aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-12-14 22:10:10 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-12-14 22:10:10 -0500
commite0aa51f54faa0659b529143de6c608e76675326f (patch)
tree22fc566b74bfe6bd612a858ba354818900cdc394 /arch
parent9f815a1765b0ce766ab1d26ef192d30410f70b2b (diff)
parent3ea6b3d0e6d0ffd91c0f8cadeb69b7133c038b32 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/include/asm/fcntl.h19
-rw-r--r--arch/alpha/kernel/osf_sys.c19
-rw-r--r--arch/arm/Kconfig5
-rw-r--r--arch/arm/Kconfig.debug8
-rw-r--r--arch/arm/configs/htcherald_defconfig9
-rw-r--r--arch/arm/configs/omap3_touchbook_defconfig2431
-rw-r--r--arch/arm/configs/omap_3430sdp_defconfig28
-rw-r--r--arch/arm/configs/omap_4430sdp_defconfig146
-rw-r--r--arch/arm/configs/omap_zoom2_defconfig3
-rw-r--r--arch/arm/configs/omap_zoom3_defconfig3
-rw-r--r--arch/arm/configs/zeus_defconfig2032
-rw-r--r--arch/arm/include/asm/mman.h3
-rw-r--r--arch/arm/kernel/Makefile1
-rw-r--r--arch/arm/kernel/calls.S2
-rw-r--r--arch/arm/kernel/early_printk.c57
-rw-r--r--arch/arm/kernel/entry-common.S4
-rw-r--r--arch/arm/kernel/smp_twd.c1
-rw-r--r--arch/arm/kernel/sys_arm.c55
-rw-r--r--arch/arm/mach-clps711x/include/mach/memory.h2
-rw-r--r--arch/arm/mach-footbridge/common.c22
-rw-r--r--arch/arm/mach-footbridge/include/mach/memory.h15
-rw-r--r--arch/arm/mach-integrator/include/mach/memory.h3
-rw-r--r--arch/arm/mach-ixp2000/include/mach/memory.h12
-rw-r--r--arch/arm/mach-ixp23xx/include/mach/memory.h19
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig22
-rw-r--r--arch/arm/mach-ixp4xx/avila-pci.c42
-rw-r--r--arch/arm/mach-ixp4xx/avila-setup.c4
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c6
-rw-r--r--arch/arm/mach-ixp4xx/common.c2
-rw-r--r--arch/arm/mach-ixp4xx/coyote-pci.c22
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c9
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-pci.c46
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c17
-rw-r--r--arch/arm/mach-ixp4xx/fsg-pci.c31
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c8
-rw-r--r--arch/arm/mach-ixp4xx/goramo_mlr.c45
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-pci.c40
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c30
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/avila.h39
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/coyote.h33
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/dsmg600.h52
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/fsg.h50
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/gtwx5715.h116
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/hardware.h18
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h307
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/irqs.h69
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/ixdp425.h39
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/nas100d.h52
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/npe.h2
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/nslu2.h55
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/prpmc1100.h33
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/timex.h2
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-pci.c43
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c12
-rw-r--r--arch/arm/mach-ixp4xx/ixp4xx_npe.c2
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-pci.c41
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c16
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-pci.c35
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c21
-rw-r--r--arch/arm/mach-lh7a40x/clocks.c8
-rw-r--r--arch/arm/mach-msm/Kconfig30
-rw-r--r--arch/arm/mach-msm/Makefile1
-rw-r--r--arch/arm/mach-msm/board-dream.c93
-rw-r--r--arch/arm/mach-msm/board-dream.h5
-rw-r--r--arch/arm/mach-msm/include/mach/debug-macro.S24
-rw-r--r--arch/arm/mach-msm/include/mach/mmc.h26
-rw-r--r--arch/arm/mach-msm/include/mach/msm_iomap.h12
-rw-r--r--arch/arm/mach-msm/include/mach/uncompress.h7
-rw-r--r--arch/arm/mach-msm/io.c3
-rw-r--r--arch/arm/mach-omap1/Makefile10
-rw-r--r--arch/arm/mach-omap1/board-fsample.c60
-rw-r--r--arch/arm/mach-omap1/board-h2.c59
-rw-r--r--arch/arm/mach-omap1/board-h3.c66
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c64
-rw-r--r--arch/arm/mach-omap1/board-innovator.c12
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c2
-rw-r--r--arch/arm/mach-omap1/board-osk.c10
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c58
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c10
-rw-r--r--arch/arm/mach-omap1/clock.c501
-rw-r--r--arch/arm/mach-omap1/clock.h652
-rw-r--r--arch/arm/mach-omap1/clock_data.c843
-rw-r--r--arch/arm/mach-omap1/i2c.c39
-rw-r--r--arch/arm/mach-omap1/include/mach/lcd_dma.h78
-rw-r--r--arch/arm/mach-omap1/include/mach/lcdc.h57
-rw-r--r--arch/arm/mach-omap1/io.c3
-rw-r--r--arch/arm/mach-omap1/lcd_dma.c448
-rw-r--r--arch/arm/mach-omap1/mux.c8
-rw-r--r--arch/arm/mach-omap1/opp.h28
-rw-r--r--arch/arm/mach-omap1/opp_data.c59
-rw-r--r--arch/arm/mach-omap2/Kconfig42
-rw-r--r--arch/arm/mach-omap2/Makefile23
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c184
-rwxr-xr-xarch/arm/mach-omap2/board-3630sdp.c14
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c11
-rw-r--r--arch/arm/mach-omap2/board-apollon.c10
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c98
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c11
-rw-r--r--arch/arm/mach-omap2/board-ldp.c12
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c23
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c21
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c43
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c572
-rw-r--r--arch/arm/mach-omap2/board-overo.c16
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c127
-rw-r--r--arch/arm/mach-omap2/board-rx51.c16
-rwxr-xr-xarch/arm/mach-omap2/board-zoom-peripherals.c14
-rw-r--r--arch/arm/mach-omap2/board-zoom2.c10
-rw-r--r--arch/arm/mach-omap2/board-zoom3.c10
-rw-r--r--arch/arm/mach-omap2/clock.c47
-rw-r--r--arch/arm/mach-omap2/clock.h50
-rw-r--r--arch/arm/mach-omap2/clock24xx.c805
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c587
-rw-r--r--arch/arm/mach-omap2/clock2xxx.h41
-rw-r--r--arch/arm/mach-omap2/clock2xxx_data.c (renamed from arch/arm/mach-omap2/clock24xx.h)836
-rw-r--r--arch/arm/mach-omap2/clock34xx.c953
-rw-r--r--arch/arm/mach-omap2/clock34xx.h2999
-rw-r--r--arch/arm/mach-omap2/clock34xx_data.c3289
-rw-r--r--arch/arm/mach-omap2/clock44xx.c33
-rw-r--r--arch/arm/mach-omap2/clock44xx.h15
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c2766
-rw-r--r--arch/arm/mach-omap2/clock_common_data.c39
-rw-r--r--arch/arm/mach-omap2/clockdomain.c6
-rw-r--r--arch/arm/mach-omap2/cm-regbits-44xx.h1474
-rw-r--r--arch/arm/mach-omap2/cm.c7
-rw-r--r--arch/arm/mach-omap2/cm.h15
-rw-r--r--arch/arm/mach-omap2/cm44xx.h358
-rw-r--r--arch/arm/mach-omap2/devices.c62
-rw-r--r--arch/arm/mach-omap2/dpll.c538
-rw-r--r--arch/arm/mach-omap2/gpmc-smc91x.c8
-rw-r--r--arch/arm/mach-omap2/gpmc.c2
-rw-r--r--arch/arm/mach-omap2/i2c.c56
-rw-r--r--arch/arm/mach-omap2/id.c31
-rw-r--r--arch/arm/mach-omap2/io.c9
-rw-r--r--arch/arm/mach-omap2/mux.c1061
-rw-r--r--arch/arm/mach-omap2/mux.h163
-rw-r--r--arch/arm/mach-omap2/mux34xx.c2099
-rw-r--r--arch/arm/mach-omap2/mux34xx.h398
-rw-r--r--arch/arm/mach-omap2/omap-headsmp.S35
-rw-r--r--arch/arm/mach-omap2/omap-smp.c31
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c164
-rw-r--r--arch/arm/mach-omap2/opp2420_data.c126
-rw-r--r--arch/arm/mach-omap2/opp2430_data.c133
-rw-r--r--arch/arm/mach-omap2/opp2xxx.h424
-rw-r--r--arch/arm/mach-omap2/pm-debug.c4
-rw-r--r--arch/arm/mach-omap2/powerdomain.c36
-rw-r--r--arch/arm/mach-omap2/powerdomains34xx.h1
-rw-r--r--arch/arm/mach-omap2/prcm-common.h73
-rw-r--r--arch/arm/mach-omap2/prcm.c13
-rw-r--r--arch/arm/mach-omap2/prm-regbits-44xx.h2205
-rw-r--r--arch/arm/mach-omap2/prm.h8
-rw-r--r--arch/arm/mach-omap2/prm44xx.h411
-rw-r--r--arch/arm/mach-omap2/sdrc.c16
-rw-r--r--arch/arm/mach-omap2/sdrc.h19
-rw-r--r--arch/arm/mach-omap2/serial.c88
-rw-r--r--arch/arm/mach-omap2/sram34xx.S19
-rw-r--r--arch/arm/mach-omap2/usb-ehci.c166
-rw-r--r--arch/arm/mach-pxa/Kconfig14
-rw-r--r--arch/arm/mach-pxa/Makefile1
-rw-r--r--arch/arm/mach-pxa/em-x270.c11
-rw-r--r--arch/arm/mach-pxa/include/mach/arcom-pcmcia.h11
-rw-r--r--arch/arm/mach-pxa/include/mach/viper.h2
-rw-r--r--arch/arm/mach-pxa/include/mach/zeus.h82
-rw-r--r--arch/arm/mach-pxa/viper.c20
-rw-r--r--arch/arm/mach-pxa/zeus.c820
-rw-r--r--arch/arm/mach-realview/Kconfig2
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/memory.h2
-rw-r--r--arch/arm/mach-sa1100/Kconfig13
-rw-r--r--arch/arm/mach-sa1100/generic.c12
-rw-r--r--arch/arm/mach-w90x900/include/mach/nuc900_spi.h35
-rw-r--r--arch/arm/mm/mmap.c3
-rw-r--r--arch/arm/plat-mxc/Makefile1
-rw-r--r--arch/arm/plat-mxc/ehci.c92
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc_ehci.h37
-rw-r--r--arch/arm/plat-omap/Kconfig63
-rw-r--r--arch/arm/plat-omap/clock.c26
-rw-r--r--arch/arm/plat-omap/common.c4
-rw-r--r--arch/arm/plat-omap/debug-devices.c10
-rw-r--r--arch/arm/plat-omap/devices.c68
-rw-r--r--arch/arm/plat-omap/dma.c410
-rw-r--r--arch/arm/plat-omap/fb.c49
-rw-r--r--arch/arm/plat-omap/i2c.c44
-rw-r--r--arch/arm/plat-omap/include/plat/board.h9
-rw-r--r--arch/arm/plat-omap/include/plat/clkdev_omap.h41
-rw-r--r--arch/arm/plat-omap/include/plat/clock.h5
-rw-r--r--arch/arm/plat-omap/include/plat/common.h35
-rw-r--r--arch/arm/plat-omap/include/plat/cpu.h31
-rw-r--r--arch/arm/plat-omap/include/plat/display.h575
-rw-r--r--arch/arm/plat-omap/include/plat/dma.h60
-rw-r--r--arch/arm/plat-omap/include/plat/gpmc.h2
-rw-r--r--arch/arm/plat-omap/include/plat/i2c.h39
-rw-r--r--arch/arm/plat-omap/include/plat/irqs.h16
-rw-r--r--arch/arm/plat-omap/include/plat/mux.h232
-rw-r--r--arch/arm/plat-omap/include/plat/omap44xx.h6
-rw-r--r--arch/arm/plat-omap/include/plat/omap_device.h8
-rw-r--r--arch/arm/plat-omap/include/plat/omap_hwmod.h26
-rw-r--r--arch/arm/plat-omap/include/plat/omapfb.h398
-rw-r--r--arch/arm/plat-omap/include/plat/powerdomain.h17
-rw-r--r--arch/arm/plat-omap/include/plat/sdrc.h9
-rw-r--r--arch/arm/plat-omap/include/plat/serial.h1
-rw-r--r--arch/arm/plat-omap/include/plat/smp.h2
-rw-r--r--arch/arm/plat-omap/include/plat/vram.h62
-rw-r--r--arch/arm/plat-omap/include/plat/vrfb.h50
-rw-r--r--arch/arm/plat-omap/mux.c8
-rw-r--r--arch/arm/plat-omap/omap_device.c18
-rw-r--r--arch/arm/plat-omap/sram.c20
-rw-r--r--arch/arm/plat-omap/usb.c8
-rw-r--r--arch/arm/vfp/vfpmodule.c83
-rw-r--r--arch/avr32/include/asm/syscalls.h4
-rw-r--r--arch/avr32/kernel/sys_avr32.c31
-rw-r--r--arch/avr32/kernel/syscall-stubs.S2
-rw-r--r--arch/blackfin/include/asm/fcntl.h2
-rw-r--r--arch/blackfin/kernel/sys_bfin.c33
-rw-r--r--arch/blackfin/mach-common/entry.S2
-rw-r--r--arch/cris/kernel/sys_cris.c30
-rw-r--r--arch/frv/kernel/sys_frv.c66
-rw-r--r--arch/h8300/kernel/sys_h8300.c83
-rw-r--r--arch/h8300/kernel/syscalls.S2
-rw-r--r--arch/ia64/Kconfig3
-rw-r--r--arch/ia64/ia32/sys_ia32.c3
-rw-r--r--arch/ia64/include/asm/meminit.h2
-rw-r--r--arch/ia64/include/asm/pgtable.h3
-rw-r--r--arch/ia64/include/asm/processor.h6
-rw-r--r--arch/ia64/include/asm/xen/hypervisor.h28
-rw-r--r--arch/ia64/kernel/acpi.c33
-rw-r--r--arch/ia64/kernel/head.S4
-rw-r--r--arch/ia64/kernel/ia64_ksyms.c2
-rw-r--r--arch/ia64/kernel/mca_asm.S2
-rw-r--r--arch/ia64/kernel/relocate_kernel.S2
-rw-r--r--arch/ia64/kernel/setup.c27
-rw-r--r--arch/ia64/kernel/sys_ia64.c83
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S11
-rw-r--r--arch/ia64/mm/contig.c99
-rw-r--r--arch/ia64/mm/discontig.c129
-rw-r--r--arch/ia64/mm/init.c4
-rw-r--r--arch/ia64/pci/pci.c33
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c8
-rw-r--r--arch/ia64/xen/irq_xen.c131
-rw-r--r--arch/ia64/xen/time.c22
-rw-r--r--arch/m32r/kernel/sys_m32r.c24
-rw-r--r--arch/m32r/kernel/syscall_table.S2
-rw-r--r--arch/m68k/include/asm/pgtable_mm.h4
-rw-r--r--arch/m68k/kernel/sys_m68k.c83
-rw-r--r--arch/m68k/sun3/mmu_emu.c8
-rw-r--r--arch/m68knommu/kernel/sys_m68k.c38
-rw-r--r--arch/m68knommu/kernel/syscalltable.S2
-rw-r--r--arch/microblaze/Kconfig19
-rw-r--r--arch/microblaze/Kconfig.debug3
-rw-r--r--arch/microblaze/Makefile2
-rw-r--r--arch/microblaze/boot/Makefile15
-rw-r--r--arch/microblaze/include/asm/cache.h16
-rw-r--r--arch/microblaze/include/asm/cacheflush.h123
-rw-r--r--arch/microblaze/include/asm/cpuinfo.h5
-rw-r--r--arch/microblaze/include/asm/device.h12
-rw-r--r--arch/microblaze/include/asm/ftrace.h25
-rw-r--r--arch/microblaze/include/asm/futex.h127
-rw-r--r--arch/microblaze/include/asm/irqflags.h112
-rw-r--r--arch/microblaze/include/asm/page.h3
-rw-r--r--arch/microblaze/include/asm/pgalloc.h9
-rw-r--r--arch/microblaze/include/asm/pvr.h30
-rw-r--r--arch/microblaze/include/asm/setup.h2
-rw-r--r--arch/microblaze/include/asm/system.h2
-rw-r--r--arch/microblaze/include/asm/uaccess.h12
-rw-r--r--arch/microblaze/kernel/Makefile14
-rw-r--r--arch/microblaze/kernel/cpu/Makefile4
-rw-r--r--arch/microblaze/kernel/cpu/cache.c663
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c15
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo-static.c17
-rw-r--r--arch/microblaze/kernel/cpu/cpuinfo.c7
-rw-r--r--arch/microblaze/kernel/cpu/mb.c8
-rw-r--r--arch/microblaze/kernel/cpu/pvr.c2
-rw-r--r--arch/microblaze/kernel/entry-nommu.S2
-rw-r--r--arch/microblaze/kernel/entry.S19
-rw-r--r--arch/microblaze/kernel/ftrace.c237
-rw-r--r--arch/microblaze/kernel/heartbeat.c15
-rw-r--r--arch/microblaze/kernel/intc.c10
-rw-r--r--arch/microblaze/kernel/mcount.S170
-rw-r--r--arch/microblaze/kernel/microblaze_ksyms.c5
-rw-r--r--arch/microblaze/kernel/process.c1
-rw-r--r--arch/microblaze/kernel/reset.c140
-rw-r--r--arch/microblaze/kernel/setup.c40
-rw-r--r--arch/microblaze/kernel/signal.c35
-rw-r--r--arch/microblaze/kernel/stacktrace.c65
-rw-r--r--arch/microblaze/kernel/sys_microblaze.c38
-rw-r--r--arch/microblaze/kernel/syscall_table.S6
-rw-r--r--arch/microblaze/kernel/timer.c28
-rw-r--r--arch/microblaze/kernel/vmlinux.lds.S6
-rw-r--r--arch/microblaze/lib/uaccess.c7
-rw-r--r--arch/microblaze/mm/init.c1
-rw-r--r--arch/microblaze/mm/pgtable.c10
-rw-r--r--arch/microblaze/oprofile/Makefile13
-rw-r--r--arch/microblaze/oprofile/microblaze_oprofile.c22
-rw-r--r--arch/microblaze/platform/Kconfig.platform21
-rw-r--r--arch/microblaze/platform/generic/Kconfig.auto29
-rw-r--r--arch/microblaze/platform/generic/system.dts38
-rw-r--r--arch/microblaze/platform/platform.c2
-rw-r--r--arch/mips/include/asm/fcntl.h17
-rw-r--r--arch/mips/kernel/kspd.c1
-rw-r--r--arch/mips/kernel/linux32.c19
-rw-r--r--arch/mips/kernel/syscall.c32
-rw-r--r--arch/mips/loongson/common/mem.c2
-rw-r--r--arch/mips/mm/cache.c2
-rw-r--r--arch/mn10300/include/asm/mman.h5
-rw-r--r--arch/mn10300/kernel/entry.S2
-rw-r--r--arch/mn10300/kernel/kprobes.c61
-rw-r--r--arch/mn10300/kernel/sys_mn10300.c36
-rw-r--r--arch/parisc/include/asm/fcntl.h5
-rw-r--r--arch/parisc/kernel/sys_parisc.c30
-rw-r--r--arch/powerpc/Kconfig49
-rw-r--r--arch/powerpc/boot/dts/canyonlands.dts2
-rw-r--r--arch/powerpc/boot/dts/eiger.dts6
-rw-r--r--arch/powerpc/boot/dts/gef_ppc9a.dts6
-rw-r--r--arch/powerpc/boot/dts/gef_sbc310.dts6
-rw-r--r--arch/powerpc/boot/dts/gef_sbc610.dts6
-rw-r--r--arch/powerpc/boot/dts/glacier.dts6
-rw-r--r--arch/powerpc/boot/dts/haleakala.dts2
-rw-r--r--arch/powerpc/boot/dts/katmai.dts36
-rw-r--r--arch/powerpc/boot/dts/kilauea.dts4
-rw-r--r--arch/powerpc/boot/dts/kmeter1.dts7
-rw-r--r--arch/powerpc/boot/dts/makalu.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc832x_mds.dts9
-rw-r--r--arch/powerpc/boot/dts/mpc832x_rdb.dts9
-rw-r--r--arch/powerpc/boot/dts/mpc836x_mds.dts9
-rw-r--r--arch/powerpc/boot/dts/mpc836x_rdk.dts9
-rw-r--r--arch/powerpc/boot/dts/mpc8568mds.dts119
-rw-r--r--arch/powerpc/boot/dts/mpc8569mds.dts111
-rw-r--r--arch/powerpc/boot/dts/mpc8610_hpcd.dts26
-rw-r--r--arch/powerpc/boot/dts/p1020rdb.dts477
-rw-r--r--arch/powerpc/boot/dts/p2020rdb_camp_core0.dts363
-rw-r--r--arch/powerpc/boot/dts/p2020rdb_camp_core1.dts184
-rw-r--r--arch/powerpc/boot/dts/p4080ds.dts554
-rw-r--r--arch/powerpc/boot/dts/redwood.dts1
-rw-r--r--arch/powerpc/boot/dts/yosemite.dts14
-rw-r--r--arch/powerpc/configs/86xx/gef_ppc9a_defconfig2
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc310_defconfig2
-rw-r--r--arch/powerpc/configs/86xx/gef_sbc610_defconfig4
-rw-r--r--arch/powerpc/include/asm/cpm.h82
-rw-r--r--arch/powerpc/include/asm/cpm1.h45
-rw-r--r--arch/powerpc/include/asm/cpm2.h47
-rw-r--r--arch/powerpc/include/asm/exception-64s.h2
-rw-r--r--arch/powerpc/include/asm/hugetlb.h27
-rw-r--r--arch/powerpc/include/asm/hvcall.h13
-rw-r--r--arch/powerpc/include/asm/hw_irq.h5
-rw-r--r--arch/powerpc/include/asm/immap_cpm2.h2
-rw-r--r--arch/powerpc/include/asm/immap_qe.h8
-rw-r--r--arch/powerpc/include/asm/irq.h13
-rw-r--r--arch/powerpc/include/asm/kvm.h18
-rw-r--r--arch/powerpc/include/asm/kvm_asm.h40
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h139
-rw-r--r--arch/powerpc/include/asm/kvm_book3s_64_asm.h58
-rw-r--r--arch/powerpc/include/asm/kvm_host.h79
-rw-r--r--arch/powerpc/include/asm/kvm_ppc.h1
-rw-r--r--arch/powerpc/include/asm/lppaca.h9
-rw-r--r--arch/powerpc/include/asm/machdep.h5
-rw-r--r--arch/powerpc/include/asm/macio.h6
-rw-r--r--arch/powerpc/include/asm/mediabay.h27
-rw-r--r--arch/powerpc/include/asm/mmu-hash64.h50
-rw-r--r--arch/powerpc/include/asm/mmu_context.h2
-rw-r--r--arch/powerpc/include/asm/mpc52xx.h47
-rw-r--r--arch/powerpc/include/asm/nvram.h1
-rw-r--r--arch/powerpc/include/asm/pSeries_reconfig.h1
-rw-r--r--arch/powerpc/include/asm/paca.h9
-rw-r--r--arch/powerpc/include/asm/page.h14
-rw-r--r--arch/powerpc/include/asm/page_64.h2
-rw-r--r--arch/powerpc/include/asm/pgalloc-32.h10
-rw-r--r--arch/powerpc/include/asm/pgalloc-64.h63
-rw-r--r--arch/powerpc/include/asm/pgalloc.h30
-rw-r--r--arch/powerpc/include/asm/pgtable-ppc64.h14
-rw-r--r--arch/powerpc/include/asm/pgtable.h3
-rw-r--r--arch/powerpc/include/asm/pte-8xx.h14
-rw-r--r--arch/powerpc/include/asm/pte-hash64-64k.h37
-rw-r--r--arch/powerpc/include/asm/qe.h43
-rw-r--r--arch/powerpc/include/asm/smp.h2
-rw-r--r--arch/powerpc/include/asm/systbl.h2
-rw-r--r--arch/powerpc/kernel/Makefile3
-rw-r--r--arch/powerpc/kernel/asm-offsets.c21
-rw-r--r--arch/powerpc/kernel/crash.c2
-rw-r--r--arch/powerpc/kernel/dma-swiotlb.c1
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S8
-rw-r--r--arch/powerpc/kernel/head_64.S7
-rw-r--r--arch/powerpc/kernel/head_8xx.S313
-rw-r--r--arch/powerpc/kernel/head_fsl_booke.S22
-rw-r--r--arch/powerpc/kernel/io.c4
-rw-r--r--arch/powerpc/kernel/irq.c137
-rw-r--r--arch/powerpc/kernel/lparcfg.c4
-rw-r--r--arch/powerpc/kernel/misc_32.S18
-rw-r--r--arch/powerpc/kernel/nvram_64.c56
-rw-r--r--arch/powerpc/kernel/perf_callchain.c24
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c3
-rw-r--r--arch/powerpc/kernel/proc_powerpc.c (renamed from arch/powerpc/kernel/proc_ppc64.c)102
-rw-r--r--arch/powerpc/kernel/rtas_flash.c10
-rw-r--r--arch/powerpc/kernel/rtasd.c (renamed from arch/powerpc/platforms/pseries/rtasd.c)48
-rw-r--r--arch/powerpc/kernel/setup-common.c4
-rw-r--r--arch/powerpc/kernel/setup_64.c5
-rw-r--r--arch/powerpc/kernel/smp.c5
-rw-r--r--arch/powerpc/kernel/syscalls.c15
-rw-r--r--arch/powerpc/kernel/sysfs.c19
-rw-r--r--arch/powerpc/kernel/time.c1
-rw-r--r--arch/powerpc/kernel/traps.c22
-rw-r--r--arch/powerpc/kernel/vector.S2
-rw-r--r--arch/powerpc/kvm/Kconfig17
-rw-r--r--arch/powerpc/kvm/Makefile27
-rw-r--r--arch/powerpc/kvm/book3s.c974
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu.c372
-rw-r--r--arch/powerpc/kvm/book3s_64_emulate.c345
-rw-r--r--arch/powerpc/kvm/book3s_64_exports.c24
-rw-r--r--arch/powerpc/kvm/book3s_64_interrupts.S392
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu.c478
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c408
-rw-r--r--arch/powerpc/kvm/book3s_64_rmhandlers.S131
-rw-r--r--arch/powerpc/kvm/book3s_64_slb.S262
-rw-r--r--arch/powerpc/kvm/booke.c5
-rw-r--r--arch/powerpc/kvm/emulate.c66
-rw-r--r--arch/powerpc/kvm/powerpc.c28
-rw-r--r--arch/powerpc/kvm/timing.c1
-rw-r--r--arch/powerpc/kvm/trace.h6
-rw-r--r--arch/powerpc/lib/copy_32.S24
-rw-r--r--arch/powerpc/mm/Makefile5
-rw-r--r--arch/powerpc/mm/fault.c8
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c132
-rw-r--r--arch/powerpc/mm/gup.c149
-rw-r--r--arch/powerpc/mm/hash_utils_64.c46
-rw-r--r--arch/powerpc/mm/hugetlbpage-hash64.c139
-rw-r--r--arch/powerpc/mm/hugetlbpage.c792
-rw-r--r--arch/powerpc/mm/init_64.c76
-rw-r--r--arch/powerpc/mm/mem.c17
-rw-r--r--arch/powerpc/mm/mmu_context_hash64.c26
-rw-r--r--arch/powerpc/mm/mmu_decl.h11
-rw-r--r--arch/powerpc/mm/pgtable.c25
-rw-r--r--arch/powerpc/mm/subpage-prot.c15
-rw-r--r--arch/powerpc/mm/tlb_hash64.c8
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_ads_cpld.c4
-rw-r--r--arch/powerpc/platforms/52xx/Kconfig5
-rw-r--r--arch/powerpc/platforms/52xx/Makefile1
-rw-r--r--arch/powerpc/platforms/52xx/media5200.c6
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpt.c432
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c560
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pic.c10
-rw-r--r--arch/powerpc/platforms/82xx/pq2ads-pci-pic.c3
-rw-r--r--arch/powerpc/platforms/83xx/mpc832x_rdb.c2
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c1
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig23
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.c125
-rw-r--r--arch/powerpc/platforms/85xx/corenet_ds.h19
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_rdb.c34
-rw-r--r--arch/powerpc/platforms/85xx/p4080_ds.c74
-rw-r--r--arch/powerpc/platforms/85xx/socrates_fpga_pic.c6
-rw-r--r--arch/powerpc/platforms/86xx/Kconfig3
-rw-r--r--arch/powerpc/platforms/86xx/gef_pic.c6
-rw-r--r--arch/powerpc/platforms/86xx/gef_ppc9a.c5
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc310.c5
-rw-r--r--arch/powerpc/platforms/86xx/gef_sbc610.c5
-rw-r--r--arch/powerpc/platforms/86xx/mpc8610_hpcd.c48
-rw-r--r--arch/powerpc/platforms/8xx/m8xx_setup.c2
-rw-r--r--arch/powerpc/platforms/Kconfig9
-rw-r--r--arch/powerpc/platforms/Kconfig.cputype17
-rw-r--r--arch/powerpc/platforms/Makefile2
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c2
-rw-r--r--arch/powerpc/platforms/cell/beat_interrupt.c8
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c20
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c8
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c2
-rw-r--r--arch/powerpc/platforms/chrp/Kconfig2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c50
-rw-r--r--arch/powerpc/platforms/iseries/htab.c8
-rw-r--r--arch/powerpc/platforms/iseries/irq.c4
-rw-r--r--arch/powerpc/platforms/powermac/pic.c12
-rw-r--r--arch/powerpc/platforms/ps3/interrupt.c2
-rw-r--r--arch/powerpc/platforms/ps3/mm.c2
-rw-r--r--arch/powerpc/platforms/pseries/Kconfig3
-rw-r--r--arch/powerpc/platforms/pseries/Makefile4
-rw-r--r--arch/powerpc/platforms/pseries/cmm.c29
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c558
-rw-r--r--arch/powerpc/platforms/pseries/dtl.c4
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c18
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c182
-rw-r--r--arch/powerpc/platforms/pseries/offline_states.h18
-rw-r--r--arch/powerpc/platforms/pseries/plpar_wrappers.h22
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c8
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c4
-rw-r--r--arch/powerpc/platforms/pseries/smp.c19
-rw-r--r--arch/powerpc/platforms/pseries/xics.c70
-rw-r--r--arch/powerpc/sysdev/Makefile1
-rw-r--r--arch/powerpc/sysdev/cpm1.c4
-rw-r--r--arch/powerpc/sysdev/cpm2_pic.c14
-rw-r--r--arch/powerpc/sysdev/cpm_common.c5
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c4
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c18
-rw-r--r--arch/powerpc/sysdev/fsl_pmc.c88
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c2
-rw-r--r--arch/powerpc/sysdev/i8259.c8
-rw-r--r--arch/powerpc/sysdev/ipic.c8
-rw-r--r--arch/powerpc/sysdev/mpc8xx_pic.c6
-rw-r--r--arch/powerpc/sysdev/mpic.c26
-rw-r--r--arch/powerpc/sysdev/mpic_pasemi_msi.c2
-rw-r--r--arch/powerpc/sysdev/mpic_u3msi.c2
-rw-r--r--arch/powerpc/sysdev/mv64x60_pic.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c61
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c8
-rw-r--r--arch/powerpc/sysdev/tsi108_pci.c6
-rw-r--r--arch/powerpc/sysdev/uic.c10
-rw-r--r--arch/powerpc/sysdev/xilinx_intc.c8
-rw-r--r--arch/powerpc/xmon/xmon.c3
-rw-r--r--arch/s390/kernel/compat_linux.c37
-rw-r--r--arch/s390/kernel/sys_s390.c30
-rw-r--r--arch/score/kernel/sys_score.c28
-rw-r--r--arch/sh/kernel/sys_sh.c28
-rw-r--r--arch/sh/mm/mmap.c3
-rw-r--r--arch/sparc/include/asm/fcntl.h19
-rw-r--r--arch/sparc/include/asm/pci_64.h2
-rw-r--r--arch/sparc/kernel/nmi.c8
-rw-r--r--arch/sparc/kernel/pci.c7
-rw-r--r--arch/sparc/kernel/sys_sparc32.c22
-rw-r--r--arch/sparc/kernel/sys_sparc_32.c64
-rw-r--r--arch/sparc/kernel/sys_sparc_64.c50
-rw-r--r--arch/sparc/kernel/systbls.h1
-rw-r--r--arch/sparc/kernel/systbls_32.S4
-rw-r--r--arch/sparc/kernel/systbls_64.S6
-rw-r--r--arch/um/kernel/syscall.c28
-rw-r--r--arch/um/sys-i386/shared/sysdep/syscalls.h4
-rw-r--r--arch/x86/Kconfig.debug4
-rw-r--r--arch/x86/ia32/ia32entry.S2
-rw-r--r--arch/x86/ia32/sys_ia32.c43
-rw-r--r--arch/x86/include/asm/amd_iommu_proto.h4
-rw-r--r--arch/x86/include/asm/irq_vectors.h2
-rw-r--r--arch/x86/include/asm/msr.h3
-rw-r--r--arch/x86/include/asm/pci_x86.h20
-rw-r--r--arch/x86/include/asm/percpu.h104
-rw-r--r--arch/x86/include/asm/sys_ia32.h3
-rw-r--r--arch/x86/include/asm/syscalls.h2
-rw-r--r--arch/x86/include/asm/system.h1
-rw-r--r--arch/x86/include/asm/trampoline.h1
-rw-r--r--arch/x86/include/asm/xen/hypervisor.h27
-rw-r--r--arch/x86/kernel/amd_iommu.c46
-rw-r--r--arch/x86/kernel/amd_iommu_init.c12
-rw-r--r--arch/x86/kernel/aperture_64.c11
-rw-r--r--arch/x86/kernel/apic/apic.c2
-rw-r--r--arch/x86/kernel/apic/apic_noop.c2
-rw-r--r--arch/x86/kernel/apic/es7000_32.c12
-rw-r--r--arch/x86/kernel/apic/nmi.c8
-rw-r--r--arch/x86/kernel/cpu/addon_cpuid_features.c15
-rw-r--r--arch/x86/kernel/cpu/amd.c2
-rw-r--r--arch/x86/kernel/cpu/common.c16
-rw-r--r--arch/x86/kernel/cpu/cpu_debug.c30
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c45
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k6.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k7.c19
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c32
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-ich.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-lib.c6
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-lib.h24
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-smi.c2
-rw-r--r--arch/x86/kernel/cpu/intel.c2
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c67
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c5
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c20
-rw-r--r--arch/x86/kernel/cpu/perf_event.c31
-rw-r--r--arch/x86/kernel/ds.c4
-rw-r--r--arch/x86/kernel/dumpstack_64.c33
-rw-r--r--arch/x86/kernel/e820.c11
-rw-r--r--arch/x86/kernel/entry_64.S6
-rw-r--r--arch/x86/kernel/head32.c2
-rw-r--r--arch/x86/kernel/head64.c2
-rw-r--r--arch/x86/kernel/hw_breakpoint.c5
-rw-r--r--arch/x86/kernel/kgdb.c14
-rw-r--r--arch/x86/kernel/microcode_amd.c40
-rw-r--r--arch/x86/kernel/microcode_core.c26
-rw-r--r--arch/x86/kernel/microcode_intel.c47
-rw-r--r--arch/x86/kernel/mpparse.c3
-rw-r--r--arch/x86/kernel/pci-dma.c5
-rw-r--r--arch/x86/kernel/pci-gart_64.c3
-rw-r--r--arch/x86/kernel/process.c21
-rw-r--r--arch/x86/kernel/process_32.c14
-rw-r--r--arch/x86/kernel/process_64.c16
-rw-r--r--arch/x86/kernel/ptrace.c68
-rw-r--r--arch/x86/kernel/reboot.c8
-rw-r--r--arch/x86/kernel/setup.c13
-rw-r--r--arch/x86/kernel/setup_percpu.c13
-rw-r--r--arch/x86/kernel/smpboot.c49
-rw-r--r--arch/x86/kernel/sys_i386_32.c27
-rw-r--r--arch/x86/kernel/sys_x86_64.c17
-rw-r--r--arch/x86/kernel/syscall_table_32.S2
-rw-r--r--arch/x86/kernel/trampoline.c20
-rw-r--r--arch/x86/kvm/i8254.c12
-rw-r--r--arch/x86/kvm/svm.c64
-rw-r--r--arch/x86/lib/Makefile4
-rw-r--r--arch/x86/lib/msr.c26
-rw-r--r--arch/x86/mm/kmmio.c42
-rw-r--r--arch/x86/mm/mmio-mod.c71
-rw-r--r--arch/x86/mm/pat.c3
-rw-r--r--arch/x86/pci/Makefile5
-rw-r--r--arch/x86/pci/acpi.c74
-rw-r--r--arch/x86/pci/amd_bus.c120
-rw-r--r--arch/x86/pci/bus_numa.c101
-rw-r--r--arch/x86/pci/bus_numa.h27
-rw-r--r--arch/x86/pci/common.c20
-rw-r--r--arch/x86/pci/early.c7
-rw-r--r--arch/x86/pci/i386.c42
-rw-r--r--arch/x86/pci/intel_bus.c90
-rw-r--r--arch/x86/pci/mmconfig-shared.c356
-rw-r--r--arch/x86/pci/mmconfig_32.c16
-rw-r--r--arch/x86/pci/mmconfig_64.c88
-rw-r--r--arch/x86/tools/test_get_len.c2
-rw-r--r--arch/x86/xen/enlighten.c33
-rw-r--r--arch/x86/xen/mmu.c2
-rw-r--r--arch/x86/xen/smp.c42
-rw-r--r--arch/x86/xen/suspend.c17
-rw-r--r--arch/x86/xen/time.c31
-rw-r--r--arch/x86/xen/xen-asm_64.S4
-rw-r--r--arch/x86/xen/xen-ops.h2
-rw-r--r--arch/xtensa/include/asm/syscall.h2
-rw-r--r--arch/xtensa/include/asm/unistd.h2
-rw-r--r--arch/xtensa/kernel/syscall.c25
-rw-r--r--arch/xtensa/platforms/iss/console.c2
618 files changed, 40864 insertions, 14102 deletions
diff --git a/arch/alpha/include/asm/fcntl.h b/arch/alpha/include/asm/fcntl.h
index 25da0017ec87..21b1117a0c61 100644
--- a/arch/alpha/include/asm/fcntl.h
+++ b/arch/alpha/include/asm/fcntl.h
@@ -1,8 +1,6 @@
1#ifndef _ALPHA_FCNTL_H 1#ifndef _ALPHA_FCNTL_H
2#define _ALPHA_FCNTL_H 2#define _ALPHA_FCNTL_H
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_CREAT 01000 /* not fcntl */ 4#define O_CREAT 01000 /* not fcntl */
7#define O_TRUNC 02000 /* not fcntl */ 5#define O_TRUNC 02000 /* not fcntl */
8#define O_EXCL 04000 /* not fcntl */ 6#define O_EXCL 04000 /* not fcntl */
@@ -10,13 +8,28 @@
10 8
11#define O_NONBLOCK 00004 9#define O_NONBLOCK 00004
12#define O_APPEND 00010 10#define O_APPEND 00010
13#define O_SYNC 040000 11#define O_DSYNC 040000 /* used to be O_SYNC, see below */
14#define O_DIRECTORY 0100000 /* must be a directory */ 12#define O_DIRECTORY 0100000 /* must be a directory */
15#define O_NOFOLLOW 0200000 /* don't follow links */ 13#define O_NOFOLLOW 0200000 /* don't follow links */
16#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */ 14#define O_LARGEFILE 0400000 /* will be set by the kernel on every open */
17#define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */ 15#define O_DIRECT 02000000 /* direct disk access - should check with OSF/1 */
18#define O_NOATIME 04000000 16#define O_NOATIME 04000000
19#define O_CLOEXEC 010000000 /* set close_on_exec */ 17#define O_CLOEXEC 010000000 /* set close_on_exec */
18/*
19 * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using
20 * the O_SYNC flag. We continue to use the existing numerical value
21 * for O_DSYNC semantics now, but using the correct symbolic name for it.
22 * This new value is used to request true Posix O_SYNC semantics. It is
23 * defined in this strange way to make sure applications compiled against
24 * new headers get at least O_DSYNC semantics on older kernels.
25 *
26 * This has the nice side-effect that we can simply test for O_DSYNC
27 * wherever we do not care if O_DSYNC or O_SYNC is used.
28 *
29 * Note: __O_SYNC must never be used directly.
30 */
31#define __O_SYNC 020000000
32#define O_SYNC (__O_SYNC|O_DSYNC)
20 33
21#define F_GETLK 7 34#define F_GETLK 7
22#define F_SETLK 8 35#define F_SETLK 8
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 9a3334ae282e..62619f25132f 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -178,25 +178,18 @@ SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len,
178 unsigned long, prot, unsigned long, flags, unsigned long, fd, 178 unsigned long, prot, unsigned long, flags, unsigned long, fd,
179 unsigned long, off) 179 unsigned long, off)
180{ 180{
181 struct file *file = NULL; 181 unsigned long ret = -EINVAL;
182 unsigned long ret = -EBADF;
183 182
184#if 0 183#if 0
185 if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED)) 184 if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED))
186 printk("%s: unimplemented OSF mmap flags %04lx\n", 185 printk("%s: unimplemented OSF mmap flags %04lx\n",
187 current->comm, flags); 186 current->comm, flags);
188#endif 187#endif
189 if (!(flags & MAP_ANONYMOUS)) { 188 if ((off + PAGE_ALIGN(len)) < off)
190 file = fget(fd); 189 goto out;
191 if (!file) 190 if (off & ~PAGE_MASK)
192 goto out; 191 goto out;
193 } 192 ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
194 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
195 down_write(&current->mm->mmap_sem);
196 ret = do_mmap(file, addr, len, prot, flags, off);
197 up_write(&current->mm->mmap_sem);
198 if (file)
199 fput(file);
200 out: 193 out:
201 return ret; 194 return ret;
202} 195}
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index cf8a99f19dc4..233a222752c0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -603,6 +603,7 @@ config ARCH_SA1100
603 select ARCH_SPARSEMEM_ENABLE 603 select ARCH_SPARSEMEM_ENABLE
604 select ARCH_MTD_XIP 604 select ARCH_MTD_XIP
605 select ARCH_HAS_CPUFREQ 605 select ARCH_HAS_CPUFREQ
606 select CPU_FREQ
606 select GENERIC_GPIO 607 select GENERIC_GPIO
607 select GENERIC_TIME 608 select GENERIC_TIME
608 select GENERIC_CLOCKEVENTS 609 select GENERIC_CLOCKEVENTS
@@ -1359,13 +1360,9 @@ source "drivers/cpufreq/Kconfig"
1359 1360
1360config CPU_FREQ_SA1100 1361config CPU_FREQ_SA1100
1361 bool 1362 bool
1362 depends on CPU_FREQ && (SA1100_H3100 || SA1100_H3600 || SA1100_LART || SA1100_PLEB || SA1100_BADGE4 || SA1100_HACKKIT)
1363 default y
1364 1363
1365config CPU_FREQ_SA1110 1364config CPU_FREQ_SA1110
1366 bool 1365 bool
1367 depends on CPU_FREQ && (SA1100_ASSABET || SA1100_CERF || SA1100_PT_SYSTEM3)
1368 default y
1369 1366
1370config CPU_FREQ_INTEGRATOR 1367config CPU_FREQ_INTEGRATOR
1371 tristate "CPUfreq driver for ARM Integrator CPUs" 1368 tristate "CPUfreq driver for ARM Integrator CPUs"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index ff54c23d085e..5cb9326df7a7 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -71,6 +71,14 @@ config DEBUG_LL
71 in the kernel. This is helpful if you are debugging code that 71 in the kernel. This is helpful if you are debugging code that
72 executes before the console is initialized. 72 executes before the console is initialized.
73 73
74config EARLY_PRINTK
75 bool "Early printk"
76 depends on DEBUG_LL
77 help
78 Say Y here if you want to have an early console using the
79 kernel low-level debugging functions. Add earlyprintk to your
80 kernel parameters to enable this console.
81
74config DEBUG_ICEDCC 82config DEBUG_ICEDCC
75 bool "Kernel low-level debugging via EmbeddedICE DCC channel" 83 bool "Kernel low-level debugging via EmbeddedICE DCC channel"
76 depends on DEBUG_LL 84 depends on DEBUG_LL
diff --git a/arch/arm/configs/htcherald_defconfig b/arch/arm/configs/htcherald_defconfig
index 338267674075..1b39691b816f 100644
--- a/arch/arm/configs/htcherald_defconfig
+++ b/arch/arm/configs/htcherald_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.32-rc6 3# Linux kernel version: 2.6.32-rc8
4# Sat Nov 14 10:56:01 2009 4# Sat Dec 5 12:16:24 2009
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -198,7 +198,9 @@ CONFIG_ARCH_OMAP1=y
198# OMAP Feature Selections 198# OMAP Feature Selections
199# 199#
200# CONFIG_OMAP_RESET_CLOCKS is not set 200# CONFIG_OMAP_RESET_CLOCKS is not set
201# CONFIG_OMAP_MUX is not set 201CONFIG_OMAP_MUX=y
202# CONFIG_OMAP_MUX_DEBUG is not set
203CONFIG_OMAP_MUX_WARNINGS=y
202CONFIG_OMAP_MCBSP=y 204CONFIG_OMAP_MCBSP=y
203# CONFIG_OMAP_MBOX_FWK is not set 205# CONFIG_OMAP_MBOX_FWK is not set
204CONFIG_OMAP_MPU_TIMER=y 206CONFIG_OMAP_MPU_TIMER=y
@@ -207,6 +209,7 @@ CONFIG_OMAP_LL_DEBUG_UART1=y
207# CONFIG_OMAP_LL_DEBUG_UART2 is not set 209# CONFIG_OMAP_LL_DEBUG_UART2 is not set
208# CONFIG_OMAP_LL_DEBUG_UART3 is not set 210# CONFIG_OMAP_LL_DEBUG_UART3 is not set
209# CONFIG_OMAP_LL_DEBUG_NONE is not set 211# CONFIG_OMAP_LL_DEBUG_NONE is not set
212CONFIG_OMAP_SERIAL_WAKE=y
210# CONFIG_OMAP_PM_NONE is not set 213# CONFIG_OMAP_PM_NONE is not set
211CONFIG_OMAP_PM_NOOP=y 214CONFIG_OMAP_PM_NOOP=y
212 215
diff --git a/arch/arm/configs/omap3_touchbook_defconfig b/arch/arm/configs/omap3_touchbook_defconfig
new file mode 100644
index 000000000000..7c8515e65c02
--- /dev/null
+++ b/arch/arm/configs/omap3_touchbook_defconfig
@@ -0,0 +1,2431 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.32-rc8
4# Fri Dec 4 16:02:17 2009
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_GENERIC_HARDIRQS=y
12CONFIG_STACKTRACE_SUPPORT=y
13CONFIG_HAVE_LATENCYTOP_SUPPORT=y
14CONFIG_LOCKDEP_SUPPORT=y
15CONFIG_TRACE_IRQFLAGS_SUPPORT=y
16CONFIG_HARDIRQS_SW_RESEND=y
17CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_RWSEM_GENERIC_SPINLOCK=y
19CONFIG_ARCH_HAS_CPUFREQ=y
20CONFIG_GENERIC_HWEIGHT=y
21CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
23CONFIG_OPROFILE_ARMV7=y
24CONFIG_VECTORS_BASE=0xffff0000
25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
26CONFIG_CONSTRUCTORS=y
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_LOCK_KERNEL=y
34CONFIG_INIT_ENV_ARG_LIMIT=32
35CONFIG_LOCALVERSION=""
36# CONFIG_LOCALVERSION_AUTO is not set
37CONFIG_SWAP=y
38CONFIG_SYSVIPC=y
39CONFIG_SYSVIPC_SYSCTL=y
40# CONFIG_POSIX_MQUEUE is not set
41CONFIG_BSD_PROCESS_ACCT=y
42# CONFIG_BSD_PROCESS_ACCT_V3 is not set
43CONFIG_TASKSTATS=y
44CONFIG_TASK_DELAY_ACCT=y
45CONFIG_TASK_XACCT=y
46CONFIG_TASK_IO_ACCOUNTING=y
47# CONFIG_AUDIT is not set
48
49#
50# RCU Subsystem
51#
52CONFIG_TREE_RCU=y
53# CONFIG_TREE_PREEMPT_RCU is not set
54# CONFIG_RCU_TRACE is not set
55CONFIG_RCU_FANOUT=32
56# CONFIG_RCU_FANOUT_EXACT is not set
57# CONFIG_TREE_RCU_TRACE is not set
58CONFIG_IKCONFIG=y
59CONFIG_IKCONFIG_PROC=y
60CONFIG_LOG_BUF_SHIFT=15
61CONFIG_GROUP_SCHED=y
62CONFIG_FAIR_GROUP_SCHED=y
63# CONFIG_RT_GROUP_SCHED is not set
64CONFIG_USER_SCHED=y
65# CONFIG_CGROUP_SCHED is not set
66# CONFIG_CGROUPS is not set
67# CONFIG_SYSFS_DEPRECATED_V2 is not set
68# CONFIG_RELAY is not set
69# CONFIG_NAMESPACES is not set
70CONFIG_BLK_DEV_INITRD=y
71CONFIG_INITRAMFS_SOURCE=""
72CONFIG_RD_GZIP=y
73# CONFIG_RD_BZIP2 is not set
74# CONFIG_RD_LZMA is not set
75CONFIG_CC_OPTIMIZE_FOR_SIZE=y
76CONFIG_SYSCTL=y
77CONFIG_ANON_INODES=y
78CONFIG_EMBEDDED=y
79CONFIG_UID16=y
80# CONFIG_SYSCTL_SYSCALL is not set
81CONFIG_KALLSYMS=y
82# CONFIG_KALLSYMS_ALL is not set
83# CONFIG_KALLSYMS_EXTRA_PASS is not set
84CONFIG_HOTPLUG=y
85CONFIG_PRINTK=y
86CONFIG_BUG=y
87# CONFIG_ELF_CORE is not set
88CONFIG_BASE_FULL=y
89CONFIG_FUTEX=y
90CONFIG_EPOLL=y
91CONFIG_SIGNALFD=y
92CONFIG_TIMERFD=y
93CONFIG_EVENTFD=y
94CONFIG_SHMEM=y
95CONFIG_AIO=y
96
97#
98# Kernel Performance Events And Counters
99#
100CONFIG_VM_EVENT_COUNTERS=y
101# CONFIG_COMPAT_BRK is not set
102CONFIG_SLAB=y
103# CONFIG_SLUB is not set
104# CONFIG_SLOB is not set
105CONFIG_PROFILING=y
106CONFIG_TRACEPOINTS=y
107CONFIG_OPROFILE=y
108CONFIG_HAVE_OPROFILE=y
109# CONFIG_KPROBES is not set
110CONFIG_HAVE_KPROBES=y
111CONFIG_HAVE_KRETPROBES=y
112CONFIG_HAVE_CLK=y
113
114#
115# GCOV-based kernel profiling
116#
117# CONFIG_GCOV_KERNEL is not set
118CONFIG_SLOW_WORK=y
119CONFIG_HAVE_GENERIC_DMA_COHERENT=y
120CONFIG_SLABINFO=y
121CONFIG_RT_MUTEXES=y
122CONFIG_BASE_SMALL=0
123CONFIG_MODULES=y
124CONFIG_MODULE_FORCE_LOAD=y
125CONFIG_MODULE_UNLOAD=y
126CONFIG_MODULE_FORCE_UNLOAD=y
127CONFIG_MODVERSIONS=y
128CONFIG_MODULE_SRCVERSION_ALL=y
129CONFIG_BLOCK=y
130CONFIG_LBDAF=y
131# CONFIG_BLK_DEV_BSG is not set
132# CONFIG_BLK_DEV_INTEGRITY is not set
133
134#
135# IO Schedulers
136#
137CONFIG_IOSCHED_NOOP=y
138CONFIG_IOSCHED_AS=y
139CONFIG_IOSCHED_DEADLINE=y
140CONFIG_IOSCHED_CFQ=y
141# CONFIG_DEFAULT_AS is not set
142# CONFIG_DEFAULT_DEADLINE is not set
143CONFIG_DEFAULT_CFQ=y
144# CONFIG_DEFAULT_NOOP is not set
145CONFIG_DEFAULT_IOSCHED="cfq"
146CONFIG_FREEZER=y
147
148#
149# System Type
150#
151CONFIG_MMU=y
152# CONFIG_ARCH_AAEC2000 is not set
153# CONFIG_ARCH_INTEGRATOR is not set
154# CONFIG_ARCH_REALVIEW is not set
155# CONFIG_ARCH_VERSATILE is not set
156# CONFIG_ARCH_AT91 is not set
157# CONFIG_ARCH_CLPS711X is not set
158# CONFIG_ARCH_GEMINI is not set
159# CONFIG_ARCH_EBSA110 is not set
160# CONFIG_ARCH_EP93XX is not set
161# CONFIG_ARCH_FOOTBRIDGE is not set
162# CONFIG_ARCH_MXC is not set
163# CONFIG_ARCH_STMP3XXX is not set
164# CONFIG_ARCH_NETX is not set
165# CONFIG_ARCH_H720X is not set
166# CONFIG_ARCH_NOMADIK is not set
167# CONFIG_ARCH_IOP13XX is not set
168# CONFIG_ARCH_IOP32X is not set
169# CONFIG_ARCH_IOP33X is not set
170# CONFIG_ARCH_IXP23XX is not set
171# CONFIG_ARCH_IXP2000 is not set
172# CONFIG_ARCH_IXP4XX is not set
173# CONFIG_ARCH_L7200 is not set
174# CONFIG_ARCH_KIRKWOOD is not set
175# CONFIG_ARCH_LOKI is not set
176# CONFIG_ARCH_MV78XX0 is not set
177# CONFIG_ARCH_ORION5X is not set
178# CONFIG_ARCH_MMP is not set
179# CONFIG_ARCH_KS8695 is not set
180# CONFIG_ARCH_NS9XXX is not set
181# CONFIG_ARCH_W90X900 is not set
182# CONFIG_ARCH_PNX4008 is not set
183# CONFIG_ARCH_PXA is not set
184# CONFIG_ARCH_MSM is not set
185# CONFIG_ARCH_RPC is not set
186# CONFIG_ARCH_SA1100 is not set
187# CONFIG_ARCH_S3C2410 is not set
188# CONFIG_ARCH_S3C64XX is not set
189# CONFIG_ARCH_S5PC1XX is not set
190# CONFIG_ARCH_SHARK is not set
191# CONFIG_ARCH_LH7A40X is not set
192# CONFIG_ARCH_U300 is not set
193# CONFIG_ARCH_DAVINCI is not set
194CONFIG_ARCH_OMAP=y
195# CONFIG_ARCH_BCMRING is not set
196
197#
198# TI OMAP Implementations
199#
200CONFIG_ARCH_OMAP_OTG=y
201# CONFIG_ARCH_OMAP1 is not set
202# CONFIG_ARCH_OMAP2 is not set
203CONFIG_ARCH_OMAP3=y
204# CONFIG_ARCH_OMAP4 is not set
205
206#
207# OMAP Feature Selections
208#
209# CONFIG_OMAP_DEBUG_POWERDOMAIN is not set
210# CONFIG_OMAP_DEBUG_CLOCKDOMAIN is not set
211CONFIG_OMAP_RESET_CLOCKS=y
212# CONFIG_OMAP_MUX is not set
213CONFIG_OMAP_MCBSP=y
214# CONFIG_OMAP_MBOX_FWK is not set
215# CONFIG_OMAP_MPU_TIMER is not set
216CONFIG_OMAP_32K_TIMER=y
217CONFIG_OMAP_32K_TIMER_HZ=128
218CONFIG_OMAP_DM_TIMER=y
219# CONFIG_OMAP_LL_DEBUG_UART1 is not set
220# CONFIG_OMAP_LL_DEBUG_UART2 is not set
221CONFIG_OMAP_LL_DEBUG_UART3=y
222# CONFIG_OMAP_LL_DEBUG_NONE is not set
223# CONFIG_OMAP_PM_NONE is not set
224CONFIG_OMAP_PM_NOOP=y
225CONFIG_ARCH_OMAP34XX=y
226CONFIG_ARCH_OMAP3430=y
227
228#
229# OMAP Board Type
230#
231# CONFIG_MACH_OMAP3_BEAGLE is not set
232# CONFIG_MACH_OMAP_LDP is not set
233# CONFIG_MACH_OVERO is not set
234# CONFIG_MACH_OMAP3EVM is not set
235# CONFIG_MACH_OMAP3517EVM is not set
236# CONFIG_MACH_OMAP3_PANDORA is not set
237CONFIG_MACH_OMAP3_TOUCHBOOK=y
238# CONFIG_MACH_OMAP_3430SDP is not set
239# CONFIG_MACH_NOKIA_RX51 is not set
240# CONFIG_MACH_OMAP_ZOOM2 is not set
241# CONFIG_MACH_OMAP_ZOOM3 is not set
242# CONFIG_MACH_CM_T35 is not set
243# CONFIG_MACH_IGEP0020 is not set
244# CONFIG_MACH_OMAP_3630SDP is not set
245
246#
247# Processor Type
248#
249CONFIG_CPU_32=y
250CONFIG_CPU_32v6K=y
251CONFIG_CPU_V7=y
252CONFIG_CPU_32v7=y
253CONFIG_CPU_ABRT_EV7=y
254CONFIG_CPU_PABRT_V7=y
255CONFIG_CPU_CACHE_V7=y
256CONFIG_CPU_CACHE_VIPT=y
257CONFIG_CPU_COPY_V6=y
258CONFIG_CPU_TLB_V7=y
259CONFIG_CPU_HAS_ASID=y
260CONFIG_CPU_CP15=y
261CONFIG_CPU_CP15_MMU=y
262
263#
264# Processor Features
265#
266CONFIG_ARM_THUMB=y
267CONFIG_ARM_THUMBEE=y
268# CONFIG_CPU_ICACHE_DISABLE is not set
269# CONFIG_CPU_DCACHE_DISABLE is not set
270# CONFIG_CPU_BPREDICT_DISABLE is not set
271CONFIG_HAS_TLS_REG=y
272CONFIG_ARM_L1_CACHE_SHIFT=6
273# CONFIG_ARM_ERRATA_430973 is not set
274# CONFIG_ARM_ERRATA_458693 is not set
275# CONFIG_ARM_ERRATA_460075 is not set
276CONFIG_COMMON_CLKDEV=y
277
278#
279# Bus support
280#
281# CONFIG_PCI_SYSCALL is not set
282# CONFIG_ARCH_SUPPORTS_MSI is not set
283# CONFIG_PCCARD is not set
284
285#
286# Kernel Features
287#
288CONFIG_TICK_ONESHOT=y
289CONFIG_NO_HZ=y
290CONFIG_HIGH_RES_TIMERS=y
291CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
292CONFIG_VMSPLIT_3G=y
293# CONFIG_VMSPLIT_2G is not set
294# CONFIG_VMSPLIT_1G is not set
295CONFIG_PAGE_OFFSET=0xC0000000
296# CONFIG_PREEMPT_NONE is not set
297# CONFIG_PREEMPT_VOLUNTARY is not set
298CONFIG_PREEMPT=y
299CONFIG_HZ=128
300# CONFIG_THUMB2_KERNEL is not set
301CONFIG_AEABI=y
302# CONFIG_OABI_COMPAT is not set
303# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
304# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
305# CONFIG_HIGHMEM is not set
306CONFIG_SELECT_MEMORY_MODEL=y
307CONFIG_FLATMEM_MANUAL=y
308# CONFIG_DISCONTIGMEM_MANUAL is not set
309# CONFIG_SPARSEMEM_MANUAL is not set
310CONFIG_FLATMEM=y
311CONFIG_FLAT_NODE_MEM_MAP=y
312CONFIG_PAGEFLAGS_EXTENDED=y
313CONFIG_SPLIT_PTLOCK_CPUS=4
314# CONFIG_PHYS_ADDR_T_64BIT is not set
315CONFIG_ZONE_DMA_FLAG=0
316CONFIG_VIRT_TO_BUS=y
317CONFIG_HAVE_MLOCK=y
318CONFIG_HAVE_MLOCKED_PAGE_BIT=y
319# CONFIG_KSM is not set
320CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
321CONFIG_LEDS=y
322CONFIG_ALIGNMENT_TRAP=y
323# CONFIG_UACCESS_WITH_MEMCPY is not set
324
325#
326# Boot options
327#
328CONFIG_ZBOOT_ROM_TEXT=0x0
329CONFIG_ZBOOT_ROM_BSS=0x0
330CONFIG_CMDLINE=" debug "
331# CONFIG_XIP_KERNEL is not set
332CONFIG_KEXEC=y
333CONFIG_ATAGS_PROC=y
334
335#
336# CPU Power Management
337#
338# CONFIG_CPU_FREQ is not set
339# CONFIG_CPU_IDLE is not set
340
341#
342# Floating point emulation
343#
344
345#
346# At least one emulation must be selected
347#
348CONFIG_VFP=y
349CONFIG_VFPv3=y
350CONFIG_NEON=y
351
352#
353# Userspace binary formats
354#
355CONFIG_BINFMT_ELF=y
356CONFIG_HAVE_AOUT=y
357CONFIG_BINFMT_AOUT=m
358CONFIG_BINFMT_MISC=y
359
360#
361# Power management options
362#
363CONFIG_PM=y
364CONFIG_PM_DEBUG=y
365# CONFIG_PM_VERBOSE is not set
366CONFIG_CAN_PM_TRACE=y
367CONFIG_PM_SLEEP=y
368CONFIG_SUSPEND=y
369# CONFIG_PM_TEST_SUSPEND is not set
370CONFIG_SUSPEND_FREEZER=y
371# CONFIG_APM_EMULATION is not set
372# CONFIG_PM_RUNTIME is not set
373CONFIG_ARCH_SUSPEND_POSSIBLE=y
374CONFIG_NET=y
375
376#
377# Networking options
378#
379CONFIG_PACKET=y
380CONFIG_PACKET_MMAP=y
381CONFIG_UNIX=y
382CONFIG_XFRM=y
383# CONFIG_XFRM_USER is not set
384# CONFIG_XFRM_SUB_POLICY is not set
385# CONFIG_XFRM_MIGRATE is not set
386# CONFIG_XFRM_STATISTICS is not set
387CONFIG_XFRM_IPCOMP=m
388CONFIG_NET_KEY=y
389# CONFIG_NET_KEY_MIGRATE is not set
390CONFIG_INET=y
391# CONFIG_IP_MULTICAST is not set
392# CONFIG_IP_ADVANCED_ROUTER is not set
393CONFIG_IP_FIB_HASH=y
394CONFIG_IP_PNP=y
395CONFIG_IP_PNP_DHCP=y
396CONFIG_IP_PNP_BOOTP=y
397CONFIG_IP_PNP_RARP=y
398CONFIG_NET_IPIP=m
399CONFIG_NET_IPGRE=m
400# CONFIG_ARPD is not set
401# CONFIG_SYN_COOKIES is not set
402CONFIG_INET_AH=m
403CONFIG_INET_ESP=m
404CONFIG_INET_IPCOMP=m
405CONFIG_INET_XFRM_TUNNEL=m
406CONFIG_INET_TUNNEL=m
407CONFIG_INET_XFRM_MODE_TRANSPORT=y
408CONFIG_INET_XFRM_MODE_TUNNEL=y
409CONFIG_INET_XFRM_MODE_BEET=y
410CONFIG_INET_LRO=y
411CONFIG_INET_DIAG=m
412CONFIG_INET_TCP_DIAG=m
413CONFIG_TCP_CONG_ADVANCED=y
414CONFIG_TCP_CONG_BIC=m
415CONFIG_TCP_CONG_CUBIC=y
416CONFIG_TCP_CONG_WESTWOOD=m
417CONFIG_TCP_CONG_HTCP=m
418CONFIG_TCP_CONG_HSTCP=m
419CONFIG_TCP_CONG_HYBLA=m
420CONFIG_TCP_CONG_VEGAS=m
421CONFIG_TCP_CONG_SCALABLE=m
422CONFIG_TCP_CONG_LP=m
423CONFIG_TCP_CONG_VENO=m
424CONFIG_TCP_CONG_YEAH=m
425CONFIG_TCP_CONG_ILLINOIS=m
426# CONFIG_DEFAULT_BIC is not set
427CONFIG_DEFAULT_CUBIC=y
428# CONFIG_DEFAULT_HTCP is not set
429# CONFIG_DEFAULT_VEGAS is not set
430# CONFIG_DEFAULT_WESTWOOD is not set
431# CONFIG_DEFAULT_RENO is not set
432CONFIG_DEFAULT_TCP_CONG="cubic"
433# CONFIG_TCP_MD5SIG is not set
434CONFIG_IPV6=m
435# CONFIG_IPV6_PRIVACY is not set
436# CONFIG_IPV6_ROUTER_PREF is not set
437# CONFIG_IPV6_OPTIMISTIC_DAD is not set
438CONFIG_INET6_AH=m
439CONFIG_INET6_ESP=m
440CONFIG_INET6_IPCOMP=m
441CONFIG_IPV6_MIP6=m
442CONFIG_INET6_XFRM_TUNNEL=m
443CONFIG_INET6_TUNNEL=m
444CONFIG_INET6_XFRM_MODE_TRANSPORT=m
445CONFIG_INET6_XFRM_MODE_TUNNEL=m
446CONFIG_INET6_XFRM_MODE_BEET=m
447CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
448CONFIG_IPV6_SIT=m
449CONFIG_IPV6_NDISC_NODETYPE=y
450CONFIG_IPV6_TUNNEL=m
451CONFIG_IPV6_MULTIPLE_TABLES=y
452CONFIG_IPV6_SUBTREES=y
453CONFIG_IPV6_MROUTE=y
454# CONFIG_IPV6_PIMSM_V2 is not set
455# CONFIG_NETWORK_SECMARK is not set
456CONFIG_NETFILTER=y
457# CONFIG_NETFILTER_DEBUG is not set
458CONFIG_NETFILTER_ADVANCED=y
459CONFIG_BRIDGE_NETFILTER=y
460
461#
462# Core Netfilter Configuration
463#
464CONFIG_NETFILTER_NETLINK=m
465CONFIG_NETFILTER_NETLINK_QUEUE=m
466CONFIG_NETFILTER_NETLINK_LOG=m
467CONFIG_NF_CONNTRACK=m
468CONFIG_NF_CT_ACCT=y
469CONFIG_NF_CONNTRACK_MARK=y
470CONFIG_NF_CONNTRACK_EVENTS=y
471CONFIG_NF_CT_PROTO_DCCP=m
472CONFIG_NF_CT_PROTO_GRE=m
473CONFIG_NF_CT_PROTO_SCTP=m
474CONFIG_NF_CT_PROTO_UDPLITE=m
475CONFIG_NF_CONNTRACK_AMANDA=m
476CONFIG_NF_CONNTRACK_FTP=m
477CONFIG_NF_CONNTRACK_H323=m
478CONFIG_NF_CONNTRACK_IRC=m
479CONFIG_NF_CONNTRACK_NETBIOS_NS=m
480CONFIG_NF_CONNTRACK_PPTP=m
481CONFIG_NF_CONNTRACK_SANE=m
482CONFIG_NF_CONNTRACK_SIP=m
483CONFIG_NF_CONNTRACK_TFTP=m
484CONFIG_NF_CT_NETLINK=m
485# CONFIG_NETFILTER_TPROXY is not set
486CONFIG_NETFILTER_XTABLES=m
487CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
488CONFIG_NETFILTER_XT_TARGET_CONNMARK=m
489# CONFIG_NETFILTER_XT_TARGET_DSCP is not set
490CONFIG_NETFILTER_XT_TARGET_HL=m
491# CONFIG_NETFILTER_XT_TARGET_LED is not set
492CONFIG_NETFILTER_XT_TARGET_MARK=m
493CONFIG_NETFILTER_XT_TARGET_NFLOG=m
494CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
495# CONFIG_NETFILTER_XT_TARGET_NOTRACK is not set
496CONFIG_NETFILTER_XT_TARGET_RATEEST=m
497# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
498CONFIG_NETFILTER_XT_TARGET_TCPMSS=m
499# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
500# CONFIG_NETFILTER_XT_MATCH_CLUSTER is not set
501CONFIG_NETFILTER_XT_MATCH_COMMENT=m
502CONFIG_NETFILTER_XT_MATCH_CONNBYTES=m
503CONFIG_NETFILTER_XT_MATCH_CONNLIMIT=m
504CONFIG_NETFILTER_XT_MATCH_CONNMARK=m
505CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
506CONFIG_NETFILTER_XT_MATCH_DCCP=m
507CONFIG_NETFILTER_XT_MATCH_DSCP=m
508CONFIG_NETFILTER_XT_MATCH_ESP=m
509CONFIG_NETFILTER_XT_MATCH_HASHLIMIT=m
510CONFIG_NETFILTER_XT_MATCH_HELPER=m
511CONFIG_NETFILTER_XT_MATCH_HL=m
512CONFIG_NETFILTER_XT_MATCH_IPRANGE=m
513CONFIG_NETFILTER_XT_MATCH_LENGTH=m
514CONFIG_NETFILTER_XT_MATCH_LIMIT=m
515CONFIG_NETFILTER_XT_MATCH_MAC=m
516CONFIG_NETFILTER_XT_MATCH_MARK=m
517CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
518CONFIG_NETFILTER_XT_MATCH_OWNER=m
519CONFIG_NETFILTER_XT_MATCH_POLICY=m
520# CONFIG_NETFILTER_XT_MATCH_PHYSDEV is not set
521CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
522CONFIG_NETFILTER_XT_MATCH_QUOTA=m
523CONFIG_NETFILTER_XT_MATCH_RATEEST=m
524CONFIG_NETFILTER_XT_MATCH_REALM=m
525CONFIG_NETFILTER_XT_MATCH_RECENT=m
526# CONFIG_NETFILTER_XT_MATCH_RECENT_PROC_COMPAT is not set
527CONFIG_NETFILTER_XT_MATCH_SCTP=m
528CONFIG_NETFILTER_XT_MATCH_STATE=m
529CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
530CONFIG_NETFILTER_XT_MATCH_STRING=m
531CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
532CONFIG_NETFILTER_XT_MATCH_TIME=m
533CONFIG_NETFILTER_XT_MATCH_U32=m
534# CONFIG_NETFILTER_XT_MATCH_OSF is not set
535CONFIG_IP_VS=m
536CONFIG_IP_VS_IPV6=y
537CONFIG_IP_VS_DEBUG=y
538CONFIG_IP_VS_TAB_BITS=12
539
540#
541# IPVS transport protocol load balancing support
542#
543CONFIG_IP_VS_PROTO_TCP=y
544CONFIG_IP_VS_PROTO_UDP=y
545CONFIG_IP_VS_PROTO_AH_ESP=y
546CONFIG_IP_VS_PROTO_ESP=y
547CONFIG_IP_VS_PROTO_AH=y
548
549#
550# IPVS scheduler
551#
552CONFIG_IP_VS_RR=m
553CONFIG_IP_VS_WRR=m
554CONFIG_IP_VS_LC=m
555CONFIG_IP_VS_WLC=m
556CONFIG_IP_VS_LBLC=m
557CONFIG_IP_VS_LBLCR=m
558CONFIG_IP_VS_DH=m
559CONFIG_IP_VS_SH=m
560CONFIG_IP_VS_SED=m
561CONFIG_IP_VS_NQ=m
562
563#
564# IPVS application helper
565#
566CONFIG_IP_VS_FTP=m
567
568#
569# IP: Netfilter Configuration
570#
571CONFIG_NF_DEFRAG_IPV4=m
572CONFIG_NF_CONNTRACK_IPV4=m
573CONFIG_NF_CONNTRACK_PROC_COMPAT=y
574CONFIG_IP_NF_QUEUE=m
575CONFIG_IP_NF_IPTABLES=m
576CONFIG_IP_NF_MATCH_ADDRTYPE=m
577CONFIG_IP_NF_MATCH_AH=m
578CONFIG_IP_NF_MATCH_ECN=m
579CONFIG_IP_NF_MATCH_TTL=m
580CONFIG_IP_NF_FILTER=m
581CONFIG_IP_NF_TARGET_REJECT=m
582CONFIG_IP_NF_TARGET_LOG=m
583CONFIG_IP_NF_TARGET_ULOG=m
584CONFIG_NF_NAT=m
585CONFIG_NF_NAT_NEEDED=y
586CONFIG_IP_NF_TARGET_MASQUERADE=m
587CONFIG_IP_NF_TARGET_NETMAP=m
588CONFIG_IP_NF_TARGET_REDIRECT=m
589CONFIG_NF_NAT_SNMP_BASIC=m
590CONFIG_NF_NAT_PROTO_DCCP=m
591CONFIG_NF_NAT_PROTO_GRE=m
592CONFIG_NF_NAT_PROTO_UDPLITE=m
593CONFIG_NF_NAT_PROTO_SCTP=m
594CONFIG_NF_NAT_FTP=m
595CONFIG_NF_NAT_IRC=m
596CONFIG_NF_NAT_TFTP=m
597CONFIG_NF_NAT_AMANDA=m
598CONFIG_NF_NAT_PPTP=m
599CONFIG_NF_NAT_H323=m
600CONFIG_NF_NAT_SIP=m
601CONFIG_IP_NF_MANGLE=m
602CONFIG_IP_NF_TARGET_CLUSTERIP=m
603CONFIG_IP_NF_TARGET_ECN=m
604CONFIG_IP_NF_TARGET_TTL=m
605CONFIG_IP_NF_RAW=m
606CONFIG_IP_NF_ARPTABLES=m
607CONFIG_IP_NF_ARPFILTER=m
608CONFIG_IP_NF_ARP_MANGLE=m
609
610#
611# IPv6: Netfilter Configuration
612#
613CONFIG_NF_CONNTRACK_IPV6=m
614CONFIG_IP6_NF_QUEUE=m
615CONFIG_IP6_NF_IPTABLES=m
616CONFIG_IP6_NF_MATCH_AH=m
617CONFIG_IP6_NF_MATCH_EUI64=m
618CONFIG_IP6_NF_MATCH_FRAG=m
619CONFIG_IP6_NF_MATCH_OPTS=m
620CONFIG_IP6_NF_MATCH_HL=m
621CONFIG_IP6_NF_MATCH_IPV6HEADER=m
622CONFIG_IP6_NF_MATCH_MH=m
623CONFIG_IP6_NF_MATCH_RT=m
624CONFIG_IP6_NF_TARGET_HL=m
625CONFIG_IP6_NF_TARGET_LOG=m
626CONFIG_IP6_NF_FILTER=m
627CONFIG_IP6_NF_TARGET_REJECT=m
628CONFIG_IP6_NF_MANGLE=m
629CONFIG_IP6_NF_RAW=m
630# CONFIG_BRIDGE_NF_EBTABLES is not set
631CONFIG_IP_DCCP=m
632CONFIG_INET_DCCP_DIAG=m
633
634#
635# DCCP CCIDs Configuration (EXPERIMENTAL)
636#
637# CONFIG_IP_DCCP_CCID2_DEBUG is not set
638CONFIG_IP_DCCP_CCID3=y
639# CONFIG_IP_DCCP_CCID3_DEBUG is not set
640CONFIG_IP_DCCP_CCID3_RTO=100
641CONFIG_IP_DCCP_TFRC_LIB=y
642
643#
644# DCCP Kernel Hacking
645#
646# CONFIG_IP_DCCP_DEBUG is not set
647CONFIG_IP_SCTP=m
648# CONFIG_SCTP_DBG_MSG is not set
649# CONFIG_SCTP_DBG_OBJCNT is not set
650# CONFIG_SCTP_HMAC_NONE is not set
651# CONFIG_SCTP_HMAC_SHA1 is not set
652CONFIG_SCTP_HMAC_MD5=y
653# CONFIG_RDS is not set
654CONFIG_TIPC=m
655# CONFIG_TIPC_ADVANCED is not set
656# CONFIG_TIPC_DEBUG is not set
657CONFIG_ATM=m
658CONFIG_ATM_CLIP=m
659# CONFIG_ATM_CLIP_NO_ICMP is not set
660CONFIG_ATM_LANE=m
661CONFIG_ATM_MPOA=m
662CONFIG_ATM_BR2684=m
663# CONFIG_ATM_BR2684_IPFILTER is not set
664CONFIG_STP=m
665CONFIG_GARP=m
666CONFIG_BRIDGE=m
667# CONFIG_NET_DSA is not set
668CONFIG_VLAN_8021Q=m
669CONFIG_VLAN_8021Q_GVRP=y
670# CONFIG_DECNET is not set
671CONFIG_LLC=m
672# CONFIG_LLC2 is not set
673# CONFIG_IPX is not set
674# CONFIG_ATALK is not set
675# CONFIG_X25 is not set
676# CONFIG_LAPB is not set
677# CONFIG_ECONET is not set
678CONFIG_WAN_ROUTER=m
679# CONFIG_PHONET is not set
680# CONFIG_IEEE802154 is not set
681CONFIG_NET_SCHED=y
682
683#
684# Queueing/Scheduling
685#
686CONFIG_NET_SCH_CBQ=m
687CONFIG_NET_SCH_HTB=m
688CONFIG_NET_SCH_HFSC=m
689CONFIG_NET_SCH_ATM=m
690CONFIG_NET_SCH_PRIO=m
691CONFIG_NET_SCH_MULTIQ=m
692CONFIG_NET_SCH_RED=m
693CONFIG_NET_SCH_SFQ=m
694CONFIG_NET_SCH_TEQL=m
695CONFIG_NET_SCH_TBF=m
696CONFIG_NET_SCH_GRED=m
697CONFIG_NET_SCH_DSMARK=m
698CONFIG_NET_SCH_NETEM=m
699CONFIG_NET_SCH_DRR=m
700
701#
702# Classification
703#
704CONFIG_NET_CLS=y
705CONFIG_NET_CLS_BASIC=m
706CONFIG_NET_CLS_TCINDEX=m
707CONFIG_NET_CLS_ROUTE4=m
708CONFIG_NET_CLS_ROUTE=y
709CONFIG_NET_CLS_FW=m
710CONFIG_NET_CLS_U32=m
711CONFIG_CLS_U32_PERF=y
712CONFIG_CLS_U32_MARK=y
713CONFIG_NET_CLS_RSVP=m
714CONFIG_NET_CLS_RSVP6=m
715CONFIG_NET_CLS_FLOW=m
716# CONFIG_NET_EMATCH is not set
717# CONFIG_NET_CLS_ACT is not set
718CONFIG_NET_CLS_IND=y
719CONFIG_NET_SCH_FIFO=y
720# CONFIG_DCB is not set
721
722#
723# Network testing
724#
725# CONFIG_NET_PKTGEN is not set
726# CONFIG_NET_DROP_MONITOR is not set
727# CONFIG_HAMRADIO is not set
728# CONFIG_CAN is not set
729# CONFIG_IRDA is not set
730CONFIG_BT=y
731CONFIG_BT_L2CAP=y
732CONFIG_BT_SCO=y
733CONFIG_BT_RFCOMM=y
734CONFIG_BT_RFCOMM_TTY=y
735CONFIG_BT_BNEP=y
736CONFIG_BT_BNEP_MC_FILTER=y
737CONFIG_BT_BNEP_PROTO_FILTER=y
738CONFIG_BT_HIDP=y
739
740#
741# Bluetooth device drivers
742#
743CONFIG_BT_HCIBTUSB=y
744CONFIG_BT_HCIBTSDIO=y
745CONFIG_BT_HCIUART=y
746CONFIG_BT_HCIUART_H4=y
747CONFIG_BT_HCIUART_BCSP=y
748CONFIG_BT_HCIUART_LL=y
749CONFIG_BT_HCIBCM203X=y
750CONFIG_BT_HCIBPA10X=y
751CONFIG_BT_HCIBFUSB=y
752# CONFIG_BT_HCIVHCI is not set
753# CONFIG_BT_MRVL is not set
754CONFIG_AF_RXRPC=m
755# CONFIG_AF_RXRPC_DEBUG is not set
756# CONFIG_RXKAD is not set
757CONFIG_FIB_RULES=y
758CONFIG_WIRELESS=y
759CONFIG_CFG80211=m
760# CONFIG_NL80211_TESTMODE is not set
761# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
762# CONFIG_CFG80211_REG_DEBUG is not set
763CONFIG_CFG80211_DEFAULT_PS=y
764CONFIG_CFG80211_DEFAULT_PS_VALUE=1
765# CONFIG_CFG80211_DEBUGFS is not set
766# CONFIG_WIRELESS_OLD_REGULATORY is not set
767CONFIG_WIRELESS_EXT=y
768CONFIG_WIRELESS_EXT_SYSFS=y
769CONFIG_LIB80211=y
770# CONFIG_LIB80211_DEBUG is not set
771CONFIG_MAC80211=m
772CONFIG_MAC80211_RC_PID=y
773# CONFIG_MAC80211_RC_MINSTREL is not set
774CONFIG_MAC80211_RC_DEFAULT_PID=y
775# CONFIG_MAC80211_RC_DEFAULT_MINSTREL is not set
776CONFIG_MAC80211_RC_DEFAULT="pid"
777# CONFIG_MAC80211_MESH is not set
778# CONFIG_MAC80211_LEDS is not set
779# CONFIG_MAC80211_DEBUGFS is not set
780# CONFIG_MAC80211_DEBUG_MENU is not set
781CONFIG_WIMAX=m
782CONFIG_WIMAX_DEBUG_LEVEL=8
783# CONFIG_RFKILL is not set
784# CONFIG_NET_9P is not set
785
786#
787# Device Drivers
788#
789
790#
791# Generic Driver Options
792#
793CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
794# CONFIG_DEVTMPFS is not set
795CONFIG_STANDALONE=y
796CONFIG_PREVENT_FIRMWARE_BUILD=y
797CONFIG_FW_LOADER=y
798CONFIG_FIRMWARE_IN_KERNEL=y
799CONFIG_EXTRA_FIRMWARE=""
800# CONFIG_DEBUG_DRIVER is not set
801# CONFIG_DEBUG_DEVRES is not set
802# CONFIG_SYS_HYPERVISOR is not set
803# CONFIG_CONNECTOR is not set
804CONFIG_MTD=y
805# CONFIG_MTD_DEBUG is not set
806# CONFIG_MTD_TESTS is not set
807CONFIG_MTD_CONCAT=y
808CONFIG_MTD_PARTITIONS=y
809# CONFIG_MTD_REDBOOT_PARTS is not set
810# CONFIG_MTD_CMDLINE_PARTS is not set
811# CONFIG_MTD_AFS_PARTS is not set
812# CONFIG_MTD_AR7_PARTS is not set
813
814#
815# User Modules And Translation Layers
816#
817CONFIG_MTD_CHAR=y
818CONFIG_MTD_BLKDEVS=y
819CONFIG_MTD_BLOCK=y
820# CONFIG_FTL is not set
821# CONFIG_NFTL is not set
822# CONFIG_INFTL is not set
823# CONFIG_RFD_FTL is not set
824# CONFIG_SSFDC is not set
825# CONFIG_MTD_OOPS is not set
826
827#
828# RAM/ROM/Flash chip drivers
829#
830# CONFIG_MTD_CFI is not set
831# CONFIG_MTD_JEDECPROBE is not set
832CONFIG_MTD_MAP_BANK_WIDTH_1=y
833CONFIG_MTD_MAP_BANK_WIDTH_2=y
834CONFIG_MTD_MAP_BANK_WIDTH_4=y
835# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
836# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
837# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
838CONFIG_MTD_CFI_I1=y
839CONFIG_MTD_CFI_I2=y
840# CONFIG_MTD_CFI_I4 is not set
841# CONFIG_MTD_CFI_I8 is not set
842# CONFIG_MTD_RAM is not set
843# CONFIG_MTD_ROM is not set
844# CONFIG_MTD_ABSENT is not set
845
846#
847# Mapping drivers for chip access
848#
849# CONFIG_MTD_COMPLEX_MAPPINGS is not set
850# CONFIG_MTD_PLATRAM is not set
851
852#
853# Self-contained MTD device drivers
854#
855# CONFIG_MTD_DATAFLASH is not set
856# CONFIG_MTD_M25P80 is not set
857# CONFIG_MTD_SST25L is not set
858# CONFIG_MTD_SLRAM is not set
859# CONFIG_MTD_PHRAM is not set
860# CONFIG_MTD_MTDRAM is not set
861# CONFIG_MTD_BLOCK2MTD is not set
862
863#
864# Disk-On-Chip Device Drivers
865#
866# CONFIG_MTD_DOC2000 is not set
867# CONFIG_MTD_DOC2001 is not set
868# CONFIG_MTD_DOC2001PLUS is not set
869CONFIG_MTD_NAND=y
870# CONFIG_MTD_NAND_VERIFY_WRITE is not set
871# CONFIG_MTD_NAND_ECC_SMC is not set
872# CONFIG_MTD_NAND_MUSEUM_IDS is not set
873# CONFIG_MTD_NAND_GPIO is not set
874CONFIG_MTD_NAND_OMAP2=y
875CONFIG_MTD_NAND_OMAP_PREFETCH=y
876# CONFIG_MTD_NAND_OMAP_PREFETCH_DMA is not set
877CONFIG_MTD_NAND_IDS=y
878# CONFIG_MTD_NAND_DISKONCHIP is not set
879# CONFIG_MTD_NAND_NANDSIM is not set
880CONFIG_MTD_NAND_PLATFORM=y
881# CONFIG_MTD_ALAUDA is not set
882# CONFIG_MTD_ONENAND is not set
883
884#
885# LPDDR flash memory drivers
886#
887# CONFIG_MTD_LPDDR is not set
888
889#
890# UBI - Unsorted block images
891#
892CONFIG_MTD_UBI=y
893CONFIG_MTD_UBI_WL_THRESHOLD=4096
894CONFIG_MTD_UBI_BEB_RESERVE=1
895# CONFIG_MTD_UBI_GLUEBI is not set
896
897#
898# UBI debugging options
899#
900# CONFIG_MTD_UBI_DEBUG is not set
901# CONFIG_PARPORT is not set
902CONFIG_BLK_DEV=y
903# CONFIG_BLK_DEV_COW_COMMON is not set
904CONFIG_BLK_DEV_LOOP=y
905CONFIG_BLK_DEV_CRYPTOLOOP=m
906# CONFIG_BLK_DEV_NBD is not set
907# CONFIG_BLK_DEV_UB is not set
908CONFIG_BLK_DEV_RAM=y
909CONFIG_BLK_DEV_RAM_COUNT=16
910CONFIG_BLK_DEV_RAM_SIZE=16384
911# CONFIG_BLK_DEV_XIP is not set
912CONFIG_CDROM_PKTCDVD=m
913CONFIG_CDROM_PKTCDVD_BUFFERS=8
914# CONFIG_CDROM_PKTCDVD_WCACHE is not set
915# CONFIG_ATA_OVER_ETH is not set
916# CONFIG_MG_DISK is not set
917CONFIG_MISC_DEVICES=y
918# CONFIG_ICS932S401 is not set
919# CONFIG_ENCLOSURE_SERVICES is not set
920# CONFIG_ISL29003 is not set
921# CONFIG_C2PORT is not set
922
923#
924# EEPROM support
925#
926# CONFIG_EEPROM_AT24 is not set
927# CONFIG_EEPROM_AT25 is not set
928# CONFIG_EEPROM_LEGACY is not set
929# CONFIG_EEPROM_MAX6875 is not set
930CONFIG_EEPROM_93CX6=y
931CONFIG_HAVE_IDE=y
932# CONFIG_IDE is not set
933
934#
935# SCSI device support
936#
937CONFIG_RAID_ATTRS=m
938CONFIG_SCSI=y
939CONFIG_SCSI_DMA=y
940# CONFIG_SCSI_TGT is not set
941# CONFIG_SCSI_NETLINK is not set
942CONFIG_SCSI_PROC_FS=y
943
944#
945# SCSI support type (disk, tape, CD-ROM)
946#
947CONFIG_BLK_DEV_SD=y
948# CONFIG_CHR_DEV_ST is not set
949# CONFIG_CHR_DEV_OSST is not set
950CONFIG_BLK_DEV_SR=y
951CONFIG_BLK_DEV_SR_VENDOR=y
952CONFIG_CHR_DEV_SG=y
953CONFIG_CHR_DEV_SCH=m
954CONFIG_SCSI_MULTI_LUN=y
955# CONFIG_SCSI_CONSTANTS is not set
956# CONFIG_SCSI_LOGGING is not set
957# CONFIG_SCSI_SCAN_ASYNC is not set
958CONFIG_SCSI_WAIT_SCAN=m
959
960#
961# SCSI Transports
962#
963# CONFIG_SCSI_SPI_ATTRS is not set
964# CONFIG_SCSI_FC_ATTRS is not set
965CONFIG_SCSI_ISCSI_ATTRS=m
966# CONFIG_SCSI_SAS_LIBSAS is not set
967# CONFIG_SCSI_SRP_ATTRS is not set
968CONFIG_SCSI_LOWLEVEL=y
969CONFIG_ISCSI_TCP=m
970# CONFIG_LIBFC is not set
971# CONFIG_LIBFCOE is not set
972# CONFIG_SCSI_DEBUG is not set
973# CONFIG_SCSI_DH is not set
974# CONFIG_SCSI_OSD_INITIATOR is not set
975# CONFIG_ATA is not set
976CONFIG_MD=y
977CONFIG_BLK_DEV_MD=m
978CONFIG_MD_LINEAR=m
979CONFIG_MD_RAID0=m
980CONFIG_MD_RAID1=m
981CONFIG_MD_RAID10=m
982CONFIG_MD_RAID456=m
983CONFIG_MD_RAID6_PQ=m
984# CONFIG_ASYNC_RAID6_TEST is not set
985CONFIG_MD_MULTIPATH=m
986CONFIG_MD_FAULTY=m
987CONFIG_BLK_DEV_DM=m
988# CONFIG_DM_DEBUG is not set
989CONFIG_DM_CRYPT=m
990CONFIG_DM_SNAPSHOT=m
991CONFIG_DM_MIRROR=m
992# CONFIG_DM_LOG_USERSPACE is not set
993CONFIG_DM_ZERO=m
994CONFIG_DM_MULTIPATH=m
995# CONFIG_DM_MULTIPATH_QL is not set
996# CONFIG_DM_MULTIPATH_ST is not set
997CONFIG_DM_DELAY=m
998# CONFIG_DM_UEVENT is not set
999CONFIG_NETDEVICES=y
1000CONFIG_DUMMY=m
1001CONFIG_BONDING=m
1002CONFIG_MACVLAN=m
1003CONFIG_EQUALIZER=m
1004CONFIG_TUN=m
1005CONFIG_VETH=m
1006# CONFIG_NET_ETHERNET is not set
1007# CONFIG_NETDEV_1000 is not set
1008# CONFIG_NETDEV_10000 is not set
1009CONFIG_WLAN=y
1010# CONFIG_WLAN_PRE80211 is not set
1011CONFIG_WLAN_80211=y
1012# CONFIG_LIBERTAS is not set
1013# CONFIG_LIBERTAS_THINFIRM is not set
1014# CONFIG_AT76C50X_USB is not set
1015# CONFIG_USB_ZD1201 is not set
1016# CONFIG_USB_NET_RNDIS_WLAN is not set
1017# CONFIG_RTL8187 is not set
1018# CONFIG_MAC80211_HWSIM is not set
1019# CONFIG_P54_COMMON is not set
1020# CONFIG_ATH_COMMON is not set
1021# CONFIG_HOSTAP is not set
1022# CONFIG_B43 is not set
1023# CONFIG_B43LEGACY is not set
1024# CONFIG_ZD1211RW is not set
1025# CONFIG_RT2X00 is not set
1026# CONFIG_WL12XX is not set
1027# CONFIG_IWM is not set
1028
1029#
1030# WiMAX Wireless Broadband devices
1031#
1032# CONFIG_WIMAX_I2400M_USB is not set
1033# CONFIG_WIMAX_I2400M_SDIO is not set
1034
1035#
1036# USB Network Adapters
1037#
1038# CONFIG_USB_CATC is not set
1039# CONFIG_USB_KAWETH is not set
1040# CONFIG_USB_PEGASUS is not set
1041# CONFIG_USB_RTL8150 is not set
1042# CONFIG_USB_USBNET is not set
1043# CONFIG_WAN is not set
1044# CONFIG_ATM_DRIVERS is not set
1045CONFIG_PPP=m
1046CONFIG_PPP_MULTILINK=y
1047CONFIG_PPP_FILTER=y
1048CONFIG_PPP_ASYNC=m
1049CONFIG_PPP_SYNC_TTY=m
1050CONFIG_PPP_DEFLATE=m
1051CONFIG_PPP_BSDCOMP=m
1052CONFIG_PPP_MPPE=m
1053CONFIG_PPPOE=m
1054# CONFIG_PPPOATM is not set
1055CONFIG_PPPOL2TP=m
1056# CONFIG_SLIP is not set
1057CONFIG_SLHC=m
1058CONFIG_NETCONSOLE=m
1059CONFIG_NETCONSOLE_DYNAMIC=y
1060CONFIG_NETPOLL=y
1061CONFIG_NETPOLL_TRAP=y
1062CONFIG_NET_POLL_CONTROLLER=y
1063# CONFIG_ISDN is not set
1064# CONFIG_PHONE is not set
1065
1066#
1067# Input device support
1068#
1069CONFIG_INPUT=y
1070CONFIG_INPUT_FF_MEMLESS=y
1071# CONFIG_INPUT_POLLDEV is not set
1072
1073#
1074# Userland interfaces
1075#
1076CONFIG_INPUT_MOUSEDEV=y
1077CONFIG_INPUT_MOUSEDEV_PSAUX=y
1078CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
1079CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
1080# CONFIG_INPUT_JOYDEV is not set
1081CONFIG_INPUT_EVDEV=y
1082# CONFIG_INPUT_EVBUG is not set
1083
1084#
1085# Input Device Drivers
1086#
1087CONFIG_INPUT_KEYBOARD=y
1088# CONFIG_KEYBOARD_ADP5588 is not set
1089# CONFIG_KEYBOARD_ATKBD is not set
1090# CONFIG_QT2160 is not set
1091# CONFIG_KEYBOARD_LKKBD is not set
1092CONFIG_KEYBOARD_GPIO=y
1093# CONFIG_KEYBOARD_MATRIX is not set
1094# CONFIG_KEYBOARD_LM8323 is not set
1095# CONFIG_KEYBOARD_MAX7359 is not set
1096# CONFIG_KEYBOARD_NEWTON is not set
1097# CONFIG_KEYBOARD_OPENCORES is not set
1098# CONFIG_KEYBOARD_STOWAWAY is not set
1099# CONFIG_KEYBOARD_SUNKBD is not set
1100# CONFIG_KEYBOARD_TWL4030 is not set
1101# CONFIG_KEYBOARD_XTKBD is not set
1102CONFIG_INPUT_MOUSE=y
1103CONFIG_MOUSE_PS2=y
1104CONFIG_MOUSE_PS2_ALPS=y
1105CONFIG_MOUSE_PS2_LOGIPS2PP=y
1106CONFIG_MOUSE_PS2_SYNAPTICS=y
1107CONFIG_MOUSE_PS2_TRACKPOINT=y
1108# CONFIG_MOUSE_PS2_ELANTECH is not set
1109# CONFIG_MOUSE_PS2_SENTELIC is not set
1110# CONFIG_MOUSE_PS2_TOUCHKIT is not set
1111# CONFIG_MOUSE_SERIAL is not set
1112# CONFIG_MOUSE_APPLETOUCH is not set
1113# CONFIG_MOUSE_BCM5974 is not set
1114# CONFIG_MOUSE_VSXXXAA is not set
1115# CONFIG_MOUSE_GPIO is not set
1116# CONFIG_MOUSE_SYNAPTICS_I2C is not set
1117# CONFIG_INPUT_JOYSTICK is not set
1118# CONFIG_INPUT_TABLET is not set
1119CONFIG_INPUT_TOUCHSCREEN=y
1120CONFIG_TOUCHSCREEN_ADS7846=y
1121# CONFIG_TOUCHSCREEN_AD7877 is not set
1122# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
1123# CONFIG_TOUCHSCREEN_AD7879_SPI is not set
1124# CONFIG_TOUCHSCREEN_AD7879 is not set
1125# CONFIG_TOUCHSCREEN_EETI is not set
1126# CONFIG_TOUCHSCREEN_FUJITSU is not set
1127# CONFIG_TOUCHSCREEN_GUNZE is not set
1128# CONFIG_TOUCHSCREEN_ELO is not set
1129# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
1130# CONFIG_TOUCHSCREEN_MCS5000 is not set
1131# CONFIG_TOUCHSCREEN_MTOUCH is not set
1132# CONFIG_TOUCHSCREEN_INEXIO is not set
1133# CONFIG_TOUCHSCREEN_MK712 is not set
1134# CONFIG_TOUCHSCREEN_PENMOUNT is not set
1135# CONFIG_TOUCHSCREEN_TOUCHRIGHT is not set
1136# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
1137# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
1138# CONFIG_TOUCHSCREEN_TOUCHIT213 is not set
1139# CONFIG_TOUCHSCREEN_TSC2007 is not set
1140# CONFIG_TOUCHSCREEN_W90X900 is not set
1141CONFIG_INPUT_MISC=y
1142# CONFIG_INPUT_ATI_REMOTE is not set
1143# CONFIG_INPUT_ATI_REMOTE2 is not set
1144# CONFIG_INPUT_KEYSPAN_REMOTE is not set
1145# CONFIG_INPUT_POWERMATE is not set
1146# CONFIG_INPUT_YEALINK is not set
1147# CONFIG_INPUT_CM109 is not set
1148CONFIG_INPUT_TWL4030_PWRBUTTON=y
1149CONFIG_INPUT_UINPUT=y
1150# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
1151
1152#
1153# Hardware I/O ports
1154#
1155CONFIG_SERIO=y
1156CONFIG_SERIO_SERPORT=y
1157CONFIG_SERIO_LIBPS2=y
1158# CONFIG_SERIO_RAW is not set
1159# CONFIG_GAMEPORT is not set
1160
1161#
1162# Character devices
1163#
1164CONFIG_VT=y
1165CONFIG_CONSOLE_TRANSLATIONS=y
1166CONFIG_VT_CONSOLE=y
1167CONFIG_HW_CONSOLE=y
1168CONFIG_VT_HW_CONSOLE_BINDING=y
1169CONFIG_DEVKMEM=y
1170# CONFIG_SERIAL_NONSTANDARD is not set
1171
1172#
1173# Serial drivers
1174#
1175CONFIG_SERIAL_8250=y
1176CONFIG_SERIAL_8250_CONSOLE=y
1177CONFIG_SERIAL_8250_NR_UARTS=32
1178CONFIG_SERIAL_8250_RUNTIME_UARTS=4
1179CONFIG_SERIAL_8250_EXTENDED=y
1180CONFIG_SERIAL_8250_MANY_PORTS=y
1181CONFIG_SERIAL_8250_SHARE_IRQ=y
1182CONFIG_SERIAL_8250_DETECT_IRQ=y
1183CONFIG_SERIAL_8250_RSA=y
1184
1185#
1186# Non-8250 serial port support
1187#
1188# CONFIG_SERIAL_MAX3100 is not set
1189CONFIG_SERIAL_CORE=y
1190CONFIG_SERIAL_CORE_CONSOLE=y
1191CONFIG_UNIX98_PTYS=y
1192# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
1193# CONFIG_LEGACY_PTYS is not set
1194# CONFIG_IPMI_HANDLER is not set
1195CONFIG_HW_RANDOM=y
1196# CONFIG_HW_RANDOM_TIMERIOMEM is not set
1197# CONFIG_R3964 is not set
1198# CONFIG_RAW_DRIVER is not set
1199# CONFIG_TCG_TPM is not set
1200CONFIG_I2C=y
1201CONFIG_I2C_BOARDINFO=y
1202CONFIG_I2C_COMPAT=y
1203CONFIG_I2C_CHARDEV=y
1204CONFIG_I2C_HELPER_AUTO=y
1205
1206#
1207# I2C Hardware Bus support
1208#
1209
1210#
1211# I2C system bus drivers (mostly embedded / system-on-chip)
1212#
1213# CONFIG_I2C_DESIGNWARE is not set
1214# CONFIG_I2C_GPIO is not set
1215# CONFIG_I2C_OCORES is not set
1216CONFIG_I2C_OMAP=y
1217# CONFIG_I2C_SIMTEC is not set
1218
1219#
1220# External I2C/SMBus adapter drivers
1221#
1222# CONFIG_I2C_PARPORT_LIGHT is not set
1223# CONFIG_I2C_TAOS_EVM is not set
1224# CONFIG_I2C_TINY_USB is not set
1225
1226#
1227# Other I2C/SMBus bus drivers
1228#
1229# CONFIG_I2C_PCA_PLATFORM is not set
1230# CONFIG_I2C_STUB is not set
1231
1232#
1233# Miscellaneous I2C Chip support
1234#
1235# CONFIG_DS1682 is not set
1236# CONFIG_SENSORS_TSL2550 is not set
1237# CONFIG_I2C_DEBUG_CORE is not set
1238# CONFIG_I2C_DEBUG_ALGO is not set
1239# CONFIG_I2C_DEBUG_BUS is not set
1240# CONFIG_I2C_DEBUG_CHIP is not set
1241CONFIG_SPI=y
1242# CONFIG_SPI_DEBUG is not set
1243CONFIG_SPI_MASTER=y
1244
1245#
1246# SPI Master Controller Drivers
1247#
1248# CONFIG_SPI_BITBANG is not set
1249# CONFIG_SPI_GPIO is not set
1250CONFIG_SPI_OMAP24XX=y
1251
1252#
1253# SPI Protocol Masters
1254#
1255CONFIG_SPI_SPIDEV=y
1256# CONFIG_SPI_TLE62X0 is not set
1257
1258#
1259# PPS support
1260#
1261# CONFIG_PPS is not set
1262CONFIG_ARCH_REQUIRE_GPIOLIB=y
1263CONFIG_GPIOLIB=y
1264# CONFIG_DEBUG_GPIO is not set
1265CONFIG_GPIO_SYSFS=y
1266
1267#
1268# Memory mapped GPIO expanders:
1269#
1270
1271#
1272# I2C GPIO expanders:
1273#
1274# CONFIG_GPIO_MAX732X is not set
1275# CONFIG_GPIO_PCA953X is not set
1276# CONFIG_GPIO_PCF857X is not set
1277CONFIG_GPIO_TWL4030=y
1278
1279#
1280# PCI GPIO expanders:
1281#
1282
1283#
1284# SPI GPIO expanders:
1285#
1286# CONFIG_GPIO_MAX7301 is not set
1287# CONFIG_GPIO_MCP23S08 is not set
1288# CONFIG_GPIO_MC33880 is not set
1289
1290#
1291# AC97 GPIO expanders:
1292#
1293# CONFIG_W1 is not set
1294CONFIG_POWER_SUPPLY=y
1295# CONFIG_POWER_SUPPLY_DEBUG is not set
1296# CONFIG_PDA_POWER is not set
1297# CONFIG_BATTERY_DS2760 is not set
1298# CONFIG_BATTERY_DS2782 is not set
1299CONFIG_BATTERY_BQ27x00=y
1300# CONFIG_BATTERY_MAX17040 is not set
1301CONFIG_HWMON=y
1302# CONFIG_HWMON_VID is not set
1303# CONFIG_HWMON_DEBUG_CHIP is not set
1304
1305#
1306# Native drivers
1307#
1308# CONFIG_SENSORS_AD7414 is not set
1309# CONFIG_SENSORS_AD7418 is not set
1310# CONFIG_SENSORS_ADCXX is not set
1311# CONFIG_SENSORS_ADM1021 is not set
1312# CONFIG_SENSORS_ADM1025 is not set
1313# CONFIG_SENSORS_ADM1026 is not set
1314# CONFIG_SENSORS_ADM1029 is not set
1315# CONFIG_SENSORS_ADM1031 is not set
1316# CONFIG_SENSORS_ADM9240 is not set
1317# CONFIG_SENSORS_ADT7462 is not set
1318# CONFIG_SENSORS_ADT7470 is not set
1319# CONFIG_SENSORS_ADT7473 is not set
1320# CONFIG_SENSORS_ADT7475 is not set
1321# CONFIG_SENSORS_ATXP1 is not set
1322# CONFIG_SENSORS_DS1621 is not set
1323# CONFIG_SENSORS_F71805F is not set
1324# CONFIG_SENSORS_F71882FG is not set
1325# CONFIG_SENSORS_F75375S is not set
1326# CONFIG_SENSORS_G760A is not set
1327# CONFIG_SENSORS_GL518SM is not set
1328# CONFIG_SENSORS_GL520SM is not set
1329# CONFIG_SENSORS_IT87 is not set
1330# CONFIG_SENSORS_LM63 is not set
1331# CONFIG_SENSORS_LM70 is not set
1332# CONFIG_SENSORS_LM75 is not set
1333# CONFIG_SENSORS_LM77 is not set
1334# CONFIG_SENSORS_LM78 is not set
1335# CONFIG_SENSORS_LM80 is not set
1336# CONFIG_SENSORS_LM83 is not set
1337# CONFIG_SENSORS_LM85 is not set
1338# CONFIG_SENSORS_LM87 is not set
1339# CONFIG_SENSORS_LM90 is not set
1340# CONFIG_SENSORS_LM92 is not set
1341# CONFIG_SENSORS_LM93 is not set
1342# CONFIG_SENSORS_LTC4215 is not set
1343# CONFIG_SENSORS_LTC4245 is not set
1344# CONFIG_SENSORS_LM95241 is not set
1345# CONFIG_SENSORS_MAX1111 is not set
1346# CONFIG_SENSORS_MAX1619 is not set
1347# CONFIG_SENSORS_MAX6650 is not set
1348# CONFIG_SENSORS_PC87360 is not set
1349# CONFIG_SENSORS_PC87427 is not set
1350# CONFIG_SENSORS_PCF8591 is not set
1351# CONFIG_SENSORS_SHT15 is not set
1352# CONFIG_SENSORS_DME1737 is not set
1353# CONFIG_SENSORS_SMSC47M1 is not set
1354# CONFIG_SENSORS_SMSC47M192 is not set
1355# CONFIG_SENSORS_SMSC47B397 is not set
1356# CONFIG_SENSORS_ADS7828 is not set
1357# CONFIG_SENSORS_THMC50 is not set
1358# CONFIG_SENSORS_TMP401 is not set
1359# CONFIG_SENSORS_TMP421 is not set
1360# CONFIG_SENSORS_VT1211 is not set
1361# CONFIG_SENSORS_W83781D is not set
1362# CONFIG_SENSORS_W83791D is not set
1363# CONFIG_SENSORS_W83792D is not set
1364# CONFIG_SENSORS_W83793 is not set
1365# CONFIG_SENSORS_W83L785TS is not set
1366# CONFIG_SENSORS_W83L786NG is not set
1367# CONFIG_SENSORS_W83627HF is not set
1368# CONFIG_SENSORS_W83627EHF is not set
1369# CONFIG_SENSORS_LIS3_SPI is not set
1370CONFIG_THERMAL=y
1371CONFIG_THERMAL_HWMON=y
1372CONFIG_WATCHDOG=y
1373CONFIG_WATCHDOG_NOWAYOUT=y
1374
1375#
1376# Watchdog Device Drivers
1377#
1378# CONFIG_SOFT_WATCHDOG is not set
1379CONFIG_OMAP_WATCHDOG=y
1380# CONFIG_TWL4030_WATCHDOG is not set
1381
1382#
1383# USB-based Watchdog Cards
1384#
1385# CONFIG_USBPCWATCHDOG is not set
1386CONFIG_SSB_POSSIBLE=y
1387
1388#
1389# Sonics Silicon Backplane
1390#
1391# CONFIG_SSB is not set
1392
1393#
1394# Multifunction device drivers
1395#
1396# CONFIG_MFD_CORE is not set
1397# CONFIG_MFD_SM501 is not set
1398# CONFIG_MFD_ASIC3 is not set
1399# CONFIG_HTC_EGPIO is not set
1400# CONFIG_HTC_PASIC3 is not set
1401# CONFIG_TPS65010 is not set
1402CONFIG_TWL4030_CORE=y
1403# CONFIG_TWL4030_POWER is not set
1404# CONFIG_TWL4030_CODEC is not set
1405# CONFIG_MFD_TMIO is not set
1406# CONFIG_MFD_T7L66XB is not set
1407# CONFIG_MFD_TC6387XB is not set
1408# CONFIG_MFD_TC6393XB is not set
1409# CONFIG_PMIC_DA903X is not set
1410# CONFIG_MFD_WM8400 is not set
1411# CONFIG_MFD_WM831X is not set
1412# CONFIG_MFD_WM8350_I2C is not set
1413# CONFIG_MFD_PCF50633 is not set
1414# CONFIG_MFD_MC13783 is not set
1415# CONFIG_AB3100_CORE is not set
1416# CONFIG_EZX_PCAP is not set
1417CONFIG_REGULATOR=y
1418# CONFIG_REGULATOR_DEBUG is not set
1419# CONFIG_REGULATOR_FIXED_VOLTAGE is not set
1420# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
1421# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
1422# CONFIG_REGULATOR_BQ24022 is not set
1423# CONFIG_REGULATOR_MAX1586 is not set
1424CONFIG_REGULATOR_TWL4030=y
1425# CONFIG_REGULATOR_LP3971 is not set
1426# CONFIG_REGULATOR_TPS65023 is not set
1427# CONFIG_REGULATOR_TPS6507X is not set
1428# CONFIG_MEDIA_SUPPORT is not set
1429
1430#
1431# Graphics support
1432#
1433# CONFIG_VGASTATE is not set
1434# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1435CONFIG_FB=y
1436# CONFIG_FIRMWARE_EDID is not set
1437# CONFIG_FB_DDC is not set
1438# CONFIG_FB_BOOT_VESA_SUPPORT is not set
1439# CONFIG_FB_CFB_FILLRECT is not set
1440# CONFIG_FB_CFB_COPYAREA is not set
1441# CONFIG_FB_CFB_IMAGEBLIT is not set
1442# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1443# CONFIG_FB_SYS_FILLRECT is not set
1444# CONFIG_FB_SYS_COPYAREA is not set
1445# CONFIG_FB_SYS_IMAGEBLIT is not set
1446# CONFIG_FB_FOREIGN_ENDIAN is not set
1447# CONFIG_FB_SYS_FOPS is not set
1448# CONFIG_FB_SVGALIB is not set
1449# CONFIG_FB_MACMODES is not set
1450# CONFIG_FB_BACKLIGHT is not set
1451# CONFIG_FB_MODE_HELPERS is not set
1452# CONFIG_FB_TILEBLITTING is not set
1453
1454#
1455# Frame buffer hardware drivers
1456#
1457# CONFIG_FB_S1D13XXX is not set
1458# CONFIG_FB_VIRTUAL is not set
1459# CONFIG_FB_METRONOME is not set
1460# CONFIG_FB_MB862XX is not set
1461# CONFIG_FB_BROADSHEET is not set
1462# CONFIG_FB_OMAP is not set
1463# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1464CONFIG_BACKLIGHT_CLASS_DEVICE=y
1465CONFIG_BACKLIGHT_GENERIC=y
1466
1467#
1468# Display device support
1469#
1470CONFIG_DISPLAY_SUPPORT=y
1471
1472#
1473# Display hardware drivers
1474#
1475
1476#
1477# Console display driver support
1478#
1479# CONFIG_VGA_CONSOLE is not set
1480CONFIG_DUMMY_CONSOLE=y
1481CONFIG_FRAMEBUFFER_CONSOLE=y
1482# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
1483CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
1484# CONFIG_FONTS is not set
1485CONFIG_FONT_8x8=y
1486CONFIG_FONT_8x16=y
1487CONFIG_LOGO=y
1488CONFIG_LOGO_LINUX_MONO=y
1489CONFIG_LOGO_LINUX_VGA16=y
1490CONFIG_LOGO_LINUX_CLUT224=y
1491CONFIG_SOUND=y
1492CONFIG_SOUND_OSS_CORE=y
1493CONFIG_SOUND_OSS_CORE_PRECLAIM=y
1494CONFIG_SND=y
1495CONFIG_SND_TIMER=y
1496CONFIG_SND_PCM=y
1497CONFIG_SND_HWDEP=y
1498CONFIG_SND_RAWMIDI=y
1499CONFIG_SND_JACK=y
1500CONFIG_SND_SEQUENCER=m
1501# CONFIG_SND_SEQ_DUMMY is not set
1502CONFIG_SND_OSSEMUL=y
1503CONFIG_SND_MIXER_OSS=y
1504CONFIG_SND_PCM_OSS=y
1505CONFIG_SND_PCM_OSS_PLUGINS=y
1506CONFIG_SND_SEQUENCER_OSS=y
1507CONFIG_SND_HRTIMER=m
1508CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
1509# CONFIG_SND_DYNAMIC_MINORS is not set
1510CONFIG_SND_SUPPORT_OLD_API=y
1511CONFIG_SND_VERBOSE_PROCFS=y
1512# CONFIG_SND_VERBOSE_PRINTK is not set
1513# CONFIG_SND_DEBUG is not set
1514CONFIG_SND_RAWMIDI_SEQ=m
1515# CONFIG_SND_OPL3_LIB_SEQ is not set
1516# CONFIG_SND_OPL4_LIB_SEQ is not set
1517# CONFIG_SND_SBAWE_SEQ is not set
1518# CONFIG_SND_EMU10K1_SEQ is not set
1519CONFIG_SND_DRIVERS=y
1520# CONFIG_SND_DUMMY is not set
1521# CONFIG_SND_VIRMIDI is not set
1522# CONFIG_SND_MTPAV is not set
1523# CONFIG_SND_SERIAL_U16550 is not set
1524# CONFIG_SND_MPU401 is not set
1525# CONFIG_SND_ARM is not set
1526CONFIG_SND_SPI=y
1527CONFIG_SND_USB=y
1528CONFIG_SND_USB_AUDIO=y
1529CONFIG_SND_USB_CAIAQ=m
1530CONFIG_SND_USB_CAIAQ_INPUT=y
1531CONFIG_SND_SOC=y
1532CONFIG_SND_OMAP_SOC=y
1533CONFIG_SND_SOC_I2C_AND_SPI=y
1534# CONFIG_SND_SOC_ALL_CODECS is not set
1535# CONFIG_SOUND_PRIME is not set
1536CONFIG_HID_SUPPORT=y
1537CONFIG_HID=y
1538# CONFIG_HIDRAW is not set
1539
1540#
1541# USB Input Devices
1542#
1543CONFIG_USB_HID=y
1544# CONFIG_HID_PID is not set
1545# CONFIG_USB_HIDDEV is not set
1546
1547#
1548# Special HID drivers
1549#
1550# CONFIG_HID_A4TECH is not set
1551# CONFIG_HID_APPLE is not set
1552# CONFIG_HID_BELKIN is not set
1553# CONFIG_HID_CHERRY is not set
1554# CONFIG_HID_CHICONY is not set
1555# CONFIG_HID_CYPRESS is not set
1556# CONFIG_HID_DRAGONRISE is not set
1557# CONFIG_HID_EZKEY is not set
1558# CONFIG_HID_KYE is not set
1559# CONFIG_HID_GYRATION is not set
1560# CONFIG_HID_TWINHAN is not set
1561# CONFIG_HID_KENSINGTON is not set
1562# CONFIG_HID_LOGITECH is not set
1563# CONFIG_HID_MICROSOFT is not set
1564# CONFIG_HID_MONTEREY is not set
1565# CONFIG_HID_NTRIG is not set
1566# CONFIG_HID_PANTHERLORD is not set
1567# CONFIG_HID_PETALYNX is not set
1568# CONFIG_HID_SAMSUNG is not set
1569# CONFIG_HID_SONY is not set
1570# CONFIG_HID_SUNPLUS is not set
1571# CONFIG_HID_GREENASIA is not set
1572# CONFIG_HID_SMARTJOYPLUS is not set
1573# CONFIG_HID_TOPSEED is not set
1574# CONFIG_HID_THRUSTMASTER is not set
1575# CONFIG_HID_WACOM is not set
1576# CONFIG_HID_ZEROPLUS is not set
1577CONFIG_USB_SUPPORT=y
1578CONFIG_USB_ARCH_HAS_HCD=y
1579CONFIG_USB_ARCH_HAS_OHCI=y
1580# CONFIG_USB_ARCH_HAS_EHCI is not set
1581CONFIG_USB=y
1582# CONFIG_USB_DEBUG is not set
1583# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1584
1585#
1586# Miscellaneous USB options
1587#
1588CONFIG_USB_DEVICEFS=y
1589CONFIG_USB_DEVICE_CLASS=y
1590# CONFIG_USB_DYNAMIC_MINORS is not set
1591CONFIG_USB_SUSPEND=y
1592CONFIG_USB_OTG=y
1593# CONFIG_USB_OTG_WHITELIST is not set
1594# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1595CONFIG_USB_MON=y
1596# CONFIG_USB_WUSB is not set
1597# CONFIG_USB_WUSB_CBAF is not set
1598
1599#
1600# USB Host Controller Drivers
1601#
1602# CONFIG_USB_C67X00_HCD is not set
1603CONFIG_USB_OXU210HP_HCD=y
1604# CONFIG_USB_ISP116X_HCD is not set
1605# CONFIG_USB_ISP1760_HCD is not set
1606# CONFIG_USB_ISP1362_HCD is not set
1607# CONFIG_USB_OHCI_HCD is not set
1608# CONFIG_USB_SL811_HCD is not set
1609# CONFIG_USB_R8A66597_HCD is not set
1610# CONFIG_USB_HWA_HCD is not set
1611CONFIG_USB_MUSB_HDRC=y
1612CONFIG_USB_MUSB_SOC=y
1613
1614#
1615# OMAP 343x high speed USB support
1616#
1617# CONFIG_USB_MUSB_HOST is not set
1618# CONFIG_USB_MUSB_PERIPHERAL is not set
1619CONFIG_USB_MUSB_OTG=y
1620CONFIG_USB_GADGET_MUSB_HDRC=y
1621CONFIG_USB_MUSB_HDRC_HCD=y
1622# CONFIG_MUSB_PIO_ONLY is not set
1623CONFIG_USB_INVENTRA_DMA=y
1624# CONFIG_USB_TI_CPPI_DMA is not set
1625# CONFIG_USB_MUSB_DEBUG is not set
1626
1627#
1628# USB Device Class drivers
1629#
1630CONFIG_USB_ACM=m
1631CONFIG_USB_PRINTER=m
1632CONFIG_USB_WDM=m
1633CONFIG_USB_TMC=m
1634
1635#
1636# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1637#
1638
1639#
1640# also be needed; see USB_STORAGE Help for more info
1641#
1642CONFIG_USB_STORAGE=y
1643# CONFIG_USB_STORAGE_DEBUG is not set
1644# CONFIG_USB_STORAGE_DATAFAB is not set
1645# CONFIG_USB_STORAGE_FREECOM is not set
1646# CONFIG_USB_STORAGE_ISD200 is not set
1647# CONFIG_USB_STORAGE_USBAT is not set
1648# CONFIG_USB_STORAGE_SDDR09 is not set
1649# CONFIG_USB_STORAGE_SDDR55 is not set
1650# CONFIG_USB_STORAGE_JUMPSHOT is not set
1651# CONFIG_USB_STORAGE_ALAUDA is not set
1652# CONFIG_USB_STORAGE_ONETOUCH is not set
1653# CONFIG_USB_STORAGE_KARMA is not set
1654# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1655# CONFIG_USB_LIBUSUAL is not set
1656
1657#
1658# USB Imaging devices
1659#
1660# CONFIG_USB_MDC800 is not set
1661# CONFIG_USB_MICROTEK is not set
1662
1663#
1664# USB port drivers
1665#
1666CONFIG_USB_SERIAL=m
1667CONFIG_USB_EZUSB=y
1668CONFIG_USB_SERIAL_GENERIC=y
1669CONFIG_USB_SERIAL_AIRCABLE=m
1670CONFIG_USB_SERIAL_ARK3116=m
1671CONFIG_USB_SERIAL_BELKIN=m
1672CONFIG_USB_SERIAL_CH341=m
1673CONFIG_USB_SERIAL_WHITEHEAT=m
1674CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1675# CONFIG_USB_SERIAL_CP210X is not set
1676CONFIG_USB_SERIAL_CYPRESS_M8=m
1677CONFIG_USB_SERIAL_EMPEG=m
1678CONFIG_USB_SERIAL_FTDI_SIO=m
1679CONFIG_USB_SERIAL_FUNSOFT=m
1680CONFIG_USB_SERIAL_VISOR=m
1681CONFIG_USB_SERIAL_IPAQ=m
1682CONFIG_USB_SERIAL_IR=m
1683CONFIG_USB_SERIAL_EDGEPORT=m
1684CONFIG_USB_SERIAL_EDGEPORT_TI=m
1685CONFIG_USB_SERIAL_GARMIN=m
1686CONFIG_USB_SERIAL_IPW=m
1687CONFIG_USB_SERIAL_IUU=m
1688CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1689CONFIG_USB_SERIAL_KEYSPAN=m
1690CONFIG_USB_SERIAL_KEYSPAN_MPR=y
1691CONFIG_USB_SERIAL_KEYSPAN_USA28=y
1692CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
1693CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
1694CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
1695CONFIG_USB_SERIAL_KEYSPAN_USA19=y
1696CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
1697CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
1698CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
1699CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
1700CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
1701CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1702CONFIG_USB_SERIAL_KLSI=m
1703CONFIG_USB_SERIAL_KOBIL_SCT=m
1704CONFIG_USB_SERIAL_MCT_U232=m
1705CONFIG_USB_SERIAL_MOS7720=m
1706CONFIG_USB_SERIAL_MOS7840=m
1707CONFIG_USB_SERIAL_MOTOROLA=m
1708CONFIG_USB_SERIAL_NAVMAN=m
1709CONFIG_USB_SERIAL_PL2303=m
1710CONFIG_USB_SERIAL_OTI6858=m
1711# CONFIG_USB_SERIAL_QUALCOMM is not set
1712CONFIG_USB_SERIAL_SPCP8X5=m
1713CONFIG_USB_SERIAL_HP4X=m
1714CONFIG_USB_SERIAL_SAFE=m
1715# CONFIG_USB_SERIAL_SAFE_PADDED is not set
1716CONFIG_USB_SERIAL_SIEMENS_MPI=m
1717CONFIG_USB_SERIAL_SIERRAWIRELESS=m
1718# CONFIG_USB_SERIAL_SYMBOL is not set
1719CONFIG_USB_SERIAL_TI=m
1720CONFIG_USB_SERIAL_CYBERJACK=m
1721CONFIG_USB_SERIAL_XIRCOM=m
1722CONFIG_USB_SERIAL_OPTION=m
1723CONFIG_USB_SERIAL_OMNINET=m
1724CONFIG_USB_SERIAL_OPTICON=m
1725CONFIG_USB_SERIAL_DEBUG=m
1726
1727#
1728# USB Miscellaneous drivers
1729#
1730CONFIG_USB_EMI62=m
1731CONFIG_USB_EMI26=m
1732# CONFIG_USB_ADUTUX is not set
1733# CONFIG_USB_SEVSEG is not set
1734# CONFIG_USB_RIO500 is not set
1735# CONFIG_USB_LEGOTOWER is not set
1736# CONFIG_USB_LCD is not set
1737# CONFIG_USB_BERRY_CHARGE is not set
1738# CONFIG_USB_LED is not set
1739# CONFIG_USB_CYPRESS_CY7C63 is not set
1740# CONFIG_USB_CYTHERM is not set
1741# CONFIG_USB_IDMOUSE is not set
1742# CONFIG_USB_FTDI_ELAN is not set
1743# CONFIG_USB_APPLEDISPLAY is not set
1744CONFIG_USB_SISUSBVGA=m
1745CONFIG_USB_SISUSBVGA_CON=y
1746# CONFIG_USB_LD is not set
1747# CONFIG_USB_TRANCEVIBRATOR is not set
1748# CONFIG_USB_IOWARRIOR is not set
1749CONFIG_USB_TEST=m
1750# CONFIG_USB_ISIGHTFW is not set
1751# CONFIG_USB_VST is not set
1752# CONFIG_USB_ATM is not set
1753CONFIG_USB_GADGET=m
1754# CONFIG_USB_GADGET_DEBUG is not set
1755# CONFIG_USB_GADGET_DEBUG_FILES is not set
1756CONFIG_USB_GADGET_DEBUG_FS=y
1757CONFIG_USB_GADGET_VBUS_DRAW=2
1758CONFIG_USB_GADGET_SELECTED=y
1759# CONFIG_USB_GADGET_AT91 is not set
1760# CONFIG_USB_GADGET_ATMEL_USBA is not set
1761# CONFIG_USB_GADGET_FSL_USB2 is not set
1762# CONFIG_USB_GADGET_LH7A40X is not set
1763# CONFIG_USB_GADGET_OMAP is not set
1764# CONFIG_USB_GADGET_PXA25X is not set
1765# CONFIG_USB_GADGET_R8A66597 is not set
1766# CONFIG_USB_GADGET_PXA27X is not set
1767# CONFIG_USB_GADGET_S3C_HSOTG is not set
1768# CONFIG_USB_GADGET_IMX is not set
1769# CONFIG_USB_GADGET_S3C2410 is not set
1770# CONFIG_USB_GADGET_M66592 is not set
1771# CONFIG_USB_GADGET_AMD5536UDC is not set
1772# CONFIG_USB_GADGET_FSL_QE is not set
1773# CONFIG_USB_GADGET_CI13XXX is not set
1774# CONFIG_USB_GADGET_NET2280 is not set
1775# CONFIG_USB_GADGET_GOKU is not set
1776# CONFIG_USB_GADGET_LANGWELL is not set
1777# CONFIG_USB_GADGET_DUMMY_HCD is not set
1778CONFIG_USB_GADGET_DUALSPEED=y
1779CONFIG_USB_ZERO=m
1780CONFIG_USB_ZERO_HNPTEST=y
1781# CONFIG_USB_AUDIO is not set
1782CONFIG_USB_ETH=m
1783CONFIG_USB_ETH_RNDIS=y
1784# CONFIG_USB_ETH_EEM is not set
1785CONFIG_USB_GADGETFS=m
1786CONFIG_USB_FILE_STORAGE=m
1787# CONFIG_USB_FILE_STORAGE_TEST is not set
1788CONFIG_USB_G_SERIAL=m
1789CONFIG_USB_MIDI_GADGET=m
1790CONFIG_USB_G_PRINTER=m
1791CONFIG_USB_CDC_COMPOSITE=m
1792
1793#
1794# OTG and related infrastructure
1795#
1796CONFIG_USB_OTG_UTILS=y
1797CONFIG_USB_GPIO_VBUS=y
1798# CONFIG_ISP1301_OMAP is not set
1799CONFIG_TWL4030_USB=y
1800# CONFIG_NOP_USB_XCEIV is not set
1801CONFIG_MMC=y
1802# CONFIG_MMC_DEBUG is not set
1803CONFIG_MMC_UNSAFE_RESUME=y
1804
1805#
1806# MMC/SD/SDIO Card Drivers
1807#
1808CONFIG_MMC_BLOCK=y
1809CONFIG_MMC_BLOCK_BOUNCE=y
1810CONFIG_SDIO_UART=y
1811# CONFIG_MMC_TEST is not set
1812
1813#
1814# MMC/SD/SDIO Host Controller Drivers
1815#
1816# CONFIG_MMC_SDHCI is not set
1817# CONFIG_MMC_OMAP is not set
1818CONFIG_MMC_OMAP_HS=y
1819# CONFIG_MMC_AT91 is not set
1820# CONFIG_MMC_ATMELMCI is not set
1821CONFIG_MMC_SPI=m
1822# CONFIG_MEMSTICK is not set
1823CONFIG_NEW_LEDS=y
1824CONFIG_LEDS_CLASS=y
1825
1826#
1827# LED drivers
1828#
1829# CONFIG_LEDS_PCA9532 is not set
1830CONFIG_LEDS_GPIO=y
1831CONFIG_LEDS_GPIO_PLATFORM=y
1832# CONFIG_LEDS_LP3944 is not set
1833# CONFIG_LEDS_PCA955X is not set
1834# CONFIG_LEDS_DAC124S085 is not set
1835# CONFIG_LEDS_BD2802 is not set
1836
1837#
1838# LED Triggers
1839#
1840CONFIG_LEDS_TRIGGERS=y
1841CONFIG_LEDS_TRIGGER_TIMER=m
1842CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1843CONFIG_LEDS_TRIGGER_BACKLIGHT=m
1844# CONFIG_LEDS_TRIGGER_GPIO is not set
1845CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
1846
1847#
1848# iptables trigger is under Netfilter config (LED target)
1849#
1850# CONFIG_ACCESSIBILITY is not set
1851CONFIG_RTC_LIB=y
1852CONFIG_RTC_CLASS=y
1853CONFIG_RTC_HCTOSYS=y
1854CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1855# CONFIG_RTC_DEBUG is not set
1856
1857#
1858# RTC interfaces
1859#
1860CONFIG_RTC_INTF_SYSFS=y
1861CONFIG_RTC_INTF_PROC=y
1862CONFIG_RTC_INTF_DEV=y
1863# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1864# CONFIG_RTC_DRV_TEST is not set
1865
1866#
1867# I2C RTC drivers
1868#
1869# CONFIG_RTC_DRV_DS1307 is not set
1870# CONFIG_RTC_DRV_DS1374 is not set
1871# CONFIG_RTC_DRV_DS1672 is not set
1872# CONFIG_RTC_DRV_MAX6900 is not set
1873# CONFIG_RTC_DRV_RS5C372 is not set
1874# CONFIG_RTC_DRV_ISL1208 is not set
1875# CONFIG_RTC_DRV_X1205 is not set
1876# CONFIG_RTC_DRV_PCF8563 is not set
1877# CONFIG_RTC_DRV_PCF8583 is not set
1878# CONFIG_RTC_DRV_M41T80 is not set
1879CONFIG_RTC_DRV_TWL4030=y
1880# CONFIG_RTC_DRV_S35390A is not set
1881# CONFIG_RTC_DRV_FM3130 is not set
1882# CONFIG_RTC_DRV_RX8581 is not set
1883# CONFIG_RTC_DRV_RX8025 is not set
1884
1885#
1886# SPI RTC drivers
1887#
1888# CONFIG_RTC_DRV_M41T94 is not set
1889# CONFIG_RTC_DRV_DS1305 is not set
1890# CONFIG_RTC_DRV_DS1390 is not set
1891# CONFIG_RTC_DRV_MAX6902 is not set
1892# CONFIG_RTC_DRV_R9701 is not set
1893# CONFIG_RTC_DRV_RS5C348 is not set
1894# CONFIG_RTC_DRV_DS3234 is not set
1895# CONFIG_RTC_DRV_PCF2123 is not set
1896
1897#
1898# Platform RTC drivers
1899#
1900# CONFIG_RTC_DRV_CMOS is not set
1901# CONFIG_RTC_DRV_DS1286 is not set
1902# CONFIG_RTC_DRV_DS1511 is not set
1903# CONFIG_RTC_DRV_DS1553 is not set
1904# CONFIG_RTC_DRV_DS1742 is not set
1905# CONFIG_RTC_DRV_STK17TA8 is not set
1906# CONFIG_RTC_DRV_M48T86 is not set
1907# CONFIG_RTC_DRV_M48T35 is not set
1908# CONFIG_RTC_DRV_M48T59 is not set
1909# CONFIG_RTC_DRV_BQ4802 is not set
1910# CONFIG_RTC_DRV_V3020 is not set
1911
1912#
1913# on-CPU RTC drivers
1914#
1915# CONFIG_DMADEVICES is not set
1916# CONFIG_AUXDISPLAY is not set
1917CONFIG_UIO=m
1918CONFIG_UIO_PDRV=m
1919CONFIG_UIO_PDRV_GENIRQ=m
1920# CONFIG_UIO_SMX is not set
1921# CONFIG_UIO_SERCOS3 is not set
1922
1923#
1924# TI VLYNQ
1925#
1926CONFIG_STAGING=y
1927# CONFIG_STAGING_EXCLUDE_BUILD is not set
1928# CONFIG_USB_IP_COMMON is not set
1929# CONFIG_W35UND is not set
1930# CONFIG_PRISM2_USB is not set
1931# CONFIG_ECHO is not set
1932# CONFIG_OTUS is not set
1933# CONFIG_COMEDI is not set
1934# CONFIG_ASUS_OLED is not set
1935# CONFIG_INPUT_MIMIO is not set
1936# CONFIG_TRANZPORT is not set
1937
1938#
1939# Android
1940#
1941
1942#
1943# Qualcomm MSM Camera And Video
1944#
1945
1946#
1947# Camera Sensor Selection
1948#
1949# CONFIG_INPUT_GPIO is not set
1950# CONFIG_DST is not set
1951# CONFIG_POHMELFS is not set
1952# CONFIG_PLAN9AUTH is not set
1953# CONFIG_LINE6_USB is not set
1954# CONFIG_USB_SERIAL_QUATECH2 is not set
1955# CONFIG_USB_SERIAL_QUATECH_USB2 is not set
1956# CONFIG_VT6656 is not set
1957# CONFIG_FB_UDL is not set
1958
1959#
1960# RAR Register Driver
1961#
1962# CONFIG_RAR_REGISTER is not set
1963# CONFIG_IIO is not set
1964
1965#
1966# File systems
1967#
1968CONFIG_EXT2_FS=y
1969# CONFIG_EXT2_FS_XATTR is not set
1970# CONFIG_EXT2_FS_XIP is not set
1971CONFIG_EXT3_FS=y
1972# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1973# CONFIG_EXT3_FS_XATTR is not set
1974CONFIG_EXT4_FS=m
1975CONFIG_EXT4_FS_XATTR=y
1976# CONFIG_EXT4_FS_POSIX_ACL is not set
1977# CONFIG_EXT4_FS_SECURITY is not set
1978# CONFIG_EXT4_DEBUG is not set
1979CONFIG_JBD=y
1980# CONFIG_JBD_DEBUG is not set
1981CONFIG_JBD2=m
1982# CONFIG_JBD2_DEBUG is not set
1983CONFIG_FS_MBCACHE=m
1984CONFIG_REISERFS_FS=m
1985# CONFIG_REISERFS_CHECK is not set
1986CONFIG_REISERFS_PROC_INFO=y
1987CONFIG_REISERFS_FS_XATTR=y
1988# CONFIG_REISERFS_FS_POSIX_ACL is not set
1989# CONFIG_REISERFS_FS_SECURITY is not set
1990CONFIG_JFS_FS=m
1991# CONFIG_JFS_POSIX_ACL is not set
1992# CONFIG_JFS_SECURITY is not set
1993# CONFIG_JFS_DEBUG is not set
1994# CONFIG_JFS_STATISTICS is not set
1995CONFIG_FS_POSIX_ACL=y
1996CONFIG_XFS_FS=m
1997# CONFIG_XFS_QUOTA is not set
1998# CONFIG_XFS_POSIX_ACL is not set
1999# CONFIG_XFS_RT is not set
2000# CONFIG_XFS_DEBUG is not set
2001# CONFIG_GFS2_FS is not set
2002# CONFIG_OCFS2_FS is not set
2003# CONFIG_BTRFS_FS is not set
2004# CONFIG_NILFS2_FS is not set
2005CONFIG_FILE_LOCKING=y
2006CONFIG_FSNOTIFY=y
2007CONFIG_DNOTIFY=y
2008CONFIG_INOTIFY=y
2009CONFIG_INOTIFY_USER=y
2010CONFIG_QUOTA=y
2011# CONFIG_QUOTA_NETLINK_INTERFACE is not set
2012CONFIG_PRINT_QUOTA_WARNING=y
2013CONFIG_QUOTA_TREE=y
2014# CONFIG_QFMT_V1 is not set
2015CONFIG_QFMT_V2=y
2016CONFIG_QUOTACTL=y
2017# CONFIG_AUTOFS_FS is not set
2018CONFIG_AUTOFS4_FS=m
2019CONFIG_FUSE_FS=y
2020# CONFIG_CUSE is not set
2021
2022#
2023# Caches
2024#
2025# CONFIG_FSCACHE is not set
2026
2027#
2028# CD-ROM/DVD Filesystems
2029#
2030CONFIG_ISO9660_FS=m
2031CONFIG_JOLIET=y
2032CONFIG_ZISOFS=y
2033CONFIG_UDF_FS=m
2034CONFIG_UDF_NLS=y
2035
2036#
2037# DOS/FAT/NT Filesystems
2038#
2039CONFIG_FAT_FS=y
2040CONFIG_MSDOS_FS=y
2041CONFIG_VFAT_FS=y
2042CONFIG_FAT_DEFAULT_CODEPAGE=437
2043CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
2044CONFIG_NTFS_FS=m
2045# CONFIG_NTFS_DEBUG is not set
2046CONFIG_NTFS_RW=y
2047
2048#
2049# Pseudo filesystems
2050#
2051CONFIG_PROC_FS=y
2052CONFIG_PROC_SYSCTL=y
2053CONFIG_PROC_PAGE_MONITOR=y
2054CONFIG_SYSFS=y
2055CONFIG_TMPFS=y
2056# CONFIG_TMPFS_POSIX_ACL is not set
2057# CONFIG_HUGETLB_PAGE is not set
2058CONFIG_CONFIGFS_FS=m
2059CONFIG_MISC_FILESYSTEMS=y
2060# CONFIG_ADFS_FS is not set
2061# CONFIG_AFFS_FS is not set
2062# CONFIG_ECRYPT_FS is not set
2063# CONFIG_HFS_FS is not set
2064# CONFIG_HFSPLUS_FS is not set
2065# CONFIG_BEFS_FS is not set
2066# CONFIG_BFS_FS is not set
2067# CONFIG_EFS_FS is not set
2068CONFIG_JFFS2_FS=y
2069CONFIG_JFFS2_FS_DEBUG=0
2070CONFIG_JFFS2_FS_WRITEBUFFER=y
2071# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
2072CONFIG_JFFS2_SUMMARY=y
2073CONFIG_JFFS2_FS_XATTR=y
2074CONFIG_JFFS2_FS_POSIX_ACL=y
2075CONFIG_JFFS2_FS_SECURITY=y
2076CONFIG_JFFS2_COMPRESSION_OPTIONS=y
2077CONFIG_JFFS2_ZLIB=y
2078CONFIG_JFFS2_LZO=y
2079CONFIG_JFFS2_RTIME=y
2080CONFIG_JFFS2_RUBIN=y
2081# CONFIG_JFFS2_CMODE_NONE is not set
2082# CONFIG_JFFS2_CMODE_PRIORITY is not set
2083# CONFIG_JFFS2_CMODE_SIZE is not set
2084CONFIG_JFFS2_CMODE_FAVOURLZO=y
2085CONFIG_UBIFS_FS=y
2086CONFIG_UBIFS_FS_XATTR=y
2087CONFIG_UBIFS_FS_ADVANCED_COMPR=y
2088CONFIG_UBIFS_FS_LZO=y
2089CONFIG_UBIFS_FS_ZLIB=y
2090# CONFIG_UBIFS_FS_DEBUG is not set
2091# CONFIG_CRAMFS is not set
2092CONFIG_SQUASHFS=y
2093# CONFIG_SQUASHFS_EMBEDDED is not set
2094CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
2095# CONFIG_VXFS_FS is not set
2096# CONFIG_MINIX_FS is not set
2097# CONFIG_OMFS_FS is not set
2098# CONFIG_HPFS_FS is not set
2099# CONFIG_QNX4FS_FS is not set
2100# CONFIG_ROMFS_FS is not set
2101# CONFIG_SYSV_FS is not set
2102# CONFIG_UFS_FS is not set
2103CONFIG_NETWORK_FILESYSTEMS=y
2104CONFIG_NFS_FS=y
2105CONFIG_NFS_V3=y
2106# CONFIG_NFS_V3_ACL is not set
2107CONFIG_NFS_V4=y
2108# CONFIG_NFS_V4_1 is not set
2109CONFIG_ROOT_NFS=y
2110CONFIG_NFSD=m
2111CONFIG_NFSD_V2_ACL=y
2112CONFIG_NFSD_V3=y
2113CONFIG_NFSD_V3_ACL=y
2114CONFIG_NFSD_V4=y
2115CONFIG_LOCKD=y
2116CONFIG_LOCKD_V4=y
2117CONFIG_EXPORTFS=m
2118CONFIG_NFS_ACL_SUPPORT=m
2119CONFIG_NFS_COMMON=y
2120CONFIG_SUNRPC=y
2121CONFIG_SUNRPC_GSS=y
2122CONFIG_RPCSEC_GSS_KRB5=y
2123# CONFIG_RPCSEC_GSS_SPKM3 is not set
2124# CONFIG_SMB_FS is not set
2125CONFIG_CIFS=m
2126CONFIG_CIFS_STATS=y
2127CONFIG_CIFS_STATS2=y
2128# CONFIG_CIFS_WEAK_PW_HASH is not set
2129# CONFIG_CIFS_UPCALL is not set
2130# CONFIG_CIFS_XATTR is not set
2131# CONFIG_CIFS_DEBUG2 is not set
2132# CONFIG_CIFS_DFS_UPCALL is not set
2133CONFIG_CIFS_EXPERIMENTAL=y
2134# CONFIG_NCP_FS is not set
2135# CONFIG_CODA_FS is not set
2136# CONFIG_AFS_FS is not set
2137
2138#
2139# Partition Types
2140#
2141CONFIG_PARTITION_ADVANCED=y
2142# CONFIG_ACORN_PARTITION is not set
2143# CONFIG_OSF_PARTITION is not set
2144# CONFIG_AMIGA_PARTITION is not set
2145# CONFIG_ATARI_PARTITION is not set
2146# CONFIG_MAC_PARTITION is not set
2147CONFIG_MSDOS_PARTITION=y
2148CONFIG_BSD_DISKLABEL=y
2149CONFIG_MINIX_SUBPARTITION=y
2150CONFIG_SOLARIS_X86_PARTITION=y
2151CONFIG_UNIXWARE_DISKLABEL=y
2152# CONFIG_LDM_PARTITION is not set
2153# CONFIG_SGI_PARTITION is not set
2154# CONFIG_ULTRIX_PARTITION is not set
2155# CONFIG_SUN_PARTITION is not set
2156# CONFIG_KARMA_PARTITION is not set
2157CONFIG_EFI_PARTITION=y
2158# CONFIG_SYSV68_PARTITION is not set
2159CONFIG_NLS=y
2160CONFIG_NLS_DEFAULT="iso8859-1"
2161CONFIG_NLS_CODEPAGE_437=y
2162CONFIG_NLS_CODEPAGE_737=m
2163CONFIG_NLS_CODEPAGE_775=m
2164CONFIG_NLS_CODEPAGE_850=m
2165CONFIG_NLS_CODEPAGE_852=m
2166CONFIG_NLS_CODEPAGE_855=m
2167CONFIG_NLS_CODEPAGE_857=m
2168CONFIG_NLS_CODEPAGE_860=m
2169CONFIG_NLS_CODEPAGE_861=m
2170CONFIG_NLS_CODEPAGE_862=m
2171CONFIG_NLS_CODEPAGE_863=m
2172CONFIG_NLS_CODEPAGE_864=m
2173CONFIG_NLS_CODEPAGE_865=m
2174CONFIG_NLS_CODEPAGE_866=m
2175CONFIG_NLS_CODEPAGE_869=m
2176CONFIG_NLS_CODEPAGE_936=m
2177CONFIG_NLS_CODEPAGE_950=m
2178CONFIG_NLS_CODEPAGE_932=m
2179CONFIG_NLS_CODEPAGE_949=m
2180CONFIG_NLS_CODEPAGE_874=m
2181CONFIG_NLS_ISO8859_8=m
2182CONFIG_NLS_CODEPAGE_1250=m
2183CONFIG_NLS_CODEPAGE_1251=m
2184CONFIG_NLS_ASCII=m
2185CONFIG_NLS_ISO8859_1=m
2186CONFIG_NLS_ISO8859_2=m
2187CONFIG_NLS_ISO8859_3=m
2188CONFIG_NLS_ISO8859_4=m
2189CONFIG_NLS_ISO8859_5=m
2190CONFIG_NLS_ISO8859_6=m
2191CONFIG_NLS_ISO8859_7=m
2192CONFIG_NLS_ISO8859_9=m
2193CONFIG_NLS_ISO8859_13=m
2194CONFIG_NLS_ISO8859_14=m
2195CONFIG_NLS_ISO8859_15=m
2196CONFIG_NLS_KOI8_R=m
2197CONFIG_NLS_KOI8_U=m
2198CONFIG_NLS_UTF8=y
2199# CONFIG_DLM is not set
2200
2201#
2202# Kernel hacking
2203#
2204CONFIG_PRINTK_TIME=y
2205CONFIG_ENABLE_WARN_DEPRECATED=y
2206CONFIG_ENABLE_MUST_CHECK=y
2207CONFIG_FRAME_WARN=1024
2208CONFIG_MAGIC_SYSRQ=y
2209# CONFIG_STRIP_ASM_SYMS is not set
2210# CONFIG_UNUSED_SYMBOLS is not set
2211CONFIG_DEBUG_FS=y
2212# CONFIG_HEADERS_CHECK is not set
2213CONFIG_DEBUG_KERNEL=y
2214# CONFIG_DEBUG_SHIRQ is not set
2215CONFIG_DETECT_SOFTLOCKUP=y
2216# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
2217CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
2218CONFIG_DETECT_HUNG_TASK=y
2219# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
2220CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
2221CONFIG_SCHED_DEBUG=y
2222CONFIG_SCHEDSTATS=y
2223CONFIG_TIMER_STATS=y
2224# CONFIG_DEBUG_OBJECTS is not set
2225# CONFIG_DEBUG_SLAB is not set
2226# CONFIG_DEBUG_KMEMLEAK is not set
2227CONFIG_DEBUG_PREEMPT=y
2228# CONFIG_DEBUG_RT_MUTEXES is not set
2229# CONFIG_RT_MUTEX_TESTER is not set
2230# CONFIG_DEBUG_SPINLOCK is not set
2231CONFIG_DEBUG_MUTEXES=y
2232# CONFIG_DEBUG_LOCK_ALLOC is not set
2233# CONFIG_PROVE_LOCKING is not set
2234# CONFIG_LOCK_STAT is not set
2235# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
2236# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
2237CONFIG_STACKTRACE=y
2238# CONFIG_DEBUG_KOBJECT is not set
2239# CONFIG_DEBUG_BUGVERBOSE is not set
2240# CONFIG_DEBUG_INFO is not set
2241# CONFIG_DEBUG_VM is not set
2242# CONFIG_DEBUG_WRITECOUNT is not set
2243# CONFIG_DEBUG_MEMORY_INIT is not set
2244# CONFIG_DEBUG_LIST is not set
2245# CONFIG_DEBUG_SG is not set
2246# CONFIG_DEBUG_NOTIFIERS is not set
2247# CONFIG_DEBUG_CREDENTIALS is not set
2248# CONFIG_BOOT_PRINTK_DELAY is not set
2249# CONFIG_RCU_TORTURE_TEST is not set
2250# CONFIG_RCU_CPU_STALL_DETECTOR is not set
2251# CONFIG_BACKTRACE_SELF_TEST is not set
2252# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
2253# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
2254# CONFIG_FAULT_INJECTION is not set
2255# CONFIG_LATENCYTOP is not set
2256# CONFIG_PAGE_POISONING is not set
2257CONFIG_NOP_TRACER=y
2258CONFIG_HAVE_FUNCTION_TRACER=y
2259CONFIG_RING_BUFFER=y
2260CONFIG_EVENT_TRACING=y
2261CONFIG_CONTEXT_SWITCH_TRACER=y
2262CONFIG_RING_BUFFER_ALLOW_SWAP=y
2263CONFIG_TRACING=y
2264CONFIG_TRACING_SUPPORT=y
2265CONFIG_FTRACE=y
2266# CONFIG_FUNCTION_TRACER is not set
2267# CONFIG_IRQSOFF_TRACER is not set
2268# CONFIG_PREEMPT_TRACER is not set
2269# CONFIG_SCHED_TRACER is not set
2270# CONFIG_ENABLE_DEFAULT_TRACERS is not set
2271# CONFIG_BOOT_TRACER is not set
2272CONFIG_BRANCH_PROFILE_NONE=y
2273# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
2274# CONFIG_PROFILE_ALL_BRANCHES is not set
2275# CONFIG_STACK_TRACER is not set
2276# CONFIG_KMEMTRACE is not set
2277# CONFIG_WORKQUEUE_TRACER is not set
2278# CONFIG_BLK_DEV_IO_TRACE is not set
2279# CONFIG_RING_BUFFER_BENCHMARK is not set
2280# CONFIG_DYNAMIC_DEBUG is not set
2281# CONFIG_SAMPLES is not set
2282CONFIG_HAVE_ARCH_KGDB=y
2283# CONFIG_KGDB is not set
2284CONFIG_ARM_UNWIND=y
2285# CONFIG_DEBUG_USER is not set
2286# CONFIG_DEBUG_ERRORS is not set
2287# CONFIG_DEBUG_STACK_USAGE is not set
2288# CONFIG_DEBUG_LL is not set
2289
2290#
2291# Security options
2292#
2293CONFIG_KEYS=y
2294# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
2295# CONFIG_SECURITY is not set
2296# CONFIG_SECURITYFS is not set
2297# CONFIG_SECURITY_FILE_CAPABILITIES is not set
2298CONFIG_XOR_BLOCKS=m
2299CONFIG_ASYNC_CORE=m
2300CONFIG_ASYNC_MEMCPY=m
2301CONFIG_ASYNC_XOR=m
2302CONFIG_ASYNC_PQ=m
2303CONFIG_ASYNC_RAID6_RECOV=m
2304CONFIG_CRYPTO=y
2305
2306#
2307# Crypto core or helper
2308#
2309CONFIG_CRYPTO_FIPS=y
2310CONFIG_CRYPTO_ALGAPI=y
2311CONFIG_CRYPTO_ALGAPI2=y
2312CONFIG_CRYPTO_AEAD=m
2313CONFIG_CRYPTO_AEAD2=y
2314CONFIG_CRYPTO_BLKCIPHER=y
2315CONFIG_CRYPTO_BLKCIPHER2=y
2316CONFIG_CRYPTO_HASH=y
2317CONFIG_CRYPTO_HASH2=y
2318CONFIG_CRYPTO_RNG=m
2319CONFIG_CRYPTO_RNG2=y
2320CONFIG_CRYPTO_PCOMP=y
2321CONFIG_CRYPTO_MANAGER=y
2322CONFIG_CRYPTO_MANAGER2=y
2323CONFIG_CRYPTO_GF128MUL=m
2324CONFIG_CRYPTO_NULL=m
2325CONFIG_CRYPTO_WORKQUEUE=y
2326CONFIG_CRYPTO_CRYPTD=m
2327CONFIG_CRYPTO_AUTHENC=m
2328CONFIG_CRYPTO_TEST=m
2329
2330#
2331# Authenticated Encryption with Associated Data
2332#
2333CONFIG_CRYPTO_CCM=m
2334CONFIG_CRYPTO_GCM=m
2335CONFIG_CRYPTO_SEQIV=m
2336
2337#
2338# Block modes
2339#
2340CONFIG_CRYPTO_CBC=y
2341CONFIG_CRYPTO_CTR=m
2342CONFIG_CRYPTO_CTS=m
2343CONFIG_CRYPTO_ECB=y
2344CONFIG_CRYPTO_LRW=m
2345CONFIG_CRYPTO_PCBC=m
2346CONFIG_CRYPTO_XTS=m
2347
2348#
2349# Hash modes
2350#
2351CONFIG_CRYPTO_HMAC=m
2352CONFIG_CRYPTO_XCBC=m
2353# CONFIG_CRYPTO_VMAC is not set
2354
2355#
2356# Digest
2357#
2358CONFIG_CRYPTO_CRC32C=y
2359CONFIG_CRYPTO_GHASH=m
2360CONFIG_CRYPTO_MD4=m
2361CONFIG_CRYPTO_MD5=y
2362CONFIG_CRYPTO_MICHAEL_MIC=y
2363CONFIG_CRYPTO_RMD128=m
2364CONFIG_CRYPTO_RMD160=m
2365CONFIG_CRYPTO_RMD256=m
2366CONFIG_CRYPTO_RMD320=m
2367CONFIG_CRYPTO_SHA1=m
2368CONFIG_CRYPTO_SHA256=m
2369CONFIG_CRYPTO_SHA512=m
2370CONFIG_CRYPTO_TGR192=m
2371CONFIG_CRYPTO_WP512=m
2372
2373#
2374# Ciphers
2375#
2376CONFIG_CRYPTO_AES=y
2377CONFIG_CRYPTO_ANUBIS=m
2378CONFIG_CRYPTO_ARC4=y
2379CONFIG_CRYPTO_BLOWFISH=m
2380CONFIG_CRYPTO_CAMELLIA=m
2381CONFIG_CRYPTO_CAST5=m
2382CONFIG_CRYPTO_CAST6=m
2383CONFIG_CRYPTO_DES=y
2384CONFIG_CRYPTO_FCRYPT=m
2385CONFIG_CRYPTO_KHAZAD=m
2386CONFIG_CRYPTO_SALSA20=m
2387CONFIG_CRYPTO_SEED=m
2388CONFIG_CRYPTO_SERPENT=m
2389CONFIG_CRYPTO_TEA=m
2390CONFIG_CRYPTO_TWOFISH=m
2391CONFIG_CRYPTO_TWOFISH_COMMON=m
2392
2393#
2394# Compression
2395#
2396CONFIG_CRYPTO_DEFLATE=y
2397# CONFIG_CRYPTO_ZLIB is not set
2398CONFIG_CRYPTO_LZO=y
2399
2400#
2401# Random Number Generation
2402#
2403CONFIG_CRYPTO_ANSI_CPRNG=m
2404CONFIG_CRYPTO_HW=y
2405CONFIG_BINARY_PRINTF=y
2406
2407#
2408# Library routines
2409#
2410CONFIG_BITREVERSE=y
2411CONFIG_GENERIC_FIND_LAST_BIT=y
2412CONFIG_CRC_CCITT=y
2413CONFIG_CRC16=y
2414CONFIG_CRC_T10DIF=y
2415CONFIG_CRC_ITU_T=y
2416CONFIG_CRC32=y
2417CONFIG_CRC7=y
2418CONFIG_LIBCRC32C=y
2419CONFIG_ZLIB_INFLATE=y
2420CONFIG_ZLIB_DEFLATE=y
2421CONFIG_LZO_COMPRESS=y
2422CONFIG_LZO_DECOMPRESS=y
2423CONFIG_DECOMPRESS_GZIP=y
2424CONFIG_TEXTSEARCH=y
2425CONFIG_TEXTSEARCH_KMP=m
2426CONFIG_TEXTSEARCH_BM=m
2427CONFIG_TEXTSEARCH_FSM=m
2428CONFIG_HAS_IOMEM=y
2429CONFIG_HAS_IOPORT=y
2430CONFIG_HAS_DMA=y
2431CONFIG_NLATTR=y
diff --git a/arch/arm/configs/omap_3430sdp_defconfig b/arch/arm/configs/omap_3430sdp_defconfig
index 84829587d55a..592457cfbbe5 100644
--- a/arch/arm/configs/omap_3430sdp_defconfig
+++ b/arch/arm/configs/omap_3430sdp_defconfig
@@ -963,10 +963,32 @@ CONFIG_FB_CFB_IMAGEBLIT=y
963# 963#
964# CONFIG_FB_S1D13XXX is not set 964# CONFIG_FB_S1D13XXX is not set
965# CONFIG_FB_VIRTUAL is not set 965# CONFIG_FB_VIRTUAL is not set
966CONFIG_FB_OMAP=y 966# CONFIG_FB_METRONOME is not set
967# CONFIG_FB_OMAP_LCDC_EXTERNAL is not set 967# CONFIG_FB_MB862XX is not set
968# CONFIG_FB_BROADSHEET is not set
969# CONFIG_FB_OMAP_LCD_VGA is not set
968# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set 970# CONFIG_FB_OMAP_BOOTLOADER_INIT is not set
969CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE=2 971CONFIG_OMAP2_VRAM=y
972CONFIG_OMAP2_VRFB=y
973CONFIG_OMAP2_DSS=y
974CONFIG_OMAP2_VRAM_SIZE=4
975CONFIG_OMAP2_DSS_DEBUG_SUPPORT=y
976# CONFIG_OMAP2_DSS_RFBI is not set
977CONFIG_OMAP2_DSS_VENC=y
978# CONFIG_OMAP2_DSS_SDI is not set
979# CONFIG_OMAP2_DSS_DSI is not set
980# CONFIG_OMAP2_DSS_FAKE_VSYNC is not set
981CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK=0
982CONFIG_FB_OMAP2=y
983CONFIG_FB_OMAP2_DEBUG_SUPPORT=y
984# CONFIG_FB_OMAP2_FORCE_AUTO_UPDATE is not set
985CONFIG_FB_OMAP2_NUM_FBS=3
986
987#
988# OMAP2/3 Display Device Drivers
989#
990CONFIG_PANEL_GENERIC=y
991CONFIG_PANEL_SHARP_LS037V7DW01=y
970# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 992# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
971 993
972# 994#
diff --git a/arch/arm/configs/omap_4430sdp_defconfig b/arch/arm/configs/omap_4430sdp_defconfig
index a464ca332a23..2319113c86bf 100644
--- a/arch/arm/configs/omap_4430sdp_defconfig
+++ b/arch/arm/configs/omap_4430sdp_defconfig
@@ -1,26 +1,29 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.30-rc7 3# Linux kernel version: 2.6.32
4# Tue Jun 9 12:36:23 2009 4# Sun Dec 6 23:37:45 2009
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y 8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y 9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y 10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_MMU=y 11CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
12CONFIG_GENERIC_HARDIRQS=y 12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_STACKTRACE_SUPPORT=y 13CONFIG_STACKTRACE_SUPPORT=y
14CONFIG_LOCKDEP_SUPPORT=y 14CONFIG_LOCKDEP_SUPPORT=y
15CONFIG_TRACE_IRQFLAGS_SUPPORT=y 15CONFIG_TRACE_IRQFLAGS_SUPPORT=y
16CONFIG_HARDIRQS_SW_RESEND=y 16CONFIG_HARDIRQS_SW_RESEND=y
17CONFIG_GENERIC_IRQ_PROBE=y 17CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_GENERIC_LOCKBREAK=y
18CONFIG_RWSEM_GENERIC_SPINLOCK=y 19CONFIG_RWSEM_GENERIC_SPINLOCK=y
20CONFIG_ARCH_HAS_CPUFREQ=y
19CONFIG_GENERIC_HWEIGHT=y 21CONFIG_GENERIC_HWEIGHT=y
20CONFIG_GENERIC_CALIBRATE_DELAY=y 22CONFIG_GENERIC_CALIBRATE_DELAY=y
21CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 23CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
22CONFIG_VECTORS_BASE=0xffff0000 24CONFIG_VECTORS_BASE=0xffff0000
23CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
26CONFIG_CONSTRUCTORS=y
24 27
25# 28#
26# General setup 29# General setup
@@ -39,11 +42,12 @@ CONFIG_BSD_PROCESS_ACCT=y
39# 42#
40# RCU Subsystem 43# RCU Subsystem
41# 44#
42CONFIG_CLASSIC_RCU=y 45CONFIG_TREE_RCU=y
43# CONFIG_TREE_RCU is not set 46# CONFIG_TREE_PREEMPT_RCU is not set
44# CONFIG_PREEMPT_RCU is not set 47# CONFIG_RCU_TRACE is not set
48CONFIG_RCU_FANOUT=32
49# CONFIG_RCU_FANOUT_EXACT is not set
45# CONFIG_TREE_RCU_TRACE is not set 50# CONFIG_TREE_RCU_TRACE is not set
46# CONFIG_PREEMPT_RCU_TRACE is not set
47# CONFIG_IKCONFIG is not set 51# CONFIG_IKCONFIG is not set
48CONFIG_LOG_BUF_SHIFT=14 52CONFIG_LOG_BUF_SHIFT=14
49CONFIG_GROUP_SCHED=y 53CONFIG_GROUP_SCHED=y
@@ -52,8 +56,7 @@ CONFIG_FAIR_GROUP_SCHED=y
52CONFIG_USER_SCHED=y 56CONFIG_USER_SCHED=y
53# CONFIG_CGROUP_SCHED is not set 57# CONFIG_CGROUP_SCHED is not set
54# CONFIG_CGROUPS is not set 58# CONFIG_CGROUPS is not set
55# CONFIG_SYSFS_DEPRECATED=y is not set 59# CONFIG_SYSFS_DEPRECATED_V2 is not set
56# CONFIG_SYSFS_DEPRECATED_V2=y is not set
57# CONFIG_RELAY is not set 60# CONFIG_RELAY is not set
58# CONFIG_NAMESPACES is not set 61# CONFIG_NAMESPACES is not set
59CONFIG_BLK_DEV_INITRD=y 62CONFIG_BLK_DEV_INITRD=y
@@ -70,7 +73,6 @@ CONFIG_UID16=y
70CONFIG_KALLSYMS=y 73CONFIG_KALLSYMS=y
71# CONFIG_KALLSYMS_ALL is not set 74# CONFIG_KALLSYMS_ALL is not set
72# CONFIG_KALLSYMS_EXTRA_PASS is not set 75# CONFIG_KALLSYMS_EXTRA_PASS is not set
73# CONFIG_STRIP_ASM_SYMS is not set
74CONFIG_HOTPLUG=y 76CONFIG_HOTPLUG=y
75CONFIG_PRINTK=y 77CONFIG_PRINTK=y
76CONFIG_BUG=y 78CONFIG_BUG=y
@@ -83,6 +85,10 @@ CONFIG_TIMERFD=y
83CONFIG_EVENTFD=y 85CONFIG_EVENTFD=y
84CONFIG_SHMEM=y 86CONFIG_SHMEM=y
85CONFIG_AIO=y 87CONFIG_AIO=y
88
89#
90# Kernel Performance Events And Counters
91#
86CONFIG_VM_EVENT_COUNTERS=y 92CONFIG_VM_EVENT_COUNTERS=y
87CONFIG_SLUB_DEBUG=y 93CONFIG_SLUB_DEBUG=y
88CONFIG_COMPAT_BRK=y 94CONFIG_COMPAT_BRK=y
@@ -90,13 +96,16 @@ CONFIG_COMPAT_BRK=y
90CONFIG_SLUB=y 96CONFIG_SLUB=y
91# CONFIG_SLOB is not set 97# CONFIG_SLOB is not set
92# CONFIG_PROFILING is not set 98# CONFIG_PROFILING is not set
93# CONFIG_MARKERS is not set
94CONFIG_HAVE_OPROFILE=y 99CONFIG_HAVE_OPROFILE=y
95# CONFIG_KPROBES is not set 100# CONFIG_KPROBES is not set
96CONFIG_HAVE_KPROBES=y 101CONFIG_HAVE_KPROBES=y
97CONFIG_HAVE_KRETPROBES=y 102CONFIG_HAVE_KRETPROBES=y
98CONFIG_USE_GENERIC_SMP_HELPERS=y 103CONFIG_USE_GENERIC_SMP_HELPERS=y
99CONFIG_HAVE_CLK=y 104CONFIG_HAVE_CLK=y
105
106#
107# GCOV-based kernel profiling
108#
100# CONFIG_SLOW_WORK is not set 109# CONFIG_SLOW_WORK is not set
101CONFIG_HAVE_GENERIC_DMA_COHERENT=y 110CONFIG_HAVE_GENERIC_DMA_COHERENT=y
102CONFIG_SLABINFO=y 111CONFIG_SLABINFO=y
@@ -110,7 +119,7 @@ CONFIG_MODVERSIONS=y
110CONFIG_MODULE_SRCVERSION_ALL=y 119CONFIG_MODULE_SRCVERSION_ALL=y
111CONFIG_STOP_MACHINE=y 120CONFIG_STOP_MACHINE=y
112CONFIG_BLOCK=y 121CONFIG_BLOCK=y
113# CONFIG_LBD is not set 122CONFIG_LBDAF=y
114# CONFIG_BLK_DEV_BSG is not set 123# CONFIG_BLK_DEV_BSG is not set
115# CONFIG_BLK_DEV_INTEGRITY is not set 124# CONFIG_BLK_DEV_INTEGRITY is not set
116 125
@@ -131,6 +140,7 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
131# 140#
132# System Type 141# System Type
133# 142#
143CONFIG_MMU=y
134# CONFIG_ARCH_AAEC2000 is not set 144# CONFIG_ARCH_AAEC2000 is not set
135# CONFIG_ARCH_INTEGRATOR is not set 145# CONFIG_ARCH_INTEGRATOR is not set
136# CONFIG_ARCH_REALVIEW is not set 146# CONFIG_ARCH_REALVIEW is not set
@@ -142,8 +152,10 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
142# CONFIG_ARCH_EP93XX is not set 152# CONFIG_ARCH_EP93XX is not set
143# CONFIG_ARCH_FOOTBRIDGE is not set 153# CONFIG_ARCH_FOOTBRIDGE is not set
144# CONFIG_ARCH_MXC is not set 154# CONFIG_ARCH_MXC is not set
155# CONFIG_ARCH_STMP3XXX is not set
145# CONFIG_ARCH_NETX is not set 156# CONFIG_ARCH_NETX is not set
146# CONFIG_ARCH_H720X is not set 157# CONFIG_ARCH_H720X is not set
158# CONFIG_ARCH_NOMADIK is not set
147# CONFIG_ARCH_IOP13XX is not set 159# CONFIG_ARCH_IOP13XX is not set
148# CONFIG_ARCH_IOP32X is not set 160# CONFIG_ARCH_IOP32X is not set
149# CONFIG_ARCH_IOP33X is not set 161# CONFIG_ARCH_IOP33X is not set
@@ -166,10 +178,13 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
166# CONFIG_ARCH_SA1100 is not set 178# CONFIG_ARCH_SA1100 is not set
167# CONFIG_ARCH_S3C2410 is not set 179# CONFIG_ARCH_S3C2410 is not set
168# CONFIG_ARCH_S3C64XX is not set 180# CONFIG_ARCH_S3C64XX is not set
181# CONFIG_ARCH_S5PC1XX is not set
169# CONFIG_ARCH_SHARK is not set 182# CONFIG_ARCH_SHARK is not set
170# CONFIG_ARCH_LH7A40X is not set 183# CONFIG_ARCH_LH7A40X is not set
184# CONFIG_ARCH_U300 is not set
171# CONFIG_ARCH_DAVINCI is not set 185# CONFIG_ARCH_DAVINCI is not set
172CONFIG_ARCH_OMAP=y 186CONFIG_ARCH_OMAP=y
187# CONFIG_ARCH_BCMRING is not set
173 188
174# 189#
175# TI OMAP Implementations 190# TI OMAP Implementations
@@ -190,9 +205,12 @@ CONFIG_ARCH_OMAP4=y
190CONFIG_OMAP_32K_TIMER=y 205CONFIG_OMAP_32K_TIMER=y
191CONFIG_OMAP_32K_TIMER_HZ=128 206CONFIG_OMAP_32K_TIMER_HZ=128
192CONFIG_OMAP_DM_TIMER=y 207CONFIG_OMAP_DM_TIMER=y
193CONFIG_OMAP_LL_DEBUG_UART1=y 208# CONFIG_OMAP_LL_DEBUG_UART1 is not set
194# CONFIG_OMAP_LL_DEBUG_UART2 is not set 209# CONFIG_OMAP_LL_DEBUG_UART2 is not set
195# CONFIG_OMAP_LL_DEBUG_UART3 is not set 210CONFIG_OMAP_LL_DEBUG_UART3=y
211# CONFIG_OMAP_LL_DEBUG_NONE is not set
212# CONFIG_OMAP_PM_NONE is not set
213CONFIG_OMAP_PM_NOOP=y
196 214
197# 215#
198# OMAP Board Type 216# OMAP Board Type
@@ -207,7 +225,7 @@ CONFIG_CPU_32v6K=y
207CONFIG_CPU_V7=y 225CONFIG_CPU_V7=y
208CONFIG_CPU_32v7=y 226CONFIG_CPU_32v7=y
209CONFIG_CPU_ABRT_EV7=y 227CONFIG_CPU_ABRT_EV7=y
210CONFIG_CPU_PABRT_IFAR=y 228CONFIG_CPU_PABRT_V7=y
211CONFIG_CPU_CACHE_V7=y 229CONFIG_CPU_CACHE_V7=y
212CONFIG_CPU_CACHE_VIPT=y 230CONFIG_CPU_CACHE_VIPT=y
213CONFIG_CPU_COPY_V6=y 231CONFIG_CPU_COPY_V6=y
@@ -222,9 +240,10 @@ CONFIG_CPU_CP15_MMU=y
222# CONFIG_ARM_THUMB is not set 240# CONFIG_ARM_THUMB is not set
223# CONFIG_ARM_THUMBEE is not set 241# CONFIG_ARM_THUMBEE is not set
224# CONFIG_CPU_ICACHE_DISABLE is not set 242# CONFIG_CPU_ICACHE_DISABLE is not set
225CONFIG_CPU_DCACHE_DISABLE=y 243# CONFIG_CPU_DCACHE_DISABLE is not set
226# CONFIG_CPU_BPREDICT_DISABLE is not set 244# CONFIG_CPU_BPREDICT_DISABLE is not set
227CONFIG_HAS_TLS_REG=y 245CONFIG_HAS_TLS_REG=y
246CONFIG_ARM_L1_CACHE_SHIFT=5
228# CONFIG_ARM_ERRATA_430973 is not set 247# CONFIG_ARM_ERRATA_430973 is not set
229# CONFIG_ARM_ERRATA_458693 is not set 248# CONFIG_ARM_ERRATA_458693 is not set
230# CONFIG_ARM_ERRATA_460075 is not set 249# CONFIG_ARM_ERRATA_460075 is not set
@@ -245,18 +264,20 @@ CONFIG_ARM_GIC=y
245CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 264CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
246CONFIG_SMP=y 265CONFIG_SMP=y
247CONFIG_HAVE_ARM_SCU=y 266CONFIG_HAVE_ARM_SCU=y
248CONFIG_HAVE_ARM_TWD=y
249CONFIG_VMSPLIT_3G=y 267CONFIG_VMSPLIT_3G=y
250# CONFIG_VMSPLIT_2G is not set 268# CONFIG_VMSPLIT_2G is not set
251# CONFIG_VMSPLIT_1G is not set 269# CONFIG_VMSPLIT_1G is not set
252CONFIG_PAGE_OFFSET=0xC0000000 270CONFIG_PAGE_OFFSET=0xC0000000
253CONFIG_NR_CPUS=2 271CONFIG_NR_CPUS=2
254# CONFIG_HOTPLUG_CPU is not set 272# CONFIG_HOTPLUG_CPU is not set
255CONFIG_LOCAL_TIMERS=y 273# CONFIG_LOCAL_TIMERS is not set
256# CONFIG_PREEMPT is not set 274# CONFIG_PREEMPT_NONE is not set
275# CONFIG_PREEMPT_VOLUNTARY is not set
276CONFIG_PREEMPT=y
257CONFIG_HZ=128 277CONFIG_HZ=128
278# CONFIG_THUMB2_KERNEL is not set
258CONFIG_AEABI=y 279CONFIG_AEABI=y
259# CONFIG_OABI_COMPAT is not set 280CONFIG_OABI_COMPAT=y
260# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set 281# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
261# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set 282# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
262# CONFIG_HIGHMEM is not set 283# CONFIG_HIGHMEM is not set
@@ -271,10 +292,13 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
271# CONFIG_PHYS_ADDR_T_64BIT is not set 292# CONFIG_PHYS_ADDR_T_64BIT is not set
272CONFIG_ZONE_DMA_FLAG=0 293CONFIG_ZONE_DMA_FLAG=0
273CONFIG_VIRT_TO_BUS=y 294CONFIG_VIRT_TO_BUS=y
274# CONFIG_UNEVICTABLE_LRU is not set
275CONFIG_HAVE_MLOCK=y 295CONFIG_HAVE_MLOCK=y
296CONFIG_HAVE_MLOCKED_PAGE_BIT=y
297# CONFIG_KSM is not set
298CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
276# CONFIG_LEDS is not set 299# CONFIG_LEDS is not set
277CONFIG_ALIGNMENT_TRAP=y 300CONFIG_ALIGNMENT_TRAP=y
301# CONFIG_UACCESS_WITH_MEMCPY is not set
278 302
279# 303#
280# Boot options 304# Boot options
@@ -298,9 +322,11 @@ CONFIG_CMDLINE="root=/dev/ram0 rw mem=128M console=ttyS0,115200n8 initrd=0x81600
298# 322#
299# At least one emulation must be selected 323# At least one emulation must be selected
300# 324#
325# CONFIG_FPE_NWFPE is not set
326# CONFIG_FPE_FASTFPE is not set
301CONFIG_VFP=y 327CONFIG_VFP=y
302CONFIG_VFPv3=y 328CONFIG_VFPv3=y
303# CONFIG_NEON is not set 329CONFIG_NEON=y
304 330
305# 331#
306# Userspace binary formats 332# Userspace binary formats
@@ -325,6 +351,7 @@ CONFIG_ARCH_SUSPEND_POSSIBLE=y
325# Generic Driver Options 351# Generic Driver Options
326# 352#
327CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 353CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
354# CONFIG_DEVTMPFS is not set
328CONFIG_STANDALONE=y 355CONFIG_STANDALONE=y
329CONFIG_PREVENT_FIRMWARE_BUILD=y 356CONFIG_PREVENT_FIRMWARE_BUILD=y
330# CONFIG_FW_LOADER is not set 357# CONFIG_FW_LOADER is not set
@@ -342,6 +369,7 @@ CONFIG_BLK_DEV_RAM_COUNT=16
342CONFIG_BLK_DEV_RAM_SIZE=16384 369CONFIG_BLK_DEV_RAM_SIZE=16384
343# CONFIG_BLK_DEV_XIP is not set 370# CONFIG_BLK_DEV_XIP is not set
344# CONFIG_CDROM_PKTCDVD is not set 371# CONFIG_CDROM_PKTCDVD is not set
372# CONFIG_MG_DISK is not set
345# CONFIG_MISC_DEVICES is not set 373# CONFIG_MISC_DEVICES is not set
346CONFIG_HAVE_IDE=y 374CONFIG_HAVE_IDE=y
347# CONFIG_IDE is not set 375# CONFIG_IDE is not set
@@ -355,6 +383,7 @@ CONFIG_HAVE_IDE=y
355# CONFIG_SCSI_NETLINK is not set 383# CONFIG_SCSI_NETLINK is not set
356# CONFIG_ATA is not set 384# CONFIG_ATA is not set
357# CONFIG_MD is not set 385# CONFIG_MD is not set
386# CONFIG_PHONE is not set
358 387
359# 388#
360# Input device support 389# Input device support
@@ -427,6 +456,11 @@ CONFIG_HW_RANDOM=y
427# CONFIG_TCG_TPM is not set 456# CONFIG_TCG_TPM is not set
428# CONFIG_I2C is not set 457# CONFIG_I2C is not set
429# CONFIG_SPI is not set 458# CONFIG_SPI is not set
459
460#
461# PPS support
462#
463# CONFIG_PPS is not set
430CONFIG_ARCH_REQUIRE_GPIOLIB=y 464CONFIG_ARCH_REQUIRE_GPIOLIB=y
431CONFIG_GPIOLIB=y 465CONFIG_GPIOLIB=y
432# CONFIG_DEBUG_GPIO is not set 466# CONFIG_DEBUG_GPIO is not set
@@ -447,11 +481,14 @@ CONFIG_GPIOLIB=y
447# 481#
448# SPI GPIO expanders: 482# SPI GPIO expanders:
449# 483#
484
485#
486# AC97 GPIO expanders:
487#
450# CONFIG_W1 is not set 488# CONFIG_W1 is not set
451# CONFIG_POWER_SUPPLY is not set 489# CONFIG_POWER_SUPPLY is not set
452# CONFIG_HWMON is not set 490# CONFIG_HWMON is not set
453# CONFIG_THERMAL is not set 491# CONFIG_THERMAL is not set
454# CONFIG_THERMAL_HWMON is not set
455# CONFIG_WATCHDOG is not set 492# CONFIG_WATCHDOG is not set
456CONFIG_SSB_POSSIBLE=y 493CONFIG_SSB_POSSIBLE=y
457 494
@@ -472,21 +509,8 @@ CONFIG_SSB_POSSIBLE=y
472# CONFIG_MFD_T7L66XB is not set 509# CONFIG_MFD_T7L66XB is not set
473# CONFIG_MFD_TC6387XB is not set 510# CONFIG_MFD_TC6387XB is not set
474# CONFIG_MFD_TC6393XB is not set 511# CONFIG_MFD_TC6393XB is not set
475 512# CONFIG_REGULATOR is not set
476# 513# CONFIG_MEDIA_SUPPORT is not set
477# Multimedia devices
478#
479
480#
481# Multimedia core support
482#
483# CONFIG_VIDEO_DEV is not set
484# CONFIG_VIDEO_MEDIA is not set
485
486#
487# Multimedia drivers
488#
489CONFIG_DAB=y
490 514
491# 515#
492# Graphics support 516# Graphics support
@@ -511,14 +535,17 @@ CONFIG_DUMMY_CONSOLE=y
511# CONFIG_USB_SUPPORT is not set 535# CONFIG_USB_SUPPORT is not set
512# CONFIG_MMC is not set 536# CONFIG_MMC is not set
513# CONFIG_MEMSTICK is not set 537# CONFIG_MEMSTICK is not set
514# CONFIG_ACCESSIBILITY is not set
515# CONFIG_NEW_LEDS is not set 538# CONFIG_NEW_LEDS is not set
539# CONFIG_ACCESSIBILITY is not set
516CONFIG_RTC_LIB=y 540CONFIG_RTC_LIB=y
517# CONFIG_RTC_CLASS is not set 541# CONFIG_RTC_CLASS is not set
518# CONFIG_DMADEVICES is not set 542# CONFIG_DMADEVICES is not set
519# CONFIG_AUXDISPLAY is not set 543# CONFIG_AUXDISPLAY is not set
520# CONFIG_REGULATOR is not set
521# CONFIG_UIO is not set 544# CONFIG_UIO is not set
545
546#
547# TI VLYNQ
548#
522# CONFIG_STAGING is not set 549# CONFIG_STAGING is not set
523 550
524# 551#
@@ -535,9 +562,12 @@ CONFIG_JBD=y
535# CONFIG_REISERFS_FS is not set 562# CONFIG_REISERFS_FS is not set
536# CONFIG_JFS_FS is not set 563# CONFIG_JFS_FS is not set
537# CONFIG_FS_POSIX_ACL is not set 564# CONFIG_FS_POSIX_ACL is not set
538CONFIG_FILE_LOCKING=y
539# CONFIG_XFS_FS is not set 565# CONFIG_XFS_FS is not set
566# CONFIG_GFS2_FS is not set
540# CONFIG_BTRFS_FS is not set 567# CONFIG_BTRFS_FS is not set
568# CONFIG_NILFS2_FS is not set
569CONFIG_FILE_LOCKING=y
570CONFIG_FSNOTIFY=y
541CONFIG_DNOTIFY=y 571CONFIG_DNOTIFY=y
542CONFIG_INOTIFY=y 572CONFIG_INOTIFY=y
543CONFIG_INOTIFY_USER=y 573CONFIG_INOTIFY_USER=y
@@ -601,7 +631,6 @@ CONFIG_MISC_FILESYSTEMS=y
601# CONFIG_ROMFS_FS is not set 631# CONFIG_ROMFS_FS is not set
602# CONFIG_SYSV_FS is not set 632# CONFIG_SYSV_FS is not set
603# CONFIG_UFS_FS is not set 633# CONFIG_UFS_FS is not set
604# CONFIG_NILFS2_FS is not set
605 634
606# 635#
607# Partition Types 636# Partition Types
@@ -673,23 +702,24 @@ CONFIG_NLS_ISO8859_1=y
673# CONFIG_ENABLE_MUST_CHECK is not set 702# CONFIG_ENABLE_MUST_CHECK is not set
674CONFIG_FRAME_WARN=1024 703CONFIG_FRAME_WARN=1024
675CONFIG_MAGIC_SYSRQ=y 704CONFIG_MAGIC_SYSRQ=y
705# CONFIG_STRIP_ASM_SYMS is not set
676# CONFIG_UNUSED_SYMBOLS is not set 706# CONFIG_UNUSED_SYMBOLS is not set
677# CONFIG_DEBUG_FS is not set 707# CONFIG_DEBUG_FS is not set
678# CONFIG_HEADERS_CHECK is not set 708# CONFIG_HEADERS_CHECK is not set
679CONFIG_DEBUG_KERNEL=y 709CONFIG_DEBUG_KERNEL=y
680# CONFIG_DEBUG_SHIRQ is not set 710# CONFIG_DEBUG_SHIRQ is not set
681CONFIG_DETECT_SOFTLOCKUP=y 711# CONFIG_DETECT_SOFTLOCKUP is not set
682# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
683CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
684CONFIG_DETECT_HUNG_TASK=y 712CONFIG_DETECT_HUNG_TASK=y
685# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set 713# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
686CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 714CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
687CONFIG_SCHED_DEBUG=y 715# CONFIG_SCHED_DEBUG is not set
688# CONFIG_SCHEDSTATS is not set 716# CONFIG_SCHEDSTATS is not set
689# CONFIG_TIMER_STATS is not set 717# CONFIG_TIMER_STATS is not set
690# CONFIG_DEBUG_OBJECTS is not set 718# CONFIG_DEBUG_OBJECTS is not set
691# CONFIG_SLUB_DEBUG_ON is not set 719# CONFIG_SLUB_DEBUG_ON is not set
692# CONFIG_SLUB_STATS is not set 720# CONFIG_SLUB_STATS is not set
721# CONFIG_DEBUG_KMEMLEAK is not set
722# CONFIG_DEBUG_PREEMPT is not set
693# CONFIG_DEBUG_RT_MUTEXES is not set 723# CONFIG_DEBUG_RT_MUTEXES is not set
694# CONFIG_RT_MUTEX_TESTER is not set 724# CONFIG_RT_MUTEX_TESTER is not set
695# CONFIG_DEBUG_SPINLOCK is not set 725# CONFIG_DEBUG_SPINLOCK is not set
@@ -708,31 +738,22 @@ CONFIG_DEBUG_INFO=y
708# CONFIG_DEBUG_LIST is not set 738# CONFIG_DEBUG_LIST is not set
709# CONFIG_DEBUG_SG is not set 739# CONFIG_DEBUG_SG is not set
710# CONFIG_DEBUG_NOTIFIERS is not set 740# CONFIG_DEBUG_NOTIFIERS is not set
741# CONFIG_DEBUG_CREDENTIALS is not set
711CONFIG_FRAME_POINTER=y 742CONFIG_FRAME_POINTER=y
712# CONFIG_BOOT_PRINTK_DELAY is not set 743# CONFIG_BOOT_PRINTK_DELAY is not set
713# CONFIG_RCU_TORTURE_TEST is not set 744# CONFIG_RCU_TORTURE_TEST is not set
714# CONFIG_RCU_CPU_STALL_DETECTOR is not set 745# CONFIG_RCU_CPU_STALL_DETECTOR is not set
715# CONFIG_BACKTRACE_SELF_TEST is not set 746# CONFIG_BACKTRACE_SELF_TEST is not set
716# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 747# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
748# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
717# CONFIG_FAULT_INJECTION is not set 749# CONFIG_FAULT_INJECTION is not set
718# CONFIG_PAGE_POISONING is not set 750# CONFIG_PAGE_POISONING is not set
719CONFIG_HAVE_FUNCTION_TRACER=y 751CONFIG_HAVE_FUNCTION_TRACER=y
720CONFIG_TRACING_SUPPORT=y 752CONFIG_TRACING_SUPPORT=y
721 753# CONFIG_FTRACE is not set
722# 754# CONFIG_BRANCH_PROFILE_NONE is not set
723# Tracers 755# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
724# 756# CONFIG_PROFILE_ALL_BRANCHES is not set
725# CONFIG_FUNCTION_TRACER is not set
726# CONFIG_IRQSOFF_TRACER is not set
727# CONFIG_SCHED_TRACER is not set
728# CONFIG_CONTEXT_SWITCH_TRACER is not set
729# CONFIG_EVENT_TRACER is not set
730# CONFIG_BOOT_TRACER is not set
731# CONFIG_TRACE_BRANCH_PROFILING is not set
732# CONFIG_STACK_TRACER is not set
733# CONFIG_KMEMTRACE is not set
734# CONFIG_WORKQUEUE_TRACER is not set
735# CONFIG_BLK_DEV_IO_TRACE is not set
736# CONFIG_SAMPLES is not set 757# CONFIG_SAMPLES is not set
737CONFIG_HAVE_ARCH_KGDB=y 758CONFIG_HAVE_ARCH_KGDB=y
738# CONFIG_KGDB is not set 759# CONFIG_KGDB is not set
@@ -754,7 +775,6 @@ CONFIG_CRYPTO=y
754# 775#
755# Crypto core or helper 776# Crypto core or helper
756# 777#
757# CONFIG_CRYPTO_FIPS is not set
758CONFIG_CRYPTO_ALGAPI=y 778CONFIG_CRYPTO_ALGAPI=y
759CONFIG_CRYPTO_ALGAPI2=y 779CONFIG_CRYPTO_ALGAPI2=y
760CONFIG_CRYPTO_AEAD2=y 780CONFIG_CRYPTO_AEAD2=y
@@ -796,11 +816,13 @@ CONFIG_CRYPTO_PCBC=m
796# 816#
797# CONFIG_CRYPTO_HMAC is not set 817# CONFIG_CRYPTO_HMAC is not set
798# CONFIG_CRYPTO_XCBC is not set 818# CONFIG_CRYPTO_XCBC is not set
819# CONFIG_CRYPTO_VMAC is not set
799 820
800# 821#
801# Digest 822# Digest
802# 823#
803CONFIG_CRYPTO_CRC32C=y 824CONFIG_CRYPTO_CRC32C=y
825# CONFIG_CRYPTO_GHASH is not set
804# CONFIG_CRYPTO_MD4 is not set 826# CONFIG_CRYPTO_MD4 is not set
805CONFIG_CRYPTO_MD5=y 827CONFIG_CRYPTO_MD5=y
806# CONFIG_CRYPTO_MICHAEL_MIC is not set 828# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/arm/configs/omap_zoom2_defconfig b/arch/arm/configs/omap_zoom2_defconfig
index eef93627fb13..4b00a4306812 100644
--- a/arch/arm/configs/omap_zoom2_defconfig
+++ b/arch/arm/configs/omap_zoom2_defconfig
@@ -610,7 +610,8 @@ CONFIG_INPUT_EVDEV=y
610# 610#
611# Input Device Drivers 611# Input Device Drivers
612# 612#
613# CONFIG_INPUT_KEYBOARD is not set 613CONFIG_INPUT_KEYBOARD=y
614CONFIG_KEYBOARD_TWL4030=y
614# CONFIG_INPUT_MOUSE is not set 615# CONFIG_INPUT_MOUSE is not set
615# CONFIG_INPUT_JOYSTICK is not set 616# CONFIG_INPUT_JOYSTICK is not set
616# CONFIG_INPUT_TABLET is not set 617# CONFIG_INPUT_TABLET is not set
diff --git a/arch/arm/configs/omap_zoom3_defconfig b/arch/arm/configs/omap_zoom3_defconfig
index f0e7d0f85582..0d7e37a3651b 100644
--- a/arch/arm/configs/omap_zoom3_defconfig
+++ b/arch/arm/configs/omap_zoom3_defconfig
@@ -629,7 +629,8 @@ CONFIG_INPUT_EVDEV=y
629# 629#
630# Input Device Drivers 630# Input Device Drivers
631# 631#
632# CONFIG_INPUT_KEYBOARD is not set 632CONFIG_INPUT_KEYBOARD=y
633CONFIG_KEYBOARD_TWL4030=y
633# CONFIG_INPUT_MOUSE is not set 634# CONFIG_INPUT_MOUSE is not set
634# CONFIG_INPUT_JOYSTICK is not set 635# CONFIG_INPUT_JOYSTICK is not set
635# CONFIG_INPUT_TABLET is not set 636# CONFIG_INPUT_TABLET is not set
diff --git a/arch/arm/configs/zeus_defconfig b/arch/arm/configs/zeus_defconfig
new file mode 100644
index 000000000000..823b11e7091a
--- /dev/null
+++ b/arch/arm/configs/zeus_defconfig
@@ -0,0 +1,2032 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.32
4# Tue Dec 8 20:27:05 2009
5#
6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
8CONFIG_GENERIC_GPIO=y
9CONFIG_GENERIC_TIME=y
10CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_GENERIC_HARDIRQS=y
12CONFIG_STACKTRACE_SUPPORT=y
13CONFIG_HAVE_LATENCYTOP_SUPPORT=y
14CONFIG_LOCKDEP_SUPPORT=y
15CONFIG_TRACE_IRQFLAGS_SUPPORT=y
16CONFIG_HARDIRQS_SW_RESEND=y
17CONFIG_GENERIC_IRQ_PROBE=y
18CONFIG_RWSEM_GENERIC_SPINLOCK=y
19CONFIG_ARCH_HAS_CPUFREQ=y
20CONFIG_GENERIC_HWEIGHT=y
21CONFIG_GENERIC_CALIBRATE_DELAY=y
22CONFIG_ARCH_MTD_XIP=y
23CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
24CONFIG_VECTORS_BASE=0xffff0000
25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
26CONFIG_CONSTRUCTORS=y
27
28#
29# General setup
30#
31CONFIG_EXPERIMENTAL=y
32CONFIG_BROKEN_ON_SMP=y
33CONFIG_INIT_ENV_ARG_LIMIT=32
34CONFIG_LOCALVERSION=""
35CONFIG_LOCALVERSION_AUTO=y
36CONFIG_SWAP=y
37CONFIG_SYSVIPC=y
38CONFIG_SYSVIPC_SYSCTL=y
39# CONFIG_POSIX_MQUEUE is not set
40# CONFIG_BSD_PROCESS_ACCT is not set
41# CONFIG_TASKSTATS is not set
42# CONFIG_AUDIT is not set
43
44#
45# RCU Subsystem
46#
47# CONFIG_TREE_RCU is not set
48# CONFIG_TREE_PREEMPT_RCU is not set
49CONFIG_TINY_RCU=y
50# CONFIG_TREE_RCU_TRACE is not set
51# CONFIG_IKCONFIG is not set
52CONFIG_LOG_BUF_SHIFT=13
53# CONFIG_GROUP_SCHED is not set
54# CONFIG_CGROUPS is not set
55# CONFIG_SYSFS_DEPRECATED_V2 is not set
56# CONFIG_RELAY is not set
57CONFIG_NAMESPACES=y
58# CONFIG_UTS_NS is not set
59# CONFIG_IPC_NS is not set
60# CONFIG_USER_NS is not set
61# CONFIG_PID_NS is not set
62# CONFIG_NET_NS is not set
63# CONFIG_BLK_DEV_INITRD is not set
64CONFIG_CC_OPTIMIZE_FOR_SIZE=y
65CONFIG_SYSCTL=y
66CONFIG_ANON_INODES=y
67# CONFIG_EMBEDDED is not set
68CONFIG_UID16=y
69CONFIG_SYSCTL_SYSCALL=y
70CONFIG_KALLSYMS=y
71# CONFIG_KALLSYMS_ALL is not set
72# CONFIG_KALLSYMS_EXTRA_PASS is not set
73CONFIG_HOTPLUG=y
74CONFIG_PRINTK=y
75CONFIG_BUG=y
76CONFIG_ELF_CORE=y
77CONFIG_BASE_FULL=y
78CONFIG_FUTEX=y
79CONFIG_EPOLL=y
80CONFIG_SIGNALFD=y
81CONFIG_TIMERFD=y
82CONFIG_EVENTFD=y
83CONFIG_SHMEM=y
84CONFIG_AIO=y
85
86#
87# Kernel Performance Events And Counters
88#
89CONFIG_VM_EVENT_COUNTERS=y
90CONFIG_SLUB_DEBUG=y
91CONFIG_COMPAT_BRK=y
92# CONFIG_SLAB is not set
93CONFIG_SLUB=y
94# CONFIG_SLOB is not set
95# CONFIG_PROFILING is not set
96CONFIG_HAVE_OPROFILE=y
97# CONFIG_KPROBES is not set
98CONFIG_HAVE_KPROBES=y
99CONFIG_HAVE_KRETPROBES=y
100CONFIG_HAVE_CLK=y
101
102#
103# GCOV-based kernel profiling
104#
105# CONFIG_SLOW_WORK is not set
106CONFIG_HAVE_GENERIC_DMA_COHERENT=y
107CONFIG_SLABINFO=y
108CONFIG_RT_MUTEXES=y
109CONFIG_BASE_SMALL=0
110CONFIG_MODULES=y
111# CONFIG_MODULE_FORCE_LOAD is not set
112CONFIG_MODULE_UNLOAD=y
113# CONFIG_MODULE_FORCE_UNLOAD is not set
114# CONFIG_MODVERSIONS is not set
115# CONFIG_MODULE_SRCVERSION_ALL is not set
116CONFIG_BLOCK=y
117CONFIG_LBDAF=y
118# CONFIG_BLK_DEV_BSG is not set
119# CONFIG_BLK_DEV_INTEGRITY is not set
120
121#
122# IO Schedulers
123#
124CONFIG_IOSCHED_NOOP=y
125CONFIG_IOSCHED_DEADLINE=y
126# CONFIG_IOSCHED_CFQ is not set
127CONFIG_DEFAULT_DEADLINE=y
128# CONFIG_DEFAULT_CFQ is not set
129# CONFIG_DEFAULT_NOOP is not set
130CONFIG_DEFAULT_IOSCHED="deadline"
131# CONFIG_INLINE_SPIN_TRYLOCK is not set
132# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
133# CONFIG_INLINE_SPIN_LOCK is not set
134# CONFIG_INLINE_SPIN_LOCK_BH is not set
135# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
136# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
137CONFIG_INLINE_SPIN_UNLOCK=y
138# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
139CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
140# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
141# CONFIG_INLINE_READ_TRYLOCK is not set
142# CONFIG_INLINE_READ_LOCK is not set
143# CONFIG_INLINE_READ_LOCK_BH is not set
144# CONFIG_INLINE_READ_LOCK_IRQ is not set
145# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
146CONFIG_INLINE_READ_UNLOCK=y
147# CONFIG_INLINE_READ_UNLOCK_BH is not set
148CONFIG_INLINE_READ_UNLOCK_IRQ=y
149# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
150# CONFIG_INLINE_WRITE_TRYLOCK is not set
151# CONFIG_INLINE_WRITE_LOCK is not set
152# CONFIG_INLINE_WRITE_LOCK_BH is not set
153# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
154# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
155CONFIG_INLINE_WRITE_UNLOCK=y
156# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
157CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
158# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
159# CONFIG_MUTEX_SPIN_ON_OWNER is not set
160CONFIG_FREEZER=y
161
162#
163# System Type
164#
165CONFIG_MMU=y
166# CONFIG_ARCH_AAEC2000 is not set
167# CONFIG_ARCH_INTEGRATOR is not set
168# CONFIG_ARCH_REALVIEW is not set
169# CONFIG_ARCH_VERSATILE is not set
170# CONFIG_ARCH_AT91 is not set
171# CONFIG_ARCH_CLPS711X is not set
172# CONFIG_ARCH_GEMINI is not set
173# CONFIG_ARCH_EBSA110 is not set
174# CONFIG_ARCH_EP93XX is not set
175# CONFIG_ARCH_FOOTBRIDGE is not set
176# CONFIG_ARCH_MXC is not set
177# CONFIG_ARCH_STMP3XXX is not set
178# CONFIG_ARCH_NETX is not set
179# CONFIG_ARCH_H720X is not set
180# CONFIG_ARCH_NOMADIK is not set
181# CONFIG_ARCH_IOP13XX is not set
182# CONFIG_ARCH_IOP32X is not set
183# CONFIG_ARCH_IOP33X is not set
184# CONFIG_ARCH_IXP23XX is not set
185# CONFIG_ARCH_IXP2000 is not set
186# CONFIG_ARCH_IXP4XX is not set
187# CONFIG_ARCH_L7200 is not set
188# CONFIG_ARCH_DOVE is not set
189# CONFIG_ARCH_KIRKWOOD is not set
190# CONFIG_ARCH_LOKI is not set
191# CONFIG_ARCH_MV78XX0 is not set
192# CONFIG_ARCH_ORION5X is not set
193# CONFIG_ARCH_MMP is not set
194# CONFIG_ARCH_KS8695 is not set
195# CONFIG_ARCH_NS9XXX is not set
196# CONFIG_ARCH_W90X900 is not set
197# CONFIG_ARCH_PNX4008 is not set
198CONFIG_ARCH_PXA=y
199# CONFIG_ARCH_MSM is not set
200# CONFIG_ARCH_RPC is not set
201# CONFIG_ARCH_SA1100 is not set
202# CONFIG_ARCH_S3C2410 is not set
203# CONFIG_ARCH_S3C64XX is not set
204# CONFIG_ARCH_S5PC1XX is not set
205# CONFIG_ARCH_SHARK is not set
206# CONFIG_ARCH_LH7A40X is not set
207# CONFIG_ARCH_U300 is not set
208# CONFIG_ARCH_DAVINCI is not set
209# CONFIG_ARCH_OMAP is not set
210# CONFIG_ARCH_BCMRING is not set
211# CONFIG_ARCH_U8500 is not set
212
213#
214# Intel PXA2xx/PXA3xx Implementations
215#
216
217#
218# Intel/Marvell Dev Platforms (sorted by hardware release time)
219#
220# CONFIG_ARCH_LUBBOCK is not set
221# CONFIG_MACH_MAINSTONE is not set
222# CONFIG_MACH_ZYLONITE300 is not set
223# CONFIG_MACH_ZYLONITE320 is not set
224# CONFIG_MACH_LITTLETON is not set
225# CONFIG_MACH_TAVOREVB is not set
226# CONFIG_MACH_SAAR is not set
227
228#
229# Third Party Dev Platforms (sorted by vendor name)
230#
231# CONFIG_ARCH_PXA_IDP is not set
232# CONFIG_ARCH_VIPER is not set
233CONFIG_MACH_ARCOM_ZEUS=y
234# CONFIG_MACH_BALLOON3 is not set
235# CONFIG_MACH_CSB726 is not set
236# CONFIG_MACH_ARMCORE is not set
237# CONFIG_MACH_EM_X270 is not set
238# CONFIG_MACH_EXEDA is not set
239# CONFIG_MACH_CM_X300 is not set
240# CONFIG_ARCH_GUMSTIX is not set
241# CONFIG_MACH_INTELMOTE2 is not set
242# CONFIG_MACH_STARGATE2 is not set
243# CONFIG_MACH_XCEP is not set
244# CONFIG_TRIZEPS_PXA is not set
245CONFIG_ARCOM_PCMCIA=y
246# CONFIG_MACH_LOGICPD_PXA270 is not set
247# CONFIG_MACH_PCM027 is not set
248# CONFIG_MACH_COLIBRI is not set
249# CONFIG_MACH_COLIBRI300 is not set
250# CONFIG_MACH_COLIBRI320 is not set
251
252#
253# End-user Products (sorted by vendor name)
254#
255# CONFIG_MACH_H4700 is not set
256# CONFIG_MACH_H5000 is not set
257# CONFIG_MACH_HIMALAYA is not set
258# CONFIG_MACH_MAGICIAN is not set
259# CONFIG_MACH_MIOA701 is not set
260# CONFIG_PXA_EZX is not set
261# CONFIG_MACH_MP900C is not set
262# CONFIG_ARCH_PXA_PALM is not set
263# CONFIG_PXA_SHARPSL is not set
264# CONFIG_ARCH_PXA_ESERIES is not set
265CONFIG_PXA27x=y
266CONFIG_PXA_SSP=y
267CONFIG_PXA_HAVE_BOARD_IRQS=y
268CONFIG_PXA_HAVE_ISA_IRQS=y
269CONFIG_PLAT_PXA=y
270
271#
272# Processor Type
273#
274CONFIG_CPU_32=y
275CONFIG_CPU_XSCALE=y
276CONFIG_CPU_32v5=y
277CONFIG_CPU_ABRT_EV5T=y
278CONFIG_CPU_PABRT_LEGACY=y
279CONFIG_CPU_CACHE_VIVT=y
280CONFIG_CPU_TLB_V4WBI=y
281CONFIG_CPU_CP15=y
282CONFIG_CPU_CP15_MMU=y
283
284#
285# Processor Features
286#
287CONFIG_ARM_THUMB=y
288# CONFIG_CPU_DCACHE_DISABLE is not set
289CONFIG_ARM_L1_CACHE_SHIFT=5
290CONFIG_IWMMXT=y
291CONFIG_XSCALE_PMU=y
292CONFIG_COMMON_CLKDEV=y
293
294#
295# Bus support
296#
297CONFIG_ISA=y
298# CONFIG_PCI_SYSCALL is not set
299# CONFIG_ARCH_SUPPORTS_MSI is not set
300CONFIG_PCCARD=m
301CONFIG_PCMCIA=m
302CONFIG_PCMCIA_LOAD_CIS=y
303CONFIG_PCMCIA_IOCTL=y
304
305#
306# PC-card bridges
307#
308# CONFIG_I82365 is not set
309# CONFIG_TCIC is not set
310CONFIG_PCMCIA_SOC_COMMON=m
311CONFIG_PCMCIA_PXA2XX=m
312# CONFIG_PCMCIA_DEBUG is not set
313CONFIG_PCMCIA_PROBE=y
314
315#
316# Kernel Features
317#
318CONFIG_TICK_ONESHOT=y
319# CONFIG_NO_HZ is not set
320# CONFIG_HIGH_RES_TIMERS is not set
321CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
322CONFIG_VMSPLIT_3G=y
323# CONFIG_VMSPLIT_2G is not set
324# CONFIG_VMSPLIT_1G is not set
325CONFIG_PAGE_OFFSET=0xC0000000
326CONFIG_PREEMPT_NONE=y
327# CONFIG_PREEMPT_VOLUNTARY is not set
328# CONFIG_PREEMPT is not set
329CONFIG_HZ=100
330CONFIG_AEABI=y
331CONFIG_OABI_COMPAT=y
332# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
333# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
334# CONFIG_HIGHMEM is not set
335CONFIG_SELECT_MEMORY_MODEL=y
336CONFIG_FLATMEM_MANUAL=y
337# CONFIG_DISCONTIGMEM_MANUAL is not set
338# CONFIG_SPARSEMEM_MANUAL is not set
339CONFIG_FLATMEM=y
340CONFIG_FLAT_NODE_MEM_MAP=y
341CONFIG_PAGEFLAGS_EXTENDED=y
342CONFIG_SPLIT_PTLOCK_CPUS=4096
343# CONFIG_PHYS_ADDR_T_64BIT is not set
344CONFIG_ZONE_DMA_FLAG=0
345CONFIG_VIRT_TO_BUS=y
346CONFIG_HAVE_MLOCK=y
347CONFIG_HAVE_MLOCKED_PAGE_BIT=y
348# CONFIG_KSM is not set
349CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
350CONFIG_ALIGNMENT_TRAP=y
351# CONFIG_UACCESS_WITH_MEMCPY is not set
352
353#
354# Boot options
355#
356CONFIG_ZBOOT_ROM_TEXT=0x0
357CONFIG_ZBOOT_ROM_BSS=0x0
358CONFIG_CMDLINE="root=31:02 rootfstype=jffs2 ro console=ttyS0,115200"
359# CONFIG_XIP_KERNEL is not set
360# CONFIG_KEXEC is not set
361
362#
363# CPU Power Management
364#
365CONFIG_CPU_FREQ=y
366CONFIG_CPU_FREQ_TABLE=y
367# CONFIG_CPU_FREQ_DEBUG is not set
368CONFIG_CPU_FREQ_STAT=y
369# CONFIG_CPU_FREQ_STAT_DETAILS is not set
370CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
371# CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set
372# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
373# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set
374# CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set
375CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
376CONFIG_CPU_FREQ_GOV_POWERSAVE=m
377CONFIG_CPU_FREQ_GOV_USERSPACE=m
378CONFIG_CPU_FREQ_GOV_ONDEMAND=m
379CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
380# CONFIG_CPU_IDLE is not set
381
382#
383# Floating point emulation
384#
385
386#
387# At least one emulation must be selected
388#
389CONFIG_FPE_NWFPE=y
390# CONFIG_FPE_NWFPE_XP is not set
391# CONFIG_FPE_FASTFPE is not set
392
393#
394# Userspace binary formats
395#
396CONFIG_BINFMT_ELF=y
397# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
398CONFIG_HAVE_AOUT=y
399# CONFIG_BINFMT_AOUT is not set
400# CONFIG_BINFMT_MISC is not set
401
402#
403# Power management options
404#
405CONFIG_PM=y
406# CONFIG_PM_DEBUG is not set
407CONFIG_PM_SLEEP=y
408CONFIG_SUSPEND=y
409CONFIG_SUSPEND_FREEZER=y
410CONFIG_APM_EMULATION=y
411# CONFIG_PM_RUNTIME is not set
412CONFIG_ARCH_SUSPEND_POSSIBLE=y
413CONFIG_NET=y
414
415#
416# Networking options
417#
418CONFIG_PACKET=y
419# CONFIG_PACKET_MMAP is not set
420CONFIG_UNIX=y
421CONFIG_XFRM=y
422# CONFIG_XFRM_USER is not set
423# CONFIG_XFRM_SUB_POLICY is not set
424# CONFIG_XFRM_MIGRATE is not set
425# CONFIG_XFRM_STATISTICS is not set
426# CONFIG_NET_KEY is not set
427CONFIG_INET=y
428# CONFIG_IP_MULTICAST is not set
429# CONFIG_IP_ADVANCED_ROUTER is not set
430CONFIG_IP_FIB_HASH=y
431CONFIG_IP_PNP=y
432CONFIG_IP_PNP_DHCP=y
433# CONFIG_IP_PNP_BOOTP is not set
434# CONFIG_IP_PNP_RARP is not set
435# CONFIG_NET_IPIP is not set
436# CONFIG_NET_IPGRE is not set
437# CONFIG_ARPD is not set
438CONFIG_SYN_COOKIES=y
439# CONFIG_INET_AH is not set
440# CONFIG_INET_ESP is not set
441# CONFIG_INET_IPCOMP is not set
442# CONFIG_INET_XFRM_TUNNEL is not set
443# CONFIG_INET_TUNNEL is not set
444CONFIG_INET_XFRM_MODE_TRANSPORT=y
445CONFIG_INET_XFRM_MODE_TUNNEL=y
446CONFIG_INET_XFRM_MODE_BEET=y
447# CONFIG_INET_LRO is not set
448CONFIG_INET_DIAG=y
449CONFIG_INET_TCP_DIAG=y
450# CONFIG_TCP_CONG_ADVANCED is not set
451CONFIG_TCP_CONG_CUBIC=y
452CONFIG_DEFAULT_TCP_CONG="cubic"
453# CONFIG_TCP_MD5SIG is not set
454# CONFIG_IPV6 is not set
455# CONFIG_NETWORK_SECMARK is not set
456# CONFIG_NETFILTER is not set
457# CONFIG_IP_DCCP is not set
458# CONFIG_IP_SCTP is not set
459# CONFIG_RDS is not set
460# CONFIG_TIPC is not set
461# CONFIG_ATM is not set
462# CONFIG_BRIDGE is not set
463# CONFIG_NET_DSA is not set
464# CONFIG_VLAN_8021Q is not set
465# CONFIG_DECNET is not set
466# CONFIG_LLC2 is not set
467# CONFIG_IPX is not set
468# CONFIG_ATALK is not set
469# CONFIG_X25 is not set
470# CONFIG_LAPB is not set
471# CONFIG_ECONET is not set
472# CONFIG_WAN_ROUTER is not set
473# CONFIG_PHONET is not set
474# CONFIG_IEEE802154 is not set
475# CONFIG_NET_SCHED is not set
476# CONFIG_DCB is not set
477
478#
479# Network testing
480#
481# CONFIG_NET_PKTGEN is not set
482# CONFIG_HAMRADIO is not set
483# CONFIG_CAN is not set
484# CONFIG_IRDA is not set
485CONFIG_BT=m
486CONFIG_BT_L2CAP=m
487# CONFIG_BT_SCO is not set
488CONFIG_BT_RFCOMM=m
489CONFIG_BT_RFCOMM_TTY=y
490CONFIG_BT_BNEP=m
491# CONFIG_BT_BNEP_MC_FILTER is not set
492# CONFIG_BT_BNEP_PROTO_FILTER is not set
493# CONFIG_BT_HIDP is not set
494
495#
496# Bluetooth device drivers
497#
498# CONFIG_BT_HCIBTUSB is not set
499# CONFIG_BT_HCIBTSDIO is not set
500CONFIG_BT_HCIUART=m
501CONFIG_BT_HCIUART_H4=y
502CONFIG_BT_HCIUART_BCSP=y
503# CONFIG_BT_HCIUART_LL is not set
504# CONFIG_BT_HCIBCM203X is not set
505# CONFIG_BT_HCIBPA10X is not set
506# CONFIG_BT_HCIBFUSB is not set
507# CONFIG_BT_HCIDTL1 is not set
508# CONFIG_BT_HCIBT3C is not set
509# CONFIG_BT_HCIBLUECARD is not set
510# CONFIG_BT_HCIBTUART is not set
511# CONFIG_BT_HCIVHCI is not set
512# CONFIG_BT_MRVL is not set
513# CONFIG_AF_RXRPC is not set
514CONFIG_WIRELESS=y
515CONFIG_WIRELESS_EXT=y
516CONFIG_WEXT_CORE=y
517CONFIG_WEXT_PROC=y
518CONFIG_WEXT_SPY=y
519CONFIG_WEXT_PRIV=y
520CONFIG_CFG80211=m
521# CONFIG_NL80211_TESTMODE is not set
522# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
523# CONFIG_CFG80211_REG_DEBUG is not set
524CONFIG_CFG80211_DEFAULT_PS=y
525# CONFIG_WIRELESS_OLD_REGULATORY is not set
526CONFIG_CFG80211_WEXT=y
527CONFIG_WIRELESS_EXT_SYSFS=y
528CONFIG_LIB80211=m
529# CONFIG_LIB80211_DEBUG is not set
530CONFIG_MAC80211=m
531CONFIG_MAC80211_RC_MINSTREL=y
532# CONFIG_MAC80211_RC_DEFAULT_PID is not set
533CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
534CONFIG_MAC80211_RC_DEFAULT="minstrel"
535# CONFIG_MAC80211_MESH is not set
536# CONFIG_MAC80211_LEDS is not set
537# CONFIG_MAC80211_DEBUG_MENU is not set
538# CONFIG_WIMAX is not set
539# CONFIG_RFKILL is not set
540# CONFIG_NET_9P is not set
541
542#
543# Device Drivers
544#
545
546#
547# Generic Driver Options
548#
549CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
550# CONFIG_DEVTMPFS is not set
551CONFIG_STANDALONE=y
552CONFIG_PREVENT_FIRMWARE_BUILD=y
553CONFIG_FW_LOADER=y
554CONFIG_FIRMWARE_IN_KERNEL=y
555CONFIG_EXTRA_FIRMWARE=""
556# CONFIG_DEBUG_DRIVER is not set
557# CONFIG_DEBUG_DEVRES is not set
558# CONFIG_SYS_HYPERVISOR is not set
559# CONFIG_CONNECTOR is not set
560CONFIG_MTD=y
561# CONFIG_MTD_DEBUG is not set
562# CONFIG_MTD_TESTS is not set
563# CONFIG_MTD_CONCAT is not set
564CONFIG_MTD_PARTITIONS=y
565CONFIG_MTD_REDBOOT_PARTS=y
566CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
567# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
568CONFIG_MTD_REDBOOT_PARTS_READONLY=y
569# CONFIG_MTD_CMDLINE_PARTS is not set
570# CONFIG_MTD_AFS_PARTS is not set
571# CONFIG_MTD_AR7_PARTS is not set
572
573#
574# User Modules And Translation Layers
575#
576CONFIG_MTD_CHAR=m
577CONFIG_MTD_BLKDEVS=y
578CONFIG_MTD_BLOCK=y
579# CONFIG_FTL is not set
580# CONFIG_NFTL is not set
581# CONFIG_INFTL is not set
582# CONFIG_RFD_FTL is not set
583# CONFIG_SSFDC is not set
584# CONFIG_MTD_OOPS is not set
585
586#
587# RAM/ROM/Flash chip drivers
588#
589CONFIG_MTD_CFI=y
590CONFIG_MTD_JEDECPROBE=y
591CONFIG_MTD_GEN_PROBE=y
592CONFIG_MTD_CFI_ADV_OPTIONS=y
593CONFIG_MTD_CFI_NOSWAP=y
594# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
595# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
596CONFIG_MTD_CFI_GEOMETRY=y
597CONFIG_MTD_MAP_BANK_WIDTH_1=y
598CONFIG_MTD_MAP_BANK_WIDTH_2=y
599# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
600# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
601# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
602# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
603CONFIG_MTD_CFI_I1=y
604# CONFIG_MTD_CFI_I2 is not set
605# CONFIG_MTD_CFI_I4 is not set
606# CONFIG_MTD_CFI_I8 is not set
607# CONFIG_MTD_OTP is not set
608CONFIG_MTD_CFI_INTELEXT=y
609CONFIG_MTD_CFI_AMDSTD=y
610# CONFIG_MTD_CFI_STAA is not set
611CONFIG_MTD_CFI_UTIL=y
612CONFIG_MTD_RAM=y
613# CONFIG_MTD_ROM is not set
614# CONFIG_MTD_ABSENT is not set
615# CONFIG_MTD_XIP is not set
616
617#
618# Mapping drivers for chip access
619#
620CONFIG_MTD_COMPLEX_MAPPINGS=y
621CONFIG_MTD_PHYSMAP=y
622# CONFIG_MTD_PHYSMAP_COMPAT is not set
623CONFIG_MTD_PXA2XX=y
624# CONFIG_MTD_ARM_INTEGRATOR is not set
625# CONFIG_MTD_IMPA7 is not set
626# CONFIG_MTD_GPIO_ADDR is not set
627# CONFIG_MTD_PLATRAM is not set
628
629#
630# Self-contained MTD device drivers
631#
632# CONFIG_MTD_DATAFLASH is not set
633# CONFIG_MTD_M25P80 is not set
634# CONFIG_MTD_SST25L is not set
635# CONFIG_MTD_SLRAM is not set
636# CONFIG_MTD_PHRAM is not set
637# CONFIG_MTD_MTDRAM is not set
638# CONFIG_MTD_BLOCK2MTD is not set
639
640#
641# Disk-On-Chip Device Drivers
642#
643# CONFIG_MTD_DOC2000 is not set
644# CONFIG_MTD_DOC2001 is not set
645# CONFIG_MTD_DOC2001PLUS is not set
646# CONFIG_MTD_NAND is not set
647# CONFIG_MTD_ONENAND is not set
648
649#
650# LPDDR flash memory drivers
651#
652# CONFIG_MTD_LPDDR is not set
653
654#
655# UBI - Unsorted block images
656#
657# CONFIG_MTD_UBI is not set
658# CONFIG_PARPORT is not set
659# CONFIG_PNP is not set
660CONFIG_BLK_DEV=y
661# CONFIG_BLK_DEV_COW_COMMON is not set
662CONFIG_BLK_DEV_LOOP=m
663# CONFIG_BLK_DEV_CRYPTOLOOP is not set
664
665#
666# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
667#
668# CONFIG_BLK_DEV_NBD is not set
669# CONFIG_BLK_DEV_UB is not set
670# CONFIG_BLK_DEV_RAM is not set
671# CONFIG_CDROM_PKTCDVD is not set
672# CONFIG_ATA_OVER_ETH is not set
673# CONFIG_MG_DISK is not set
674CONFIG_MISC_DEVICES=y
675# CONFIG_ICS932S401 is not set
676# CONFIG_ENCLOSURE_SERVICES is not set
677# CONFIG_ISL29003 is not set
678# CONFIG_DS1682 is not set
679# CONFIG_C2PORT is not set
680
681#
682# EEPROM support
683#
684CONFIG_EEPROM_AT24=m
685# CONFIG_EEPROM_AT25 is not set
686# CONFIG_EEPROM_LEGACY is not set
687# CONFIG_EEPROM_MAX6875 is not set
688# CONFIG_EEPROM_93CX6 is not set
689# CONFIG_IWMC3200TOP is not set
690CONFIG_HAVE_IDE=y
691# CONFIG_IDE is not set
692
693#
694# SCSI device support
695#
696# CONFIG_RAID_ATTRS is not set
697CONFIG_SCSI=m
698CONFIG_SCSI_DMA=y
699# CONFIG_SCSI_TGT is not set
700# CONFIG_SCSI_NETLINK is not set
701# CONFIG_SCSI_PROC_FS is not set
702
703#
704# SCSI support type (disk, tape, CD-ROM)
705#
706CONFIG_BLK_DEV_SD=m
707# CONFIG_CHR_DEV_ST is not set
708# CONFIG_CHR_DEV_OSST is not set
709# CONFIG_BLK_DEV_SR is not set
710# CONFIG_CHR_DEV_SG is not set
711# CONFIG_CHR_DEV_SCH is not set
712# CONFIG_SCSI_MULTI_LUN is not set
713# CONFIG_SCSI_CONSTANTS is not set
714# CONFIG_SCSI_LOGGING is not set
715# CONFIG_SCSI_SCAN_ASYNC is not set
716CONFIG_SCSI_WAIT_SCAN=m
717
718#
719# SCSI Transports
720#
721# CONFIG_SCSI_SPI_ATTRS is not set
722# CONFIG_SCSI_FC_ATTRS is not set
723# CONFIG_SCSI_ISCSI_ATTRS is not set
724# CONFIG_SCSI_SAS_LIBSAS is not set
725# CONFIG_SCSI_SRP_ATTRS is not set
726CONFIG_SCSI_LOWLEVEL=y
727# CONFIG_ISCSI_TCP is not set
728# CONFIG_SCSI_AHA152X is not set
729# CONFIG_SCSI_AIC7XXX_OLD is not set
730# CONFIG_SCSI_ADVANSYS is not set
731# CONFIG_SCSI_IN2000 is not set
732# CONFIG_LIBFC is not set
733# CONFIG_LIBFCOE is not set
734# CONFIG_SCSI_DTC3280 is not set
735# CONFIG_SCSI_FUTURE_DOMAIN is not set
736# CONFIG_SCSI_GENERIC_NCR5380 is not set
737# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
738# CONFIG_SCSI_NCR53C406A is not set
739# CONFIG_SCSI_PAS16 is not set
740# CONFIG_SCSI_QLOGIC_FAS is not set
741# CONFIG_SCSI_SYM53C416 is not set
742# CONFIG_SCSI_T128 is not set
743# CONFIG_SCSI_DEBUG is not set
744# CONFIG_SCSI_LOWLEVEL_PCMCIA is not set
745# CONFIG_SCSI_DH is not set
746# CONFIG_SCSI_OSD_INITIATOR is not set
747CONFIG_ATA=m
748# CONFIG_ATA_NONSTANDARD is not set
749CONFIG_ATA_VERBOSE_ERROR=y
750# CONFIG_SATA_PMP is not set
751CONFIG_ATA_SFF=y
752# CONFIG_SATA_MV is not set
753# CONFIG_PATA_LEGACY is not set
754CONFIG_PATA_PCMCIA=m
755# CONFIG_PATA_QDI is not set
756# CONFIG_PATA_WINBOND_VLB is not set
757# CONFIG_MD is not set
758CONFIG_NETDEVICES=y
759# CONFIG_DUMMY is not set
760# CONFIG_BONDING is not set
761# CONFIG_MACVLAN is not set
762# CONFIG_EQUALIZER is not set
763# CONFIG_TUN is not set
764# CONFIG_VETH is not set
765# CONFIG_ARCNET is not set
766# CONFIG_PHYLIB is not set
767CONFIG_NET_ETHERNET=y
768CONFIG_MII=y
769# CONFIG_AX88796 is not set
770# CONFIG_NET_VENDOR_3COM is not set
771# CONFIG_NET_VENDOR_SMC is not set
772# CONFIG_SMC91X is not set
773CONFIG_DM9000=y
774CONFIG_DM9000_DEBUGLEVEL=4
775# CONFIG_DM9000_FORCE_SIMPLE_PHY_POLL is not set
776# CONFIG_ENC28J60 is not set
777# CONFIG_ETHOC is not set
778# CONFIG_SMC911X is not set
779# CONFIG_SMSC911X is not set
780# CONFIG_NET_VENDOR_RACAL is not set
781# CONFIG_DNET is not set
782# CONFIG_AT1700 is not set
783# CONFIG_DEPCA is not set
784# CONFIG_HP100 is not set
785# CONFIG_NET_ISA is not set
786# CONFIG_IBM_NEW_EMAC_ZMII is not set
787# CONFIG_IBM_NEW_EMAC_RGMII is not set
788# CONFIG_IBM_NEW_EMAC_TAH is not set
789# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
790# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
791# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
792# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
793# CONFIG_NET_PCI is not set
794# CONFIG_B44 is not set
795# CONFIG_CS89x0 is not set
796# CONFIG_KS8842 is not set
797# CONFIG_KS8851 is not set
798# CONFIG_KS8851_MLL is not set
799# CONFIG_NETDEV_1000 is not set
800# CONFIG_NETDEV_10000 is not set
801# CONFIG_TR is not set
802CONFIG_WLAN=y
803# CONFIG_PCMCIA_RAYCS is not set
804# CONFIG_LIBERTAS_THINFIRM is not set
805# CONFIG_ATMEL is not set
806# CONFIG_AT76C50X_USB is not set
807# CONFIG_AIRO_CS is not set
808# CONFIG_PCMCIA_WL3501 is not set
809# CONFIG_USB_ZD1201 is not set
810# CONFIG_USB_NET_RNDIS_WLAN is not set
811# CONFIG_RTL8187 is not set
812# CONFIG_MAC80211_HWSIM is not set
813# CONFIG_ATH_COMMON is not set
814# CONFIG_B43 is not set
815# CONFIG_B43LEGACY is not set
816# CONFIG_HOSTAP is not set
817# CONFIG_IWM is not set
818# CONFIG_LIBERTAS is not set
819CONFIG_HERMES=m
820CONFIG_HERMES_CACHE_FW_ON_INIT=y
821CONFIG_PCMCIA_HERMES=m
822# CONFIG_PCMCIA_SPECTRUM is not set
823# CONFIG_P54_COMMON is not set
824CONFIG_RT2X00=m
825# CONFIG_RT2500USB is not set
826CONFIG_RT73USB=m
827# CONFIG_RT2800USB is not set
828CONFIG_RT2X00_LIB_USB=m
829CONFIG_RT2X00_LIB=m
830CONFIG_RT2X00_LIB_FIRMWARE=y
831CONFIG_RT2X00_LIB_CRYPTO=y
832CONFIG_RT2X00_LIB_LEDS=y
833# CONFIG_RT2X00_DEBUG is not set
834# CONFIG_WL12XX is not set
835# CONFIG_ZD1211RW is not set
836
837#
838# Enable WiMAX (Networking options) to see the WiMAX drivers
839#
840
841#
842# USB Network Adapters
843#
844# CONFIG_USB_CATC is not set
845# CONFIG_USB_KAWETH is not set
846# CONFIG_USB_PEGASUS is not set
847# CONFIG_USB_RTL8150 is not set
848# CONFIG_USB_USBNET is not set
849CONFIG_NET_PCMCIA=y
850# CONFIG_PCMCIA_3C589 is not set
851# CONFIG_PCMCIA_3C574 is not set
852# CONFIG_PCMCIA_FMVJ18X is not set
853# CONFIG_PCMCIA_PCNET is not set
854# CONFIG_PCMCIA_NMCLAN is not set
855# CONFIG_PCMCIA_SMC91C92 is not set
856# CONFIG_PCMCIA_XIRC2PS is not set
857# CONFIG_PCMCIA_AXNET is not set
858# CONFIG_WAN is not set
859CONFIG_PPP=m
860# CONFIG_PPP_MULTILINK is not set
861# CONFIG_PPP_FILTER is not set
862CONFIG_PPP_ASYNC=m
863# CONFIG_PPP_SYNC_TTY is not set
864CONFIG_PPP_DEFLATE=m
865CONFIG_PPP_BSDCOMP=m
866# CONFIG_PPP_MPPE is not set
867# CONFIG_PPPOE is not set
868# CONFIG_PPPOL2TP is not set
869# CONFIG_SLIP is not set
870CONFIG_SLHC=m
871# CONFIG_NETCONSOLE is not set
872# CONFIG_NETPOLL is not set
873# CONFIG_NET_POLL_CONTROLLER is not set
874# CONFIG_ISDN is not set
875# CONFIG_PHONE is not set
876
877#
878# Input device support
879#
880CONFIG_INPUT=y
881# CONFIG_INPUT_FF_MEMLESS is not set
882# CONFIG_INPUT_POLLDEV is not set
883
884#
885# Userland interfaces
886#
887CONFIG_INPUT_MOUSEDEV=y
888# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
889CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
890CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
891# CONFIG_INPUT_JOYDEV is not set
892CONFIG_INPUT_EVDEV=m
893# CONFIG_INPUT_EVBUG is not set
894
895#
896# Input Device Drivers
897#
898# CONFIG_INPUT_KEYBOARD is not set
899# CONFIG_INPUT_MOUSE is not set
900# CONFIG_INPUT_JOYSTICK is not set
901# CONFIG_INPUT_TABLET is not set
902CONFIG_INPUT_TOUCHSCREEN=y
903# CONFIG_TOUCHSCREEN_ADS7846 is not set
904# CONFIG_TOUCHSCREEN_AD7877 is not set
905# CONFIG_TOUCHSCREEN_AD7879_I2C is not set
906# CONFIG_TOUCHSCREEN_AD7879_SPI is not set
907# CONFIG_TOUCHSCREEN_AD7879 is not set
908# CONFIG_TOUCHSCREEN_EETI is not set
909CONFIG_TOUCHSCREEN_FUJITSU=m
910# CONFIG_TOUCHSCREEN_GUNZE is not set
911CONFIG_TOUCHSCREEN_ELO=m
912# CONFIG_TOUCHSCREEN_WACOM_W8001 is not set
913# CONFIG_TOUCHSCREEN_MCS5000 is not set
914CONFIG_TOUCHSCREEN_MTOUCH=m
915CONFIG_TOUCHSCREEN_INEXIO=m
916# CONFIG_TOUCHSCREEN_MK712 is not set
917CONFIG_TOUCHSCREEN_HTCPEN=m
918CONFIG_TOUCHSCREEN_PENMOUNT=m
919CONFIG_TOUCHSCREEN_TOUCHRIGHT=m
920CONFIG_TOUCHSCREEN_TOUCHWIN=m
921# CONFIG_TOUCHSCREEN_WM97XX is not set
922# CONFIG_TOUCHSCREEN_USB_COMPOSITE is not set
923CONFIG_TOUCHSCREEN_TOUCHIT213=m
924# CONFIG_TOUCHSCREEN_TSC2007 is not set
925# CONFIG_TOUCHSCREEN_W90X900 is not set
926CONFIG_INPUT_MISC=y
927# CONFIG_INPUT_ATI_REMOTE is not set
928# CONFIG_INPUT_ATI_REMOTE2 is not set
929# CONFIG_INPUT_KEYSPAN_REMOTE is not set
930# CONFIG_INPUT_POWERMATE is not set
931# CONFIG_INPUT_YEALINK is not set
932# CONFIG_INPUT_CM109 is not set
933CONFIG_INPUT_UINPUT=m
934# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
935
936#
937# Hardware I/O ports
938#
939CONFIG_SERIO=y
940CONFIG_SERIO_SERPORT=y
941# CONFIG_SERIO_RAW is not set
942# CONFIG_GAMEPORT is not set
943
944#
945# Character devices
946#
947CONFIG_VT=y
948CONFIG_CONSOLE_TRANSLATIONS=y
949CONFIG_VT_CONSOLE=y
950CONFIG_HW_CONSOLE=y
951# CONFIG_VT_HW_CONSOLE_BINDING is not set
952CONFIG_DEVKMEM=y
953# CONFIG_SERIAL_NONSTANDARD is not set
954
955#
956# Serial drivers
957#
958CONFIG_SERIAL_8250=y
959CONFIG_SERIAL_8250_CONSOLE=y
960# CONFIG_SERIAL_8250_CS is not set
961CONFIG_SERIAL_8250_NR_UARTS=7
962CONFIG_SERIAL_8250_RUNTIME_UARTS=7
963# CONFIG_SERIAL_8250_EXTENDED is not set
964
965#
966# Non-8250 serial port support
967#
968# CONFIG_SERIAL_MAX3100 is not set
969# CONFIG_SERIAL_PXA is not set
970CONFIG_SERIAL_CORE=y
971CONFIG_SERIAL_CORE_CONSOLE=y
972CONFIG_UNIX98_PTYS=y
973# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
974# CONFIG_LEGACY_PTYS is not set
975# CONFIG_IPMI_HANDLER is not set
976CONFIG_HW_RANDOM=m
977# CONFIG_HW_RANDOM_TIMERIOMEM is not set
978# CONFIG_DTLK is not set
979# CONFIG_R3964 is not set
980
981#
982# PCMCIA character devices
983#
984# CONFIG_SYNCLINK_CS is not set
985# CONFIG_CARDMAN_4000 is not set
986# CONFIG_CARDMAN_4040 is not set
987# CONFIG_IPWIRELESS is not set
988# CONFIG_RAW_DRIVER is not set
989# CONFIG_TCG_TPM is not set
990CONFIG_DEVPORT=y
991CONFIG_I2C=y
992CONFIG_I2C_BOARDINFO=y
993CONFIG_I2C_COMPAT=y
994CONFIG_I2C_CHARDEV=y
995# CONFIG_I2C_HELPER_AUTO is not set
996
997#
998# I2C Algorithms
999#
1000CONFIG_I2C_ALGOBIT=y
1001# CONFIG_I2C_ALGOPCF is not set
1002# CONFIG_I2C_ALGOPCA is not set
1003
1004#
1005# I2C Hardware Bus support
1006#
1007
1008#
1009# I2C system bus drivers (mostly embedded / system-on-chip)
1010#
1011# CONFIG_I2C_DESIGNWARE is not set
1012CONFIG_I2C_GPIO=y
1013# CONFIG_I2C_OCORES is not set
1014CONFIG_I2C_PXA=y
1015# CONFIG_I2C_PXA_SLAVE is not set
1016# CONFIG_I2C_SIMTEC is not set
1017
1018#
1019# External I2C/SMBus adapter drivers
1020#
1021# CONFIG_I2C_PARPORT_LIGHT is not set
1022# CONFIG_I2C_TAOS_EVM is not set
1023# CONFIG_I2C_TINY_USB is not set
1024
1025#
1026# Other I2C/SMBus bus drivers
1027#
1028# CONFIG_I2C_ELEKTOR is not set
1029# CONFIG_I2C_PCA_ISA is not set
1030# CONFIG_I2C_PCA_PLATFORM is not set
1031# CONFIG_I2C_STUB is not set
1032
1033#
1034# Miscellaneous I2C Chip support
1035#
1036# CONFIG_SENSORS_TSL2550 is not set
1037# CONFIG_I2C_DEBUG_CORE is not set
1038# CONFIG_I2C_DEBUG_ALGO is not set
1039# CONFIG_I2C_DEBUG_BUS is not set
1040# CONFIG_I2C_DEBUG_CHIP is not set
1041CONFIG_SPI=y
1042# CONFIG_SPI_DEBUG is not set
1043CONFIG_SPI_MASTER=y
1044
1045#
1046# SPI Master Controller Drivers
1047#
1048# CONFIG_SPI_BITBANG is not set
1049# CONFIG_SPI_GPIO is not set
1050CONFIG_SPI_PXA2XX=y
1051
1052#
1053# SPI Protocol Masters
1054#
1055# CONFIG_SPI_SPIDEV is not set
1056# CONFIG_SPI_TLE62X0 is not set
1057
1058#
1059# PPS support
1060#
1061# CONFIG_PPS is not set
1062CONFIG_ARCH_REQUIRE_GPIOLIB=y
1063CONFIG_GPIOLIB=y
1064# CONFIG_DEBUG_GPIO is not set
1065CONFIG_GPIO_SYSFS=y
1066
1067#
1068# Memory mapped GPIO expanders:
1069#
1070
1071#
1072# I2C GPIO expanders:
1073#
1074# CONFIG_GPIO_MAX732X is not set
1075CONFIG_GPIO_PCA953X=y
1076# CONFIG_GPIO_PCF857X is not set
1077
1078#
1079# PCI GPIO expanders:
1080#
1081
1082#
1083# SPI GPIO expanders:
1084#
1085# CONFIG_GPIO_MAX7301 is not set
1086# CONFIG_GPIO_MCP23S08 is not set
1087# CONFIG_GPIO_MC33880 is not set
1088
1089#
1090# AC97 GPIO expanders:
1091#
1092# CONFIG_W1 is not set
1093# CONFIG_POWER_SUPPLY is not set
1094CONFIG_HWMON=y
1095# CONFIG_HWMON_VID is not set
1096# CONFIG_HWMON_DEBUG_CHIP is not set
1097
1098#
1099# Native drivers
1100#
1101# CONFIG_SENSORS_AD7414 is not set
1102# CONFIG_SENSORS_AD7418 is not set
1103# CONFIG_SENSORS_ADCXX is not set
1104# CONFIG_SENSORS_ADM1021 is not set
1105# CONFIG_SENSORS_ADM1025 is not set
1106# CONFIG_SENSORS_ADM1026 is not set
1107# CONFIG_SENSORS_ADM1029 is not set
1108# CONFIG_SENSORS_ADM1031 is not set
1109# CONFIG_SENSORS_ADM9240 is not set
1110# CONFIG_SENSORS_ADT7462 is not set
1111# CONFIG_SENSORS_ADT7470 is not set
1112# CONFIG_SENSORS_ADT7473 is not set
1113# CONFIG_SENSORS_ADT7475 is not set
1114# CONFIG_SENSORS_ATXP1 is not set
1115# CONFIG_SENSORS_DS1621 is not set
1116# CONFIG_SENSORS_F71805F is not set
1117# CONFIG_SENSORS_F71882FG is not set
1118# CONFIG_SENSORS_F75375S is not set
1119# CONFIG_SENSORS_G760A is not set
1120# CONFIG_SENSORS_GL518SM is not set
1121# CONFIG_SENSORS_GL520SM is not set
1122# CONFIG_SENSORS_IT87 is not set
1123# CONFIG_SENSORS_LM63 is not set
1124# CONFIG_SENSORS_LM70 is not set
1125CONFIG_SENSORS_LM75=m
1126# CONFIG_SENSORS_LM77 is not set
1127# CONFIG_SENSORS_LM78 is not set
1128# CONFIG_SENSORS_LM80 is not set
1129# CONFIG_SENSORS_LM83 is not set
1130# CONFIG_SENSORS_LM85 is not set
1131# CONFIG_SENSORS_LM87 is not set
1132# CONFIG_SENSORS_LM90 is not set
1133# CONFIG_SENSORS_LM92 is not set
1134# CONFIG_SENSORS_LM93 is not set
1135# CONFIG_SENSORS_LTC4215 is not set
1136# CONFIG_SENSORS_LTC4245 is not set
1137# CONFIG_SENSORS_LM95241 is not set
1138# CONFIG_SENSORS_MAX1111 is not set
1139# CONFIG_SENSORS_MAX1619 is not set
1140# CONFIG_SENSORS_MAX6650 is not set
1141# CONFIG_SENSORS_PC87360 is not set
1142# CONFIG_SENSORS_PC87427 is not set
1143# CONFIG_SENSORS_PCF8591 is not set
1144# CONFIG_SENSORS_SHT15 is not set
1145# CONFIG_SENSORS_DME1737 is not set
1146# CONFIG_SENSORS_SMSC47M1 is not set
1147# CONFIG_SENSORS_SMSC47M192 is not set
1148# CONFIG_SENSORS_SMSC47B397 is not set
1149# CONFIG_SENSORS_ADS7828 is not set
1150# CONFIG_SENSORS_THMC50 is not set
1151# CONFIG_SENSORS_TMP401 is not set
1152# CONFIG_SENSORS_TMP421 is not set
1153# CONFIG_SENSORS_VT1211 is not set
1154# CONFIG_SENSORS_W83781D is not set
1155# CONFIG_SENSORS_W83791D is not set
1156# CONFIG_SENSORS_W83792D is not set
1157# CONFIG_SENSORS_W83793 is not set
1158# CONFIG_SENSORS_W83L785TS is not set
1159# CONFIG_SENSORS_W83L786NG is not set
1160# CONFIG_SENSORS_W83627HF is not set
1161# CONFIG_SENSORS_W83627EHF is not set
1162# CONFIG_SENSORS_LIS3_SPI is not set
1163# CONFIG_THERMAL is not set
1164CONFIG_WATCHDOG=y
1165# CONFIG_WATCHDOG_NOWAYOUT is not set
1166
1167#
1168# Watchdog Device Drivers
1169#
1170# CONFIG_SOFT_WATCHDOG is not set
1171# CONFIG_SA1100_WATCHDOG is not set
1172
1173#
1174# ISA-based Watchdog Cards
1175#
1176# CONFIG_PCWATCHDOG is not set
1177# CONFIG_MIXCOMWD is not set
1178# CONFIG_WDT is not set
1179
1180#
1181# USB-based Watchdog Cards
1182#
1183# CONFIG_USBPCWATCHDOG is not set
1184CONFIG_SSB_POSSIBLE=y
1185
1186#
1187# Sonics Silicon Backplane
1188#
1189# CONFIG_SSB is not set
1190
1191#
1192# Multifunction device drivers
1193#
1194# CONFIG_MFD_CORE is not set
1195# CONFIG_MFD_SM501 is not set
1196# CONFIG_MFD_ASIC3 is not set
1197# CONFIG_HTC_EGPIO is not set
1198# CONFIG_HTC_PASIC3 is not set
1199# CONFIG_UCB1400_CORE is not set
1200# CONFIG_TPS65010 is not set
1201# CONFIG_TWL4030_CORE is not set
1202# CONFIG_MFD_TMIO is not set
1203# CONFIG_MFD_T7L66XB is not set
1204# CONFIG_MFD_TC6387XB is not set
1205# CONFIG_MFD_TC6393XB is not set
1206# CONFIG_PMIC_DA903X is not set
1207# CONFIG_MFD_WM8400 is not set
1208# CONFIG_MFD_WM831X is not set
1209# CONFIG_MFD_WM8350_I2C is not set
1210# CONFIG_MFD_PCF50633 is not set
1211# CONFIG_MFD_MC13783 is not set
1212# CONFIG_AB3100_CORE is not set
1213# CONFIG_EZX_PCAP is not set
1214# CONFIG_REGULATOR is not set
1215# CONFIG_MEDIA_SUPPORT is not set
1216
1217#
1218# Graphics support
1219#
1220# CONFIG_VGASTATE is not set
1221# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1222CONFIG_FB=y
1223# CONFIG_FIRMWARE_EDID is not set
1224# CONFIG_FB_DDC is not set
1225# CONFIG_FB_BOOT_VESA_SUPPORT is not set
1226CONFIG_FB_CFB_FILLRECT=m
1227CONFIG_FB_CFB_COPYAREA=m
1228CONFIG_FB_CFB_IMAGEBLIT=m
1229# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
1230# CONFIG_FB_SYS_FILLRECT is not set
1231# CONFIG_FB_SYS_COPYAREA is not set
1232# CONFIG_FB_SYS_IMAGEBLIT is not set
1233# CONFIG_FB_FOREIGN_ENDIAN is not set
1234# CONFIG_FB_SYS_FOPS is not set
1235# CONFIG_FB_SVGALIB is not set
1236# CONFIG_FB_MACMODES is not set
1237# CONFIG_FB_BACKLIGHT is not set
1238# CONFIG_FB_MODE_HELPERS is not set
1239# CONFIG_FB_TILEBLITTING is not set
1240
1241#
1242# Frame buffer hardware drivers
1243#
1244# CONFIG_FB_S1D13XXX is not set
1245CONFIG_FB_PXA=m
1246# CONFIG_FB_PXA_OVERLAY is not set
1247# CONFIG_FB_PXA_SMARTPANEL is not set
1248CONFIG_FB_PXA_PARAMETERS=y
1249# CONFIG_FB_MBX is not set
1250# CONFIG_FB_W100 is not set
1251# CONFIG_FB_VIRTUAL is not set
1252# CONFIG_FB_METRONOME is not set
1253# CONFIG_FB_MB862XX is not set
1254# CONFIG_FB_BROADSHEET is not set
1255CONFIG_BACKLIGHT_LCD_SUPPORT=y
1256CONFIG_LCD_CLASS_DEVICE=m
1257# CONFIG_LCD_LMS283GF05 is not set
1258# CONFIG_LCD_LTV350QV is not set
1259# CONFIG_LCD_ILI9320 is not set
1260# CONFIG_LCD_TDO24M is not set
1261# CONFIG_LCD_VGG2432A4 is not set
1262# CONFIG_LCD_PLATFORM is not set
1263CONFIG_BACKLIGHT_CLASS_DEVICE=m
1264CONFIG_BACKLIGHT_GENERIC=m
1265
1266#
1267# Display device support
1268#
1269# CONFIG_DISPLAY_SUPPORT is not set
1270
1271#
1272# Console display driver support
1273#
1274# CONFIG_VGA_CONSOLE is not set
1275# CONFIG_MDA_CONSOLE is not set
1276CONFIG_DUMMY_CONSOLE=y
1277CONFIG_FRAMEBUFFER_CONSOLE=m
1278# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
1279# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1280# CONFIG_FONTS is not set
1281CONFIG_FONT_8x8=y
1282CONFIG_FONT_8x16=y
1283CONFIG_LOGO=y
1284CONFIG_LOGO_LINUX_MONO=y
1285CONFIG_LOGO_LINUX_VGA16=y
1286CONFIG_LOGO_LINUX_CLUT224=y
1287CONFIG_SOUND=m
1288CONFIG_SOUND_OSS_CORE=y
1289CONFIG_SOUND_OSS_CORE_PRECLAIM=y
1290CONFIG_SND=m
1291CONFIG_SND_TIMER=m
1292CONFIG_SND_PCM=m
1293CONFIG_SND_JACK=y
1294# CONFIG_SND_SEQUENCER is not set
1295CONFIG_SND_OSSEMUL=y
1296CONFIG_SND_MIXER_OSS=m
1297CONFIG_SND_PCM_OSS=m
1298CONFIG_SND_PCM_OSS_PLUGINS=y
1299# CONFIG_SND_DYNAMIC_MINORS is not set
1300# CONFIG_SND_SUPPORT_OLD_API is not set
1301CONFIG_SND_VERBOSE_PROCFS=y
1302# CONFIG_SND_VERBOSE_PRINTK is not set
1303# CONFIG_SND_DEBUG is not set
1304CONFIG_SND_VMASTER=y
1305# CONFIG_SND_RAWMIDI_SEQ is not set
1306# CONFIG_SND_OPL3_LIB_SEQ is not set
1307# CONFIG_SND_OPL4_LIB_SEQ is not set
1308# CONFIG_SND_SBAWE_SEQ is not set
1309# CONFIG_SND_EMU10K1_SEQ is not set
1310CONFIG_SND_AC97_CODEC=m
1311CONFIG_SND_DRIVERS=y
1312# CONFIG_SND_DUMMY is not set
1313# CONFIG_SND_MTPAV is not set
1314# CONFIG_SND_SERIAL_U16550 is not set
1315# CONFIG_SND_MPU401 is not set
1316# CONFIG_SND_AC97_POWER_SAVE is not set
1317CONFIG_SND_ARM=y
1318CONFIG_SND_PXA2XX_PCM=m
1319CONFIG_SND_PXA2XX_LIB=m
1320CONFIG_SND_PXA2XX_LIB_AC97=y
1321CONFIG_SND_PXA2XX_AC97=m
1322# CONFIG_SND_SPI is not set
1323CONFIG_SND_USB=y
1324# CONFIG_SND_USB_AUDIO is not set
1325# CONFIG_SND_USB_CAIAQ is not set
1326# CONFIG_SND_PCMCIA is not set
1327CONFIG_SND_SOC=m
1328CONFIG_SND_PXA2XX_SOC=m
1329CONFIG_SND_SOC_I2C_AND_SPI=m
1330# CONFIG_SND_SOC_ALL_CODECS is not set
1331# CONFIG_SOUND_PRIME is not set
1332CONFIG_AC97_BUS=m
1333# CONFIG_HID_SUPPORT is not set
1334CONFIG_USB_SUPPORT=y
1335CONFIG_USB_ARCH_HAS_HCD=y
1336CONFIG_USB_ARCH_HAS_OHCI=y
1337# CONFIG_USB_ARCH_HAS_EHCI is not set
1338CONFIG_USB=m
1339# CONFIG_USB_DEBUG is not set
1340# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1341
1342#
1343# Miscellaneous USB options
1344#
1345CONFIG_USB_DEVICEFS=y
1346CONFIG_USB_DEVICE_CLASS=y
1347# CONFIG_USB_DYNAMIC_MINORS is not set
1348CONFIG_USB_SUSPEND=y
1349# CONFIG_USB_OTG is not set
1350# CONFIG_USB_MON is not set
1351# CONFIG_USB_WUSB is not set
1352# CONFIG_USB_WUSB_CBAF is not set
1353
1354#
1355# USB Host Controller Drivers
1356#
1357# CONFIG_USB_C67X00_HCD is not set
1358# CONFIG_USB_OXU210HP_HCD is not set
1359# CONFIG_USB_ISP116X_HCD is not set
1360# CONFIG_USB_ISP1760_HCD is not set
1361# CONFIG_USB_ISP1362_HCD is not set
1362CONFIG_USB_OHCI_HCD=m
1363# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1364# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1365CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1366# CONFIG_USB_SL811_HCD is not set
1367# CONFIG_USB_R8A66597_HCD is not set
1368# CONFIG_USB_HWA_HCD is not set
1369# CONFIG_USB_MUSB_HDRC is not set
1370# CONFIG_USB_GADGET_MUSB_HDRC is not set
1371
1372#
1373# USB Device Class drivers
1374#
1375CONFIG_USB_ACM=m
1376# CONFIG_USB_PRINTER is not set
1377# CONFIG_USB_WDM is not set
1378# CONFIG_USB_TMC is not set
1379
1380#
1381# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1382#
1383
1384#
1385# also be needed; see USB_STORAGE Help for more info
1386#
1387CONFIG_USB_STORAGE=m
1388# CONFIG_USB_STORAGE_DEBUG is not set
1389# CONFIG_USB_STORAGE_DATAFAB is not set
1390# CONFIG_USB_STORAGE_FREECOM is not set
1391# CONFIG_USB_STORAGE_ISD200 is not set
1392# CONFIG_USB_STORAGE_USBAT is not set
1393# CONFIG_USB_STORAGE_SDDR09 is not set
1394# CONFIG_USB_STORAGE_SDDR55 is not set
1395# CONFIG_USB_STORAGE_JUMPSHOT is not set
1396# CONFIG_USB_STORAGE_ALAUDA is not set
1397# CONFIG_USB_STORAGE_ONETOUCH is not set
1398# CONFIG_USB_STORAGE_KARMA is not set
1399# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1400# CONFIG_USB_LIBUSUAL is not set
1401
1402#
1403# USB Imaging devices
1404#
1405# CONFIG_USB_MDC800 is not set
1406# CONFIG_USB_MICROTEK is not set
1407
1408#
1409# USB port drivers
1410#
1411CONFIG_USB_SERIAL=m
1412# CONFIG_USB_EZUSB is not set
1413CONFIG_USB_SERIAL_GENERIC=y
1414# CONFIG_USB_SERIAL_AIRCABLE is not set
1415# CONFIG_USB_SERIAL_ARK3116 is not set
1416# CONFIG_USB_SERIAL_BELKIN is not set
1417# CONFIG_USB_SERIAL_CH341 is not set
1418# CONFIG_USB_SERIAL_WHITEHEAT is not set
1419# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1420# CONFIG_USB_SERIAL_CP210X is not set
1421# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1422# CONFIG_USB_SERIAL_EMPEG is not set
1423# CONFIG_USB_SERIAL_FTDI_SIO is not set
1424# CONFIG_USB_SERIAL_FUNSOFT is not set
1425# CONFIG_USB_SERIAL_VISOR is not set
1426# CONFIG_USB_SERIAL_IPAQ is not set
1427# CONFIG_USB_SERIAL_IR is not set
1428# CONFIG_USB_SERIAL_EDGEPORT is not set
1429# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1430# CONFIG_USB_SERIAL_GARMIN is not set
1431# CONFIG_USB_SERIAL_IPW is not set
1432# CONFIG_USB_SERIAL_IUU is not set
1433# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1434# CONFIG_USB_SERIAL_KEYSPAN is not set
1435# CONFIG_USB_SERIAL_KLSI is not set
1436# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1437CONFIG_USB_SERIAL_MCT_U232=m
1438# CONFIG_USB_SERIAL_MOS7720 is not set
1439# CONFIG_USB_SERIAL_MOS7840 is not set
1440# CONFIG_USB_SERIAL_MOTOROLA is not set
1441# CONFIG_USB_SERIAL_NAVMAN is not set
1442# CONFIG_USB_SERIAL_PL2303 is not set
1443# CONFIG_USB_SERIAL_OTI6858 is not set
1444# CONFIG_USB_SERIAL_QUALCOMM is not set
1445# CONFIG_USB_SERIAL_SPCP8X5 is not set
1446# CONFIG_USB_SERIAL_HP4X is not set
1447# CONFIG_USB_SERIAL_SAFE is not set
1448# CONFIG_USB_SERIAL_SIEMENS_MPI is not set
1449# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
1450# CONFIG_USB_SERIAL_SYMBOL is not set
1451# CONFIG_USB_SERIAL_TI is not set
1452# CONFIG_USB_SERIAL_CYBERJACK is not set
1453# CONFIG_USB_SERIAL_XIRCOM is not set
1454# CONFIG_USB_SERIAL_OPTION is not set
1455# CONFIG_USB_SERIAL_OMNINET is not set
1456# CONFIG_USB_SERIAL_OPTICON is not set
1457# CONFIG_USB_SERIAL_DEBUG is not set
1458
1459#
1460# USB Miscellaneous drivers
1461#
1462# CONFIG_USB_EMI62 is not set
1463# CONFIG_USB_EMI26 is not set
1464# CONFIG_USB_ADUTUX is not set
1465# CONFIG_USB_SEVSEG is not set
1466# CONFIG_USB_RIO500 is not set
1467# CONFIG_USB_LEGOTOWER is not set
1468# CONFIG_USB_LCD is not set
1469# CONFIG_USB_BERRY_CHARGE is not set
1470# CONFIG_USB_LED is not set
1471# CONFIG_USB_CYPRESS_CY7C63 is not set
1472# CONFIG_USB_CYTHERM is not set
1473# CONFIG_USB_IDMOUSE is not set
1474# CONFIG_USB_FTDI_ELAN is not set
1475# CONFIG_USB_APPLEDISPLAY is not set
1476# CONFIG_USB_LD is not set
1477# CONFIG_USB_TRANCEVIBRATOR is not set
1478# CONFIG_USB_IOWARRIOR is not set
1479# CONFIG_USB_TEST is not set
1480# CONFIG_USB_ISIGHTFW is not set
1481# CONFIG_USB_VST is not set
1482CONFIG_USB_GADGET=m
1483# CONFIG_USB_GADGET_DEBUG is not set
1484# CONFIG_USB_GADGET_DEBUG_FILES is not set
1485CONFIG_USB_GADGET_VBUS_DRAW=2
1486CONFIG_USB_GADGET_SELECTED=y
1487# CONFIG_USB_GADGET_AT91 is not set
1488# CONFIG_USB_GADGET_ATMEL_USBA is not set
1489# CONFIG_USB_GADGET_FSL_USB2 is not set
1490# CONFIG_USB_GADGET_LH7A40X is not set
1491# CONFIG_USB_GADGET_OMAP is not set
1492# CONFIG_USB_GADGET_PXA25X is not set
1493# CONFIG_USB_GADGET_R8A66597 is not set
1494CONFIG_USB_GADGET_PXA27X=y
1495CONFIG_USB_PXA27X=m
1496# CONFIG_USB_GADGET_S3C_HSOTG is not set
1497# CONFIG_USB_GADGET_IMX is not set
1498# CONFIG_USB_GADGET_S3C2410 is not set
1499# CONFIG_USB_GADGET_M66592 is not set
1500# CONFIG_USB_GADGET_AMD5536UDC is not set
1501# CONFIG_USB_GADGET_FSL_QE is not set
1502# CONFIG_USB_GADGET_CI13XXX is not set
1503# CONFIG_USB_GADGET_NET2280 is not set
1504# CONFIG_USB_GADGET_GOKU is not set
1505# CONFIG_USB_GADGET_LANGWELL is not set
1506# CONFIG_USB_GADGET_DUMMY_HCD is not set
1507# CONFIG_USB_GADGET_DUALSPEED is not set
1508# CONFIG_USB_ZERO is not set
1509# CONFIG_USB_AUDIO is not set
1510CONFIG_USB_ETH=m
1511CONFIG_USB_ETH_RNDIS=y
1512# CONFIG_USB_ETH_EEM is not set
1513CONFIG_USB_GADGETFS=m
1514CONFIG_USB_FILE_STORAGE=m
1515# CONFIG_USB_FILE_STORAGE_TEST is not set
1516CONFIG_USB_G_SERIAL=m
1517# CONFIG_USB_MIDI_GADGET is not set
1518CONFIG_USB_G_PRINTER=m
1519# CONFIG_USB_CDC_COMPOSITE is not set
1520
1521#
1522# OTG and related infrastructure
1523#
1524CONFIG_USB_OTG_UTILS=y
1525# CONFIG_USB_GPIO_VBUS is not set
1526# CONFIG_NOP_USB_XCEIV is not set
1527CONFIG_MMC=y
1528# CONFIG_MMC_DEBUG is not set
1529# CONFIG_MMC_UNSAFE_RESUME is not set
1530
1531#
1532# MMC/SD/SDIO Card Drivers
1533#
1534CONFIG_MMC_BLOCK=y
1535# CONFIG_MMC_BLOCK_BOUNCE is not set
1536# CONFIG_SDIO_UART is not set
1537# CONFIG_MMC_TEST is not set
1538
1539#
1540# MMC/SD/SDIO Host Controller Drivers
1541#
1542CONFIG_MMC_PXA=y
1543# CONFIG_MMC_SDHCI is not set
1544# CONFIG_MMC_AT91 is not set
1545# CONFIG_MMC_ATMELMCI is not set
1546# CONFIG_MMC_SPI is not set
1547# CONFIG_MEMSTICK is not set
1548CONFIG_NEW_LEDS=y
1549CONFIG_LEDS_CLASS=m
1550
1551#
1552# LED drivers
1553#
1554# CONFIG_LEDS_PCA9532 is not set
1555CONFIG_LEDS_GPIO=m
1556CONFIG_LEDS_GPIO_PLATFORM=y
1557# CONFIG_LEDS_LP3944 is not set
1558# CONFIG_LEDS_PCA955X is not set
1559# CONFIG_LEDS_DAC124S085 is not set
1560# CONFIG_LEDS_BD2802 is not set
1561
1562#
1563# LED Triggers
1564#
1565CONFIG_LEDS_TRIGGERS=y
1566CONFIG_LEDS_TRIGGER_TIMER=m
1567CONFIG_LEDS_TRIGGER_HEARTBEAT=m
1568CONFIG_LEDS_TRIGGER_BACKLIGHT=m
1569CONFIG_LEDS_TRIGGER_GPIO=m
1570CONFIG_LEDS_TRIGGER_DEFAULT_ON=m
1571
1572#
1573# iptables trigger is under Netfilter config (LED target)
1574#
1575# CONFIG_ACCESSIBILITY is not set
1576CONFIG_RTC_LIB=y
1577CONFIG_RTC_CLASS=m
1578
1579#
1580# RTC interfaces
1581#
1582CONFIG_RTC_INTF_SYSFS=y
1583CONFIG_RTC_INTF_PROC=y
1584CONFIG_RTC_INTF_DEV=y
1585# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1586# CONFIG_RTC_DRV_TEST is not set
1587
1588#
1589# I2C RTC drivers
1590#
1591# CONFIG_RTC_DRV_DS1307 is not set
1592# CONFIG_RTC_DRV_DS1374 is not set
1593# CONFIG_RTC_DRV_DS1672 is not set
1594# CONFIG_RTC_DRV_MAX6900 is not set
1595# CONFIG_RTC_DRV_RS5C372 is not set
1596CONFIG_RTC_DRV_ISL1208=m
1597# CONFIG_RTC_DRV_X1205 is not set
1598# CONFIG_RTC_DRV_PCF8563 is not set
1599# CONFIG_RTC_DRV_PCF8583 is not set
1600# CONFIG_RTC_DRV_M41T80 is not set
1601# CONFIG_RTC_DRV_S35390A is not set
1602# CONFIG_RTC_DRV_FM3130 is not set
1603# CONFIG_RTC_DRV_RX8581 is not set
1604# CONFIG_RTC_DRV_RX8025 is not set
1605
1606#
1607# SPI RTC drivers
1608#
1609# CONFIG_RTC_DRV_M41T94 is not set
1610# CONFIG_RTC_DRV_DS1305 is not set
1611# CONFIG_RTC_DRV_DS1390 is not set
1612# CONFIG_RTC_DRV_MAX6902 is not set
1613# CONFIG_RTC_DRV_R9701 is not set
1614# CONFIG_RTC_DRV_RS5C348 is not set
1615# CONFIG_RTC_DRV_DS3234 is not set
1616# CONFIG_RTC_DRV_PCF2123 is not set
1617
1618#
1619# Platform RTC drivers
1620#
1621# CONFIG_RTC_DRV_CMOS is not set
1622# CONFIG_RTC_DRV_DS1286 is not set
1623# CONFIG_RTC_DRV_DS1511 is not set
1624# CONFIG_RTC_DRV_DS1553 is not set
1625# CONFIG_RTC_DRV_DS1742 is not set
1626# CONFIG_RTC_DRV_STK17TA8 is not set
1627# CONFIG_RTC_DRV_M48T86 is not set
1628# CONFIG_RTC_DRV_M48T35 is not set
1629# CONFIG_RTC_DRV_M48T59 is not set
1630# CONFIG_RTC_DRV_MSM6242 is not set
1631# CONFIG_RTC_DRV_BQ4802 is not set
1632# CONFIG_RTC_DRV_RP5C01 is not set
1633# CONFIG_RTC_DRV_V3020 is not set
1634
1635#
1636# on-CPU RTC drivers
1637#
1638# CONFIG_RTC_DRV_SA1100 is not set
1639CONFIG_RTC_DRV_PXA=m
1640# CONFIG_DMADEVICES is not set
1641# CONFIG_AUXDISPLAY is not set
1642# CONFIG_UIO is not set
1643
1644#
1645# TI VLYNQ
1646#
1647# CONFIG_STAGING is not set
1648
1649#
1650# File systems
1651#
1652CONFIG_EXT2_FS=y
1653# CONFIG_EXT2_FS_XATTR is not set
1654# CONFIG_EXT2_FS_XIP is not set
1655CONFIG_EXT3_FS=y
1656# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1657# CONFIG_EXT3_FS_XATTR is not set
1658# CONFIG_EXT4_FS is not set
1659CONFIG_JBD=y
1660# CONFIG_REISERFS_FS is not set
1661# CONFIG_JFS_FS is not set
1662# CONFIG_FS_POSIX_ACL is not set
1663# CONFIG_XFS_FS is not set
1664# CONFIG_GFS2_FS is not set
1665# CONFIG_OCFS2_FS is not set
1666# CONFIG_BTRFS_FS is not set
1667# CONFIG_NILFS2_FS is not set
1668CONFIG_FILE_LOCKING=y
1669CONFIG_FSNOTIFY=y
1670# CONFIG_DNOTIFY is not set
1671CONFIG_INOTIFY=y
1672CONFIG_INOTIFY_USER=y
1673# CONFIG_QUOTA is not set
1674# CONFIG_AUTOFS_FS is not set
1675# CONFIG_AUTOFS4_FS is not set
1676# CONFIG_FUSE_FS is not set
1677
1678#
1679# Caches
1680#
1681# CONFIG_FSCACHE is not set
1682
1683#
1684# CD-ROM/DVD Filesystems
1685#
1686# CONFIG_ISO9660_FS is not set
1687# CONFIG_UDF_FS is not set
1688
1689#
1690# DOS/FAT/NT Filesystems
1691#
1692CONFIG_FAT_FS=m
1693# CONFIG_MSDOS_FS is not set
1694CONFIG_VFAT_FS=m
1695CONFIG_FAT_DEFAULT_CODEPAGE=437
1696CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1697# CONFIG_NTFS_FS is not set
1698
1699#
1700# Pseudo filesystems
1701#
1702CONFIG_PROC_FS=y
1703CONFIG_PROC_SYSCTL=y
1704CONFIG_PROC_PAGE_MONITOR=y
1705CONFIG_SYSFS=y
1706CONFIG_TMPFS=y
1707# CONFIG_TMPFS_POSIX_ACL is not set
1708# CONFIG_HUGETLB_PAGE is not set
1709# CONFIG_CONFIGFS_FS is not set
1710CONFIG_MISC_FILESYSTEMS=y
1711# CONFIG_ADFS_FS is not set
1712# CONFIG_AFFS_FS is not set
1713# CONFIG_HFS_FS is not set
1714# CONFIG_HFSPLUS_FS is not set
1715# CONFIG_BEFS_FS is not set
1716# CONFIG_BFS_FS is not set
1717# CONFIG_EFS_FS is not set
1718CONFIG_JFFS2_FS=y
1719CONFIG_JFFS2_FS_DEBUG=0
1720CONFIG_JFFS2_FS_WRITEBUFFER=y
1721# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1722# CONFIG_JFFS2_SUMMARY is not set
1723# CONFIG_JFFS2_FS_XATTR is not set
1724# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1725CONFIG_JFFS2_ZLIB=y
1726# CONFIG_JFFS2_LZO is not set
1727CONFIG_JFFS2_RTIME=y
1728# CONFIG_JFFS2_RUBIN is not set
1729# CONFIG_CRAMFS is not set
1730# CONFIG_SQUASHFS is not set
1731# CONFIG_VXFS_FS is not set
1732# CONFIG_MINIX_FS is not set
1733# CONFIG_OMFS_FS is not set
1734# CONFIG_HPFS_FS is not set
1735# CONFIG_QNX4FS_FS is not set
1736# CONFIG_ROMFS_FS is not set
1737# CONFIG_SYSV_FS is not set
1738# CONFIG_UFS_FS is not set
1739CONFIG_NETWORK_FILESYSTEMS=y
1740CONFIG_NFS_FS=y
1741CONFIG_NFS_V3=y
1742# CONFIG_NFS_V3_ACL is not set
1743# CONFIG_NFS_V4 is not set
1744CONFIG_ROOT_NFS=y
1745CONFIG_NFSD=m
1746CONFIG_NFSD_V3=y
1747# CONFIG_NFSD_V3_ACL is not set
1748# CONFIG_NFSD_V4 is not set
1749CONFIG_LOCKD=y
1750CONFIG_LOCKD_V4=y
1751CONFIG_EXPORTFS=m
1752CONFIG_NFS_COMMON=y
1753CONFIG_SUNRPC=y
1754# CONFIG_RPCSEC_GSS_KRB5 is not set
1755# CONFIG_RPCSEC_GSS_SPKM3 is not set
1756# CONFIG_SMB_FS is not set
1757# CONFIG_CIFS is not set
1758# CONFIG_NCP_FS is not set
1759# CONFIG_CODA_FS is not set
1760# CONFIG_AFS_FS is not set
1761
1762#
1763# Partition Types
1764#
1765CONFIG_PARTITION_ADVANCED=y
1766# CONFIG_ACORN_PARTITION is not set
1767# CONFIG_OSF_PARTITION is not set
1768# CONFIG_AMIGA_PARTITION is not set
1769# CONFIG_ATARI_PARTITION is not set
1770# CONFIG_MAC_PARTITION is not set
1771CONFIG_MSDOS_PARTITION=y
1772# CONFIG_BSD_DISKLABEL is not set
1773# CONFIG_MINIX_SUBPARTITION is not set
1774# CONFIG_SOLARIS_X86_PARTITION is not set
1775# CONFIG_UNIXWARE_DISKLABEL is not set
1776# CONFIG_LDM_PARTITION is not set
1777# CONFIG_SGI_PARTITION is not set
1778# CONFIG_ULTRIX_PARTITION is not set
1779# CONFIG_SUN_PARTITION is not set
1780# CONFIG_KARMA_PARTITION is not set
1781# CONFIG_EFI_PARTITION is not set
1782# CONFIG_SYSV68_PARTITION is not set
1783CONFIG_NLS=m
1784CONFIG_NLS_DEFAULT="iso8859-1"
1785CONFIG_NLS_CODEPAGE_437=m
1786# CONFIG_NLS_CODEPAGE_737 is not set
1787# CONFIG_NLS_CODEPAGE_775 is not set
1788CONFIG_NLS_CODEPAGE_850=m
1789# CONFIG_NLS_CODEPAGE_852 is not set
1790# CONFIG_NLS_CODEPAGE_855 is not set
1791# CONFIG_NLS_CODEPAGE_857 is not set
1792# CONFIG_NLS_CODEPAGE_860 is not set
1793# CONFIG_NLS_CODEPAGE_861 is not set
1794# CONFIG_NLS_CODEPAGE_862 is not set
1795# CONFIG_NLS_CODEPAGE_863 is not set
1796# CONFIG_NLS_CODEPAGE_864 is not set
1797# CONFIG_NLS_CODEPAGE_865 is not set
1798# CONFIG_NLS_CODEPAGE_866 is not set
1799# CONFIG_NLS_CODEPAGE_869 is not set
1800# CONFIG_NLS_CODEPAGE_936 is not set
1801# CONFIG_NLS_CODEPAGE_950 is not set
1802# CONFIG_NLS_CODEPAGE_932 is not set
1803# CONFIG_NLS_CODEPAGE_949 is not set
1804# CONFIG_NLS_CODEPAGE_874 is not set
1805# CONFIG_NLS_ISO8859_8 is not set
1806# CONFIG_NLS_CODEPAGE_1250 is not set
1807# CONFIG_NLS_CODEPAGE_1251 is not set
1808# CONFIG_NLS_ASCII is not set
1809CONFIG_NLS_ISO8859_1=m
1810# CONFIG_NLS_ISO8859_2 is not set
1811# CONFIG_NLS_ISO8859_3 is not set
1812# CONFIG_NLS_ISO8859_4 is not set
1813# CONFIG_NLS_ISO8859_5 is not set
1814# CONFIG_NLS_ISO8859_6 is not set
1815# CONFIG_NLS_ISO8859_7 is not set
1816# CONFIG_NLS_ISO8859_9 is not set
1817# CONFIG_NLS_ISO8859_13 is not set
1818# CONFIG_NLS_ISO8859_14 is not set
1819CONFIG_NLS_ISO8859_15=m
1820# CONFIG_NLS_KOI8_R is not set
1821# CONFIG_NLS_KOI8_U is not set
1822CONFIG_NLS_UTF8=m
1823# CONFIG_DLM is not set
1824
1825#
1826# Kernel hacking
1827#
1828# CONFIG_PRINTK_TIME is not set
1829CONFIG_ENABLE_WARN_DEPRECATED=y
1830CONFIG_ENABLE_MUST_CHECK=y
1831CONFIG_FRAME_WARN=1024
1832CONFIG_MAGIC_SYSRQ=y
1833# CONFIG_STRIP_ASM_SYMS is not set
1834# CONFIG_UNUSED_SYMBOLS is not set
1835# CONFIG_DEBUG_FS is not set
1836# CONFIG_HEADERS_CHECK is not set
1837CONFIG_DEBUG_KERNEL=y
1838# CONFIG_DEBUG_SHIRQ is not set
1839CONFIG_DETECT_SOFTLOCKUP=y
1840# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1841CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1842CONFIG_DETECT_HUNG_TASK=y
1843# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
1844CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
1845CONFIG_SCHED_DEBUG=y
1846# CONFIG_SCHEDSTATS is not set
1847# CONFIG_TIMER_STATS is not set
1848# CONFIG_DEBUG_OBJECTS is not set
1849# CONFIG_SLUB_DEBUG_ON is not set
1850# CONFIG_SLUB_STATS is not set
1851# CONFIG_DEBUG_KMEMLEAK is not set
1852# CONFIG_DEBUG_RT_MUTEXES is not set
1853# CONFIG_RT_MUTEX_TESTER is not set
1854# CONFIG_DEBUG_SPINLOCK is not set
1855CONFIG_DEBUG_MUTEXES=y
1856# CONFIG_DEBUG_LOCK_ALLOC is not set
1857# CONFIG_PROVE_LOCKING is not set
1858# CONFIG_LOCK_STAT is not set
1859# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1860# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1861# CONFIG_DEBUG_KOBJECT is not set
1862CONFIG_DEBUG_BUGVERBOSE=y
1863# CONFIG_DEBUG_INFO is not set
1864# CONFIG_DEBUG_VM is not set
1865# CONFIG_DEBUG_WRITECOUNT is not set
1866CONFIG_DEBUG_MEMORY_INIT=y
1867# CONFIG_DEBUG_LIST is not set
1868# CONFIG_DEBUG_SG is not set
1869# CONFIG_DEBUG_NOTIFIERS is not set
1870# CONFIG_DEBUG_CREDENTIALS is not set
1871# CONFIG_BOOT_PRINTK_DELAY is not set
1872# CONFIG_RCU_TORTURE_TEST is not set
1873# CONFIG_BACKTRACE_SELF_TEST is not set
1874# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1875# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1876# CONFIG_FAULT_INJECTION is not set
1877# CONFIG_LATENCYTOP is not set
1878CONFIG_SYSCTL_SYSCALL_CHECK=y
1879# CONFIG_PAGE_POISONING is not set
1880CONFIG_HAVE_FUNCTION_TRACER=y
1881CONFIG_TRACING_SUPPORT=y
1882CONFIG_FTRACE=y
1883# CONFIG_FUNCTION_TRACER is not set
1884# CONFIG_IRQSOFF_TRACER is not set
1885# CONFIG_SCHED_TRACER is not set
1886# CONFIG_ENABLE_DEFAULT_TRACERS is not set
1887# CONFIG_BOOT_TRACER is not set
1888CONFIG_BRANCH_PROFILE_NONE=y
1889# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1890# CONFIG_PROFILE_ALL_BRANCHES is not set
1891# CONFIG_STACK_TRACER is not set
1892# CONFIG_KMEMTRACE is not set
1893# CONFIG_WORKQUEUE_TRACER is not set
1894# CONFIG_BLK_DEV_IO_TRACE is not set
1895# CONFIG_SAMPLES is not set
1896CONFIG_HAVE_ARCH_KGDB=y
1897# CONFIG_KGDB is not set
1898CONFIG_ARM_UNWIND=y
1899# CONFIG_DEBUG_USER is not set
1900CONFIG_DEBUG_ERRORS=y
1901# CONFIG_DEBUG_STACK_USAGE is not set
1902# CONFIG_DEBUG_LL is not set
1903# CONFIG_OC_ETM is not set
1904
1905#
1906# Security options
1907#
1908# CONFIG_KEYS is not set
1909# CONFIG_SECURITY is not set
1910# CONFIG_SECURITYFS is not set
1911# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1912# CONFIG_DEFAULT_SECURITY_SMACK is not set
1913# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1914CONFIG_DEFAULT_SECURITY_DAC=y
1915CONFIG_DEFAULT_SECURITY=""
1916CONFIG_CRYPTO=y
1917
1918#
1919# Crypto core or helper
1920#
1921CONFIG_CRYPTO_ALGAPI=m
1922CONFIG_CRYPTO_ALGAPI2=m
1923CONFIG_CRYPTO_AEAD2=m
1924CONFIG_CRYPTO_BLKCIPHER=m
1925CONFIG_CRYPTO_BLKCIPHER2=m
1926CONFIG_CRYPTO_HASH=m
1927CONFIG_CRYPTO_HASH2=m
1928CONFIG_CRYPTO_RNG2=m
1929CONFIG_CRYPTO_PCOMP=m
1930CONFIG_CRYPTO_MANAGER=m
1931CONFIG_CRYPTO_MANAGER2=m
1932# CONFIG_CRYPTO_GF128MUL is not set
1933# CONFIG_CRYPTO_NULL is not set
1934CONFIG_CRYPTO_WORKQUEUE=m
1935# CONFIG_CRYPTO_CRYPTD is not set
1936# CONFIG_CRYPTO_AUTHENC is not set
1937# CONFIG_CRYPTO_TEST is not set
1938
1939#
1940# Authenticated Encryption with Associated Data
1941#
1942# CONFIG_CRYPTO_CCM is not set
1943# CONFIG_CRYPTO_GCM is not set
1944# CONFIG_CRYPTO_SEQIV is not set
1945
1946#
1947# Block modes
1948#
1949# CONFIG_CRYPTO_CBC is not set
1950# CONFIG_CRYPTO_CTR is not set
1951# CONFIG_CRYPTO_CTS is not set
1952CONFIG_CRYPTO_ECB=m
1953# CONFIG_CRYPTO_LRW is not set
1954# CONFIG_CRYPTO_PCBC is not set
1955# CONFIG_CRYPTO_XTS is not set
1956
1957#
1958# Hash modes
1959#
1960# CONFIG_CRYPTO_HMAC is not set
1961# CONFIG_CRYPTO_XCBC is not set
1962# CONFIG_CRYPTO_VMAC is not set
1963
1964#
1965# Digest
1966#
1967# CONFIG_CRYPTO_CRC32C is not set
1968# CONFIG_CRYPTO_GHASH is not set
1969# CONFIG_CRYPTO_MD4 is not set
1970# CONFIG_CRYPTO_MD5 is not set
1971CONFIG_CRYPTO_MICHAEL_MIC=m
1972# CONFIG_CRYPTO_RMD128 is not set
1973# CONFIG_CRYPTO_RMD160 is not set
1974# CONFIG_CRYPTO_RMD256 is not set
1975# CONFIG_CRYPTO_RMD320 is not set
1976# CONFIG_CRYPTO_SHA1 is not set
1977# CONFIG_CRYPTO_SHA256 is not set
1978# CONFIG_CRYPTO_SHA512 is not set
1979# CONFIG_CRYPTO_TGR192 is not set
1980# CONFIG_CRYPTO_WP512 is not set
1981
1982#
1983# Ciphers
1984#
1985CONFIG_CRYPTO_AES=m
1986# CONFIG_CRYPTO_ANUBIS is not set
1987CONFIG_CRYPTO_ARC4=m
1988# CONFIG_CRYPTO_BLOWFISH is not set
1989# CONFIG_CRYPTO_CAMELLIA is not set
1990# CONFIG_CRYPTO_CAST5 is not set
1991# CONFIG_CRYPTO_CAST6 is not set
1992# CONFIG_CRYPTO_DES is not set
1993# CONFIG_CRYPTO_FCRYPT is not set
1994# CONFIG_CRYPTO_KHAZAD is not set
1995# CONFIG_CRYPTO_SALSA20 is not set
1996# CONFIG_CRYPTO_SEED is not set
1997# CONFIG_CRYPTO_SERPENT is not set
1998# CONFIG_CRYPTO_TEA is not set
1999# CONFIG_CRYPTO_TWOFISH is not set
2000
2001#
2002# Compression
2003#
2004# CONFIG_CRYPTO_DEFLATE is not set
2005# CONFIG_CRYPTO_ZLIB is not set
2006# CONFIG_CRYPTO_LZO is not set
2007
2008#
2009# Random Number Generation
2010#
2011# CONFIG_CRYPTO_ANSI_CPRNG is not set
2012CONFIG_CRYPTO_HW=y
2013# CONFIG_BINARY_PRINTF is not set
2014
2015#
2016# Library routines
2017#
2018CONFIG_BITREVERSE=y
2019CONFIG_GENERIC_FIND_LAST_BIT=y
2020CONFIG_CRC_CCITT=m
2021CONFIG_CRC16=m
2022CONFIG_CRC_T10DIF=m
2023CONFIG_CRC_ITU_T=m
2024CONFIG_CRC32=y
2025# CONFIG_CRC7 is not set
2026# CONFIG_LIBCRC32C is not set
2027CONFIG_ZLIB_INFLATE=y
2028CONFIG_ZLIB_DEFLATE=y
2029CONFIG_HAS_IOMEM=y
2030CONFIG_HAS_IOPORT=y
2031CONFIG_HAS_DMA=y
2032CONFIG_NLATTR=y
diff --git a/arch/arm/include/asm/mman.h b/arch/arm/include/asm/mman.h
index 8eebf89f5ab1..41f99c573b93 100644
--- a/arch/arm/include/asm/mman.h
+++ b/arch/arm/include/asm/mman.h
@@ -1 +1,4 @@
1#include <asm-generic/mman.h> 1#include <asm-generic/mman.h>
2
3#define arch_mmap_check(addr, len, flags) \
4 (((flags) & MAP_FIXED && (addr) < FIRST_USER_ADDRESS) ? -EINVAL : 0)
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index e7ccf7e697ce..dd00f747e2ad 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -54,5 +54,6 @@ endif
54 54
55head-y := head$(MMUEXT).o 55head-y := head$(MMUEXT).o
56obj-$(CONFIG_DEBUG_LL) += debug.o 56obj-$(CONFIG_DEBUG_LL) += debug.o
57obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
57 58
58extra-y := $(head-y) init_task.o vmlinux.lds 59extra-y := $(head-y) init_task.o vmlinux.lds
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index f58c1156e779..9314a2d681f1 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -172,7 +172,7 @@
172/* 160 */ CALL(sys_sched_get_priority_min) 172/* 160 */ CALL(sys_sched_get_priority_min)
173 CALL(sys_sched_rr_get_interval) 173 CALL(sys_sched_rr_get_interval)
174 CALL(sys_nanosleep) 174 CALL(sys_nanosleep)
175 CALL(sys_arm_mremap) 175 CALL(sys_mremap)
176 CALL(sys_setresuid16) 176 CALL(sys_setresuid16)
177/* 165 */ CALL(sys_getresuid16) 177/* 165 */ CALL(sys_getresuid16)
178 CALL(sys_ni_syscall) /* vm86 */ 178 CALL(sys_ni_syscall) /* vm86 */
diff --git a/arch/arm/kernel/early_printk.c b/arch/arm/kernel/early_printk.c
new file mode 100644
index 000000000000..85aa2b292692
--- /dev/null
+++ b/arch/arm/kernel/early_printk.c
@@ -0,0 +1,57 @@
1/*
2 * linux/arch/arm/kernel/early_printk.c
3 *
4 * Copyright (C) 2009 Sascha Hauer <s.hauer@pengutronix.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/kernel.h>
12#include <linux/console.h>
13#include <linux/init.h>
14
15extern void printch(int);
16
17static void early_write(const char *s, unsigned n)
18{
19 while (n-- > 0) {
20 if (*s == '\n')
21 printch('\r');
22 printch(*s);
23 s++;
24 }
25}
26
27static void early_console_write(struct console *con, const char *s, unsigned n)
28{
29 early_write(s, n);
30}
31
32static struct console early_console = {
33 .name = "earlycon",
34 .write = early_console_write,
35 .flags = CON_PRINTBUFFER | CON_BOOT,
36 .index = -1,
37};
38
39asmlinkage void early_printk(const char *fmt, ...)
40{
41 char buf[512];
42 int n;
43 va_list ap;
44
45 va_start(ap, fmt);
46 n = vscnprintf(buf, sizeof(buf), fmt, ap);
47 early_write(buf, n);
48 va_end(ap);
49}
50
51static int __init setup_early_printk(char *buf)
52{
53 register_console(&early_console);
54 return 0;
55}
56
57early_param("earlyprintk", setup_early_printk);
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index f0fe95b7085d..2c1db77d7848 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -416,12 +416,12 @@ sys_mmap2:
416 tst r5, #PGOFF_MASK 416 tst r5, #PGOFF_MASK
417 moveq r5, r5, lsr #PAGE_SHIFT - 12 417 moveq r5, r5, lsr #PAGE_SHIFT - 12
418 streq r5, [sp, #4] 418 streq r5, [sp, #4]
419 beq do_mmap2 419 beq sys_mmap_pgoff
420 mov r0, #-EINVAL 420 mov r0, #-EINVAL
421 mov pc, lr 421 mov pc, lr
422#else 422#else
423 str r5, [sp, #4] 423 str r5, [sp, #4]
424 b do_mmap2 424 b sys_mmap_pgoff
425#endif 425#endif
426ENDPROC(sys_mmap2) 426ENDPROC(sys_mmap2)
427 427
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index a73a34dccf2a..ea02a7b1c244 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -160,6 +160,7 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
160 160
161 /* Make sure our local interrupt controller has this enabled */ 161 /* Make sure our local interrupt controller has this enabled */
162 local_irq_save(flags); 162 local_irq_save(flags);
163 irq_to_desc(clk->irq)->status |= IRQ_NOPROBE;
163 get_irq_chip(clk->irq)->unmask(clk->irq); 164 get_irq_chip(clk->irq)->unmask(clk->irq);
164 local_irq_restore(flags); 165 local_irq_restore(flags);
165 166
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index 78ecaac65206..ae4027bd01bd 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -28,41 +28,6 @@
28#include <linux/ipc.h> 28#include <linux/ipc.h>
29#include <linux/uaccess.h> 29#include <linux/uaccess.h>
30 30
31extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
32 unsigned long new_len, unsigned long flags,
33 unsigned long new_addr);
34
35/* common code for old and new mmaps */
36inline long do_mmap2(
37 unsigned long addr, unsigned long len,
38 unsigned long prot, unsigned long flags,
39 unsigned long fd, unsigned long pgoff)
40{
41 int error = -EINVAL;
42 struct file * file = NULL;
43
44 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
45
46 if (flags & MAP_FIXED && addr < FIRST_USER_ADDRESS)
47 goto out;
48
49 error = -EBADF;
50 if (!(flags & MAP_ANONYMOUS)) {
51 file = fget(fd);
52 if (!file)
53 goto out;
54 }
55
56 down_write(&current->mm->mmap_sem);
57 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
58 up_write(&current->mm->mmap_sem);
59
60 if (file)
61 fput(file);
62out:
63 return error;
64}
65
66struct mmap_arg_struct { 31struct mmap_arg_struct {
67 unsigned long addr; 32 unsigned long addr;
68 unsigned long len; 33 unsigned long len;
@@ -84,29 +49,11 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
84 if (a.offset & ~PAGE_MASK) 49 if (a.offset & ~PAGE_MASK)
85 goto out; 50 goto out;
86 51
87 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); 52 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
88out: 53out:
89 return error; 54 return error;
90} 55}
91 56
92asmlinkage unsigned long
93sys_arm_mremap(unsigned long addr, unsigned long old_len,
94 unsigned long new_len, unsigned long flags,
95 unsigned long new_addr)
96{
97 unsigned long ret = -EINVAL;
98
99 if (flags & MREMAP_FIXED && new_addr < FIRST_USER_ADDRESS)
100 goto out;
101
102 down_write(&current->mm->mmap_sem);
103 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
104 up_write(&current->mm->mmap_sem);
105
106out:
107 return ret;
108}
109
110/* 57/*
111 * Perform the select(nd, in, out, ex, tv) and mmap() system 58 * Perform the select(nd, in, out, ex, tv) and mmap() system
112 * calls. 59 * calls.
diff --git a/arch/arm/mach-clps711x/include/mach/memory.h b/arch/arm/mach-clps711x/include/mach/memory.h
index e522b20bcbc2..f70d52be48a2 100644
--- a/arch/arm/mach-clps711x/include/mach/memory.h
+++ b/arch/arm/mach-clps711x/include/mach/memory.h
@@ -30,6 +30,8 @@
30 30
31#define __virt_to_bus(x) ((x) - PAGE_OFFSET) 31#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
32#define __bus_to_virt(x) ((x) + PAGE_OFFSET) 32#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
33#define __pfn_to_bus(x) (__pfn_to_phys(x) - PHYS_OFFSET)
34#define __bus_to_pfn(x) __phys_to_pfn((x) + PHYS_OFFSET)
33 35
34#endif 36#endif
35 37
diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c
index b97f529e58e8..41febc796b1c 100644
--- a/arch/arm/mach-footbridge/common.c
+++ b/arch/arm/mach-footbridge/common.c
@@ -201,6 +201,11 @@ void __init footbridge_map_io(void)
201 201
202#ifdef CONFIG_FOOTBRIDGE_ADDIN 202#ifdef CONFIG_FOOTBRIDGE_ADDIN
203 203
204static inline unsigned long fb_bus_sdram_offset(void)
205{
206 return *CSR_PCISDRAMBASE & 0xfffffff0;
207}
208
204/* 209/*
205 * These two functions convert virtual addresses to PCI addresses and PCI 210 * These two functions convert virtual addresses to PCI addresses and PCI
206 * addresses to virtual addresses. Note that it is only legal to use these 211 * addresses to virtual addresses. Note that it is only legal to use these
@@ -210,14 +215,13 @@ unsigned long __virt_to_bus(unsigned long res)
210{ 215{
211 WARN_ON(res < PAGE_OFFSET || res >= (unsigned long)high_memory); 216 WARN_ON(res < PAGE_OFFSET || res >= (unsigned long)high_memory);
212 217
213 return (res - PAGE_OFFSET) + (*CSR_PCISDRAMBASE & 0xfffffff0); 218 return res + (fb_bus_sdram_offset() - PAGE_OFFSET);
214} 219}
215EXPORT_SYMBOL(__virt_to_bus); 220EXPORT_SYMBOL(__virt_to_bus);
216 221
217unsigned long __bus_to_virt(unsigned long res) 222unsigned long __bus_to_virt(unsigned long res)
218{ 223{
219 res -= (*CSR_PCISDRAMBASE & 0xfffffff0); 224 res = res - (fb_bus_sdram_offset() - PAGE_OFFSET);
220 res += PAGE_OFFSET;
221 225
222 WARN_ON(res < PAGE_OFFSET || res >= (unsigned long)high_memory); 226 WARN_ON(res < PAGE_OFFSET || res >= (unsigned long)high_memory);
223 227
@@ -225,4 +229,16 @@ unsigned long __bus_to_virt(unsigned long res)
225} 229}
226EXPORT_SYMBOL(__bus_to_virt); 230EXPORT_SYMBOL(__bus_to_virt);
227 231
232unsigned long __pfn_to_bus(unsigned long pfn)
233{
234 return __pfn_to_phys(pfn) + (fb_bus_sdram_offset() - PHYS_OFFSET));
235}
236EXPORT_SYMBOL(__pfn_to_bus);
237
238unsigned long __bus_to_pfn(unsigned long bus)
239{
240 return __phys_to_pfn(bus - (fb_bus_sdram_offset() - PHYS_OFFSET));
241}
242EXPORT_SYMBOL(__bus_to_pfn);
243
228#endif 244#endif
diff --git a/arch/arm/mach-footbridge/include/mach/memory.h b/arch/arm/mach-footbridge/include/mach/memory.h
index cb16e59d87b6..8d64f4574087 100644
--- a/arch/arm/mach-footbridge/include/mach/memory.h
+++ b/arch/arm/mach-footbridge/include/mach/memory.h
@@ -29,6 +29,8 @@
29#ifndef __ASSEMBLY__ 29#ifndef __ASSEMBLY__
30extern unsigned long __virt_to_bus(unsigned long); 30extern unsigned long __virt_to_bus(unsigned long);
31extern unsigned long __bus_to_virt(unsigned long); 31extern unsigned long __bus_to_virt(unsigned long);
32extern unsigned long __pfn_to_bus(unsigned long);
33extern unsigned long __bus_to_pfn(unsigned long);
32#endif 34#endif
33#define __virt_to_bus __virt_to_bus 35#define __virt_to_bus __virt_to_bus
34#define __bus_to_virt __bus_to_virt 36#define __bus_to_virt __bus_to_virt
@@ -36,14 +38,15 @@ extern unsigned long __bus_to_virt(unsigned long);
36#elif defined(CONFIG_FOOTBRIDGE_HOST) 38#elif defined(CONFIG_FOOTBRIDGE_HOST)
37 39
38/* 40/*
39 * The footbridge is programmed to expose the system RAM at the corresponding 41 * The footbridge is programmed to expose the system RAM at 0xe0000000.
40 * address. So, if PAGE_OFFSET is 0xc0000000, RAM appears at 0xe0000000. 42 * The requirement is that the RAM isn't placed at bus address 0, which
41 * If 0x80000000, then its exposed at 0xa0000000 on the bus. etc.
42 * The only requirement is that the RAM isn't placed at bus address 0 which
43 * would clash with VGA cards. 43 * would clash with VGA cards.
44 */ 44 */
45#define __virt_to_bus(x) ((x) - 0xe0000000) 45#define BUS_OFFSET 0xe0000000
46#define __bus_to_virt(x) ((x) + 0xe0000000) 46#define __virt_to_bus(x) ((x) + (BUS_OFFSET - PAGE_OFFSET))
47#define __bus_to_virt(x) ((x) - (BUS_OFFSET - PAGE_OFFSET))
48#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - PHYS_OFFSET))
49#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - PHYS_OFFSET))
47 50
48#else 51#else
49 52
diff --git a/arch/arm/mach-integrator/include/mach/memory.h b/arch/arm/mach-integrator/include/mach/memory.h
index 4891828454f5..991f24d2c115 100644
--- a/arch/arm/mach-integrator/include/mach/memory.h
+++ b/arch/arm/mach-integrator/include/mach/memory.h
@@ -28,6 +28,7 @@
28#define BUS_OFFSET UL(0x80000000) 28#define BUS_OFFSET UL(0x80000000)
29#define __virt_to_bus(x) ((x) - PAGE_OFFSET + BUS_OFFSET) 29#define __virt_to_bus(x) ((x) - PAGE_OFFSET + BUS_OFFSET)
30#define __bus_to_virt(x) ((x) - BUS_OFFSET + PAGE_OFFSET) 30#define __bus_to_virt(x) ((x) - BUS_OFFSET + PAGE_OFFSET)
31#define __pfn_to_bus(x) (((x) << PAGE_SHIFT) + BUS_OFFSET) 31#define __pfn_to_bus(x) (__pfn_to_phys(x) + (BUS_OFFSET - PHYS_OFFSET))
32#define __bus_to_pfn(x) __phys_to_pfn((x) - (BUS_OFFSET - PHYS_OFFSET))
32 33
33#endif 34#endif
diff --git a/arch/arm/mach-ixp2000/include/mach/memory.h b/arch/arm/mach-ixp2000/include/mach/memory.h
index aee7eb8a71b2..98e3471be15b 100644
--- a/arch/arm/mach-ixp2000/include/mach/memory.h
+++ b/arch/arm/mach-ixp2000/include/mach/memory.h
@@ -17,11 +17,15 @@
17 17
18#include <mach/ixp2000-regs.h> 18#include <mach/ixp2000-regs.h>
19 19
20#define __virt_to_bus(v) \ 20#define IXP2000_PCI_SDRAM_OFFSET (*IXP2000_PCI_SDRAM_BAR & 0xfffffff0)
21 (((__virt_to_phys(v) - 0x0) + (*IXP2000_PCI_SDRAM_BAR & 0xfffffff0)))
22 21
23#define __bus_to_virt(b) \ 22#define __phys_to_bus(x) ((x) + (IXP2000_PCI_SDRAM_OFFSET - PHYS_OFFSET))
24 __phys_to_virt((((b - (*IXP2000_PCI_SDRAM_BAR & 0xfffffff0)) + 0x0))) 23#define __bus_to_phys(x) ((x) - (IXP2000_PCI_SDRAM_OFFSET - PHYS_OFFSET))
24
25#define __virt_to_bus(v) __phys_to_bus(__virt_to_phys(v))
26#define __bus_to_virt(b) __phys_to_virt(__bus_to_phys(b))
27#define __pfn_to_bus(p) __phys_to_bus(__pfn_to_phys(p))
28#define __bus_to_pfn(b) __phys_to_pfn(__bus_to_phys(b))
25 29
26#endif 30#endif
27 31
diff --git a/arch/arm/mach-ixp23xx/include/mach/memory.h b/arch/arm/mach-ixp23xx/include/mach/memory.h
index fdd138706c70..94a3a86cfeb8 100644
--- a/arch/arm/mach-ixp23xx/include/mach/memory.h
+++ b/arch/arm/mach-ixp23xx/include/mach/memory.h
@@ -19,16 +19,15 @@
19 */ 19 */
20#define PHYS_OFFSET (0x00000000) 20#define PHYS_OFFSET (0x00000000)
21 21
22#define __virt_to_bus(v) \ 22#define IXP23XX_PCI_SDRAM_OFFSET (*((volatile int *)IXP23XX_PCI_SDRAM_BAR) & 0xfffffff0))
23 ({ unsigned int ret; \ 23
24 ret = ((__virt_to_phys(v) - 0x00000000) + \ 24#define __phys_to_bus(x) ((x) + (IXP23XX_PCI_SDRAM_OFFSET - PHYS_OFFSET))
25 (*((volatile int *)IXP23XX_PCI_SDRAM_BAR) & 0xfffffff0)); \ 25#define __bus_to_phys(x) ((x) - (IXP23XX_PCI_SDRAM_OFFSET - PHYS_OFFSET))
26 ret; }) 26
27 27#define __virt_to_bus(v) __phys_to_bus(__virt_to_phys(v))
28#define __bus_to_virt(b) \ 28#define __bus_to_virt(b) __phys_to_virt(__bus_to_phys(b))
29 ({ unsigned int data; \ 29#define __pfn_to_bus(p) __phys_to_bus(__pfn_to_phys(p))
30 data = *((volatile int *)IXP23XX_PCI_SDRAM_BAR); \ 30#define __bus_to_pfn(b) __phys_to_pfn(__bus_to_phys(b))
31 __phys_to_virt((((b - (data & 0xfffffff0)) + 0x00000000))); })
32 31
33#define arch_is_coherent() 1 32#define arch_is_coherent() 1
34 33
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index 264f4d59f898..9e5070da17ae 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -179,21 +179,21 @@ config IXP4XX_INDIRECT_PCI
179 help 179 help
180 IXP4xx provides two methods of accessing PCI memory space: 180 IXP4xx provides two methods of accessing PCI memory space:
181 181
182 1) A direct mapped window from 0x48000000 to 0x4bffffff (64MB). 182 1) A direct mapped window from 0x48000000 to 0x4BFFFFFF (64MB).
183 To access PCI via this space, we simply ioremap() the BAR 183 To access PCI via this space, we simply ioremap() the BAR
184 into the kernel and we can use the standard read[bwl]/write[bwl] 184 into the kernel and we can use the standard read[bwl]/write[bwl]
185 macros. This is the preferred method due to speed but it 185 macros. This is the preferred method due to speed but it
186 limits the system to just 64MB of PCI memory. This can be 186 limits the system to just 64MB of PCI memory. This can be
187 problematic if using video cards and other memory-heavy devices. 187 problematic if using video cards and other memory-heavy devices.
188 188
189 2) If > 64MB of memory space is required, the IXP4xx can be 189 2) If > 64MB of memory space is required, the IXP4xx can be
190 configured to use indirect registers to access PCI This allows 190 configured to use indirect registers to access the whole PCI
191 for up to 128MB (0x48000000 to 0x4fffffff) of memory on the bus. 191 memory space. This currently allows for up to 1 GB (0x10000000
192 The disadvantage of this is that every PCI access requires 192 to 0x4FFFFFFF) of memory on the bus. The disadvantage of this
193 three local register accesses plus a spinlock, but in some 193 is that every PCI access requires three local register accesses
194 cases the performance hit is acceptable. In addition, you cannot 194 plus a spinlock, but in some cases the performance hit is
195 mmap() PCI devices in this case due to the indirect nature 195 acceptable. In addition, you cannot mmap() PCI devices in this
196 of the PCI window. 196 case due to the indirect nature of the PCI window.
197 197
198 By default, the direct method is used. Choose this option if you 198 By default, the direct method is used. Choose this option if you
199 need to use the indirect method instead. If you don't know 199 need to use the indirect method instead. If you don't know
diff --git a/arch/arm/mach-ixp4xx/avila-pci.c b/arch/arm/mach-ixp4xx/avila-pci.c
index 08d65dcdb5fe..845e1b500548 100644
--- a/arch/arm/mach-ixp4xx/avila-pci.c
+++ b/arch/arm/mach-ixp4xx/avila-pci.c
@@ -22,40 +22,45 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25
26#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
27#include <asm/irq.h> 26#include <asm/irq.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
29#include <asm/mach-types.h> 28#include <asm/mach-types.h>
30 29
30#define AVILA_MAX_DEV 4
31#define LOFT_MAX_DEV 6
32#define IRQ_LINES 4
33
34/* PCI controller GPIO to IRQ pin mappings */
35#define INTA 11
36#define INTB 10
37#define INTC 9
38#define INTD 8
39
31void __init avila_pci_preinit(void) 40void __init avila_pci_preinit(void)
32{ 41{
33 set_irq_type(IRQ_AVILA_PCI_INTA, IRQ_TYPE_LEVEL_LOW); 42 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
34 set_irq_type(IRQ_AVILA_PCI_INTB, IRQ_TYPE_LEVEL_LOW); 43 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
35 set_irq_type(IRQ_AVILA_PCI_INTC, IRQ_TYPE_LEVEL_LOW); 44 set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);
36 set_irq_type(IRQ_AVILA_PCI_INTD, IRQ_TYPE_LEVEL_LOW); 45 set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);
37
38 ixp4xx_pci_preinit(); 46 ixp4xx_pci_preinit();
39} 47}
40 48
41static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 49static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
42{ 50{
43 static int pci_irq_table[AVILA_PCI_IRQ_LINES] = { 51 static int pci_irq_table[IRQ_LINES] = {
44 IRQ_AVILA_PCI_INTA, 52 IXP4XX_GPIO_IRQ(INTA),
45 IRQ_AVILA_PCI_INTB, 53 IXP4XX_GPIO_IRQ(INTB),
46 IRQ_AVILA_PCI_INTC, 54 IXP4XX_GPIO_IRQ(INTC),
47 IRQ_AVILA_PCI_INTD 55 IXP4XX_GPIO_IRQ(INTD)
48 }; 56 };
49 57
50 int irq = -1;
51
52 if (slot >= 1 && 58 if (slot >= 1 &&
53 slot <= (machine_is_loft() ? LOFT_PCI_MAX_DEV : AVILA_PCI_MAX_DEV) && 59 slot <= (machine_is_loft() ? LOFT_MAX_DEV : AVILA_MAX_DEV) &&
54 pin >= 1 && pin <= AVILA_PCI_IRQ_LINES) { 60 pin >= 1 && pin <= IRQ_LINES)
55 irq = pci_irq_table[(slot + pin - 2) % 4]; 61 return pci_irq_table[(slot + pin - 2) % 4];
56 }
57 62
58 return irq; 63 return -1;
59} 64}
60 65
61struct hw_pci avila_pci __initdata = { 66struct hw_pci avila_pci __initdata = {
@@ -75,4 +80,3 @@ int __init avila_pci_init(void)
75} 80}
76 81
77subsys_initcall(avila_pci_init); 82subsys_initcall(avila_pci_init);
78
diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c
index 797995ce18b9..6e558a76457d 100644
--- a/arch/arm/mach-ixp4xx/avila-setup.c
+++ b/arch/arm/mach-ixp4xx/avila-setup.c
@@ -19,7 +19,6 @@
19#include <linux/serial_8250.h> 19#include <linux/serial_8250.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/i2c-gpio.h> 21#include <linux/i2c-gpio.h>
22
23#include <asm/types.h> 22#include <asm/types.h>
24#include <asm/setup.h> 23#include <asm/setup.h>
25#include <asm/memory.h> 24#include <asm/memory.h>
@@ -29,6 +28,9 @@
29#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
30#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
31 30
31#define AVILA_SDA_PIN 7
32#define AVILA_SCL_PIN 6
33
32static struct flash_platform_data avila_flash_data = { 34static struct flash_platform_data avila_flash_data = {
33 .map_name = "cfi_probe", 35 .map_name = "cfi_probe",
34 .width = 2, 36 .width = 2,
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 70afcfe5b881..c4a01594c761 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -481,11 +481,7 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
481 481
482 res[1].name = "PCI Memory Space"; 482 res[1].name = "PCI Memory Space";
483 res[1].start = PCIBIOS_MIN_MEM; 483 res[1].start = PCIBIOS_MIN_MEM;
484#ifndef CONFIG_IXP4XX_INDIRECT_PCI 484 res[1].end = PCIBIOS_MAX_MEM;
485 res[1].end = 0x4bffffff;
486#else
487 res[1].end = 0x4fffffff;
488#endif
489 res[1].flags = IORESOURCE_MEM; 485 res[1].flags = IORESOURCE_MEM;
490 486
491 request_resource(&ioport_resource, &res[0]); 487 request_resource(&ioport_resource, &res[0]);
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index cfd52fb341cb..3bbf40f6d964 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -117,7 +117,7 @@ int gpio_to_irq(int gpio)
117} 117}
118EXPORT_SYMBOL(gpio_to_irq); 118EXPORT_SYMBOL(gpio_to_irq);
119 119
120int irq_to_gpio(int irq) 120int irq_to_gpio(unsigned int irq)
121{ 121{
122 int gpio = (irq < 32) ? irq2gpio[irq] : -EINVAL; 122 int gpio = (irq < 32) ? irq2gpio[irq] : -EINVAL;
123 123
diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c
index efddf01ed17b..b978ea8bd6f0 100644
--- a/arch/arm/mach-ixp4xx/coyote-pci.c
+++ b/arch/arm/mach-ixp4xx/coyote-pci.c
@@ -18,27 +18,31 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21
22#include <asm/mach-types.h> 21#include <asm/mach-types.h>
23#include <mach/hardware.h> 22#include <mach/hardware.h>
24#include <asm/irq.h> 23#include <asm/irq.h>
25
26#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
27 25
26#define SLOT0_DEVID 14
27#define SLOT1_DEVID 15
28
29/* PCI controller GPIO to IRQ pin mappings */
30#define SLOT0_INTA 6
31#define SLOT1_INTA 11
32
28void __init coyote_pci_preinit(void) 33void __init coyote_pci_preinit(void)
29{ 34{
30 set_irq_type(IRQ_COYOTE_PCI_SLOT0, IRQ_TYPE_LEVEL_LOW); 35 set_irq_type(IXP4XX_GPIO_IRQ(SLOT0_INTA), IRQ_TYPE_LEVEL_LOW);
31 set_irq_type(IRQ_COYOTE_PCI_SLOT1, IRQ_TYPE_LEVEL_LOW); 36 set_irq_type(IXP4XX_GPIO_IRQ(SLOT1_INTA), IRQ_TYPE_LEVEL_LOW);
32
33 ixp4xx_pci_preinit(); 37 ixp4xx_pci_preinit();
34} 38}
35 39
36static int __init coyote_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 40static int __init coyote_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
37{ 41{
38 if (slot == COYOTE_PCI_SLOT0_DEVID) 42 if (slot == SLOT0_DEVID)
39 return IRQ_COYOTE_PCI_SLOT0; 43 return IXP4XX_GPIO_IRQ(SLOT0_INTA);
40 else if (slot == COYOTE_PCI_SLOT1_DEVID) 44 else if (slot == SLOT1_DEVID)
41 return IRQ_COYOTE_PCI_SLOT1; 45 return IXP4XX_GPIO_IRQ(SLOT1_INTA);
42 else return -1; 46 else return -1;
43} 47}
44 48
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index aab1954e2747..25bf5ad770ea 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -25,6 +25,15 @@
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
27 27
28#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
29#define COYOTE_IDE_BASE_VIRT 0xFFFE1000
30#define COYOTE_IDE_REGION_SIZE 0x1000
31
32#define COYOTE_IDE_DATA_PORT 0xFFFE10E0
33#define COYOTE_IDE_CTRL_PORT 0xFFFE10FC
34#define COYOTE_IDE_ERROR_PORT 0xFFFE10E2
35#define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5
36
28static struct flash_platform_data coyote_flash_data = { 37static struct flash_platform_data coyote_flash_data = {
29 .map_name = "cfi_probe", 38 .map_name = "cfi_probe",
30 .width = 2, 39 .width = 2,
diff --git a/arch/arm/mach-ixp4xx/dsmg600-pci.c b/arch/arm/mach-ixp4xx/dsmg600-pci.c
index 926d15f885fb..fa70fed462ba 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-pci.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-pci.c
@@ -19,39 +19,45 @@
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22
23#include <asm/mach/pci.h> 22#include <asm/mach/pci.h>
24#include <asm/mach-types.h> 23#include <asm/mach-types.h>
25 24
25#define MAX_DEV 4
26#define IRQ_LINES 3
27
28/* PCI controller GPIO to IRQ pin mappings */
29#define INTA 11
30#define INTB 10
31#define INTC 9
32#define INTD 8
33#define INTE 7
34#define INTF 6
35
26void __init dsmg600_pci_preinit(void) 36void __init dsmg600_pci_preinit(void)
27{ 37{
28 set_irq_type(IRQ_DSMG600_PCI_INTA, IRQ_TYPE_LEVEL_LOW); 38 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
29 set_irq_type(IRQ_DSMG600_PCI_INTB, IRQ_TYPE_LEVEL_LOW); 39 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
30 set_irq_type(IRQ_DSMG600_PCI_INTC, IRQ_TYPE_LEVEL_LOW); 40 set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);
31 set_irq_type(IRQ_DSMG600_PCI_INTD, IRQ_TYPE_LEVEL_LOW); 41 set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);
32 set_irq_type(IRQ_DSMG600_PCI_INTE, IRQ_TYPE_LEVEL_LOW); 42 set_irq_type(IXP4XX_GPIO_IRQ(INTE), IRQ_TYPE_LEVEL_LOW);
33 set_irq_type(IRQ_DSMG600_PCI_INTF, IRQ_TYPE_LEVEL_LOW); 43 set_irq_type(IXP4XX_GPIO_IRQ(INTF), IRQ_TYPE_LEVEL_LOW);
34
35 ixp4xx_pci_preinit(); 44 ixp4xx_pci_preinit();
36} 45}
37 46
38static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 47static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
39{ 48{
40 static int pci_irq_table[DSMG600_PCI_MAX_DEV][DSMG600_PCI_IRQ_LINES] = 49 static int pci_irq_table[MAX_DEV][IRQ_LINES] = {
41 { 50 { IXP4XX_GPIO_IRQ(INTE), -1, -1 },
42 { IRQ_DSMG600_PCI_INTE, -1, -1 }, 51 { IXP4XX_GPIO_IRQ(INTA), -1, -1 },
43 { IRQ_DSMG600_PCI_INTA, -1, -1 }, 52 { IXP4XX_GPIO_IRQ(INTB), IXP4XX_GPIO_IRQ(INTC),
44 { IRQ_DSMG600_PCI_INTB, IRQ_DSMG600_PCI_INTC, IRQ_DSMG600_PCI_INTD }, 53 IXP4XX_GPIO_IRQ(INTD) },
45 { IRQ_DSMG600_PCI_INTF, -1, -1 }, 54 { IXP4XX_GPIO_IRQ(INTF), -1, -1 },
46 }; 55 };
47 56
48 int irq = -1; 57 if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
49 58 return pci_irq_table[slot - 1][pin - 1];
50 if (slot >= 1 && slot <= DSMG600_PCI_MAX_DEV &&
51 pin >= 1 && pin <= DSMG600_PCI_IRQ_LINES)
52 irq = pci_irq_table[slot-1][pin-1];
53 59
54 return irq; 60 return -1;
55} 61}
56 62
57struct hw_pci __initdata dsmg600_pci = { 63struct hw_pci __initdata dsmg600_pci = {
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index a51bfa6978b6..7c1fa54a6145 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -33,6 +33,23 @@
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <asm/gpio.h> 34#include <asm/gpio.h>
35 35
36#define DSMG600_SDA_PIN 5
37#define DSMG600_SCL_PIN 4
38
39/* DSM-G600 Timer Setting */
40#define DSMG600_FREQ 66000000
41
42/* Buttons */
43#define DSMG600_PB_GPIO 15 /* power button */
44#define DSMG600_RB_GPIO 3 /* reset button */
45
46/* Power control */
47#define DSMG600_PO_GPIO 2 /* power off */
48
49/* LEDs */
50#define DSMG600_LED_PWR_GPIO 0
51#define DSMG600_LED_WLAN_GPIO 14
52
36static struct flash_platform_data dsmg600_flash_data = { 53static struct flash_platform_data dsmg600_flash_data = {
37 .map_name = "cfi_probe", 54 .map_name = "cfi_probe",
38 .width = 2, 55 .width = 2,
diff --git a/arch/arm/mach-ixp4xx/fsg-pci.c b/arch/arm/mach-ixp4xx/fsg-pci.c
index ca12a9ca0830..5a810c930624 100644
--- a/arch/arm/mach-ixp4xx/fsg-pci.c
+++ b/arch/arm/mach-ixp4xx/fsg-pci.c
@@ -19,33 +19,38 @@
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22
23#include <asm/mach/pci.h> 22#include <asm/mach/pci.h>
24#include <asm/mach-types.h> 23#include <asm/mach-types.h>
25 24
25#define MAX_DEV 3
26#define IRQ_LINES 3
27
28/* PCI controller GPIO to IRQ pin mappings */
29#define INTA 6
30#define INTB 7
31#define INTC 5
32
26void __init fsg_pci_preinit(void) 33void __init fsg_pci_preinit(void)
27{ 34{
28 set_irq_type(IRQ_FSG_PCI_INTA, IRQ_TYPE_LEVEL_LOW); 35 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
29 set_irq_type(IRQ_FSG_PCI_INTB, IRQ_TYPE_LEVEL_LOW); 36 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
30 set_irq_type(IRQ_FSG_PCI_INTC, IRQ_TYPE_LEVEL_LOW); 37 set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);
31
32 ixp4xx_pci_preinit(); 38 ixp4xx_pci_preinit();
33} 39}
34 40
35static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 41static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
36{ 42{
37 static int pci_irq_table[FSG_PCI_IRQ_LINES] = { 43 static int pci_irq_table[IRQ_LINES] = {
38 IRQ_FSG_PCI_INTC, 44 IXP4XX_GPIO_IRQ(INTC),
39 IRQ_FSG_PCI_INTB, 45 IXP4XX_GPIO_IRQ(INTB),
40 IRQ_FSG_PCI_INTA, 46 IXP4XX_GPIO_IRQ(INTA),
41 }; 47 };
42 48
43 int irq = -1; 49 int irq = -1;
44 slot = slot - 11; 50 slot -= 11;
45 51
46 if (slot >= 1 && slot <= FSG_PCI_MAX_DEV && 52 if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
47 pin >= 1 && pin <= FSG_PCI_IRQ_LINES) 53 irq = pci_irq_table[slot - 1];
48 irq = pci_irq_table[(slot - 1)];
49 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n", 54 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
50 __func__, slot, pin, irq); 55 __func__, slot, pin, irq);
51 56
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index 5add22fc9899..e7f4befba422 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -24,12 +24,18 @@
24#include <linux/i2c.h> 24#include <linux/i2c.h>
25#include <linux/i2c-gpio.h> 25#include <linux/i2c-gpio.h>
26#include <linux/io.h> 26#include <linux/io.h>
27
28#include <asm/mach-types.h> 27#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
30#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
31#include <asm/gpio.h> 30#include <asm/gpio.h>
32 31
32#define FSG_SDA_PIN 12
33#define FSG_SCL_PIN 13
34
35#define FSG_SB_GPIO 4 /* sync button */
36#define FSG_RB_GPIO 9 /* reset button */
37#define FSG_UB_GPIO 10 /* usb button */
38
33static struct flash_platform_data fsg_flash_data = { 39static struct flash_platform_data fsg_flash_data = {
34 .map_name = "cfi_probe", 40 .map_name = "cfi_probe",
35 .width = 2, 41 .width = 2,
diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c
index a733b8ff3cec..1c28048209c1 100644
--- a/arch/arm/mach-ixp4xx/goramo_mlr.c
+++ b/arch/arm/mach-ixp4xx/goramo_mlr.c
@@ -17,29 +17,28 @@
17#include <asm/mach/flash.h> 17#include <asm/mach/flash.h>
18#include <asm/mach/pci.h> 18#include <asm/mach/pci.h>
19 19
20#define xgpio_irq(n) (IRQ_IXP4XX_GPIO ## n)
21#define gpio_irq(n) xgpio_irq(n)
22
23#define SLOT_ETHA 0x0B /* IDSEL = AD21 */ 20#define SLOT_ETHA 0x0B /* IDSEL = AD21 */
24#define SLOT_ETHB 0x0C /* IDSEL = AD20 */ 21#define SLOT_ETHB 0x0C /* IDSEL = AD20 */
25#define SLOT_MPCI 0x0D /* IDSEL = AD19 */ 22#define SLOT_MPCI 0x0D /* IDSEL = AD19 */
26#define SLOT_NEC 0x0E /* IDSEL = AD18 */ 23#define SLOT_NEC 0x0E /* IDSEL = AD18 */
27 24
28#define IRQ_ETHA IRQ_IXP4XX_GPIO4
29#define IRQ_ETHB IRQ_IXP4XX_GPIO5
30#define IRQ_NEC IRQ_IXP4XX_GPIO3
31#define IRQ_MPCI IRQ_IXP4XX_GPIO12
32
33/* GPIO lines */ 25/* GPIO lines */
34#define GPIO_SCL 0 26#define GPIO_SCL 0
35#define GPIO_SDA 1 27#define GPIO_SDA 1
36#define GPIO_STR 2 28#define GPIO_STR 2
29#define GPIO_IRQ_NEC 3
30#define GPIO_IRQ_ETHA 4
31#define GPIO_IRQ_ETHB 5
37#define GPIO_HSS0_DCD_N 6 32#define GPIO_HSS0_DCD_N 6
38#define GPIO_HSS1_DCD_N 7 33#define GPIO_HSS1_DCD_N 7
34#define GPIO_UART0_DCD 8
35#define GPIO_UART1_DCD 9
39#define GPIO_HSS0_CTS_N 10 36#define GPIO_HSS0_CTS_N 10
40#define GPIO_HSS1_CTS_N 11 37#define GPIO_HSS1_CTS_N 11
38#define GPIO_IRQ_MPCI 12
41#define GPIO_HSS1_RTS_N 13 39#define GPIO_HSS1_RTS_N 13
42#define GPIO_HSS0_RTS_N 14 40#define GPIO_HSS0_RTS_N 14
41/* GPIO15 is not connected */
43 42
44/* Control outputs from 74HC4094 */ 43/* Control outputs from 74HC4094 */
45#define CONTROL_HSS0_CLK_INT 0 44#define CONTROL_HSS0_CLK_INT 0
@@ -152,7 +151,7 @@ static int hss_set_clock(int port, unsigned int clock_type)
152 151
153static irqreturn_t hss_dcd_irq(int irq, void *pdev) 152static irqreturn_t hss_dcd_irq(int irq, void *pdev)
154{ 153{
155 int i, port = (irq == gpio_irq(GPIO_HSS1_DCD_N)); 154 int i, port = (irq == IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N));
156 gpio_line_get(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N, &i); 155 gpio_line_get(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N, &i);
157 set_carrier_cb_tab[port](pdev, !i); 156 set_carrier_cb_tab[port](pdev, !i);
158 return IRQ_HANDLED; 157 return IRQ_HANDLED;
@@ -165,9 +164,9 @@ static int hss_open(int port, void *pdev,
165 int i, irq; 164 int i, irq;
166 165
167 if (!port) 166 if (!port)
168 irq = gpio_irq(GPIO_HSS0_DCD_N); 167 irq = IXP4XX_GPIO_IRQ(GPIO_HSS0_DCD_N);
169 else 168 else
170 irq = gpio_irq(GPIO_HSS1_DCD_N); 169 irq = IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N);
171 170
172 gpio_line_get(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N, &i); 171 gpio_line_get(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N, &i);
173 set_carrier_cb(pdev, !i); 172 set_carrier_cb(pdev, !i);
@@ -188,8 +187,8 @@ static int hss_open(int port, void *pdev,
188 187
189static void hss_close(int port, void *pdev) 188static void hss_close(int port, void *pdev)
190{ 189{
191 free_irq(port ? gpio_irq(GPIO_HSS1_DCD_N) : gpio_irq(GPIO_HSS0_DCD_N), 190 free_irq(port ? IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N) :
192 pdev); 191 IXP4XX_GPIO_IRQ(GPIO_HSS0_DCD_N), pdev);
193 set_carrier_cb_tab[!!port] = NULL; /* catch bugs */ 192 set_carrier_cb_tab[!!port] = NULL; /* catch bugs */
194 193
195 set_control(port ? CONTROL_HSS1_DTR_N : CONTROL_HSS0_DTR_N, 1); 194 set_control(port ? CONTROL_HSS1_DTR_N : CONTROL_HSS0_DTR_N, 1);
@@ -421,8 +420,8 @@ static void __init gmlr_init(void)
421 gpio_line_config(GPIO_HSS1_RTS_N, IXP4XX_GPIO_OUT); 420 gpio_line_config(GPIO_HSS1_RTS_N, IXP4XX_GPIO_OUT);
422 gpio_line_config(GPIO_HSS0_DCD_N, IXP4XX_GPIO_IN); 421 gpio_line_config(GPIO_HSS0_DCD_N, IXP4XX_GPIO_IN);
423 gpio_line_config(GPIO_HSS1_DCD_N, IXP4XX_GPIO_IN); 422 gpio_line_config(GPIO_HSS1_DCD_N, IXP4XX_GPIO_IN);
424 set_irq_type(gpio_irq(GPIO_HSS0_DCD_N), IRQ_TYPE_EDGE_BOTH); 423 set_irq_type(IXP4XX_GPIO_IRQ(GPIO_HSS0_DCD_N), IRQ_TYPE_EDGE_BOTH);
425 set_irq_type(gpio_irq(GPIO_HSS1_DCD_N), IRQ_TYPE_EDGE_BOTH); 424 set_irq_type(IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N), IRQ_TYPE_EDGE_BOTH);
426 425
427 set_control(CONTROL_HSS0_DTR_N, 1); 426 set_control(CONTROL_HSS0_DTR_N, 1);
428 set_control(CONTROL_HSS1_DTR_N, 1); 427 set_control(CONTROL_HSS1_DTR_N, 1);
@@ -442,10 +441,10 @@ static void __init gmlr_init(void)
442#ifdef CONFIG_PCI 441#ifdef CONFIG_PCI
443static void __init gmlr_pci_preinit(void) 442static void __init gmlr_pci_preinit(void)
444{ 443{
445 set_irq_type(IRQ_ETHA, IRQ_TYPE_LEVEL_LOW); 444 set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA), IRQ_TYPE_LEVEL_LOW);
446 set_irq_type(IRQ_ETHB, IRQ_TYPE_LEVEL_LOW); 445 set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHB), IRQ_TYPE_LEVEL_LOW);
447 set_irq_type(IRQ_NEC, IRQ_TYPE_LEVEL_LOW); 446 set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_NEC), IRQ_TYPE_LEVEL_LOW);
448 set_irq_type(IRQ_MPCI, IRQ_TYPE_LEVEL_LOW); 447 set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_MPCI), IRQ_TYPE_LEVEL_LOW);
449 ixp4xx_pci_preinit(); 448 ixp4xx_pci_preinit();
450} 449}
451 450
@@ -466,10 +465,10 @@ static void __init gmlr_pci_postinit(void)
466static int __init gmlr_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 465static int __init gmlr_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
467{ 466{
468 switch(slot) { 467 switch(slot) {
469 case SLOT_ETHA: return IRQ_ETHA; 468 case SLOT_ETHA: return IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA);
470 case SLOT_ETHB: return IRQ_ETHB; 469 case SLOT_ETHB: return IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHB);
471 case SLOT_NEC: return IRQ_NEC; 470 case SLOT_NEC: return IXP4XX_GPIO_IRQ(GPIO_IRQ_NEC);
472 default: return IRQ_MPCI; 471 default: return IXP4XX_GPIO_IRQ(GPIO_IRQ_MPCI);
473 } 472 }
474} 473}
475 474
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
index 7b8a2c323840..25d2c333c204 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c
@@ -26,14 +26,16 @@
26#include <linux/init.h> 26#include <linux/init.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/irq.h> 28#include <linux/irq.h>
29
30#include <asm/mach-types.h> 29#include <asm/mach-types.h>
31#include <mach/hardware.h> 30#include <mach/hardware.h>
32#include <mach/gtwx5715.h>
33#include <asm/mach/pci.h> 31#include <asm/mach/pci.h>
34 32
33#define SLOT0_DEVID 0
34#define SLOT1_DEVID 1
35#define INTA 10 /* slot 1 has INTA and INTB crossed */
36#define INTB 11
37
35/* 38/*
36 * The exact GPIO pins and IRQs are defined in arch-ixp4xx/gtwx5715.h
37 * Slot 0 isn't actually populated with a card connector but 39 * Slot 0 isn't actually populated with a card connector but
38 * we initialize it anyway in case a future version has the 40 * we initialize it anyway in case a future version has the
39 * slot populated or someone with good soldering skills has 41 * slot populated or someone with good soldering skills has
@@ -41,32 +43,26 @@
41 */ 43 */
42void __init gtwx5715_pci_preinit(void) 44void __init gtwx5715_pci_preinit(void)
43{ 45{
44 set_irq_type(GTWX5715_PCI_SLOT0_INTA_IRQ, IRQ_TYPE_LEVEL_LOW); 46 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
45 set_irq_type(GTWX5715_PCI_SLOT0_INTB_IRQ, IRQ_TYPE_LEVEL_LOW); 47 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
46 set_irq_type(GTWX5715_PCI_SLOT1_INTA_IRQ, IRQ_TYPE_LEVEL_LOW);
47 set_irq_type(GTWX5715_PCI_SLOT1_INTB_IRQ, IRQ_TYPE_LEVEL_LOW);
48
49 ixp4xx_pci_preinit(); 48 ixp4xx_pci_preinit();
50} 49}
51 50
52 51
53static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 52static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
54{ 53{
55 int rc; 54 int rc = -1;
56 static int gtwx5715_irqmap
57 [GTWX5715_PCI_SLOT_COUNT]
58 [GTWX5715_PCI_INT_PIN_COUNT] = {
59 {GTWX5715_PCI_SLOT0_INTA_IRQ, GTWX5715_PCI_SLOT0_INTB_IRQ},
60 {GTWX5715_PCI_SLOT1_INTA_IRQ, GTWX5715_PCI_SLOT1_INTB_IRQ},
61};
62 55
63 if (slot >= GTWX5715_PCI_SLOT_COUNT || 56 if ((slot == SLOT0_DEVID && pin == 1) ||
64 pin >= GTWX5715_PCI_INT_PIN_COUNT) rc = -1; 57 (slot == SLOT1_DEVID && pin == 2))
65 else 58 rc = IXP4XX_GPIO_IRQ(INTA);
66 rc = gtwx5715_irqmap[slot][pin-1]; 59 else if ((slot == SLOT0_DEVID && pin == 2) ||
60 (slot == SLOT1_DEVID && pin == 1))
61 rc = IXP4XX_GPIO_IRQ(INTB);
67 62
68 printk("%s: Mapped slot %d pin %d to IRQ %d\n", __func__, slot, pin, rc); 63 printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
69 return(rc); 64 __func__, slot, pin, rc);
65 return rc;
70} 66}
71 67
72struct hw_pci gtwx5715_pci __initdata = { 68struct hw_pci gtwx5715_pci __initdata = {
@@ -81,9 +77,7 @@ struct hw_pci gtwx5715_pci __initdata = {
81int __init gtwx5715_pci_init(void) 77int __init gtwx5715_pci_init(void)
82{ 78{
83 if (machine_is_gtwx5715()) 79 if (machine_is_gtwx5715())
84 {
85 pci_common_init(&gtwx5715_pci); 80 pci_common_init(&gtwx5715_pci);
86 }
87 81
88 return 0; 82 return 0;
89} 83}
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 25c21d6665ec..0bc7185cb6f7 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -28,7 +28,6 @@
28#include <linux/tty.h> 28#include <linux/tty.h>
29#include <linux/serial_8250.h> 29#include <linux/serial_8250.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31
32#include <asm/types.h> 31#include <asm/types.h>
33#include <asm/setup.h> 32#include <asm/setup.h>
34#include <asm/memory.h> 33#include <asm/memory.h>
@@ -37,7 +36,34 @@
37#include <asm/mach-types.h> 36#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
39#include <asm/mach/flash.h> 38#include <asm/mach/flash.h>
40#include <mach/gtwx5715.h> 39
40/* GPIO 5,6,7 and 12 are hard wired to the Kendin KS8995M Switch
41 and operate as an SPI type interface. The details of the interface
42 are available on Kendin/Micrel's web site. */
43
44#define GTWX5715_KSSPI_SELECT 5
45#define GTWX5715_KSSPI_TXD 6
46#define GTWX5715_KSSPI_CLOCK 7
47#define GTWX5715_KSSPI_RXD 12
48
49/* The "reset" button is wired to GPIO 3.
50 The GPIO is brought "low" when the button is pushed. */
51
52#define GTWX5715_BUTTON_GPIO 3
53
54/* Board Label Front Label
55 LED1 Power
56 LED2 Wireless-G
57 LED3 not populated but could be
58 LED4 Internet
59 LED5 - LED8 Controlled by KS8995M Switch
60 LED9 DMZ */
61
62#define GTWX5715_LED1_GPIO 2
63#define GTWX5715_LED2_GPIO 9
64#define GTWX5715_LED3_GPIO 8
65#define GTWX5715_LED4_GPIO 1
66#define GTWX5715_LED9_GPIO 4
41 67
42/* 68/*
43 * Xscale UART registers are 32 bits wide with only the least 69 * Xscale UART registers are 32 bits wide with only the least
diff --git a/arch/arm/mach-ixp4xx/include/mach/avila.h b/arch/arm/mach-ixp4xx/include/mach/avila.h
deleted file mode 100644
index 1640cb61972b..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/avila.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/avila.h
3 *
4 * Gateworks Avila platform specific definitions
5 *
6 * Author: Michael-Luke Jones <mlj28@cam.ac.uk>
7 *
8 * Based on ixdp425.h
9 * Author: Deepak Saxena <dsaxena@plexity.net>
10 *
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <mach/hardware.h>"
20#endif
21
22#define AVILA_SDA_PIN 7
23#define AVILA_SCL_PIN 6
24
25/*
26 * AVILA PCI IRQs
27 */
28#define AVILA_PCI_MAX_DEV 4
29#define LOFT_PCI_MAX_DEV 6
30#define AVILA_PCI_IRQ_LINES 4
31
32
33/* PCI controller GPIO to IRQ pin mappings */
34#define AVILA_PCI_INTA_PIN 11
35#define AVILA_PCI_INTB_PIN 10
36#define AVILA_PCI_INTC_PIN 9
37#define AVILA_PCI_INTD_PIN 8
38
39
diff --git a/arch/arm/mach-ixp4xx/include/mach/coyote.h b/arch/arm/mach-ixp4xx/include/mach/coyote.h
deleted file mode 100644
index 717ac6d16f55..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/coyote.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/coyote.h
3 *
4 * ADI Engineering platform specific definitions
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista, Software, Inc.
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#ifndef __ASM_ARCH_HARDWARE_H__
16#error "Do not include this directly, instead #include <mach/hardware.h>"
17#endif
18
19/* PCI controller GPIO to IRQ pin mappings */
20#define COYOTE_PCI_SLOT0_PIN 6
21#define COYOTE_PCI_SLOT1_PIN 11
22
23#define COYOTE_PCI_SLOT0_DEVID 14
24#define COYOTE_PCI_SLOT1_DEVID 15
25
26#define COYOTE_IDE_BASE_PHYS IXP4XX_EXP_BUS_BASE(3)
27#define COYOTE_IDE_BASE_VIRT 0xFFFE1000
28#define COYOTE_IDE_REGION_SIZE 0x1000
29
30#define COYOTE_IDE_DATA_PORT 0xFFFE10E0
31#define COYOTE_IDE_CTRL_PORT 0xFFFE10FC
32#define COYOTE_IDE_ERROR_PORT 0xFFFE10E2
33
diff --git a/arch/arm/mach-ixp4xx/include/mach/dsmg600.h b/arch/arm/mach-ixp4xx/include/mach/dsmg600.h
deleted file mode 100644
index dc087a34a268..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/dsmg600.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * DSM-G600 platform specific definitions
3 *
4 * Copyright (C) 2006 Tower Technologies
5 * Author: Alessandro Zummo <a.zummo@towertech.it>
6 *
7 * based on ixdp425.h:
8 * Copyright 2004 (C) MontaVista, Software, Inc.
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#ifndef __ASM_ARCH_HARDWARE_H__
16#error "Do not include this directly, instead #include <mach/hardware.h>"
17#endif
18
19#define DSMG600_SDA_PIN 5
20#define DSMG600_SCL_PIN 4
21
22/*
23 * DSMG600 PCI IRQs
24 */
25#define DSMG600_PCI_MAX_DEV 4
26#define DSMG600_PCI_IRQ_LINES 3
27
28
29/* PCI controller GPIO to IRQ pin mappings */
30#define DSMG600_PCI_INTA_PIN 11
31#define DSMG600_PCI_INTB_PIN 10
32#define DSMG600_PCI_INTC_PIN 9
33#define DSMG600_PCI_INTD_PIN 8
34#define DSMG600_PCI_INTE_PIN 7
35#define DSMG600_PCI_INTF_PIN 6
36
37/* DSM-G600 Timer Setting */
38#define DSMG600_FREQ 66000000
39
40/* Buttons */
41
42#define DSMG600_PB_GPIO 15 /* power button */
43#define DSMG600_RB_GPIO 3 /* reset button */
44
45/* Power control */
46
47#define DSMG600_PO_GPIO 2 /* power off */
48
49/* LEDs */
50
51#define DSMG600_LED_PWR_GPIO 0
52#define DSMG600_LED_WLAN_GPIO 14
diff --git a/arch/arm/mach-ixp4xx/include/mach/fsg.h b/arch/arm/mach-ixp4xx/include/mach/fsg.h
deleted file mode 100644
index 1f02b7e22a13..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/fsg.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/fsg.h
3 *
4 * Freecom FSG-3 platform specific definitions
5 *
6 * Author: Rod Whitby <rod@whitby.id.au>
7 * Author: Tomasz Chmielewski <mangoo@wpkg.org>
8 * Maintainers: http://www.nslu2-linux.org
9 *
10 * Based on coyote.h by
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <mach/hardware.h>"
20#endif
21
22#define FSG_SDA_PIN 12
23#define FSG_SCL_PIN 13
24
25/*
26 * FSG PCI IRQs
27 */
28#define FSG_PCI_MAX_DEV 3
29#define FSG_PCI_IRQ_LINES 3
30
31
32/* PCI controller GPIO to IRQ pin mappings */
33#define FSG_PCI_INTA_PIN 6
34#define FSG_PCI_INTB_PIN 7
35#define FSG_PCI_INTC_PIN 5
36
37/* Buttons */
38
39#define FSG_SB_GPIO 4 /* sync button */
40#define FSG_RB_GPIO 9 /* reset button */
41#define FSG_UB_GPIO 10 /* usb button */
42
43/* LEDs */
44
45#define FSG_LED_WLAN_BIT 0
46#define FSG_LED_WAN_BIT 1
47#define FSG_LED_SATA_BIT 2
48#define FSG_LED_USB_BIT 4
49#define FSG_LED_RING_BIT 5
50#define FSG_LED_SYNC_BIT 7
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
index cd5aec26c072..a5f87ded2f28 100644
--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -70,7 +70,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
70#include <asm-generic/gpio.h> /* cansleep wrappers */ 70#include <asm-generic/gpio.h> /* cansleep wrappers */
71 71
72extern int gpio_to_irq(int gpio); 72extern int gpio_to_irq(int gpio);
73extern int irq_to_gpio(int gpio); 73extern int irq_to_gpio(unsigned int irq);
74 74
75#endif 75#endif
76 76
diff --git a/arch/arm/mach-ixp4xx/include/mach/gtwx5715.h b/arch/arm/mach-ixp4xx/include/mach/gtwx5715.h
deleted file mode 100644
index 5d5e201cac7e..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/gtwx5715.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/gtwx5715.h
3 *
4 * Gemtek GTWX5715 Gateway (Linksys WRV54G)
5 *
6 * Copyright 2004 (c) George T. Joseph
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22
23#ifndef __ASM_ARCH_HARDWARE_H__
24#error "Do not include this directly, instead #include <mach/hardware.h>"
25#endif
26#include "irqs.h"
27
28#define GTWX5715_GPIO0 0
29#define GTWX5715_GPIO1 1
30#define GTWX5715_GPIO2 2
31#define GTWX5715_GPIO3 3
32#define GTWX5715_GPIO4 4
33#define GTWX5715_GPIO5 5
34#define GTWX5715_GPIO6 6
35#define GTWX5715_GPIO7 7
36#define GTWX5715_GPIO8 8
37#define GTWX5715_GPIO9 9
38#define GTWX5715_GPIO10 10
39#define GTWX5715_GPIO11 11
40#define GTWX5715_GPIO12 12
41#define GTWX5715_GPIO13 13
42#define GTWX5715_GPIO14 14
43
44#define GTWX5715_GPIO0_IRQ IRQ_IXP4XX_GPIO0
45#define GTWX5715_GPIO1_IRQ IRQ_IXP4XX_GPIO1
46#define GTWX5715_GPIO2_IRQ IRQ_IXP4XX_GPIO2
47#define GTWX5715_GPIO3_IRQ IRQ_IXP4XX_GPIO3
48#define GTWX5715_GPIO4_IRQ IRQ_IXP4XX_GPIO4
49#define GTWX5715_GPIO5_IRQ IRQ_IXP4XX_GPIO5
50#define GTWX5715_GPIO6_IRQ IRQ_IXP4XX_GPIO6
51#define GTWX5715_GPIO7_IRQ IRQ_IXP4XX_GPIO7
52#define GTWX5715_GPIO8_IRQ IRQ_IXP4XX_GPIO8
53#define GTWX5715_GPIO9_IRQ IRQ_IXP4XX_GPIO9
54#define GTWX5715_GPIO10_IRQ IRQ_IXP4XX_GPIO10
55#define GTWX5715_GPIO11_IRQ IRQ_IXP4XX_GPIO11
56#define GTWX5715_GPIO12_IRQ IRQ_IXP4XX_GPIO12
57#define GTWX5715_GPIO13_IRQ IRQ_IXP4XX_SW_INT1
58#define GTWX5715_GPIO14_IRQ IRQ_IXP4XX_SW_INT2
59
60/* PCI controller GPIO to IRQ pin mappings
61
62 INTA INTB
63SLOT 0 10 11
64SLOT 1 11 10
65
66*/
67
68#define GTWX5715_PCI_SLOT0_DEVID 0
69#define GTWX5715_PCI_SLOT0_INTA_GPIO GTWX5715_GPIO10
70#define GTWX5715_PCI_SLOT0_INTB_GPIO GTWX5715_GPIO11
71#define GTWX5715_PCI_SLOT0_INTA_IRQ GTWX5715_GPIO10_IRQ
72#define GTWX5715_PCI_SLOT0_INTB_IRQ GTWX5715_GPIO11_IRQ
73
74#define GTWX5715_PCI_SLOT1_DEVID 1
75#define GTWX5715_PCI_SLOT1_INTA_GPIO GTWX5715_GPIO11
76#define GTWX5715_PCI_SLOT1_INTB_GPIO GTWX5715_GPIO10
77#define GTWX5715_PCI_SLOT1_INTA_IRQ GTWX5715_GPIO11_IRQ
78#define GTWX5715_PCI_SLOT1_INTB_IRQ GTWX5715_GPIO10_IRQ
79
80#define GTWX5715_PCI_SLOT_COUNT 2
81#define GTWX5715_PCI_INT_PIN_COUNT 2
82
83/*
84 * GPIO 5,6,7 and12 are hard wired to the Kendin KS8995M Switch
85 * and operate as an SPI type interface. The details of the interface
86 * are available on Kendin/Micrel's web site.
87 */
88
89#define GTWX5715_KSSPI_SELECT GTWX5715_GPIO5
90#define GTWX5715_KSSPI_TXD GTWX5715_GPIO6
91#define GTWX5715_KSSPI_CLOCK GTWX5715_GPIO7
92#define GTWX5715_KSSPI_RXD GTWX5715_GPIO12
93
94/*
95 * The "reset" button is wired to GPIO 3.
96 * The GPIO is brought "low" when the button is pushed.
97 */
98
99#define GTWX5715_BUTTON_GPIO GTWX5715_GPIO3
100#define GTWX5715_BUTTON_IRQ GTWX5715_GPIO3_IRQ
101
102/*
103 * Board Label Front Label
104 * LED1 Power
105 * LED2 Wireless-G
106 * LED3 not populated but could be
107 * LED4 Internet
108 * LED5 - LED8 Controlled by KS8995M Switch
109 * LED9 DMZ
110 */
111
112#define GTWX5715_LED1_GPIO GTWX5715_GPIO2
113#define GTWX5715_LED2_GPIO GTWX5715_GPIO9
114#define GTWX5715_LED3_GPIO GTWX5715_GPIO8
115#define GTWX5715_LED4_GPIO GTWX5715_GPIO1
116#define GTWX5715_LED9_GPIO GTWX5715_GPIO4
diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h
index f58a43a23966..f9d1c43e4a54 100644
--- a/arch/arm/mach-ixp4xx/include/mach/hardware.h
+++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h
@@ -18,7 +18,13 @@
18#define __ASM_ARCH_HARDWARE_H__ 18#define __ASM_ARCH_HARDWARE_H__
19 19
20#define PCIBIOS_MIN_IO 0x00001000 20#define PCIBIOS_MIN_IO 0x00001000
21#define PCIBIOS_MIN_MEM (cpu_is_ixp43x() ? 0x40000000 : 0x48000000) 21#ifdef CONFIG_IXP4XX_INDIRECT_PCI
22#define PCIBIOS_MIN_MEM 0x10000000 /* 1 GB of indirect PCI MMIO space */
23#define PCIBIOS_MAX_MEM 0x4FFFFFFF
24#else
25#define PCIBIOS_MIN_MEM 0x48000000 /* 64 MB of PCI MMIO space */
26#define PCIBIOS_MAX_MEM 0x4BFFFFFF
27#endif
22 28
23/* 29/*
24 * We override the standard dma-mask routines for bouncing. 30 * We override the standard dma-mask routines for bouncing.
@@ -37,14 +43,4 @@
37/* Platform helper functions and definitions */ 43/* Platform helper functions and definitions */
38#include "platform.h" 44#include "platform.h"
39 45
40/* Platform specific details */
41#include "ixdp425.h"
42#include "avila.h"
43#include "coyote.h"
44#include "prpmc1100.h"
45#include "nslu2.h"
46#include "nas100d.h"
47#include "dsmg600.h"
48#include "fsg.h"
49
50#endif /* _ASM_ARCH_HARDWARE_H */ 46#endif /* _ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 8a947d42a6f1..6ea7e2fb2701 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -26,22 +26,20 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
26/* 26/*
27 * IXP4xx provides two methods of accessing PCI memory space: 27 * IXP4xx provides two methods of accessing PCI memory space:
28 * 28 *
29 * 1) A direct mapped window from 0x48000000 to 0x4bffffff (64MB). 29 * 1) A direct mapped window from 0x48000000 to 0x4BFFFFFF (64MB).
30 * To access PCI via this space, we simply ioremap() the BAR 30 * To access PCI via this space, we simply ioremap() the BAR
31 * into the kernel and we can use the standard read[bwl]/write[bwl] 31 * into the kernel and we can use the standard read[bwl]/write[bwl]
32 * macros. This is the preffered method due to speed but it 32 * macros. This is the preffered method due to speed but it
33 * limits the system to just 64MB of PCI memory. This can be 33 * limits the system to just 64MB of PCI memory. This can be
34 * problamatic if using video cards and other memory-heavy 34 * problematic if using video cards and other memory-heavy targets.
35 * targets.
36 *
37 * 2) If > 64MB of memory space is required, the IXP4xx can be configured
38 * to use indirect registers to access PCI (as we do below for I/O
39 * transactions). This allows for up to 128MB (0x48000000 to 0x4fffffff)
40 * of memory on the bus. The disadvantage of this is that every
41 * PCI access requires three local register accesses plus a spinlock,
42 * but in some cases the performance hit is acceptable. In addition,
43 * you cannot mmap() PCI devices in this case.
44 * 35 *
36 * 2) If > 64MB of memory space is required, the IXP4xx can use indirect
37 * registers to access the whole 4 GB of PCI memory space (as we do below
38 * for I/O transactions). This allows currently for up to 1 GB (0x10000000
39 * to 0x4FFFFFFF) of memory on the bus. The disadvantage of this is that
40 * every PCI access requires three local register accesses plus a spinlock,
41 * but in some cases the performance hit is acceptable. In addition, you
42 * cannot mmap() PCI devices in this case.
45 */ 43 */
46#ifndef CONFIG_IXP4XX_INDIRECT_PCI 44#ifndef CONFIG_IXP4XX_INDIRECT_PCI
47 45
@@ -55,48 +53,52 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
55 * access registers. If something outside of PCI is ioremap'd, we 53 * access registers. If something outside of PCI is ioremap'd, we
56 * fallback to the default. 54 * fallback to the default.
57 */ 55 */
58static inline void __iomem * 56
59__ixp4xx_ioremap(unsigned long addr, size_t size, unsigned int mtype) 57static inline int is_pci_memory(u32 addr)
58{
59 return (addr >= PCIBIOS_MIN_MEM) && (addr <= 0x4FFFFFFF);
60}
61
62static inline void __iomem * __indirect_ioremap(unsigned long addr, size_t size,
63 unsigned int mtype)
60{ 64{
61 if((addr < PCIBIOS_MIN_MEM) || (addr > 0x4fffffff)) 65 if (!is_pci_memory(addr))
62 return __arm_ioremap(addr, size, mtype); 66 return __arm_ioremap(addr, size, mtype);
63 67
64 return (void __iomem *)addr; 68 return (void __iomem *)addr;
65} 69}
66 70
67static inline void 71static inline void __indirect_iounmap(void __iomem *addr)
68__ixp4xx_iounmap(void __iomem *addr)
69{ 72{
70 if ((__force u32)addr >= VMALLOC_START) 73 if (!is_pci_memory((__force u32)addr))
71 __iounmap(addr); 74 __iounmap(addr);
72} 75}
73 76
74#define __arch_ioremap(a, s, f) __ixp4xx_ioremap(a, s, f) 77#define __arch_ioremap(a, s, f) __indirect_ioremap(a, s, f)
75#define __arch_iounmap(a) __ixp4xx_iounmap(a) 78#define __arch_iounmap(a) __indirect_iounmap(a)
76 79
77#define writeb(v, p) __ixp4xx_writeb(v, p) 80#define writeb(v, p) __indirect_writeb(v, p)
78#define writew(v, p) __ixp4xx_writew(v, p) 81#define writew(v, p) __indirect_writew(v, p)
79#define writel(v, p) __ixp4xx_writel(v, p) 82#define writel(v, p) __indirect_writel(v, p)
80 83
81#define writesb(p, v, l) __ixp4xx_writesb(p, v, l) 84#define writesb(p, v, l) __indirect_writesb(p, v, l)
82#define writesw(p, v, l) __ixp4xx_writesw(p, v, l) 85#define writesw(p, v, l) __indirect_writesw(p, v, l)
83#define writesl(p, v, l) __ixp4xx_writesl(p, v, l) 86#define writesl(p, v, l) __indirect_writesl(p, v, l)
84
85#define readb(p) __ixp4xx_readb(p)
86#define readw(p) __ixp4xx_readw(p)
87#define readl(p) __ixp4xx_readl(p)
88
89#define readsb(p, v, l) __ixp4xx_readsb(p, v, l)
90#define readsw(p, v, l) __ixp4xx_readsw(p, v, l)
91#define readsl(p, v, l) __ixp4xx_readsl(p, v, l)
92 87
93static inline void 88#define readb(p) __indirect_readb(p)
94__ixp4xx_writeb(u8 value, volatile void __iomem *p) 89#define readw(p) __indirect_readw(p)
90#define readl(p) __indirect_readl(p)
91
92#define readsb(p, v, l) __indirect_readsb(p, v, l)
93#define readsw(p, v, l) __indirect_readsw(p, v, l)
94#define readsl(p, v, l) __indirect_readsl(p, v, l)
95
96static inline void __indirect_writeb(u8 value, volatile void __iomem *p)
95{ 97{
96 u32 addr = (u32)p; 98 u32 addr = (u32)p;
97 u32 n, byte_enables, data; 99 u32 n, byte_enables, data;
98 100
99 if (addr >= VMALLOC_START) { 101 if (!is_pci_memory(addr)) {
100 __raw_writeb(value, addr); 102 __raw_writeb(value, addr);
101 return; 103 return;
102 } 104 }
@@ -107,20 +109,19 @@ __ixp4xx_writeb(u8 value, volatile void __iomem *p)
107 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data); 109 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data);
108} 110}
109 111
110static inline void 112static inline void __indirect_writesb(volatile void __iomem *bus_addr,
111__ixp4xx_writesb(volatile void __iomem *bus_addr, const u8 *vaddr, int count) 113 const u8 *vaddr, int count)
112{ 114{
113 while (count--) 115 while (count--)
114 writeb(*vaddr++, bus_addr); 116 writeb(*vaddr++, bus_addr);
115} 117}
116 118
117static inline void 119static inline void __indirect_writew(u16 value, volatile void __iomem *p)
118__ixp4xx_writew(u16 value, volatile void __iomem *p)
119{ 120{
120 u32 addr = (u32)p; 121 u32 addr = (u32)p;
121 u32 n, byte_enables, data; 122 u32 n, byte_enables, data;
122 123
123 if (addr >= VMALLOC_START) { 124 if (!is_pci_memory(addr)) {
124 __raw_writew(value, addr); 125 __raw_writew(value, addr);
125 return; 126 return;
126 } 127 }
@@ -131,18 +132,18 @@ __ixp4xx_writew(u16 value, volatile void __iomem *p)
131 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data); 132 ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data);
132} 133}
133 134
134static inline void 135static inline void __indirect_writesw(volatile void __iomem *bus_addr,
135__ixp4xx_writesw(volatile void __iomem *bus_addr, const u16 *vaddr, int count) 136 const u16 *vaddr, int count)
136{ 137{
137 while (count--) 138 while (count--)
138 writew(*vaddr++, bus_addr); 139 writew(*vaddr++, bus_addr);
139} 140}
140 141
141static inline void 142static inline void __indirect_writel(u32 value, volatile void __iomem *p)
142__ixp4xx_writel(u32 value, volatile void __iomem *p)
143{ 143{
144 u32 addr = (__force u32)p; 144 u32 addr = (__force u32)p;
145 if (addr >= VMALLOC_START) { 145
146 if (!is_pci_memory(addr)) {
146 __raw_writel(value, p); 147 __raw_writel(value, p);
147 return; 148 return;
148 } 149 }
@@ -150,20 +151,19 @@ __ixp4xx_writel(u32 value, volatile void __iomem *p)
150 ixp4xx_pci_write(addr, NP_CMD_MEMWRITE, value); 151 ixp4xx_pci_write(addr, NP_CMD_MEMWRITE, value);
151} 152}
152 153
153static inline void 154static inline void __indirect_writesl(volatile void __iomem *bus_addr,
154__ixp4xx_writesl(volatile void __iomem *bus_addr, const u32 *vaddr, int count) 155 const u32 *vaddr, int count)
155{ 156{
156 while (count--) 157 while (count--)
157 writel(*vaddr++, bus_addr); 158 writel(*vaddr++, bus_addr);
158} 159}
159 160
160static inline unsigned char 161static inline unsigned char __indirect_readb(const volatile void __iomem *p)
161__ixp4xx_readb(const volatile void __iomem *p)
162{ 162{
163 u32 addr = (u32)p; 163 u32 addr = (u32)p;
164 u32 n, byte_enables, data; 164 u32 n, byte_enables, data;
165 165
166 if (addr >= VMALLOC_START) 166 if (!is_pci_memory(addr))
167 return __raw_readb(addr); 167 return __raw_readb(addr);
168 168
169 n = addr % 4; 169 n = addr % 4;
@@ -174,20 +174,19 @@ __ixp4xx_readb(const volatile void __iomem *p)
174 return data >> (8*n); 174 return data >> (8*n);
175} 175}
176 176
177static inline void 177static inline void __indirect_readsb(const volatile void __iomem *bus_addr,
178__ixp4xx_readsb(const volatile void __iomem *bus_addr, u8 *vaddr, u32 count) 178 u8 *vaddr, u32 count)
179{ 179{
180 while (count--) 180 while (count--)
181 *vaddr++ = readb(bus_addr); 181 *vaddr++ = readb(bus_addr);
182} 182}
183 183
184static inline unsigned short 184static inline unsigned short __indirect_readw(const volatile void __iomem *p)
185__ixp4xx_readw(const volatile void __iomem *p)
186{ 185{
187 u32 addr = (u32)p; 186 u32 addr = (u32)p;
188 u32 n, byte_enables, data; 187 u32 n, byte_enables, data;
189 188
190 if (addr >= VMALLOC_START) 189 if (!is_pci_memory(addr))
191 return __raw_readw(addr); 190 return __raw_readw(addr);
192 191
193 n = addr % 4; 192 n = addr % 4;
@@ -198,20 +197,19 @@ __ixp4xx_readw(const volatile void __iomem *p)
198 return data>>(8*n); 197 return data>>(8*n);
199} 198}
200 199
201static inline void 200static inline void __indirect_readsw(const volatile void __iomem *bus_addr,
202__ixp4xx_readsw(const volatile void __iomem *bus_addr, u16 *vaddr, u32 count) 201 u16 *vaddr, u32 count)
203{ 202{
204 while (count--) 203 while (count--)
205 *vaddr++ = readw(bus_addr); 204 *vaddr++ = readw(bus_addr);
206} 205}
207 206
208static inline unsigned long 207static inline unsigned long __indirect_readl(const volatile void __iomem *p)
209__ixp4xx_readl(const volatile void __iomem *p)
210{ 208{
211 u32 addr = (__force u32)p; 209 u32 addr = (__force u32)p;
212 u32 data; 210 u32 data;
213 211
214 if (addr >= VMALLOC_START) 212 if (!is_pci_memory(addr))
215 return __raw_readl(p); 213 return __raw_readl(p);
216 214
217 if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data)) 215 if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data))
@@ -220,8 +218,8 @@ __ixp4xx_readl(const volatile void __iomem *p)
220 return data; 218 return data;
221} 219}
222 220
223static inline void 221static inline void __indirect_readsl(const volatile void __iomem *bus_addr,
224__ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count) 222 u32 *vaddr, u32 count)
225{ 223{
226 while (count--) 224 while (count--)
227 *vaddr++ = readl(bus_addr); 225 *vaddr++ = readl(bus_addr);
@@ -235,7 +233,7 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
235#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l)) 233#define memcpy_fromio(a,c,l) _memcpy_fromio((a),(c),(l))
236#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l)) 234#define memcpy_toio(c,a,l) _memcpy_toio((c),(a),(l))
237 235
238#endif 236#endif /* CONFIG_IXP4XX_INDIRECT_PCI */
239 237
240#ifndef CONFIG_PCI 238#ifndef CONFIG_PCI
241 239
@@ -250,25 +248,8 @@ __ixp4xx_readsl(const volatile void __iomem *bus_addr, u32 *vaddr, u32 count)
250 * transaction. This means that we need to override the default 248 * transaction. This means that we need to override the default
251 * I/O functions. 249 * I/O functions.
252 */ 250 */
253#define outb(p, v) __ixp4xx_outb(p, v)
254#define outw(p, v) __ixp4xx_outw(p, v)
255#define outl(p, v) __ixp4xx_outl(p, v)
256
257#define outsb(p, v, l) __ixp4xx_outsb(p, v, l)
258#define outsw(p, v, l) __ixp4xx_outsw(p, v, l)
259#define outsl(p, v, l) __ixp4xx_outsl(p, v, l)
260 251
261#define inb(p) __ixp4xx_inb(p) 252static inline void outb(u8 value, u32 addr)
262#define inw(p) __ixp4xx_inw(p)
263#define inl(p) __ixp4xx_inl(p)
264
265#define insb(p, v, l) __ixp4xx_insb(p, v, l)
266#define insw(p, v, l) __ixp4xx_insw(p, v, l)
267#define insl(p, v, l) __ixp4xx_insl(p, v, l)
268
269
270static inline void
271__ixp4xx_outb(u8 value, u32 addr)
272{ 253{
273 u32 n, byte_enables, data; 254 u32 n, byte_enables, data;
274 n = addr % 4; 255 n = addr % 4;
@@ -277,15 +258,13 @@ __ixp4xx_outb(u8 value, u32 addr)
277 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data); 258 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
278} 259}
279 260
280static inline void 261static inline void outsb(u32 io_addr, const u8 *vaddr, u32 count)
281__ixp4xx_outsb(u32 io_addr, const u8 *vaddr, u32 count)
282{ 262{
283 while (count--) 263 while (count--)
284 outb(*vaddr++, io_addr); 264 outb(*vaddr++, io_addr);
285} 265}
286 266
287static inline void 267static inline void outw(u16 value, u32 addr)
288__ixp4xx_outw(u16 value, u32 addr)
289{ 268{
290 u32 n, byte_enables, data; 269 u32 n, byte_enables, data;
291 n = addr % 4; 270 n = addr % 4;
@@ -294,28 +273,24 @@ __ixp4xx_outw(u16 value, u32 addr)
294 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data); 273 ixp4xx_pci_write(addr, byte_enables | NP_CMD_IOWRITE, data);
295} 274}
296 275
297static inline void 276static inline void outsw(u32 io_addr, const u16 *vaddr, u32 count)
298__ixp4xx_outsw(u32 io_addr, const u16 *vaddr, u32 count)
299{ 277{
300 while (count--) 278 while (count--)
301 outw(cpu_to_le16(*vaddr++), io_addr); 279 outw(cpu_to_le16(*vaddr++), io_addr);
302} 280}
303 281
304static inline void 282static inline void outl(u32 value, u32 addr)
305__ixp4xx_outl(u32 value, u32 addr)
306{ 283{
307 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value); 284 ixp4xx_pci_write(addr, NP_CMD_IOWRITE, value);
308} 285}
309 286
310static inline void 287static inline void outsl(u32 io_addr, const u32 *vaddr, u32 count)
311__ixp4xx_outsl(u32 io_addr, const u32 *vaddr, u32 count)
312{ 288{
313 while (count--) 289 while (count--)
314 outl(*vaddr++, io_addr); 290 outl(cpu_to_le32(*vaddr++), io_addr);
315} 291}
316 292
317static inline u8 293static inline u8 inb(u32 addr)
318__ixp4xx_inb(u32 addr)
319{ 294{
320 u32 n, byte_enables, data; 295 u32 n, byte_enables, data;
321 n = addr % 4; 296 n = addr % 4;
@@ -326,15 +301,13 @@ __ixp4xx_inb(u32 addr)
326 return data >> (8*n); 301 return data >> (8*n);
327} 302}
328 303
329static inline void 304static inline void insb(u32 io_addr, u8 *vaddr, u32 count)
330__ixp4xx_insb(u32 io_addr, u8 *vaddr, u32 count)
331{ 305{
332 while (count--) 306 while (count--)
333 *vaddr++ = inb(io_addr); 307 *vaddr++ = inb(io_addr);
334} 308}
335 309
336static inline u16 310static inline u16 inw(u32 addr)
337__ixp4xx_inw(u32 addr)
338{ 311{
339 u32 n, byte_enables, data; 312 u32 n, byte_enables, data;
340 n = addr % 4; 313 n = addr % 4;
@@ -345,15 +318,13 @@ __ixp4xx_inw(u32 addr)
345 return data>>(8*n); 318 return data>>(8*n);
346} 319}
347 320
348static inline void 321static inline void insw(u32 io_addr, u16 *vaddr, u32 count)
349__ixp4xx_insw(u32 io_addr, u16 *vaddr, u32 count)
350{ 322{
351 while (count--) 323 while (count--)
352 *vaddr++ = le16_to_cpu(inw(io_addr)); 324 *vaddr++ = le16_to_cpu(inw(io_addr));
353} 325}
354 326
355static inline u32 327static inline u32 inl(u32 addr)
356__ixp4xx_inl(u32 addr)
357{ 328{
358 u32 data; 329 u32 data;
359 if (ixp4xx_pci_read(addr, NP_CMD_IOREAD, &data)) 330 if (ixp4xx_pci_read(addr, NP_CMD_IOREAD, &data))
@@ -362,11 +333,10 @@ __ixp4xx_inl(u32 addr)
362 return data; 333 return data;
363} 334}
364 335
365static inline void 336static inline void insl(u32 io_addr, u32 *vaddr, u32 count)
366__ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count)
367{ 337{
368 while (count--) 338 while (count--)
369 *vaddr++ = inl(io_addr); 339 *vaddr++ = le32_to_cpu(inl(io_addr));
370} 340}
371 341
372#define PIO_OFFSET 0x10000UL 342#define PIO_OFFSET 0x10000UL
@@ -374,194 +344,183 @@ __ixp4xx_insl(u32 io_addr, u32 *vaddr, u32 count)
374 344
375#define __is_io_address(p) (((unsigned long)p >= PIO_OFFSET) && \ 345#define __is_io_address(p) (((unsigned long)p >= PIO_OFFSET) && \
376 ((unsigned long)p <= (PIO_MASK + PIO_OFFSET))) 346 ((unsigned long)p <= (PIO_MASK + PIO_OFFSET)))
377static inline unsigned int 347
378__ixp4xx_ioread8(const void __iomem *addr) 348#define ioread8(p) ioread8(p)
349static inline unsigned int ioread8(const void __iomem *addr)
379{ 350{
380 unsigned long port = (unsigned long __force)addr; 351 unsigned long port = (unsigned long __force)addr;
381 if (__is_io_address(port)) 352 if (__is_io_address(port))
382 return (unsigned int)__ixp4xx_inb(port & PIO_MASK); 353 return (unsigned int)inb(port & PIO_MASK);
383 else 354 else
384#ifndef CONFIG_IXP4XX_INDIRECT_PCI 355#ifndef CONFIG_IXP4XX_INDIRECT_PCI
385 return (unsigned int)__raw_readb(port); 356 return (unsigned int)__raw_readb(port);
386#else 357#else
387 return (unsigned int)__ixp4xx_readb(addr); 358 return (unsigned int)__indirect_readb(addr);
388#endif 359#endif
389} 360}
390 361
391static inline void 362#define ioread8_rep(p, v, c) ioread8_rep(p, v, c)
392__ixp4xx_ioread8_rep(const void __iomem *addr, void *vaddr, u32 count) 363static inline void ioread8_rep(const void __iomem *addr, void *vaddr, u32 count)
393{ 364{
394 unsigned long port = (unsigned long __force)addr; 365 unsigned long port = (unsigned long __force)addr;
395 if (__is_io_address(port)) 366 if (__is_io_address(port))
396 __ixp4xx_insb(port & PIO_MASK, vaddr, count); 367 insb(port & PIO_MASK, vaddr, count);
397 else 368 else
398#ifndef CONFIG_IXP4XX_INDIRECT_PCI 369#ifndef CONFIG_IXP4XX_INDIRECT_PCI
399 __raw_readsb(addr, vaddr, count); 370 __raw_readsb(addr, vaddr, count);
400#else 371#else
401 __ixp4xx_readsb(addr, vaddr, count); 372 __indirect_readsb(addr, vaddr, count);
402#endif 373#endif
403} 374}
404 375
405static inline unsigned int 376#define ioread16(p) ioread16(p)
406__ixp4xx_ioread16(const void __iomem *addr) 377static inline unsigned int ioread16(const void __iomem *addr)
407{ 378{
408 unsigned long port = (unsigned long __force)addr; 379 unsigned long port = (unsigned long __force)addr;
409 if (__is_io_address(port)) 380 if (__is_io_address(port))
410 return (unsigned int)__ixp4xx_inw(port & PIO_MASK); 381 return (unsigned int)inw(port & PIO_MASK);
411 else 382 else
412#ifndef CONFIG_IXP4XX_INDIRECT_PCI 383#ifndef CONFIG_IXP4XX_INDIRECT_PCI
413 return le16_to_cpu(__raw_readw((u32)port)); 384 return le16_to_cpu(__raw_readw((u32)port));
414#else 385#else
415 return (unsigned int)__ixp4xx_readw(addr); 386 return (unsigned int)__indirect_readw(addr);
416#endif 387#endif
417} 388}
418 389
419static inline void 390#define ioread16_rep(p, v, c) ioread16_rep(p, v, c)
420__ixp4xx_ioread16_rep(const void __iomem *addr, void *vaddr, u32 count) 391static inline void ioread16_rep(const void __iomem *addr, void *vaddr,
392 u32 count)
421{ 393{
422 unsigned long port = (unsigned long __force)addr; 394 unsigned long port = (unsigned long __force)addr;
423 if (__is_io_address(port)) 395 if (__is_io_address(port))
424 __ixp4xx_insw(port & PIO_MASK, vaddr, count); 396 insw(port & PIO_MASK, vaddr, count);
425 else 397 else
426#ifndef CONFIG_IXP4XX_INDIRECT_PCI 398#ifndef CONFIG_IXP4XX_INDIRECT_PCI
427 __raw_readsw(addr, vaddr, count); 399 __raw_readsw(addr, vaddr, count);
428#else 400#else
429 __ixp4xx_readsw(addr, vaddr, count); 401 __indirect_readsw(addr, vaddr, count);
430#endif 402#endif
431} 403}
432 404
433static inline unsigned int 405#define ioread32(p) ioread32(p)
434__ixp4xx_ioread32(const void __iomem *addr) 406static inline unsigned int ioread32(const void __iomem *addr)
435{ 407{
436 unsigned long port = (unsigned long __force)addr; 408 unsigned long port = (unsigned long __force)addr;
437 if (__is_io_address(port)) 409 if (__is_io_address(port))
438 return (unsigned int)__ixp4xx_inl(port & PIO_MASK); 410 return (unsigned int)inl(port & PIO_MASK);
439 else { 411 else {
440#ifndef CONFIG_IXP4XX_INDIRECT_PCI 412#ifndef CONFIG_IXP4XX_INDIRECT_PCI
441 return le32_to_cpu((__force __le32)__raw_readl(addr)); 413 return le32_to_cpu((__force __le32)__raw_readl(addr));
442#else 414#else
443 return (unsigned int)__ixp4xx_readl(addr); 415 return (unsigned int)__indirect_readl(addr);
444#endif 416#endif
445 } 417 }
446} 418}
447 419
448static inline void 420#define ioread32_rep(p, v, c) ioread32_rep(p, v, c)
449__ixp4xx_ioread32_rep(const void __iomem *addr, void *vaddr, u32 count) 421static inline void ioread32_rep(const void __iomem *addr, void *vaddr,
422 u32 count)
450{ 423{
451 unsigned long port = (unsigned long __force)addr; 424 unsigned long port = (unsigned long __force)addr;
452 if (__is_io_address(port)) 425 if (__is_io_address(port))
453 __ixp4xx_insl(port & PIO_MASK, vaddr, count); 426 insl(port & PIO_MASK, vaddr, count);
454 else 427 else
455#ifndef CONFIG_IXP4XX_INDIRECT_PCI 428#ifndef CONFIG_IXP4XX_INDIRECT_PCI
456 __raw_readsl(addr, vaddr, count); 429 __raw_readsl(addr, vaddr, count);
457#else 430#else
458 __ixp4xx_readsl(addr, vaddr, count); 431 __indirect_readsl(addr, vaddr, count);
459#endif 432#endif
460} 433}
461 434
462static inline void 435#define iowrite8(v, p) iowrite8(v, p)
463__ixp4xx_iowrite8(u8 value, void __iomem *addr) 436static inline void iowrite8(u8 value, void __iomem *addr)
464{ 437{
465 unsigned long port = (unsigned long __force)addr; 438 unsigned long port = (unsigned long __force)addr;
466 if (__is_io_address(port)) 439 if (__is_io_address(port))
467 __ixp4xx_outb(value, port & PIO_MASK); 440 outb(value, port & PIO_MASK);
468 else 441 else
469#ifndef CONFIG_IXP4XX_INDIRECT_PCI 442#ifndef CONFIG_IXP4XX_INDIRECT_PCI
470 __raw_writeb(value, port); 443 __raw_writeb(value, port);
471#else 444#else
472 __ixp4xx_writeb(value, addr); 445 __indirect_writeb(value, addr);
473#endif 446#endif
474} 447}
475 448
476static inline void 449#define iowrite8_rep(p, v, c) iowrite8_rep(p, v, c)
477__ixp4xx_iowrite8_rep(void __iomem *addr, const void *vaddr, u32 count) 450static inline void iowrite8_rep(void __iomem *addr, const void *vaddr,
451 u32 count)
478{ 452{
479 unsigned long port = (unsigned long __force)addr; 453 unsigned long port = (unsigned long __force)addr;
480 if (__is_io_address(port)) 454 if (__is_io_address(port))
481 __ixp4xx_outsb(port & PIO_MASK, vaddr, count); 455 outsb(port & PIO_MASK, vaddr, count);
482 else 456 else
483#ifndef CONFIG_IXP4XX_INDIRECT_PCI 457#ifndef CONFIG_IXP4XX_INDIRECT_PCI
484 __raw_writesb(addr, vaddr, count); 458 __raw_writesb(addr, vaddr, count);
485#else 459#else
486 __ixp4xx_writesb(addr, vaddr, count); 460 __indirect_writesb(addr, vaddr, count);
487#endif 461#endif
488} 462}
489 463
490static inline void 464#define iowrite16(v, p) iowrite16(v, p)
491__ixp4xx_iowrite16(u16 value, void __iomem *addr) 465static inline void iowrite16(u16 value, void __iomem *addr)
492{ 466{
493 unsigned long port = (unsigned long __force)addr; 467 unsigned long port = (unsigned long __force)addr;
494 if (__is_io_address(port)) 468 if (__is_io_address(port))
495 __ixp4xx_outw(value, port & PIO_MASK); 469 outw(value, port & PIO_MASK);
496 else 470 else
497#ifndef CONFIG_IXP4XX_INDIRECT_PCI 471#ifndef CONFIG_IXP4XX_INDIRECT_PCI
498 __raw_writew(cpu_to_le16(value), addr); 472 __raw_writew(cpu_to_le16(value), addr);
499#else 473#else
500 __ixp4xx_writew(value, addr); 474 __indirect_writew(value, addr);
501#endif 475#endif
502} 476}
503 477
504static inline void 478#define iowrite16_rep(p, v, c) iowrite16_rep(p, v, c)
505__ixp4xx_iowrite16_rep(void __iomem *addr, const void *vaddr, u32 count) 479static inline void iowrite16_rep(void __iomem *addr, const void *vaddr,
480 u32 count)
506{ 481{
507 unsigned long port = (unsigned long __force)addr; 482 unsigned long port = (unsigned long __force)addr;
508 if (__is_io_address(port)) 483 if (__is_io_address(port))
509 __ixp4xx_outsw(port & PIO_MASK, vaddr, count); 484 outsw(port & PIO_MASK, vaddr, count);
510 else 485 else
511#ifndef CONFIG_IXP4XX_INDIRECT_PCI 486#ifndef CONFIG_IXP4XX_INDIRECT_PCI
512 __raw_writesw(addr, vaddr, count); 487 __raw_writesw(addr, vaddr, count);
513#else 488#else
514 __ixp4xx_writesw(addr, vaddr, count); 489 __indirect_writesw(addr, vaddr, count);
515#endif 490#endif
516} 491}
517 492
518static inline void 493#define iowrite32(v, p) iowrite32(v, p)
519__ixp4xx_iowrite32(u32 value, void __iomem *addr) 494static inline void iowrite32(u32 value, void __iomem *addr)
520{ 495{
521 unsigned long port = (unsigned long __force)addr; 496 unsigned long port = (unsigned long __force)addr;
522 if (__is_io_address(port)) 497 if (__is_io_address(port))
523 __ixp4xx_outl(value, port & PIO_MASK); 498 outl(value, port & PIO_MASK);
524 else 499 else
525#ifndef CONFIG_IXP4XX_INDIRECT_PCI 500#ifndef CONFIG_IXP4XX_INDIRECT_PCI
526 __raw_writel((u32 __force)cpu_to_le32(value), addr); 501 __raw_writel((u32 __force)cpu_to_le32(value), addr);
527#else 502#else
528 __ixp4xx_writel(value, addr); 503 __indirect_writel(value, addr);
529#endif 504#endif
530} 505}
531 506
532static inline void 507#define iowrite32_rep(p, v, c) iowrite32_rep(p, v, c)
533__ixp4xx_iowrite32_rep(void __iomem *addr, const void *vaddr, u32 count) 508static inline void iowrite32_rep(void __iomem *addr, const void *vaddr,
509 u32 count)
534{ 510{
535 unsigned long port = (unsigned long __force)addr; 511 unsigned long port = (unsigned long __force)addr;
536 if (__is_io_address(port)) 512 if (__is_io_address(port))
537 __ixp4xx_outsl(port & PIO_MASK, vaddr, count); 513 outsl(port & PIO_MASK, vaddr, count);
538 else 514 else
539#ifndef CONFIG_IXP4XX_INDIRECT_PCI 515#ifndef CONFIG_IXP4XX_INDIRECT_PCI
540 __raw_writesl(addr, vaddr, count); 516 __raw_writesl(addr, vaddr, count);
541#else 517#else
542 __ixp4xx_writesl(addr, vaddr, count); 518 __indirect_writesl(addr, vaddr, count);
543#endif 519#endif
544} 520}
545 521
546#define ioread8(p) __ixp4xx_ioread8(p)
547#define ioread16(p) __ixp4xx_ioread16(p)
548#define ioread32(p) __ixp4xx_ioread32(p)
549
550#define ioread8_rep(p, v, c) __ixp4xx_ioread8_rep(p, v, c)
551#define ioread16_rep(p, v, c) __ixp4xx_ioread16_rep(p, v, c)
552#define ioread32_rep(p, v, c) __ixp4xx_ioread32_rep(p, v, c)
553
554#define iowrite8(v,p) __ixp4xx_iowrite8(v,p)
555#define iowrite16(v,p) __ixp4xx_iowrite16(v,p)
556#define iowrite32(v,p) __ixp4xx_iowrite32(v,p)
557
558#define iowrite8_rep(p, v, c) __ixp4xx_iowrite8_rep(p, v, c)
559#define iowrite16_rep(p, v, c) __ixp4xx_iowrite16_rep(p, v, c)
560#define iowrite32_rep(p, v, c) __ixp4xx_iowrite32_rep(p, v, c)
561
562#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET)) 522#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET))
563#define ioport_unmap(addr) 523#define ioport_unmap(addr)
564#endif // !CONFIG_PCI 524#endif /* CONFIG_PCI */
565
566#endif // __ASM_ARM_ARCH_IO_H
567 525
526#endif /* __ASM_ARM_ARCH_IO_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/irqs.h b/arch/arm/mach-ixp4xx/include/mach/irqs.h
index f4d74de1566a..7e6d4cce7c27 100644
--- a/arch/arm/mach-ixp4xx/include/mach/irqs.h
+++ b/arch/arm/mach-ixp4xx/include/mach/irqs.h
@@ -15,7 +15,6 @@
15#ifndef _ARCH_IXP4XX_IRQS_H_ 15#ifndef _ARCH_IXP4XX_IRQS_H_
16#define _ARCH_IXP4XX_IRQS_H_ 16#define _ARCH_IXP4XX_IRQS_H_
17 17
18
19#define IRQ_IXP4XX_NPEA 0 18#define IRQ_IXP4XX_NPEA 0
20#define IRQ_IXP4XX_NPEB 1 19#define IRQ_IXP4XX_NPEB 1
21#define IRQ_IXP4XX_NPEC 2 20#define IRQ_IXP4XX_NPEC 2
@@ -59,6 +58,9 @@
59#define IRQ_IXP4XX_MCU_ECC 61 58#define IRQ_IXP4XX_MCU_ECC 61
60#define IRQ_IXP4XX_EXP_PE 62 59#define IRQ_IXP4XX_EXP_PE 62
61 60
61#define _IXP4XX_GPIO_IRQ(n) (IRQ_IXP4XX_GPIO ## n)
62#define IXP4XX_GPIO_IRQ(n) _IXP4XX_GPIO_IRQ(n)
63
62/* 64/*
63 * Only first 32 sources are valid if running on IXP42x systems 65 * Only first 32 sources are valid if running on IXP42x systems
64 */ 66 */
@@ -70,69 +72,4 @@
70 72
71#define XSCALE_PMU_IRQ (IRQ_IXP4XX_XSCALE_PMU) 73#define XSCALE_PMU_IRQ (IRQ_IXP4XX_XSCALE_PMU)
72 74
73/*
74 * IXDP425 board IRQs
75 */
76#define IRQ_IXDP425_PCI_INTA IRQ_IXP4XX_GPIO11
77#define IRQ_IXDP425_PCI_INTB IRQ_IXP4XX_GPIO10
78#define IRQ_IXDP425_PCI_INTC IRQ_IXP4XX_GPIO9
79#define IRQ_IXDP425_PCI_INTD IRQ_IXP4XX_GPIO8
80
81/*
82 * Gateworks Avila board IRQs
83 */
84#define IRQ_AVILA_PCI_INTA IRQ_IXP4XX_GPIO11
85#define IRQ_AVILA_PCI_INTB IRQ_IXP4XX_GPIO10
86#define IRQ_AVILA_PCI_INTC IRQ_IXP4XX_GPIO9
87#define IRQ_AVILA_PCI_INTD IRQ_IXP4XX_GPIO8
88
89
90/*
91 * PrPMC1100 Board IRQs
92 */
93#define IRQ_PRPMC1100_PCI_INTA IRQ_IXP4XX_GPIO11
94#define IRQ_PRPMC1100_PCI_INTB IRQ_IXP4XX_GPIO10
95#define IRQ_PRPMC1100_PCI_INTC IRQ_IXP4XX_GPIO9
96#define IRQ_PRPMC1100_PCI_INTD IRQ_IXP4XX_GPIO8
97
98/*
99 * ADI Coyote Board IRQs
100 */
101#define IRQ_COYOTE_PCI_SLOT0 IRQ_IXP4XX_GPIO6
102#define IRQ_COYOTE_PCI_SLOT1 IRQ_IXP4XX_GPIO11
103#define IRQ_COYOTE_IDE IRQ_IXP4XX_GPIO5
104
105/*
106 * NSLU2 board IRQs
107 */
108#define IRQ_NSLU2_PCI_INTA IRQ_IXP4XX_GPIO11
109#define IRQ_NSLU2_PCI_INTB IRQ_IXP4XX_GPIO10
110#define IRQ_NSLU2_PCI_INTC IRQ_IXP4XX_GPIO9
111
112/*
113 * NAS100D board IRQs
114 */
115#define IRQ_NAS100D_PCI_INTA IRQ_IXP4XX_GPIO11
116#define IRQ_NAS100D_PCI_INTB IRQ_IXP4XX_GPIO10
117#define IRQ_NAS100D_PCI_INTC IRQ_IXP4XX_GPIO9
118#define IRQ_NAS100D_PCI_INTD IRQ_IXP4XX_GPIO8
119#define IRQ_NAS100D_PCI_INTE IRQ_IXP4XX_GPIO7
120
121/*
122 * D-Link DSM-G600 RevA board IRQs
123 */
124#define IRQ_DSMG600_PCI_INTA IRQ_IXP4XX_GPIO11
125#define IRQ_DSMG600_PCI_INTB IRQ_IXP4XX_GPIO10
126#define IRQ_DSMG600_PCI_INTC IRQ_IXP4XX_GPIO9
127#define IRQ_DSMG600_PCI_INTD IRQ_IXP4XX_GPIO8
128#define IRQ_DSMG600_PCI_INTE IRQ_IXP4XX_GPIO7
129#define IRQ_DSMG600_PCI_INTF IRQ_IXP4XX_GPIO6
130
131/*
132 * Freecom FSG-3 Board IRQs
133 */
134#define IRQ_FSG_PCI_INTA IRQ_IXP4XX_GPIO6
135#define IRQ_FSG_PCI_INTB IRQ_IXP4XX_GPIO7
136#define IRQ_FSG_PCI_INTC IRQ_IXP4XX_GPIO5
137
138#endif 75#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixdp425.h b/arch/arm/mach-ixp4xx/include/mach/ixdp425.h
deleted file mode 100644
index 2cafe65ebfee..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/ixdp425.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/ixdp425.h
3 *
4 * IXDP425 platform specific definitions
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista, Software, Inc.
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#ifndef __ASM_ARCH_HARDWARE_H__
16#error "Do not include this directly, instead #include <mach/hardware.h>"
17#endif
18
19#define IXDP425_SDA_PIN 7
20#define IXDP425_SCL_PIN 6
21
22/*
23 * IXDP425 PCI IRQs
24 */
25#define IXDP425_PCI_MAX_DEV 4
26#define IXDP425_PCI_IRQ_LINES 4
27
28
29/* PCI controller GPIO to IRQ pin mappings */
30#define IXDP425_PCI_INTA_PIN 11
31#define IXDP425_PCI_INTB_PIN 10
32#define IXDP425_PCI_INTC_PIN 9
33#define IXDP425_PCI_INTD_PIN 8
34
35/* NAND Flash pins */
36#define IXDP425_NAND_NCE_PIN 12
37
38#define IXDP425_NAND_CMD_BYTE 0x01
39#define IXDP425_NAND_ADDR_BYTE 0x02
diff --git a/arch/arm/mach-ixp4xx/include/mach/nas100d.h b/arch/arm/mach-ixp4xx/include/mach/nas100d.h
deleted file mode 100644
index 3771d62a9748..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/nas100d.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/nas100d.h
3 *
4 * NAS100D platform specific definitions
5 *
6 * Copyright (c) 2005 Tower Technologies
7 *
8 * Author: Alessandro Zummo <a.zummo@towertech.it>
9 *
10 * based on ixdp425.h:
11 * Copyright 2004 (c) MontaVista, Software, Inc.
12 *
13 * This file is licensed under the terms of the GNU General Public
14 * License version 2. This program is licensed "as is" without any
15 * warranty of any kind, whether express or implied.
16 */
17
18#ifndef __ASM_ARCH_HARDWARE_H__
19#error "Do not include this directly, instead #include <mach/hardware.h>"
20#endif
21
22#define NAS100D_SDA_PIN 5
23#define NAS100D_SCL_PIN 6
24
25/*
26 * NAS100D PCI IRQs
27 */
28#define NAS100D_PCI_MAX_DEV 3
29#define NAS100D_PCI_IRQ_LINES 3
30
31
32/* PCI controller GPIO to IRQ pin mappings */
33#define NAS100D_PCI_INTA_PIN 11
34#define NAS100D_PCI_INTB_PIN 10
35#define NAS100D_PCI_INTC_PIN 9
36#define NAS100D_PCI_INTD_PIN 8
37#define NAS100D_PCI_INTE_PIN 7
38
39/* Buttons */
40
41#define NAS100D_PB_GPIO 14 /* power button */
42#define NAS100D_RB_GPIO 4 /* reset button */
43
44/* Power control */
45
46#define NAS100D_PO_GPIO 12 /* power off */
47
48/* LEDs */
49
50#define NAS100D_LED_WLAN_GPIO 0
51#define NAS100D_LED_DISK_GPIO 3
52#define NAS100D_LED_PWR_GPIO 15
diff --git a/arch/arm/mach-ixp4xx/include/mach/npe.h b/arch/arm/mach-ixp4xx/include/mach/npe.h
index 37d0511689dc..e320db2457ae 100644
--- a/arch/arm/mach-ixp4xx/include/mach/npe.h
+++ b/arch/arm/mach-ixp4xx/include/mach/npe.h
@@ -33,7 +33,7 @@ int npe_send_message(struct npe *npe, const void *msg, const char *what);
33int npe_recv_message(struct npe *npe, void *msg, const char *what); 33int npe_recv_message(struct npe *npe, void *msg, const char *what);
34int npe_send_recv_message(struct npe *npe, void *msg, const char *what); 34int npe_send_recv_message(struct npe *npe, void *msg, const char *what);
35int npe_load_firmware(struct npe *npe, const char *name, struct device *dev); 35int npe_load_firmware(struct npe *npe, const char *name, struct device *dev);
36struct npe *npe_request(int id); 36struct npe *npe_request(unsigned id);
37void npe_release(struct npe *npe); 37void npe_release(struct npe *npe);
38 38
39#endif /* __IXP4XX_NPE_H */ 39#endif /* __IXP4XX_NPE_H */
diff --git a/arch/arm/mach-ixp4xx/include/mach/nslu2.h b/arch/arm/mach-ixp4xx/include/mach/nslu2.h
deleted file mode 100644
index 85d00adbfb92..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/nslu2.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/nslu2.h
3 *
4 * NSLU2 platform specific definitions
5 *
6 * Author: Mark Rakes <mrakes AT mac.com>
7 * Maintainers: http://www.nslu2-linux.org
8 *
9 * based on ixdp425.h:
10 * Copyright 2004 (c) MontaVista, Software, Inc.
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#ifndef __ASM_ARCH_HARDWARE_H__
18#error "Do not include this directly, instead #include <mach/hardware.h>"
19#endif
20
21#define NSLU2_SDA_PIN 7
22#define NSLU2_SCL_PIN 6
23
24/*
25 * NSLU2 PCI IRQs
26 */
27#define NSLU2_PCI_MAX_DEV 3
28#define NSLU2_PCI_IRQ_LINES 3
29
30
31/* PCI controller GPIO to IRQ pin mappings */
32#define NSLU2_PCI_INTA_PIN 11
33#define NSLU2_PCI_INTB_PIN 10
34#define NSLU2_PCI_INTC_PIN 9
35#define NSLU2_PCI_INTD_PIN 8
36
37/* NSLU2 Timer */
38#define NSLU2_FREQ 66000000
39
40/* Buttons */
41
42#define NSLU2_PB_GPIO 5 /* power button */
43#define NSLU2_PO_GPIO 8 /* power off */
44#define NSLU2_RB_GPIO 12 /* reset button */
45
46/* Buzzer */
47
48#define NSLU2_GPIO_BUZZ 4
49
50/* LEDs */
51
52#define NSLU2_LED_RED_GPIO 0
53#define NSLU2_LED_GRN_GPIO 1
54#define NSLU2_LED_DISK1_GPIO 3
55#define NSLU2_LED_DISK2_GPIO 2
diff --git a/arch/arm/mach-ixp4xx/include/mach/prpmc1100.h b/arch/arm/mach-ixp4xx/include/mach/prpmc1100.h
deleted file mode 100644
index 17274a2e3dec..000000000000
--- a/arch/arm/mach-ixp4xx/include/mach/prpmc1100.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * arch/arm/mach-ixp4xx/include/mach/prpmc1100.h
3 *
4 * Motorolla PrPMC1100 platform specific definitions
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2004 (c) MontaVista, Software, Inc.
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#ifndef __ASM_ARCH_HARDWARE_H__
16#error "Do not include this directly, instead #include <mach/hardware.h>"
17#endif
18
19#define PRPMC1100_FLASH_BASE IXP4XX_EXP_BUS_CS0_BASE_PHYS
20#define PRPMC1100_FLASH_SIZE IXP4XX_EXP_BUS_CSX_REGION_SIZE
21
22#define PRPMC1100_PCI_MIN_DEVID 10
23#define PRPMC1100_PCI_MAX_DEVID 16
24#define PRPMC1100_PCI_IRQ_LINES 4
25
26
27/* PCI controller GPIO to IRQ pin mappings */
28#define PRPMC1100_PCI_INTA_PIN 11
29#define PRPMC1100_PCI_INTB_PIN 10
30#define PRPMC1100_PCI_INTC_PIN 9
31#define PRPMC1100_PCI_INTD_PIN 8
32
33
diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-ixp4xx/include/mach/timex.h
index 89ce3ee84698..2c3f93c3eb79 100644
--- a/arch/arm/mach-ixp4xx/include/mach/timex.h
+++ b/arch/arm/mach-ixp4xx/include/mach/timex.h
@@ -10,6 +10,6 @@
10 * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the 10 * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the
11 * timer register ignores the bottom 2 bits of the LATCH value. 11 * timer register ignores the bottom 2 bits of the LATCH value.
12 */ 12 */
13#define FREQ 66666666 13#define FREQ 66666000
14#define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) 14#define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ)
15 15
diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c
index 64c29aacaac9..1ba165a6edac 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-ixp4xx/ixdp425-pci.c 2 * arch/arm/mach-ixp4xx/ixdp425-pci.c
3 * 3 *
4 * IXDP425 board-level PCI initialization 4 * IXDP425 board-level PCI initialization
5 * 5 *
@@ -19,39 +19,43 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22
23#include <asm/mach/pci.h> 22#include <asm/mach/pci.h>
24#include <asm/irq.h> 23#include <asm/irq.h>
25#include <mach/hardware.h> 24#include <mach/hardware.h>
26#include <asm/mach-types.h> 25#include <asm/mach-types.h>
27 26
27#define MAX_DEV 4
28#define IRQ_LINES 4
29
30/* PCI controller GPIO to IRQ pin mappings */
31#define INTA 11
32#define INTB 10
33#define INTC 9
34#define INTD 8
35
36
28void __init ixdp425_pci_preinit(void) 37void __init ixdp425_pci_preinit(void)
29{ 38{
30 set_irq_type(IRQ_IXDP425_PCI_INTA, IRQ_TYPE_LEVEL_LOW); 39 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
31 set_irq_type(IRQ_IXDP425_PCI_INTB, IRQ_TYPE_LEVEL_LOW); 40 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
32 set_irq_type(IRQ_IXDP425_PCI_INTC, IRQ_TYPE_LEVEL_LOW); 41 set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);
33 set_irq_type(IRQ_IXDP425_PCI_INTD, IRQ_TYPE_LEVEL_LOW); 42 set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);
34
35 ixp4xx_pci_preinit(); 43 ixp4xx_pci_preinit();
36} 44}
37 45
38static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 46static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
39{ 47{
40 static int pci_irq_table[IXDP425_PCI_IRQ_LINES] = { 48 static int pci_irq_table[IRQ_LINES] = {
41 IRQ_IXDP425_PCI_INTA, 49 IXP4XX_GPIO_IRQ(INTA),
42 IRQ_IXDP425_PCI_INTB, 50 IXP4XX_GPIO_IRQ(INTB),
43 IRQ_IXDP425_PCI_INTC, 51 IXP4XX_GPIO_IRQ(INTC),
44 IRQ_IXDP425_PCI_INTD 52 IXP4XX_GPIO_IRQ(INTD)
45 }; 53 };
46 54
47 int irq = -1; 55 if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
48 56 return pci_irq_table[(slot + pin - 2) % 4];
49 if (slot >= 1 && slot <= IXDP425_PCI_MAX_DEV &&
50 pin >= 1 && pin <= IXDP425_PCI_IRQ_LINES) {
51 irq = pci_irq_table[(slot + pin - 2) % 4];
52 }
53 57
54 return irq; 58 return -1;
55} 59}
56 60
57struct hw_pci ixdp425_pci __initdata = { 61struct hw_pci ixdp425_pci __initdata = {
@@ -72,4 +76,3 @@ int __init ixdp425_pci_init(void)
72} 76}
73 77
74subsys_initcall(ixdp425_pci_init); 78subsys_initcall(ixdp425_pci_init);
75
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index f4a0c1bc1331..bbb768988845 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/arm/mach-ixp4xx/ixdp425-setup.c 2 * arch/arm/mach-ixp4xx/ixdp425-setup.c
3 * 3 *
4 * IXDP425/IXCDP1100 board-setup 4 * IXDP425/IXCDP1100 board-setup
5 * 5 *
6 * Copyright (C) 2003-2005 MontaVista Software, Inc. 6 * Copyright (C) 2003-2005 MontaVista Software, Inc.
7 * 7 *
@@ -21,7 +21,6 @@
21#include <linux/mtd/nand.h> 21#include <linux/mtd/nand.h>
22#include <linux/mtd/partitions.h> 22#include <linux/mtd/partitions.h>
23#include <linux/delay.h> 23#include <linux/delay.h>
24
25#include <asm/types.h> 24#include <asm/types.h>
26#include <asm/setup.h> 25#include <asm/setup.h>
27#include <asm/memory.h> 26#include <asm/memory.h>
@@ -31,6 +30,15 @@
31#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
32#include <asm/mach/flash.h> 31#include <asm/mach/flash.h>
33 32
33#define IXDP425_SDA_PIN 7
34#define IXDP425_SCL_PIN 6
35
36/* NAND Flash pins */
37#define IXDP425_NAND_NCE_PIN 12
38
39#define IXDP425_NAND_CMD_BYTE 0x01
40#define IXDP425_NAND_ADDR_BYTE 0x02
41
34static struct flash_platform_data ixdp425_flash_data = { 42static struct flash_platform_data ixdp425_flash_data = {
35 .map_name = "cfi_probe", 43 .map_name = "cfi_probe",
36 .width = 2, 44 .width = 2,
diff --git a/arch/arm/mach-ixp4xx/ixp4xx_npe.c b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
index 47ac69c7ec78..e8bb25778166 100644
--- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c
+++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c
@@ -665,7 +665,7 @@ err:
665} 665}
666 666
667 667
668struct npe *npe_request(int id) 668struct npe *npe_request(unsigned id)
669{ 669{
670 if (id < NPE_COUNT) 670 if (id < NPE_COUNT)
671 if (npe_tab[id].valid) 671 if (npe_tab[id].valid)
diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c
index 1088426fdcee..d0cea34cf61e 100644
--- a/arch/arm/mach-ixp4xx/nas100d-pci.c
+++ b/arch/arm/mach-ixp4xx/nas100d-pci.c
@@ -18,37 +18,42 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21
22#include <asm/mach/pci.h> 21#include <asm/mach/pci.h>
23#include <asm/mach-types.h> 22#include <asm/mach-types.h>
24 23
24#define MAX_DEV 3
25#define IRQ_LINES 3
26
27/* PCI controller GPIO to IRQ pin mappings */
28#define INTA 11
29#define INTB 10
30#define INTC 9
31#define INTD 8
32#define INTE 7
33
25void __init nas100d_pci_preinit(void) 34void __init nas100d_pci_preinit(void)
26{ 35{
27 set_irq_type(IRQ_NAS100D_PCI_INTA, IRQ_TYPE_LEVEL_LOW); 36 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
28 set_irq_type(IRQ_NAS100D_PCI_INTB, IRQ_TYPE_LEVEL_LOW); 37 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
29 set_irq_type(IRQ_NAS100D_PCI_INTC, IRQ_TYPE_LEVEL_LOW); 38 set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);
30 set_irq_type(IRQ_NAS100D_PCI_INTD, IRQ_TYPE_LEVEL_LOW); 39 set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);
31 set_irq_type(IRQ_NAS100D_PCI_INTE, IRQ_TYPE_LEVEL_LOW); 40 set_irq_type(IXP4XX_GPIO_IRQ(INTE), IRQ_TYPE_LEVEL_LOW);
32
33 ixp4xx_pci_preinit(); 41 ixp4xx_pci_preinit();
34} 42}
35 43
36static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 44static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
37{ 45{
38 static int pci_irq_table[NAS100D_PCI_MAX_DEV][NAS100D_PCI_IRQ_LINES] = 46 static int pci_irq_table[MAX_DEV][IRQ_LINES] = {
39 { 47 { IXP4XX_GPIO_IRQ(INTA), -1, -1 },
40 { IRQ_NAS100D_PCI_INTA, -1, -1 }, 48 { IXP4XX_GPIO_IRQ(INTB), -1, -1 },
41 { IRQ_NAS100D_PCI_INTB, -1, -1 }, 49 { IXP4XX_GPIO_IRQ(INTC), IXP4XX_GPIO_IRQ(INTD),
42 { IRQ_NAS100D_PCI_INTC, IRQ_NAS100D_PCI_INTD, IRQ_NAS100D_PCI_INTE }, 50 IXP4XX_GPIO_IRQ(INTE) },
43 }; 51 };
44 52
45 int irq = -1; 53 if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
46 54 return pci_irq_table[slot - 1][pin - 1];
47 if (slot >= 1 && slot <= NAS100D_PCI_MAX_DEV &&
48 pin >= 1 && pin <= NAS100D_PCI_IRQ_LINES)
49 irq = pci_irq_table[slot-1][pin-1];
50 55
51 return irq; 56 return -1;
52} 57}
53 58
54struct hw_pci __initdata nas100d_pci = { 59struct hw_pci __initdata nas100d_pci = {
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 921c947b5b6b..e3ee880aa1e6 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -29,12 +29,26 @@
29#include <linux/i2c.h> 29#include <linux/i2c.h>
30#include <linux/i2c-gpio.h> 30#include <linux/i2c-gpio.h>
31#include <linux/io.h> 31#include <linux/io.h>
32
33#include <asm/mach-types.h> 32#include <asm/mach-types.h>
34#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
35#include <asm/mach/flash.h> 34#include <asm/mach/flash.h>
36#include <asm/gpio.h> 35#include <asm/gpio.h>
37 36
37#define NAS100D_SDA_PIN 5
38#define NAS100D_SCL_PIN 6
39
40/* Buttons */
41#define NAS100D_PB_GPIO 14 /* power button */
42#define NAS100D_RB_GPIO 4 /* reset button */
43
44/* Power control */
45#define NAS100D_PO_GPIO 12 /* power off */
46
47/* LEDs */
48#define NAS100D_LED_WLAN_GPIO 0
49#define NAS100D_LED_DISK_GPIO 3
50#define NAS100D_LED_PWR_GPIO 15
51
38static struct flash_platform_data nas100d_flash_data = { 52static struct flash_platform_data nas100d_flash_data = {
39 .map_name = "cfi_probe", 53 .map_name = "cfi_probe",
40 .width = 2, 54 .width = 2,
diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c
index 4429b8448b61..1eb5a90470bc 100644
--- a/arch/arm/mach-ixp4xx/nslu2-pci.c
+++ b/arch/arm/mach-ixp4xx/nslu2-pci.c
@@ -18,35 +18,38 @@
18#include <linux/pci.h> 18#include <linux/pci.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21
22#include <asm/mach/pci.h> 21#include <asm/mach/pci.h>
23#include <asm/mach-types.h> 22#include <asm/mach-types.h>
24 23
24#define MAX_DEV 3
25#define IRQ_LINES 3
26
27/* PCI controller GPIO to IRQ pin mappings */
28#define INTA 11
29#define INTB 10
30#define INTC 9
31#define INTD 8
32
25void __init nslu2_pci_preinit(void) 33void __init nslu2_pci_preinit(void)
26{ 34{
27 set_irq_type(IRQ_NSLU2_PCI_INTA, IRQ_TYPE_LEVEL_LOW); 35 set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
28 set_irq_type(IRQ_NSLU2_PCI_INTB, IRQ_TYPE_LEVEL_LOW); 36 set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
29 set_irq_type(IRQ_NSLU2_PCI_INTC, IRQ_TYPE_LEVEL_LOW); 37 set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);
30
31 ixp4xx_pci_preinit(); 38 ixp4xx_pci_preinit();
32} 39}
33 40
34static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 41static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
35{ 42{
36 static int pci_irq_table[NSLU2_PCI_IRQ_LINES] = { 43 static int pci_irq_table[IRQ_LINES] = {
37 IRQ_NSLU2_PCI_INTA, 44 IXP4XX_GPIO_IRQ(INTA),
38 IRQ_NSLU2_PCI_INTB, 45 IXP4XX_GPIO_IRQ(INTB),
39 IRQ_NSLU2_PCI_INTC, 46 IXP4XX_GPIO_IRQ(INTC),
40 }; 47 };
41 48
42 int irq = -1; 49 if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES)
43 50 return pci_irq_table[(slot + pin - 2) % IRQ_LINES];
44 if (slot >= 1 && slot <= NSLU2_PCI_MAX_DEV &&
45 pin >= 1 && pin <= NSLU2_PCI_IRQ_LINES) {
46 irq = pci_irq_table[(slot + pin - 2) % NSLU2_PCI_IRQ_LINES];
47 }
48 51
49 return irq; 52 return -1;
50} 53}
51 54
52struct hw_pci __initdata nslu2_pci = { 55struct hw_pci __initdata nslu2_pci = {
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index ff6a08d02cc4..c14e0034be4b 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -26,13 +26,32 @@
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/i2c-gpio.h> 27#include <linux/i2c-gpio.h>
28#include <linux/io.h> 28#include <linux/io.h>
29
30#include <asm/mach-types.h> 29#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
32#include <asm/mach/flash.h> 31#include <asm/mach/flash.h>
33#include <asm/mach/time.h> 32#include <asm/mach/time.h>
34#include <asm/gpio.h> 33#include <asm/gpio.h>
35 34
35#define NSLU2_SDA_PIN 7
36#define NSLU2_SCL_PIN 6
37
38/* NSLU2 Timer */
39#define NSLU2_FREQ 66000000
40
41/* Buttons */
42#define NSLU2_PB_GPIO 5 /* power button */
43#define NSLU2_PO_GPIO 8 /* power off */
44#define NSLU2_RB_GPIO 12 /* reset button */
45
46/* Buzzer */
47#define NSLU2_GPIO_BUZZ 4
48
49/* LEDs */
50#define NSLU2_LED_RED_GPIO 0
51#define NSLU2_LED_GRN_GPIO 1
52#define NSLU2_LED_DISK1_GPIO 3
53#define NSLU2_LED_DISK2_GPIO 2
54
36static struct flash_platform_data nslu2_flash_data = { 55static struct flash_platform_data nslu2_flash_data = {
37 .map_name = "cfi_probe", 56 .map_name = "cfi_probe",
38 .width = 2, 57 .width = 2,
diff --git a/arch/arm/mach-lh7a40x/clocks.c b/arch/arm/mach-lh7a40x/clocks.c
index 6182f5410b4d..fcaf876f19b6 100644
--- a/arch/arm/mach-lh7a40x/clocks.c
+++ b/arch/arm/mach-lh7a40x/clocks.c
@@ -7,8 +7,6 @@
7 * version 2 as published by the Free Software Foundation. 7 * version 2 as published by the Free Software Foundation.
8 * 8 *
9 */ 9 */
10
11#include <linux/cpufreq.h>
12#include <mach/hardware.h> 10#include <mach/hardware.h>
13#include <mach/clocks.h> 11#include <mach/clocks.h>
14#include <linux/err.h> 12#include <linux/err.h>
@@ -31,12 +29,6 @@ struct clk {
31#define HCLKDIV(c) (((c) >> 0) & 0x02) 29#define HCLKDIV(c) (((c) >> 0) & 0x02)
32#define PCLKDIV(c) (((c) >> 16) & 0x03) 30#define PCLKDIV(c) (((c) >> 16) & 0x03)
33 31
34unsigned int cpufreq_get (unsigned int cpu) /* in kHz */
35{
36 return fclkfreq_get ()/1000;
37}
38EXPORT_SYMBOL(cpufreq_get);
39
40unsigned int fclkfreq_get (void) 32unsigned int fclkfreq_get (void)
41{ 33{
42 unsigned int clkset = CSC_CLKSET; 34 unsigned int clkset = CSC_CLKSET;
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index d140abca690a..f780086befd7 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -3,6 +3,30 @@ if ARCH_MSM
3comment "MSM Board Type" 3comment "MSM Board Type"
4 depends on ARCH_MSM 4 depends on ARCH_MSM
5 5
6config MSM_DEBUG_UART
7 int
8 default 1 if MSM_DEBUG_UART1
9 default 2 if MSM_DEBUG_UART2
10 default 3 if MSM_DEBUG_UART3
11
12choice
13 prompt "Debug UART"
14
15 default MSM_DEBUG_UART_NONE
16
17 config MSM_DEBUG_UART_NONE
18 bool "None"
19
20 config MSM_DEBUG_UART1
21 bool "UART1"
22
23 config MSM_DEBUG_UART2
24 bool "UART2"
25
26 config MSM_DEBUG_UART3
27 bool "UART3"
28endchoice
29
6config MACH_HALIBUT 30config MACH_HALIBUT
7 depends on ARCH_MSM 31 depends on ARCH_MSM
8 default y 32 default y
@@ -10,4 +34,10 @@ config MACH_HALIBUT
10 help 34 help
11 Support for the Qualcomm SURF7201A eval board. 35 Support for the Qualcomm SURF7201A eval board.
12 36
37config MACH_TROUT
38 default y
39 bool "HTC Dream (aka trout)"
40 help
41 Support for the HTC Dream, T-Mobile G1, Android ADP1 devices.
42
13endif 43endif
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 1aa47001aa3b..91e6f5c95dc1 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -6,3 +6,4 @@ obj-y += clock.o clock-7x01a.o
6 6
7obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o 7obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o
8 8
9obj-$(CONFIG_MACH_TROUT) += board-dream.o
diff --git a/arch/arm/mach-msm/board-dream.c b/arch/arm/mach-msm/board-dream.c
new file mode 100644
index 000000000000..21afa8513168
--- /dev/null
+++ b/arch/arm/mach-msm/board-dream.c
@@ -0,0 +1,93 @@
1/* linux/arch/arm/mach-msm/board-dream.c
2 *
3 * Copyright (C) 2009 Google, Inc.
4 * Author: Brian Swetland <swetland@google.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/platform_device.h>
20
21#include <asm/mach-types.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24#include <asm/setup.h>
25
26#include <mach/board.h>
27#include <mach/hardware.h>
28#include <mach/msm_iomap.h>
29
30#include "devices.h"
31#include "board-dream.h"
32
33static struct platform_device *devices[] __initdata = {
34 &msm_device_uart3,
35 &msm_device_smd,
36 &msm_device_nand,
37 &msm_device_hsusb,
38 &msm_device_i2c,
39};
40
41extern struct sys_timer msm_timer;
42
43static void __init trout_init_irq(void)
44{
45 msm_init_irq();
46}
47
48static void __init trout_fixup(struct machine_desc *desc, struct tag *tags,
49 char **cmdline, struct meminfo *mi)
50{
51 mi->nr_banks = 1;
52 mi->bank[0].start = PHYS_OFFSET;
53 mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
54 mi->bank[0].size = (101*1024*1024);
55}
56
57static void __init trout_init(void)
58{
59 platform_add_devices(devices, ARRAY_SIZE(devices));
60}
61
62static struct map_desc trout_io_desc[] __initdata = {
63 {
64 .virtual = TROUT_CPLD_BASE,
65 .pfn = __phys_to_pfn(TROUT_CPLD_START),
66 .length = TROUT_CPLD_SIZE,
67 .type = MT_DEVICE_NONSHARED
68 }
69};
70
71static void __init trout_map_io(void)
72{
73 msm_map_common_io();
74 iotable_init(trout_io_desc, ARRAY_SIZE(trout_io_desc));
75
76#ifdef CONFIG_MSM_DEBUG_UART3
77 /* route UART3 to the "H2W" extended usb connector */
78 writeb(0x80, TROUT_CPLD_BASE + 0x00);
79#endif
80
81 msm_clock_init();
82}
83
84MACHINE_START(TROUT, "HTC Dream")
85 .phys_io = MSM_DEBUG_UART_PHYS,
86 .io_pg_offst = ((MSM_DEBUG_UART_BASE) >> 18) & 0xfffc,
87 .boot_params = 0x10000100,
88 .fixup = trout_fixup,
89 .map_io = trout_map_io,
90 .init_irq = trout_init_irq,
91 .init_machine = trout_init,
92 .timer = &msm_timer,
93MACHINE_END
diff --git a/arch/arm/mach-msm/board-dream.h b/arch/arm/mach-msm/board-dream.h
new file mode 100644
index 000000000000..4f345a5a0a61
--- /dev/null
+++ b/arch/arm/mach-msm/board-dream.h
@@ -0,0 +1,5 @@
1
2#define TROUT_CPLD_BASE 0xE8100000
3#define TROUT_CPLD_START 0x98000000
4#define TROUT_CPLD_SIZE SZ_4K
5
diff --git a/arch/arm/mach-msm/include/mach/debug-macro.S b/arch/arm/mach-msm/include/mach/debug-macro.S
index 1db3c97dbc49..d48747ebcd3d 100644
--- a/arch/arm/mach-msm/include/mach/debug-macro.S
+++ b/arch/arm/mach-msm/include/mach/debug-macro.S
@@ -14,15 +14,18 @@
14 * 14 *
15 */ 15 */
16 16
17
18
17#include <mach/hardware.h> 19#include <mach/hardware.h>
18#include <mach/msm_iomap.h> 20#include <mach/msm_iomap.h>
19 21
22#ifdef CONFIG_MSM_DEBUG_UART
20 .macro addruart,rx 23 .macro addruart,rx
21 @ see if the MMU is enabled and select appropriate base address 24 @ see if the MMU is enabled and select appropriate base address
22 mrc p15, 0, \rx, c1, c0 25 mrc p15, 0, \rx, c1, c0
23 tst \rx, #1 26 tst \rx, #1
24 ldreq \rx, =MSM_UART1_PHYS 27 ldreq \rx, =MSM_DEBUG_UART_PHYS
25 movne \rx, #0 28 ldrne \rx, =MSM_DEBUG_UART_BASE
26 .endm 29 .endm
27 30
28 .macro senduart,rd,rx 31 .macro senduart,rd,rx
@@ -32,13 +35,20 @@
32 35
33 .macro waituart,rd,rx 36 .macro waituart,rd,rx
34 @ wait for TX_READY 37 @ wait for TX_READY
35 teq \rx, #0 381001: ldr \rd, [\rx, #0x08]
36 bne 2f
371: ldr \rd, [\rx, #0x08]
38 tst \rd, #0x04 39 tst \rd, #0x04
39 beq 1b 40 beq 1001b
402: 41 .endm
42#else
43 .macro addruart,rx
44 .endm
45
46 .macro senduart,rd,rx
47 .endm
48
49 .macro waituart,rd,rx
41 .endm 50 .endm
51#endif
42 52
43 .macro busyuart,rd,rx 53 .macro busyuart,rd,rx
44 .endm 54 .endm
diff --git a/arch/arm/mach-msm/include/mach/mmc.h b/arch/arm/mach-msm/include/mach/mmc.h
new file mode 100644
index 000000000000..0ecf25426284
--- /dev/null
+++ b/arch/arm/mach-msm/include/mach/mmc.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/include/asm/mach/mmc.h
3 */
4#ifndef ASMARM_MACH_MMC_H
5#define ASMARM_MACH_MMC_H
6
7#include <linux/mmc/host.h>
8#include <linux/mmc/card.h>
9#include <linux/mmc/sdio_func.h>
10
11struct embedded_sdio_data {
12 struct sdio_cis cis;
13 struct sdio_cccr cccr;
14 struct sdio_embedded_func *funcs;
15 int num_funcs;
16};
17
18struct mmc_platform_data {
19 unsigned int ocr_mask; /* available voltages */
20 u32 (*translate_vdd)(struct device *, unsigned int);
21 unsigned int (*status)(struct device *);
22 struct embedded_sdio_data *embedded_sdio;
23 int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id);
24};
25
26#endif
diff --git a/arch/arm/mach-msm/include/mach/msm_iomap.h b/arch/arm/mach-msm/include/mach/msm_iomap.h
index 2f7b4c8620d9..9dae1a98c77a 100644
--- a/arch/arm/mach-msm/include/mach/msm_iomap.h
+++ b/arch/arm/mach-msm/include/mach/msm_iomap.h
@@ -84,6 +84,18 @@
84#define MSM_UART3_PHYS 0xA9C00000 84#define MSM_UART3_PHYS 0xA9C00000
85#define MSM_UART3_SIZE SZ_4K 85#define MSM_UART3_SIZE SZ_4K
86 86
87#ifdef CONFIG_MSM_DEBUG_UART
88#define MSM_DEBUG_UART_BASE 0xE1000000
89#if CONFIG_MSM_DEBUG_UART == 1
90#define MSM_DEBUG_UART_PHYS MSM_UART1_PHYS
91#elif CONFIG_MSM_DEBUG_UART == 2
92#define MSM_DEBUG_UART_PHYS MSM_UART2_PHYS
93#elif CONFIG_MSM_DEBUG_UART == 3
94#define MSM_DEBUG_UART_PHYS MSM_UART3_PHYS
95#endif
96#define MSM_DEBUG_UART_SIZE SZ_4K
97#endif
98
87#define MSM_SDC1_PHYS 0xA0400000 99#define MSM_SDC1_PHYS 0xA0400000
88#define MSM_SDC1_SIZE SZ_4K 100#define MSM_SDC1_SIZE SZ_4K
89 101
diff --git a/arch/arm/mach-msm/include/mach/uncompress.h b/arch/arm/mach-msm/include/mach/uncompress.h
index 026e8955ace9..d94292c29d8e 100644
--- a/arch/arm/mach-msm/include/mach/uncompress.h
+++ b/arch/arm/mach-msm/include/mach/uncompress.h
@@ -16,9 +16,16 @@
16#ifndef __ASM_ARCH_MSM_UNCOMPRESS_H 16#ifndef __ASM_ARCH_MSM_UNCOMPRESS_H
17 17
18#include "hardware.h" 18#include "hardware.h"
19#include "linux/io.h"
20#include "mach/msm_iomap.h"
19 21
20static void putc(int c) 22static void putc(int c)
21{ 23{
24#if defined(MSM_DEBUG_UART_PHYS)
25 unsigned base = MSM_DEBUG_UART_PHYS;
26 while (!(readl(base + 0x08) & 0x04)) ;
27 writel(c, base + 0x0c);
28#endif
22} 29}
23 30
24static inline void flush(void) 31static inline void flush(void)
diff --git a/arch/arm/mach-msm/io.c b/arch/arm/mach-msm/io.c
index 6e7692ff6f2c..1c5e7dac086f 100644
--- a/arch/arm/mach-msm/io.c
+++ b/arch/arm/mach-msm/io.c
@@ -42,6 +42,9 @@ static struct map_desc msm_io_desc[] __initdata = {
42 MSM_DEVICE(GPIO1), 42 MSM_DEVICE(GPIO1),
43 MSM_DEVICE(GPIO2), 43 MSM_DEVICE(GPIO2),
44 MSM_DEVICE(CLK_CTL), 44 MSM_DEVICE(CLK_CTL),
45#ifdef CONFIG_MSM_DEBUG_UART
46 MSM_DEVICE(DEBUG_UART),
47#endif
45 { 48 {
46 .virtual = (unsigned long) MSM_SHARED_RAM_BASE, 49 .virtual = (unsigned long) MSM_SHARED_RAM_BASE,
47 .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS), 50 .pfn = __phys_to_pfn(MSM_SHARED_RAM_PHYS),
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
index 87e539aa8ad9..9ce17f13d3f1 100644
--- a/arch/arm/mach-omap1/Makefile
+++ b/arch/arm/mach-omap1/Makefile
@@ -3,7 +3,8 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := io.o id.o sram.o clock.o irq.o mux.o serial.o devices.o 6obj-y := io.o id.o sram.o irq.o mux.o serial.o devices.o
7obj-y += clock.o clock_data.o opp_data.o
7 8
8obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 9obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
9 10
@@ -17,6 +18,9 @@ obj-$(CONFIG_PM) += pm.o sleep.o
17obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o 18obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox_mach.o
18mailbox_mach-objs := mailbox.o 19mailbox_mach-objs := mailbox.o
19 20
21i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
22obj-y += $(i2c-omap-m) $(i2c-omap-y)
23
20led-y := leds.o 24led-y := leds.o
21 25
22# Specific board support 26# Specific board support
@@ -48,3 +52,7 @@ led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
48led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o 52led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
49led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o 53led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
50obj-$(CONFIG_LEDS) += $(led-y) 54obj-$(CONFIG_LEDS) += $(led-y)
55
56ifneq ($(CONFIG_FB_OMAP),)
57obj-y += lcd_dma.o
58endif
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index f4b72c1654f5..7e70c3c08da6 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/nand.h> 19#include <linux/mtd/nand.h>
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <linux/input.h> 21#include <linux/input.h>
22#include <linux/smc91x.h>
22 23
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -30,7 +31,6 @@
30#include <mach/gpio.h> 31#include <mach/gpio.h>
31#include <plat/mux.h> 32#include <plat/mux.h>
32#include <plat/fpga.h> 33#include <plat/fpga.h>
33#include <plat/nand.h>
34#include <plat/keypad.h> 34#include <plat/keypad.h>
35#include <plat/common.h> 35#include <plat/common.h>
36#include <plat/board.h> 36#include <plat/board.h>
@@ -100,6 +100,12 @@ static int fsample_keymap[] = {
100 0 100 0
101}; 101};
102 102
103static struct smc91x_platdata smc91x_info = {
104 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
105 .leda = RPC_LED_100_10,
106 .ledb = RPC_LED_TX_RX,
107};
108
103static struct resource smc91x_resources[] = { 109static struct resource smc91x_resources[] = {
104 [0] = { 110 [0] = {
105 .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */ 111 .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */
@@ -167,8 +173,40 @@ static struct platform_device nor_device = {
167 .resource = &nor_resource, 173 .resource = &nor_resource,
168}; 174};
169 175
170static struct omap_nand_platform_data nand_data = { 176static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
171 .options = NAND_SAMSUNG_LP_OPTIONS, 177{
178 struct nand_chip *this = mtd->priv;
179 unsigned long mask;
180
181 if (cmd == NAND_CMD_NONE)
182 return;
183
184 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
185 if (ctrl & NAND_ALE)
186 mask |= 0x04;
187 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
188}
189
190#define FSAMPLE_NAND_RB_GPIO_PIN 62
191
192static int nand_dev_ready(struct mtd_info *mtd)
193{
194 return gpio_get_value(FSAMPLE_NAND_RB_GPIO_PIN);
195}
196
197static const char *part_probes[] = { "cmdlinepart", NULL };
198
199static struct platform_nand_data nand_data = {
200 .chip = {
201 .nr_chips = 1,
202 .chip_offset = 0,
203 .options = NAND_SAMSUNG_LP_OPTIONS,
204 .part_probe_types = part_probes,
205 },
206 .ctrl = {
207 .cmd_ctrl = nand_cmd_ctl,
208 .dev_ready = nand_dev_ready,
209 },
172}; 210};
173 211
174static struct resource nand_resource = { 212static struct resource nand_resource = {
@@ -178,7 +216,7 @@ static struct resource nand_resource = {
178}; 216};
179 217
180static struct platform_device nand_device = { 218static struct platform_device nand_device = {
181 .name = "omapnand", 219 .name = "gen_nand",
182 .id = 0, 220 .id = 0,
183 .dev = { 221 .dev = {
184 .platform_data = &nand_data, 222 .platform_data = &nand_data,
@@ -190,6 +228,9 @@ static struct platform_device nand_device = {
190static struct platform_device smc91x_device = { 228static struct platform_device smc91x_device = {
191 .name = "smc91x", 229 .name = "smc91x",
192 .id = 0, 230 .id = 0,
231 .dev = {
232 .platform_data = &smc91x_info,
233 },
193 .num_resources = ARRAY_SIZE(smc91x_resources), 234 .num_resources = ARRAY_SIZE(smc91x_resources),
194 .resource = smc91x_resources, 235 .resource = smc91x_resources,
195}; 236};
@@ -233,13 +274,6 @@ static struct platform_device *devices[] __initdata = {
233 &lcd_device, 274 &lcd_device,
234}; 275};
235 276
236#define P2_NAND_RB_GPIO_PIN 62
237
238static int nand_dev_ready(struct omap_nand_platform_data *data)
239{
240 return gpio_get_value(P2_NAND_RB_GPIO_PIN);
241}
242
243static struct omap_lcd_config fsample_lcd_config __initdata = { 277static struct omap_lcd_config fsample_lcd_config __initdata = {
244 .ctrl_name = "internal", 278 .ctrl_name = "internal",
245}; 279};
@@ -250,9 +284,9 @@ static struct omap_board_config_kernel fsample_config[] = {
250 284
251static void __init omap_fsample_init(void) 285static void __init omap_fsample_init(void)
252{ 286{
253 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0) 287 if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
254 BUG(); 288 BUG();
255 nand_data.dev_ready = nand_dev_ready; 289 gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
256 290
257 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 291 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
258 omap_cfg_reg(M8_1610_FLASH_CS2B_WE); 292 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 89ba8ec4bbf4..fa7cecea19f9 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -28,6 +28,7 @@
28#include <linux/mtd/partitions.h> 28#include <linux/mtd/partitions.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/i2c/tps65010.h> 30#include <linux/i2c/tps65010.h>
31#include <linux/smc91x.h>
31 32
32#include <mach/hardware.h> 33#include <mach/hardware.h>
33#include <asm/gpio.h> 34#include <asm/gpio.h>
@@ -40,7 +41,6 @@
40#include <plat/mux.h> 41#include <plat/mux.h>
41#include <plat/dma.h> 42#include <plat/dma.h>
42#include <plat/tc.h> 43#include <plat/tc.h>
43#include <plat/nand.h>
44#include <plat/irda.h> 44#include <plat/irda.h>
45#include <plat/usb.h> 45#include <plat/usb.h>
46#include <plat/keypad.h> 46#include <plat/keypad.h>
@@ -179,11 +179,43 @@ static struct mtd_partition h2_nand_partitions[] = {
179 }, 179 },
180}; 180};
181 181
182/* dip switches control NAND chip access: 8 bit, 16 bit, or neither */ 182static void h2_nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
183static struct omap_nand_platform_data h2_nand_data = { 183{
184 .options = NAND_SAMSUNG_LP_OPTIONS, 184 struct nand_chip *this = mtd->priv;
185 .parts = h2_nand_partitions, 185 unsigned long mask;
186 .nr_parts = ARRAY_SIZE(h2_nand_partitions), 186
187 if (cmd == NAND_CMD_NONE)
188 return;
189
190 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
191 if (ctrl & NAND_ALE)
192 mask |= 0x04;
193 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
194}
195
196#define H2_NAND_RB_GPIO_PIN 62
197
198static int h2_nand_dev_ready(struct mtd_info *mtd)
199{
200 return gpio_get_value(H2_NAND_RB_GPIO_PIN);
201}
202
203static const char *h2_part_probes[] = { "cmdlinepart", NULL };
204
205struct platform_nand_data h2_nand_platdata = {
206 .chip = {
207 .nr_chips = 1,
208 .chip_offset = 0,
209 .nr_partitions = ARRAY_SIZE(h2_nand_partitions),
210 .partitions = h2_nand_partitions,
211 .options = NAND_SAMSUNG_LP_OPTIONS,
212 .part_probe_types = h2_part_probes,
213 },
214 .ctrl = {
215 .cmd_ctrl = h2_nand_cmd_ctl,
216 .dev_ready = h2_nand_dev_ready,
217
218 },
187}; 219};
188 220
189static struct resource h2_nand_resource = { 221static struct resource h2_nand_resource = {
@@ -191,15 +223,21 @@ static struct resource h2_nand_resource = {
191}; 223};
192 224
193static struct platform_device h2_nand_device = { 225static struct platform_device h2_nand_device = {
194 .name = "omapnand", 226 .name = "gen_nand",
195 .id = 0, 227 .id = 0,
196 .dev = { 228 .dev = {
197 .platform_data = &h2_nand_data, 229 .platform_data = &h2_nand_platdata,
198 }, 230 },
199 .num_resources = 1, 231 .num_resources = 1,
200 .resource = &h2_nand_resource, 232 .resource = &h2_nand_resource,
201}; 233};
202 234
235static struct smc91x_platdata h2_smc91x_info = {
236 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
237 .leda = RPC_LED_100_10,
238 .ledb = RPC_LED_TX_RX,
239};
240
203static struct resource h2_smc91x_resources[] = { 241static struct resource h2_smc91x_resources[] = {
204 [0] = { 242 [0] = {
205 .start = OMAP1610_ETHR_START, /* Physical */ 243 .start = OMAP1610_ETHR_START, /* Physical */
@@ -216,6 +254,9 @@ static struct resource h2_smc91x_resources[] = {
216static struct platform_device h2_smc91x_device = { 254static struct platform_device h2_smc91x_device = {
217 .name = "smc91x", 255 .name = "smc91x",
218 .id = 0, 256 .id = 0,
257 .dev = {
258 .platform_data = &h2_smc91x_info,
259 },
219 .num_resources = ARRAY_SIZE(h2_smc91x_resources), 260 .num_resources = ARRAY_SIZE(h2_smc91x_resources),
220 .resource = h2_smc91x_resources, 261 .resource = h2_smc91x_resources,
221}; 262};
@@ -368,8 +409,6 @@ static struct omap_board_config_kernel h2_config[] __initdata = {
368 { OMAP_TAG_LCD, &h2_lcd_config }, 409 { OMAP_TAG_LCD, &h2_lcd_config },
369}; 410};
370 411
371#define H2_NAND_RB_GPIO_PIN 62
372
373static void __init h2_init(void) 412static void __init h2_init(void)
374{ 413{
375 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 414 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index f5cc0a730524..6a7f9c391cf1 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -28,6 +28,7 @@
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/spi/spi.h> 29#include <linux/spi/spi.h>
30#include <linux/i2c/tps65010.h> 30#include <linux/i2c/tps65010.h>
31#include <linux/smc91x.h>
31 32
32#include <asm/setup.h> 33#include <asm/setup.h>
33#include <asm/page.h> 34#include <asm/page.h>
@@ -42,7 +43,6 @@
42#include <mach/irqs.h> 43#include <mach/irqs.h>
43#include <plat/mux.h> 44#include <plat/mux.h>
44#include <plat/tc.h> 45#include <plat/tc.h>
45#include <plat/nand.h>
46#include <plat/usb.h> 46#include <plat/usb.h>
47#include <plat/keypad.h> 47#include <plat/keypad.h>
48#include <plat/dma.h> 48#include <plat/dma.h>
@@ -181,11 +181,43 @@ static struct mtd_partition nand_partitions[] = {
181 }, 181 },
182}; 182};
183 183
184/* dip switches control NAND chip access: 8 bit, 16 bit, or neither */ 184static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
185static struct omap_nand_platform_data nand_data = { 185{
186 .options = NAND_SAMSUNG_LP_OPTIONS, 186 struct nand_chip *this = mtd->priv;
187 .parts = nand_partitions, 187 unsigned long mask;
188 .nr_parts = ARRAY_SIZE(nand_partitions), 188
189 if (cmd == NAND_CMD_NONE)
190 return;
191
192 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
193 if (ctrl & NAND_ALE)
194 mask |= 0x04;
195 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
196}
197
198#define H3_NAND_RB_GPIO_PIN 10
199
200static int nand_dev_ready(struct mtd_info *mtd)
201{
202 return gpio_get_value(H3_NAND_RB_GPIO_PIN);
203}
204
205static const char *part_probes[] = { "cmdlinepart", NULL };
206
207struct platform_nand_data nand_platdata = {
208 .chip = {
209 .nr_chips = 1,
210 .chip_offset = 0,
211 .nr_partitions = ARRAY_SIZE(nand_partitions),
212 .partitions = nand_partitions,
213 .options = NAND_SAMSUNG_LP_OPTIONS,
214 .part_probe_types = part_probes,
215 },
216 .ctrl = {
217 .cmd_ctrl = nand_cmd_ctl,
218 .dev_ready = nand_dev_ready,
219
220 },
189}; 221};
190 222
191static struct resource nand_resource = { 223static struct resource nand_resource = {
@@ -193,15 +225,21 @@ static struct resource nand_resource = {
193}; 225};
194 226
195static struct platform_device nand_device = { 227static struct platform_device nand_device = {
196 .name = "omapnand", 228 .name = "gen_nand",
197 .id = 0, 229 .id = 0,
198 .dev = { 230 .dev = {
199 .platform_data = &nand_data, 231 .platform_data = &nand_platdata,
200 }, 232 },
201 .num_resources = 1, 233 .num_resources = 1,
202 .resource = &nand_resource, 234 .resource = &nand_resource,
203}; 235};
204 236
237static struct smc91x_platdata smc91x_info = {
238 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
239 .leda = RPC_LED_100_10,
240 .ledb = RPC_LED_TX_RX,
241};
242
205static struct resource smc91x_resources[] = { 243static struct resource smc91x_resources[] = {
206 [0] = { 244 [0] = {
207 .start = OMAP1710_ETHR_START, /* Physical */ 245 .start = OMAP1710_ETHR_START, /* Physical */
@@ -218,6 +256,9 @@ static struct resource smc91x_resources[] = {
218static struct platform_device smc91x_device = { 256static struct platform_device smc91x_device = {
219 .name = "smc91x", 257 .name = "smc91x",
220 .id = 0, 258 .id = 0,
259 .dev = {
260 .platform_data = &smc91x_info,
261 },
221 .num_resources = ARRAY_SIZE(smc91x_resources), 262 .num_resources = ARRAY_SIZE(smc91x_resources),
222 .resource = smc91x_resources, 263 .resource = smc91x_resources,
223}; 264};
@@ -332,13 +373,6 @@ static struct i2c_board_info __initdata h3_i2c_board_info[] = {
332 }, 373 },
333}; 374};
334 375
335#define H3_NAND_RB_GPIO_PIN 10
336
337static int nand_dev_ready(struct omap_nand_platform_data *data)
338{
339 return gpio_get_value(H3_NAND_RB_GPIO_PIN);
340}
341
342static void __init h3_init(void) 376static void __init h3_init(void)
343{ 377{
344 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped 378 /* Here we assume the NOR boot config: NOR on CS3 (possibly swapped
@@ -356,7 +390,7 @@ static void __init h3_init(void)
356 nand_resource.end += SZ_4K - 1; 390 nand_resource.end += SZ_4K - 1;
357 if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0) 391 if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0)
358 BUG(); 392 BUG();
359 nand_data.dev_ready = nand_dev_ready; 393 gpio_direction_input(H3_NAND_RB_GPIO_PIN);
360 394
361 /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */ 395 /* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */
362 /* GPIO10 pullup/down register, Enable pullup on GPIO10 */ 396 /* GPIO10 pullup/down register, Enable pullup on GPIO10 */
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 5f28a5ceacac..e36639f66150 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -39,6 +39,7 @@
39#include <plat/common.h> 39#include <plat/common.h>
40#include <plat/board.h> 40#include <plat/board.h>
41#include <plat/keypad.h> 41#include <plat/keypad.h>
42#include <plat/usb.h>
42 43
43#include <mach/irqs.h> 44#include <mach/irqs.h>
44 45
@@ -140,6 +141,15 @@ static struct platform_device kp_device = {
140 .resource = kp_resources, 141 .resource = kp_resources,
141}; 142};
142 143
144/* USB Device */
145static struct omap_usb_config htcherald_usb_config __initdata = {
146 .otg = 0,
147 .register_host = 0,
148 .register_dev = 1,
149 .hmc_mode = 4,
150 .pins[0] = 2,
151};
152
143/* LCD Device resources */ 153/* LCD Device resources */
144static struct platform_device lcd_device = { 154static struct platform_device lcd_device = {
145 .name = "lcd_htcherald", 155 .name = "lcd_htcherald",
@@ -214,6 +224,57 @@ static void __init htcherald_disable_watchdog(void)
214 } 224 }
215} 225}
216 226
227#define HTCHERALD_GPIO_USB_EN1 33
228#define HTCHERALD_GPIO_USB_EN2 73
229#define HTCHERALD_GPIO_USB_DM 35
230#define HTCHERALD_GPIO_USB_DP 36
231
232static void __init htcherald_usb_enable(void)
233{
234 unsigned int tries = 20;
235 unsigned int value = 0;
236
237 /* Request the GPIOs we need to control here */
238 if (gpio_request(HTCHERALD_GPIO_USB_EN1, "herald_usb") < 0)
239 goto err1;
240
241 if (gpio_request(HTCHERALD_GPIO_USB_EN2, "herald_usb") < 0)
242 goto err2;
243
244 if (gpio_request(HTCHERALD_GPIO_USB_DM, "herald_usb") < 0)
245 goto err3;
246
247 if (gpio_request(HTCHERALD_GPIO_USB_DP, "herald_usb") < 0)
248 goto err4;
249
250 /* force USB_EN GPIO to 0 */
251 do {
252 /* output low */
253 gpio_direction_output(HTCHERALD_GPIO_USB_EN1, 0);
254 } while ((value = gpio_get_value(HTCHERALD_GPIO_USB_EN1)) == 1 &&
255 --tries);
256
257 if (value == 1)
258 printk(KERN_WARNING "Unable to reset USB, trying to continue\n");
259
260 gpio_direction_output(HTCHERALD_GPIO_USB_EN2, 0); /* output low */
261 gpio_direction_input(HTCHERALD_GPIO_USB_DM); /* input */
262 gpio_direction_input(HTCHERALD_GPIO_USB_DP); /* input */
263
264 goto done;
265
266err4:
267 gpio_free(HTCHERALD_GPIO_USB_DM);
268err3:
269 gpio_free(HTCHERALD_GPIO_USB_EN2);
270err2:
271 gpio_free(HTCHERALD_GPIO_USB_EN1);
272err1:
273 printk(KERN_ERR "Unabled to request GPIO for USB\n");
274done:
275 printk(KERN_INFO "USB setup complete.\n");
276}
277
217static void __init htcherald_init(void) 278static void __init htcherald_init(void)
218{ 279{
219 printk(KERN_INFO "HTC Herald init.\n"); 280 printk(KERN_INFO "HTC Herald init.\n");
@@ -225,6 +286,9 @@ static void __init htcherald_init(void)
225 platform_add_devices(devices, ARRAY_SIZE(devices)); 286 platform_add_devices(devices, ARRAY_SIZE(devices));
226 287
227 htcherald_disable_watchdog(); 288 htcherald_disable_watchdog();
289
290 htcherald_usb_enable();
291 omap_usb_init(&htcherald_usb_config);
228} 292}
229 293
230static void __init htcherald_init_irq(void) 294static void __init htcherald_init_irq(void)
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index cf0fdb9c182f..2133b006f6a3 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -23,6 +23,7 @@
23#include <linux/mtd/mtd.h> 23#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h> 24#include <linux/mtd/partitions.h>
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/smc91x.h>
26 27
27#include <mach/hardware.h> 28#include <mach/hardware.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -142,6 +143,11 @@ static struct platform_device innovator_kp_device = {
142 .resource = innovator_kp_resources, 143 .resource = innovator_kp_resources,
143}; 144};
144 145
146static struct smc91x_platdata innovator_smc91x_info = {
147 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
148 .leda = RPC_LED_100_10,
149 .ledb = RPC_LED_TX_RX,
150};
145 151
146#ifdef CONFIG_ARCH_OMAP15XX 152#ifdef CONFIG_ARCH_OMAP15XX
147 153
@@ -175,6 +181,9 @@ static struct resource innovator1510_smc91x_resources[] = {
175static struct platform_device innovator1510_smc91x_device = { 181static struct platform_device innovator1510_smc91x_device = {
176 .name = "smc91x", 182 .name = "smc91x",
177 .id = 0, 183 .id = 0,
184 .dev = {
185 .platform_data = &innovator_smc91x_info,
186 },
178 .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources), 187 .num_resources = ARRAY_SIZE(innovator1510_smc91x_resources),
179 .resource = innovator1510_smc91x_resources, 188 .resource = innovator1510_smc91x_resources,
180}; 189};
@@ -241,6 +250,9 @@ static struct resource innovator1610_smc91x_resources[] = {
241static struct platform_device innovator1610_smc91x_device = { 250static struct platform_device innovator1610_smc91x_device = {
242 .name = "smc91x", 251 .name = "smc91x",
243 .id = 0, 252 .id = 0,
253 .dev = {
254 .platform_data = &innovator_smc91x_info,
255 },
244 .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources), 256 .num_resources = ARRAY_SIZE(innovator1610_smc91x_resources),
245 .resource = innovator1610_smc91x_resources, 257 .resource = innovator1610_smc91x_resources,
246}; 258};
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 5a275bab2dfe..71e1a3fad0ea 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -14,6 +14,7 @@
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/input.h> 15#include <linux/input.h>
16#include <linux/clk.h> 16#include <linux/clk.h>
17#include <linux/omapfb.h>
17 18
18#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
19#include <linux/spi/ads7846.h> 20#include <linux/spi/ads7846.h>
@@ -32,7 +33,6 @@
32#include <plat/keypad.h> 33#include <plat/keypad.h>
33#include <plat/common.h> 34#include <plat/common.h>
34#include <plat/dsp_common.h> 35#include <plat/dsp_common.h>
35#include <plat/omapfb.h>
36#include <plat/hwa742.h> 36#include <plat/hwa742.h>
37#include <plat/lcd_mipid.h> 37#include <plat/lcd_mipid.h>
38#include <plat/mmc.h> 38#include <plat/mmc.h>
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 50c92c13e48a..ccea4f448e9a 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -33,6 +33,7 @@
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/i2c.h> 34#include <linux/i2c.h>
35#include <linux/leds.h> 35#include <linux/leds.h>
36#include <linux/smc91x.h>
36 37
37#include <linux/mtd/mtd.h> 38#include <linux/mtd/mtd.h>
38#include <linux/mtd/partitions.h> 39#include <linux/mtd/partitions.h>
@@ -115,6 +116,12 @@ static struct platform_device osk5912_flash_device = {
115 .resource = &osk_flash_resource, 116 .resource = &osk_flash_resource,
116}; 117};
117 118
119static struct smc91x_platdata osk5912_smc91x_info = {
120 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
121 .leda = RPC_LED_100_10,
122 .ledb = RPC_LED_TX_RX,
123};
124
118static struct resource osk5912_smc91x_resources[] = { 125static struct resource osk5912_smc91x_resources[] = {
119 [0] = { 126 [0] = {
120 .start = OMAP_OSK_ETHR_START, /* Physical */ 127 .start = OMAP_OSK_ETHR_START, /* Physical */
@@ -131,6 +138,9 @@ static struct resource osk5912_smc91x_resources[] = {
131static struct platform_device osk5912_smc91x_device = { 138static struct platform_device osk5912_smc91x_device = {
132 .name = "smc91x", 139 .name = "smc91x",
133 .id = -1, 140 .id = -1,
141 .dev = {
142 .platform_data = &osk5912_smc91x_info,
143 },
134 .num_resources = ARRAY_SIZE(osk5912_smc91x_resources), 144 .num_resources = ARRAY_SIZE(osk5912_smc91x_resources),
135 .resource = osk5912_smc91x_resources, 145 .resource = osk5912_smc91x_resources,
136}; 146};
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index ca7df1e93efc..1387a4f15da9 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -19,6 +19,7 @@
19#include <linux/mtd/nand.h> 19#include <linux/mtd/nand.h>
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <linux/input.h> 21#include <linux/input.h>
22#include <linux/smc91x.h>
22 23
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -30,7 +31,6 @@
30#include <mach/gpio.h> 31#include <mach/gpio.h>
31#include <plat/mux.h> 32#include <plat/mux.h>
32#include <plat/fpga.h> 33#include <plat/fpga.h>
33#include <plat/nand.h>
34#include <plat/keypad.h> 34#include <plat/keypad.h>
35#include <plat/common.h> 35#include <plat/common.h>
36#include <plat/board.h> 36#include <plat/board.h>
@@ -67,6 +67,12 @@ static int p2_keymap[] = {
67 0 67 0
68}; 68};
69 69
70static struct smc91x_platdata smc91x_info = {
71 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
72 .leda = RPC_LED_100_10,
73 .ledb = RPC_LED_TX_RX,
74};
75
70static struct resource smc91x_resources[] = { 76static struct resource smc91x_resources[] = {
71 [0] = { 77 [0] = {
72 .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */ 78 .start = H2P2_DBG_FPGA_ETHR_START, /* Physical */
@@ -134,8 +140,40 @@ static struct platform_device nor_device = {
134 .resource = &nor_resource, 140 .resource = &nor_resource,
135}; 141};
136 142
137static struct omap_nand_platform_data nand_data = { 143static void nand_cmd_ctl(struct mtd_info *mtd, int cmd, unsigned int ctrl)
138 .options = NAND_SAMSUNG_LP_OPTIONS, 144{
145 struct nand_chip *this = mtd->priv;
146 unsigned long mask;
147
148 if (cmd == NAND_CMD_NONE)
149 return;
150
151 mask = (ctrl & NAND_CLE) ? 0x02 : 0;
152 if (ctrl & NAND_ALE)
153 mask |= 0x04;
154 writeb(cmd, (unsigned long)this->IO_ADDR_W | mask);
155}
156
157#define P2_NAND_RB_GPIO_PIN 62
158
159static int nand_dev_ready(struct mtd_info *mtd)
160{
161 return gpio_get_value(P2_NAND_RB_GPIO_PIN);
162}
163
164static const char *part_probes[] = { "cmdlinepart", NULL };
165
166static struct platform_nand_data nand_data = {
167 .chip = {
168 .nr_chips = 1,
169 .chip_offset = 0,
170 .options = NAND_SAMSUNG_LP_OPTIONS,
171 .part_probe_types = part_probes,
172 },
173 .ctrl = {
174 .cmd_ctrl = nand_cmd_ctl,
175 .dev_ready = nand_dev_ready,
176 },
139}; 177};
140 178
141static struct resource nand_resource = { 179static struct resource nand_resource = {
@@ -145,7 +183,7 @@ static struct resource nand_resource = {
145}; 183};
146 184
147static struct platform_device nand_device = { 185static struct platform_device nand_device = {
148 .name = "omapnand", 186 .name = "gen_nand",
149 .id = 0, 187 .id = 0,
150 .dev = { 188 .dev = {
151 .platform_data = &nand_data, 189 .platform_data = &nand_data,
@@ -157,6 +195,9 @@ static struct platform_device nand_device = {
157static struct platform_device smc91x_device = { 195static struct platform_device smc91x_device = {
158 .name = "smc91x", 196 .name = "smc91x",
159 .id = 0, 197 .id = 0,
198 .dev = {
199 .platform_data = &smc91x_info,
200 },
160 .num_resources = ARRAY_SIZE(smc91x_resources), 201 .num_resources = ARRAY_SIZE(smc91x_resources),
161 .resource = smc91x_resources, 202 .resource = smc91x_resources,
162}; 203};
@@ -201,13 +242,6 @@ static struct platform_device *devices[] __initdata = {
201 &lcd_device, 242 &lcd_device,
202}; 243};
203 244
204#define P2_NAND_RB_GPIO_PIN 62
205
206static int nand_dev_ready(struct omap_nand_platform_data *data)
207{
208 return gpio_get_value(P2_NAND_RB_GPIO_PIN);
209}
210
211static struct omap_lcd_config perseus2_lcd_config __initdata = { 245static struct omap_lcd_config perseus2_lcd_config __initdata = {
212 .ctrl_name = "internal", 246 .ctrl_name = "internal",
213}; 247};
@@ -220,7 +254,7 @@ static void __init omap_perseus2_init(void)
220{ 254{
221 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0) 255 if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
222 BUG(); 256 BUG();
223 nand_data.dev_ready = nand_dev_ready; 257 gpio_direction_input(P2_NAND_RB_GPIO_PIN);
224 258
225 omap_cfg_reg(L3_1610_FLASH_CS2B_OE); 259 omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
226 omap_cfg_reg(M8_1610_FLASH_CS2B_WE); 260 omap_cfg_reg(M8_1610_FLASH_CS2B_WE);
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 35c75c1bd0aa..169183537997 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -22,6 +22,7 @@
22#include <linux/reboot.h> 22#include <linux/reboot.h>
23#include <linux/serial_8250.h> 23#include <linux/serial_8250.h>
24#include <linux/serial_reg.h> 24#include <linux/serial_reg.h>
25#include <linux/smc91x.h>
25 26
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <asm/mach-types.h> 28#include <asm/mach-types.h>
@@ -106,6 +107,12 @@ static struct platform_device voiceblue_flash_device = {
106 .resource = &voiceblue_flash_resource, 107 .resource = &voiceblue_flash_resource,
107}; 108};
108 109
110static struct smc91x_platdata voiceblue_smc91x_info = {
111 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
112 .leda = RPC_LED_100_10,
113 .ledb = RPC_LED_TX_RX,
114};
115
109static struct resource voiceblue_smc91x_resources[] = { 116static struct resource voiceblue_smc91x_resources[] = {
110 [0] = { 117 [0] = {
111 .start = OMAP_CS2_PHYS + 0x300, 118 .start = OMAP_CS2_PHYS + 0x300,
@@ -122,6 +129,9 @@ static struct resource voiceblue_smc91x_resources[] = {
122static struct platform_device voiceblue_smc91x_device = { 129static struct platform_device voiceblue_smc91x_device = {
123 .name = "smc91x", 130 .name = "smc91x",
124 .id = 0, 131 .id = 0,
132 .dev = {
133 .platform_data = &voiceblue_smc91x_info,
134 },
125 .num_resources = ARRAY_SIZE(voiceblue_smc91x_resources), 135 .num_resources = ARRAY_SIZE(voiceblue_smc91x_resources),
126 .resource = voiceblue_smc91x_resources, 136 .resource = voiceblue_smc91x_resources,
127}; 137};
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 42cbe203da36..2ba9ab953731 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-omap1/clock.c 2 * linux/arch/arm/mach-omap1/clock.c
3 * 3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation 4 * Copyright (C) 2004 - 2005, 2009 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * 6 *
7 * Modified to use omap shared clock framework by 7 * Modified to use omap shared clock framework by
@@ -26,12 +26,17 @@
26#include <plat/usb.h> 26#include <plat/usb.h>
27#include <plat/clock.h> 27#include <plat/clock.h>
28#include <plat/sram.h> 28#include <plat/sram.h>
29 29#include <plat/clkdev_omap.h>
30static const struct clkops clkops_generic;
31static const struct clkops clkops_uart;
32static const struct clkops clkops_dspck;
33 30
34#include "clock.h" 31#include "clock.h"
32#include "opp.h"
33
34__u32 arm_idlect1_mask;
35struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
36
37/*-------------------------------------------------------------------------
38 * Omap1 specific clock functions
39 *-------------------------------------------------------------------------*/
35 40
36static int clk_omap1_dummy_enable(struct clk *clk) 41static int clk_omap1_dummy_enable(struct clk *clk)
37{ 42{
@@ -42,134 +47,24 @@ static void clk_omap1_dummy_disable(struct clk *clk)
42{ 47{
43} 48}
44 49
45static const struct clkops clkops_dummy = { 50const struct clkops clkops_dummy = {
46 .enable = clk_omap1_dummy_enable, 51 .enable = clk_omap1_dummy_enable,
47 .disable = clk_omap1_dummy_disable, 52 .disable = clk_omap1_dummy_disable,
48};
49
50static struct clk dummy_ck = {
51 .name = "dummy",
52 .ops = &clkops_dummy,
53 .flags = RATE_FIXED,
54};
55
56struct omap_clk {
57 u32 cpu;
58 struct clk_lookup lk;
59}; 53};
60 54
61#define CLK(dev, con, ck, cp) \ 55/* XXX can be replaced with a fixed_divisor_recalc */
62 { \ 56unsigned long omap1_watchdog_recalc(struct clk *clk)
63 .cpu = cp, \
64 .lk = { \
65 .dev_id = dev, \
66 .con_id = con, \
67 .clk = ck, \
68 }, \
69 }
70
71#define CK_310 (1 << 0)
72#define CK_7XX (1 << 1)
73#define CK_1510 (1 << 2)
74#define CK_16XX (1 << 3)
75
76static struct omap_clk omap_clks[] = {
77 /* non-ULPD clocks */
78 CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX),
79 CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310),
80 /* CK_GEN1 clocks */
81 CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX),
82 CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
83 CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310),
84 CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
85 CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310),
86 CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
87 CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
88 CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310),
89 CLK("omap_wdt", "ick", &armper_ck.clk, CK_16XX),
90 CLK("omap_wdt", "ick", &dummy_ck, CK_1510 | CK_310),
91 CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310),
92 CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX),
93 /* CK_GEN2 clocks */
94 CLK(NULL, "dsp_ck", &dsp_ck, CK_16XX | CK_1510 | CK_310),
95 CLK(NULL, "dspmmu_ck", &dspmmu_ck, CK_16XX | CK_1510 | CK_310),
96 CLK(NULL, "dspper_ck", &dspper_ck, CK_16XX | CK_1510 | CK_310),
97 CLK(NULL, "dspxor_ck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
98 CLK(NULL, "dsptim_ck", &dsptim_ck, CK_16XX | CK_1510 | CK_310),
99 /* CK_GEN3 clocks */
100 CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
101 CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310),
102 CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX | CK_7XX),
103 CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX),
104 CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX),
105 CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310),
106 CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
107 CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310),
108 CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310),
109 CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX),
110 CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX),
111 CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_7XX),
112 CLK(NULL, "lcd_ck", &lcd_ck_1510.clk, CK_1510 | CK_310),
113 /* ULPD clocks */
114 CLK(NULL, "uart1_ck", &uart1_1510, CK_1510 | CK_310),
115 CLK(NULL, "uart1_ck", &uart1_16xx.clk, CK_16XX),
116 CLK(NULL, "uart2_ck", &uart2_ck, CK_16XX | CK_1510 | CK_310),
117 CLK(NULL, "uart3_ck", &uart3_1510, CK_1510 | CK_310),
118 CLK(NULL, "uart3_ck", &uart3_16xx.clk, CK_16XX),
119 CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310),
120 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310),
121 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX),
122 CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX),
123 CLK(NULL, "usb_dc_ck", &usb_dc_ck7xx, CK_7XX),
124 CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310),
125 CLK(NULL, "mclk", &mclk_16xx, CK_16XX),
126 CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310),
127 CLK(NULL, "bclk", &bclk_16xx, CK_16XX),
128 CLK("mmci-omap.0", "fck", &mmc1_ck, CK_16XX | CK_1510 | CK_310),
129 CLK("mmci-omap.0", "fck", &mmc3_ck, CK_7XX),
130 CLK("mmci-omap.0", "ick", &armper_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
131 CLK("mmci-omap.1", "fck", &mmc2_ck, CK_16XX),
132 CLK("mmci-omap.1", "ick", &armper_ck.clk, CK_16XX),
133 /* Virtual clocks */
134 CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
135 CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310),
136 CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX),
137 CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310),
138 CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310),
139 CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX),
140 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310),
141 CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
142 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_1510 | CK_310),
143 CLK("omap-mcbsp.3", "ick", &dspper_ck, CK_16XX),
144 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_1510 | CK_310),
145 CLK("omap-mcbsp.1", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
146 CLK("omap-mcbsp.2", "fck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
147 CLK("omap-mcbsp.3", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
148};
149
150static int omap1_clk_enable_generic(struct clk * clk);
151static int omap1_clk_enable(struct clk *clk);
152static void omap1_clk_disable_generic(struct clk * clk);
153static void omap1_clk_disable(struct clk *clk);
154
155__u32 arm_idlect1_mask;
156
157/*-------------------------------------------------------------------------
158 * Omap1 specific clock functions
159 *-------------------------------------------------------------------------*/
160
161static unsigned long omap1_watchdog_recalc(struct clk *clk)
162{ 57{
163 return clk->parent->rate / 14; 58 return clk->parent->rate / 14;
164} 59}
165 60
166static unsigned long omap1_uart_recalc(struct clk *clk) 61unsigned long omap1_uart_recalc(struct clk *clk)
167{ 62{
168 unsigned int val = __raw_readl(clk->enable_reg); 63 unsigned int val = __raw_readl(clk->enable_reg);
169 return val & clk->enable_bit ? 48000000 : 12000000; 64 return val & clk->enable_bit ? 48000000 : 12000000;
170} 65}
171 66
172static unsigned long omap1_sossi_recalc(struct clk *clk) 67unsigned long omap1_sossi_recalc(struct clk *clk)
173{ 68{
174 u32 div = omap_readl(MOD_CONF_CTRL_1); 69 u32 div = omap_readl(MOD_CONF_CTRL_1);
175 70
@@ -179,64 +74,6 @@ static unsigned long omap1_sossi_recalc(struct clk *clk)
179 return clk->parent->rate / div; 74 return clk->parent->rate / div;
180} 75}
181 76
182static int omap1_clk_enable_dsp_domain(struct clk *clk)
183{
184 int retval;
185
186 retval = omap1_clk_enable(&api_ck.clk);
187 if (!retval) {
188 retval = omap1_clk_enable_generic(clk);
189 omap1_clk_disable(&api_ck.clk);
190 }
191
192 return retval;
193}
194
195static void omap1_clk_disable_dsp_domain(struct clk *clk)
196{
197 if (omap1_clk_enable(&api_ck.clk) == 0) {
198 omap1_clk_disable_generic(clk);
199 omap1_clk_disable(&api_ck.clk);
200 }
201}
202
203static const struct clkops clkops_dspck = {
204 .enable = &omap1_clk_enable_dsp_domain,
205 .disable = &omap1_clk_disable_dsp_domain,
206};
207
208static int omap1_clk_enable_uart_functional(struct clk *clk)
209{
210 int ret;
211 struct uart_clk *uclk;
212
213 ret = omap1_clk_enable_generic(clk);
214 if (ret == 0) {
215 /* Set smart idle acknowledgement mode */
216 uclk = (struct uart_clk *)clk;
217 omap_writeb((omap_readb(uclk->sysc_addr) & ~0x10) | 8,
218 uclk->sysc_addr);
219 }
220
221 return ret;
222}
223
224static void omap1_clk_disable_uart_functional(struct clk *clk)
225{
226 struct uart_clk *uclk;
227
228 /* Set force idle acknowledgement mode */
229 uclk = (struct uart_clk *)clk;
230 omap_writeb((omap_readb(uclk->sysc_addr) & ~0x18), uclk->sysc_addr);
231
232 omap1_clk_disable_generic(clk);
233}
234
235static const struct clkops clkops_uart = {
236 .enable = &omap1_clk_enable_uart_functional,
237 .disable = &omap1_clk_disable_uart_functional,
238};
239
240static void omap1_clk_allow_idle(struct clk *clk) 77static void omap1_clk_allow_idle(struct clk *clk)
241{ 78{
242 struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk; 79 struct arm_idlect1_clk * iclk = (struct arm_idlect1_clk *)clk;
@@ -344,7 +181,7 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate)
344 return dsor_exp; 181 return dsor_exp;
345} 182}
346 183
347static unsigned long omap1_ckctl_recalc(struct clk *clk) 184unsigned long omap1_ckctl_recalc(struct clk *clk)
348{ 185{
349 /* Calculate divisor encoded as 2-bit exponent */ 186 /* Calculate divisor encoded as 2-bit exponent */
350 int dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset)); 187 int dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset));
@@ -352,7 +189,7 @@ static unsigned long omap1_ckctl_recalc(struct clk *clk)
352 return clk->parent->rate / dsor; 189 return clk->parent->rate / dsor;
353} 190}
354 191
355static unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk) 192unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk)
356{ 193{
357 int dsor; 194 int dsor;
358 195
@@ -363,28 +200,29 @@ static unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk)
363 * Note that DSP_CKCTL virt addr = phys addr, so 200 * Note that DSP_CKCTL virt addr = phys addr, so
364 * we must use __raw_readw() instead of omap_readw(). 201 * we must use __raw_readw() instead of omap_readw().
365 */ 202 */
366 omap1_clk_enable(&api_ck.clk); 203 omap1_clk_enable(api_ck_p);
367 dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset)); 204 dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset));
368 omap1_clk_disable(&api_ck.clk); 205 omap1_clk_disable(api_ck_p);
369 206
370 return clk->parent->rate / dsor; 207 return clk->parent->rate / dsor;
371} 208}
372 209
373/* MPU virtual clock functions */ 210/* MPU virtual clock functions */
374static int omap1_select_table_rate(struct clk * clk, unsigned long rate) 211int omap1_select_table_rate(struct clk *clk, unsigned long rate)
375{ 212{
376 /* Find the highest supported frequency <= rate and switch to it */ 213 /* Find the highest supported frequency <= rate and switch to it */
377 struct mpu_rate * ptr; 214 struct mpu_rate * ptr;
215 unsigned long dpll1_rate, ref_rate;
378 216
379 if (clk != &virtual_ck_mpu) 217 dpll1_rate = clk_get_rate(ck_dpll1_p);
380 return -EINVAL; 218 ref_rate = clk_get_rate(ck_ref_p);
381 219
382 for (ptr = rate_table; ptr->rate; ptr++) { 220 for (ptr = omap1_rate_table; ptr->rate; ptr++) {
383 if (ptr->xtal != ck_ref.rate) 221 if (ptr->xtal != ref_rate)
384 continue; 222 continue;
385 223
386 /* DPLL1 cannot be reprogrammed without risking system crash */ 224 /* DPLL1 cannot be reprogrammed without risking system crash */
387 if (likely(ck_dpll1.rate!=0) && ptr->pll_rate != ck_dpll1.rate) 225 if (likely(dpll1_rate != 0) && ptr->pll_rate != dpll1_rate)
388 continue; 226 continue;
389 227
390 /* Can check only after xtal frequency check */ 228 /* Can check only after xtal frequency check */
@@ -405,11 +243,13 @@ static int omap1_select_table_rate(struct clk * clk, unsigned long rate)
405 else 243 else
406 omap_sram_reprogram_clock(ptr->dpllctl_val, ptr->ckctl_val); 244 omap_sram_reprogram_clock(ptr->dpllctl_val, ptr->ckctl_val);
407 245
408 ck_dpll1.rate = ptr->pll_rate; 246 /* XXX Do we need to recalculate the tree below DPLL1 at this point? */
247 ck_dpll1_p->rate = ptr->pll_rate;
248
409 return 0; 249 return 0;
410} 250}
411 251
412static int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate) 252int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate)
413{ 253{
414 int dsor_exp; 254 int dsor_exp;
415 u16 regval; 255 u16 regval;
@@ -429,7 +269,7 @@ static int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate)
429 return 0; 269 return 0;
430} 270}
431 271
432static long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate) 272long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate)
433{ 273{
434 int dsor_exp = calc_dsor_exp(clk, rate); 274 int dsor_exp = calc_dsor_exp(clk, rate);
435 if (dsor_exp < 0) 275 if (dsor_exp < 0)
@@ -439,7 +279,7 @@ static long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate)
439 return clk->parent->rate / (1 << dsor_exp); 279 return clk->parent->rate / (1 << dsor_exp);
440} 280}
441 281
442static int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate) 282int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate)
443{ 283{
444 int dsor_exp; 284 int dsor_exp;
445 u16 regval; 285 u16 regval;
@@ -459,19 +299,19 @@ static int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate)
459 return 0; 299 return 0;
460} 300}
461 301
462static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate) 302long omap1_round_to_table_rate(struct clk *clk, unsigned long rate)
463{ 303{
464 /* Find the highest supported frequency <= rate */ 304 /* Find the highest supported frequency <= rate */
465 struct mpu_rate * ptr; 305 struct mpu_rate * ptr;
466 long highest_rate; 306 long highest_rate;
307 unsigned long ref_rate;
467 308
468 if (clk != &virtual_ck_mpu) 309 ref_rate = clk_get_rate(ck_ref_p);
469 return -EINVAL;
470 310
471 highest_rate = -EINVAL; 311 highest_rate = -EINVAL;
472 312
473 for (ptr = rate_table; ptr->rate; ptr++) { 313 for (ptr = omap1_rate_table; ptr->rate; ptr++) {
474 if (ptr->xtal != ck_ref.rate) 314 if (ptr->xtal != ref_rate)
475 continue; 315 continue;
476 316
477 highest_rate = ptr->rate; 317 highest_rate = ptr->rate;
@@ -506,8 +346,8 @@ static unsigned calc_ext_dsor(unsigned long rate)
506 return dsor; 346 return dsor;
507} 347}
508 348
509/* Only needed on 1510 */ 349/* XXX Only needed on 1510 */
510static int omap1_set_uart_rate(struct clk * clk, unsigned long rate) 350int omap1_set_uart_rate(struct clk *clk, unsigned long rate)
511{ 351{
512 unsigned int val; 352 unsigned int val;
513 353
@@ -525,7 +365,7 @@ static int omap1_set_uart_rate(struct clk * clk, unsigned long rate)
525} 365}
526 366
527/* External clock (MCLK & BCLK) functions */ 367/* External clock (MCLK & BCLK) functions */
528static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate) 368int omap1_set_ext_clk_rate(struct clk *clk, unsigned long rate)
529{ 369{
530 unsigned dsor; 370 unsigned dsor;
531 __u16 ratio_bits; 371 __u16 ratio_bits;
@@ -543,7 +383,7 @@ static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate)
543 return 0; 383 return 0;
544} 384}
545 385
546static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate) 386int omap1_set_sossi_rate(struct clk *clk, unsigned long rate)
547{ 387{
548 u32 l; 388 u32 l;
549 int div; 389 int div;
@@ -566,12 +406,12 @@ static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate)
566 return 0; 406 return 0;
567} 407}
568 408
569static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate) 409long omap1_round_ext_clk_rate(struct clk *clk, unsigned long rate)
570{ 410{
571 return 96000000 / calc_ext_dsor(rate); 411 return 96000000 / calc_ext_dsor(rate);
572} 412}
573 413
574static void omap1_init_ext_clk(struct clk * clk) 414void omap1_init_ext_clk(struct clk *clk)
575{ 415{
576 unsigned dsor; 416 unsigned dsor;
577 __u16 ratio_bits; 417 __u16 ratio_bits;
@@ -589,7 +429,7 @@ static void omap1_init_ext_clk(struct clk * clk)
589 clk-> rate = 96000000 / dsor; 429 clk-> rate = 96000000 / dsor;
590} 430}
591 431
592static int omap1_clk_enable(struct clk *clk) 432int omap1_clk_enable(struct clk *clk)
593{ 433{
594 int ret = 0; 434 int ret = 0;
595 435
@@ -617,7 +457,7 @@ err:
617 return ret; 457 return ret;
618} 458}
619 459
620static void omap1_clk_disable(struct clk *clk) 460void omap1_clk_disable(struct clk *clk)
621{ 461{
622 if (clk->usecount > 0 && !(--clk->usecount)) { 462 if (clk->usecount > 0 && !(--clk->usecount)) {
623 clk->ops->disable(clk); 463 clk->ops->disable(clk);
@@ -672,12 +512,70 @@ static void omap1_clk_disable_generic(struct clk *clk)
672 } 512 }
673} 513}
674 514
675static const struct clkops clkops_generic = { 515const struct clkops clkops_generic = {
676 .enable = &omap1_clk_enable_generic, 516 .enable = omap1_clk_enable_generic,
677 .disable = &omap1_clk_disable_generic, 517 .disable = omap1_clk_disable_generic,
518};
519
520static int omap1_clk_enable_dsp_domain(struct clk *clk)
521{
522 int retval;
523
524 retval = omap1_clk_enable(api_ck_p);
525 if (!retval) {
526 retval = omap1_clk_enable_generic(clk);
527 omap1_clk_disable(api_ck_p);
528 }
529
530 return retval;
531}
532
533static void omap1_clk_disable_dsp_domain(struct clk *clk)
534{
535 if (omap1_clk_enable(api_ck_p) == 0) {
536 omap1_clk_disable_generic(clk);
537 omap1_clk_disable(api_ck_p);
538 }
539}
540
541const struct clkops clkops_dspck = {
542 .enable = omap1_clk_enable_dsp_domain,
543 .disable = omap1_clk_disable_dsp_domain,
544};
545
546static int omap1_clk_enable_uart_functional(struct clk *clk)
547{
548 int ret;
549 struct uart_clk *uclk;
550
551 ret = omap1_clk_enable_generic(clk);
552 if (ret == 0) {
553 /* Set smart idle acknowledgement mode */
554 uclk = (struct uart_clk *)clk;
555 omap_writeb((omap_readb(uclk->sysc_addr) & ~0x10) | 8,
556 uclk->sysc_addr);
557 }
558
559 return ret;
560}
561
562static void omap1_clk_disable_uart_functional(struct clk *clk)
563{
564 struct uart_clk *uclk;
565
566 /* Set force idle acknowledgement mode */
567 uclk = (struct uart_clk *)clk;
568 omap_writeb((omap_readb(uclk->sysc_addr) & ~0x18), uclk->sysc_addr);
569
570 omap1_clk_disable_generic(clk);
571}
572
573const struct clkops clkops_uart = {
574 .enable = omap1_clk_enable_uart_functional,
575 .disable = omap1_clk_disable_uart_functional,
678}; 576};
679 577
680static long omap1_clk_round_rate(struct clk *clk, unsigned long rate) 578long omap1_clk_round_rate(struct clk *clk, unsigned long rate)
681{ 579{
682 if (clk->flags & RATE_FIXED) 580 if (clk->flags & RATE_FIXED)
683 return clk->rate; 581 return clk->rate;
@@ -688,7 +586,7 @@ static long omap1_clk_round_rate(struct clk *clk, unsigned long rate)
688 return clk->rate; 586 return clk->rate;
689} 587}
690 588
691static int omap1_clk_set_rate(struct clk *clk, unsigned long rate) 589int omap1_clk_set_rate(struct clk *clk, unsigned long rate)
692{ 590{
693 int ret = -EINVAL; 591 int ret = -EINVAL;
694 592
@@ -703,7 +601,7 @@ static int omap1_clk_set_rate(struct clk *clk, unsigned long rate)
703 601
704#ifdef CONFIG_OMAP_RESET_CLOCKS 602#ifdef CONFIG_OMAP_RESET_CLOCKS
705 603
706static void __init omap1_clk_disable_unused(struct clk *clk) 604void __init omap1_clk_disable_unused(struct clk *clk)
707{ 605{
708 __u32 regval32; 606 __u32 regval32;
709 607
@@ -724,184 +622,9 @@ static void __init omap1_clk_disable_unused(struct clk *clk)
724 if ((regval32 & (1 << clk->enable_bit)) == 0) 622 if ((regval32 & (1 << clk->enable_bit)) == 0)
725 return; 623 return;
726 624
727 /* FIXME: This clock seems to be necessary but no-one
728 * has asked for its activation. */
729 if (clk == &tc2_ck /* FIX: pm.c (SRAM), CCP, Camera */
730 || clk == &ck_dpll1out.clk /* FIX: SoSSI, SSR */
731 || clk == &arm_gpio_ck /* FIX: GPIO code for 1510 */
732 ) {
733 printk(KERN_INFO "FIXME: Clock \"%s\" seems unused\n",
734 clk->name);
735 return;
736 }
737
738 printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name); 625 printk(KERN_INFO "Disabling unused clock \"%s\"... ", clk->name);
739 clk->ops->disable(clk); 626 clk->ops->disable(clk);
740 printk(" done\n"); 627 printk(" done\n");
741} 628}
742 629
743#else
744#define omap1_clk_disable_unused NULL
745#endif 630#endif
746
747static struct clk_functions omap1_clk_functions = {
748 .clk_enable = omap1_clk_enable,
749 .clk_disable = omap1_clk_disable,
750 .clk_round_rate = omap1_clk_round_rate,
751 .clk_set_rate = omap1_clk_set_rate,
752 .clk_disable_unused = omap1_clk_disable_unused,
753};
754
755int __init omap1_clk_init(void)
756{
757 struct omap_clk *c;
758 const struct omap_clock_config *info;
759 int crystal_type = 0; /* Default 12 MHz */
760 u32 reg, cpu_mask;
761
762#ifdef CONFIG_DEBUG_LL
763 /* Resets some clocks that may be left on from bootloader,
764 * but leaves serial clocks on.
765 */
766 omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
767#endif
768
769 /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
770 reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
771 omap_writew(reg, SOFT_REQ_REG);
772 if (!cpu_is_omap15xx())
773 omap_writew(0, SOFT_REQ_REG2);
774
775 clk_init(&omap1_clk_functions);
776
777 /* By default all idlect1 clocks are allowed to idle */
778 arm_idlect1_mask = ~0;
779
780 for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
781 clk_preinit(c->lk.clk);
782
783 cpu_mask = 0;
784 if (cpu_is_omap16xx())
785 cpu_mask |= CK_16XX;
786 if (cpu_is_omap1510())
787 cpu_mask |= CK_1510;
788 if (cpu_is_omap7xx())
789 cpu_mask |= CK_7XX;
790 if (cpu_is_omap310())
791 cpu_mask |= CK_310;
792
793 for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
794 if (c->cpu & cpu_mask) {
795 clkdev_add(&c->lk);
796 clk_register(c->lk.clk);
797 }
798
799 info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);
800 if (info != NULL) {
801 if (!cpu_is_omap15xx())
802 crystal_type = info->system_clock_type;
803 }
804
805#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
806 ck_ref.rate = 13000000;
807#elif defined(CONFIG_ARCH_OMAP16XX)
808 if (crystal_type == 2)
809 ck_ref.rate = 19200000;
810#endif
811
812 printk("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: 0x%04x\n",
813 omap_readw(ARM_SYSST), omap_readw(DPLL_CTL),
814 omap_readw(ARM_CKCTL));
815
816 /* We want to be in syncronous scalable mode */
817 omap_writew(0x1000, ARM_SYSST);
818
819#ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
820 /* Use values set by bootloader. Determine PLL rate and recalculate
821 * dependent clocks as if kernel had changed PLL or divisors.
822 */
823 {
824 unsigned pll_ctl_val = omap_readw(DPLL_CTL);
825
826 ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
827 if (pll_ctl_val & 0x10) {
828 /* PLL enabled, apply multiplier and divisor */
829 if (pll_ctl_val & 0xf80)
830 ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
831 ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
832 } else {
833 /* PLL disabled, apply bypass divisor */
834 switch (pll_ctl_val & 0xc) {
835 case 0:
836 break;
837 case 0x4:
838 ck_dpll1.rate /= 2;
839 break;
840 default:
841 ck_dpll1.rate /= 4;
842 break;
843 }
844 }
845 }
846#else
847 /* Find the highest supported frequency and enable it */
848 if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
849 printk(KERN_ERR "System frequencies not set. Check your config.\n");
850 /* Guess sane values (60MHz) */
851 omap_writew(0x2290, DPLL_CTL);
852 omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
853 ck_dpll1.rate = 60000000;
854 }
855#endif
856 propagate_rate(&ck_dpll1);
857 /* Cache rates for clocks connected to ck_ref (not dpll1) */
858 propagate_rate(&ck_ref);
859 printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
860 "%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
861 ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
862 ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
863 arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
864
865#if defined(CONFIG_MACH_OMAP_PERSEUS2) || defined(CONFIG_MACH_OMAP_FSAMPLE)
866 /* Select slicer output as OMAP input clock */
867 omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, OMAP7XX_PCC_UPLD_CTRL);
868#endif
869
870 /* Amstrad Delta wants BCLK high when inactive */
871 if (machine_is_ams_delta())
872 omap_writel(omap_readl(ULPD_CLOCK_CTRL) |
873 (1 << SDW_MCLK_INV_BIT),
874 ULPD_CLOCK_CTRL);
875
876 /* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
877 /* (on 730, bit 13 must not be cleared) */
878 if (cpu_is_omap7xx())
879 omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
880 else
881 omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
882
883 /* Put DSP/MPUI into reset until needed */
884 omap_writew(0, ARM_RSTCT1);
885 omap_writew(1, ARM_RSTCT2);
886 omap_writew(0x400, ARM_IDLECT1);
887
888 /*
889 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
890 * of the ARM_IDLECT2 register must be set to zero. The power-on
891 * default value of this bit is one.
892 */
893 omap_writew(0x0000, ARM_IDLECT2); /* Turn LCD clock off also */
894
895 /*
896 * Only enable those clocks we will need, let the drivers
897 * enable other clocks as necessary
898 */
899 clk_enable(&armper_ck.clk);
900 clk_enable(&armxor_ck.clk);
901 clk_enable(&armtim_ck.clk); /* This should be done by timer code */
902
903 if (cpu_is_omap15xx())
904 clk_enable(&arm_gpio_ck);
905
906 return 0;
907}
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index 29ffa97dc7f3..a4190afb8614 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/arm/mach-omap1/clock.h 2 * linux/arch/arm/mach-omap1/clock.h
3 * 3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation 4 * Copyright (C) 2004 - 2005, 2009 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc 6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 * 7 *
@@ -13,30 +13,36 @@
13#ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H 13#ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H
14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H 14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H
15 15
16static unsigned long omap1_ckctl_recalc(struct clk *clk); 16#include <linux/clk.h>
17static unsigned long omap1_watchdog_recalc(struct clk *clk); 17
18static int omap1_set_sossi_rate(struct clk *clk, unsigned long rate); 18#include <plat/clock.h>
19static unsigned long omap1_sossi_recalc(struct clk *clk); 19
20static unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk); 20extern int __init omap1_clk_init(void);
21static int omap1_clk_set_rate_dsp_domain(struct clk * clk, unsigned long rate); 21extern int omap1_clk_enable(struct clk *clk);
22static int omap1_set_uart_rate(struct clk * clk, unsigned long rate); 22extern void omap1_clk_disable(struct clk *clk);
23static unsigned long omap1_uart_recalc(struct clk *clk); 23extern long omap1_clk_round_rate(struct clk *clk, unsigned long rate);
24static int omap1_set_ext_clk_rate(struct clk * clk, unsigned long rate); 24extern int omap1_clk_set_rate(struct clk *clk, unsigned long rate);
25static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate); 25extern unsigned long omap1_ckctl_recalc(struct clk *clk);
26static void omap1_init_ext_clk(struct clk * clk); 26extern int omap1_set_sossi_rate(struct clk *clk, unsigned long rate);
27static int omap1_select_table_rate(struct clk * clk, unsigned long rate); 27extern unsigned long omap1_sossi_recalc(struct clk *clk);
28static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate); 28extern unsigned long omap1_ckctl_recalc_dsp_domain(struct clk *clk);
29 29extern int omap1_clk_set_rate_dsp_domain(struct clk *clk, unsigned long rate);
30static int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate); 30extern int omap1_set_uart_rate(struct clk *clk, unsigned long rate);
31static long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate); 31extern unsigned long omap1_uart_recalc(struct clk *clk);
32 32extern int omap1_set_ext_clk_rate(struct clk *clk, unsigned long rate);
33struct mpu_rate { 33extern long omap1_round_ext_clk_rate(struct clk *clk, unsigned long rate);
34 unsigned long rate; 34extern void omap1_init_ext_clk(struct clk *clk);
35 unsigned long xtal; 35extern int omap1_select_table_rate(struct clk *clk, unsigned long rate);
36 unsigned long pll_rate; 36extern long omap1_round_to_table_rate(struct clk *clk, unsigned long rate);
37 __u16 ckctl_val; 37extern int omap1_clk_set_rate_ckctl_arm(struct clk *clk, unsigned long rate);
38 __u16 dpllctl_val; 38extern long omap1_clk_round_rate_ckctl_arm(struct clk *clk, unsigned long rate);
39}; 39extern unsigned long omap1_watchdog_recalc(struct clk *clk);
40
41#ifdef CONFIG_OMAP_RESET_CLOCKS
42extern void __init omap1_clk_disable_unused(struct clk *clk);
43#else
44#define omap1_clk_disable_unused NULL
45#endif
40 46
41struct uart_clk { 47struct uart_clk {
42 struct clk clk; 48 struct clk clk;
@@ -96,596 +102,12 @@ struct arm_idlect1_clk {
96#define SOFT_REQ_REG 0xfffe0834 102#define SOFT_REQ_REG 0xfffe0834
97#define SOFT_REQ_REG2 0xfffe0880 103#define SOFT_REQ_REG2 0xfffe0880
98 104
99/*------------------------------------------------------------------------- 105extern __u32 arm_idlect1_mask;
100 * Omap1 MPU rate table 106extern struct clk *api_ck_p, *ck_dpll1_p, *ck_ref_p;
101 *-------------------------------------------------------------------------*/
102static struct mpu_rate rate_table[] = {
103 /* MPU MHz, xtal MHz, dpll1 MHz, CKCTL, DPLL_CTL
104 * NOTE: Comment order here is different from bits in CKCTL value:
105 * armdiv, dspdiv, dspmmu, tcdiv, perdiv, lcddiv
106 */
107#if defined(CONFIG_OMAP_ARM_216MHZ)
108 { 216000000, 12000000, 216000000, 0x050d, 0x2910 }, /* 1/1/2/2/2/8 */
109#endif
110#if defined(CONFIG_OMAP_ARM_195MHZ)
111 { 195000000, 13000000, 195000000, 0x050e, 0x2790 }, /* 1/1/2/2/4/8 */
112#endif
113#if defined(CONFIG_OMAP_ARM_192MHZ)
114 { 192000000, 19200000, 192000000, 0x050f, 0x2510 }, /* 1/1/2/2/8/8 */
115 { 192000000, 12000000, 192000000, 0x050f, 0x2810 }, /* 1/1/2/2/8/8 */
116 { 96000000, 12000000, 192000000, 0x055f, 0x2810 }, /* 2/2/2/2/8/8 */
117 { 48000000, 12000000, 192000000, 0x0baf, 0x2810 }, /* 4/4/4/8/8/8 */
118 { 24000000, 12000000, 192000000, 0x0fff, 0x2810 }, /* 8/8/8/8/8/8 */
119#endif
120#if defined(CONFIG_OMAP_ARM_182MHZ)
121 { 182000000, 13000000, 182000000, 0x050e, 0x2710 }, /* 1/1/2/2/4/8 */
122#endif
123#if defined(CONFIG_OMAP_ARM_168MHZ)
124 { 168000000, 12000000, 168000000, 0x010f, 0x2710 }, /* 1/1/1/2/8/8 */
125#endif
126#if defined(CONFIG_OMAP_ARM_150MHZ)
127 { 150000000, 12000000, 150000000, 0x010a, 0x2cb0 }, /* 1/1/1/2/4/4 */
128#endif
129#if defined(CONFIG_OMAP_ARM_120MHZ)
130 { 120000000, 12000000, 120000000, 0x010a, 0x2510 }, /* 1/1/1/2/4/4 */
131#endif
132#if defined(CONFIG_OMAP_ARM_96MHZ)
133 { 96000000, 12000000, 96000000, 0x0005, 0x2410 }, /* 1/1/1/1/2/2 */
134#endif
135#if defined(CONFIG_OMAP_ARM_60MHZ)
136 { 60000000, 12000000, 60000000, 0x0005, 0x2290 }, /* 1/1/1/1/2/2 */
137#endif
138#if defined(CONFIG_OMAP_ARM_30MHZ)
139 { 30000000, 12000000, 60000000, 0x0555, 0x2290 }, /* 2/2/2/2/2/2 */
140#endif
141 { 0, 0, 0, 0, 0 },
142};
143
144/*-------------------------------------------------------------------------
145 * Omap1 clocks
146 *-------------------------------------------------------------------------*/
147
148static struct clk ck_ref = {
149 .name = "ck_ref",
150 .ops = &clkops_null,
151 .rate = 12000000,
152};
153
154static struct clk ck_dpll1 = {
155 .name = "ck_dpll1",
156 .ops = &clkops_null,
157 .parent = &ck_ref,
158};
159
160static struct arm_idlect1_clk ck_dpll1out = {
161 .clk = {
162 .name = "ck_dpll1out",
163 .ops = &clkops_generic,
164 .parent = &ck_dpll1,
165 .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT,
166 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
167 .enable_bit = EN_CKOUT_ARM,
168 .recalc = &followparent_recalc,
169 },
170 .idlect_shift = 12,
171};
172
173static struct clk sossi_ck = {
174 .name = "ck_sossi",
175 .ops = &clkops_generic,
176 .parent = &ck_dpll1out.clk,
177 .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
178 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
179 .enable_bit = 16,
180 .recalc = &omap1_sossi_recalc,
181 .set_rate = &omap1_set_sossi_rate,
182};
183
184static struct clk arm_ck = {
185 .name = "arm_ck",
186 .ops = &clkops_null,
187 .parent = &ck_dpll1,
188 .rate_offset = CKCTL_ARMDIV_OFFSET,
189 .recalc = &omap1_ckctl_recalc,
190 .round_rate = omap1_clk_round_rate_ckctl_arm,
191 .set_rate = omap1_clk_set_rate_ckctl_arm,
192};
193
194static struct arm_idlect1_clk armper_ck = {
195 .clk = {
196 .name = "armper_ck",
197 .ops = &clkops_generic,
198 .parent = &ck_dpll1,
199 .flags = CLOCK_IDLE_CONTROL,
200 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
201 .enable_bit = EN_PERCK,
202 .rate_offset = CKCTL_PERDIV_OFFSET,
203 .recalc = &omap1_ckctl_recalc,
204 .round_rate = omap1_clk_round_rate_ckctl_arm,
205 .set_rate = omap1_clk_set_rate_ckctl_arm,
206 },
207 .idlect_shift = 2,
208};
209
210static struct clk arm_gpio_ck = {
211 .name = "arm_gpio_ck",
212 .ops = &clkops_generic,
213 .parent = &ck_dpll1,
214 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
215 .enable_bit = EN_GPIOCK,
216 .recalc = &followparent_recalc,
217};
218
219static struct arm_idlect1_clk armxor_ck = {
220 .clk = {
221 .name = "armxor_ck",
222 .ops = &clkops_generic,
223 .parent = &ck_ref,
224 .flags = CLOCK_IDLE_CONTROL,
225 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
226 .enable_bit = EN_XORPCK,
227 .recalc = &followparent_recalc,
228 },
229 .idlect_shift = 1,
230};
231
232static struct arm_idlect1_clk armtim_ck = {
233 .clk = {
234 .name = "armtim_ck",
235 .ops = &clkops_generic,
236 .parent = &ck_ref,
237 .flags = CLOCK_IDLE_CONTROL,
238 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
239 .enable_bit = EN_TIMCK,
240 .recalc = &followparent_recalc,
241 },
242 .idlect_shift = 9,
243};
244
245static struct arm_idlect1_clk armwdt_ck = {
246 .clk = {
247 .name = "armwdt_ck",
248 .ops = &clkops_generic,
249 .parent = &ck_ref,
250 .flags = CLOCK_IDLE_CONTROL,
251 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
252 .enable_bit = EN_WDTCK,
253 .recalc = &omap1_watchdog_recalc,
254 },
255 .idlect_shift = 0,
256};
257
258static struct clk arminth_ck16xx = {
259 .name = "arminth_ck",
260 .ops = &clkops_null,
261 .parent = &arm_ck,
262 .recalc = &followparent_recalc,
263 /* Note: On 16xx the frequency can be divided by 2 by programming
264 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
265 *
266 * 1510 version is in TC clocks.
267 */
268};
269
270static struct clk dsp_ck = {
271 .name = "dsp_ck",
272 .ops = &clkops_generic,
273 .parent = &ck_dpll1,
274 .enable_reg = OMAP1_IO_ADDRESS(ARM_CKCTL),
275 .enable_bit = EN_DSPCK,
276 .rate_offset = CKCTL_DSPDIV_OFFSET,
277 .recalc = &omap1_ckctl_recalc,
278 .round_rate = omap1_clk_round_rate_ckctl_arm,
279 .set_rate = omap1_clk_set_rate_ckctl_arm,
280};
281
282static struct clk dspmmu_ck = {
283 .name = "dspmmu_ck",
284 .ops = &clkops_null,
285 .parent = &ck_dpll1,
286 .rate_offset = CKCTL_DSPMMUDIV_OFFSET,
287 .recalc = &omap1_ckctl_recalc,
288 .round_rate = omap1_clk_round_rate_ckctl_arm,
289 .set_rate = omap1_clk_set_rate_ckctl_arm,
290};
291
292static struct clk dspper_ck = {
293 .name = "dspper_ck",
294 .ops = &clkops_dspck,
295 .parent = &ck_dpll1,
296 .enable_reg = DSP_IDLECT2,
297 .enable_bit = EN_PERCK,
298 .rate_offset = CKCTL_PERDIV_OFFSET,
299 .recalc = &omap1_ckctl_recalc_dsp_domain,
300 .round_rate = omap1_clk_round_rate_ckctl_arm,
301 .set_rate = &omap1_clk_set_rate_dsp_domain,
302};
303
304static struct clk dspxor_ck = {
305 .name = "dspxor_ck",
306 .ops = &clkops_dspck,
307 .parent = &ck_ref,
308 .enable_reg = DSP_IDLECT2,
309 .enable_bit = EN_XORPCK,
310 .recalc = &followparent_recalc,
311};
312
313static struct clk dsptim_ck = {
314 .name = "dsptim_ck",
315 .ops = &clkops_dspck,
316 .parent = &ck_ref,
317 .enable_reg = DSP_IDLECT2,
318 .enable_bit = EN_DSPTIMCK,
319 .recalc = &followparent_recalc,
320};
321
322/* Tie ARM_IDLECT1:IDLIF_ARM to this logical clock structure */
323static struct arm_idlect1_clk tc_ck = {
324 .clk = {
325 .name = "tc_ck",
326 .ops = &clkops_null,
327 .parent = &ck_dpll1,
328 .flags = CLOCK_IDLE_CONTROL,
329 .rate_offset = CKCTL_TCDIV_OFFSET,
330 .recalc = &omap1_ckctl_recalc,
331 .round_rate = omap1_clk_round_rate_ckctl_arm,
332 .set_rate = omap1_clk_set_rate_ckctl_arm,
333 },
334 .idlect_shift = 6,
335};
336
337static struct clk arminth_ck1510 = {
338 .name = "arminth_ck",
339 .ops = &clkops_null,
340 .parent = &tc_ck.clk,
341 .recalc = &followparent_recalc,
342 /* Note: On 1510 the frequency follows TC_CK
343 *
344 * 16xx version is in MPU clocks.
345 */
346};
347
348static struct clk tipb_ck = {
349 /* No-idle controlled by "tc_ck" */
350 .name = "tipb_ck",
351 .ops = &clkops_null,
352 .parent = &tc_ck.clk,
353 .recalc = &followparent_recalc,
354};
355
356static struct clk l3_ocpi_ck = {
357 /* No-idle controlled by "tc_ck" */
358 .name = "l3_ocpi_ck",
359 .ops = &clkops_generic,
360 .parent = &tc_ck.clk,
361 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
362 .enable_bit = EN_OCPI_CK,
363 .recalc = &followparent_recalc,
364};
365
366static struct clk tc1_ck = {
367 .name = "tc1_ck",
368 .ops = &clkops_generic,
369 .parent = &tc_ck.clk,
370 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
371 .enable_bit = EN_TC1_CK,
372 .recalc = &followparent_recalc,
373};
374 107
375static struct clk tc2_ck = { 108extern const struct clkops clkops_dspck;
376 .name = "tc2_ck", 109extern const struct clkops clkops_dummy;
377 .ops = &clkops_generic, 110extern const struct clkops clkops_uart;
378 .parent = &tc_ck.clk, 111extern const struct clkops clkops_generic;
379 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
380 .enable_bit = EN_TC2_CK,
381 .recalc = &followparent_recalc,
382};
383
384static struct clk dma_ck = {
385 /* No-idle controlled by "tc_ck" */
386 .name = "dma_ck",
387 .ops = &clkops_null,
388 .parent = &tc_ck.clk,
389 .recalc = &followparent_recalc,
390};
391
392static struct clk dma_lcdfree_ck = {
393 .name = "dma_lcdfree_ck",
394 .ops = &clkops_null,
395 .parent = &tc_ck.clk,
396 .recalc = &followparent_recalc,
397};
398
399static struct arm_idlect1_clk api_ck = {
400 .clk = {
401 .name = "api_ck",
402 .ops = &clkops_generic,
403 .parent = &tc_ck.clk,
404 .flags = CLOCK_IDLE_CONTROL,
405 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
406 .enable_bit = EN_APICK,
407 .recalc = &followparent_recalc,
408 },
409 .idlect_shift = 8,
410};
411
412static struct arm_idlect1_clk lb_ck = {
413 .clk = {
414 .name = "lb_ck",
415 .ops = &clkops_generic,
416 .parent = &tc_ck.clk,
417 .flags = CLOCK_IDLE_CONTROL,
418 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
419 .enable_bit = EN_LBCK,
420 .recalc = &followparent_recalc,
421 },
422 .idlect_shift = 4,
423};
424
425static struct clk rhea1_ck = {
426 .name = "rhea1_ck",
427 .ops = &clkops_null,
428 .parent = &tc_ck.clk,
429 .recalc = &followparent_recalc,
430};
431
432static struct clk rhea2_ck = {
433 .name = "rhea2_ck",
434 .ops = &clkops_null,
435 .parent = &tc_ck.clk,
436 .recalc = &followparent_recalc,
437};
438
439static struct clk lcd_ck_16xx = {
440 .name = "lcd_ck",
441 .ops = &clkops_generic,
442 .parent = &ck_dpll1,
443 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
444 .enable_bit = EN_LCDCK,
445 .rate_offset = CKCTL_LCDDIV_OFFSET,
446 .recalc = &omap1_ckctl_recalc,
447 .round_rate = omap1_clk_round_rate_ckctl_arm,
448 .set_rate = omap1_clk_set_rate_ckctl_arm,
449};
450
451static struct arm_idlect1_clk lcd_ck_1510 = {
452 .clk = {
453 .name = "lcd_ck",
454 .ops = &clkops_generic,
455 .parent = &ck_dpll1,
456 .flags = CLOCK_IDLE_CONTROL,
457 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
458 .enable_bit = EN_LCDCK,
459 .rate_offset = CKCTL_LCDDIV_OFFSET,
460 .recalc = &omap1_ckctl_recalc,
461 .round_rate = omap1_clk_round_rate_ckctl_arm,
462 .set_rate = omap1_clk_set_rate_ckctl_arm,
463 },
464 .idlect_shift = 3,
465};
466
467static struct clk uart1_1510 = {
468 .name = "uart1_ck",
469 .ops = &clkops_null,
470 /* Direct from ULPD, no real parent */
471 .parent = &armper_ck.clk,
472 .rate = 12000000,
473 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
474 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
475 .enable_bit = 29, /* Chooses between 12MHz and 48MHz */
476 .set_rate = &omap1_set_uart_rate,
477 .recalc = &omap1_uart_recalc,
478};
479
480static struct uart_clk uart1_16xx = {
481 .clk = {
482 .name = "uart1_ck",
483 .ops = &clkops_uart,
484 /* Direct from ULPD, no real parent */
485 .parent = &armper_ck.clk,
486 .rate = 48000000,
487 .flags = RATE_FIXED | ENABLE_REG_32BIT |
488 CLOCK_NO_IDLE_PARENT,
489 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
490 .enable_bit = 29,
491 },
492 .sysc_addr = 0xfffb0054,
493};
494
495static struct clk uart2_ck = {
496 .name = "uart2_ck",
497 .ops = &clkops_null,
498 /* Direct from ULPD, no real parent */
499 .parent = &armper_ck.clk,
500 .rate = 12000000,
501 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
502 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
503 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */
504 .set_rate = &omap1_set_uart_rate,
505 .recalc = &omap1_uart_recalc,
506};
507
508static struct clk uart3_1510 = {
509 .name = "uart3_ck",
510 .ops = &clkops_null,
511 /* Direct from ULPD, no real parent */
512 .parent = &armper_ck.clk,
513 .rate = 12000000,
514 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
515 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
516 .enable_bit = 31, /* Chooses between 12MHz and 48MHz */
517 .set_rate = &omap1_set_uart_rate,
518 .recalc = &omap1_uart_recalc,
519};
520
521static struct uart_clk uart3_16xx = {
522 .clk = {
523 .name = "uart3_ck",
524 .ops = &clkops_uart,
525 /* Direct from ULPD, no real parent */
526 .parent = &armper_ck.clk,
527 .rate = 48000000,
528 .flags = RATE_FIXED | ENABLE_REG_32BIT |
529 CLOCK_NO_IDLE_PARENT,
530 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
531 .enable_bit = 31,
532 },
533 .sysc_addr = 0xfffb9854,
534};
535
536static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */
537 .name = "usb_clko",
538 .ops = &clkops_generic,
539 /* Direct from ULPD, no parent */
540 .rate = 6000000,
541 .flags = RATE_FIXED | ENABLE_REG_32BIT,
542 .enable_reg = OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL),
543 .enable_bit = USB_MCLK_EN_BIT,
544};
545
546static struct clk usb_hhc_ck1510 = {
547 .name = "usb_hhc_ck",
548 .ops = &clkops_generic,
549 /* Direct from ULPD, no parent */
550 .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
551 .flags = RATE_FIXED | ENABLE_REG_32BIT,
552 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
553 .enable_bit = USB_HOST_HHC_UHOST_EN,
554};
555
556static struct clk usb_hhc_ck16xx = {
557 .name = "usb_hhc_ck",
558 .ops = &clkops_generic,
559 /* Direct from ULPD, no parent */
560 .rate = 48000000,
561 /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
562 .flags = RATE_FIXED | ENABLE_REG_32BIT,
563 .enable_reg = OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */
564 .enable_bit = 8 /* UHOST_EN */,
565};
566
567static struct clk usb_dc_ck = {
568 .name = "usb_dc_ck",
569 .ops = &clkops_generic,
570 /* Direct from ULPD, no parent */
571 .rate = 48000000,
572 .flags = RATE_FIXED,
573 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
574 .enable_bit = 4,
575};
576
577static struct clk usb_dc_ck7xx = {
578 .name = "usb_dc_ck",
579 .ops = &clkops_generic,
580 /* Direct from ULPD, no parent */
581 .rate = 48000000,
582 .flags = RATE_FIXED,
583 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
584 .enable_bit = 8,
585};
586
587static struct clk mclk_1510 = {
588 .name = "mclk",
589 .ops = &clkops_generic,
590 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
591 .rate = 12000000,
592 .flags = RATE_FIXED,
593 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
594 .enable_bit = 6,
595};
596
597static struct clk mclk_16xx = {
598 .name = "mclk",
599 .ops = &clkops_generic,
600 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
601 .enable_reg = OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL),
602 .enable_bit = COM_ULPD_PLL_CLK_REQ,
603 .set_rate = &omap1_set_ext_clk_rate,
604 .round_rate = &omap1_round_ext_clk_rate,
605 .init = &omap1_init_ext_clk,
606};
607
608static struct clk bclk_1510 = {
609 .name = "bclk",
610 .ops = &clkops_generic,
611 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
612 .rate = 12000000,
613 .flags = RATE_FIXED,
614};
615
616static struct clk bclk_16xx = {
617 .name = "bclk",
618 .ops = &clkops_generic,
619 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
620 .enable_reg = OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL),
621 .enable_bit = SWD_ULPD_PLL_CLK_REQ,
622 .set_rate = &omap1_set_ext_clk_rate,
623 .round_rate = &omap1_round_ext_clk_rate,
624 .init = &omap1_init_ext_clk,
625};
626
627static struct clk mmc1_ck = {
628 .name = "mmc_ck",
629 .ops = &clkops_generic,
630 /* Functional clock is direct from ULPD, interface clock is ARMPER */
631 .parent = &armper_ck.clk,
632 .rate = 48000000,
633 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
634 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
635 .enable_bit = 23,
636};
637
638static struct clk mmc2_ck = {
639 .name = "mmc_ck",
640 .id = 1,
641 .ops = &clkops_generic,
642 /* Functional clock is direct from ULPD, interface clock is ARMPER */
643 .parent = &armper_ck.clk,
644 .rate = 48000000,
645 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
646 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
647 .enable_bit = 20,
648};
649
650static struct clk mmc3_ck = {
651 .name = "mmc_ck",
652 .id = 2,
653 .ops = &clkops_generic,
654 /* Functional clock is direct from ULPD, interface clock is ARMPER */
655 .parent = &armper_ck.clk,
656 .rate = 48000000,
657 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
658 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
659 .enable_bit = 12,
660};
661
662static struct clk virtual_ck_mpu = {
663 .name = "mpu",
664 .ops = &clkops_null,
665 .parent = &arm_ck, /* Is smarter alias for */
666 .recalc = &followparent_recalc,
667 .set_rate = &omap1_select_table_rate,
668 .round_rate = &omap1_round_to_table_rate,
669};
670
671/* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK
672remains active during MPU idle whenever this is enabled */
673static struct clk i2c_fck = {
674 .name = "i2c_fck",
675 .id = 1,
676 .ops = &clkops_null,
677 .flags = CLOCK_NO_IDLE_PARENT,
678 .parent = &armxor_ck.clk,
679 .recalc = &followparent_recalc,
680};
681
682static struct clk i2c_ick = {
683 .name = "i2c_ick",
684 .id = 1,
685 .ops = &clkops_null,
686 .flags = CLOCK_NO_IDLE_PARENT,
687 .parent = &armper_ck.clk,
688 .recalc = &followparent_recalc,
689};
690 112
691#endif 113#endif
diff --git a/arch/arm/mach-omap1/clock_data.c b/arch/arm/mach-omap1/clock_data.c
new file mode 100644
index 000000000000..ab995a9c606c
--- /dev/null
+++ b/arch/arm/mach-omap1/clock_data.c
@@ -0,0 +1,843 @@
1/*
2 * linux/arch/arm/mach-omap1/clock_data.c
3 *
4 * Copyright (C) 2004 - 2005, 2009 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/kernel.h>
14#include <linux/clk.h>
15#include <linux/io.h>
16
17#include <asm/mach-types.h> /* for machine_is_* */
18
19#include <plat/clock.h>
20#include <plat/cpu.h>
21#include <plat/clkdev_omap.h>
22#include <plat/usb.h> /* for OTG_BASE */
23
24#include "clock.h"
25
26/*------------------------------------------------------------------------
27 * Omap1 clocks
28 *-------------------------------------------------------------------------*/
29
30/* XXX is this necessary? */
31static struct clk dummy_ck = {
32 .name = "dummy",
33 .ops = &clkops_dummy,
34 .flags = RATE_FIXED,
35};
36
37static struct clk ck_ref = {
38 .name = "ck_ref",
39 .ops = &clkops_null,
40 .rate = 12000000,
41};
42
43static struct clk ck_dpll1 = {
44 .name = "ck_dpll1",
45 .ops = &clkops_null,
46 .parent = &ck_ref,
47};
48
49/*
50 * FIXME: This clock seems to be necessary but no-one has asked for its
51 * activation. [ FIX: SoSSI, SSR ]
52 */
53static struct arm_idlect1_clk ck_dpll1out = {
54 .clk = {
55 .name = "ck_dpll1out",
56 .ops = &clkops_generic,
57 .parent = &ck_dpll1,
58 .flags = CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT |
59 ENABLE_ON_INIT,
60 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
61 .enable_bit = EN_CKOUT_ARM,
62 .recalc = &followparent_recalc,
63 },
64 .idlect_shift = 12,
65};
66
67static struct clk sossi_ck = {
68 .name = "ck_sossi",
69 .ops = &clkops_generic,
70 .parent = &ck_dpll1out.clk,
71 .flags = CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
72 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
73 .enable_bit = 16,
74 .recalc = &omap1_sossi_recalc,
75 .set_rate = &omap1_set_sossi_rate,
76};
77
78static struct clk arm_ck = {
79 .name = "arm_ck",
80 .ops = &clkops_null,
81 .parent = &ck_dpll1,
82 .rate_offset = CKCTL_ARMDIV_OFFSET,
83 .recalc = &omap1_ckctl_recalc,
84 .round_rate = omap1_clk_round_rate_ckctl_arm,
85 .set_rate = omap1_clk_set_rate_ckctl_arm,
86};
87
88static struct arm_idlect1_clk armper_ck = {
89 .clk = {
90 .name = "armper_ck",
91 .ops = &clkops_generic,
92 .parent = &ck_dpll1,
93 .flags = CLOCK_IDLE_CONTROL,
94 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
95 .enable_bit = EN_PERCK,
96 .rate_offset = CKCTL_PERDIV_OFFSET,
97 .recalc = &omap1_ckctl_recalc,
98 .round_rate = omap1_clk_round_rate_ckctl_arm,
99 .set_rate = omap1_clk_set_rate_ckctl_arm,
100 },
101 .idlect_shift = 2,
102};
103
104/*
105 * FIXME: This clock seems to be necessary but no-one has asked for its
106 * activation. [ GPIO code for 1510 ]
107 */
108static struct clk arm_gpio_ck = {
109 .name = "arm_gpio_ck",
110 .ops = &clkops_generic,
111 .parent = &ck_dpll1,
112 .flags = ENABLE_ON_INIT,
113 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
114 .enable_bit = EN_GPIOCK,
115 .recalc = &followparent_recalc,
116};
117
118static struct arm_idlect1_clk armxor_ck = {
119 .clk = {
120 .name = "armxor_ck",
121 .ops = &clkops_generic,
122 .parent = &ck_ref,
123 .flags = CLOCK_IDLE_CONTROL,
124 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
125 .enable_bit = EN_XORPCK,
126 .recalc = &followparent_recalc,
127 },
128 .idlect_shift = 1,
129};
130
131static struct arm_idlect1_clk armtim_ck = {
132 .clk = {
133 .name = "armtim_ck",
134 .ops = &clkops_generic,
135 .parent = &ck_ref,
136 .flags = CLOCK_IDLE_CONTROL,
137 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
138 .enable_bit = EN_TIMCK,
139 .recalc = &followparent_recalc,
140 },
141 .idlect_shift = 9,
142};
143
144static struct arm_idlect1_clk armwdt_ck = {
145 .clk = {
146 .name = "armwdt_ck",
147 .ops = &clkops_generic,
148 .parent = &ck_ref,
149 .flags = CLOCK_IDLE_CONTROL,
150 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
151 .enable_bit = EN_WDTCK,
152 .recalc = &omap1_watchdog_recalc,
153 },
154 .idlect_shift = 0,
155};
156
157static struct clk arminth_ck16xx = {
158 .name = "arminth_ck",
159 .ops = &clkops_null,
160 .parent = &arm_ck,
161 .recalc = &followparent_recalc,
162 /* Note: On 16xx the frequency can be divided by 2 by programming
163 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
164 *
165 * 1510 version is in TC clocks.
166 */
167};
168
169static struct clk dsp_ck = {
170 .name = "dsp_ck",
171 .ops = &clkops_generic,
172 .parent = &ck_dpll1,
173 .enable_reg = OMAP1_IO_ADDRESS(ARM_CKCTL),
174 .enable_bit = EN_DSPCK,
175 .rate_offset = CKCTL_DSPDIV_OFFSET,
176 .recalc = &omap1_ckctl_recalc,
177 .round_rate = omap1_clk_round_rate_ckctl_arm,
178 .set_rate = omap1_clk_set_rate_ckctl_arm,
179};
180
181static struct clk dspmmu_ck = {
182 .name = "dspmmu_ck",
183 .ops = &clkops_null,
184 .parent = &ck_dpll1,
185 .rate_offset = CKCTL_DSPMMUDIV_OFFSET,
186 .recalc = &omap1_ckctl_recalc,
187 .round_rate = omap1_clk_round_rate_ckctl_arm,
188 .set_rate = omap1_clk_set_rate_ckctl_arm,
189};
190
191static struct clk dspper_ck = {
192 .name = "dspper_ck",
193 .ops = &clkops_dspck,
194 .parent = &ck_dpll1,
195 .enable_reg = DSP_IDLECT2,
196 .enable_bit = EN_PERCK,
197 .rate_offset = CKCTL_PERDIV_OFFSET,
198 .recalc = &omap1_ckctl_recalc_dsp_domain,
199 .round_rate = omap1_clk_round_rate_ckctl_arm,
200 .set_rate = &omap1_clk_set_rate_dsp_domain,
201};
202
203static struct clk dspxor_ck = {
204 .name = "dspxor_ck",
205 .ops = &clkops_dspck,
206 .parent = &ck_ref,
207 .enable_reg = DSP_IDLECT2,
208 .enable_bit = EN_XORPCK,
209 .recalc = &followparent_recalc,
210};
211
212static struct clk dsptim_ck = {
213 .name = "dsptim_ck",
214 .ops = &clkops_dspck,
215 .parent = &ck_ref,
216 .enable_reg = DSP_IDLECT2,
217 .enable_bit = EN_DSPTIMCK,
218 .recalc = &followparent_recalc,
219};
220
221/* Tie ARM_IDLECT1:IDLIF_ARM to this logical clock structure */
222static struct arm_idlect1_clk tc_ck = {
223 .clk = {
224 .name = "tc_ck",
225 .ops = &clkops_null,
226 .parent = &ck_dpll1,
227 .flags = CLOCK_IDLE_CONTROL,
228 .rate_offset = CKCTL_TCDIV_OFFSET,
229 .recalc = &omap1_ckctl_recalc,
230 .round_rate = omap1_clk_round_rate_ckctl_arm,
231 .set_rate = omap1_clk_set_rate_ckctl_arm,
232 },
233 .idlect_shift = 6,
234};
235
236static struct clk arminth_ck1510 = {
237 .name = "arminth_ck",
238 .ops = &clkops_null,
239 .parent = &tc_ck.clk,
240 .recalc = &followparent_recalc,
241 /* Note: On 1510 the frequency follows TC_CK
242 *
243 * 16xx version is in MPU clocks.
244 */
245};
246
247static struct clk tipb_ck = {
248 /* No-idle controlled by "tc_ck" */
249 .name = "tipb_ck",
250 .ops = &clkops_null,
251 .parent = &tc_ck.clk,
252 .recalc = &followparent_recalc,
253};
254
255static struct clk l3_ocpi_ck = {
256 /* No-idle controlled by "tc_ck" */
257 .name = "l3_ocpi_ck",
258 .ops = &clkops_generic,
259 .parent = &tc_ck.clk,
260 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
261 .enable_bit = EN_OCPI_CK,
262 .recalc = &followparent_recalc,
263};
264
265static struct clk tc1_ck = {
266 .name = "tc1_ck",
267 .ops = &clkops_generic,
268 .parent = &tc_ck.clk,
269 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
270 .enable_bit = EN_TC1_CK,
271 .recalc = &followparent_recalc,
272};
273
274/*
275 * FIXME: This clock seems to be necessary but no-one has asked for its
276 * activation. [ pm.c (SRAM), CCP, Camera ]
277 */
278static struct clk tc2_ck = {
279 .name = "tc2_ck",
280 .ops = &clkops_generic,
281 .parent = &tc_ck.clk,
282 .flags = ENABLE_ON_INIT,
283 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT3),
284 .enable_bit = EN_TC2_CK,
285 .recalc = &followparent_recalc,
286};
287
288static struct clk dma_ck = {
289 /* No-idle controlled by "tc_ck" */
290 .name = "dma_ck",
291 .ops = &clkops_null,
292 .parent = &tc_ck.clk,
293 .recalc = &followparent_recalc,
294};
295
296static struct clk dma_lcdfree_ck = {
297 .name = "dma_lcdfree_ck",
298 .ops = &clkops_null,
299 .parent = &tc_ck.clk,
300 .recalc = &followparent_recalc,
301};
302
303static struct arm_idlect1_clk api_ck = {
304 .clk = {
305 .name = "api_ck",
306 .ops = &clkops_generic,
307 .parent = &tc_ck.clk,
308 .flags = CLOCK_IDLE_CONTROL,
309 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
310 .enable_bit = EN_APICK,
311 .recalc = &followparent_recalc,
312 },
313 .idlect_shift = 8,
314};
315
316static struct arm_idlect1_clk lb_ck = {
317 .clk = {
318 .name = "lb_ck",
319 .ops = &clkops_generic,
320 .parent = &tc_ck.clk,
321 .flags = CLOCK_IDLE_CONTROL,
322 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
323 .enable_bit = EN_LBCK,
324 .recalc = &followparent_recalc,
325 },
326 .idlect_shift = 4,
327};
328
329static struct clk rhea1_ck = {
330 .name = "rhea1_ck",
331 .ops = &clkops_null,
332 .parent = &tc_ck.clk,
333 .recalc = &followparent_recalc,
334};
335
336static struct clk rhea2_ck = {
337 .name = "rhea2_ck",
338 .ops = &clkops_null,
339 .parent = &tc_ck.clk,
340 .recalc = &followparent_recalc,
341};
342
343static struct clk lcd_ck_16xx = {
344 .name = "lcd_ck",
345 .ops = &clkops_generic,
346 .parent = &ck_dpll1,
347 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
348 .enable_bit = EN_LCDCK,
349 .rate_offset = CKCTL_LCDDIV_OFFSET,
350 .recalc = &omap1_ckctl_recalc,
351 .round_rate = omap1_clk_round_rate_ckctl_arm,
352 .set_rate = omap1_clk_set_rate_ckctl_arm,
353};
354
355static struct arm_idlect1_clk lcd_ck_1510 = {
356 .clk = {
357 .name = "lcd_ck",
358 .ops = &clkops_generic,
359 .parent = &ck_dpll1,
360 .flags = CLOCK_IDLE_CONTROL,
361 .enable_reg = OMAP1_IO_ADDRESS(ARM_IDLECT2),
362 .enable_bit = EN_LCDCK,
363 .rate_offset = CKCTL_LCDDIV_OFFSET,
364 .recalc = &omap1_ckctl_recalc,
365 .round_rate = omap1_clk_round_rate_ckctl_arm,
366 .set_rate = omap1_clk_set_rate_ckctl_arm,
367 },
368 .idlect_shift = 3,
369};
370
371static struct clk uart1_1510 = {
372 .name = "uart1_ck",
373 .ops = &clkops_null,
374 /* Direct from ULPD, no real parent */
375 .parent = &armper_ck.clk,
376 .rate = 12000000,
377 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
378 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
379 .enable_bit = 29, /* Chooses between 12MHz and 48MHz */
380 .set_rate = &omap1_set_uart_rate,
381 .recalc = &omap1_uart_recalc,
382};
383
384static struct uart_clk uart1_16xx = {
385 .clk = {
386 .name = "uart1_ck",
387 .ops = &clkops_uart,
388 /* Direct from ULPD, no real parent */
389 .parent = &armper_ck.clk,
390 .rate = 48000000,
391 .flags = RATE_FIXED | ENABLE_REG_32BIT |
392 CLOCK_NO_IDLE_PARENT,
393 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
394 .enable_bit = 29,
395 },
396 .sysc_addr = 0xfffb0054,
397};
398
399static struct clk uart2_ck = {
400 .name = "uart2_ck",
401 .ops = &clkops_null,
402 /* Direct from ULPD, no real parent */
403 .parent = &armper_ck.clk,
404 .rate = 12000000,
405 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
406 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
407 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */
408 .set_rate = &omap1_set_uart_rate,
409 .recalc = &omap1_uart_recalc,
410};
411
412static struct clk uart3_1510 = {
413 .name = "uart3_ck",
414 .ops = &clkops_null,
415 /* Direct from ULPD, no real parent */
416 .parent = &armper_ck.clk,
417 .rate = 12000000,
418 .flags = ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
419 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
420 .enable_bit = 31, /* Chooses between 12MHz and 48MHz */
421 .set_rate = &omap1_set_uart_rate,
422 .recalc = &omap1_uart_recalc,
423};
424
425static struct uart_clk uart3_16xx = {
426 .clk = {
427 .name = "uart3_ck",
428 .ops = &clkops_uart,
429 /* Direct from ULPD, no real parent */
430 .parent = &armper_ck.clk,
431 .rate = 48000000,
432 .flags = RATE_FIXED | ENABLE_REG_32BIT |
433 CLOCK_NO_IDLE_PARENT,
434 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
435 .enable_bit = 31,
436 },
437 .sysc_addr = 0xfffb9854,
438};
439
440static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */
441 .name = "usb_clko",
442 .ops = &clkops_generic,
443 /* Direct from ULPD, no parent */
444 .rate = 6000000,
445 .flags = RATE_FIXED | ENABLE_REG_32BIT,
446 .enable_reg = OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL),
447 .enable_bit = USB_MCLK_EN_BIT,
448};
449
450static struct clk usb_hhc_ck1510 = {
451 .name = "usb_hhc_ck",
452 .ops = &clkops_generic,
453 /* Direct from ULPD, no parent */
454 .rate = 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
455 .flags = RATE_FIXED | ENABLE_REG_32BIT,
456 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
457 .enable_bit = USB_HOST_HHC_UHOST_EN,
458};
459
460static struct clk usb_hhc_ck16xx = {
461 .name = "usb_hhc_ck",
462 .ops = &clkops_generic,
463 /* Direct from ULPD, no parent */
464 .rate = 48000000,
465 /* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
466 .flags = RATE_FIXED | ENABLE_REG_32BIT,
467 .enable_reg = OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */
468 .enable_bit = 8 /* UHOST_EN */,
469};
470
471static struct clk usb_dc_ck = {
472 .name = "usb_dc_ck",
473 .ops = &clkops_generic,
474 /* Direct from ULPD, no parent */
475 .rate = 48000000,
476 .flags = RATE_FIXED,
477 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
478 .enable_bit = 4,
479};
480
481static struct clk usb_dc_ck7xx = {
482 .name = "usb_dc_ck",
483 .ops = &clkops_generic,
484 /* Direct from ULPD, no parent */
485 .rate = 48000000,
486 .flags = RATE_FIXED,
487 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
488 .enable_bit = 8,
489};
490
491static struct clk mclk_1510 = {
492 .name = "mclk",
493 .ops = &clkops_generic,
494 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
495 .rate = 12000000,
496 .flags = RATE_FIXED,
497 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
498 .enable_bit = 6,
499};
500
501static struct clk mclk_16xx = {
502 .name = "mclk",
503 .ops = &clkops_generic,
504 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
505 .enable_reg = OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL),
506 .enable_bit = COM_ULPD_PLL_CLK_REQ,
507 .set_rate = &omap1_set_ext_clk_rate,
508 .round_rate = &omap1_round_ext_clk_rate,
509 .init = &omap1_init_ext_clk,
510};
511
512static struct clk bclk_1510 = {
513 .name = "bclk",
514 .ops = &clkops_generic,
515 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
516 .rate = 12000000,
517 .flags = RATE_FIXED,
518};
519
520static struct clk bclk_16xx = {
521 .name = "bclk",
522 .ops = &clkops_generic,
523 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
524 .enable_reg = OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL),
525 .enable_bit = SWD_ULPD_PLL_CLK_REQ,
526 .set_rate = &omap1_set_ext_clk_rate,
527 .round_rate = &omap1_round_ext_clk_rate,
528 .init = &omap1_init_ext_clk,
529};
530
531static struct clk mmc1_ck = {
532 .name = "mmc_ck",
533 .ops = &clkops_generic,
534 /* Functional clock is direct from ULPD, interface clock is ARMPER */
535 .parent = &armper_ck.clk,
536 .rate = 48000000,
537 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
538 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
539 .enable_bit = 23,
540};
541
542static struct clk mmc2_ck = {
543 .name = "mmc_ck",
544 .id = 1,
545 .ops = &clkops_generic,
546 /* Functional clock is direct from ULPD, interface clock is ARMPER */
547 .parent = &armper_ck.clk,
548 .rate = 48000000,
549 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
550 .enable_reg = OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
551 .enable_bit = 20,
552};
553
554static struct clk mmc3_ck = {
555 .name = "mmc_ck",
556 .id = 2,
557 .ops = &clkops_generic,
558 /* Functional clock is direct from ULPD, interface clock is ARMPER */
559 .parent = &armper_ck.clk,
560 .rate = 48000000,
561 .flags = RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
562 .enable_reg = OMAP1_IO_ADDRESS(SOFT_REQ_REG),
563 .enable_bit = 12,
564};
565
566static struct clk virtual_ck_mpu = {
567 .name = "mpu",
568 .ops = &clkops_null,
569 .parent = &arm_ck, /* Is smarter alias for */
570 .recalc = &followparent_recalc,
571 .set_rate = &omap1_select_table_rate,
572 .round_rate = &omap1_round_to_table_rate,
573};
574
575/* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK
576remains active during MPU idle whenever this is enabled */
577static struct clk i2c_fck = {
578 .name = "i2c_fck",
579 .id = 1,
580 .ops = &clkops_null,
581 .flags = CLOCK_NO_IDLE_PARENT,
582 .parent = &armxor_ck.clk,
583 .recalc = &followparent_recalc,
584};
585
586static struct clk i2c_ick = {
587 .name = "i2c_ick",
588 .id = 1,
589 .ops = &clkops_null,
590 .flags = CLOCK_NO_IDLE_PARENT,
591 .parent = &armper_ck.clk,
592 .recalc = &followparent_recalc,
593};
594
595/*
596 * clkdev integration
597 */
598
599static struct omap_clk omap_clks[] = {
600 /* non-ULPD clocks */
601 CLK(NULL, "ck_ref", &ck_ref, CK_16XX | CK_1510 | CK_310 | CK_7XX),
602 CLK(NULL, "ck_dpll1", &ck_dpll1, CK_16XX | CK_1510 | CK_310),
603 /* CK_GEN1 clocks */
604 CLK(NULL, "ck_dpll1out", &ck_dpll1out.clk, CK_16XX),
605 CLK(NULL, "ck_sossi", &sossi_ck, CK_16XX),
606 CLK(NULL, "arm_ck", &arm_ck, CK_16XX | CK_1510 | CK_310),
607 CLK(NULL, "armper_ck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
608 CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310),
609 CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
610 CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310),
611 CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310),
612 CLK("omap_wdt", "ick", &armper_ck.clk, CK_16XX),
613 CLK("omap_wdt", "ick", &dummy_ck, CK_1510 | CK_310),
614 CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310),
615 CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX),
616 /* CK_GEN2 clocks */
617 CLK(NULL, "dsp_ck", &dsp_ck, CK_16XX | CK_1510 | CK_310),
618 CLK(NULL, "dspmmu_ck", &dspmmu_ck, CK_16XX | CK_1510 | CK_310),
619 CLK(NULL, "dspper_ck", &dspper_ck, CK_16XX | CK_1510 | CK_310),
620 CLK(NULL, "dspxor_ck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
621 CLK(NULL, "dsptim_ck", &dsptim_ck, CK_16XX | CK_1510 | CK_310),
622 /* CK_GEN3 clocks */
623 CLK(NULL, "tc_ck", &tc_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
624 CLK(NULL, "tipb_ck", &tipb_ck, CK_1510 | CK_310),
625 CLK(NULL, "l3_ocpi_ck", &l3_ocpi_ck, CK_16XX | CK_7XX),
626 CLK(NULL, "tc1_ck", &tc1_ck, CK_16XX),
627 CLK(NULL, "tc2_ck", &tc2_ck, CK_16XX),
628 CLK(NULL, "dma_ck", &dma_ck, CK_16XX | CK_1510 | CK_310),
629 CLK(NULL, "dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
630 CLK(NULL, "api_ck", &api_ck.clk, CK_16XX | CK_1510 | CK_310),
631 CLK(NULL, "lb_ck", &lb_ck.clk, CK_1510 | CK_310),
632 CLK(NULL, "rhea1_ck", &rhea1_ck, CK_16XX),
633 CLK(NULL, "rhea2_ck", &rhea2_ck, CK_16XX),
634 CLK(NULL, "lcd_ck", &lcd_ck_16xx, CK_16XX | CK_7XX),
635 CLK(NULL, "lcd_ck", &lcd_ck_1510.clk, CK_1510 | CK_310),
636 /* ULPD clocks */
637 CLK(NULL, "uart1_ck", &uart1_1510, CK_1510 | CK_310),
638 CLK(NULL, "uart1_ck", &uart1_16xx.clk, CK_16XX),
639 CLK(NULL, "uart2_ck", &uart2_ck, CK_16XX | CK_1510 | CK_310),
640 CLK(NULL, "uart3_ck", &uart3_1510, CK_1510 | CK_310),
641 CLK(NULL, "uart3_ck", &uart3_16xx.clk, CK_16XX),
642 CLK(NULL, "usb_clko", &usb_clko, CK_16XX | CK_1510 | CK_310),
643 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck1510, CK_1510 | CK_310),
644 CLK(NULL, "usb_hhc_ck", &usb_hhc_ck16xx, CK_16XX),
645 CLK(NULL, "usb_dc_ck", &usb_dc_ck, CK_16XX),
646 CLK(NULL, "usb_dc_ck", &usb_dc_ck7xx, CK_7XX),
647 CLK(NULL, "mclk", &mclk_1510, CK_1510 | CK_310),
648 CLK(NULL, "mclk", &mclk_16xx, CK_16XX),
649 CLK(NULL, "bclk", &bclk_1510, CK_1510 | CK_310),
650 CLK(NULL, "bclk", &bclk_16xx, CK_16XX),
651 CLK("mmci-omap.0", "fck", &mmc1_ck, CK_16XX | CK_1510 | CK_310),
652 CLK("mmci-omap.0", "fck", &mmc3_ck, CK_7XX),
653 CLK("mmci-omap.0", "ick", &armper_ck.clk, CK_16XX | CK_1510 | CK_310 | CK_7XX),
654 CLK("mmci-omap.1", "fck", &mmc2_ck, CK_16XX),
655 CLK("mmci-omap.1", "ick", &armper_ck.clk, CK_16XX),
656 /* Virtual clocks */
657 CLK(NULL, "mpu", &virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
658 CLK("i2c_omap.1", "fck", &i2c_fck, CK_16XX | CK_1510 | CK_310 | CK_7XX),
659 CLK("i2c_omap.1", "ick", &i2c_ick, CK_16XX),
660 CLK("i2c_omap.1", "ick", &dummy_ck, CK_1510 | CK_310 | CK_7XX),
661 CLK("omap_uwire", "fck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310),
662 CLK("omap-mcbsp.1", "ick", &dspper_ck, CK_16XX),
663 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_1510 | CK_310),
664 CLK("omap-mcbsp.2", "ick", &armper_ck.clk, CK_16XX),
665 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_1510 | CK_310),
666 CLK("omap-mcbsp.3", "ick", &dspper_ck, CK_16XX),
667 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_1510 | CK_310),
668 CLK("omap-mcbsp.1", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
669 CLK("omap-mcbsp.2", "fck", &armper_ck.clk, CK_16XX | CK_1510 | CK_310),
670 CLK("omap-mcbsp.3", "fck", &dspxor_ck, CK_16XX | CK_1510 | CK_310),
671};
672
673/*
674 * init
675 */
676
677static struct clk_functions omap1_clk_functions __initdata = {
678 .clk_enable = omap1_clk_enable,
679 .clk_disable = omap1_clk_disable,
680 .clk_round_rate = omap1_clk_round_rate,
681 .clk_set_rate = omap1_clk_set_rate,
682 .clk_disable_unused = omap1_clk_disable_unused,
683};
684
685int __init omap1_clk_init(void)
686{
687 struct omap_clk *c;
688 const struct omap_clock_config *info;
689 int crystal_type = 0; /* Default 12 MHz */
690 u32 reg, cpu_mask;
691
692#ifdef CONFIG_DEBUG_LL
693 /*
694 * Resets some clocks that may be left on from bootloader,
695 * but leaves serial clocks on.
696 */
697 omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
698#endif
699
700 /* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
701 reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
702 omap_writew(reg, SOFT_REQ_REG);
703 if (!cpu_is_omap15xx())
704 omap_writew(0, SOFT_REQ_REG2);
705
706 clk_init(&omap1_clk_functions);
707
708 /* By default all idlect1 clocks are allowed to idle */
709 arm_idlect1_mask = ~0;
710
711 for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
712 clk_preinit(c->lk.clk);
713
714 cpu_mask = 0;
715 if (cpu_is_omap16xx())
716 cpu_mask |= CK_16XX;
717 if (cpu_is_omap1510())
718 cpu_mask |= CK_1510;
719 if (cpu_is_omap7xx())
720 cpu_mask |= CK_7XX;
721 if (cpu_is_omap310())
722 cpu_mask |= CK_310;
723
724 for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
725 if (c->cpu & cpu_mask) {
726 clkdev_add(&c->lk);
727 clk_register(c->lk.clk);
728 }
729
730 /* Pointers to these clocks are needed by code in clock.c */
731 api_ck_p = clk_get(NULL, "api_ck");
732 ck_dpll1_p = clk_get(NULL, "ck_dpll1");
733 ck_ref_p = clk_get(NULL, "ck_ref");
734
735 info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);
736 if (info != NULL) {
737 if (!cpu_is_omap15xx())
738 crystal_type = info->system_clock_type;
739 }
740
741#if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
742 ck_ref.rate = 13000000;
743#elif defined(CONFIG_ARCH_OMAP16XX)
744 if (crystal_type == 2)
745 ck_ref.rate = 19200000;
746#endif
747
748 pr_info("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: "
749 "0x%04x\n", omap_readw(ARM_SYSST), omap_readw(DPLL_CTL),
750 omap_readw(ARM_CKCTL));
751
752 /* We want to be in syncronous scalable mode */
753 omap_writew(0x1000, ARM_SYSST);
754
755#ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
756 /* Use values set by bootloader. Determine PLL rate and recalculate
757 * dependent clocks as if kernel had changed PLL or divisors.
758 */
759 {
760 unsigned pll_ctl_val = omap_readw(DPLL_CTL);
761
762 ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
763 if (pll_ctl_val & 0x10) {
764 /* PLL enabled, apply multiplier and divisor */
765 if (pll_ctl_val & 0xf80)
766 ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
767 ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
768 } else {
769 /* PLL disabled, apply bypass divisor */
770 switch (pll_ctl_val & 0xc) {
771 case 0:
772 break;
773 case 0x4:
774 ck_dpll1.rate /= 2;
775 break;
776 default:
777 ck_dpll1.rate /= 4;
778 break;
779 }
780 }
781 }
782#else
783 /* Find the highest supported frequency and enable it */
784 if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
785 printk(KERN_ERR "System frequencies not set. Check your config.\n");
786 /* Guess sane values (60MHz) */
787 omap_writew(0x2290, DPLL_CTL);
788 omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
789 ck_dpll1.rate = 60000000;
790 }
791#endif
792 propagate_rate(&ck_dpll1);
793 /* Cache rates for clocks connected to ck_ref (not dpll1) */
794 propagate_rate(&ck_ref);
795 printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
796 "%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
797 ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
798 ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
799 arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
800
801#if defined(CONFIG_MACH_OMAP_PERSEUS2) || defined(CONFIG_MACH_OMAP_FSAMPLE)
802 /* Select slicer output as OMAP input clock */
803 omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, OMAP7XX_PCC_UPLD_CTRL);
804#endif
805
806 /* Amstrad Delta wants BCLK high when inactive */
807 if (machine_is_ams_delta())
808 omap_writel(omap_readl(ULPD_CLOCK_CTRL) |
809 (1 << SDW_MCLK_INV_BIT),
810 ULPD_CLOCK_CTRL);
811
812 /* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
813 /* (on 730, bit 13 must not be cleared) */
814 if (cpu_is_omap7xx())
815 omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
816 else
817 omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
818
819 /* Put DSP/MPUI into reset until needed */
820 omap_writew(0, ARM_RSTCT1);
821 omap_writew(1, ARM_RSTCT2);
822 omap_writew(0x400, ARM_IDLECT1);
823
824 /*
825 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
826 * of the ARM_IDLECT2 register must be set to zero. The power-on
827 * default value of this bit is one.
828 */
829 omap_writew(0x0000, ARM_IDLECT2); /* Turn LCD clock off also */
830
831 /*
832 * Only enable those clocks we will need, let the drivers
833 * enable other clocks as necessary
834 */
835 clk_enable(&armper_ck.clk);
836 clk_enable(&armxor_ck.clk);
837 clk_enable(&armtim_ck.clk); /* This should be done by timer code */
838
839 if (cpu_is_omap15xx())
840 clk_enable(&arm_gpio_ck);
841
842 return 0;
843}
diff --git a/arch/arm/mach-omap1/i2c.c b/arch/arm/mach-omap1/i2c.c
new file mode 100644
index 000000000000..1bf4735e27a6
--- /dev/null
+++ b/arch/arm/mach-omap1/i2c.c
@@ -0,0 +1,39 @@
1/*
2 * Helper module for board specific I2C bus registration
3 *
4 * Copyright (C) 2009 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <plat/i2c.h>
23#include <plat/mux.h>
24#include <plat/cpu.h>
25
26int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
27 struct i2c_board_info const *info,
28 unsigned len)
29{
30 if (cpu_is_omap7xx()) {
31 omap_cfg_reg(I2C_7XX_SDA);
32 omap_cfg_reg(I2C_7XX_SCL);
33 } else {
34 omap_cfg_reg(I2C_SDA);
35 omap_cfg_reg(I2C_SCL);
36 }
37
38 return omap_plat_register_i2c_bus(bus_id, clkrate, info, len);
39}
diff --git a/arch/arm/mach-omap1/include/mach/lcd_dma.h b/arch/arm/mach-omap1/include/mach/lcd_dma.h
new file mode 100644
index 000000000000..d7a457bbcb7f
--- /dev/null
+++ b/arch/arm/mach-omap1/include/mach/lcd_dma.h
@@ -0,0 +1,78 @@
1/*
2 * arch/arm/mach-omap1/include/mach/lcd_dma.h
3 *
4 * Extracted from arch/arm/plat-omap/include/plat/dma.h
5 * Copyright (C) 2003 Nokia Corporation
6 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#ifndef __MACH_OMAP1_LCD_DMA_H__
23#define __MACH_OMAP1_LCD_DMA_H__
24
25/* Hardware registers for LCD DMA */
26#define OMAP1510_DMA_LCD_BASE (0xfffedb00)
27#define OMAP1510_DMA_LCD_CTRL (OMAP1510_DMA_LCD_BASE + 0x00)
28#define OMAP1510_DMA_LCD_TOP_F1_L (OMAP1510_DMA_LCD_BASE + 0x02)
29#define OMAP1510_DMA_LCD_TOP_F1_U (OMAP1510_DMA_LCD_BASE + 0x04)
30#define OMAP1510_DMA_LCD_BOT_F1_L (OMAP1510_DMA_LCD_BASE + 0x06)
31#define OMAP1510_DMA_LCD_BOT_F1_U (OMAP1510_DMA_LCD_BASE + 0x08)
32
33#define OMAP1610_DMA_LCD_BASE (0xfffee300)
34#define OMAP1610_DMA_LCD_CSDP (OMAP1610_DMA_LCD_BASE + 0xc0)
35#define OMAP1610_DMA_LCD_CCR (OMAP1610_DMA_LCD_BASE + 0xc2)
36#define OMAP1610_DMA_LCD_CTRL (OMAP1610_DMA_LCD_BASE + 0xc4)
37#define OMAP1610_DMA_LCD_TOP_B1_L (OMAP1610_DMA_LCD_BASE + 0xc8)
38#define OMAP1610_DMA_LCD_TOP_B1_U (OMAP1610_DMA_LCD_BASE + 0xca)
39#define OMAP1610_DMA_LCD_BOT_B1_L (OMAP1610_DMA_LCD_BASE + 0xcc)
40#define OMAP1610_DMA_LCD_BOT_B1_U (OMAP1610_DMA_LCD_BASE + 0xce)
41#define OMAP1610_DMA_LCD_TOP_B2_L (OMAP1610_DMA_LCD_BASE + 0xd0)
42#define OMAP1610_DMA_LCD_TOP_B2_U (OMAP1610_DMA_LCD_BASE + 0xd2)
43#define OMAP1610_DMA_LCD_BOT_B2_L (OMAP1610_DMA_LCD_BASE + 0xd4)
44#define OMAP1610_DMA_LCD_BOT_B2_U (OMAP1610_DMA_LCD_BASE + 0xd6)
45#define OMAP1610_DMA_LCD_SRC_EI_B1 (OMAP1610_DMA_LCD_BASE + 0xd8)
46#define OMAP1610_DMA_LCD_SRC_FI_B1_L (OMAP1610_DMA_LCD_BASE + 0xda)
47#define OMAP1610_DMA_LCD_SRC_EN_B1 (OMAP1610_DMA_LCD_BASE + 0xe0)
48#define OMAP1610_DMA_LCD_SRC_FN_B1 (OMAP1610_DMA_LCD_BASE + 0xe4)
49#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea)
50#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4)
51
52/* LCD DMA block numbers */
53enum {
54 OMAP_LCD_DMA_B1_TOP,
55 OMAP_LCD_DMA_B1_BOTTOM,
56 OMAP_LCD_DMA_B2_TOP,
57 OMAP_LCD_DMA_B2_BOTTOM
58};
59
60/* LCD DMA functions */
61extern int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
62 void *data);
63extern void omap_free_lcd_dma(void);
64extern void omap_setup_lcd_dma(void);
65extern void omap_enable_lcd_dma(void);
66extern void omap_stop_lcd_dma(void);
67extern void omap_set_lcd_dma_ext_controller(int external);
68extern void omap_set_lcd_dma_single_transfer(int single);
69extern void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
70 int data_type);
71extern void omap_set_lcd_dma_b1_rotation(int rotate);
72extern void omap_set_lcd_dma_b1_vxres(unsigned long vxres);
73extern void omap_set_lcd_dma_b1_mirror(int mirror);
74extern void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale);
75
76extern int omap_lcd_dma_running(void);
77
78#endif /* __MACH_OMAP1_LCD_DMA_H__ */
diff --git a/arch/arm/mach-omap1/include/mach/lcdc.h b/arch/arm/mach-omap1/include/mach/lcdc.h
new file mode 100644
index 000000000000..89bd703adaf6
--- /dev/null
+++ b/arch/arm/mach-omap1/include/mach/lcdc.h
@@ -0,0 +1,57 @@
1/*
2 * arch/arm/mach-omap1/include/mach/lcdc.h
3 *
4 * Extracted from drivers/video/omap/lcdc.c
5 * Copyright (C) 2004 Nokia Corporation
6 * Author: Imre Deak <imre.deak@nokia.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21 */
22#ifndef __MACH_LCDC_H__
23#define __MACH_LCDC_H__
24
25#define OMAP_LCDC_BASE 0xfffec000
26#define OMAP_LCDC_SIZE 256
27#define OMAP_LCDC_IRQ INT_LCD_CTRL
28
29#define OMAP_LCDC_CONTROL (OMAP_LCDC_BASE + 0x00)
30#define OMAP_LCDC_TIMING0 (OMAP_LCDC_BASE + 0x04)
31#define OMAP_LCDC_TIMING1 (OMAP_LCDC_BASE + 0x08)
32#define OMAP_LCDC_TIMING2 (OMAP_LCDC_BASE + 0x0c)
33#define OMAP_LCDC_STATUS (OMAP_LCDC_BASE + 0x10)
34#define OMAP_LCDC_SUBPANEL (OMAP_LCDC_BASE + 0x14)
35#define OMAP_LCDC_LINE_INT (OMAP_LCDC_BASE + 0x18)
36#define OMAP_LCDC_DISPLAY_STATUS (OMAP_LCDC_BASE + 0x1c)
37
38#define OMAP_LCDC_STAT_DONE (1 << 0)
39#define OMAP_LCDC_STAT_VSYNC (1 << 1)
40#define OMAP_LCDC_STAT_SYNC_LOST (1 << 2)
41#define OMAP_LCDC_STAT_ABC (1 << 3)
42#define OMAP_LCDC_STAT_LINE_INT (1 << 4)
43#define OMAP_LCDC_STAT_FUF (1 << 5)
44#define OMAP_LCDC_STAT_LOADED_PALETTE (1 << 6)
45
46#define OMAP_LCDC_CTRL_LCD_EN (1 << 0)
47#define OMAP_LCDC_CTRL_LCD_TFT (1 << 7)
48#define OMAP_LCDC_CTRL_LINE_IRQ_CLR_SEL (1 << 10)
49
50#define OMAP_LCDC_IRQ_VSYNC (1 << 2)
51#define OMAP_LCDC_IRQ_DONE (1 << 3)
52#define OMAP_LCDC_IRQ_LOADED_PALETTE (1 << 4)
53#define OMAP_LCDC_IRQ_LINE_NIRQ (1 << 5)
54#define OMAP_LCDC_IRQ_LINE (1 << 6)
55#define OMAP_LCDC_IRQ_MASK (((1 << 5) - 1) << 2)
56
57#endif /* __MACH_LCDC_H__ */
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 2a6d68aa3489..d9b8d82530ae 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -18,7 +18,8 @@
18#include <plat/mux.h> 18#include <plat/mux.h>
19#include <plat/tc.h> 19#include <plat/tc.h>
20 20
21extern int omap1_clk_init(void); 21#include "clock.h"
22
22extern void omap_check_revision(void); 23extern void omap_check_revision(void);
23extern void omap_sram_init(void); 24extern void omap_sram_init(void);
24extern void omapfb_reserve_sdram(void); 25extern void omapfb_reserve_sdram(void);
diff --git a/arch/arm/mach-omap1/lcd_dma.c b/arch/arm/mach-omap1/lcd_dma.c
new file mode 100644
index 000000000000..3be11af687bb
--- /dev/null
+++ b/arch/arm/mach-omap1/lcd_dma.c
@@ -0,0 +1,448 @@
1/*
2 * linux/arch/arm/mach-omap1/lcd_dma.c
3 *
4 * Extracted from arch/arm/plat-omap/dma.c
5 * Copyright (C) 2003 - 2008 Nokia Corporation
6 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
7 * DMA channel linking for 1610 by Samuel Ortiz <samuel.ortiz@nokia.com>
8 * Graphics DMA and LCD DMA graphics tranformations
9 * by Imre Deak <imre.deak@nokia.com>
10 * OMAP2/3 support Copyright (C) 2004-2007 Texas Instruments, Inc.
11 * Merged to support both OMAP1 and OMAP2 by Tony Lindgren <tony@atomide.com>
12 * Some functions based on earlier dma-omap.c Copyright (C) 2001 RidgeRun, Inc.
13 *
14 * Copyright (C) 2009 Texas Instruments
15 * Added OMAP4 support - Santosh Shilimkar <santosh.shilimkar@ti.com>
16 *
17 * Support functions for the OMAP internal DMA channels.
18 *
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License version 2 as
21 * published by the Free Software Foundation.
22 *
23 */
24
25#include <linux/module.h>
26#include <linux/spinlock.h>
27#include <linux/interrupt.h>
28#include <linux/io.h>
29
30#include <mach/hardware.h>
31#include <mach/lcdc.h>
32#include <plat/dma.h>
33
34int omap_lcd_dma_running(void)
35{
36 /*
37 * On OMAP1510, internal LCD controller will start the transfer
38 * when it gets enabled, so assume DMA running if LCD enabled.
39 */
40 if (cpu_is_omap1510())
41 if (omap_readw(OMAP_LCDC_CONTROL) & OMAP_LCDC_CTRL_LCD_EN)
42 return 1;
43
44 /* Check if LCD DMA is running */
45 if (cpu_is_omap16xx())
46 if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
47 return 1;
48
49 return 0;
50}
51
52static struct lcd_dma_info {
53 spinlock_t lock;
54 int reserved;
55 void (*callback)(u16 status, void *data);
56 void *cb_data;
57
58 int active;
59 unsigned long addr, size;
60 int rotate, data_type, xres, yres;
61 int vxres;
62 int mirror;
63 int xscale, yscale;
64 int ext_ctrl;
65 int src_port;
66 int single_transfer;
67} lcd_dma;
68
69void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
70 int data_type)
71{
72 lcd_dma.addr = addr;
73 lcd_dma.data_type = data_type;
74 lcd_dma.xres = fb_xres;
75 lcd_dma.yres = fb_yres;
76}
77EXPORT_SYMBOL(omap_set_lcd_dma_b1);
78
79void omap_set_lcd_dma_src_port(int port)
80{
81 lcd_dma.src_port = port;
82}
83
84void omap_set_lcd_dma_ext_controller(int external)
85{
86 lcd_dma.ext_ctrl = external;
87}
88EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
89
90void omap_set_lcd_dma_single_transfer(int single)
91{
92 lcd_dma.single_transfer = single;
93}
94EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
95
96void omap_set_lcd_dma_b1_rotation(int rotate)
97{
98 if (cpu_is_omap1510()) {
99 printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n");
100 BUG();
101 return;
102 }
103 lcd_dma.rotate = rotate;
104}
105EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
106
107void omap_set_lcd_dma_b1_mirror(int mirror)
108{
109 if (cpu_is_omap1510()) {
110 printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n");
111 BUG();
112 }
113 lcd_dma.mirror = mirror;
114}
115EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
116
117void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
118{
119 if (cpu_is_omap1510()) {
120 printk(KERN_ERR "DMA virtual resulotion is not supported "
121 "in 1510 mode\n");
122 BUG();
123 }
124 lcd_dma.vxres = vxres;
125}
126EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
127
128void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
129{
130 if (cpu_is_omap1510()) {
131 printk(KERN_ERR "DMA scale is not supported in 1510 mode\n");
132 BUG();
133 }
134 lcd_dma.xscale = xscale;
135 lcd_dma.yscale = yscale;
136}
137EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
138
139static void set_b1_regs(void)
140{
141 unsigned long top, bottom;
142 int es;
143 u16 w;
144 unsigned long en, fn;
145 long ei, fi;
146 unsigned long vxres;
147 unsigned int xscale, yscale;
148
149 switch (lcd_dma.data_type) {
150 case OMAP_DMA_DATA_TYPE_S8:
151 es = 1;
152 break;
153 case OMAP_DMA_DATA_TYPE_S16:
154 es = 2;
155 break;
156 case OMAP_DMA_DATA_TYPE_S32:
157 es = 4;
158 break;
159 default:
160 BUG();
161 return;
162 }
163
164 vxres = lcd_dma.vxres ? lcd_dma.vxres : lcd_dma.xres;
165 xscale = lcd_dma.xscale ? lcd_dma.xscale : 1;
166 yscale = lcd_dma.yscale ? lcd_dma.yscale : 1;
167 BUG_ON(vxres < lcd_dma.xres);
168
169#define PIXADDR(x, y) (lcd_dma.addr + \
170 ((y) * vxres * yscale + (x) * xscale) * es)
171#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1)
172
173 switch (lcd_dma.rotate) {
174 case 0:
175 if (!lcd_dma.mirror) {
176 top = PIXADDR(0, 0);
177 bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
178 /* 1510 DMA requires the bottom address to be 2 more
179 * than the actual last memory access location. */
180 if (cpu_is_omap1510() &&
181 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32)
182 bottom += 2;
183 ei = PIXSTEP(0, 0, 1, 0);
184 fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1);
185 } else {
186 top = PIXADDR(lcd_dma.xres - 1, 0);
187 bottom = PIXADDR(0, lcd_dma.yres - 1);
188 ei = PIXSTEP(1, 0, 0, 0);
189 fi = PIXSTEP(0, 0, lcd_dma.xres - 1, 1);
190 }
191 en = lcd_dma.xres;
192 fn = lcd_dma.yres;
193 break;
194 case 90:
195 if (!lcd_dma.mirror) {
196 top = PIXADDR(0, lcd_dma.yres - 1);
197 bottom = PIXADDR(lcd_dma.xres - 1, 0);
198 ei = PIXSTEP(0, 1, 0, 0);
199 fi = PIXSTEP(0, 0, 1, lcd_dma.yres - 1);
200 } else {
201 top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
202 bottom = PIXADDR(0, 0);
203 ei = PIXSTEP(0, 1, 0, 0);
204 fi = PIXSTEP(1, 0, 0, lcd_dma.yres - 1);
205 }
206 en = lcd_dma.yres;
207 fn = lcd_dma.xres;
208 break;
209 case 180:
210 if (!lcd_dma.mirror) {
211 top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
212 bottom = PIXADDR(0, 0);
213 ei = PIXSTEP(1, 0, 0, 0);
214 fi = PIXSTEP(0, 1, lcd_dma.xres - 1, 0);
215 } else {
216 top = PIXADDR(0, lcd_dma.yres - 1);
217 bottom = PIXADDR(lcd_dma.xres - 1, 0);
218 ei = PIXSTEP(0, 0, 1, 0);
219 fi = PIXSTEP(lcd_dma.xres - 1, 1, 0, 0);
220 }
221 en = lcd_dma.xres;
222 fn = lcd_dma.yres;
223 break;
224 case 270:
225 if (!lcd_dma.mirror) {
226 top = PIXADDR(lcd_dma.xres - 1, 0);
227 bottom = PIXADDR(0, lcd_dma.yres - 1);
228 ei = PIXSTEP(0, 0, 0, 1);
229 fi = PIXSTEP(1, lcd_dma.yres - 1, 0, 0);
230 } else {
231 top = PIXADDR(0, 0);
232 bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
233 ei = PIXSTEP(0, 0, 0, 1);
234 fi = PIXSTEP(0, lcd_dma.yres - 1, 1, 0);
235 }
236 en = lcd_dma.yres;
237 fn = lcd_dma.xres;
238 break;
239 default:
240 BUG();
241 return; /* Suppress warning about uninitialized vars */
242 }
243
244 if (cpu_is_omap1510()) {
245 omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U);
246 omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L);
247 omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U);
248 omap_writew(bottom, OMAP1510_DMA_LCD_BOT_F1_L);
249
250 return;
251 }
252
253 /* 1610 regs */
254 omap_writew(top >> 16, OMAP1610_DMA_LCD_TOP_B1_U);
255 omap_writew(top, OMAP1610_DMA_LCD_TOP_B1_L);
256 omap_writew(bottom >> 16, OMAP1610_DMA_LCD_BOT_B1_U);
257 omap_writew(bottom, OMAP1610_DMA_LCD_BOT_B1_L);
258
259 omap_writew(en, OMAP1610_DMA_LCD_SRC_EN_B1);
260 omap_writew(fn, OMAP1610_DMA_LCD_SRC_FN_B1);
261
262 w = omap_readw(OMAP1610_DMA_LCD_CSDP);
263 w &= ~0x03;
264 w |= lcd_dma.data_type;
265 omap_writew(w, OMAP1610_DMA_LCD_CSDP);
266
267 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
268 /* Always set the source port as SDRAM for now*/
269 w &= ~(0x03 << 6);
270 if (lcd_dma.callback != NULL)
271 w |= 1 << 1; /* Block interrupt enable */
272 else
273 w &= ~(1 << 1);
274 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
275
276 if (!(lcd_dma.rotate || lcd_dma.mirror ||
277 lcd_dma.vxres || lcd_dma.xscale || lcd_dma.yscale))
278 return;
279
280 w = omap_readw(OMAP1610_DMA_LCD_CCR);
281 /* Set the double-indexed addressing mode */
282 w |= (0x03 << 12);
283 omap_writew(w, OMAP1610_DMA_LCD_CCR);
284
285 omap_writew(ei, OMAP1610_DMA_LCD_SRC_EI_B1);
286 omap_writew(fi >> 16, OMAP1610_DMA_LCD_SRC_FI_B1_U);
287 omap_writew(fi, OMAP1610_DMA_LCD_SRC_FI_B1_L);
288}
289
290static irqreturn_t lcd_dma_irq_handler(int irq, void *dev_id)
291{
292 u16 w;
293
294 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
295 if (unlikely(!(w & (1 << 3)))) {
296 printk(KERN_WARNING "Spurious LCD DMA IRQ\n");
297 return IRQ_NONE;
298 }
299 /* Ack the IRQ */
300 w |= (1 << 3);
301 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
302 lcd_dma.active = 0;
303 if (lcd_dma.callback != NULL)
304 lcd_dma.callback(w, lcd_dma.cb_data);
305
306 return IRQ_HANDLED;
307}
308
309int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
310 void *data)
311{
312 spin_lock_irq(&lcd_dma.lock);
313 if (lcd_dma.reserved) {
314 spin_unlock_irq(&lcd_dma.lock);
315 printk(KERN_ERR "LCD DMA channel already reserved\n");
316 BUG();
317 return -EBUSY;
318 }
319 lcd_dma.reserved = 1;
320 spin_unlock_irq(&lcd_dma.lock);
321 lcd_dma.callback = callback;
322 lcd_dma.cb_data = data;
323 lcd_dma.active = 0;
324 lcd_dma.single_transfer = 0;
325 lcd_dma.rotate = 0;
326 lcd_dma.vxres = 0;
327 lcd_dma.mirror = 0;
328 lcd_dma.xscale = 0;
329 lcd_dma.yscale = 0;
330 lcd_dma.ext_ctrl = 0;
331 lcd_dma.src_port = 0;
332
333 return 0;
334}
335EXPORT_SYMBOL(omap_request_lcd_dma);
336
337void omap_free_lcd_dma(void)
338{
339 spin_lock(&lcd_dma.lock);
340 if (!lcd_dma.reserved) {
341 spin_unlock(&lcd_dma.lock);
342 printk(KERN_ERR "LCD DMA is not reserved\n");
343 BUG();
344 return;
345 }
346 if (!cpu_is_omap1510())
347 omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1,
348 OMAP1610_DMA_LCD_CCR);
349 lcd_dma.reserved = 0;
350 spin_unlock(&lcd_dma.lock);
351}
352EXPORT_SYMBOL(omap_free_lcd_dma);
353
354void omap_enable_lcd_dma(void)
355{
356 u16 w;
357
358 /*
359 * Set the Enable bit only if an external controller is
360 * connected. Otherwise the OMAP internal controller will
361 * start the transfer when it gets enabled.
362 */
363 if (cpu_is_omap1510() || !lcd_dma.ext_ctrl)
364 return;
365
366 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
367 w |= 1 << 8;
368 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
369
370 lcd_dma.active = 1;
371
372 w = omap_readw(OMAP1610_DMA_LCD_CCR);
373 w |= 1 << 7;
374 omap_writew(w, OMAP1610_DMA_LCD_CCR);
375}
376EXPORT_SYMBOL(omap_enable_lcd_dma);
377
378void omap_setup_lcd_dma(void)
379{
380 BUG_ON(lcd_dma.active);
381 if (!cpu_is_omap1510()) {
382 /* Set some reasonable defaults */
383 omap_writew(0x5440, OMAP1610_DMA_LCD_CCR);
384 omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP);
385 omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL);
386 }
387 set_b1_regs();
388 if (!cpu_is_omap1510()) {
389 u16 w;
390
391 w = omap_readw(OMAP1610_DMA_LCD_CCR);
392 /*
393 * If DMA was already active set the end_prog bit to have
394 * the programmed register set loaded into the active
395 * register set.
396 */
397 w |= 1 << 11; /* End_prog */
398 if (!lcd_dma.single_transfer)
399 w |= (3 << 8); /* Auto_init, repeat */
400 omap_writew(w, OMAP1610_DMA_LCD_CCR);
401 }
402}
403EXPORT_SYMBOL(omap_setup_lcd_dma);
404
405void omap_stop_lcd_dma(void)
406{
407 u16 w;
408
409 lcd_dma.active = 0;
410 if (cpu_is_omap1510() || !lcd_dma.ext_ctrl)
411 return;
412
413 w = omap_readw(OMAP1610_DMA_LCD_CCR);
414 w &= ~(1 << 7);
415 omap_writew(w, OMAP1610_DMA_LCD_CCR);
416
417 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
418 w &= ~(1 << 8);
419 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
420}
421EXPORT_SYMBOL(omap_stop_lcd_dma);
422
423static int __init omap_init_lcd_dma(void)
424{
425 int r;
426
427 if (cpu_is_omap16xx()) {
428 u16 w;
429
430 /* this would prevent OMAP sleep */
431 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
432 w &= ~(1 << 8);
433 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
434 }
435
436 spin_lock_init(&lcd_dma.lock);
437
438 r = request_irq(INT_DMA_LCD, lcd_dma_irq_handler, 0,
439 "LCD DMA", NULL);
440 if (r != 0)
441 printk(KERN_ERR "unable to request IRQ for LCD DMA "
442 "(error %d)\n", r);
443
444 return r;
445}
446
447arch_initcall(omap_init_lcd_dma);
448
diff --git a/arch/arm/mach-omap1/mux.c b/arch/arm/mach-omap1/mux.c
index 785371e982fc..07212cc621ae 100644
--- a/arch/arm/mach-omap1/mux.c
+++ b/arch/arm/mach-omap1/mux.c
@@ -50,12 +50,18 @@ MUX_CFG_7XX("E3_7XX_KBC4", 13, 25, 0, 24, 1, 0)
50 50
51MUX_CFG_7XX("AA17_7XX_USB_DM", 2, 21, 0, 20, 0, 0) 51MUX_CFG_7XX("AA17_7XX_USB_DM", 2, 21, 0, 20, 0, 0)
52MUX_CFG_7XX("W16_7XX_USB_PU_EN", 2, 25, 0, 24, 0, 0) 52MUX_CFG_7XX("W16_7XX_USB_PU_EN", 2, 25, 0, 24, 0, 0)
53MUX_CFG_7XX("W17_7XX_USB_VBUSI", 2, 29, 0, 28, 0, 0) 53MUX_CFG_7XX("W17_7XX_USB_VBUSI", 2, 29, 6, 28, 1, 0)
54MUX_CFG_7XX("W18_7XX_USB_DMCK_OUT",3, 3, 1, 2, 0, 0)
55MUX_CFG_7XX("W19_7XX_USB_DCRST", 3, 7, 1, 6, 0, 0)
54 56
55/* MMC Pins */ 57/* MMC Pins */
56MUX_CFG_7XX("MMC_7XX_CMD", 2, 9, 0, 8, 1, 0) 58MUX_CFG_7XX("MMC_7XX_CMD", 2, 9, 0, 8, 1, 0)
57MUX_CFG_7XX("MMC_7XX_CLK", 2, 13, 0, 12, 1, 0) 59MUX_CFG_7XX("MMC_7XX_CLK", 2, 13, 0, 12, 1, 0)
58MUX_CFG_7XX("MMC_7XX_DAT0", 2, 17, 0, 16, 1, 0) 60MUX_CFG_7XX("MMC_7XX_DAT0", 2, 17, 0, 16, 1, 0)
61
62/* I2C interface */
63MUX_CFG_7XX("I2C_7XX_SCL", 5, 1, 0, 0, 1, 0)
64MUX_CFG_7XX("I2C_7XX_SDA", 5, 5, 0, 0, 1, 0)
59}; 65};
60#define OMAP7XX_PINS_SZ ARRAY_SIZE(omap7xx_pins) 66#define OMAP7XX_PINS_SZ ARRAY_SIZE(omap7xx_pins)
61#else 67#else
diff --git a/arch/arm/mach-omap1/opp.h b/arch/arm/mach-omap1/opp.h
new file mode 100644
index 000000000000..07074d79adce
--- /dev/null
+++ b/arch/arm/mach-omap1/opp.h
@@ -0,0 +1,28 @@
1/*
2 * linux/arch/arm/mach-omap1/opp.h
3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __ARCH_ARM_MACH_OMAP1_OPP_H
14#define __ARCH_ARM_MACH_OMAP1_OPP_H
15
16#include <linux/types.h>
17
18struct mpu_rate {
19 unsigned long rate;
20 unsigned long xtal;
21 unsigned long pll_rate;
22 __u16 ckctl_val;
23 __u16 dpllctl_val;
24};
25
26extern struct mpu_rate omap1_rate_table[];
27
28#endif
diff --git a/arch/arm/mach-omap1/opp_data.c b/arch/arm/mach-omap1/opp_data.c
new file mode 100644
index 000000000000..75a546514994
--- /dev/null
+++ b/arch/arm/mach-omap1/opp_data.c
@@ -0,0 +1,59 @@
1/*
2 * linux/arch/arm/mach-omap1/opp_data.c
3 *
4 * Copyright (C) 2004 - 2005 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
6 * Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include "opp.h"
14
15/*-------------------------------------------------------------------------
16 * Omap1 MPU rate table
17 *-------------------------------------------------------------------------*/
18struct mpu_rate omap1_rate_table[] = {
19 /* MPU MHz, xtal MHz, dpll1 MHz, CKCTL, DPLL_CTL
20 * NOTE: Comment order here is different from bits in CKCTL value:
21 * armdiv, dspdiv, dspmmu, tcdiv, perdiv, lcddiv
22 */
23#if defined(CONFIG_OMAP_ARM_216MHZ)
24 { 216000000, 12000000, 216000000, 0x050d, 0x2910 }, /* 1/1/2/2/2/8 */
25#endif
26#if defined(CONFIG_OMAP_ARM_195MHZ)
27 { 195000000, 13000000, 195000000, 0x050e, 0x2790 }, /* 1/1/2/2/4/8 */
28#endif
29#if defined(CONFIG_OMAP_ARM_192MHZ)
30 { 192000000, 19200000, 192000000, 0x050f, 0x2510 }, /* 1/1/2/2/8/8 */
31 { 192000000, 12000000, 192000000, 0x050f, 0x2810 }, /* 1/1/2/2/8/8 */
32 { 96000000, 12000000, 192000000, 0x055f, 0x2810 }, /* 2/2/2/2/8/8 */
33 { 48000000, 12000000, 192000000, 0x0baf, 0x2810 }, /* 4/4/4/8/8/8 */
34 { 24000000, 12000000, 192000000, 0x0fff, 0x2810 }, /* 8/8/8/8/8/8 */
35#endif
36#if defined(CONFIG_OMAP_ARM_182MHZ)
37 { 182000000, 13000000, 182000000, 0x050e, 0x2710 }, /* 1/1/2/2/4/8 */
38#endif
39#if defined(CONFIG_OMAP_ARM_168MHZ)
40 { 168000000, 12000000, 168000000, 0x010f, 0x2710 }, /* 1/1/1/2/8/8 */
41#endif
42#if defined(CONFIG_OMAP_ARM_150MHZ)
43 { 150000000, 12000000, 150000000, 0x010a, 0x2cb0 }, /* 1/1/1/2/4/4 */
44#endif
45#if defined(CONFIG_OMAP_ARM_120MHZ)
46 { 120000000, 12000000, 120000000, 0x010a, 0x2510 }, /* 1/1/1/2/4/4 */
47#endif
48#if defined(CONFIG_OMAP_ARM_96MHZ)
49 { 96000000, 12000000, 96000000, 0x0005, 0x2410 }, /* 1/1/1/1/2/2 */
50#endif
51#if defined(CONFIG_OMAP_ARM_60MHZ)
52 { 60000000, 12000000, 60000000, 0x0005, 0x2290 }, /* 1/1/1/1/2/2 */
53#endif
54#if defined(CONFIG_OMAP_ARM_30MHZ)
55 { 30000000, 12000000, 60000000, 0x0555, 0x2290 }, /* 2/2/2/2/2/2 */
56#endif
57 { 0, 0, 0, 0, 0 },
58};
59
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 7309aab305a9..76c11ee113e9 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -24,6 +24,18 @@ config ARCH_OMAP3430
24 depends on ARCH_OMAP3 && ARCH_OMAP34XX 24 depends on ARCH_OMAP3 && ARCH_OMAP34XX
25 select ARCH_OMAP_OTG 25 select ARCH_OMAP_OTG
26 26
27config OMAP_PACKAGE_CBC
28 bool
29
30config OMAP_PACKAGE_CBB
31 bool
32
33config OMAP_PACKAGE_CUS
34 bool
35
36config OMAP_PACKAGE_CBP
37 bool
38
27comment "OMAP Board Type" 39comment "OMAP Board Type"
28 depends on ARCH_OMAP2 || ARCH_OMAP3 || ARCH_OMAP4 40 depends on ARCH_OMAP2 || ARCH_OMAP3 || ARCH_OMAP4
29 41
@@ -52,14 +64,17 @@ config MACH_OMAP_2430SDP
52config MACH_OMAP3_BEAGLE 64config MACH_OMAP3_BEAGLE
53 bool "OMAP3 BEAGLE board" 65 bool "OMAP3 BEAGLE board"
54 depends on ARCH_OMAP3 && ARCH_OMAP34XX 66 depends on ARCH_OMAP3 && ARCH_OMAP34XX
67 select OMAP_PACKAGE_CBB
55 68
56config MACH_OMAP_LDP 69config MACH_OMAP_LDP
57 bool "OMAP3 LDP board" 70 bool "OMAP3 LDP board"
58 depends on ARCH_OMAP3 && ARCH_OMAP34XX 71 depends on ARCH_OMAP3 && ARCH_OMAP34XX
72 select OMAP_PACKAGE_CBB
59 73
60config MACH_OVERO 74config MACH_OVERO
61 bool "Gumstix Overo board" 75 bool "Gumstix Overo board"
62 depends on ARCH_OMAP3 && ARCH_OMAP34XX 76 depends on ARCH_OMAP3 && ARCH_OMAP34XX
77 select OMAP_PACKAGE_CBB
63 78
64config MACH_OMAP3EVM 79config MACH_OMAP3EVM
65 bool "OMAP 3530 EVM board" 80 bool "OMAP 3530 EVM board"
@@ -68,14 +83,22 @@ config MACH_OMAP3EVM
68config MACH_OMAP3517EVM 83config MACH_OMAP3517EVM
69 bool "OMAP3517/ AM3517 EVM board" 84 bool "OMAP3517/ AM3517 EVM board"
70 depends on ARCH_OMAP3 && ARCH_OMAP34XX 85 depends on ARCH_OMAP3 && ARCH_OMAP34XX
86 select OMAP_PACKAGE_CBB
71 87
72config MACH_OMAP3_PANDORA 88config MACH_OMAP3_PANDORA
73 bool "OMAP3 Pandora" 89 bool "OMAP3 Pandora"
74 depends on ARCH_OMAP3 && ARCH_OMAP34XX 90 depends on ARCH_OMAP3 && ARCH_OMAP34XX
91 select OMAP_PACKAGE_CBB
92
93config MACH_OMAP3_TOUCHBOOK
94 bool "OMAP3 Touch Book"
95 depends on ARCH_OMAP3 && ARCH_OMAP34XX
96 select BACKLIGHT_CLASS_DEVICE
75 97
76config MACH_OMAP_3430SDP 98config MACH_OMAP_3430SDP
77 bool "OMAP 3430 SDP board" 99 bool "OMAP 3430 SDP board"
78 depends on ARCH_OMAP3 && ARCH_OMAP34XX 100 depends on ARCH_OMAP3 && ARCH_OMAP34XX
101 select OMAP_PACKAGE_CBB
79 102
80config MACH_NOKIA_N800 103config MACH_NOKIA_N800
81 bool 104 bool
@@ -96,26 +119,33 @@ config MACH_NOKIA_N8X0
96config MACH_NOKIA_RX51 119config MACH_NOKIA_RX51
97 bool "Nokia RX-51 board" 120 bool "Nokia RX-51 board"
98 depends on ARCH_OMAP3 && ARCH_OMAP34XX 121 depends on ARCH_OMAP3 && ARCH_OMAP34XX
122 select OMAP_PACKAGE_CBB
99 123
100config MACH_OMAP_ZOOM2 124config MACH_OMAP_ZOOM2
101 bool "OMAP3 Zoom2 board" 125 bool "OMAP3 Zoom2 board"
102 depends on ARCH_OMAP3 && ARCH_OMAP34XX 126 depends on ARCH_OMAP3 && ARCH_OMAP34XX
127 select OMAP_PACKAGE_CBB
103 128
104config MACH_OMAP_ZOOM3 129config MACH_OMAP_ZOOM3
105 bool "OMAP3630 Zoom3 board" 130 bool "OMAP3630 Zoom3 board"
106 depends on ARCH_OMAP3 && ARCH_OMAP34XX 131 depends on ARCH_OMAP3 && ARCH_OMAP34XX
132 select OMAP_PACKAGE_CBP
107 133
108config MACH_CM_T35 134config MACH_CM_T35
109 bool "CompuLab CM-T35 module" 135 bool "CompuLab CM-T35 module"
110 depends on ARCH_OMAP3 && ARCH_OMAP34XX 136 depends on ARCH_OMAP3 && ARCH_OMAP34XX
137 select OMAP_PACKAGE_CUS
138 select OMAP_MUX
111 139
112config MACH_IGEP0020 140config MACH_IGEP0020
113 bool "IGEP0020" 141 bool "IGEP0020"
114 depends on ARCH_OMAP3 && ARCH_OMAP34XX 142 depends on ARCH_OMAP3 && ARCH_OMAP34XX
143 select OMAP_PACKAGE_CBB
115 144
116config MACH_OMAP_3630SDP 145config MACH_OMAP_3630SDP
117 bool "OMAP3630 SDP board" 146 bool "OMAP3630 SDP board"
118 depends on ARCH_OMAP3 && ARCH_OMAP34XX 147 depends on ARCH_OMAP3 && ARCH_OMAP34XX
148 select OMAP_PACKAGE_CBP
119 149
120config MACH_OMAP_4430SDP 150config MACH_OMAP_4430SDP
121 bool "OMAP 4430 SDP board" 151 bool "OMAP 4430 SDP board"
@@ -128,3 +158,15 @@ config OMAP3_EMU
128 help 158 help
129 Say Y here to enable debugging hardware of omap3 159 Say Y here to enable debugging hardware of omap3
130 160
161config OMAP3_SDRC_AC_TIMING
162 bool "Enable SDRC AC timing register changes"
163 depends on ARCH_OMAP3 && ARCH_OMAP34XX
164 default n
165 help
166 If you know that none of your system initiators will attempt to
167 access SDRAM during CORE DVFS, select Y here. This should boost
168 SDRAM performance at lower CORE OPPs. There are relatively few
169 users who will wish to say yes at this point - almost everyone will
170 wish to say no. Selecting yes without understanding what is
171 going on could result in system crashes;
172
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 32548a4510c5..b32678b848bc 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -6,11 +6,14 @@
6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o 6obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o
7 7
8omap-2-3-common = irq.o sdrc.o omap_hwmod.o 8omap-2-3-common = irq.o sdrc.o omap_hwmod.o
9omap-3-4-common = dpll.o
9prcm-common = prcm.o powerdomain.o 10prcm-common = prcm.o powerdomain.o
10clock-common = clock.o clockdomain.o 11clock-common = clock.o clock_common_data.o clockdomain.o
11 12
12obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) 13obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common)
13obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common) 14obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(prcm-common) $(clock-common) \
15 $(omap-3-4-common)
16obj-$(CONFIG_ARCH_OMAP4) += $(omap-3-4-common) prcm.o clock.o
14 17
15obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o 18obj-$(CONFIG_OMAP_MCBSP) += mcbsp.o
16 19
@@ -23,6 +26,9 @@ obj-$(CONFIG_ARCH_OMAP2420) += sram242x.o
23obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o 26obj-$(CONFIG_ARCH_OMAP2430) += sram243x.o
24obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o 27obj-$(CONFIG_ARCH_OMAP3) += sram34xx.o
25 28
29# Pin multiplexing
30obj-$(CONFIG_ARCH_OMAP3) += mux34xx.o
31
26# SMS/SDRC 32# SMS/SDRC
27obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o 33obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
28# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o 34# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o
@@ -41,8 +47,11 @@ obj-$(CONFIG_ARCH_OMAP3) += cm.o
41obj-$(CONFIG_ARCH_OMAP4) += cm4xxx.o 47obj-$(CONFIG_ARCH_OMAP4) += cm4xxx.o
42 48
43# Clock framework 49# Clock framework
44obj-$(CONFIG_ARCH_OMAP2) += clock24xx.o 50obj-$(CONFIG_ARCH_OMAP2) += clock2xxx.o clock2xxx_data.o
45obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o 51obj-$(CONFIG_ARCH_OMAP2420) += opp2420_data.o
52obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clock34xx_data.o
53obj-$(CONFIG_ARCH_OMAP2430) += opp2430_data.o
54obj-$(CONFIG_ARCH_OMAP4) += clock44xx.o clock44xx_data.o
46 55
47# EMU peripherals 56# EMU peripherals
48obj-$(CONFIG_OMAP3_EMU) += emu.o 57obj-$(CONFIG_OMAP3_EMU) += emu.o
@@ -55,6 +64,9 @@ iommu-$(CONFIG_ARCH_OMAP3) += omap3-iommu.o
55 64
56obj-$(CONFIG_OMAP_IOMMU) += $(iommu-y) 65obj-$(CONFIG_OMAP_IOMMU) += $(iommu-y)
57 66
67i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
68obj-y += $(i2c-omap-m) $(i2c-omap-y)
69
58# Specific board support 70# Specific board support
59obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 71obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
60obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 72obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
@@ -93,7 +105,8 @@ obj-$(CONFIG_MACH_CM_T35) += board-cm-t35.o \
93 mmc-twl4030.o 105 mmc-twl4030.o
94obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \ 106obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
95 mmc-twl4030.o 107 mmc-twl4030.o
96 108obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
109 mmc-twl4030.o
97obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o 110obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o
98 111
99obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o 112obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index db9374bc528b..e508904fb67e 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -19,7 +19,7 @@
19#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
20#include <linux/mtd/partitions.h> 20#include <linux/mtd/partitions.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/i2c/twl4030.h> 22#include <linux/i2c/twl.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/io.h> 25#include <linux/io.h>
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 491364e44c7d..c90b0d0b1927 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -20,7 +20,7 @@
20#include <linux/input/matrix_keypad.h> 20#include <linux/input/matrix_keypad.h>
21#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
22#include <linux/spi/ads7846.h> 22#include <linux/spi/ads7846.h>
23#include <linux/i2c/twl4030.h> 23#include <linux/i2c/twl.h>
24#include <linux/regulator/machine.h> 24#include <linux/regulator/machine.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/gpio.h> 26#include <linux/gpio.h>
@@ -31,16 +31,17 @@
31#include <asm/mach/map.h> 31#include <asm/mach/map.h>
32 32
33#include <plat/mcspi.h> 33#include <plat/mcspi.h>
34#include <plat/mux.h>
35#include <plat/board.h> 34#include <plat/board.h>
36#include <plat/usb.h> 35#include <plat/usb.h>
37#include <plat/common.h> 36#include <plat/common.h>
38#include <plat/dma.h> 37#include <plat/dma.h>
39#include <plat/gpmc.h> 38#include <plat/gpmc.h>
39#include <plat/display.h>
40 40
41#include <plat/control.h> 41#include <plat/control.h>
42#include <plat/gpmc-smc91x.h> 42#include <plat/gpmc-smc91x.h>
43 43
44#include "mux.h"
44#include "sdram-qimonda-hyb18m512160af-6.h" 45#include "sdram-qimonda-hyb18m512160af-6.h"
45#include "mmc-twl4030.h" 46#include "mmc-twl4030.h"
46 47
@@ -152,31 +153,152 @@ static struct spi_board_info sdp3430_spi_board_info[] __initdata = {
152 }, 153 },
153}; 154};
154 155
155static struct platform_device sdp3430_lcd_device = { 156
156 .name = "sdp2430_lcd", 157#define SDP3430_LCD_PANEL_BACKLIGHT_GPIO 8
157 .id = -1, 158#define SDP3430_LCD_PANEL_ENABLE_GPIO 5
159
160static unsigned backlight_gpio;
161static unsigned enable_gpio;
162static int lcd_enabled;
163static int dvi_enabled;
164
165static void __init sdp3430_display_init(void)
166{
167 int r;
168
169 enable_gpio = SDP3430_LCD_PANEL_ENABLE_GPIO;
170 backlight_gpio = SDP3430_LCD_PANEL_BACKLIGHT_GPIO;
171
172 r = gpio_request(enable_gpio, "LCD reset");
173 if (r) {
174 printk(KERN_ERR "failed to get LCD reset GPIO\n");
175 goto err0;
176 }
177
178 r = gpio_request(backlight_gpio, "LCD Backlight");
179 if (r) {
180 printk(KERN_ERR "failed to get LCD backlight GPIO\n");
181 goto err1;
182 }
183
184 gpio_direction_output(enable_gpio, 0);
185 gpio_direction_output(backlight_gpio, 0);
186
187 return;
188err1:
189 gpio_free(enable_gpio);
190err0:
191 return;
192}
193
194static int sdp3430_panel_enable_lcd(struct omap_dss_device *dssdev)
195{
196 if (dvi_enabled) {
197 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
198 return -EINVAL;
199 }
200
201 gpio_direction_output(enable_gpio, 1);
202 gpio_direction_output(backlight_gpio, 1);
203
204 lcd_enabled = 1;
205
206 return 0;
207}
208
209static void sdp3430_panel_disable_lcd(struct omap_dss_device *dssdev)
210{
211 lcd_enabled = 0;
212
213 gpio_direction_output(enable_gpio, 0);
214 gpio_direction_output(backlight_gpio, 0);
215}
216
217static int sdp3430_panel_enable_dvi(struct omap_dss_device *dssdev)
218{
219 if (lcd_enabled) {
220 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
221 return -EINVAL;
222 }
223
224 dvi_enabled = 1;
225
226 return 0;
227}
228
229static void sdp3430_panel_disable_dvi(struct omap_dss_device *dssdev)
230{
231 dvi_enabled = 0;
232}
233
234static int sdp3430_panel_enable_tv(struct omap_dss_device *dssdev)
235{
236 return 0;
237}
238
239static void sdp3430_panel_disable_tv(struct omap_dss_device *dssdev)
240{
241}
242
243
244static struct omap_dss_device sdp3430_lcd_device = {
245 .name = "lcd",
246 .driver_name = "sharp_ls_panel",
247 .type = OMAP_DISPLAY_TYPE_DPI,
248 .phy.dpi.data_lines = 16,
249 .platform_enable = sdp3430_panel_enable_lcd,
250 .platform_disable = sdp3430_panel_disable_lcd,
158}; 251};
159 252
160static struct regulator_consumer_supply sdp3430_vdac_supply = { 253static struct omap_dss_device sdp3430_dvi_device = {
161 .supply = "vdac", 254 .name = "dvi",
162 .dev = &sdp3430_lcd_device.dev, 255 .driver_name = "generic_panel",
256 .type = OMAP_DISPLAY_TYPE_DPI,
257 .phy.dpi.data_lines = 24,
258 .platform_enable = sdp3430_panel_enable_dvi,
259 .platform_disable = sdp3430_panel_disable_dvi,
163}; 260};
164 261
165static struct regulator_consumer_supply sdp3430_vdvi_supply = { 262static struct omap_dss_device sdp3430_tv_device = {
166 .supply = "vdvi", 263 .name = "tv",
167 .dev = &sdp3430_lcd_device.dev, 264 .driver_name = "venc",
265 .type = OMAP_DISPLAY_TYPE_VENC,
266 .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO,
267 .platform_enable = sdp3430_panel_enable_tv,
268 .platform_disable = sdp3430_panel_disable_tv,
168}; 269};
169 270
170static struct platform_device *sdp3430_devices[] __initdata = { 271
272static struct omap_dss_device *sdp3430_dss_devices[] = {
171 &sdp3430_lcd_device, 273 &sdp3430_lcd_device,
274 &sdp3430_dvi_device,
275 &sdp3430_tv_device,
276};
277
278static struct omap_dss_board_info sdp3430_dss_data = {
279 .num_devices = ARRAY_SIZE(sdp3430_dss_devices),
280 .devices = sdp3430_dss_devices,
281 .default_device = &sdp3430_lcd_device,
172}; 282};
173 283
174static struct omap_lcd_config sdp3430_lcd_config __initdata = { 284static struct platform_device sdp3430_dss_device = {
175 .ctrl_name = "internal", 285 .name = "omapdss",
286 .id = -1,
287 .dev = {
288 .platform_data = &sdp3430_dss_data,
289 },
290};
291
292static struct regulator_consumer_supply sdp3430_vdda_dac_supply = {
293 .supply = "vdda_dac",
294 .dev = &sdp3430_dss_device.dev,
295};
296
297static struct platform_device *sdp3430_devices[] __initdata = {
298 &sdp3430_dss_device,
176}; 299};
177 300
178static struct omap_board_config_kernel sdp3430_config[] __initdata = { 301static struct omap_board_config_kernel sdp3430_config[] __initdata = {
179 { OMAP_TAG_LCD, &sdp3430_lcd_config },
180}; 302};
181 303
182static void __init omap_3430sdp_init_irq(void) 304static void __init omap_3430sdp_init_irq(void)
@@ -392,22 +514,34 @@ static struct regulator_init_data sdp3430_vdac = {
392 | REGULATOR_CHANGE_STATUS, 514 | REGULATOR_CHANGE_STATUS,
393 }, 515 },
394 .num_consumer_supplies = 1, 516 .num_consumer_supplies = 1,
395 .consumer_supplies = &sdp3430_vdac_supply, 517 .consumer_supplies = &sdp3430_vdda_dac_supply,
396}; 518};
397 519
398/* VPLL2 for digital video outputs */ 520/* VPLL2 for digital video outputs */
521static struct regulator_consumer_supply sdp3430_vpll2_supplies[] = {
522 {
523 .supply = "vdvi",
524 .dev = &sdp3430_lcd_device.dev,
525 },
526 {
527 .supply = "vdds_dsi",
528 .dev = &sdp3430_dss_device.dev,
529 }
530};
531
399static struct regulator_init_data sdp3430_vpll2 = { 532static struct regulator_init_data sdp3430_vpll2 = {
400 .constraints = { 533 .constraints = {
401 .name = "VDVI", 534 .name = "VDVI",
402 .min_uV = 1800000, 535 .min_uV = 1800000,
403 .max_uV = 1800000, 536 .max_uV = 1800000,
537 .apply_uV = true,
404 .valid_modes_mask = REGULATOR_MODE_NORMAL 538 .valid_modes_mask = REGULATOR_MODE_NORMAL
405 | REGULATOR_MODE_STANDBY, 539 | REGULATOR_MODE_STANDBY,
406 .valid_ops_mask = REGULATOR_CHANGE_MODE 540 .valid_ops_mask = REGULATOR_CHANGE_MODE
407 | REGULATOR_CHANGE_STATUS, 541 | REGULATOR_CHANGE_STATUS,
408 }, 542 },
409 .num_consumer_supplies = 1, 543 .num_consumer_supplies = ARRAY_SIZE(sdp3430_vpll2_supplies),
410 .consumer_supplies = &sdp3430_vdvi_supply, 544 .consumer_supplies = sdp3430_vpll2_supplies,
411}; 545};
412 546
413static struct twl4030_codec_audio_data sdp3430_audio = { 547static struct twl4030_codec_audio_data sdp3430_audio = {
@@ -491,7 +625,9 @@ static inline void board_smc91x_init(void)
491 625
492static void enable_board_wakeup_source(void) 626static void enable_board_wakeup_source(void)
493{ 627{
494 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */ 628 /* T2 interrupt line (keypad) */
629 omap_mux_init_signal("sys_nirq",
630 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
495} 631}
496 632
497static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { 633static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
@@ -506,8 +642,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
506 .reset_gpio_port[2] = -EINVAL 642 .reset_gpio_port[2] = -EINVAL
507}; 643};
508 644
645#ifdef CONFIG_OMAP_MUX
646static struct omap_board_mux board_mux[] __initdata = {
647 { .reg_offset = OMAP_MUX_TERMINATOR },
648};
649#else
650#define board_mux NULL
651#endif
652
509static void __init omap_3430sdp_init(void) 653static void __init omap_3430sdp_init(void)
510{ 654{
655 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
511 omap3430_i2c_init(); 656 omap3430_i2c_init();
512 platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices)); 657 platform_add_devices(sdp3430_devices, ARRAY_SIZE(sdp3430_devices));
513 if (omap_rev() > OMAP3430_REV_ES1_0) 658 if (omap_rev() > OMAP3430_REV_ES1_0)
@@ -521,6 +666,7 @@ static void __init omap_3430sdp_init(void)
521 omap_serial_init(); 666 omap_serial_init();
522 usb_musb_init(); 667 usb_musb_init();
523 board_smc91x_init(); 668 board_smc91x_init();
669 sdp3430_display_init();
524 enable_board_wakeup_source(); 670 enable_board_wakeup_source();
525 usb_ehci_init(&ehci_pdata); 671 usb_ehci_init(&ehci_pdata);
526} 672}
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index 348b70b98336..739059632811 100755
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -23,6 +23,7 @@
23 23
24#include <mach/board-zoom.h> 24#include <mach/board-zoom.h>
25 25
26#include "mux.h"
26#include "sdram-hynix-h8mbx00u0mer-0em.h" 27#include "sdram-hynix-h8mbx00u0mer-0em.h"
27 28
28#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE) 29#if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91X_MODULE)
@@ -48,7 +49,9 @@ static inline void board_smc91x_init(void)
48 49
49static void enable_board_wakeup_source(void) 50static void enable_board_wakeup_source(void)
50{ 51{
51 omap_cfg_reg(AF26_34XX_SYS_NIRQ); /* T2 interrupt line (keypad) */ 52 /* T2 interrupt line (keypad) */
53 omap_mux_init_signal("sys_nirq",
54 OMAP_WAKEUP_EN | OMAP_PIN_INPUT_PULLUP);
52} 55}
53 56
54static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { 57static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
@@ -82,8 +85,17 @@ static void __init omap_sdp_init_irq(void)
82 omap_gpio_init(); 85 omap_gpio_init();
83} 86}
84 87
88#ifdef CONFIG_OMAP_MUX
89static struct omap_board_mux board_mux[] __initdata = {
90 { .reg_offset = OMAP_MUX_TERMINATOR },
91};
92#else
93#define board_mux NULL
94#endif
95
85static void __init omap_sdp_init(void) 96static void __init omap_sdp_init(void)
86{ 97{
98 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
87 zoom_peripherals_init(); 99 zoom_peripherals_init();
88 board_smc91x_init(); 100 board_smc91x_init();
89 enable_board_wakeup_source(); 101 enable_board_wakeup_source();
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 415a13d767cc..b4e6eca0e8a9 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -30,6 +30,8 @@
30#include <plat/common.h> 30#include <plat/common.h>
31#include <plat/usb.h> 31#include <plat/usb.h>
32 32
33#include "mux.h"
34
33/* 35/*
34 * Board initialization 36 * Board initialization
35 */ 37 */
@@ -60,8 +62,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
60 .reset_gpio_port[2] = -EINVAL 62 .reset_gpio_port[2] = -EINVAL
61}; 63};
62 64
65#ifdef CONFIG_OMAP_MUX
66static struct omap_board_mux board_mux[] __initdata = {
67 { .reg_offset = OMAP_MUX_TERMINATOR },
68};
69#else
70#define board_mux NULL
71#endif
72
63static void __init am3517_evm_init(void) 73static void __init am3517_evm_init(void)
64{ 74{
75 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
65 platform_add_devices(am3517_evm_devices, 76 platform_add_devices(am3517_evm_devices,
66 ARRAY_SIZE(am3517_evm_devices)); 77 ARRAY_SIZE(am3517_evm_devices));
67 78
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 8a2ce77a02ec..fbbd68d69cc8 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -26,6 +26,7 @@
26#include <linux/leds.h> 26#include <linux/leds.h>
27#include <linux/err.h> 27#include <linux/err.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/smc91x.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
@@ -120,6 +121,12 @@ static void __init apollon_flash_init(void)
120 apollon_flash_resource[0].end = base + SZ_128K - 1; 121 apollon_flash_resource[0].end = base + SZ_128K - 1;
121} 122}
122 123
124static struct smc91x_platdata appolon_smc91x_info = {
125 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
126 .leda = RPC_LED_100_10,
127 .ledb = RPC_LED_TX_RX,
128};
129
123static struct resource apollon_smc91x_resources[] = { 130static struct resource apollon_smc91x_resources[] = {
124 [0] = { 131 [0] = {
125 .flags = IORESOURCE_MEM, 132 .flags = IORESOURCE_MEM,
@@ -134,6 +141,9 @@ static struct resource apollon_smc91x_resources[] = {
134static struct platform_device apollon_smc91x_device = { 141static struct platform_device apollon_smc91x_device = {
135 .name = "smc91x", 142 .name = "smc91x",
136 .id = -1, 143 .id = -1,
144 .dev = {
145 .platform_data = &appolon_smc91x_info,
146 },
137 .num_resources = ARRAY_SIZE(apollon_smc91x_resources), 147 .num_resources = ARRAY_SIZE(apollon_smc91x_resources),
138 .resource = apollon_smc91x_resources, 148 .resource = apollon_smc91x_resources,
139}; 149};
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 22c45290db63..1591aae64500 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -38,13 +38,13 @@
38 38
39#include <plat/board.h> 39#include <plat/board.h>
40#include <plat/common.h> 40#include <plat/common.h>
41#include <plat/mux.h>
42#include <plat/nand.h> 41#include <plat/nand.h>
43#include <plat/gpmc.h> 42#include <plat/gpmc.h>
44#include <plat/usb.h> 43#include <plat/usb.h>
45 44
46#include <mach/hardware.h> 45#include <mach/hardware.h>
47 46
47#include "mux.h"
48#include "sdram-micron-mt46h32m32lf-6.h" 48#include "sdram-micron-mt46h32m32lf-6.h"
49#include "mmc-twl4030.h" 49#include "mmc-twl4030.h"
50 50
@@ -482,8 +482,102 @@ static void __init cm_t35_map_io(void)
482 omap2_map_common_io(); 482 omap2_map_common_io();
483} 483}
484 484
485static struct omap_board_mux board_mux[] __initdata = {
486 /* nCS and IRQ for CM-T35 ethernet */
487 OMAP3_MUX(GPMC_NCS5, OMAP_MUX_MODE0),
488 OMAP3_MUX(UART3_CTS_RCTX, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
489
490 /* nCS and IRQ for SB-T35 ethernet */
491 OMAP3_MUX(GPMC_NCS4, OMAP_MUX_MODE0),
492 OMAP3_MUX(GPMC_WAIT3, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
493
494 /* PENDOWN GPIO */
495 OMAP3_MUX(GPMC_NCS6, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
496
497 /* mUSB */
498 OMAP3_MUX(HSUSB0_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
499 OMAP3_MUX(HSUSB0_STP, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
500 OMAP3_MUX(HSUSB0_DIR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
501 OMAP3_MUX(HSUSB0_NXT, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
502 OMAP3_MUX(HSUSB0_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
503 OMAP3_MUX(HSUSB0_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
504 OMAP3_MUX(HSUSB0_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
505 OMAP3_MUX(HSUSB0_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
506 OMAP3_MUX(HSUSB0_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
507 OMAP3_MUX(HSUSB0_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
508 OMAP3_MUX(HSUSB0_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
509 OMAP3_MUX(HSUSB0_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
510
511 /* MMC 2 */
512 OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
513 OMAP3_MUX(SDMMC2_DAT5, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
514 OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
515 OMAP3_MUX(SDMMC2_DAT7, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
516
517 /* McSPI 1 */
518 OMAP3_MUX(MCSPI1_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
519 OMAP3_MUX(MCSPI1_SIMO, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
520 OMAP3_MUX(MCSPI1_SOMI, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
521 OMAP3_MUX(MCSPI1_CS0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLDOWN),
522
523 /* McSPI 4 */
524 OMAP3_MUX(MCBSP1_CLKR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
525 OMAP3_MUX(MCBSP1_DX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
526 OMAP3_MUX(MCBSP1_DR, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
527 OMAP3_MUX(MCBSP1_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT_PULLUP),
528
529 /* McBSP 2 */
530 OMAP3_MUX(MCBSP2_FSX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
531 OMAP3_MUX(MCBSP2_CLKX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
532 OMAP3_MUX(MCBSP2_DR, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
533 OMAP3_MUX(MCBSP2_DX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
534
535 /* serial ports */
536 OMAP3_MUX(MCBSP3_CLKX, OMAP_MUX_MODE1 | OMAP_PIN_OUTPUT),
537 OMAP3_MUX(MCBSP3_FSX, OMAP_MUX_MODE1 | OMAP_PIN_INPUT),
538 OMAP3_MUX(UART1_TX, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
539 OMAP3_MUX(UART1_RX, OMAP_MUX_MODE0 | OMAP_PIN_INPUT),
540
541 /* DSS */
542 OMAP3_MUX(DSS_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
543 OMAP3_MUX(DSS_HSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
544 OMAP3_MUX(DSS_VSYNC, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
545 OMAP3_MUX(DSS_ACBIAS, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
546 OMAP3_MUX(DSS_DATA0, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
547 OMAP3_MUX(DSS_DATA1, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
548 OMAP3_MUX(DSS_DATA2, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
549 OMAP3_MUX(DSS_DATA3, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
550 OMAP3_MUX(DSS_DATA4, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
551 OMAP3_MUX(DSS_DATA5, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
552 OMAP3_MUX(DSS_DATA6, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
553 OMAP3_MUX(DSS_DATA7, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
554 OMAP3_MUX(DSS_DATA8, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
555 OMAP3_MUX(DSS_DATA9, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
556 OMAP3_MUX(DSS_DATA10, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
557 OMAP3_MUX(DSS_DATA11, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
558 OMAP3_MUX(DSS_DATA12, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
559 OMAP3_MUX(DSS_DATA13, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
560 OMAP3_MUX(DSS_DATA14, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
561 OMAP3_MUX(DSS_DATA15, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
562 OMAP3_MUX(DSS_DATA16, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
563 OMAP3_MUX(DSS_DATA17, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
564 OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
565 OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
566 OMAP3_MUX(DSS_DATA20, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
567 OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
568 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
569 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT),
570
571 /* TPS IRQ */
572 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_WAKEUP_EN | \
573 OMAP_PIN_INPUT_PULLUP),
574
575 { .reg_offset = OMAP_MUX_TERMINATOR },
576};
577
485static void __init cm_t35_init(void) 578static void __init cm_t35_init(void)
486{ 579{
580 omap3_mux_init(board_mux, OMAP_PACKAGE_CUS);
487 omap_serial_init(); 581 omap_serial_init();
488 cm_t35_init_i2c(); 582 cm_t35_init_i2c();
489 cm_t35_init_nand(); 583 cm_t35_init_nand();
@@ -492,8 +586,6 @@ static void __init cm_t35_init(void)
492 cm_t35_init_led(); 586 cm_t35_init_led();
493 587
494 usb_musb_init(); 588 usb_musb_init();
495
496 omap_cfg_reg(AF26_34XX_SYS_NIRQ);
497} 589}
498 590
499MACHINE_START(CM_T35, "Compulab CM-T35") 591MACHINE_START(CM_T35, "Compulab CM-T35")
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index fa62e80c13b7..44239e3ec02e 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -27,9 +27,9 @@
27#include <plat/board.h> 27#include <plat/board.h>
28#include <plat/common.h> 28#include <plat/common.h>
29#include <plat/gpmc.h> 29#include <plat/gpmc.h>
30#include <plat/mux.h>
31#include <plat/usb.h> 30#include <plat/usb.h>
32 31
32#include "mux.h"
33#include "mmc-twl4030.h" 33#include "mmc-twl4030.h"
34 34
35#define IGEP2_SMSC911X_CS 5 35#define IGEP2_SMSC911X_CS 5
@@ -203,8 +203,17 @@ static int __init igep2_i2c_init(void)
203 return 0; 203 return 0;
204} 204}
205 205
206#ifdef CONFIG_OMAP_MUX
207static struct omap_board_mux board_mux[] __initdata = {
208 { .reg_offset = OMAP_MUX_TERMINATOR },
209};
210#else
211#define board_mux NULL
212#endif
213
206static void __init igep2_init(void) 214static void __init igep2_init(void)
207{ 215{
216 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
208 igep2_i2c_init(); 217 igep2_i2c_init();
209 omap_serial_init(); 218 omap_serial_init();
210 usb_musb_init(); 219 usb_musb_init();
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index c062238fe881..995d4a2b2dfd 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -24,7 +24,7 @@
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h> 25#include <linux/spi/ads7846.h>
26#include <linux/regulator/machine.h> 26#include <linux/regulator/machine.h>
27#include <linux/i2c/twl4030.h> 27#include <linux/i2c/twl.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/smsc911x.h> 29#include <linux/smsc911x.h>
30 30
@@ -43,6 +43,7 @@
43#include <plat/control.h> 43#include <plat/control.h>
44#include <plat/usb.h> 44#include <plat/usb.h>
45 45
46#include "mux.h"
46#include "mmc-twl4030.h" 47#include "mmc-twl4030.h"
47 48
48#define LDP_SMSC911X_CS 1 49#define LDP_SMSC911X_CS 1
@@ -374,8 +375,17 @@ static struct platform_device *ldp_devices[] __initdata = {
374 &ldp_gpio_keys_device, 375 &ldp_gpio_keys_device,
375}; 376};
376 377
378#ifdef CONFIG_OMAP_MUX
379static struct omap_board_mux board_mux[] __initdata = {
380 { .reg_offset = OMAP_MUX_TERMINATOR },
381};
382#else
383#define board_mux NULL
384#endif
385
377static void __init omap_ldp_init(void) 386static void __init omap_ldp_init(void)
378{ 387{
388 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
379 omap_i2c_init(); 389 omap_i2c_init();
380 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices)); 390 platform_add_devices(ldp_devices, ARRAY_SIZE(ldp_devices));
381 ts_gpio = 54; 391 ts_gpio = 54;
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 41480bd0e58a..231cb4ec1847 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -29,7 +29,7 @@
29#include <linux/mtd/nand.h> 29#include <linux/mtd/nand.h>
30 30
31#include <linux/regulator/machine.h> 31#include <linux/regulator/machine.h>
32#include <linux/i2c/twl4030.h> 32#include <linux/i2c/twl.h>
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <asm/mach-types.h> 35#include <asm/mach-types.h>
@@ -41,10 +41,10 @@
41#include <plat/common.h> 41#include <plat/common.h>
42#include <plat/gpmc.h> 42#include <plat/gpmc.h>
43#include <plat/nand.h> 43#include <plat/nand.h>
44#include <plat/mux.h>
45#include <plat/usb.h> 44#include <plat/usb.h>
46#include <plat/timer-gp.h> 45#include <plat/timer-gp.h>
47 46
47#include "mux.h"
48#include "mmc-twl4030.h" 48#include "mmc-twl4030.h"
49 49
50#define GPMC_CS0_BASE 0x60 50#define GPMC_CS0_BASE 0x60
@@ -140,10 +140,10 @@ static int beagle_twl_gpio_setup(struct device *dev,
140 unsigned gpio, unsigned ngpio) 140 unsigned gpio, unsigned ngpio)
141{ 141{
142 if (system_rev >= 0x20 && system_rev <= 0x34301000) { 142 if (system_rev >= 0x20 && system_rev <= 0x34301000) {
143 omap_cfg_reg(AG9_34XX_GPIO23); 143 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
144 mmc[0].gpio_wp = 23; 144 mmc[0].gpio_wp = 23;
145 } else { 145 } else {
146 omap_cfg_reg(AH8_34XX_GPIO29); 146 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
147 } 147 }
148 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 148 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
149 mmc[0].gpio_cd = gpio + 0; 149 mmc[0].gpio_cd = gpio + 0;
@@ -422,14 +422,23 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
422 .reset_gpio_port[2] = -EINVAL 422 .reset_gpio_port[2] = -EINVAL
423}; 423};
424 424
425#ifdef CONFIG_OMAP_MUX
426static struct omap_board_mux board_mux[] __initdata = {
427 { .reg_offset = OMAP_MUX_TERMINATOR },
428};
429#else
430#define board_mux NULL
431#endif
432
425static void __init omap3_beagle_init(void) 433static void __init omap3_beagle_init(void)
426{ 434{
435 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
427 omap3_beagle_i2c_init(); 436 omap3_beagle_i2c_init();
428 platform_add_devices(omap3_beagle_devices, 437 platform_add_devices(omap3_beagle_devices,
429 ARRAY_SIZE(omap3_beagle_devices)); 438 ARRAY_SIZE(omap3_beagle_devices));
430 omap_serial_init(); 439 omap_serial_init();
431 440
432 omap_cfg_reg(J25_34XX_GPIO170); 441 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
433 gpio_request(170, "DVI_nPD"); 442 gpio_request(170, "DVI_nPD");
434 /* REVISIT leave DVI powered down until it's needed ... */ 443 /* REVISIT leave DVI powered down until it's needed ... */
435 gpio_direction_output(170, true); 444 gpio_direction_output(170, true);
@@ -439,8 +448,8 @@ static void __init omap3_beagle_init(void)
439 omap3beagle_flash_init(); 448 omap3beagle_flash_init();
440 449
441 /* Ensure SDRC pins are mux'd for self-refresh */ 450 /* Ensure SDRC pins are mux'd for self-refresh */
442 omap_cfg_reg(H16_34XX_SDRC_CKE0); 451 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
443 omap_cfg_reg(H17_34XX_SDRC_CKE1); 452 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
444} 453}
445 454
446static void __init omap3_beagle_map_io(void) 455static void __init omap3_beagle_map_io(void)
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 5efc2e9068db..18913e96e34d 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -38,11 +38,11 @@
38#include <asm/mach/map.h> 38#include <asm/mach/map.h>
39 39
40#include <plat/board.h> 40#include <plat/board.h>
41#include <plat/mux.h>
42#include <plat/usb.h> 41#include <plat/usb.h>
43#include <plat/common.h> 42#include <plat/common.h>
44#include <plat/mcspi.h> 43#include <plat/mcspi.h>
45 44
45#include "mux.h"
46#include "sdram-micron-mt46h32m32lf-6.h" 46#include "sdram-micron-mt46h32m32lf-6.h"
47#include "mmc-twl4030.h" 47#include "mmc-twl4030.h"
48 48
@@ -223,7 +223,7 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
223 unsigned gpio, unsigned ngpio) 223 unsigned gpio, unsigned ngpio)
224{ 224{
225 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 225 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
226 omap_cfg_reg(L8_34XX_GPIO63); 226 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
227 mmc[0].gpio_cd = gpio + 0; 227 mmc[0].gpio_cd = gpio + 0;
228 twl4030_mmc_init(mmc); 228 twl4030_mmc_init(mmc);
229 229
@@ -422,9 +422,18 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
422 .reset_gpio_port[2] = -EINVAL 422 .reset_gpio_port[2] = -EINVAL
423}; 423};
424 424
425#ifdef CONFIG_OMAP_MUX
426static struct omap_board_mux board_mux[] __initdata = {
427 { .reg_offset = OMAP_MUX_TERMINATOR },
428};
429#else
430#define board_mux NULL
431#endif
432
425static void __init omap3_evm_init(void) 433static void __init omap3_evm_init(void)
426{ 434{
427 omap3_evm_get_revision(); 435 omap3_evm_get_revision();
436 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
428 437
429 omap3_evm_i2c_init(); 438 omap3_evm_i2c_init();
430 439
@@ -440,24 +449,24 @@ static void __init omap3_evm_init(void)
440#endif 449#endif
441 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { 450 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
442 /* enable EHCI VBUS using GPIO22 */ 451 /* enable EHCI VBUS using GPIO22 */
443 omap_cfg_reg(AF9_34XX_GPIO22); 452 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
444 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); 453 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
445 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); 454 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
446 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); 455 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
447 456
448 /* Select EHCI port on main board */ 457 /* Select EHCI port on main board */
449 omap_cfg_reg(U3_34XX_GPIO61); 458 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
450 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); 459 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
451 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); 460 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
452 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); 461 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
453 462
454 /* setup EHCI phy reset config */ 463 /* setup EHCI phy reset config */
455 omap_cfg_reg(AH14_34XX_GPIO21); 464 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
456 ehci_pdata.reset_gpio_port[1] = 21; 465 ehci_pdata.reset_gpio_port[1] = 21;
457 466
458 } else { 467 } else {
459 /* setup EHCI phy reset on MDC */ 468 /* setup EHCI phy reset on MDC */
460 omap_cfg_reg(AF4_34XX_GPIO135_OUT); 469 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
461 ehci_pdata.reset_gpio_port[1] = 135; 470 ehci_pdata.reset_gpio_port[1] = 135;
462 } 471 }
463 usb_musb_init(); 472 usb_musb_init();
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 2db5ba5b3bf7..ef17cf1ab6d7 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -24,7 +24,7 @@
24#include <linux/spi/spi.h> 24#include <linux/spi/spi.h>
25#include <linux/spi/ads7846.h> 25#include <linux/spi/ads7846.h>
26#include <linux/regulator/machine.h> 26#include <linux/regulator/machine.h>
27#include <linux/i2c/twl4030.h> 27#include <linux/i2c/twl.h>
28#include <linux/leds.h> 28#include <linux/leds.h>
29#include <linux/input.h> 29#include <linux/input.h>
30#include <linux/input/matrix_keypad.h> 30#include <linux/input/matrix_keypad.h>
@@ -40,8 +40,8 @@
40#include <mach/hardware.h> 40#include <mach/hardware.h>
41#include <plat/mcspi.h> 41#include <plat/mcspi.h>
42#include <plat/usb.h> 42#include <plat/usb.h>
43#include <plat/mux.h>
44 43
44#include "mux.h"
45#include "sdram-micron-mt46h32m32lf-6.h" 45#include "sdram-micron-mt46h32m32lf-6.h"
46#include "mmc-twl4030.h" 46#include "mmc-twl4030.h"
47 47
@@ -98,10 +98,10 @@ static struct gpio_keys_button pandora_gpio_keys[] = {
98 GPIO_BUTTON_LOW(103, KEY_DOWN, "down"), 98 GPIO_BUTTON_LOW(103, KEY_DOWN, "down"),
99 GPIO_BUTTON_LOW(96, KEY_LEFT, "left"), 99 GPIO_BUTTON_LOW(96, KEY_LEFT, "left"),
100 GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"), 100 GPIO_BUTTON_LOW(98, KEY_RIGHT, "right"),
101 GPIO_BUTTON_LOW(111, BTN_A, "a"), 101 GPIO_BUTTON_LOW(109, KEY_KP1, "game 1"),
102 GPIO_BUTTON_LOW(106, BTN_B, "b"), 102 GPIO_BUTTON_LOW(111, KEY_KP2, "game 2"),
103 GPIO_BUTTON_LOW(109, BTN_X, "x"), 103 GPIO_BUTTON_LOW(106, KEY_KP3, "game 3"),
104 GPIO_BUTTON_LOW(101, BTN_Y, "y"), 104 GPIO_BUTTON_LOW(101, KEY_KP4, "game 4"),
105 GPIO_BUTTON_LOW(102, BTN_TL, "l"), 105 GPIO_BUTTON_LOW(102, BTN_TL, "l"),
106 GPIO_BUTTON_LOW(97, BTN_TL2, "l2"), 106 GPIO_BUTTON_LOW(97, BTN_TL2, "l2"),
107 GPIO_BUTTON_LOW(105, BTN_TR, "r"), 107 GPIO_BUTTON_LOW(105, BTN_TR, "r"),
@@ -315,7 +315,7 @@ static int __init omap3pandora_i2c_init(void)
315 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo, 315 omap_register_i2c_bus(1, 2600, omap3pandora_i2c_boardinfo,
316 ARRAY_SIZE(omap3pandora_i2c_boardinfo)); 316 ARRAY_SIZE(omap3pandora_i2c_boardinfo));
317 /* i2c2 pins are not connected */ 317 /* i2c2 pins are not connected */
318 omap_register_i2c_bus(3, 400, NULL, 0); 318 omap_register_i2c_bus(3, 100, NULL, 0);
319 return 0; 319 return 0;
320} 320}
321 321
@@ -368,23 +368,8 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
368 } 368 }
369}; 369};
370 370
371static struct platform_device omap3pandora_lcd_device = {
372 .name = "pandora_lcd",
373 .id = -1,
374};
375
376static struct omap_lcd_config omap3pandora_lcd_config __initdata = {
377 .ctrl_name = "internal",
378};
379
380static struct omap_board_config_kernel omap3pandora_config[] __initdata = {
381 { OMAP_TAG_LCD, &omap3pandora_lcd_config },
382};
383
384static void __init omap3pandora_init_irq(void) 371static void __init omap3pandora_init_irq(void)
385{ 372{
386 omap_board_config = omap3pandora_config;
387 omap_board_config_size = ARRAY_SIZE(omap3pandora_config);
388 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, 373 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
389 mt46h32m32lf6_sdrc_params); 374 mt46h32m32lf6_sdrc_params);
390 omap_init_irq(); 375 omap_init_irq();
@@ -392,7 +377,6 @@ static void __init omap3pandora_init_irq(void)
392} 377}
393 378
394static struct platform_device *omap3pandora_devices[] __initdata = { 379static struct platform_device *omap3pandora_devices[] __initdata = {
395 &omap3pandora_lcd_device,
396 &pandora_leds_gpio, 380 &pandora_leds_gpio,
397 &pandora_keys_gpio, 381 &pandora_keys_gpio,
398}; 382};
@@ -409,8 +393,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
409 .reset_gpio_port[2] = -EINVAL 393 .reset_gpio_port[2] = -EINVAL
410}; 394};
411 395
396#ifdef CONFIG_OMAP_MUX
397static struct omap_board_mux board_mux[] __initdata = {
398 { .reg_offset = OMAP_MUX_TERMINATOR },
399};
400#else
401#define board_mux NULL
402#endif
403
412static void __init omap3pandora_init(void) 404static void __init omap3pandora_init(void)
413{ 405{
406 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
414 omap3pandora_i2c_init(); 407 omap3pandora_i2c_init();
415 platform_add_devices(omap3pandora_devices, 408 platform_add_devices(omap3pandora_devices,
416 ARRAY_SIZE(omap3pandora_devices)); 409 ARRAY_SIZE(omap3pandora_devices));
@@ -423,8 +416,8 @@ static void __init omap3pandora_init(void)
423 usb_musb_init(); 416 usb_musb_init();
424 417
425 /* Ensure SDRC pins are mux'd for self-refresh */ 418 /* Ensure SDRC pins are mux'd for self-refresh */
426 omap_cfg_reg(H16_34XX_SDRC_CKE0); 419 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
427 omap_cfg_reg(H17_34XX_SDRC_CKE1); 420 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
428} 421}
429 422
430static void __init omap3pandora_map_io(void) 423static void __init omap3pandora_map_io(void)
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
new file mode 100644
index 000000000000..c9e5ebb4d91d
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -0,0 +1,572 @@
1/*
2 * linux/arch/arm/mach-omap2/board-omap3touchbook.c
3 *
4 * Copyright (C) 2009 Always Innovating
5 *
6 * Modified from mach-omap2/board-omap3beagleboard.c
7 *
8 * Initial code: Grégoire Gentil, Tim Yamin
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/delay.h>
19#include <linux/err.h>
20#include <linux/clk.h>
21#include <linux/io.h>
22#include <linux/leds.h>
23#include <linux/gpio.h>
24#include <linux/input.h>
25#include <linux/gpio_keys.h>
26
27#include <linux/mtd/mtd.h>
28#include <linux/mtd/partitions.h>
29#include <linux/mtd/nand.h>
30
31#include <plat/mcspi.h>
32#include <linux/spi/spi.h>
33
34#include <linux/spi/ads7846.h>
35
36#include <linux/regulator/machine.h>
37#include <linux/i2c/twl4030.h>
38
39#include <mach/hardware.h>
40#include <asm/mach-types.h>
41#include <asm/mach/arch.h>
42#include <asm/mach/map.h>
43#include <asm/mach/flash.h>
44
45#include <plat/board.h>
46#include <plat/common.h>
47#include <plat/gpmc.h>
48#include <plat/nand.h>
49#include <plat/usb.h>
50#include <plat/timer-gp.h>
51
52#include "mux.h"
53#include "mmc-twl4030.h"
54
55#include <asm/setup.h>
56
57#define GPMC_CS0_BASE 0x60
58#define GPMC_CS_SIZE 0x30
59
60#define NAND_BLOCK_SIZE SZ_128K
61
62#define OMAP3_AC_GPIO 136
63#define OMAP3_TS_GPIO 162
64#define TB_BL_PWM_TIMER 9
65#define TB_KILL_POWER_GPIO 168
66
67unsigned long touchbook_revision;
68
69static struct mtd_partition omap3touchbook_nand_partitions[] = {
70 /* All the partition sizes are listed in terms of NAND block size */
71 {
72 .name = "X-Loader",
73 .offset = 0,
74 .size = 4 * NAND_BLOCK_SIZE,
75 .mask_flags = MTD_WRITEABLE, /* force read-only */
76 },
77 {
78 .name = "U-Boot",
79 .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */
80 .size = 15 * NAND_BLOCK_SIZE,
81 .mask_flags = MTD_WRITEABLE, /* force read-only */
82 },
83 {
84 .name = "U-Boot Env",
85 .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */
86 .size = 1 * NAND_BLOCK_SIZE,
87 },
88 {
89 .name = "Kernel",
90 .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */
91 .size = 32 * NAND_BLOCK_SIZE,
92 },
93 {
94 .name = "File System",
95 .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */
96 .size = MTDPART_SIZ_FULL,
97 },
98};
99
100static struct omap_nand_platform_data omap3touchbook_nand_data = {
101 .options = NAND_BUSWIDTH_16,
102 .parts = omap3touchbook_nand_partitions,
103 .nr_parts = ARRAY_SIZE(omap3touchbook_nand_partitions),
104 .dma_channel = -1, /* disable DMA in OMAP NAND driver */
105 .nand_setup = NULL,
106 .dev_ready = NULL,
107};
108
109static struct resource omap3touchbook_nand_resource = {
110 .flags = IORESOURCE_MEM,
111};
112
113static struct platform_device omap3touchbook_nand_device = {
114 .name = "omap2-nand",
115 .id = -1,
116 .dev = {
117 .platform_data = &omap3touchbook_nand_data,
118 },
119 .num_resources = 1,
120 .resource = &omap3touchbook_nand_resource,
121};
122
123#include "sdram-micron-mt46h32m32lf-6.h"
124
125static struct twl4030_hsmmc_info mmc[] = {
126 {
127 .mmc = 1,
128 .wires = 8,
129 .gpio_wp = 29,
130 },
131 {} /* Terminator */
132};
133
134static struct platform_device omap3_touchbook_lcd_device = {
135 .name = "omap3touchbook_lcd",
136 .id = -1,
137};
138
139static struct omap_lcd_config omap3_touchbook_lcd_config __initdata = {
140 .ctrl_name = "internal",
141};
142
143static struct regulator_consumer_supply touchbook_vmmc1_supply = {
144 .supply = "vmmc",
145};
146
147static struct regulator_consumer_supply touchbook_vsim_supply = {
148 .supply = "vmmc_aux",
149};
150
151static struct gpio_led gpio_leds[];
152
153static int touchbook_twl_gpio_setup(struct device *dev,
154 unsigned gpio, unsigned ngpio)
155{
156 if (system_rev >= 0x20 && system_rev <= 0x34301000) {
157 omap_mux_init_gpio(23, OMAP_PIN_INPUT);
158 mmc[0].gpio_wp = 23;
159 } else {
160 omap_mux_init_gpio(29, OMAP_PIN_INPUT);
161 }
162 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
163 mmc[0].gpio_cd = gpio + 0;
164 twl4030_mmc_init(mmc);
165
166 /* link regulators to MMC adapters */
167 touchbook_vmmc1_supply.dev = mmc[0].dev;
168 touchbook_vsim_supply.dev = mmc[0].dev;
169
170 /* REVISIT: need ehci-omap hooks for external VBUS
171 * power switch and overcurrent detect
172 */
173
174 gpio_request(gpio + 1, "EHCI_nOC");
175 gpio_direction_input(gpio + 1);
176
177 /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */
178 gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR");
179 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
180
181 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
182 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
183
184 return 0;
185}
186
187static struct twl4030_gpio_platform_data touchbook_gpio_data = {
188 .gpio_base = OMAP_MAX_GPIO_LINES,
189 .irq_base = TWL4030_GPIO_IRQ_BASE,
190 .irq_end = TWL4030_GPIO_IRQ_END,
191 .use_leds = true,
192 .pullups = BIT(1),
193 .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13)
194 | BIT(15) | BIT(16) | BIT(17),
195 .setup = touchbook_twl_gpio_setup,
196};
197
198static struct regulator_consumer_supply touchbook_vdac_supply = {
199 .supply = "vdac",
200 .dev = &omap3_touchbook_lcd_device.dev,
201};
202
203static struct regulator_consumer_supply touchbook_vdvi_supply = {
204 .supply = "vdvi",
205 .dev = &omap3_touchbook_lcd_device.dev,
206};
207
208/* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
209static struct regulator_init_data touchbook_vmmc1 = {
210 .constraints = {
211 .min_uV = 1850000,
212 .max_uV = 3150000,
213 .valid_modes_mask = REGULATOR_MODE_NORMAL
214 | REGULATOR_MODE_STANDBY,
215 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
216 | REGULATOR_CHANGE_MODE
217 | REGULATOR_CHANGE_STATUS,
218 },
219 .num_consumer_supplies = 1,
220 .consumer_supplies = &touchbook_vmmc1_supply,
221};
222
223/* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
224static struct regulator_init_data touchbook_vsim = {
225 .constraints = {
226 .min_uV = 1800000,
227 .max_uV = 3000000,
228 .valid_modes_mask = REGULATOR_MODE_NORMAL
229 | REGULATOR_MODE_STANDBY,
230 .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE
231 | REGULATOR_CHANGE_MODE
232 | REGULATOR_CHANGE_STATUS,
233 },
234 .num_consumer_supplies = 1,
235 .consumer_supplies = &touchbook_vsim_supply,
236};
237
238/* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */
239static struct regulator_init_data touchbook_vdac = {
240 .constraints = {
241 .min_uV = 1800000,
242 .max_uV = 1800000,
243 .valid_modes_mask = REGULATOR_MODE_NORMAL
244 | REGULATOR_MODE_STANDBY,
245 .valid_ops_mask = REGULATOR_CHANGE_MODE
246 | REGULATOR_CHANGE_STATUS,
247 },
248 .num_consumer_supplies = 1,
249 .consumer_supplies = &touchbook_vdac_supply,
250};
251
252/* VPLL2 for digital video outputs */
253static struct regulator_init_data touchbook_vpll2 = {
254 .constraints = {
255 .name = "VDVI",
256 .min_uV = 1800000,
257 .max_uV = 1800000,
258 .valid_modes_mask = REGULATOR_MODE_NORMAL
259 | REGULATOR_MODE_STANDBY,
260 .valid_ops_mask = REGULATOR_CHANGE_MODE
261 | REGULATOR_CHANGE_STATUS,
262 },
263 .num_consumer_supplies = 1,
264 .consumer_supplies = &touchbook_vdvi_supply,
265};
266
267static struct twl4030_usb_data touchbook_usb_data = {
268 .usb_mode = T2_USB_MODE_ULPI,
269};
270
271static struct twl4030_codec_audio_data touchbook_audio_data = {
272 .audio_mclk = 26000000,
273};
274
275static struct twl4030_codec_data touchbook_codec_data = {
276 .audio_mclk = 26000000,
277 .audio = &touchbook_audio_data,
278};
279
280static struct twl4030_platform_data touchbook_twldata = {
281 .irq_base = TWL4030_IRQ_BASE,
282 .irq_end = TWL4030_IRQ_END,
283
284 /* platform_data for children goes here */
285 .usb = &touchbook_usb_data,
286 .gpio = &touchbook_gpio_data,
287 .codec = &touchbook_codec_data,
288 .vmmc1 = &touchbook_vmmc1,
289 .vsim = &touchbook_vsim,
290 .vdac = &touchbook_vdac,
291 .vpll2 = &touchbook_vpll2,
292};
293
294static struct i2c_board_info __initdata touchbook_i2c_boardinfo[] = {
295 {
296 I2C_BOARD_INFO("twl4030", 0x48),
297 .flags = I2C_CLIENT_WAKE,
298 .irq = INT_34XX_SYS_NIRQ,
299 .platform_data = &touchbook_twldata,
300 },
301};
302
303static struct i2c_board_info __initdata touchBook_i2c_boardinfo[] = {
304 {
305 I2C_BOARD_INFO("bq27200", 0x55),
306 },
307};
308
309static int __init omap3_touchbook_i2c_init(void)
310{
311 /* Standard TouchBook bus */
312 omap_register_i2c_bus(1, 2600, touchbook_i2c_boardinfo,
313 ARRAY_SIZE(touchbook_i2c_boardinfo));
314
315 /* Additional TouchBook bus */
316 omap_register_i2c_bus(3, 100, touchBook_i2c_boardinfo,
317 ARRAY_SIZE(touchBook_i2c_boardinfo));
318
319 return 0;
320}
321
322static void __init omap3_ads7846_init(void)
323{
324 if (gpio_request(OMAP3_TS_GPIO, "ads7846_pen_down")) {
325 printk(KERN_ERR "Failed to request GPIO %d for "
326 "ads7846 pen down IRQ\n", OMAP3_TS_GPIO);
327 return;
328 }
329
330 gpio_direction_input(OMAP3_TS_GPIO);
331 omap_set_gpio_debounce(OMAP3_TS_GPIO, 1);
332 omap_set_gpio_debounce_time(OMAP3_TS_GPIO, 0xa);
333}
334
335static struct ads7846_platform_data ads7846_config = {
336 .x_min = 100,
337 .y_min = 265,
338 .x_max = 3950,
339 .y_max = 3750,
340 .x_plate_ohms = 40,
341 .pressure_max = 255,
342 .debounce_max = 10,
343 .debounce_tol = 5,
344 .debounce_rep = 1,
345 .gpio_pendown = OMAP3_TS_GPIO,
346 .keep_vref_on = 1,
347};
348
349static struct omap2_mcspi_device_config ads7846_mcspi_config = {
350 .turbo_mode = 0,
351 .single_channel = 1, /* 0: slave, 1: master */
352};
353
354static struct spi_board_info omap3_ads7846_spi_board_info[] __initdata = {
355 {
356 .modalias = "ads7846",
357 .bus_num = 4,
358 .chip_select = 0,
359 .max_speed_hz = 1500000,
360 .controller_data = &ads7846_mcspi_config,
361 .irq = OMAP_GPIO_IRQ(OMAP3_TS_GPIO),
362 .platform_data = &ads7846_config,
363 }
364};
365
366static struct gpio_led gpio_leds[] = {
367 {
368 .name = "touchbook::usr0",
369 .default_trigger = "heartbeat",
370 .gpio = 150,
371 },
372 {
373 .name = "touchbook::usr1",
374 .default_trigger = "mmc0",
375 .gpio = 149,
376 },
377 {
378 .name = "touchbook::pmu_stat",
379 .gpio = -EINVAL, /* gets replaced */
380 .active_low = true,
381 },
382};
383
384static struct gpio_led_platform_data gpio_led_info = {
385 .leds = gpio_leds,
386 .num_leds = ARRAY_SIZE(gpio_leds),
387};
388
389static struct platform_device leds_gpio = {
390 .name = "leds-gpio",
391 .id = -1,
392 .dev = {
393 .platform_data = &gpio_led_info,
394 },
395};
396
397static struct gpio_keys_button gpio_buttons[] = {
398 {
399 .code = BTN_EXTRA,
400 .gpio = 7,
401 .desc = "user",
402 .wakeup = 1,
403 },
404 {
405 .code = KEY_POWER,
406 .gpio = 183,
407 .desc = "power",
408 .wakeup = 1,
409 },
410};
411
412static struct gpio_keys_platform_data gpio_key_info = {
413 .buttons = gpio_buttons,
414 .nbuttons = ARRAY_SIZE(gpio_buttons),
415};
416
417static struct platform_device keys_gpio = {
418 .name = "gpio-keys",
419 .id = -1,
420 .dev = {
421 .platform_data = &gpio_key_info,
422 },
423};
424
425static struct omap_board_config_kernel omap3_touchbook_config[] __initdata = {
426 { OMAP_TAG_LCD, &omap3_touchbook_lcd_config },
427};
428
429#ifdef CONFIG_OMAP_MUX
430static struct omap_board_mux board_mux[] __initdata = {
431 { .reg_offset = OMAP_MUX_TERMINATOR },
432};
433#else
434#define board_mux NULL
435#endif
436
437static void __init omap3_touchbook_init_irq(void)
438{
439 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
440 omap_board_config = omap3_touchbook_config;
441 omap_board_config_size = ARRAY_SIZE(omap3_touchbook_config);
442 omap2_init_common_hw(mt46h32m32lf6_sdrc_params,
443 mt46h32m32lf6_sdrc_params);
444 omap_init_irq();
445#ifdef CONFIG_OMAP_32K_TIMER
446 omap2_gp_clockevent_set_gptimer(12);
447#endif
448 omap_gpio_init();
449}
450
451static struct platform_device *omap3_touchbook_devices[] __initdata = {
452 &omap3_touchbook_lcd_device,
453 &leds_gpio,
454 &keys_gpio,
455};
456
457static void __init omap3touchbook_flash_init(void)
458{
459 u8 cs = 0;
460 u8 nandcs = GPMC_CS_NUM + 1;
461
462 u32 gpmc_base_add = OMAP34XX_GPMC_VIRT;
463
464 /* find out the chip-select on which NAND exists */
465 while (cs < GPMC_CS_NUM) {
466 u32 ret = 0;
467 ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
468
469 if ((ret & 0xC00) == 0x800) {
470 printk(KERN_INFO "Found NAND on CS%d\n", cs);
471 if (nandcs > GPMC_CS_NUM)
472 nandcs = cs;
473 }
474 cs++;
475 }
476
477 if (nandcs > GPMC_CS_NUM) {
478 printk(KERN_INFO "NAND: Unable to find configuration "
479 "in GPMC\n ");
480 return;
481 }
482
483 if (nandcs < GPMC_CS_NUM) {
484 omap3touchbook_nand_data.cs = nandcs;
485 omap3touchbook_nand_data.gpmc_cs_baseaddr = (void *)
486 (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE);
487 omap3touchbook_nand_data.gpmc_baseaddr =
488 (void *) (gpmc_base_add);
489
490 printk(KERN_INFO "Registering NAND on CS%d\n", nandcs);
491 if (platform_device_register(&omap3touchbook_nand_device) < 0)
492 printk(KERN_ERR "Unable to register NAND device\n");
493 }
494}
495
496static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
497
498 .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY,
499 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
500 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
501
502 .phy_reset = true,
503 .reset_gpio_port[0] = -EINVAL,
504 .reset_gpio_port[1] = 147,
505 .reset_gpio_port[2] = -EINVAL
506};
507
508static void omap3_touchbook_poweroff(void)
509{
510 int r;
511
512 r = gpio_request(TB_KILL_POWER_GPIO, "DVI reset");
513 if (r < 0) {
514 printk(KERN_ERR "Unable to get kill power GPIO\n");
515 return;
516 }
517
518 gpio_direction_output(TB_KILL_POWER_GPIO, 0);
519}
520
521static void __init early_touchbook_revision(char **p)
522{
523 if (!*p)
524 return;
525
526 strict_strtoul(*p, 10, &touchbook_revision);
527}
528__early_param("tbr=", early_touchbook_revision);
529
530static void __init omap3_touchbook_init(void)
531{
532 pm_power_off = omap3_touchbook_poweroff;
533
534 omap3_touchbook_i2c_init();
535 platform_add_devices(omap3_touchbook_devices,
536 ARRAY_SIZE(omap3_touchbook_devices));
537 omap_serial_init();
538
539 omap_mux_init_gpio(170, OMAP_PIN_INPUT);
540 gpio_request(176, "DVI_nPD");
541 /* REVISIT leave DVI powered down until it's needed ... */
542 gpio_direction_output(176, true);
543
544 /* Touchscreen and accelerometer */
545 spi_register_board_info(omap3_ads7846_spi_board_info,
546 ARRAY_SIZE(omap3_ads7846_spi_board_info));
547 omap3_ads7846_init();
548 usb_musb_init();
549 usb_ehci_init(&ehci_pdata);
550 omap3touchbook_flash_init();
551
552 /* Ensure SDRC pins are mux'd for self-refresh */
553 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
554 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
555}
556
557static void __init omap3_touchbook_map_io(void)
558{
559 omap2_set_globals_343x();
560 omap2_map_common_io();
561}
562
563MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
564 /* Maintainer: Gregoire Gentil - http://www.alwaysinnovating.com */
565 .phys_io = 0x48000000,
566 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
567 .boot_params = 0x80000100,
568 .map_io = omap3_touchbook_map_io,
569 .init_irq = omap3_touchbook_init_irq,
570 .init_machine = omap3_touchbook_init,
571 .timer = &omap_timer,
572MACHINE_END
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 52dfd51a938e..d192dd98a591 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -26,7 +26,7 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/i2c/twl4030.h> 29#include <linux/i2c/twl.h>
30#include <linux/regulator/machine.h> 30#include <linux/regulator/machine.h>
31 31
32#include <linux/mtd/mtd.h> 32#include <linux/mtd/mtd.h>
@@ -44,9 +44,9 @@
44#include <plat/gpmc.h> 44#include <plat/gpmc.h>
45#include <mach/hardware.h> 45#include <mach/hardware.h>
46#include <plat/nand.h> 46#include <plat/nand.h>
47#include <plat/mux.h>
48#include <plat/usb.h> 47#include <plat/usb.h>
49 48
49#include "mux.h"
50#include "sdram-micron-mt46h32m32lf-6.h" 50#include "sdram-micron-mt46h32m32lf-6.h"
51#include "mmc-twl4030.h" 51#include "mmc-twl4030.h"
52 52
@@ -405,9 +405,17 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = {
405 .reset_gpio_port[2] = -EINVAL 405 .reset_gpio_port[2] = -EINVAL
406}; 406};
407 407
408#ifdef CONFIG_OMAP_MUX
409static struct omap_board_mux board_mux[] __initdata = {
410 { .reg_offset = OMAP_MUX_TERMINATOR },
411};
412#else
413#define board_mux NULL
414#endif
408 415
409static void __init overo_init(void) 416static void __init overo_init(void)
410{ 417{
418 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
411 overo_i2c_init(); 419 overo_i2c_init();
412 platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices)); 420 platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices));
413 omap_serial_init(); 421 omap_serial_init();
@@ -418,8 +426,8 @@ static void __init overo_init(void)
418 overo_init_smsc911x(); 426 overo_init_smsc911x();
419 427
420 /* Ensure SDRC pins are mux'd for self-refresh */ 428 /* Ensure SDRC pins are mux'd for self-refresh */
421 omap_cfg_reg(H16_34XX_SDRC_CKE0); 429 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
422 omap_cfg_reg(H17_34XX_SDRC_CKE1); 430 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
423 431
424 if ((gpio_request(OVERO_GPIO_W2W_NRESET, 432 if ((gpio_request(OVERO_GPIO_W2W_NRESET,
425 "OVERO_GPIO_W2W_NRESET") == 0) && 433 "OVERO_GPIO_W2W_NRESET") == 0) &&
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 15ce6514c5fd..17f3c91231db 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 <plat/onenand.h> 33#include <plat/onenand.h>
34#include <plat/gpmc-smc91x.h> 34#include <plat/gpmc-smc91x.h>
35 35
36#include "mux.h"
36#include "mmc-twl4030.h" 37#include "mmc-twl4030.h"
37 38
38#define SYSTEM_REV_B_USES_VAUX3 0x1699 39#define SYSTEM_REV_B_USES_VAUX3 0x1699
@@ -59,7 +60,7 @@ static struct spi_board_info rx51_peripherals_spi_board_info[] __initdata = {
59 .bus_num = 4, 60 .bus_num = 4,
60 .chip_select = 0, 61 .chip_select = 0,
61 .max_speed_hz = 48000000, 62 .max_speed_hz = 48000000,
62 .mode = SPI_MODE_2, 63 .mode = SPI_MODE_3,
63 .controller_data = &wl1251_mcspi_config, 64 .controller_data = &wl1251_mcspi_config,
64 .platform_data = &wl1251_pdata, 65 .platform_data = &wl1251_pdata,
65 }, 66 },
@@ -401,15 +402,9 @@ static struct twl4030_usb_data rx51_usb_data = {
401 402
402static struct twl4030_ins sleep_on_seq[] __initdata = { 403static struct twl4030_ins sleep_on_seq[] __initdata = {
403/* 404/*
404 * Turn off VDD1 and VDD2. 405 * Turn off everything
405 */ 406 */
406 {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_OFF), 4}, 407 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_SLEEP), 2},
407 {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_OFF), 2},
408/*
409 * And also turn off the OMAP3 PLLs and the sysclk output.
410 */
411 {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_OFF), 3},
412 {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_OFF), 3},
413}; 408};
414 409
415static struct twl4030_script sleep_on_script __initdata = { 410static struct twl4030_script sleep_on_script __initdata = {
@@ -420,14 +415,9 @@ static struct twl4030_script sleep_on_script __initdata = {
420 415
421static struct twl4030_ins wakeup_seq[] __initdata = { 416static struct twl4030_ins wakeup_seq[] __initdata = {
422/* 417/*
423 * Reenable the OMAP3 PLLs. 418 * Reenable everything
424 * Wakeup VDD1 and VDD2.
425 * Reenable sysclk output.
426 */ 419 */
427 {MSG_SINGULAR(DEV_GRP_P1, 0x7, RES_STATE_ACTIVE), 0x30}, 420 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
428 {MSG_SINGULAR(DEV_GRP_P1, 0xf, RES_STATE_ACTIVE), 0x30},
429 {MSG_SINGULAR(DEV_GRP_P1, 0x10, RES_STATE_ACTIVE), 0x37},
430 {MSG_SINGULAR(DEV_GRP_P1, 0x19, RES_STATE_ACTIVE), 3},
431}; 421};
432 422
433static struct twl4030_script wakeup_script __initdata = { 423static struct twl4030_script wakeup_script __initdata = {
@@ -438,10 +428,9 @@ static struct twl4030_script wakeup_script __initdata = {
438 428
439static struct twl4030_ins wakeup_p3_seq[] __initdata = { 429static struct twl4030_ins wakeup_p3_seq[] __initdata = {
440/* 430/*
441 * Wakeup VDD1 (dummy to be able to insert a delay) 431 * Reenable everything
442 * Enable CLKEN
443 */ 432 */
444 {MSG_SINGULAR(DEV_GRP_P1, 0x17, RES_STATE_ACTIVE), 3}, 433 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 1, 0, RES_STATE_ACTIVE), 2},
445}; 434};
446 435
447static struct twl4030_script wakeup_p3_script __initdata = { 436static struct twl4030_script wakeup_p3_script __initdata = {
@@ -462,12 +451,11 @@ static struct twl4030_ins wrst_seq[] __initdata = {
462 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2}, 451 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_OFF), 2},
463 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE), 452 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_ALL, 0, 1, RES_STATE_ACTIVE),
464 0x13}, 453 0x13},
465 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 2, RES_STATE_WRST), 0x13},
466 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13}, 454 {MSG_BROADCAST(DEV_GRP_NULL, RES_GRP_PP, 0, 3, RES_STATE_OFF), 0x13},
467 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13}, 455 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD1, RES_STATE_WRST), 0x13},
468 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13}, 456 {MSG_SINGULAR(DEV_GRP_NULL, RES_VDD2, RES_STATE_WRST), 0x13},
469 {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35}, 457 {MSG_SINGULAR(DEV_GRP_NULL, RES_VPLL1, RES_STATE_WRST), 0x35},
470 {MSG_SINGULAR(DEV_GRP_P1, RES_HFCLKOUT, RES_STATE_ACTIVE), 2}, 458 {MSG_SINGULAR(DEV_GRP_P3, RES_HFCLKOUT, RES_STATE_ACTIVE), 2},
471 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2}, 459 {MSG_SINGULAR(DEV_GRP_NULL, RES_RESET, RES_STATE_ACTIVE), 2},
472}; 460};
473 461
@@ -489,22 +477,81 @@ static struct twl4030_script *twl4030_scripts[] __initdata = {
489}; 477};
490 478
491static struct twl4030_resconfig twl4030_rconfig[] __initdata = { 479static struct twl4030_resconfig twl4030_rconfig[] __initdata = {
492 { .resource = RES_VINTANA1, .devgroup = -1, .type = -1, .type2 = 1 }, 480 { .resource = RES_VDD1, .devgroup = -1,
493 { .resource = RES_VINTANA2, .devgroup = -1, .type = -1, .type2 = 1 }, 481 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
494 { .resource = RES_VINTDIG, .devgroup = -1, .type = -1, .type2 = 1 }, 482 .remap_sleep = RES_STATE_OFF
495 { .resource = RES_VMMC1, .devgroup = -1, .type = -1, .type2 = 3}, 483 },
496 { .resource = RES_VMMC2, .devgroup = DEV_GRP_NULL, .type = -1, 484 { .resource = RES_VDD2, .devgroup = -1,
497 .type2 = 3}, 485 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
498 { .resource = RES_VAUX1, .devgroup = -1, .type = -1, .type2 = 3}, 486 .remap_sleep = RES_STATE_OFF
499 { .resource = RES_VAUX2, .devgroup = -1, .type = -1, .type2 = 3}, 487 },
500 { .resource = RES_VAUX3, .devgroup = -1, .type = -1, .type2 = 3}, 488 { .resource = RES_VPLL1, .devgroup = -1,
501 { .resource = RES_VAUX4, .devgroup = -1, .type = -1, .type2 = 3}, 489 .type = 1, .type2 = -1, .remap_off = RES_STATE_OFF,
502 { .resource = RES_VPLL2, .devgroup = -1, .type = -1, .type2 = 3}, 490 .remap_sleep = RES_STATE_OFF
503 { .resource = RES_VDAC, .devgroup = -1, .type = -1, .type2 = 3}, 491 },
504 { .resource = RES_VSIM, .devgroup = DEV_GRP_NULL, .type = -1, 492 { .resource = RES_VPLL2, .devgroup = -1,
505 .type2 = 3}, 493 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
506 { .resource = RES_CLKEN, .devgroup = DEV_GRP_P3, .type = -1, 494 },
507 .type2 = 1 }, 495 { .resource = RES_VAUX1, .devgroup = -1,
496 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
497 },
498 { .resource = RES_VAUX2, .devgroup = -1,
499 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
500 },
501 { .resource = RES_VAUX3, .devgroup = -1,
502 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
503 },
504 { .resource = RES_VAUX4, .devgroup = -1,
505 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
506 },
507 { .resource = RES_VMMC1, .devgroup = -1,
508 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
509 },
510 { .resource = RES_VMMC2, .devgroup = -1,
511 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
512 },
513 { .resource = RES_VDAC, .devgroup = -1,
514 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
515 },
516 { .resource = RES_VSIM, .devgroup = -1,
517 .type = -1, .type2 = 3, .remap_off = -1, .remap_sleep = -1
518 },
519 { .resource = RES_VINTANA1, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
520 .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
521 },
522 { .resource = RES_VINTANA2, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
523 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
524 },
525 { .resource = RES_VINTDIG, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
526 .type = -1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
527 },
528 { .resource = RES_VIO, .devgroup = DEV_GRP_P3,
529 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
530 },
531 { .resource = RES_CLKEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
532 .type = 1, .type2 = -1 , .remap_off = -1, .remap_sleep = -1
533 },
534 { .resource = RES_REGEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
535 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
536 },
537 { .resource = RES_NRES_PWRON, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
538 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
539 },
540 { .resource = RES_SYSEN, .devgroup = DEV_GRP_P1 | DEV_GRP_P3,
541 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
542 },
543 { .resource = RES_HFCLKOUT, .devgroup = DEV_GRP_P3,
544 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
545 },
546 { .resource = RES_32KCLKOUT, .devgroup = -1,
547 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
548 },
549 { .resource = RES_RESET, .devgroup = -1,
550 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
551 },
552 { .resource = RES_Main_Ref, .devgroup = -1,
553 .type = 1, .type2 = -1, .remap_off = -1, .remap_sleep = -1
554 },
508 { 0, 0}, 555 { 0, 0},
509}; 556};
510 557
@@ -630,9 +677,9 @@ static struct omap_smc91x_platform_data board_smc91x_data = {
630 677
631static void __init board_smc91x_init(void) 678static void __init board_smc91x_init(void)
632{ 679{
633 omap_cfg_reg(U8_34XX_GPIO54_DOWN); 680 omap_mux_init_gpio(54, OMAP_PIN_INPUT_PULLDOWN);
634 omap_cfg_reg(G25_34XX_GPIO86_OUT); 681 omap_mux_init_gpio(86, OMAP_PIN_OUTPUT);
635 omap_cfg_reg(H19_34XX_GPIO164_OUT); 682 omap_mux_init_gpio(164, OMAP_PIN_OUTPUT);
636 683
637 gpmc_smc91x_init(&board_smc91x_data); 684 gpmc_smc91x_init(&board_smc91x_data);
638} 685}
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 1bb1de245917..67bb3476b707 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -23,13 +23,14 @@
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <plat/mcspi.h> 25#include <plat/mcspi.h>
26#include <plat/mux.h>
27#include <plat/board.h> 26#include <plat/board.h>
28#include <plat/common.h> 27#include <plat/common.h>
29#include <plat/dma.h> 28#include <plat/dma.h>
30#include <plat/gpmc.h> 29#include <plat/gpmc.h>
31#include <plat/usb.h> 30#include <plat/usb.h>
32 31
32#include "mux.h"
33
33struct omap_sdrc_params *rx51_get_sdram_timings(void); 34struct omap_sdrc_params *rx51_get_sdram_timings(void);
34 35
35static struct omap_lcd_config rx51_lcd_config = { 36static struct omap_lcd_config rx51_lcd_config = {
@@ -69,15 +70,24 @@ static void __init rx51_init_irq(void)
69 70
70extern void __init rx51_peripherals_init(void); 71extern void __init rx51_peripherals_init(void);
71 72
73#ifdef CONFIG_OMAP_MUX
74static struct omap_board_mux board_mux[] __initdata = {
75 { .reg_offset = OMAP_MUX_TERMINATOR },
76};
77#else
78#define board_mux NULL
79#endif
80
72static void __init rx51_init(void) 81static void __init rx51_init(void)
73{ 82{
83 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
74 omap_serial_init(); 84 omap_serial_init();
75 usb_musb_init(); 85 usb_musb_init();
76 rx51_peripherals_init(); 86 rx51_peripherals_init();
77 87
78 /* Ensure SDRC pins are mux'd for self-refresh */ 88 /* Ensure SDRC pins are mux'd for self-refresh */
79 omap_cfg_reg(H16_34XX_SDRC_CKE0); 89 omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT);
80 omap_cfg_reg(H17_34XX_SDRC_CKE1); 90 omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT);
81} 91}
82 92
83static void __init rx51_map_io(void) 93static void __init rx51_map_io(void)
diff --git a/arch/arm/mach-omap2/board-zoom-peripherals.c b/arch/arm/mach-omap2/board-zoom-peripherals.c
index f14baa392760..258794db488f 100755
--- a/arch/arm/mach-omap2/board-zoom-peripherals.c
+++ b/arch/arm/mach-omap2/board-zoom-peripherals.c
@@ -152,14 +152,20 @@ static struct regulator_init_data zoom_vsim = {
152 152
153static struct twl4030_hsmmc_info mmc[] __initdata = { 153static struct twl4030_hsmmc_info mmc[] __initdata = {
154 { 154 {
155 .name = "external",
155 .mmc = 1, 156 .mmc = 1,
156 .wires = 4, 157 .wires = 4,
157 .gpio_wp = -EINVAL, 158 .gpio_wp = -EINVAL,
159 .power_saving = true,
158 }, 160 },
159 { 161 {
162 .name = "internal",
160 .mmc = 2, 163 .mmc = 2,
161 .wires = 4, 164 .wires = 8,
165 .gpio_cd = -EINVAL,
162 .gpio_wp = -EINVAL, 166 .gpio_wp = -EINVAL,
167 .nonremovable = true,
168 .power_saving = true,
163 }, 169 },
164 {} /* Terminator */ 170 {} /* Terminator */
165}; 171};
@@ -167,11 +173,8 @@ static struct twl4030_hsmmc_info mmc[] __initdata = {
167static int zoom_twl_gpio_setup(struct device *dev, 173static int zoom_twl_gpio_setup(struct device *dev,
168 unsigned gpio, unsigned ngpio) 174 unsigned gpio, unsigned ngpio)
169{ 175{
170 /* gpio + 0 is "mmc0_cd" (input/IRQ), 176 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
171 * gpio + 1 is "mmc1_cd" (input/IRQ)
172 */
173 mmc[0].gpio_cd = gpio + 0; 177 mmc[0].gpio_cd = gpio + 0;
174 mmc[1].gpio_cd = gpio + 1;
175 twl4030_mmc_init(mmc); 178 twl4030_mmc_init(mmc);
176 179
177 /* link regulators to MMC adapters ... we "know" the 180 /* link regulators to MMC adapters ... we "know" the
@@ -236,6 +239,7 @@ static struct twl4030_platform_data zoom_twldata = {
236 .gpio = &zoom_gpio_data, 239 .gpio = &zoom_gpio_data,
237 .keypad = &zoom_kp_twl4030_data, 240 .keypad = &zoom_kp_twl4030_data,
238 .codec = &zoom_codec_data, 241 .codec = &zoom_codec_data,
242 .vmmc1 = &zoom_vmmc1,
239 .vmmc2 = &zoom_vmmc2, 243 .vmmc2 = &zoom_vmmc2,
240 .vsim = &zoom_vsim, 244 .vsim = &zoom_vsim,
241 245
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index d94d047c7dce..bb87cf7878ff 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -23,6 +23,7 @@
23 23
24#include <mach/board-zoom.h> 24#include <mach/board-zoom.h>
25 25
26#include "mux.h"
26#include "sdram-micron-mt46h32m32lf-6.h" 27#include "sdram-micron-mt46h32m32lf-6.h"
27 28
28static void __init omap_zoom2_init_irq(void) 29static void __init omap_zoom2_init_irq(void)
@@ -68,8 +69,17 @@ static struct twl4030_platform_data zoom2_twldata = {
68 69
69#endif 70#endif
70 71
72#ifdef CONFIG_OMAP_MUX
73static struct omap_board_mux board_mux[] __initdata = {
74 { .reg_offset = OMAP_MUX_TERMINATOR },
75};
76#else
77#define board_mux NULL
78#endif
79
71static void __init omap_zoom2_init(void) 80static void __init omap_zoom2_init(void)
72{ 81{
82 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
73 zoom_peripherals_init(); 83 zoom_peripherals_init();
74 zoom_debugboard_init(); 84 zoom_debugboard_init();
75} 85}
diff --git a/arch/arm/mach-omap2/board-zoom3.c b/arch/arm/mach-omap2/board-zoom3.c
index 8d965a6516c8..a9fe9181b010 100644
--- a/arch/arm/mach-omap2/board-zoom3.c
+++ b/arch/arm/mach-omap2/board-zoom3.c
@@ -21,6 +21,7 @@
21#include <plat/common.h> 21#include <plat/common.h>
22#include <plat/board.h> 22#include <plat/board.h>
23 23
24#include "mux.h"
24#include "sdram-hynix-h8mbx00u0mer-0em.h" 25#include "sdram-hynix-h8mbx00u0mer-0em.h"
25 26
26static void __init omap_zoom_map_io(void) 27static void __init omap_zoom_map_io(void)
@@ -42,8 +43,17 @@ static void __init omap_zoom_init_irq(void)
42 omap_gpio_init(); 43 omap_gpio_init();
43} 44}
44 45
46#ifdef CONFIG_OMAP_MUX
47static struct omap_board_mux board_mux[] __initdata = {
48 { .reg_offset = OMAP_MUX_TERMINATOR },
49};
50#else
51#define board_mux NULL
52#endif
53
45static void __init omap_zoom_init(void) 54static void __init omap_zoom_init(void)
46{ 55{
56 omap3_mux_init(board_mux, OMAP_PACKAGE_CBP);
47 zoom_peripherals_init(); 57 zoom_peripherals_init();
48 zoom_debugboard_init(); 58 zoom_debugboard_init();
49} 59}
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 4716206547ac..759c72a48f7f 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -70,9 +70,41 @@
70u8 cpu_mask; 70u8 cpu_mask;
71 71
72/*------------------------------------------------------------------------- 72/*-------------------------------------------------------------------------
73 * OMAP2/3 specific clock functions 73 * OMAP2/3/4 specific clock functions
74 *-------------------------------------------------------------------------*/ 74 *-------------------------------------------------------------------------*/
75 75
76void omap2_init_dpll_parent(struct clk *clk)
77{
78 u32 v;
79 struct dpll_data *dd;
80
81 dd = clk->dpll_data;
82 if (!dd)
83 return;
84
85 /* Return bypass rate if DPLL is bypassed */
86 v = __raw_readl(dd->control_reg);
87 v &= dd->enable_mask;
88 v >>= __ffs(dd->enable_mask);
89
90 /* Reparent in case the dpll is in bypass */
91 if (cpu_is_omap24xx()) {
92 if (v == OMAP2XXX_EN_DPLL_LPBYPASS ||
93 v == OMAP2XXX_EN_DPLL_FRBYPASS)
94 clk_reparent(clk, dd->clk_bypass);
95 } else if (cpu_is_omap34xx()) {
96 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
97 v == OMAP3XXX_EN_DPLL_FRBYPASS)
98 clk_reparent(clk, dd->clk_bypass);
99 } else if (cpu_is_omap44xx()) {
100 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
101 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
102 v == OMAP4XXX_EN_DPLL_MNBYPASS)
103 clk_reparent(clk, dd->clk_bypass);
104 }
105 return;
106}
107
76/** 108/**
77 * _omap2xxx_clk_commit - commit clock parent/rate changes in hardware 109 * _omap2xxx_clk_commit - commit clock parent/rate changes in hardware
78 * @clk: struct clk * 110 * @clk: struct clk *
@@ -149,6 +181,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n)
149 * clockdomain pointer, and save it into the struct clk. Intended to be 181 * clockdomain pointer, and save it into the struct clk. Intended to be
150 * called during clk_register(). No return value. 182 * called during clk_register(). No return value.
151 */ 183 */
184#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdm f/w is in place */
152void omap2_init_clk_clkdm(struct clk *clk) 185void omap2_init_clk_clkdm(struct clk *clk)
153{ 186{
154 struct clockdomain *clkdm; 187 struct clockdomain *clkdm;
@@ -166,6 +199,7 @@ void omap2_init_clk_clkdm(struct clk *clk)
166 "clkdm %s\n", clk->name, clk->clkdm_name); 199 "clkdm %s\n", clk->name, clk->clkdm_name);
167 } 200 }
168} 201}
202#endif
169 203
170/** 204/**
171 * omap2_init_clksel_parent - set a clksel clk's parent field from the hardware 205 * omap2_init_clksel_parent - set a clksel clk's parent field from the hardware
@@ -247,6 +281,11 @@ u32 omap2_get_dpll_rate(struct clk *clk)
247 if (v == OMAP3XXX_EN_DPLL_LPBYPASS || 281 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
248 v == OMAP3XXX_EN_DPLL_FRBYPASS) 282 v == OMAP3XXX_EN_DPLL_FRBYPASS)
249 return dd->clk_bypass->rate; 283 return dd->clk_bypass->rate;
284 } else if (cpu_is_omap44xx()) {
285 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
286 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
287 v == OMAP4XXX_EN_DPLL_MNBYPASS)
288 return dd->clk_bypass->rate;
250 } 289 }
251 290
252 v = __raw_readl(dd->mult_div1_reg); 291 v = __raw_readl(dd->mult_div1_reg);
@@ -437,8 +476,10 @@ void omap2_clk_disable(struct clk *clk)
437 _omap2_clk_disable(clk); 476 _omap2_clk_disable(clk);
438 if (clk->parent) 477 if (clk->parent)
439 omap2_clk_disable(clk->parent); 478 omap2_clk_disable(clk->parent);
479#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdm f/w is in place */
440 if (clk->clkdm) 480 if (clk->clkdm)
441 omap2_clkdm_clk_disable(clk->clkdm, clk); 481 omap2_clkdm_clk_disable(clk->clkdm, clk);
482#endif
442 483
443 } 484 }
444} 485}
@@ -448,8 +489,10 @@ int omap2_clk_enable(struct clk *clk)
448 int ret = 0; 489 int ret = 0;
449 490
450 if (clk->usecount++ == 0) { 491 if (clk->usecount++ == 0) {
492#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdm f/w is in place */
451 if (clk->clkdm) 493 if (clk->clkdm)
452 omap2_clkdm_clk_enable(clk->clkdm, clk); 494 omap2_clkdm_clk_enable(clk->clkdm, clk);
495#endif
453 496
454 if (clk->parent) { 497 if (clk->parent) {
455 ret = omap2_clk_enable(clk->parent); 498 ret = omap2_clk_enable(clk->parent);
@@ -468,8 +511,10 @@ int omap2_clk_enable(struct clk *clk)
468 return ret; 511 return ret;
469 512
470err: 513err:
514#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdm f/w is in place */
471 if (clk->clkdm) 515 if (clk->clkdm)
472 omap2_clkdm_clk_disable(clk->clkdm, clk); 516 omap2_clkdm_clk_disable(clk->clkdm, clk);
517#endif
473 clk->usecount--; 518 clk->usecount--;
474 return ret; 519 return ret;
475} 520}
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 43b6bedaafd6..93c48df3b5b1 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -1,8 +1,8 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/clock.h 2 * linux/arch/arm/mach-omap2/clock.h
3 * 3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc. 4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2008 Nokia Corporation 5 * Copyright (C) 2004-2009 Nokia Corporation
6 * 6 *
7 * Contacts: 7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com> 8 * Richard Woodruff <r-woodruff2@ti.com>
@@ -36,6 +36,17 @@
36#define OMAP3XXX_EN_DPLL_FRBYPASS 0x6 36#define OMAP3XXX_EN_DPLL_FRBYPASS 0x6
37#define OMAP3XXX_EN_DPLL_LOCKED 0x7 37#define OMAP3XXX_EN_DPLL_LOCKED 0x7
38 38
39/* OMAP4xxx CM_CLKMODE_DPLL*.EN_*_DPLL bits - for omap2_get_dpll_rate() */
40#define OMAP4XXX_EN_DPLL_MNBYPASS 0x4
41#define OMAP4XXX_EN_DPLL_LPBYPASS 0x5
42#define OMAP4XXX_EN_DPLL_FRBYPASS 0x6
43#define OMAP4XXX_EN_DPLL_LOCKED 0x7
44
45/* CM_CLKEN_PLL*.EN* bit values - not all are available for every DPLL */
46#define DPLL_LOW_POWER_STOP 0x1
47#define DPLL_LOW_POWER_BYPASS 0x5
48#define DPLL_LOCKED 0x7
49
39int omap2_clk_init(void); 50int omap2_clk_init(void);
40int omap2_clk_enable(struct clk *clk); 51int omap2_clk_enable(struct clk *clk);
41void omap2_clk_disable(struct clk *clk); 52void omap2_clk_disable(struct clk *clk);
@@ -44,6 +55,14 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate);
44int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); 55int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent);
45int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance); 56int omap2_dpll_set_rate_tolerance(struct clk *clk, unsigned int tolerance);
46long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate); 57long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate);
58unsigned long omap3_dpll_recalc(struct clk *clk);
59unsigned long omap3_clkoutx2_recalc(struct clk *clk);
60void omap3_dpll_allow_idle(struct clk *clk);
61void omap3_dpll_deny_idle(struct clk *clk);
62u32 omap3_dpll_autoidle_read(struct clk *clk);
63int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate);
64int omap3_noncore_dpll_enable(struct clk *clk);
65void omap3_noncore_dpll_disable(struct clk *clk);
47 66
48#ifdef CONFIG_OMAP_RESET_CLOCKS 67#ifdef CONFIG_OMAP_RESET_CLOCKS
49void omap2_clk_disable_unused(struct clk *clk); 68void omap2_clk_disable_unused(struct clk *clk);
@@ -63,6 +82,7 @@ unsigned long omap2_fixed_divisor_recalc(struct clk *clk);
63long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); 82long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate);
64int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 83int omap2_clksel_set_rate(struct clk *clk, unsigned long rate);
65u32 omap2_get_dpll_rate(struct clk *clk); 84u32 omap2_get_dpll_rate(struct clk *clk);
85void omap2_init_dpll_parent(struct clk *clk);
66int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); 86int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
67void omap2_clk_prepare_for_reboot(void); 87void omap2_clk_prepare_for_reboot(void);
68int omap2_dflt_clk_enable(struct clk *clk); 88int omap2_dflt_clk_enable(struct clk *clk);
@@ -72,29 +92,17 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
72void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, 92void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
73 u8 *idlest_bit); 93 u8 *idlest_bit);
74 94
95extern u8 cpu_mask;
96
75extern const struct clkops clkops_omap2_dflt_wait; 97extern const struct clkops clkops_omap2_dflt_wait;
76extern const struct clkops clkops_omap2_dflt; 98extern const struct clkops clkops_omap2_dflt;
77 99
78extern u8 cpu_mask; 100extern struct clk_functions omap2_clk_functions;
101extern struct clk *vclk, *sclk;
79 102
80/* clksel_rate data common to 24xx/343x */ 103extern const struct clksel_rate gpt_32k_rates[];
81static const struct clksel_rate gpt_32k_rates[] = { 104extern const struct clksel_rate gpt_sys_rates[];
82 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE }, 105extern const struct clksel_rate gfx_l3_rates[];
83 { .div = 0 }
84};
85
86static const struct clksel_rate gpt_sys_rates[] = {
87 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
88 { .div = 0 }
89};
90
91static const struct clksel_rate gfx_l3_rates[] = {
92 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X },
93 { .div = 2, .val = 2, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
94 { .div = 3, .val = 3, .flags = RATE_IN_243X | RATE_IN_343X },
95 { .div = 4, .val = 4, .flags = RATE_IN_243X | RATE_IN_343X },
96 { .div = 0 }
97};
98 106
99 107
100#endif 108#endif
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c
deleted file mode 100644
index e70e7e000eaa..000000000000
--- a/arch/arm/mach-omap2/clock24xx.c
+++ /dev/null
@@ -1,805 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/clock.c
3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Copyright (C) 2004-2008 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,
12 * Gordon McNutt and RidgeRun, Inc.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18#undef DEBUG
19
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/device.h>
23#include <linux/list.h>
24#include <linux/errno.h>
25#include <linux/delay.h>
26#include <linux/clk.h>
27#include <linux/io.h>
28#include <linux/cpufreq.h>
29#include <linux/bitops.h>
30
31#include <plat/clock.h>
32#include <plat/sram.h>
33#include <plat/prcm.h>
34#include <asm/div64.h>
35#include <asm/clkdev.h>
36
37#include <plat/sdrc.h>
38#include "clock.h"
39#include "prm.h"
40#include "prm-regbits-24xx.h"
41#include "cm.h"
42#include "cm-regbits-24xx.h"
43
44static const struct clkops clkops_oscck;
45static const struct clkops clkops_fixed;
46
47static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
48 void __iomem **idlest_reg,
49 u8 *idlest_bit);
50
51/* 2430 I2CHS has non-standard IDLEST register */
52static const struct clkops clkops_omap2430_i2chs_wait = {
53 .enable = omap2_dflt_clk_enable,
54 .disable = omap2_dflt_clk_disable,
55 .find_idlest = omap2430_clk_i2chs_find_idlest,
56 .find_companion = omap2_clk_dflt_find_companion,
57};
58
59#include "clock24xx.h"
60
61struct omap_clk {
62 u32 cpu;
63 struct clk_lookup lk;
64};
65
66#define CLK(dev, con, ck, cp) \
67 { \
68 .cpu = cp, \
69 .lk = { \
70 .dev_id = dev, \
71 .con_id = con, \
72 .clk = ck, \
73 }, \
74 }
75
76#define CK_243X RATE_IN_243X
77#define CK_242X RATE_IN_242X
78
79static struct omap_clk omap24xx_clks[] = {
80 /* external root sources */
81 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X | CK_242X),
82 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X | CK_242X),
83 CLK(NULL, "osc_ck", &osc_ck, CK_243X | CK_242X),
84 CLK(NULL, "sys_ck", &sys_ck, CK_243X | CK_242X),
85 CLK(NULL, "alt_ck", &alt_ck, CK_243X | CK_242X),
86 /* internal analog sources */
87 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X | CK_242X),
88 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X | CK_242X),
89 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X | CK_242X),
90 /* internal prcm root sources */
91 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X | CK_242X),
92 CLK(NULL, "core_ck", &core_ck, CK_243X | CK_242X),
93 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X | CK_242X),
94 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X | CK_242X),
95 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X | CK_242X),
96 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X | CK_242X),
97 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X | CK_242X),
98 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X | CK_242X),
99 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
100 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
101 CLK(NULL, "emul_ck", &emul_ck, CK_242X),
102 /* mpu domain clocks */
103 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X | CK_242X),
104 /* dsp domain clocks */
105 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X | CK_242X),
106 CLK(NULL, "dsp_irate_ick", &dsp_irate_ick, CK_243X | CK_242X),
107 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
108 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
109 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
110 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
111 /* GFX domain clocks */
112 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X | CK_242X),
113 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X | CK_242X),
114 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X | CK_242X),
115 /* Modem domain clocks */
116 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
117 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
118 /* DSS domain clocks */
119 CLK("omapfb", "ick", &dss_ick, CK_243X | CK_242X),
120 CLK("omapfb", "dss1_fck", &dss1_fck, CK_243X | CK_242X),
121 CLK("omapfb", "dss2_fck", &dss2_fck, CK_243X | CK_242X),
122 CLK("omapfb", "tv_fck", &dss_54m_fck, CK_243X | CK_242X),
123 /* L3 domain clocks */
124 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X | CK_242X),
125 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X | CK_242X),
126 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X | CK_242X),
127 /* L4 domain clocks */
128 CLK(NULL, "l4_ck", &l4_ck, CK_243X | CK_242X),
129 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X | CK_242X),
130 /* virtual meta-group clock */
131 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X | CK_242X),
132 /* general l4 interface ck, multi-parent functional clk */
133 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X | CK_242X),
134 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X | CK_242X),
135 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X | CK_242X),
136 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X | CK_242X),
137 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X | CK_242X),
138 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X | CK_242X),
139 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X | CK_242X),
140 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X | CK_242X),
141 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X | CK_242X),
142 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X | CK_242X),
143 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X | CK_242X),
144 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X | CK_242X),
145 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X | CK_242X),
146 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X | CK_242X),
147 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X | CK_242X),
148 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X | CK_242X),
149 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X | CK_242X),
150 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X | CK_242X),
151 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X | CK_242X),
152 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X | CK_242X),
153 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X | CK_242X),
154 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X | CK_242X),
155 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X | CK_242X),
156 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X | CK_242X),
157 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X | CK_242X),
158 CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_243X | CK_242X),
159 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X | CK_242X),
160 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_243X | CK_242X),
161 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
162 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_243X),
163 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
164 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_243X),
165 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
166 CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_243X),
167 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X | CK_242X),
168 CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_243X | CK_242X),
169 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X | CK_242X),
170 CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_243X | CK_242X),
171 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
172 CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_243X),
173 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X | CK_242X),
174 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X | CK_242X),
175 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X | CK_242X),
176 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X | CK_242X),
177 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X | CK_242X),
178 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X | CK_242X),
179 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X | CK_242X),
180 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X | CK_242X),
181 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X | CK_242X),
182 CLK("omap_wdt", "fck", &mpu_wdt_fck, CK_243X | CK_242X),
183 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X | CK_242X),
184 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X | CK_242X),
185 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X | CK_242X),
186 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
187 CLK("omap24xxcam", "fck", &cam_fck, CK_243X | CK_242X),
188 CLK("omap24xxcam", "ick", &cam_ick, CK_243X | CK_242X),
189 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X | CK_242X),
190 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X | CK_242X),
191 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X | CK_242X),
192 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
193 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
194 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X | CK_242X),
195 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X | CK_242X),
196 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
197 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
198 CLK(NULL, "fac_ick", &fac_ick, CK_243X | CK_242X),
199 CLK(NULL, "fac_fck", &fac_fck, CK_243X | CK_242X),
200 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
201 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
202 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X | CK_242X),
203 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X | CK_242X),
204 CLK("i2c_omap.1", "ick", &i2c1_ick, CK_243X | CK_242X),
205 CLK("i2c_omap.1", "fck", &i2c1_fck, CK_242X),
206 CLK("i2c_omap.1", "fck", &i2chs1_fck, CK_243X),
207 CLK("i2c_omap.2", "ick", &i2c2_ick, CK_243X | CK_242X),
208 CLK("i2c_omap.2", "fck", &i2c2_fck, CK_242X),
209 CLK("i2c_omap.2", "fck", &i2chs2_fck, CK_243X),
210 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X | CK_242X),
211 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X | CK_242X),
212 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X | CK_242X),
213 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
214 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
215 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
216 CLK(NULL, "des_ick", &des_ick, CK_243X | CK_242X),
217 CLK(NULL, "sha_ick", &sha_ick, CK_243X | CK_242X),
218 CLK("omap_rng", "ick", &rng_ick, CK_243X | CK_242X),
219 CLK(NULL, "aes_ick", &aes_ick, CK_243X | CK_242X),
220 CLK(NULL, "pka_ick", &pka_ick, CK_243X | CK_242X),
221 CLK(NULL, "usb_fck", &usb_fck, CK_243X | CK_242X),
222 CLK("musb_hdrc", "ick", &usbhs_ick, CK_243X),
223 CLK("mmci-omap-hs.0", "ick", &mmchs1_ick, CK_243X),
224 CLK("mmci-omap-hs.0", "fck", &mmchs1_fck, CK_243X),
225 CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_243X),
226 CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_243X),
227 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
228 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
229 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
230 CLK("mmci-omap-hs.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
231 CLK("mmci-omap-hs.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
232};
233
234/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
235#define EN_APLL_STOPPED 0
236#define EN_APLL_LOCKED 3
237
238/* CM_CLKSEL1_PLL.APLLS_CLKIN options (24XX) */
239#define APLLS_CLKIN_19_2MHZ 0
240#define APLLS_CLKIN_13MHZ 2
241#define APLLS_CLKIN_12MHZ 3
242
243/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
244
245static struct prcm_config *curr_prcm_set;
246static struct clk *vclk;
247static struct clk *sclk;
248
249static void __iomem *prcm_clksrc_ctrl;
250
251/*-------------------------------------------------------------------------
252 * Omap24xx specific clock functions
253 *-------------------------------------------------------------------------*/
254
255/**
256 * omap2430_clk_i2chs_find_idlest - return CM_IDLEST info for 2430 I2CHS
257 * @clk: struct clk * being enabled
258 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
259 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
260 *
261 * OMAP2430 I2CHS CM_IDLEST bits are in CM_IDLEST1_CORE, but the
262 * CM_*CLKEN bits are in CM_{I,F}CLKEN2_CORE. This custom function
263 * passes back the correct CM_IDLEST register address for I2CHS
264 * modules. No return value.
265 */
266static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
267 void __iomem **idlest_reg,
268 u8 *idlest_bit)
269{
270 *idlest_reg = OMAP_CM_REGADDR(CORE_MOD, CM_IDLEST);
271 *idlest_bit = clk->enable_bit;
272}
273
274
275/**
276 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
277 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
278 *
279 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate
280 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
281 * (the latter is unusual). This currently should be called with
282 * struct clk *dpll_ck, which is a composite clock of dpll_ck and
283 * core_ck.
284 */
285static unsigned long omap2xxx_clk_get_core_rate(struct clk *clk)
286{
287 long long core_clk;
288 u32 v;
289
290 core_clk = omap2_get_dpll_rate(clk);
291
292 v = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
293 v &= OMAP24XX_CORE_CLK_SRC_MASK;
294
295 if (v == CORE_CLK_SRC_32K)
296 core_clk = 32768;
297 else
298 core_clk *= v;
299
300 return core_clk;
301}
302
303static int omap2_enable_osc_ck(struct clk *clk)
304{
305 u32 pcc;
306
307 pcc = __raw_readl(prcm_clksrc_ctrl);
308
309 __raw_writel(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
310
311 return 0;
312}
313
314static void omap2_disable_osc_ck(struct clk *clk)
315{
316 u32 pcc;
317
318 pcc = __raw_readl(prcm_clksrc_ctrl);
319
320 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
321}
322
323static const struct clkops clkops_oscck = {
324 .enable = &omap2_enable_osc_ck,
325 .disable = &omap2_disable_osc_ck,
326};
327
328#ifdef OLD_CK
329/* Recalculate SYST_CLK */
330static void omap2_sys_clk_recalc(struct clk * clk)
331{
332 u32 div = PRCM_CLKSRC_CTRL;
333 div &= (1 << 7) | (1 << 6); /* Test if ext clk divided by 1 or 2 */
334 div >>= clk->rate_offset;
335 clk->rate = (clk->parent->rate / div);
336 propagate_rate(clk);
337}
338#endif /* OLD_CK */
339
340/* Enable an APLL if off */
341static int omap2_clk_fixed_enable(struct clk *clk)
342{
343 u32 cval, apll_mask;
344
345 apll_mask = EN_APLL_LOCKED << clk->enable_bit;
346
347 cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN);
348
349 if ((cval & apll_mask) == apll_mask)
350 return 0; /* apll already enabled */
351
352 cval &= ~apll_mask;
353 cval |= apll_mask;
354 cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
355
356 if (clk == &apll96_ck)
357 cval = OMAP24XX_ST_96M_APLL;
358 else if (clk == &apll54_ck)
359 cval = OMAP24XX_ST_54M_APLL;
360
361 omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), cval,
362 clk->name);
363
364 /*
365 * REVISIT: Should we return an error code if omap2_wait_clock_ready()
366 * fails?
367 */
368 return 0;
369}
370
371/* Stop APLL */
372static void omap2_clk_fixed_disable(struct clk *clk)
373{
374 u32 cval;
375
376 cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN);
377 cval &= ~(EN_APLL_LOCKED << clk->enable_bit);
378 cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
379}
380
381static const struct clkops clkops_fixed = {
382 .enable = &omap2_clk_fixed_enable,
383 .disable = &omap2_clk_fixed_disable,
384};
385
386/*
387 * Uses the current prcm set to tell if a rate is valid.
388 * You can go slower, but not faster within a given rate set.
389 */
390static long omap2_dpllcore_round_rate(unsigned long target_rate)
391{
392 u32 high, low, core_clk_src;
393
394 core_clk_src = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
395 core_clk_src &= OMAP24XX_CORE_CLK_SRC_MASK;
396
397 if (core_clk_src == CORE_CLK_SRC_DPLL) { /* DPLL clockout */
398 high = curr_prcm_set->dpll_speed * 2;
399 low = curr_prcm_set->dpll_speed;
400 } else { /* DPLL clockout x 2 */
401 high = curr_prcm_set->dpll_speed;
402 low = curr_prcm_set->dpll_speed / 2;
403 }
404
405#ifdef DOWN_VARIABLE_DPLL
406 if (target_rate > high)
407 return high;
408 else
409 return target_rate;
410#else
411 if (target_rate > low)
412 return high;
413 else
414 return low;
415#endif
416
417}
418
419static unsigned long omap2_dpllcore_recalc(struct clk *clk)
420{
421 return omap2xxx_clk_get_core_rate(clk);
422}
423
424static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
425{
426 u32 cur_rate, low, mult, div, valid_rate, done_rate;
427 u32 bypass = 0;
428 struct prcm_config tmpset;
429 const struct dpll_data *dd;
430
431 cur_rate = omap2xxx_clk_get_core_rate(&dpll_ck);
432 mult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
433 mult &= OMAP24XX_CORE_CLK_SRC_MASK;
434
435 if ((rate == (cur_rate / 2)) && (mult == 2)) {
436 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
437 } else if ((rate == (cur_rate * 2)) && (mult == 1)) {
438 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
439 } else if (rate != cur_rate) {
440 valid_rate = omap2_dpllcore_round_rate(rate);
441 if (valid_rate != rate)
442 return -EINVAL;
443
444 if (mult == 1)
445 low = curr_prcm_set->dpll_speed;
446 else
447 low = curr_prcm_set->dpll_speed / 2;
448
449 dd = clk->dpll_data;
450 if (!dd)
451 return -EINVAL;
452
453 tmpset.cm_clksel1_pll = __raw_readl(dd->mult_div1_reg);
454 tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
455 dd->div1_mask);
456 div = ((curr_prcm_set->xtal_speed / 1000000) - 1);
457 tmpset.cm_clksel2_pll = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
458 tmpset.cm_clksel2_pll &= ~OMAP24XX_CORE_CLK_SRC_MASK;
459 if (rate > low) {
460 tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL_X2;
461 mult = ((rate / 2) / 1000000);
462 done_rate = CORE_CLK_SRC_DPLL_X2;
463 } else {
464 tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL;
465 mult = (rate / 1000000);
466 done_rate = CORE_CLK_SRC_DPLL;
467 }
468 tmpset.cm_clksel1_pll |= (div << __ffs(dd->mult_mask));
469 tmpset.cm_clksel1_pll |= (mult << __ffs(dd->div1_mask));
470
471 /* Worst case */
472 tmpset.base_sdrc_rfr = SDRC_RFR_CTRL_BYPASS;
473
474 if (rate == curr_prcm_set->xtal_speed) /* If asking for 1-1 */
475 bypass = 1;
476
477 /* For omap2xxx_sdrc_init_params() */
478 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
479
480 /* Force dll lock mode */
481 omap2_set_prcm(tmpset.cm_clksel1_pll, tmpset.base_sdrc_rfr,
482 bypass);
483
484 /* Errata: ret dll entry state */
485 omap2xxx_sdrc_init_params(omap2xxx_sdrc_dll_is_unlocked());
486 omap2xxx_sdrc_reprogram(done_rate, 0);
487 }
488
489 return 0;
490}
491
492/**
493 * omap2_table_mpu_recalc - just return the MPU speed
494 * @clk: virt_prcm_set struct clk
495 *
496 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set.
497 */
498static unsigned long omap2_table_mpu_recalc(struct clk *clk)
499{
500 return curr_prcm_set->mpu_speed;
501}
502
503/*
504 * Look for a rate equal or less than the target rate given a configuration set.
505 *
506 * What's not entirely clear is "which" field represents the key field.
507 * Some might argue L3-DDR, others ARM, others IVA. This code is simple and
508 * just uses the ARM rates.
509 */
510static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
511{
512 struct prcm_config *ptr;
513 long highest_rate;
514
515 if (clk != &virt_prcm_set)
516 return -EINVAL;
517
518 highest_rate = -EINVAL;
519
520 for (ptr = rate_table; ptr->mpu_speed; ptr++) {
521 if (!(ptr->flags & cpu_mask))
522 continue;
523 if (ptr->xtal_speed != sys_ck.rate)
524 continue;
525
526 highest_rate = ptr->mpu_speed;
527
528 /* Can check only after xtal frequency check */
529 if (ptr->mpu_speed <= rate)
530 break;
531 }
532 return highest_rate;
533}
534
535/* Sets basic clocks based on the specified rate */
536static int omap2_select_table_rate(struct clk *clk, unsigned long rate)
537{
538 u32 cur_rate, done_rate, bypass = 0, tmp;
539 struct prcm_config *prcm;
540 unsigned long found_speed = 0;
541 unsigned long flags;
542
543 if (clk != &virt_prcm_set)
544 return -EINVAL;
545
546 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
547 if (!(prcm->flags & cpu_mask))
548 continue;
549
550 if (prcm->xtal_speed != sys_ck.rate)
551 continue;
552
553 if (prcm->mpu_speed <= rate) {
554 found_speed = prcm->mpu_speed;
555 break;
556 }
557 }
558
559 if (!found_speed) {
560 printk(KERN_INFO "Could not set MPU rate to %luMHz\n",
561 rate / 1000000);
562 return -EINVAL;
563 }
564
565 curr_prcm_set = prcm;
566 cur_rate = omap2xxx_clk_get_core_rate(&dpll_ck);
567
568 if (prcm->dpll_speed == cur_rate / 2) {
569 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
570 } else if (prcm->dpll_speed == cur_rate * 2) {
571 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
572 } else if (prcm->dpll_speed != cur_rate) {
573 local_irq_save(flags);
574
575 if (prcm->dpll_speed == prcm->xtal_speed)
576 bypass = 1;
577
578 if ((prcm->cm_clksel2_pll & OMAP24XX_CORE_CLK_SRC_MASK) ==
579 CORE_CLK_SRC_DPLL_X2)
580 done_rate = CORE_CLK_SRC_DPLL_X2;
581 else
582 done_rate = CORE_CLK_SRC_DPLL;
583
584 /* MPU divider */
585 cm_write_mod_reg(prcm->cm_clksel_mpu, MPU_MOD, CM_CLKSEL);
586
587 /* dsp + iva1 div(2420), iva2.1(2430) */
588 cm_write_mod_reg(prcm->cm_clksel_dsp,
589 OMAP24XX_DSP_MOD, CM_CLKSEL);
590
591 cm_write_mod_reg(prcm->cm_clksel_gfx, GFX_MOD, CM_CLKSEL);
592
593 /* Major subsystem dividers */
594 tmp = cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK;
595 cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD,
596 CM_CLKSEL1);
597
598 if (cpu_is_omap2430())
599 cm_write_mod_reg(prcm->cm_clksel_mdm,
600 OMAP2430_MDM_MOD, CM_CLKSEL);
601
602 /* x2 to enter omap2xxx_sdrc_init_params() */
603 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
604
605 omap2_set_prcm(prcm->cm_clksel1_pll, prcm->base_sdrc_rfr,
606 bypass);
607
608 omap2xxx_sdrc_init_params(omap2xxx_sdrc_dll_is_unlocked());
609 omap2xxx_sdrc_reprogram(done_rate, 0);
610
611 local_irq_restore(flags);
612 }
613
614 return 0;
615}
616
617#ifdef CONFIG_CPU_FREQ
618/*
619 * Walk PRCM rate table and fillout cpufreq freq_table
620 */
621static struct cpufreq_frequency_table freq_table[ARRAY_SIZE(rate_table)];
622
623void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
624{
625 struct prcm_config *prcm;
626 int i = 0;
627
628 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
629 if (!(prcm->flags & cpu_mask))
630 continue;
631 if (prcm->xtal_speed != sys_ck.rate)
632 continue;
633
634 /* don't put bypass rates in table */
635 if (prcm->dpll_speed == prcm->xtal_speed)
636 continue;
637
638 freq_table[i].index = i;
639 freq_table[i].frequency = prcm->mpu_speed / 1000;
640 i++;
641 }
642
643 if (i == 0) {
644 printk(KERN_WARNING "%s: failed to initialize frequency "
645 "table\n", __func__);
646 return;
647 }
648
649 freq_table[i].index = i;
650 freq_table[i].frequency = CPUFREQ_TABLE_END;
651
652 *table = &freq_table[0];
653}
654#endif
655
656static struct clk_functions omap2_clk_functions = {
657 .clk_enable = omap2_clk_enable,
658 .clk_disable = omap2_clk_disable,
659 .clk_round_rate = omap2_clk_round_rate,
660 .clk_set_rate = omap2_clk_set_rate,
661 .clk_set_parent = omap2_clk_set_parent,
662 .clk_disable_unused = omap2_clk_disable_unused,
663#ifdef CONFIG_CPU_FREQ
664 .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
665#endif
666};
667
668static u32 omap2_get_apll_clkin(void)
669{
670 u32 aplls, srate = 0;
671
672 aplls = cm_read_mod_reg(PLL_MOD, CM_CLKSEL1);
673 aplls &= OMAP24XX_APLLS_CLKIN_MASK;
674 aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT;
675
676 if (aplls == APLLS_CLKIN_19_2MHZ)
677 srate = 19200000;
678 else if (aplls == APLLS_CLKIN_13MHZ)
679 srate = 13000000;
680 else if (aplls == APLLS_CLKIN_12MHZ)
681 srate = 12000000;
682
683 return srate;
684}
685
686static u32 omap2_get_sysclkdiv(void)
687{
688 u32 div;
689
690 div = __raw_readl(prcm_clksrc_ctrl);
691 div &= OMAP_SYSCLKDIV_MASK;
692 div >>= OMAP_SYSCLKDIV_SHIFT;
693
694 return div;
695}
696
697static unsigned long omap2_osc_clk_recalc(struct clk *clk)
698{
699 return omap2_get_apll_clkin() * omap2_get_sysclkdiv();
700}
701
702static unsigned long omap2_sys_clk_recalc(struct clk *clk)
703{
704 return clk->parent->rate / omap2_get_sysclkdiv();
705}
706
707/*
708 * Set clocks for bypass mode for reboot to work.
709 */
710void omap2_clk_prepare_for_reboot(void)
711{
712 u32 rate;
713
714 if (vclk == NULL || sclk == NULL)
715 return;
716
717 rate = clk_get_rate(sclk);
718 clk_set_rate(vclk, rate);
719}
720
721/*
722 * Switch the MPU rate if specified on cmdline.
723 * We cannot do this early until cmdline is parsed.
724 */
725static int __init omap2_clk_arch_init(void)
726{
727 if (!mpurate)
728 return -EINVAL;
729
730 if (clk_set_rate(&virt_prcm_set, mpurate))
731 printk(KERN_ERR "Could not find matching MPU rate\n");
732
733 recalculate_root_clocks();
734
735 printk(KERN_INFO "Switched to new clocking rate (Crystal/DPLL/MPU): "
736 "%ld.%01ld/%ld/%ld MHz\n",
737 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
738 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
739
740 return 0;
741}
742arch_initcall(omap2_clk_arch_init);
743
744int __init omap2_clk_init(void)
745{
746 struct prcm_config *prcm;
747 struct omap_clk *c;
748 u32 clkrate;
749
750 if (cpu_is_omap242x()) {
751 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
752 cpu_mask = RATE_IN_242X;
753 } else if (cpu_is_omap2430()) {
754 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
755 cpu_mask = RATE_IN_243X;
756 }
757
758 clk_init(&omap2_clk_functions);
759
760 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
761 clk_preinit(c->lk.clk);
762
763 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
764 propagate_rate(&osc_ck);
765 sys_ck.rate = omap2_sys_clk_recalc(&sys_ck);
766 propagate_rate(&sys_ck);
767
768 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
769 if (c->cpu & cpu_mask) {
770 clkdev_add(&c->lk);
771 clk_register(c->lk.clk);
772 omap2_init_clk_clkdm(c->lk.clk);
773 }
774
775 /* Check the MPU rate set by bootloader */
776 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
777 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
778 if (!(prcm->flags & cpu_mask))
779 continue;
780 if (prcm->xtal_speed != sys_ck.rate)
781 continue;
782 if (prcm->dpll_speed <= clkrate)
783 break;
784 }
785 curr_prcm_set = prcm;
786
787 recalculate_root_clocks();
788
789 printk(KERN_INFO "Clocking rate (Crystal/DPLL/MPU): "
790 "%ld.%01ld/%ld/%ld MHz\n",
791 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
792 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
793
794 /*
795 * Only enable those clocks we will need, let the drivers
796 * enable other clocks as necessary
797 */
798 clk_enable_init_clocks();
799
800 /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
801 vclk = clk_get(NULL, "virt_prcm_set");
802 sclk = clk_get(NULL, "sys_ck");
803
804 return 0;
805}
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
new file mode 100644
index 000000000000..d0e3fb7f9298
--- /dev/null
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -0,0 +1,587 @@
1/*
2 * linux/arch/arm/mach-omap2/clock.c
3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc.
5 * Copyright (C) 2004-2008 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,
12 * Gordon McNutt and RidgeRun, Inc.
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 */
18#undef DEBUG
19
20#include <linux/module.h>
21#include <linux/kernel.h>
22#include <linux/device.h>
23#include <linux/list.h>
24#include <linux/errno.h>
25#include <linux/delay.h>
26#include <linux/clk.h>
27#include <linux/io.h>
28#include <linux/cpufreq.h>
29#include <linux/bitops.h>
30
31#include <plat/clock.h>
32#include <plat/sram.h>
33#include <plat/prcm.h>
34#include <plat/clkdev_omap.h>
35#include <asm/div64.h>
36#include <asm/clkdev.h>
37
38#include <plat/sdrc.h>
39#include "clock.h"
40#include "clock2xxx.h"
41#include "opp2xxx.h"
42#include "prm.h"
43#include "prm-regbits-24xx.h"
44#include "cm.h"
45#include "cm-regbits-24xx.h"
46
47
48/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
49#define EN_APLL_STOPPED 0
50#define EN_APLL_LOCKED 3
51
52/* CM_CLKSEL1_PLL.APLLS_CLKIN options (24XX) */
53#define APLLS_CLKIN_19_2MHZ 0
54#define APLLS_CLKIN_13MHZ 2
55#define APLLS_CLKIN_12MHZ 3
56
57/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
58
59const struct prcm_config *curr_prcm_set;
60const struct prcm_config *rate_table;
61
62struct clk *vclk, *sclk, *dclk;
63
64void __iomem *prcm_clksrc_ctrl;
65
66/*-------------------------------------------------------------------------
67 * Omap24xx specific clock functions
68 *-------------------------------------------------------------------------*/
69
70/**
71 * omap2430_clk_i2chs_find_idlest - return CM_IDLEST info for 2430 I2CHS
72 * @clk: struct clk * being enabled
73 * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
74 * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
75 *
76 * OMAP2430 I2CHS CM_IDLEST bits are in CM_IDLEST1_CORE, but the
77 * CM_*CLKEN bits are in CM_{I,F}CLKEN2_CORE. This custom function
78 * passes back the correct CM_IDLEST register address for I2CHS
79 * modules. No return value.
80 */
81static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
82 void __iomem **idlest_reg,
83 u8 *idlest_bit)
84{
85 *idlest_reg = OMAP_CM_REGADDR(CORE_MOD, CM_IDLEST);
86 *idlest_bit = clk->enable_bit;
87}
88
89/* 2430 I2CHS has non-standard IDLEST register */
90const struct clkops clkops_omap2430_i2chs_wait = {
91 .enable = omap2_dflt_clk_enable,
92 .disable = omap2_dflt_clk_disable,
93 .find_idlest = omap2430_clk_i2chs_find_idlest,
94 .find_companion = omap2_clk_dflt_find_companion,
95};
96
97/**
98 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
99 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
100 *
101 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate
102 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
103 * (the latter is unusual). This currently should be called with
104 * struct clk *dpll_ck, which is a composite clock of dpll_ck and
105 * core_ck.
106 */
107unsigned long omap2xxx_clk_get_core_rate(struct clk *clk)
108{
109 long long core_clk;
110 u32 v;
111
112 core_clk = omap2_get_dpll_rate(clk);
113
114 v = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
115 v &= OMAP24XX_CORE_CLK_SRC_MASK;
116
117 if (v == CORE_CLK_SRC_32K)
118 core_clk = 32768;
119 else
120 core_clk *= v;
121
122 return core_clk;
123}
124
125static int omap2_enable_osc_ck(struct clk *clk)
126{
127 u32 pcc;
128
129 pcc = __raw_readl(prcm_clksrc_ctrl);
130
131 __raw_writel(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
132
133 return 0;
134}
135
136static void omap2_disable_osc_ck(struct clk *clk)
137{
138 u32 pcc;
139
140 pcc = __raw_readl(prcm_clksrc_ctrl);
141
142 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
143}
144
145const struct clkops clkops_oscck = {
146 .enable = omap2_enable_osc_ck,
147 .disable = omap2_disable_osc_ck,
148};
149
150#ifdef OLD_CK
151/* Recalculate SYST_CLK */
152static void omap2_sys_clk_recalc(struct clk *clk)
153{
154 u32 div = PRCM_CLKSRC_CTRL;
155 div &= (1 << 7) | (1 << 6); /* Test if ext clk divided by 1 or 2 */
156 div >>= clk->rate_offset;
157 clk->rate = (clk->parent->rate / div);
158 propagate_rate(clk);
159}
160#endif /* OLD_CK */
161
162/* Enable an APLL if off */
163static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask)
164{
165 u32 cval, apll_mask;
166
167 apll_mask = EN_APLL_LOCKED << clk->enable_bit;
168
169 cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN);
170
171 if ((cval & apll_mask) == apll_mask)
172 return 0; /* apll already enabled */
173
174 cval &= ~apll_mask;
175 cval |= apll_mask;
176 cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
177
178 omap2_cm_wait_idlest(OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST), status_mask,
179 clk->name);
180
181 /*
182 * REVISIT: Should we return an error code if omap2_wait_clock_ready()
183 * fails?
184 */
185 return 0;
186}
187
188static int omap2_clk_apll96_enable(struct clk *clk)
189{
190 return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL);
191}
192
193static int omap2_clk_apll54_enable(struct clk *clk)
194{
195 return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL);
196}
197
198/* Stop APLL */
199static void omap2_clk_apll_disable(struct clk *clk)
200{
201 u32 cval;
202
203 cval = cm_read_mod_reg(PLL_MOD, CM_CLKEN);
204 cval &= ~(EN_APLL_LOCKED << clk->enable_bit);
205 cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
206}
207
208const struct clkops clkops_apll96 = {
209 .enable = omap2_clk_apll96_enable,
210 .disable = omap2_clk_apll_disable,
211};
212
213const struct clkops clkops_apll54 = {
214 .enable = omap2_clk_apll54_enable,
215 .disable = omap2_clk_apll_disable,
216};
217
218/*
219 * Uses the current prcm set to tell if a rate is valid.
220 * You can go slower, but not faster within a given rate set.
221 */
222long omap2_dpllcore_round_rate(unsigned long target_rate)
223{
224 u32 high, low, core_clk_src;
225
226 core_clk_src = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
227 core_clk_src &= OMAP24XX_CORE_CLK_SRC_MASK;
228
229 if (core_clk_src == CORE_CLK_SRC_DPLL) { /* DPLL clockout */
230 high = curr_prcm_set->dpll_speed * 2;
231 low = curr_prcm_set->dpll_speed;
232 } else { /* DPLL clockout x 2 */
233 high = curr_prcm_set->dpll_speed;
234 low = curr_prcm_set->dpll_speed / 2;
235 }
236
237#ifdef DOWN_VARIABLE_DPLL
238 if (target_rate > high)
239 return high;
240 else
241 return target_rate;
242#else
243 if (target_rate > low)
244 return high;
245 else
246 return low;
247#endif
248
249}
250
251unsigned long omap2_dpllcore_recalc(struct clk *clk)
252{
253 return omap2xxx_clk_get_core_rate(clk);
254}
255
256int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
257{
258 u32 cur_rate, low, mult, div, valid_rate, done_rate;
259 u32 bypass = 0;
260 struct prcm_config tmpset;
261 const struct dpll_data *dd;
262
263 cur_rate = omap2xxx_clk_get_core_rate(dclk);
264 mult = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
265 mult &= OMAP24XX_CORE_CLK_SRC_MASK;
266
267 if ((rate == (cur_rate / 2)) && (mult == 2)) {
268 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
269 } else if ((rate == (cur_rate * 2)) && (mult == 1)) {
270 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
271 } else if (rate != cur_rate) {
272 valid_rate = omap2_dpllcore_round_rate(rate);
273 if (valid_rate != rate)
274 return -EINVAL;
275
276 if (mult == 1)
277 low = curr_prcm_set->dpll_speed;
278 else
279 low = curr_prcm_set->dpll_speed / 2;
280
281 dd = clk->dpll_data;
282 if (!dd)
283 return -EINVAL;
284
285 tmpset.cm_clksel1_pll = __raw_readl(dd->mult_div1_reg);
286 tmpset.cm_clksel1_pll &= ~(dd->mult_mask |
287 dd->div1_mask);
288 div = ((curr_prcm_set->xtal_speed / 1000000) - 1);
289 tmpset.cm_clksel2_pll = cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
290 tmpset.cm_clksel2_pll &= ~OMAP24XX_CORE_CLK_SRC_MASK;
291 if (rate > low) {
292 tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL_X2;
293 mult = ((rate / 2) / 1000000);
294 done_rate = CORE_CLK_SRC_DPLL_X2;
295 } else {
296 tmpset.cm_clksel2_pll |= CORE_CLK_SRC_DPLL;
297 mult = (rate / 1000000);
298 done_rate = CORE_CLK_SRC_DPLL;
299 }
300 tmpset.cm_clksel1_pll |= (div << __ffs(dd->mult_mask));
301 tmpset.cm_clksel1_pll |= (mult << __ffs(dd->div1_mask));
302
303 /* Worst case */
304 tmpset.base_sdrc_rfr = SDRC_RFR_CTRL_BYPASS;
305
306 if (rate == curr_prcm_set->xtal_speed) /* If asking for 1-1 */
307 bypass = 1;
308
309 /* For omap2xxx_sdrc_init_params() */
310 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
311
312 /* Force dll lock mode */
313 omap2_set_prcm(tmpset.cm_clksel1_pll, tmpset.base_sdrc_rfr,
314 bypass);
315
316 /* Errata: ret dll entry state */
317 omap2xxx_sdrc_init_params(omap2xxx_sdrc_dll_is_unlocked());
318 omap2xxx_sdrc_reprogram(done_rate, 0);
319 }
320
321 return 0;
322}
323
324/**
325 * omap2_table_mpu_recalc - just return the MPU speed
326 * @clk: virt_prcm_set struct clk
327 *
328 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set.
329 */
330unsigned long omap2_table_mpu_recalc(struct clk *clk)
331{
332 return curr_prcm_set->mpu_speed;
333}
334
335/*
336 * Look for a rate equal or less than the target rate given a configuration set.
337 *
338 * What's not entirely clear is "which" field represents the key field.
339 * Some might argue L3-DDR, others ARM, others IVA. This code is simple and
340 * just uses the ARM rates.
341 */
342long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
343{
344 const struct prcm_config *ptr;
345 long highest_rate;
346 long sys_ck_rate;
347
348 sys_ck_rate = clk_get_rate(sclk);
349
350 highest_rate = -EINVAL;
351
352 for (ptr = rate_table; ptr->mpu_speed; ptr++) {
353 if (!(ptr->flags & cpu_mask))
354 continue;
355 if (ptr->xtal_speed != sys_ck_rate)
356 continue;
357
358 highest_rate = ptr->mpu_speed;
359
360 /* Can check only after xtal frequency check */
361 if (ptr->mpu_speed <= rate)
362 break;
363 }
364 return highest_rate;
365}
366
367/* Sets basic clocks based on the specified rate */
368int omap2_select_table_rate(struct clk *clk, unsigned long rate)
369{
370 u32 cur_rate, done_rate, bypass = 0, tmp;
371 const struct prcm_config *prcm;
372 unsigned long found_speed = 0;
373 unsigned long flags;
374 long sys_ck_rate;
375
376 sys_ck_rate = clk_get_rate(sclk);
377
378 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
379 if (!(prcm->flags & cpu_mask))
380 continue;
381
382 if (prcm->xtal_speed != sys_ck_rate)
383 continue;
384
385 if (prcm->mpu_speed <= rate) {
386 found_speed = prcm->mpu_speed;
387 break;
388 }
389 }
390
391 if (!found_speed) {
392 printk(KERN_INFO "Could not set MPU rate to %luMHz\n",
393 rate / 1000000);
394 return -EINVAL;
395 }
396
397 curr_prcm_set = prcm;
398 cur_rate = omap2xxx_clk_get_core_rate(dclk);
399
400 if (prcm->dpll_speed == cur_rate / 2) {
401 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
402 } else if (prcm->dpll_speed == cur_rate * 2) {
403 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
404 } else if (prcm->dpll_speed != cur_rate) {
405 local_irq_save(flags);
406
407 if (prcm->dpll_speed == prcm->xtal_speed)
408 bypass = 1;
409
410 if ((prcm->cm_clksel2_pll & OMAP24XX_CORE_CLK_SRC_MASK) ==
411 CORE_CLK_SRC_DPLL_X2)
412 done_rate = CORE_CLK_SRC_DPLL_X2;
413 else
414 done_rate = CORE_CLK_SRC_DPLL;
415
416 /* MPU divider */
417 cm_write_mod_reg(prcm->cm_clksel_mpu, MPU_MOD, CM_CLKSEL);
418
419 /* dsp + iva1 div(2420), iva2.1(2430) */
420 cm_write_mod_reg(prcm->cm_clksel_dsp,
421 OMAP24XX_DSP_MOD, CM_CLKSEL);
422
423 cm_write_mod_reg(prcm->cm_clksel_gfx, GFX_MOD, CM_CLKSEL);
424
425 /* Major subsystem dividers */
426 tmp = cm_read_mod_reg(CORE_MOD, CM_CLKSEL1) & OMAP24XX_CLKSEL_DSS2_MASK;
427 cm_write_mod_reg(prcm->cm_clksel1_core | tmp, CORE_MOD,
428 CM_CLKSEL1);
429
430 if (cpu_is_omap2430())
431 cm_write_mod_reg(prcm->cm_clksel_mdm,
432 OMAP2430_MDM_MOD, CM_CLKSEL);
433
434 /* x2 to enter omap2xxx_sdrc_init_params() */
435 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL_X2, 1);
436
437 omap2_set_prcm(prcm->cm_clksel1_pll, prcm->base_sdrc_rfr,
438 bypass);
439
440 omap2xxx_sdrc_init_params(omap2xxx_sdrc_dll_is_unlocked());
441 omap2xxx_sdrc_reprogram(done_rate, 0);
442
443 local_irq_restore(flags);
444 }
445
446 return 0;
447}
448
449#ifdef CONFIG_CPU_FREQ
450/*
451 * Walk PRCM rate table and fillout cpufreq freq_table
452 */
453static struct cpufreq_frequency_table freq_table[ARRAY_SIZE(rate_table)];
454
455void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
456{
457 struct prcm_config *prcm;
458 int i = 0;
459
460 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
461 if (!(prcm->flags & cpu_mask))
462 continue;
463 if (prcm->xtal_speed != sys_ck.rate)
464 continue;
465
466 /* don't put bypass rates in table */
467 if (prcm->dpll_speed == prcm->xtal_speed)
468 continue;
469
470 freq_table[i].index = i;
471 freq_table[i].frequency = prcm->mpu_speed / 1000;
472 i++;
473 }
474
475 if (i == 0) {
476 printk(KERN_WARNING "%s: failed to initialize frequency "
477 "table\n", __func__);
478 return;
479 }
480
481 freq_table[i].index = i;
482 freq_table[i].frequency = CPUFREQ_TABLE_END;
483
484 *table = &freq_table[0];
485}
486#endif
487
488struct clk_functions omap2_clk_functions = {
489 .clk_enable = omap2_clk_enable,
490 .clk_disable = omap2_clk_disable,
491 .clk_round_rate = omap2_clk_round_rate,
492 .clk_set_rate = omap2_clk_set_rate,
493 .clk_set_parent = omap2_clk_set_parent,
494 .clk_disable_unused = omap2_clk_disable_unused,
495#ifdef CONFIG_CPU_FREQ
496 .clk_init_cpufreq_table = omap2_clk_init_cpufreq_table,
497#endif
498};
499
500static u32 omap2_get_apll_clkin(void)
501{
502 u32 aplls, srate = 0;
503
504 aplls = cm_read_mod_reg(PLL_MOD, CM_CLKSEL1);
505 aplls &= OMAP24XX_APLLS_CLKIN_MASK;
506 aplls >>= OMAP24XX_APLLS_CLKIN_SHIFT;
507
508 if (aplls == APLLS_CLKIN_19_2MHZ)
509 srate = 19200000;
510 else if (aplls == APLLS_CLKIN_13MHZ)
511 srate = 13000000;
512 else if (aplls == APLLS_CLKIN_12MHZ)
513 srate = 12000000;
514
515 return srate;
516}
517
518static u32 omap2_get_sysclkdiv(void)
519{
520 u32 div;
521
522 div = __raw_readl(prcm_clksrc_ctrl);
523 div &= OMAP_SYSCLKDIV_MASK;
524 div >>= OMAP_SYSCLKDIV_SHIFT;
525
526 return div;
527}
528
529unsigned long omap2_osc_clk_recalc(struct clk *clk)
530{
531 return omap2_get_apll_clkin() * omap2_get_sysclkdiv();
532}
533
534unsigned long omap2_sys_clk_recalc(struct clk *clk)
535{
536 return clk->parent->rate / omap2_get_sysclkdiv();
537}
538
539/*
540 * Set clocks for bypass mode for reboot to work.
541 */
542void omap2_clk_prepare_for_reboot(void)
543{
544 u32 rate;
545
546 if (vclk == NULL || sclk == NULL)
547 return;
548
549 rate = clk_get_rate(sclk);
550 clk_set_rate(vclk, rate);
551}
552
553/*
554 * Switch the MPU rate if specified on cmdline.
555 * We cannot do this early until cmdline is parsed.
556 */
557static int __init omap2_clk_arch_init(void)
558{
559 struct clk *virt_prcm_set, *sys_ck, *dpll_ck, *mpu_ck;
560 unsigned long sys_ck_rate;
561
562 if (!mpurate)
563 return -EINVAL;
564
565 virt_prcm_set = clk_get(NULL, "virt_prcm_set");
566 sys_ck = clk_get(NULL, "sys_ck");
567 dpll_ck = clk_get(NULL, "dpll_ck");
568 mpu_ck = clk_get(NULL, "mpu_ck");
569
570 if (clk_set_rate(virt_prcm_set, mpurate))
571 printk(KERN_ERR "Could not find matching MPU rate\n");
572
573 recalculate_root_clocks();
574
575 sys_ck_rate = clk_get_rate(sys_ck);
576
577 pr_info("Switched to new clocking rate (Crystal/DPLL/MPU): "
578 "%ld.%01ld/%ld/%ld MHz\n",
579 (sys_ck_rate / 1000000), (sys_ck_rate / 100000) % 10,
580 (clk_get_rate(dpll_ck) / 1000000),
581 (clk_get_rate(mpu_ck) / 1000000));
582
583 return 0;
584}
585arch_initcall(omap2_clk_arch_init);
586
587
diff --git a/arch/arm/mach-omap2/clock2xxx.h b/arch/arm/mach-omap2/clock2xxx.h
new file mode 100644
index 000000000000..e35efde4bd80
--- /dev/null
+++ b/arch/arm/mach-omap2/clock2xxx.h
@@ -0,0 +1,41 @@
1/*
2 * OMAP2 clock function prototypes and macros
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2009 Nokia Corporation
6 */
7
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_24XX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK_24XX_H
10
11unsigned long omap2_table_mpu_recalc(struct clk *clk);
12int omap2_select_table_rate(struct clk *clk, unsigned long rate);
13long omap2_round_to_table_rate(struct clk *clk, unsigned long rate);
14unsigned long omap2_sys_clk_recalc(struct clk *clk);
15unsigned long omap2_osc_clk_recalc(struct clk *clk);
16unsigned long omap2_sys_clk_recalc(struct clk *clk);
17unsigned long omap2_dpllcore_recalc(struct clk *clk);
18int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);
19unsigned long omap2xxx_clk_get_core_rate(struct clk *clk);
20
21/* REVISIT: These should be set dynamically for CONFIG_MULTI_OMAP2 */
22#ifdef CONFIG_ARCH_OMAP2420
23#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
24#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP2420_PRCM_CLKOUT_CTRL
25#define OMAP24XX_PRCM_CLKEMUL_CTRL OMAP2420_PRCM_CLKEMUL_CTRL
26#else
27#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
28#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP2430_PRCM_CLKOUT_CTRL
29#define OMAP24XX_PRCM_CLKEMUL_CTRL OMAP2430_PRCM_CLKEMUL_CTRL
30#endif
31
32extern void __iomem *prcm_clksrc_ctrl;
33
34extern struct clk *dclk;
35
36extern const struct clkops clkops_omap2430_i2chs_wait;
37extern const struct clkops clkops_oscck;
38extern const struct clkops clkops_apll96;
39extern const struct clkops clkops_apll54;
40
41#endif
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock2xxx_data.c
index d19cf7a7d8db..97dc7cf7751d 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock2xxx_data.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * linux/arch/arm/mach-omap2/clock24xx.h 2 * linux/arch/arm/mach-omap2/clock2xxx_data.c
3 * 3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc. 4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2008 Nokia Corporation 5 * Copyright (C) 2004-2009 Nokia Corporation
6 * 6 *
7 * Contacts: 7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com> 8 * Richard Woodruff <r-woodruff2@ti.com>
@@ -13,600 +13,21 @@
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15
16#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK24XX_H 16#include <linux/module.h>
17#define __ARCH_ARM_MACH_OMAP2_CLOCK24XX_H 17#include <linux/kernel.h>
18#include <linux/clk.h>
18 19
19#include "clock.h" 20#include <plat/clkdev_omap.h>
20 21
22#include "clock.h"
23#include "clock2xxx.h"
24#include "opp2xxx.h"
21#include "prm.h" 25#include "prm.h"
22#include "cm.h" 26#include "cm.h"
23#include "prm-regbits-24xx.h" 27#include "prm-regbits-24xx.h"
24#include "cm-regbits-24xx.h" 28#include "cm-regbits-24xx.h"
25#include "sdrc.h" 29#include "sdrc.h"
26 30
27/* REVISIT: These should be set dynamically for CONFIG_MULTI_OMAP2 */
28#ifdef CONFIG_ARCH_OMAP2420
29#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
30#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP2420_PRCM_CLKOUT_CTRL
31#define OMAP24XX_PRCM_CLKEMUL_CTRL OMAP2420_PRCM_CLKEMUL_CTRL
32#else
33#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
34#define OMAP24XX_PRCM_CLKOUT_CTRL OMAP2430_PRCM_CLKOUT_CTRL
35#define OMAP24XX_PRCM_CLKEMUL_CTRL OMAP2430_PRCM_CLKEMUL_CTRL
36#endif
37
38static unsigned long omap2_table_mpu_recalc(struct clk *clk);
39static int omap2_select_table_rate(struct clk *clk, unsigned long rate);
40static long omap2_round_to_table_rate(struct clk *clk, unsigned long rate);
41static unsigned long omap2_sys_clk_recalc(struct clk *clk);
42static unsigned long omap2_osc_clk_recalc(struct clk *clk);
43static unsigned long omap2_sys_clk_recalc(struct clk *clk);
44static unsigned long omap2_dpllcore_recalc(struct clk *clk);
45static int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);
46
47/* Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
48 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP
49 * CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL CM_CLKSEL2_PLL, CM_CLKSEL_MDM
50 */
51struct prcm_config {
52 unsigned long xtal_speed; /* crystal rate */
53 unsigned long dpll_speed; /* dpll: out*xtal*M/(N-1)table_recalc */
54 unsigned long mpu_speed; /* speed of MPU */
55 unsigned long cm_clksel_mpu; /* mpu divider */
56 unsigned long cm_clksel_dsp; /* dsp+iva1 div(2420), iva2.1(2430) */
57 unsigned long cm_clksel_gfx; /* gfx dividers */
58 unsigned long cm_clksel1_core; /* major subsystem dividers */
59 unsigned long cm_clksel1_pll; /* m,n */
60 unsigned long cm_clksel2_pll; /* dpllx1 or x2 out */
61 unsigned long cm_clksel_mdm; /* modem dividers 2430 only */
62 unsigned long base_sdrc_rfr; /* base refresh timing for a set */
63 unsigned char flags;
64};
65
66/*
67 * The OMAP2 processor can be run at several discrete 'PRCM configurations'.
68 * These configurations are characterized by voltage and speed for clocks.
69 * The device is only validated for certain combinations. One way to express
70 * these combinations is via the 'ratio's' which the clocks operate with
71 * respect to each other. These ratio sets are for a given voltage/DPLL
72 * setting. All configurations can be described by a DPLL setting and a ratio
73 * There are 3 ratio sets for the 2430 and X ratio sets for 2420.
74 *
75 * 2430 differs from 2420 in that there are no more phase synchronizers used.
76 * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs
77 * 2430 (iva2.1, NOdsp, mdm)
78 */
79
80/* Core fields for cm_clksel, not ratio governed */
81#define RX_CLKSEL_DSS1 (0x10 << 8)
82#define RX_CLKSEL_DSS2 (0x0 << 13)
83#define RX_CLKSEL_SSI (0x5 << 20)
84
85/*-------------------------------------------------------------------------
86 * Voltage/DPLL ratios
87 *-------------------------------------------------------------------------*/
88
89/* 2430 Ratio's, 2430-Ratio Config 1 */
90#define R1_CLKSEL_L3 (4 << 0)
91#define R1_CLKSEL_L4 (2 << 5)
92#define R1_CLKSEL_USB (4 << 25)
93#define R1_CM_CLKSEL1_CORE_VAL R1_CLKSEL_USB | RX_CLKSEL_SSI | \
94 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
95 R1_CLKSEL_L4 | R1_CLKSEL_L3
96#define R1_CLKSEL_MPU (2 << 0)
97#define R1_CM_CLKSEL_MPU_VAL R1_CLKSEL_MPU
98#define R1_CLKSEL_DSP (2 << 0)
99#define R1_CLKSEL_DSP_IF (2 << 5)
100#define R1_CM_CLKSEL_DSP_VAL R1_CLKSEL_DSP | R1_CLKSEL_DSP_IF
101#define R1_CLKSEL_GFX (2 << 0)
102#define R1_CM_CLKSEL_GFX_VAL R1_CLKSEL_GFX
103#define R1_CLKSEL_MDM (4 << 0)
104#define R1_CM_CLKSEL_MDM_VAL R1_CLKSEL_MDM
105
106/* 2430-Ratio Config 2 */
107#define R2_CLKSEL_L3 (6 << 0)
108#define R2_CLKSEL_L4 (2 << 5)
109#define R2_CLKSEL_USB (2 << 25)
110#define R2_CM_CLKSEL1_CORE_VAL R2_CLKSEL_USB | RX_CLKSEL_SSI | \
111 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
112 R2_CLKSEL_L4 | R2_CLKSEL_L3
113#define R2_CLKSEL_MPU (2 << 0)
114#define R2_CM_CLKSEL_MPU_VAL R2_CLKSEL_MPU
115#define R2_CLKSEL_DSP (2 << 0)
116#define R2_CLKSEL_DSP_IF (3 << 5)
117#define R2_CM_CLKSEL_DSP_VAL R2_CLKSEL_DSP | R2_CLKSEL_DSP_IF
118#define R2_CLKSEL_GFX (2 << 0)
119#define R2_CM_CLKSEL_GFX_VAL R2_CLKSEL_GFX
120#define R2_CLKSEL_MDM (6 << 0)
121#define R2_CM_CLKSEL_MDM_VAL R2_CLKSEL_MDM
122
123/* 2430-Ratio Bootm (BYPASS) */
124#define RB_CLKSEL_L3 (1 << 0)
125#define RB_CLKSEL_L4 (1 << 5)
126#define RB_CLKSEL_USB (1 << 25)
127#define RB_CM_CLKSEL1_CORE_VAL RB_CLKSEL_USB | RX_CLKSEL_SSI | \
128 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
129 RB_CLKSEL_L4 | RB_CLKSEL_L3
130#define RB_CLKSEL_MPU (1 << 0)
131#define RB_CM_CLKSEL_MPU_VAL RB_CLKSEL_MPU
132#define RB_CLKSEL_DSP (1 << 0)
133#define RB_CLKSEL_DSP_IF (1 << 5)
134#define RB_CM_CLKSEL_DSP_VAL RB_CLKSEL_DSP | RB_CLKSEL_DSP_IF
135#define RB_CLKSEL_GFX (1 << 0)
136#define RB_CM_CLKSEL_GFX_VAL RB_CLKSEL_GFX
137#define RB_CLKSEL_MDM (1 << 0)
138#define RB_CM_CLKSEL_MDM_VAL RB_CLKSEL_MDM
139
140/* 2420 Ratio Equivalents */
141#define RXX_CLKSEL_VLYNQ (0x12 << 15)
142#define RXX_CLKSEL_SSI (0x8 << 20)
143
144/* 2420-PRCM III 532MHz core */
145#define RIII_CLKSEL_L3 (4 << 0) /* 133MHz */
146#define RIII_CLKSEL_L4 (2 << 5) /* 66.5MHz */
147#define RIII_CLKSEL_USB (4 << 25) /* 33.25MHz */
148#define RIII_CM_CLKSEL1_CORE_VAL RIII_CLKSEL_USB | RXX_CLKSEL_SSI | \
149 RXX_CLKSEL_VLYNQ | RX_CLKSEL_DSS2 | \
150 RX_CLKSEL_DSS1 | RIII_CLKSEL_L4 | \
151 RIII_CLKSEL_L3
152#define RIII_CLKSEL_MPU (2 << 0) /* 266MHz */
153#define RIII_CM_CLKSEL_MPU_VAL RIII_CLKSEL_MPU
154#define RIII_CLKSEL_DSP (3 << 0) /* c5x - 177.3MHz */
155#define RIII_CLKSEL_DSP_IF (2 << 5) /* c5x - 88.67MHz */
156#define RIII_SYNC_DSP (1 << 7) /* Enable sync */
157#define RIII_CLKSEL_IVA (6 << 8) /* iva1 - 88.67MHz */
158#define RIII_SYNC_IVA (1 << 13) /* Enable sync */
159#define RIII_CM_CLKSEL_DSP_VAL RIII_SYNC_IVA | RIII_CLKSEL_IVA | \
160 RIII_SYNC_DSP | RIII_CLKSEL_DSP_IF | \
161 RIII_CLKSEL_DSP
162#define RIII_CLKSEL_GFX (2 << 0) /* 66.5MHz */
163#define RIII_CM_CLKSEL_GFX_VAL RIII_CLKSEL_GFX
164
165/* 2420-PRCM II 600MHz core */
166#define RII_CLKSEL_L3 (6 << 0) /* 100MHz */
167#define RII_CLKSEL_L4 (2 << 5) /* 50MHz */
168#define RII_CLKSEL_USB (2 << 25) /* 50MHz */
169#define RII_CM_CLKSEL1_CORE_VAL RII_CLKSEL_USB | \
170 RXX_CLKSEL_SSI | RXX_CLKSEL_VLYNQ | \
171 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
172 RII_CLKSEL_L4 | RII_CLKSEL_L3
173#define RII_CLKSEL_MPU (2 << 0) /* 300MHz */
174#define RII_CM_CLKSEL_MPU_VAL RII_CLKSEL_MPU
175#define RII_CLKSEL_DSP (3 << 0) /* c5x - 200MHz */
176#define RII_CLKSEL_DSP_IF (2 << 5) /* c5x - 100MHz */
177#define RII_SYNC_DSP (0 << 7) /* Bypass sync */
178#define RII_CLKSEL_IVA (3 << 8) /* iva1 - 200MHz */
179#define RII_SYNC_IVA (0 << 13) /* Bypass sync */
180#define RII_CM_CLKSEL_DSP_VAL RII_SYNC_IVA | RII_CLKSEL_IVA | \
181 RII_SYNC_DSP | RII_CLKSEL_DSP_IF | \
182 RII_CLKSEL_DSP
183#define RII_CLKSEL_GFX (2 << 0) /* 50MHz */
184#define RII_CM_CLKSEL_GFX_VAL RII_CLKSEL_GFX
185
186/* 2420-PRCM I 660MHz core */
187#define RI_CLKSEL_L3 (4 << 0) /* 165MHz */
188#define RI_CLKSEL_L4 (2 << 5) /* 82.5MHz */
189#define RI_CLKSEL_USB (4 << 25) /* 41.25MHz */
190#define RI_CM_CLKSEL1_CORE_VAL RI_CLKSEL_USB | \
191 RXX_CLKSEL_SSI | RXX_CLKSEL_VLYNQ | \
192 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
193 RI_CLKSEL_L4 | RI_CLKSEL_L3
194#define RI_CLKSEL_MPU (2 << 0) /* 330MHz */
195#define RI_CM_CLKSEL_MPU_VAL RI_CLKSEL_MPU
196#define RI_CLKSEL_DSP (3 << 0) /* c5x - 220MHz */
197#define RI_CLKSEL_DSP_IF (2 << 5) /* c5x - 110MHz */
198#define RI_SYNC_DSP (1 << 7) /* Activate sync */
199#define RI_CLKSEL_IVA (4 << 8) /* iva1 - 165MHz */
200#define RI_SYNC_IVA (0 << 13) /* Bypass sync */
201#define RI_CM_CLKSEL_DSP_VAL RI_SYNC_IVA | RI_CLKSEL_IVA | \
202 RI_SYNC_DSP | RI_CLKSEL_DSP_IF | \
203 RI_CLKSEL_DSP
204#define RI_CLKSEL_GFX (1 << 0) /* 165MHz */
205#define RI_CM_CLKSEL_GFX_VAL RI_CLKSEL_GFX
206
207/* 2420-PRCM VII (boot) */
208#define RVII_CLKSEL_L3 (1 << 0)
209#define RVII_CLKSEL_L4 (1 << 5)
210#define RVII_CLKSEL_DSS1 (1 << 8)
211#define RVII_CLKSEL_DSS2 (0 << 13)
212#define RVII_CLKSEL_VLYNQ (1 << 15)
213#define RVII_CLKSEL_SSI (1 << 20)
214#define RVII_CLKSEL_USB (1 << 25)
215
216#define RVII_CM_CLKSEL1_CORE_VAL RVII_CLKSEL_USB | RVII_CLKSEL_SSI | \
217 RVII_CLKSEL_VLYNQ | RVII_CLKSEL_DSS2 | \
218 RVII_CLKSEL_DSS1 | RVII_CLKSEL_L4 | RVII_CLKSEL_L3
219
220#define RVII_CLKSEL_MPU (1 << 0) /* all divide by 1 */
221#define RVII_CM_CLKSEL_MPU_VAL RVII_CLKSEL_MPU
222
223#define RVII_CLKSEL_DSP (1 << 0)
224#define RVII_CLKSEL_DSP_IF (1 << 5)
225#define RVII_SYNC_DSP (0 << 7)
226#define RVII_CLKSEL_IVA (1 << 8)
227#define RVII_SYNC_IVA (0 << 13)
228#define RVII_CM_CLKSEL_DSP_VAL RVII_SYNC_IVA | RVII_CLKSEL_IVA | RVII_SYNC_DSP | \
229 RVII_CLKSEL_DSP_IF | RVII_CLKSEL_DSP
230
231#define RVII_CLKSEL_GFX (1 << 0)
232#define RVII_CM_CLKSEL_GFX_VAL RVII_CLKSEL_GFX
233
234/*-------------------------------------------------------------------------
235 * 2430 Target modes: Along with each configuration the CPU has several
236 * modes which goes along with them. Modes mainly are the addition of
237 * describe DPLL combinations to go along with a ratio.
238 *-------------------------------------------------------------------------*/
239
240/* Hardware governed */
241#define MX_48M_SRC (0 << 3)
242#define MX_54M_SRC (0 << 5)
243#define MX_APLLS_CLIKIN_12 (3 << 23)
244#define MX_APLLS_CLIKIN_13 (2 << 23)
245#define MX_APLLS_CLIKIN_19_2 (0 << 23)
246
247/*
248 * 2430 - standalone, 2*ref*M/(n+1), M/N is for exactness not relock speed
249 * #5a (ratio1) baseport-target, target DPLL = 266*2 = 532MHz
250 */
251#define M5A_DPLL_MULT_12 (133 << 12)
252#define M5A_DPLL_DIV_12 (5 << 8)
253#define M5A_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \
254 M5A_DPLL_DIV_12 | M5A_DPLL_MULT_12 | \
255 MX_APLLS_CLIKIN_12
256#define M5A_DPLL_MULT_13 (61 << 12)
257#define M5A_DPLL_DIV_13 (2 << 8)
258#define M5A_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \
259 M5A_DPLL_DIV_13 | M5A_DPLL_MULT_13 | \
260 MX_APLLS_CLIKIN_13
261#define M5A_DPLL_MULT_19 (55 << 12)
262#define M5A_DPLL_DIV_19 (3 << 8)
263#define M5A_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \
264 M5A_DPLL_DIV_19 | M5A_DPLL_MULT_19 | \
265 MX_APLLS_CLIKIN_19_2
266/* #5b (ratio1) target DPLL = 200*2 = 400MHz */
267#define M5B_DPLL_MULT_12 (50 << 12)
268#define M5B_DPLL_DIV_12 (2 << 8)
269#define M5B_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \
270 M5B_DPLL_DIV_12 | M5B_DPLL_MULT_12 | \
271 MX_APLLS_CLIKIN_12
272#define M5B_DPLL_MULT_13 (200 << 12)
273#define M5B_DPLL_DIV_13 (12 << 8)
274
275#define M5B_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \
276 M5B_DPLL_DIV_13 | M5B_DPLL_MULT_13 | \
277 MX_APLLS_CLIKIN_13
278#define M5B_DPLL_MULT_19 (125 << 12)
279#define M5B_DPLL_DIV_19 (31 << 8)
280#define M5B_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \
281 M5B_DPLL_DIV_19 | M5B_DPLL_MULT_19 | \
282 MX_APLLS_CLIKIN_19_2
283/*
284 * #4 (ratio2), DPLL = 399*2 = 798MHz, L3=133MHz
285 */
286#define M4_DPLL_MULT_12 (133 << 12)
287#define M4_DPLL_DIV_12 (3 << 8)
288#define M4_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \
289 M4_DPLL_DIV_12 | M4_DPLL_MULT_12 | \
290 MX_APLLS_CLIKIN_12
291
292#define M4_DPLL_MULT_13 (399 << 12)
293#define M4_DPLL_DIV_13 (12 << 8)
294#define M4_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \
295 M4_DPLL_DIV_13 | M4_DPLL_MULT_13 | \
296 MX_APLLS_CLIKIN_13
297
298#define M4_DPLL_MULT_19 (145 << 12)
299#define M4_DPLL_DIV_19 (6 << 8)
300#define M4_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \
301 M4_DPLL_DIV_19 | M4_DPLL_MULT_19 | \
302 MX_APLLS_CLIKIN_19_2
303
304/*
305 * #3 (ratio2) baseport-target, target DPLL = 330*2 = 660MHz
306 */
307#define M3_DPLL_MULT_12 (55 << 12)
308#define M3_DPLL_DIV_12 (1 << 8)
309#define M3_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \
310 M3_DPLL_DIV_12 | M3_DPLL_MULT_12 | \
311 MX_APLLS_CLIKIN_12
312#define M3_DPLL_MULT_13 (76 << 12)
313#define M3_DPLL_DIV_13 (2 << 8)
314#define M3_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \
315 M3_DPLL_DIV_13 | M3_DPLL_MULT_13 | \
316 MX_APLLS_CLIKIN_13
317#define M3_DPLL_MULT_19 (17 << 12)
318#define M3_DPLL_DIV_19 (0 << 8)
319#define M3_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \
320 M3_DPLL_DIV_19 | M3_DPLL_MULT_19 | \
321 MX_APLLS_CLIKIN_19_2
322
323/*
324 * #2 (ratio1) DPLL = 330*2 = 660MHz, L3=165MHz
325 */
326#define M2_DPLL_MULT_12 (55 << 12)
327#define M2_DPLL_DIV_12 (1 << 8)
328#define M2_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \
329 M2_DPLL_DIV_12 | M2_DPLL_MULT_12 | \
330 MX_APLLS_CLIKIN_12
331
332/* Speed changes - Used 658.7MHz instead of 660MHz for LP-Refresh M=76 N=2,
333 * relock time issue */
334/* Core frequency changed from 330/165 to 329/164 MHz*/
335#define M2_DPLL_MULT_13 (76 << 12)
336#define M2_DPLL_DIV_13 (2 << 8)
337#define M2_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \
338 M2_DPLL_DIV_13 | M2_DPLL_MULT_13 | \
339 MX_APLLS_CLIKIN_13
340
341#define M2_DPLL_MULT_19 (17 << 12)
342#define M2_DPLL_DIV_19 (0 << 8)
343#define M2_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | \
344 M2_DPLL_DIV_19 | M2_DPLL_MULT_19 | \
345 MX_APLLS_CLIKIN_19_2
346
347/* boot (boot) */
348#define MB_DPLL_MULT (1 << 12)
349#define MB_DPLL_DIV (0 << 8)
350#define MB_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\
351 MB_DPLL_MULT | MX_APLLS_CLIKIN_12
352
353#define MB_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\
354 MB_DPLL_MULT | MX_APLLS_CLIKIN_13
355
356#define MB_CM_CLKSEL1_PLL_19_VAL MX_48M_SRC | MX_54M_SRC | MB_DPLL_DIV |\
357 MB_DPLL_MULT | MX_APLLS_CLIKIN_19
358
359/*
360 * 2430 - chassis (sedna)
361 * 165 (ratio1) same as above #2
362 * 150 (ratio1)
363 * 133 (ratio2) same as above #4
364 * 110 (ratio2) same as above #3
365 * 104 (ratio2)
366 * boot (boot)
367 */
368
369/* PRCM I target DPLL = 2*330MHz = 660MHz */
370#define MI_DPLL_MULT_12 (55 << 12)
371#define MI_DPLL_DIV_12 (1 << 8)
372#define MI_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \
373 MI_DPLL_DIV_12 | MI_DPLL_MULT_12 | \
374 MX_APLLS_CLIKIN_12
375
376/*
377 * 2420 Equivalent - mode registers
378 * PRCM II , target DPLL = 2*300MHz = 600MHz
379 */
380#define MII_DPLL_MULT_12 (50 << 12)
381#define MII_DPLL_DIV_12 (1 << 8)
382#define MII_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \
383 MII_DPLL_DIV_12 | MII_DPLL_MULT_12 | \
384 MX_APLLS_CLIKIN_12
385#define MII_DPLL_MULT_13 (300 << 12)
386#define MII_DPLL_DIV_13 (12 << 8)
387#define MII_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \
388 MII_DPLL_DIV_13 | MII_DPLL_MULT_13 | \
389 MX_APLLS_CLIKIN_13
390
391/* PRCM III target DPLL = 2*266 = 532MHz*/
392#define MIII_DPLL_MULT_12 (133 << 12)
393#define MIII_DPLL_DIV_12 (5 << 8)
394#define MIII_CM_CLKSEL1_PLL_12_VAL MX_48M_SRC | MX_54M_SRC | \
395 MIII_DPLL_DIV_12 | MIII_DPLL_MULT_12 | \
396 MX_APLLS_CLIKIN_12
397#define MIII_DPLL_MULT_13 (266 << 12)
398#define MIII_DPLL_DIV_13 (12 << 8)
399#define MIII_CM_CLKSEL1_PLL_13_VAL MX_48M_SRC | MX_54M_SRC | \
400 MIII_DPLL_DIV_13 | MIII_DPLL_MULT_13 | \
401 MX_APLLS_CLIKIN_13
402
403/* PRCM VII (boot bypass) */
404#define MVII_CM_CLKSEL1_PLL_12_VAL MB_CM_CLKSEL1_PLL_12_VAL
405#define MVII_CM_CLKSEL1_PLL_13_VAL MB_CM_CLKSEL1_PLL_13_VAL
406
407/* High and low operation value */
408#define MX_CLKSEL2_PLL_2x_VAL (2 << 0)
409#define MX_CLKSEL2_PLL_1x_VAL (1 << 0)
410
411/* MPU speed defines */
412#define S12M 12000000
413#define S13M 13000000
414#define S19M 19200000
415#define S26M 26000000
416#define S100M 100000000
417#define S133M 133000000
418#define S150M 150000000
419#define S164M 164000000
420#define S165M 165000000
421#define S199M 199000000
422#define S200M 200000000
423#define S266M 266000000
424#define S300M 300000000
425#define S329M 329000000
426#define S330M 330000000
427#define S399M 399000000
428#define S400M 400000000
429#define S532M 532000000
430#define S600M 600000000
431#define S658M 658000000
432#define S660M 660000000
433#define S798M 798000000
434
435/*-------------------------------------------------------------------------
436 * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
437 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,
438 * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL,
439 * CM_CLKSEL2_PLL, CM_CLKSEL_MDM
440 *
441 * Filling in table based on H4 boards and 2430-SDPs variants available.
442 * There are quite a few more rates combinations which could be defined.
443 *
444 * When multiple values are defined the start up will try and choose the
445 * fastest one. If a 'fast' value is defined, then automatically, the /2
446 * one should be included as it can be used. Generally having more that
447 * one fast set does not make sense, as static timings need to be changed
448 * to change the set. The exception is the bypass setting which is
449 * availble for low power bypass.
450 *
451 * Note: This table needs to be sorted, fastest to slowest.
452 *-------------------------------------------------------------------------*/
453static struct prcm_config rate_table[] = {
454 /* PRCM I - FAST */
455 {S12M, S660M, S330M, RI_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */
456 RI_CM_CLKSEL_DSP_VAL, RI_CM_CLKSEL_GFX_VAL,
457 RI_CM_CLKSEL1_CORE_VAL, MI_CM_CLKSEL1_PLL_12_VAL,
458 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_165MHz,
459 RATE_IN_242X},
460
461 /* PRCM II - FAST */
462 {S12M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL, /* 300MHz ARM */
463 RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
464 RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL,
465 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
466 RATE_IN_242X},
467
468 {S13M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL, /* 300MHz ARM */
469 RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
470 RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL,
471 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
472 RATE_IN_242X},
473
474 /* PRCM III - FAST */
475 {S12M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */
476 RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
477 RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL,
478 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
479 RATE_IN_242X},
480
481 {S13M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */
482 RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
483 RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL,
484 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
485 RATE_IN_242X},
486
487 /* PRCM II - SLOW */
488 {S12M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL, /* 150MHz ARM */
489 RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
490 RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL,
491 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
492 RATE_IN_242X},
493
494 {S13M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL, /* 150MHz ARM */
495 RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
496 RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL,
497 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
498 RATE_IN_242X},
499
500 /* PRCM III - SLOW */
501 {S12M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */
502 RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
503 RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL,
504 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
505 RATE_IN_242X},
506
507 {S13M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */
508 RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
509 RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL,
510 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
511 RATE_IN_242X},
512
513 /* PRCM-VII (boot-bypass) */
514 {S12M, S12M, S12M, RVII_CM_CLKSEL_MPU_VAL, /* 12MHz ARM*/
515 RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL,
516 RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_12_VAL,
517 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_BYPASS,
518 RATE_IN_242X},
519
520 /* PRCM-VII (boot-bypass) */
521 {S13M, S13M, S13M, RVII_CM_CLKSEL_MPU_VAL, /* 13MHz ARM */
522 RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL,
523 RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_13_VAL,
524 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_BYPASS,
525 RATE_IN_242X},
526
527 /* PRCM #4 - ratio2 (ES2.1) - FAST */
528 {S13M, S798M, S399M, R2_CM_CLKSEL_MPU_VAL, /* 399MHz ARM */
529 R2_CM_CLKSEL_DSP_VAL, R2_CM_CLKSEL_GFX_VAL,
530 R2_CM_CLKSEL1_CORE_VAL, M4_CM_CLKSEL1_PLL_13_VAL,
531 MX_CLKSEL2_PLL_2x_VAL, R2_CM_CLKSEL_MDM_VAL,
532 SDRC_RFR_CTRL_133MHz,
533 RATE_IN_243X},
534
535 /* PRCM #2 - ratio1 (ES2) - FAST */
536 {S13M, S658M, S329M, R1_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */
537 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
538 R1_CM_CLKSEL1_CORE_VAL, M2_CM_CLKSEL1_PLL_13_VAL,
539 MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL,
540 SDRC_RFR_CTRL_165MHz,
541 RATE_IN_243X},
542
543 /* PRCM #5a - ratio1 - FAST */
544 {S13M, S532M, S266M, R1_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */
545 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
546 R1_CM_CLKSEL1_CORE_VAL, M5A_CM_CLKSEL1_PLL_13_VAL,
547 MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL,
548 SDRC_RFR_CTRL_133MHz,
549 RATE_IN_243X},
550
551 /* PRCM #5b - ratio1 - FAST */
552 {S13M, S400M, S200M, R1_CM_CLKSEL_MPU_VAL, /* 200MHz ARM */
553 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
554 R1_CM_CLKSEL1_CORE_VAL, M5B_CM_CLKSEL1_PLL_13_VAL,
555 MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL,
556 SDRC_RFR_CTRL_100MHz,
557 RATE_IN_243X},
558
559 /* PRCM #4 - ratio1 (ES2.1) - SLOW */
560 {S13M, S399M, S199M, R2_CM_CLKSEL_MPU_VAL, /* 200MHz ARM */
561 R2_CM_CLKSEL_DSP_VAL, R2_CM_CLKSEL_GFX_VAL,
562 R2_CM_CLKSEL1_CORE_VAL, M4_CM_CLKSEL1_PLL_13_VAL,
563 MX_CLKSEL2_PLL_1x_VAL, R2_CM_CLKSEL_MDM_VAL,
564 SDRC_RFR_CTRL_133MHz,
565 RATE_IN_243X},
566
567 /* PRCM #2 - ratio1 (ES2) - SLOW */
568 {S13M, S329M, S164M, R1_CM_CLKSEL_MPU_VAL, /* 165MHz ARM */
569 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
570 R1_CM_CLKSEL1_CORE_VAL, M2_CM_CLKSEL1_PLL_13_VAL,
571 MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL,
572 SDRC_RFR_CTRL_165MHz,
573 RATE_IN_243X},
574
575 /* PRCM #5a - ratio1 - SLOW */
576 {S13M, S266M, S133M, R1_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */
577 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
578 R1_CM_CLKSEL1_CORE_VAL, M5A_CM_CLKSEL1_PLL_13_VAL,
579 MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL,
580 SDRC_RFR_CTRL_133MHz,
581 RATE_IN_243X},
582
583 /* PRCM #5b - ratio1 - SLOW*/
584 {S13M, S200M, S100M, R1_CM_CLKSEL_MPU_VAL, /* 100MHz ARM */
585 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
586 R1_CM_CLKSEL1_CORE_VAL, M5B_CM_CLKSEL1_PLL_13_VAL,
587 MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL,
588 SDRC_RFR_CTRL_100MHz,
589 RATE_IN_243X},
590
591 /* PRCM-boot/bypass */
592 {S13M, S13M, S13M, RB_CM_CLKSEL_MPU_VAL, /* 13Mhz */
593 RB_CM_CLKSEL_DSP_VAL, RB_CM_CLKSEL_GFX_VAL,
594 RB_CM_CLKSEL1_CORE_VAL, MB_CM_CLKSEL1_PLL_13_VAL,
595 MX_CLKSEL2_PLL_2x_VAL, RB_CM_CLKSEL_MDM_VAL,
596 SDRC_RFR_CTRL_BYPASS,
597 RATE_IN_243X},
598
599 /* PRCM-boot/bypass */
600 {S12M, S12M, S12M, RB_CM_CLKSEL_MPU_VAL, /* 12Mhz */
601 RB_CM_CLKSEL_DSP_VAL, RB_CM_CLKSEL_GFX_VAL,
602 RB_CM_CLKSEL1_CORE_VAL, MB_CM_CLKSEL1_PLL_12_VAL,
603 MX_CLKSEL2_PLL_2x_VAL, RB_CM_CLKSEL_MDM_VAL,
604 SDRC_RFR_CTRL_BYPASS,
605 RATE_IN_243X},
606
607 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
608};
609
610/*------------------------------------------------------------------------- 31/*-------------------------------------------------------------------------
611 * 24xx clock tree. 32 * 24xx clock tree.
612 * 33 *
@@ -708,7 +129,7 @@ static struct clk dpll_ck = {
708 129
709static struct clk apll96_ck = { 130static struct clk apll96_ck = {
710 .name = "apll96_ck", 131 .name = "apll96_ck",
711 .ops = &clkops_fixed, 132 .ops = &clkops_apll96,
712 .parent = &sys_ck, 133 .parent = &sys_ck,
713 .rate = 96000000, 134 .rate = 96000000,
714 .flags = RATE_FIXED | ENABLE_ON_INIT, 135 .flags = RATE_FIXED | ENABLE_ON_INIT,
@@ -719,7 +140,7 @@ static struct clk apll96_ck = {
719 140
720static struct clk apll54_ck = { 141static struct clk apll54_ck = {
721 .name = "apll54_ck", 142 .name = "apll54_ck",
722 .ops = &clkops_fixed, 143 .ops = &clkops_apll54,
723 .parent = &sys_ck, 144 .parent = &sys_ck,
724 .rate = 54000000, 145 .rate = 54000000,
725 .flags = RATE_FIXED | ENABLE_ON_INIT, 146 .flags = RATE_FIXED | ENABLE_ON_INIT,
@@ -2653,5 +2074,236 @@ static struct clk virt_prcm_set = {
2653 .round_rate = &omap2_round_to_table_rate, 2074 .round_rate = &omap2_round_to_table_rate,
2654}; 2075};
2655 2076
2656#endif 2077
2078/*
2079 * clkdev integration
2080 */
2081
2082static struct omap_clk omap24xx_clks[] = {
2083 /* external root sources */
2084 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X | CK_242X),
2085 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X | CK_242X),
2086 CLK(NULL, "osc_ck", &osc_ck, CK_243X | CK_242X),
2087 CLK(NULL, "sys_ck", &sys_ck, CK_243X | CK_242X),
2088 CLK(NULL, "alt_ck", &alt_ck, CK_243X | CK_242X),
2089 /* internal analog sources */
2090 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X | CK_242X),
2091 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X | CK_242X),
2092 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X | CK_242X),
2093 /* internal prcm root sources */
2094 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X | CK_242X),
2095 CLK(NULL, "core_ck", &core_ck, CK_243X | CK_242X),
2096 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X | CK_242X),
2097 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X | CK_242X),
2098 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X | CK_242X),
2099 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X | CK_242X),
2100 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X | CK_242X),
2101 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X | CK_242X),
2102 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
2103 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
2104 CLK(NULL, "emul_ck", &emul_ck, CK_242X),
2105 /* mpu domain clocks */
2106 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X | CK_242X),
2107 /* dsp domain clocks */
2108 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X | CK_242X),
2109 CLK(NULL, "dsp_irate_ick", &dsp_irate_ick, CK_243X | CK_242X),
2110 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
2111 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
2112 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
2113 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
2114 /* GFX domain clocks */
2115 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X | CK_242X),
2116 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X | CK_242X),
2117 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X | CK_242X),
2118 /* Modem domain clocks */
2119 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
2120 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
2121 /* DSS domain clocks */
2122 CLK("omapdss", "ick", &dss_ick, CK_243X | CK_242X),
2123 CLK("omapdss", "dss1_fck", &dss1_fck, CK_243X | CK_242X),
2124 CLK("omapdss", "dss2_fck", &dss2_fck, CK_243X | CK_242X),
2125 CLK("omapdss", "tv_fck", &dss_54m_fck, CK_243X | CK_242X),
2126 /* L3 domain clocks */
2127 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X | CK_242X),
2128 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X | CK_242X),
2129 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X | CK_242X),
2130 /* L4 domain clocks */
2131 CLK(NULL, "l4_ck", &l4_ck, CK_243X | CK_242X),
2132 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X | CK_242X),
2133 /* virtual meta-group clock */
2134 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X | CK_242X),
2135 /* general l4 interface ck, multi-parent functional clk */
2136 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X | CK_242X),
2137 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X | CK_242X),
2138 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X | CK_242X),
2139 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X | CK_242X),
2140 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X | CK_242X),
2141 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X | CK_242X),
2142 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X | CK_242X),
2143 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X | CK_242X),
2144 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X | CK_242X),
2145 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X | CK_242X),
2146 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X | CK_242X),
2147 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X | CK_242X),
2148 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X | CK_242X),
2149 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X | CK_242X),
2150 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X | CK_242X),
2151 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X | CK_242X),
2152 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X | CK_242X),
2153 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X | CK_242X),
2154 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X | CK_242X),
2155 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X | CK_242X),
2156 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X | CK_242X),
2157 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X | CK_242X),
2158 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X | CK_242X),
2159 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X | CK_242X),
2160 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X | CK_242X),
2161 CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_243X | CK_242X),
2162 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X | CK_242X),
2163 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_243X | CK_242X),
2164 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
2165 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_243X),
2166 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
2167 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_243X),
2168 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
2169 CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_243X),
2170 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X | CK_242X),
2171 CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_243X | CK_242X),
2172 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X | CK_242X),
2173 CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_243X | CK_242X),
2174 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
2175 CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_243X),
2176 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X | CK_242X),
2177 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X | CK_242X),
2178 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X | CK_242X),
2179 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X | CK_242X),
2180 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X | CK_242X),
2181 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X | CK_242X),
2182 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X | CK_242X),
2183 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X | CK_242X),
2184 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X | CK_242X),
2185 CLK("omap_wdt", "fck", &mpu_wdt_fck, CK_243X | CK_242X),
2186 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X | CK_242X),
2187 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X | CK_242X),
2188 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X | CK_242X),
2189 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
2190 CLK("omap24xxcam", "fck", &cam_fck, CK_243X | CK_242X),
2191 CLK("omap24xxcam", "ick", &cam_ick, CK_243X | CK_242X),
2192 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X | CK_242X),
2193 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X | CK_242X),
2194 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X | CK_242X),
2195 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
2196 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
2197 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X | CK_242X),
2198 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X | CK_242X),
2199 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
2200 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
2201 CLK(NULL, "fac_ick", &fac_ick, CK_243X | CK_242X),
2202 CLK(NULL, "fac_fck", &fac_fck, CK_243X | CK_242X),
2203 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
2204 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
2205 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X | CK_242X),
2206 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X | CK_242X),
2207 CLK("i2c_omap.1", "ick", &i2c1_ick, CK_243X | CK_242X),
2208 CLK("i2c_omap.1", "fck", &i2c1_fck, CK_242X),
2209 CLK("i2c_omap.1", "fck", &i2chs1_fck, CK_243X),
2210 CLK("i2c_omap.2", "ick", &i2c2_ick, CK_243X | CK_242X),
2211 CLK("i2c_omap.2", "fck", &i2c2_fck, CK_242X),
2212 CLK("i2c_omap.2", "fck", &i2chs2_fck, CK_243X),
2213 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X | CK_242X),
2214 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X | CK_242X),
2215 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X | CK_242X),
2216 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
2217 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
2218 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
2219 CLK(NULL, "des_ick", &des_ick, CK_243X | CK_242X),
2220 CLK(NULL, "sha_ick", &sha_ick, CK_243X | CK_242X),
2221 CLK("omap_rng", "ick", &rng_ick, CK_243X | CK_242X),
2222 CLK(NULL, "aes_ick", &aes_ick, CK_243X | CK_242X),
2223 CLK(NULL, "pka_ick", &pka_ick, CK_243X | CK_242X),
2224 CLK(NULL, "usb_fck", &usb_fck, CK_243X | CK_242X),
2225 CLK("musb_hdrc", "ick", &usbhs_ick, CK_243X),
2226 CLK("mmci-omap-hs.0", "ick", &mmchs1_ick, CK_243X),
2227 CLK("mmci-omap-hs.0", "fck", &mmchs1_fck, CK_243X),
2228 CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_243X),
2229 CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_243X),
2230 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
2231 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
2232 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
2233 CLK("mmci-omap-hs.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2234 CLK("mmci-omap-hs.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2235};
2236
2237/*
2238 * init code
2239 */
2240
2241int __init omap2_clk_init(void)
2242{
2243 const struct prcm_config *prcm;
2244 struct omap_clk *c;
2245 u32 clkrate;
2246 u16 cpu_clkflg;
2247
2248 if (cpu_is_omap242x()) {
2249 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
2250 cpu_mask = RATE_IN_242X;
2251 cpu_clkflg = CK_242X;
2252 rate_table = omap2420_rate_table;
2253 } else if (cpu_is_omap2430()) {
2254 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2255 cpu_mask = RATE_IN_243X;
2256 cpu_clkflg = CK_243X;
2257 rate_table = omap2430_rate_table;
2258 }
2259
2260 clk_init(&omap2_clk_functions);
2261
2262 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
2263 clk_preinit(c->lk.clk);
2264
2265 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
2266 propagate_rate(&osc_ck);
2267 sys_ck.rate = omap2_sys_clk_recalc(&sys_ck);
2268 propagate_rate(&sys_ck);
2269
2270 for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
2271 if (c->cpu & cpu_clkflg) {
2272 clkdev_add(&c->lk);
2273 clk_register(c->lk.clk);
2274 omap2_init_clk_clkdm(c->lk.clk);
2275 }
2276
2277 /* Check the MPU rate set by bootloader */
2278 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
2279 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
2280 if (!(prcm->flags & cpu_mask))
2281 continue;
2282 if (prcm->xtal_speed != sys_ck.rate)
2283 continue;
2284 if (prcm->dpll_speed <= clkrate)
2285 break;
2286 }
2287 curr_prcm_set = prcm;
2288
2289 recalculate_root_clocks();
2290
2291 printk(KERN_INFO "Clocking rate (Crystal/DPLL/MPU): "
2292 "%ld.%01ld/%ld/%ld MHz\n",
2293 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
2294 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
2295
2296 /*
2297 * Only enable those clocks we will need, let the drivers
2298 * enable other clocks as necessary
2299 */
2300 clk_enable_init_clocks();
2301
2302 /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
2303 vclk = clk_get(NULL, "virt_prcm_set");
2304 sclk = clk_get(NULL, "sys_ck");
2305 dclk = clk_get(NULL, "dpll_ck");
2306
2307 return 0;
2308}
2657 2309
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index 9f2feaf79865..ded32364f32b 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -30,314 +30,21 @@
30#include <plat/cpu.h> 30#include <plat/cpu.h>
31#include <plat/clock.h> 31#include <plat/clock.h>
32#include <plat/sram.h> 32#include <plat/sram.h>
33#include <plat/sdrc.h>
33#include <asm/div64.h> 34#include <asm/div64.h>
34#include <asm/clkdev.h> 35#include <asm/clkdev.h>
35 36
36#include <plat/sdrc.h> 37#include <plat/sdrc.h>
37#include "clock.h" 38#include "clock.h"
39#include "clock34xx.h"
40#include "sdrc.h"
38#include "prm.h" 41#include "prm.h"
39#include "prm-regbits-34xx.h" 42#include "prm-regbits-34xx.h"
40#include "cm.h" 43#include "cm.h"
41#include "cm-regbits-34xx.h" 44#include "cm-regbits-34xx.h"
42 45
43static const struct clkops clkops_noncore_dpll_ops;
44
45static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
46 void __iomem **idlest_reg,
47 u8 *idlest_bit);
48static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
49 void __iomem **idlest_reg,
50 u8 *idlest_bit);
51static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
52 void __iomem **idlest_reg,
53 u8 *idlest_bit);
54
55static const struct clkops clkops_omap3430es2_ssi_wait = {
56 .enable = omap2_dflt_clk_enable,
57 .disable = omap2_dflt_clk_disable,
58 .find_idlest = omap3430es2_clk_ssi_find_idlest,
59 .find_companion = omap2_clk_dflt_find_companion,
60};
61
62static const struct clkops clkops_omap3430es2_hsotgusb_wait = {
63 .enable = omap2_dflt_clk_enable,
64 .disable = omap2_dflt_clk_disable,
65 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
66 .find_companion = omap2_clk_dflt_find_companion,
67};
68
69static const struct clkops clkops_omap3430es2_dss_usbhost_wait = {
70 .enable = omap2_dflt_clk_enable,
71 .disable = omap2_dflt_clk_disable,
72 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
73 .find_companion = omap2_clk_dflt_find_companion,
74};
75
76#include "clock34xx.h"
77
78struct omap_clk {
79 u32 cpu;
80 struct clk_lookup lk;
81};
82
83#define CLK(dev, con, ck, cp) \
84 { \
85 .cpu = cp, \
86 .lk = { \
87 .dev_id = dev, \
88 .con_id = con, \
89 .clk = ck, \
90 }, \
91 }
92
93#define CK_343X (1 << 0)
94#define CK_3430ES1 (1 << 1)
95#define CK_3430ES2 (1 << 2)
96
97static struct omap_clk omap34xx_clks[] = {
98 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_343X),
99 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_343X),
100 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_343X),
101 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2),
102 CLK(NULL, "virt_19_2m_ck", &virt_19_2m_ck, CK_343X),
103 CLK(NULL, "virt_26m_ck", &virt_26m_ck, CK_343X),
104 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_343X),
105 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_343X),
106 CLK(NULL, "sys_ck", &sys_ck, CK_343X),
107 CLK(NULL, "sys_altclk", &sys_altclk, CK_343X),
108 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_343X),
109 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_343X),
110 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_343X),
111 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_343X),
112 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_343X),
113 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_343X),
114 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_343X),
115 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_343X),
116 CLK(NULL, "core_ck", &core_ck, CK_343X),
117 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_343X),
118 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_343X),
119 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_343X),
120 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_343X),
121 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_343X),
122 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X),
123 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_343X),
124 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_343X),
125 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_343X),
126 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_343X),
127 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_343X),
128 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_343X),
129 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_343X),
130 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_343X),
131 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_343X),
132 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_343X),
133 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_343X),
134 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_343X),
135 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_343X),
136 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_343X),
137 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_343X),
138 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_343X),
139 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_343X),
140 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_343X),
141 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X),
142 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2),
143 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2),
144 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_343X),
145 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_343X),
146 CLK(NULL, "corex2_fck", &corex2_fck, CK_343X),
147 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_343X),
148 CLK(NULL, "mpu_ck", &mpu_ck, CK_343X),
149 CLK(NULL, "arm_fck", &arm_fck, CK_343X),
150 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X),
151 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_343X),
152 CLK(NULL, "iva2_ck", &iva2_ck, CK_343X),
153 CLK(NULL, "l3_ick", &l3_ick, CK_343X),
154 CLK(NULL, "l4_ick", &l4_ick, CK_343X),
155 CLK(NULL, "rm_ick", &rm_ick, CK_343X),
156 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
157 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
158 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
159 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
160 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
161 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2),
162 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2),
163 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
164 CLK(NULL, "modem_fck", &modem_fck, CK_343X),
165 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_343X),
166 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_343X),
167 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_343X),
168 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_343X),
169 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2),
170 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2),
171 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2),
172 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_343X),
173 CLK("mmci-omap-hs.2", "fck", &mmchs3_fck, CK_3430ES2),
174 CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_343X),
175 CLK(NULL, "mspro_fck", &mspro_fck, CK_343X),
176 CLK("mmci-omap-hs.0", "fck", &mmchs1_fck, CK_343X),
177 CLK("i2c_omap.3", "fck", &i2c3_fck, CK_343X),
178 CLK("i2c_omap.2", "fck", &i2c2_fck, CK_343X),
179 CLK("i2c_omap.1", "fck", &i2c1_fck, CK_343X),
180 CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_343X),
181 CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_343X),
182 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_343X),
183 CLK("omap2_mcspi.4", "fck", &mcspi4_fck, CK_343X),
184 CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_343X),
185 CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_343X),
186 CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_343X),
187 CLK(NULL, "uart2_fck", &uart2_fck, CK_343X),
188 CLK(NULL, "uart1_fck", &uart1_fck, CK_343X),
189 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
190 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_343X),
191 CLK("omap_hdq.0", "fck", &hdq_fck, CK_343X),
192 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
193 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2),
194 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
195 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2),
196 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_343X),
197 CLK("musb_hdrc", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
198 CLK("musb_hdrc", "ick", &hsotgusb_ick_3430es2, CK_3430ES2),
199 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_343X),
200 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_343X),
201 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_343X),
202 CLK(NULL, "pka_ick", &pka_ick, CK_343X),
203 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_343X),
204 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2),
205 CLK("mmci-omap-hs.2", "ick", &mmchs3_ick, CK_3430ES2),
206 CLK(NULL, "icr_ick", &icr_ick, CK_343X),
207 CLK(NULL, "aes2_ick", &aes2_ick, CK_343X),
208 CLK(NULL, "sha12_ick", &sha12_ick, CK_343X),
209 CLK(NULL, "des2_ick", &des2_ick, CK_343X),
210 CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_343X),
211 CLK("mmci-omap-hs.0", "ick", &mmchs1_ick, CK_343X),
212 CLK(NULL, "mspro_ick", &mspro_ick, CK_343X),
213 CLK("omap_hdq.0", "ick", &hdq_ick, CK_343X),
214 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_343X),
215 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_343X),
216 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_343X),
217 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_343X),
218 CLK("i2c_omap.3", "ick", &i2c3_ick, CK_343X),
219 CLK("i2c_omap.2", "ick", &i2c2_ick, CK_343X),
220 CLK("i2c_omap.1", "ick", &i2c1_ick, CK_343X),
221 CLK(NULL, "uart2_ick", &uart2_ick, CK_343X),
222 CLK(NULL, "uart1_ick", &uart1_ick, CK_343X),
223 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_343X),
224 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_343X),
225 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_343X),
226 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_343X),
227 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
228 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_343X),
229 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_343X),
230 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_343X),
231 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1),
232 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2),
233 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
234 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_343X),
235 CLK(NULL, "aes1_ick", &aes1_ick, CK_343X),
236 CLK("omap_rng", "ick", &rng_ick, CK_343X),
237 CLK(NULL, "sha11_ick", &sha11_ick, CK_343X),
238 CLK(NULL, "des1_ick", &des1_ick, CK_343X),
239 CLK("omapfb", "dss1_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
240 CLK("omapfb", "dss1_fck", &dss1_alwon_fck_3430es2, CK_3430ES2),
241 CLK("omapfb", "tv_fck", &dss_tv_fck, CK_343X),
242 CLK("omapfb", "video_fck", &dss_96m_fck, CK_343X),
243 CLK("omapfb", "dss2_fck", &dss2_alwon_fck, CK_343X),
244 CLK("omapfb", "ick", &dss_ick_3430es1, CK_3430ES1),
245 CLK("omapfb", "ick", &dss_ick_3430es2, CK_3430ES2),
246 CLK(NULL, "cam_mclk", &cam_mclk, CK_343X),
247 CLK(NULL, "cam_ick", &cam_ick, CK_343X),
248 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_343X),
249 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2),
250 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2),
251 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2),
252 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2),
253 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_343X),
254 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_343X),
255 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_343X),
256 CLK("omap_wdt", "fck", &wdt2_fck, CK_343X),
257 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_343X),
258 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2),
259 CLK("omap_wdt", "ick", &wdt2_ick, CK_343X),
260 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_343X),
261 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_343X),
262 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
263 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_343X),
264 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_343X),
265 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_343X),
266 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_343X),
267 CLK(NULL, "uart3_fck", &uart3_fck, CK_343X),
268 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_343X),
269 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_343X),
270 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_343X),
271 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_343X),
272 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_343X),
273 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_343X),
274 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_343X),
275 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_343X),
276 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_343X),
277 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_343X),
278 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_343X),
279 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_343X),
280 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_343X),
281 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_343X),
282 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_343X),
283 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_343X),
284 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_343X),
285 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_343X),
286 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_343X),
287 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_343X),
288 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_343X),
289 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_343X),
290 CLK(NULL, "uart3_ick", &uart3_ick, CK_343X),
291 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_343X),
292 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_343X),
293 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_343X),
294 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_343X),
295 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_343X),
296 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_343X),
297 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_343X),
298 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_343X),
299 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_343X),
300 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_343X),
301 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_343X),
302 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_343X),
303 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_343X),
304 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_343X),
305 CLK("etb", "emu_src_ck", &emu_src_ck, CK_343X),
306 CLK(NULL, "pclk_fck", &pclk_fck, CK_343X),
307 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_343X),
308 CLK(NULL, "atclk_fck", &atclk_fck, CK_343X),
309 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_343X),
310 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_343X),
311 CLK(NULL, "sr1_fck", &sr1_fck, CK_343X),
312 CLK(NULL, "sr2_fck", &sr2_fck, CK_343X),
313 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_343X),
314 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_343X),
315 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_343X),
316 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_343X),
317};
318
319/* CM_AUTOIDLE_PLL*.AUTO_* bit values */
320#define DPLL_AUTOIDLE_DISABLE 0x0
321#define DPLL_AUTOIDLE_LOW_POWER_STOP 0x1
322
323#define MAX_DPLL_WAIT_TRIES 1000000
324
325#define MIN_SDRC_DLL_LOCK_FREQ 83000000
326
327#define CYCLES_PER_MHZ 1000000 46#define CYCLES_PER_MHZ 1000000
328 47
329/* Scale factor for fixed-point arith in omap3_core_dpll_m2_set_rate() */
330#define SDRC_MPURATE_SCALE 8
331
332/* 2^SDRC_MPURATE_BASE_SHIFT: MPU MHz that SDRC_MPURATE_LOOPS is defined for */
333#define SDRC_MPURATE_BASE_SHIFT 9
334
335/*
336 * SDRC_MPURATE_LOOPS: Number of MPU loops to execute at
337 * 2^MPURATE_BASE_SHIFT MHz for SDRC to stabilize
338 */
339#define SDRC_MPURATE_LOOPS 96
340
341/* 48/*
342 * DPLL5_FREQ_FOR_USBHOST: USBHOST and USBTLL are the only clocks 49 * DPLL5_FREQ_FOR_USBHOST: USBHOST and USBTLL are the only clocks
343 * that are sourced by DPLL5, and both of these require this clock 50 * that are sourced by DPLL5, and both of these require this clock
@@ -345,6 +52,9 @@ static struct omap_clk omap34xx_clks[] = {
345 */ 52 */
346#define DPLL5_FREQ_FOR_USBHOST 120000000 53#define DPLL5_FREQ_FOR_USBHOST 120000000
347 54
55/* needed by omap3_core_dpll_m2_set_rate() */
56struct clk *sdrc_ick_p, *arm_fck_p;
57
348/** 58/**
349 * omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI 59 * omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI
350 * @clk: struct clk * being enabled 60 * @clk: struct clk * being enabled
@@ -366,6 +76,13 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
366 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT; 76 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
367} 77}
368 78
79const struct clkops clkops_omap3430es2_ssi_wait = {
80 .enable = omap2_dflt_clk_enable,
81 .disable = omap2_dflt_clk_disable,
82 .find_idlest = omap3430es2_clk_ssi_find_idlest,
83 .find_companion = omap2_clk_dflt_find_companion,
84};
85
369/** 86/**
370 * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST 87 * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
371 * @clk: struct clk * being enabled 88 * @clk: struct clk * being enabled
@@ -391,6 +108,13 @@ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
391 *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT; 108 *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT;
392} 109}
393 110
111const struct clkops clkops_omap3430es2_dss_usbhost_wait = {
112 .enable = omap2_dflt_clk_enable,
113 .disable = omap2_dflt_clk_disable,
114 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
115 .find_companion = omap2_clk_dflt_find_companion,
116};
117
394/** 118/**
395 * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB 119 * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
396 * @clk: struct clk * being enabled 120 * @clk: struct clk * being enabled
@@ -412,395 +136,19 @@ static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
412 *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT; 136 *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT;
413} 137}
414 138
415/** 139const struct clkops clkops_omap3430es2_hsotgusb_wait = {
416 * omap3_dpll_recalc - recalculate DPLL rate 140 .enable = omap2_dflt_clk_enable,
417 * @clk: DPLL struct clk 141 .disable = omap2_dflt_clk_disable,
418 * 142 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
419 * Recalculate and propagate the DPLL rate. 143 .find_companion = omap2_clk_dflt_find_companion,
420 */ 144};
421static unsigned long omap3_dpll_recalc(struct clk *clk)
422{
423 return omap2_get_dpll_rate(clk);
424}
425
426/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
427static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
428{
429 const struct dpll_data *dd;
430 u32 v;
431
432 dd = clk->dpll_data;
433
434 v = __raw_readl(dd->control_reg);
435 v &= ~dd->enable_mask;
436 v |= clken_bits << __ffs(dd->enable_mask);
437 __raw_writel(v, dd->control_reg);
438}
439
440/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
441static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
442{
443 const struct dpll_data *dd;
444 int i = 0;
445 int ret = -EINVAL;
446
447 dd = clk->dpll_data;
448
449 state <<= __ffs(dd->idlest_mask);
450
451 while (((__raw_readl(dd->idlest_reg) & dd->idlest_mask) != state) &&
452 i < MAX_DPLL_WAIT_TRIES) {
453 i++;
454 udelay(1);
455 }
456
457 if (i == MAX_DPLL_WAIT_TRIES) {
458 printk(KERN_ERR "clock: %s failed transition to '%s'\n",
459 clk->name, (state) ? "locked" : "bypassed");
460 } else {
461 pr_debug("clock: %s transition to '%s' in %d loops\n",
462 clk->name, (state) ? "locked" : "bypassed", i);
463
464 ret = 0;
465 }
466
467 return ret;
468}
469
470/* From 3430 TRM ES2 4.7.6.2 */
471static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
472{
473 unsigned long fint;
474 u16 f = 0;
475
476 fint = clk->dpll_data->clk_ref->rate / n;
477
478 pr_debug("clock: fint is %lu\n", fint);
479
480 if (fint >= 750000 && fint <= 1000000)
481 f = 0x3;
482 else if (fint > 1000000 && fint <= 1250000)
483 f = 0x4;
484 else if (fint > 1250000 && fint <= 1500000)
485 f = 0x5;
486 else if (fint > 1500000 && fint <= 1750000)
487 f = 0x6;
488 else if (fint > 1750000 && fint <= 2100000)
489 f = 0x7;
490 else if (fint > 7500000 && fint <= 10000000)
491 f = 0xB;
492 else if (fint > 10000000 && fint <= 12500000)
493 f = 0xC;
494 else if (fint > 12500000 && fint <= 15000000)
495 f = 0xD;
496 else if (fint > 15000000 && fint <= 17500000)
497 f = 0xE;
498 else if (fint > 17500000 && fint <= 21000000)
499 f = 0xF;
500 else
501 pr_debug("clock: unknown freqsel setting for %d\n", n);
502
503 return f;
504}
505
506/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */
507
508/*
509 * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness
510 * @clk: pointer to a DPLL struct clk
511 *
512 * Instructs a non-CORE DPLL to lock. Waits for the DPLL to report
513 * readiness before returning. Will save and restore the DPLL's
514 * autoidle state across the enable, per the CDP code. If the DPLL
515 * locked successfully, return 0; if the DPLL did not lock in the time
516 * allotted, or DPLL3 was passed in, return -EINVAL.
517 */
518static int _omap3_noncore_dpll_lock(struct clk *clk)
519{
520 u8 ai;
521 int r;
522
523 if (clk == &dpll3_ck)
524 return -EINVAL;
525
526 pr_debug("clock: locking DPLL %s\n", clk->name);
527
528 ai = omap3_dpll_autoidle_read(clk);
529
530 omap3_dpll_deny_idle(clk);
531
532 _omap3_dpll_write_clken(clk, DPLL_LOCKED);
533
534 r = _omap3_wait_dpll_status(clk, 1);
535
536 if (ai)
537 omap3_dpll_allow_idle(clk);
538
539 return r;
540}
541
542/*
543 * _omap3_noncore_dpll_bypass - instruct a DPLL to bypass and wait for readiness
544 * @clk: pointer to a DPLL struct clk
545 *
546 * Instructs a non-CORE DPLL to enter low-power bypass mode. In
547 * bypass mode, the DPLL's rate is set equal to its parent clock's
548 * rate. Waits for the DPLL to report readiness before returning.
549 * Will save and restore the DPLL's autoidle state across the enable,
550 * per the CDP code. If the DPLL entered bypass mode successfully,
551 * return 0; if the DPLL did not enter bypass in the time allotted, or
552 * DPLL3 was passed in, or the DPLL does not support low-power bypass,
553 * return -EINVAL.
554 */
555static int _omap3_noncore_dpll_bypass(struct clk *clk)
556{
557 int r;
558 u8 ai;
559
560 if (clk == &dpll3_ck)
561 return -EINVAL;
562
563 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS)))
564 return -EINVAL;
565
566 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
567 clk->name);
568
569 ai = omap3_dpll_autoidle_read(clk);
570
571 _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_BYPASS);
572
573 r = _omap3_wait_dpll_status(clk, 0);
574
575 if (ai)
576 omap3_dpll_allow_idle(clk);
577 else
578 omap3_dpll_deny_idle(clk);
579
580 return r;
581}
582
583/*
584 * _omap3_noncore_dpll_stop - instruct a DPLL to stop
585 * @clk: pointer to a DPLL struct clk
586 *
587 * Instructs a non-CORE DPLL to enter low-power stop. Will save and
588 * restore the DPLL's autoidle state across the stop, per the CDP
589 * code. If DPLL3 was passed in, or the DPLL does not support
590 * low-power stop, return -EINVAL; otherwise, return 0.
591 */
592static int _omap3_noncore_dpll_stop(struct clk *clk)
593{
594 u8 ai;
595
596 if (clk == &dpll3_ck)
597 return -EINVAL;
598
599 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
600 return -EINVAL;
601
602 pr_debug("clock: stopping DPLL %s\n", clk->name);
603
604 ai = omap3_dpll_autoidle_read(clk);
605
606 _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_STOP);
607
608 if (ai)
609 omap3_dpll_allow_idle(clk);
610 else
611 omap3_dpll_deny_idle(clk);
612
613 return 0;
614}
615
616/**
617 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
618 * @clk: pointer to a DPLL struct clk
619 *
620 * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
621 * The choice of modes depends on the DPLL's programmed rate: if it is
622 * the same as the DPLL's parent clock, it will enter bypass;
623 * otherwise, it will enter lock. This code will wait for the DPLL to
624 * indicate readiness before returning, unless the DPLL takes too long
625 * to enter the target state. Intended to be used as the struct clk's
626 * enable function. If DPLL3 was passed in, or the DPLL does not
627 * support low-power stop, or if the DPLL took too long to enter
628 * bypass or lock, return -EINVAL; otherwise, return 0.
629 */
630static int omap3_noncore_dpll_enable(struct clk *clk)
631{
632 int r;
633 struct dpll_data *dd;
634
635 if (clk == &dpll3_ck)
636 return -EINVAL;
637
638 dd = clk->dpll_data;
639 if (!dd)
640 return -EINVAL;
641
642 if (clk->rate == dd->clk_bypass->rate) {
643 WARN_ON(clk->parent != dd->clk_bypass);
644 r = _omap3_noncore_dpll_bypass(clk);
645 } else {
646 WARN_ON(clk->parent != dd->clk_ref);
647 r = _omap3_noncore_dpll_lock(clk);
648 }
649 /* FIXME: this is dubious - if clk->rate has changed, what about propagating? */
650 if (!r)
651 clk->rate = omap2_get_dpll_rate(clk);
652
653 return r;
654}
655
656/**
657 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
658 * @clk: pointer to a DPLL struct clk
659 *
660 * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
661 * The choice of modes depends on the DPLL's programmed rate: if it is
662 * the same as the DPLL's parent clock, it will enter bypass;
663 * otherwise, it will enter lock. This code will wait for the DPLL to
664 * indicate readiness before returning, unless the DPLL takes too long
665 * to enter the target state. Intended to be used as the struct clk's
666 * enable function. If DPLL3 was passed in, or the DPLL does not
667 * support low-power stop, or if the DPLL took too long to enter
668 * bypass or lock, return -EINVAL; otherwise, return 0.
669 */
670static void omap3_noncore_dpll_disable(struct clk *clk)
671{
672 if (clk == &dpll3_ck)
673 return;
674
675 _omap3_noncore_dpll_stop(clk);
676}
677
678
679/* Non-CORE DPLL rate set code */
680
681/*
682 * omap3_noncore_dpll_program - set non-core DPLL M,N values directly
683 * @clk: struct clk * of DPLL to set
684 * @m: DPLL multiplier to set
685 * @n: DPLL divider to set
686 * @freqsel: FREQSEL value to set
687 *
688 * Program the DPLL with the supplied M, N values, and wait for the DPLL to
689 * lock.. Returns -EINVAL upon error, or 0 upon success.
690 */
691static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
692{
693 struct dpll_data *dd = clk->dpll_data;
694 u32 v;
695
696 /* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */
697 _omap3_noncore_dpll_bypass(clk);
698
699 /* Set jitter correction */
700 v = __raw_readl(dd->control_reg);
701 v &= ~dd->freqsel_mask;
702 v |= freqsel << __ffs(dd->freqsel_mask);
703 __raw_writel(v, dd->control_reg);
704
705 /* Set DPLL multiplier, divider */
706 v = __raw_readl(dd->mult_div1_reg);
707 v &= ~(dd->mult_mask | dd->div1_mask);
708 v |= m << __ffs(dd->mult_mask);
709 v |= (n - 1) << __ffs(dd->div1_mask);
710 __raw_writel(v, dd->mult_div1_reg);
711
712 /* We let the clock framework set the other output dividers later */
713
714 /* REVISIT: Set ramp-up delay? */
715
716 _omap3_noncore_dpll_lock(clk);
717
718 return 0;
719}
720
721/**
722 * omap3_noncore_dpll_set_rate - set non-core DPLL rate
723 * @clk: struct clk * of DPLL to set
724 * @rate: rounded target rate
725 *
726 * Set the DPLL CLKOUT to the target rate. If the DPLL can enter
727 * low-power bypass, and the target rate is the bypass source clock
728 * rate, then configure the DPLL for bypass. Otherwise, round the
729 * target rate if it hasn't been done already, then program and lock
730 * the DPLL. Returns -EINVAL upon error, or 0 upon success.
731 */
732static int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
733{
734 struct clk *new_parent = NULL;
735 u16 freqsel;
736 struct dpll_data *dd;
737 int ret;
738
739 if (!clk || !rate)
740 return -EINVAL;
741
742 dd = clk->dpll_data;
743 if (!dd)
744 return -EINVAL;
745
746 if (rate == omap2_get_dpll_rate(clk))
747 return 0;
748
749 /*
750 * Ensure both the bypass and ref clocks are enabled prior to
751 * doing anything; we need the bypass clock running to reprogram
752 * the DPLL.
753 */
754 omap2_clk_enable(dd->clk_bypass);
755 omap2_clk_enable(dd->clk_ref);
756
757 if (dd->clk_bypass->rate == rate &&
758 (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
759 pr_debug("clock: %s: set rate: entering bypass.\n", clk->name);
760
761 ret = _omap3_noncore_dpll_bypass(clk);
762 if (!ret)
763 new_parent = dd->clk_bypass;
764 } else {
765 if (dd->last_rounded_rate != rate)
766 omap2_dpll_round_rate(clk, rate);
767
768 if (dd->last_rounded_rate == 0)
769 return -EINVAL;
770
771 freqsel = _omap3_dpll_compute_freqsel(clk, dd->last_rounded_n);
772 if (!freqsel)
773 WARN_ON(1);
774
775 pr_debug("clock: %s: set rate: locking rate to %lu.\n",
776 clk->name, rate);
777
778 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m,
779 dd->last_rounded_n, freqsel);
780 if (!ret)
781 new_parent = dd->clk_ref;
782 }
783 if (!ret) {
784 /*
785 * Switch the parent clock in the heirarchy, and make sure
786 * that the new parent's usecount is correct. Note: we
787 * enable the new parent before disabling the old to avoid
788 * any unnecessary hardware disable->enable transitions.
789 */
790 if (clk->usecount) {
791 omap2_clk_enable(new_parent);
792 omap2_clk_disable(clk->parent);
793 }
794 clk_reparent(clk, new_parent);
795 clk->rate = rate;
796 }
797 omap2_clk_disable(dd->clk_ref);
798 omap2_clk_disable(dd->clk_bypass);
799 145
800 return 0; 146const struct clkops clkops_noncore_dpll_ops = {
801} 147 .enable = omap3_noncore_dpll_enable,
148 .disable = omap3_noncore_dpll_disable,
149};
802 150
803static int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) 151int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
804{ 152{
805 /* 153 /*
806 * According to the 12-5 CDP code from TI, "Limitation 2.5" 154 * According to the 12-5 CDP code from TI, "Limitation 2.5"
@@ -831,12 +179,12 @@ static int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
831 * Program the DPLL M2 divider with the rounded target rate. Returns 179 * Program the DPLL M2 divider with the rounded target rate. Returns
832 * -EINVAL upon error, or 0 upon success. 180 * -EINVAL upon error, or 0 upon success.
833 */ 181 */
834static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) 182int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
835{ 183{
836 u32 new_div = 0; 184 u32 new_div = 0;
837 u32 unlock_dll = 0; 185 u32 unlock_dll = 0;
838 u32 c; 186 u32 c;
839 unsigned long validrate, sdrcrate, mpurate; 187 unsigned long validrate, sdrcrate, _mpurate;
840 struct omap_sdrc_params *sdrc_cs0; 188 struct omap_sdrc_params *sdrc_cs0;
841 struct omap_sdrc_params *sdrc_cs1; 189 struct omap_sdrc_params *sdrc_cs1;
842 int ret; 190 int ret;
@@ -844,14 +192,11 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
844 if (!clk || !rate) 192 if (!clk || !rate)
845 return -EINVAL; 193 return -EINVAL;
846 194
847 if (clk != &dpll3_m2_ck)
848 return -EINVAL;
849
850 validrate = omap2_clksel_round_rate_div(clk, rate, &new_div); 195 validrate = omap2_clksel_round_rate_div(clk, rate, &new_div);
851 if (validrate != rate) 196 if (validrate != rate)
852 return -EINVAL; 197 return -EINVAL;
853 198
854 sdrcrate = sdrc_ick.rate; 199 sdrcrate = sdrc_ick_p->rate;
855 if (rate > clk->rate) 200 if (rate > clk->rate)
856 sdrcrate <<= ((rate / clk->rate) >> 1); 201 sdrcrate <<= ((rate / clk->rate) >> 1);
857 else 202 else
@@ -869,8 +214,8 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
869 /* 214 /*
870 * XXX This only needs to be done when the CPU frequency changes 215 * XXX This only needs to be done when the CPU frequency changes
871 */ 216 */
872 mpurate = arm_fck.rate / CYCLES_PER_MHZ; 217 _mpurate = arm_fck_p->rate / CYCLES_PER_MHZ;
873 c = (mpurate << SDRC_MPURATE_SCALE) >> SDRC_MPURATE_BASE_SHIFT; 218 c = (_mpurate << SDRC_MPURATE_SCALE) >> SDRC_MPURATE_BASE_SHIFT;
874 c += 1; /* for safety */ 219 c += 1; /* for safety */
875 c *= SDRC_MPURATE_LOOPS; 220 c *= SDRC_MPURATE_LOOPS;
876 c >>= SDRC_MPURATE_SCALE; 221 c >>= SDRC_MPURATE_SCALE;
@@ -906,129 +251,6 @@ static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
906 return 0; 251 return 0;
907} 252}
908 253
909
910static const struct clkops clkops_noncore_dpll_ops = {
911 .enable = &omap3_noncore_dpll_enable,
912 .disable = &omap3_noncore_dpll_disable,
913};
914
915/* DPLL autoidle read/set code */
916
917
918/**
919 * omap3_dpll_autoidle_read - read a DPLL's autoidle bits
920 * @clk: struct clk * of the DPLL to read
921 *
922 * Return the DPLL's autoidle bits, shifted down to bit 0. Returns
923 * -EINVAL if passed a null pointer or if the struct clk does not
924 * appear to refer to a DPLL.
925 */
926static u32 omap3_dpll_autoidle_read(struct clk *clk)
927{
928 const struct dpll_data *dd;
929 u32 v;
930
931 if (!clk || !clk->dpll_data)
932 return -EINVAL;
933
934 dd = clk->dpll_data;
935
936 v = __raw_readl(dd->autoidle_reg);
937 v &= dd->autoidle_mask;
938 v >>= __ffs(dd->autoidle_mask);
939
940 return v;
941}
942
943/**
944 * omap3_dpll_allow_idle - enable DPLL autoidle bits
945 * @clk: struct clk * of the DPLL to operate on
946 *
947 * Enable DPLL automatic idle control. This automatic idle mode
948 * switching takes effect only when the DPLL is locked, at least on
949 * OMAP3430. The DPLL will enter low-power stop when its downstream
950 * clocks are gated. No return value.
951 */
952static void omap3_dpll_allow_idle(struct clk *clk)
953{
954 const struct dpll_data *dd;
955 u32 v;
956
957 if (!clk || !clk->dpll_data)
958 return;
959
960 dd = clk->dpll_data;
961
962 /*
963 * REVISIT: CORE DPLL can optionally enter low-power bypass
964 * by writing 0x5 instead of 0x1. Add some mechanism to
965 * optionally enter this mode.
966 */
967 v = __raw_readl(dd->autoidle_reg);
968 v &= ~dd->autoidle_mask;
969 v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask);
970 __raw_writel(v, dd->autoidle_reg);
971}
972
973/**
974 * omap3_dpll_deny_idle - prevent DPLL from automatically idling
975 * @clk: struct clk * of the DPLL to operate on
976 *
977 * Disable DPLL automatic idle control. No return value.
978 */
979static void omap3_dpll_deny_idle(struct clk *clk)
980{
981 const struct dpll_data *dd;
982 u32 v;
983
984 if (!clk || !clk->dpll_data)
985 return;
986
987 dd = clk->dpll_data;
988
989 v = __raw_readl(dd->autoidle_reg);
990 v &= ~dd->autoidle_mask;
991 v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask);
992 __raw_writel(v, dd->autoidle_reg);
993}
994
995/* Clock control for DPLL outputs */
996
997/**
998 * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate
999 * @clk: DPLL output struct clk
1000 *
1001 * Using parent clock DPLL data, look up DPLL state. If locked, set our
1002 * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
1003 */
1004static unsigned long omap3_clkoutx2_recalc(struct clk *clk)
1005{
1006 const struct dpll_data *dd;
1007 unsigned long rate;
1008 u32 v;
1009 struct clk *pclk;
1010
1011 /* Walk up the parents of clk, looking for a DPLL */
1012 pclk = clk->parent;
1013 while (pclk && !pclk->dpll_data)
1014 pclk = pclk->parent;
1015
1016 /* clk does not have a DPLL as a parent? */
1017 WARN_ON(!pclk);
1018
1019 dd = pclk->dpll_data;
1020
1021 WARN_ON(!dd->enable_mask);
1022
1023 v = __raw_readl(dd->control_reg) & dd->enable_mask;
1024 v >>= __ffs(dd->enable_mask);
1025 if (v != OMAP3XXX_EN_DPLL_LOCKED)
1026 rate = clk->parent->rate;
1027 else
1028 rate = clk->parent->rate * 2;
1029 return rate;
1030}
1031
1032/* Common clock code */ 254/* Common clock code */
1033 255
1034/* 256/*
@@ -1037,7 +259,7 @@ static unsigned long omap3_clkoutx2_recalc(struct clk *clk)
1037 */ 259 */
1038#if defined(CONFIG_ARCH_OMAP3) 260#if defined(CONFIG_ARCH_OMAP3)
1039 261
1040static struct clk_functions omap2_clk_functions = { 262struct clk_functions omap2_clk_functions = {
1041 .clk_enable = omap2_clk_enable, 263 .clk_enable = omap2_clk_enable,
1042 .clk_disable = omap2_clk_disable, 264 .clk_disable = omap2_clk_disable,
1043 .clk_round_rate = omap2_clk_round_rate, 265 .clk_round_rate = omap2_clk_round_rate,
@@ -1063,7 +285,7 @@ void omap2_clk_prepare_for_reboot(void)
1063#endif 285#endif
1064} 286}
1065 287
1066static void omap3_clk_lock_dpll5(void) 288void omap3_clk_lock_dpll5(void)
1067{ 289{
1068 struct clk *dpll5_clk; 290 struct clk *dpll5_clk;
1069 struct clk *dpll5_m2_clk; 291 struct clk *dpll5_m2_clk;
@@ -1093,19 +315,32 @@ static void omap3_clk_lock_dpll5(void)
1093 */ 315 */
1094static int __init omap2_clk_arch_init(void) 316static int __init omap2_clk_arch_init(void)
1095{ 317{
318 struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck;
319 unsigned long osc_sys_rate;
320
1096 if (!mpurate) 321 if (!mpurate)
1097 return -EINVAL; 322 return -EINVAL;
1098 323
324 /* XXX test these for success */
325 dpll1_ck = clk_get(NULL, "dpll1_ck");
326 arm_fck = clk_get(NULL, "arm_fck");
327 core_ck = clk_get(NULL, "core_ck");
328 osc_sys_ck = clk_get(NULL, "osc_sys_ck");
329
1099 /* REVISIT: not yet ready for 343x */ 330 /* REVISIT: not yet ready for 343x */
1100 if (clk_set_rate(&dpll1_ck, mpurate)) 331 if (clk_set_rate(dpll1_ck, mpurate))
1101 printk(KERN_ERR "*** Unable to set MPU rate\n"); 332 printk(KERN_ERR "*** Unable to set MPU rate\n");
1102 333
1103 recalculate_root_clocks(); 334 recalculate_root_clocks();
1104 335
1105 printk(KERN_INFO "Switched to new clocking rate (Crystal/Core/MPU): " 336 osc_sys_rate = clk_get_rate(osc_sys_ck);
1106 "%ld.%01ld/%ld/%ld MHz\n", 337
1107 (osc_sys_ck.rate / 1000000), ((osc_sys_ck.rate / 100000) % 10), 338 pr_info("Switched to new clocking rate (Crystal/Core/MPU): "
1108 (core_ck.rate / 1000000), (arm_fck.rate / 1000000)) ; 339 "%ld.%01ld/%ld/%ld MHz\n",
340 (osc_sys_rate / 1000000),
341 ((osc_sys_rate / 100000) % 10),
342 (clk_get_rate(core_ck) / 1000000),
343 (clk_get_rate(arm_fck) / 1000000));
1109 344
1110 calibrate_delay(); 345 calibrate_delay();
1111 346
@@ -1113,83 +348,7 @@ static int __init omap2_clk_arch_init(void)
1113} 348}
1114arch_initcall(omap2_clk_arch_init); 349arch_initcall(omap2_clk_arch_init);
1115 350
1116int __init omap2_clk_init(void)
1117{
1118 /* struct prcm_config *prcm; */
1119 struct omap_clk *c;
1120 /* u32 clkrate; */
1121 u32 cpu_clkflg;
1122
1123 if (cpu_is_omap34xx()) {
1124 cpu_mask = RATE_IN_343X;
1125 cpu_clkflg = CK_343X;
1126
1127 /*
1128 * Update this if there are further clock changes between ES2
1129 * and production parts
1130 */
1131 if (omap_rev() == OMAP3430_REV_ES1_0) {
1132 /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */
1133 cpu_clkflg |= CK_3430ES1;
1134 } else {
1135 cpu_mask |= RATE_IN_3430ES2;
1136 cpu_clkflg |= CK_3430ES2;
1137 }
1138 }
1139
1140 clk_init(&omap2_clk_functions);
1141
1142 for (c = omap34xx_clks; c < omap34xx_clks + ARRAY_SIZE(omap34xx_clks); c++)
1143 clk_preinit(c->lk.clk);
1144 351
1145 for (c = omap34xx_clks; c < omap34xx_clks + ARRAY_SIZE(omap34xx_clks); c++)
1146 if (c->cpu & cpu_clkflg) {
1147 clkdev_add(&c->lk);
1148 clk_register(c->lk.clk);
1149 omap2_init_clk_clkdm(c->lk.clk);
1150 }
1151
1152 /* REVISIT: Not yet ready for OMAP3 */
1153#if 0
1154 /* Check the MPU rate set by bootloader */
1155 clkrate = omap2_get_dpll_rate_24xx(&dpll_ck);
1156 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
1157 if (!(prcm->flags & cpu_mask))
1158 continue;
1159 if (prcm->xtal_speed != sys_ck.rate)
1160 continue;
1161 if (prcm->dpll_speed <= clkrate)
1162 break;
1163 }
1164 curr_prcm_set = prcm;
1165#endif 352#endif
1166 353
1167 recalculate_root_clocks();
1168
1169 printk(KERN_INFO "Clocking rate (Crystal/Core/MPU): "
1170 "%ld.%01ld/%ld/%ld MHz\n",
1171 (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
1172 (core_ck.rate / 1000000), (arm_fck.rate / 1000000));
1173
1174 /*
1175 * Only enable those clocks we will need, let the drivers
1176 * enable other clocks as necessary
1177 */
1178 clk_enable_init_clocks();
1179
1180 /*
1181 * Lock DPLL5 and put it in autoidle.
1182 */
1183 if (omap_rev() >= OMAP3430_REV_ES2_0)
1184 omap3_clk_lock_dpll5();
1185 354
1186 /* Avoid sleeping during omap2_clk_prepare_for_reboot() */
1187 /* REVISIT: not yet ready for 343x */
1188#if 0
1189 vclk = clk_get(NULL, "virt_prcm_set");
1190 sclk = clk_get(NULL, "sys_ck");
1191#endif
1192 return 0;
1193}
1194
1195#endif
diff --git a/arch/arm/mach-omap2/clock34xx.h b/arch/arm/mach-omap2/clock34xx.h
index 8fe1bcb23dd9..9a2c07eac9ad 100644
--- a/arch/arm/mach-omap2/clock34xx.h
+++ b/arch/arm/mach-omap2/clock34xx.h
@@ -1,2993 +1,24 @@
1/* 1/*
2 * OMAP3 clock framework 2 * OMAP3 clock function prototypes and macros
3 * 3 *
4 * Copyright (C) 2007-2008 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009 Texas Instruments, Inc.
5 * Copyright (C) 2007-2008 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander
9 * DPLL bypass clock support added by Roman Tereshonkov
10 *
11 */
12
13/*
14 * Virtual clocks are introduced as convenient tools.
15 * They are sources for other clocks and not supposed
16 * to be requested from drivers directly.
17 */
18
19#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
20#define __ARCH_ARM_MACH_OMAP2_CLOCK34XX_H
21
22#include <plat/control.h>
23
24#include "clock.h"
25#include "cm.h"
26#include "cm-regbits-34xx.h"
27#include "prm.h"
28#include "prm-regbits-34xx.h"
29
30#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
31
32static unsigned long omap3_dpll_recalc(struct clk *clk);
33static unsigned long omap3_clkoutx2_recalc(struct clk *clk);
34static void omap3_dpll_allow_idle(struct clk *clk);
35static void omap3_dpll_deny_idle(struct clk *clk);
36static u32 omap3_dpll_autoidle_read(struct clk *clk);
37static int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate);
38static int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate);
39static int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate);
40
41/* Maximum DPLL multiplier, divider values for OMAP3 */
42#define OMAP3_MAX_DPLL_MULT 2048
43#define OMAP3_MAX_DPLL_DIV 128
44
45/*
46 * DPLL1 supplies clock to the MPU.
47 * DPLL2 supplies clock to the IVA2.
48 * DPLL3 supplies CORE domain clocks.
49 * DPLL4 supplies peripheral clocks.
50 * DPLL5 supplies other peripheral clocks (USBHOST, USIM).
51 */
52
53/* Forward declarations for DPLL bypass clocks */
54static struct clk dpll1_fck;
55static struct clk dpll2_fck;
56
57/* CM_CLKEN_PLL*.EN* bit values - not all are available for every DPLL */
58#define DPLL_LOW_POWER_STOP 0x1
59#define DPLL_LOW_POWER_BYPASS 0x5
60#define DPLL_LOCKED 0x7
61
62/* PRM CLOCKS */
63
64/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */
65static struct clk omap_32k_fck = {
66 .name = "omap_32k_fck",
67 .ops = &clkops_null,
68 .rate = 32768,
69 .flags = RATE_FIXED,
70};
71
72static struct clk secure_32k_fck = {
73 .name = "secure_32k_fck",
74 .ops = &clkops_null,
75 .rate = 32768,
76 .flags = RATE_FIXED,
77};
78
79/* Virtual source clocks for osc_sys_ck */
80static struct clk virt_12m_ck = {
81 .name = "virt_12m_ck",
82 .ops = &clkops_null,
83 .rate = 12000000,
84 .flags = RATE_FIXED,
85};
86
87static struct clk virt_13m_ck = {
88 .name = "virt_13m_ck",
89 .ops = &clkops_null,
90 .rate = 13000000,
91 .flags = RATE_FIXED,
92};
93
94static struct clk virt_16_8m_ck = {
95 .name = "virt_16_8m_ck",
96 .ops = &clkops_null,
97 .rate = 16800000,
98 .flags = RATE_FIXED,
99};
100
101static struct clk virt_19_2m_ck = {
102 .name = "virt_19_2m_ck",
103 .ops = &clkops_null,
104 .rate = 19200000,
105 .flags = RATE_FIXED,
106};
107
108static struct clk virt_26m_ck = {
109 .name = "virt_26m_ck",
110 .ops = &clkops_null,
111 .rate = 26000000,
112 .flags = RATE_FIXED,
113};
114
115static struct clk virt_38_4m_ck = {
116 .name = "virt_38_4m_ck",
117 .ops = &clkops_null,
118 .rate = 38400000,
119 .flags = RATE_FIXED,
120};
121
122static const struct clksel_rate osc_sys_12m_rates[] = {
123 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
124 { .div = 0 }
125};
126
127static const struct clksel_rate osc_sys_13m_rates[] = {
128 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
129 { .div = 0 }
130};
131
132static const struct clksel_rate osc_sys_16_8m_rates[] = {
133 { .div = 1, .val = 5, .flags = RATE_IN_3430ES2 | DEFAULT_RATE },
134 { .div = 0 }
135};
136
137static const struct clksel_rate osc_sys_19_2m_rates[] = {
138 { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE },
139 { .div = 0 }
140};
141
142static const struct clksel_rate osc_sys_26m_rates[] = {
143 { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
144 { .div = 0 }
145};
146
147static const struct clksel_rate osc_sys_38_4m_rates[] = {
148 { .div = 1, .val = 4, .flags = RATE_IN_343X | DEFAULT_RATE },
149 { .div = 0 }
150};
151
152static const struct clksel osc_sys_clksel[] = {
153 { .parent = &virt_12m_ck, .rates = osc_sys_12m_rates },
154 { .parent = &virt_13m_ck, .rates = osc_sys_13m_rates },
155 { .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates },
156 { .parent = &virt_19_2m_ck, .rates = osc_sys_19_2m_rates },
157 { .parent = &virt_26m_ck, .rates = osc_sys_26m_rates },
158 { .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates },
159 { .parent = NULL },
160};
161
162/* Oscillator clock */
163/* 12, 13, 16.8, 19.2, 26, or 38.4 MHz */
164static struct clk osc_sys_ck = {
165 .name = "osc_sys_ck",
166 .ops = &clkops_null,
167 .init = &omap2_init_clksel_parent,
168 .clksel_reg = OMAP3430_PRM_CLKSEL,
169 .clksel_mask = OMAP3430_SYS_CLKIN_SEL_MASK,
170 .clksel = osc_sys_clksel,
171 /* REVISIT: deal with autoextclkmode? */
172 .flags = RATE_FIXED,
173 .recalc = &omap2_clksel_recalc,
174};
175
176static const struct clksel_rate div2_rates[] = {
177 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
178 { .div = 2, .val = 2, .flags = RATE_IN_343X },
179 { .div = 0 }
180};
181
182static const struct clksel sys_clksel[] = {
183 { .parent = &osc_sys_ck, .rates = div2_rates },
184 { .parent = NULL }
185};
186
187/* Latency: this clock is only enabled after PRM_CLKSETUP.SETUP_TIME */
188/* Feeds DPLLs - divided first by PRM_CLKSRC_CTRL.SYSCLKDIV? */
189static struct clk sys_ck = {
190 .name = "sys_ck",
191 .ops = &clkops_null,
192 .parent = &osc_sys_ck,
193 .init = &omap2_init_clksel_parent,
194 .clksel_reg = OMAP3430_PRM_CLKSRC_CTRL,
195 .clksel_mask = OMAP_SYSCLKDIV_MASK,
196 .clksel = sys_clksel,
197 .recalc = &omap2_clksel_recalc,
198};
199
200static struct clk sys_altclk = {
201 .name = "sys_altclk",
202 .ops = &clkops_null,
203};
204
205/* Optional external clock input for some McBSPs */
206static struct clk mcbsp_clks = {
207 .name = "mcbsp_clks",
208 .ops = &clkops_null,
209};
210
211/* PRM EXTERNAL CLOCK OUTPUT */
212
213static struct clk sys_clkout1 = {
214 .name = "sys_clkout1",
215 .ops = &clkops_omap2_dflt,
216 .parent = &osc_sys_ck,
217 .enable_reg = OMAP3430_PRM_CLKOUT_CTRL,
218 .enable_bit = OMAP3430_CLKOUT_EN_SHIFT,
219 .recalc = &followparent_recalc,
220};
221
222/* DPLLS */
223
224/* CM CLOCKS */
225
226static const struct clksel_rate div16_dpll_rates[] = {
227 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
228 { .div = 2, .val = 2, .flags = RATE_IN_343X },
229 { .div = 3, .val = 3, .flags = RATE_IN_343X },
230 { .div = 4, .val = 4, .flags = RATE_IN_343X },
231 { .div = 5, .val = 5, .flags = RATE_IN_343X },
232 { .div = 6, .val = 6, .flags = RATE_IN_343X },
233 { .div = 7, .val = 7, .flags = RATE_IN_343X },
234 { .div = 8, .val = 8, .flags = RATE_IN_343X },
235 { .div = 9, .val = 9, .flags = RATE_IN_343X },
236 { .div = 10, .val = 10, .flags = RATE_IN_343X },
237 { .div = 11, .val = 11, .flags = RATE_IN_343X },
238 { .div = 12, .val = 12, .flags = RATE_IN_343X },
239 { .div = 13, .val = 13, .flags = RATE_IN_343X },
240 { .div = 14, .val = 14, .flags = RATE_IN_343X },
241 { .div = 15, .val = 15, .flags = RATE_IN_343X },
242 { .div = 16, .val = 16, .flags = RATE_IN_343X },
243 { .div = 0 }
244};
245
246/* DPLL1 */
247/* MPU clock source */
248/* Type: DPLL */
249static struct dpll_data dpll1_dd = {
250 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
251 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
252 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
253 .clk_bypass = &dpll1_fck,
254 .clk_ref = &sys_ck,
255 .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK,
256 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
257 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
258 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
259 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
260 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
261 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
262 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
263 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
264 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
265 .idlest_mask = OMAP3430_ST_MPU_CLK_MASK,
266 .max_multiplier = OMAP3_MAX_DPLL_MULT,
267 .min_divider = 1,
268 .max_divider = OMAP3_MAX_DPLL_DIV,
269 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
270};
271
272static struct clk dpll1_ck = {
273 .name = "dpll1_ck",
274 .ops = &clkops_null,
275 .parent = &sys_ck,
276 .dpll_data = &dpll1_dd,
277 .round_rate = &omap2_dpll_round_rate,
278 .set_rate = &omap3_noncore_dpll_set_rate,
279 .clkdm_name = "dpll1_clkdm",
280 .recalc = &omap3_dpll_recalc,
281};
282
283/*
284 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
285 * DPLL isn't bypassed.
286 */
287static struct clk dpll1_x2_ck = {
288 .name = "dpll1_x2_ck",
289 .ops = &clkops_null,
290 .parent = &dpll1_ck,
291 .clkdm_name = "dpll1_clkdm",
292 .recalc = &omap3_clkoutx2_recalc,
293};
294
295/* On DPLL1, unlike other DPLLs, the divider is downstream from CLKOUTX2 */
296static const struct clksel div16_dpll1_x2m2_clksel[] = {
297 { .parent = &dpll1_x2_ck, .rates = div16_dpll_rates },
298 { .parent = NULL }
299};
300
301/*
302 * Does not exist in the TRM - needed to separate the M2 divider from
303 * bypass selection in mpu_ck
304 */
305static struct clk dpll1_x2m2_ck = {
306 .name = "dpll1_x2m2_ck",
307 .ops = &clkops_null,
308 .parent = &dpll1_x2_ck,
309 .init = &omap2_init_clksel_parent,
310 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
311 .clksel_mask = OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK,
312 .clksel = div16_dpll1_x2m2_clksel,
313 .clkdm_name = "dpll1_clkdm",
314 .recalc = &omap2_clksel_recalc,
315};
316
317/* DPLL2 */
318/* IVA2 clock source */
319/* Type: DPLL */
320
321static struct dpll_data dpll2_dd = {
322 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
323 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
324 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
325 .clk_bypass = &dpll2_fck,
326 .clk_ref = &sys_ck,
327 .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK,
328 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
329 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
330 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
331 (1 << DPLL_LOW_POWER_BYPASS),
332 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
333 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
334 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
335 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
336 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
337 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
338 .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK,
339 .max_multiplier = OMAP3_MAX_DPLL_MULT,
340 .min_divider = 1,
341 .max_divider = OMAP3_MAX_DPLL_DIV,
342 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
343};
344
345static struct clk dpll2_ck = {
346 .name = "dpll2_ck",
347 .ops = &clkops_noncore_dpll_ops,
348 .parent = &sys_ck,
349 .dpll_data = &dpll2_dd,
350 .round_rate = &omap2_dpll_round_rate,
351 .set_rate = &omap3_noncore_dpll_set_rate,
352 .clkdm_name = "dpll2_clkdm",
353 .recalc = &omap3_dpll_recalc,
354};
355
356static const struct clksel div16_dpll2_m2x2_clksel[] = {
357 { .parent = &dpll2_ck, .rates = div16_dpll_rates },
358 { .parent = NULL }
359};
360
361/*
362 * The TRM is conflicted on whether IVA2 clock comes from DPLL2 CLKOUT
363 * or CLKOUTX2. CLKOUT seems most plausible.
364 */
365static struct clk dpll2_m2_ck = {
366 .name = "dpll2_m2_ck",
367 .ops = &clkops_null,
368 .parent = &dpll2_ck,
369 .init = &omap2_init_clksel_parent,
370 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD,
371 OMAP3430_CM_CLKSEL2_PLL),
372 .clksel_mask = OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK,
373 .clksel = div16_dpll2_m2x2_clksel,
374 .clkdm_name = "dpll2_clkdm",
375 .recalc = &omap2_clksel_recalc,
376};
377
378/*
379 * DPLL3
380 * Source clock for all interfaces and for some device fclks
381 * REVISIT: Also supports fast relock bypass - not included below
382 */
383static struct dpll_data dpll3_dd = {
384 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
385 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
386 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
387 .clk_bypass = &sys_ck,
388 .clk_ref = &sys_ck,
389 .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK,
390 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
391 .enable_mask = OMAP3430_EN_CORE_DPLL_MASK,
392 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
393 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
394 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
395 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
396 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
397 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
398 .idlest_mask = OMAP3430_ST_CORE_CLK_MASK,
399 .max_multiplier = OMAP3_MAX_DPLL_MULT,
400 .min_divider = 1,
401 .max_divider = OMAP3_MAX_DPLL_DIV,
402 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
403};
404
405static struct clk dpll3_ck = {
406 .name = "dpll3_ck",
407 .ops = &clkops_null,
408 .parent = &sys_ck,
409 .dpll_data = &dpll3_dd,
410 .round_rate = &omap2_dpll_round_rate,
411 .clkdm_name = "dpll3_clkdm",
412 .recalc = &omap3_dpll_recalc,
413};
414
415/*
416 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
417 * DPLL isn't bypassed
418 */
419static struct clk dpll3_x2_ck = {
420 .name = "dpll3_x2_ck",
421 .ops = &clkops_null,
422 .parent = &dpll3_ck,
423 .clkdm_name = "dpll3_clkdm",
424 .recalc = &omap3_clkoutx2_recalc,
425};
426
427static const struct clksel_rate div31_dpll3_rates[] = {
428 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
429 { .div = 2, .val = 2, .flags = RATE_IN_343X },
430 { .div = 3, .val = 3, .flags = RATE_IN_3430ES2 },
431 { .div = 4, .val = 4, .flags = RATE_IN_3430ES2 },
432 { .div = 5, .val = 5, .flags = RATE_IN_3430ES2 },
433 { .div = 6, .val = 6, .flags = RATE_IN_3430ES2 },
434 { .div = 7, .val = 7, .flags = RATE_IN_3430ES2 },
435 { .div = 8, .val = 8, .flags = RATE_IN_3430ES2 },
436 { .div = 9, .val = 9, .flags = RATE_IN_3430ES2 },
437 { .div = 10, .val = 10, .flags = RATE_IN_3430ES2 },
438 { .div = 11, .val = 11, .flags = RATE_IN_3430ES2 },
439 { .div = 12, .val = 12, .flags = RATE_IN_3430ES2 },
440 { .div = 13, .val = 13, .flags = RATE_IN_3430ES2 },
441 { .div = 14, .val = 14, .flags = RATE_IN_3430ES2 },
442 { .div = 15, .val = 15, .flags = RATE_IN_3430ES2 },
443 { .div = 16, .val = 16, .flags = RATE_IN_3430ES2 },
444 { .div = 17, .val = 17, .flags = RATE_IN_3430ES2 },
445 { .div = 18, .val = 18, .flags = RATE_IN_3430ES2 },
446 { .div = 19, .val = 19, .flags = RATE_IN_3430ES2 },
447 { .div = 20, .val = 20, .flags = RATE_IN_3430ES2 },
448 { .div = 21, .val = 21, .flags = RATE_IN_3430ES2 },
449 { .div = 22, .val = 22, .flags = RATE_IN_3430ES2 },
450 { .div = 23, .val = 23, .flags = RATE_IN_3430ES2 },
451 { .div = 24, .val = 24, .flags = RATE_IN_3430ES2 },
452 { .div = 25, .val = 25, .flags = RATE_IN_3430ES2 },
453 { .div = 26, .val = 26, .flags = RATE_IN_3430ES2 },
454 { .div = 27, .val = 27, .flags = RATE_IN_3430ES2 },
455 { .div = 28, .val = 28, .flags = RATE_IN_3430ES2 },
456 { .div = 29, .val = 29, .flags = RATE_IN_3430ES2 },
457 { .div = 30, .val = 30, .flags = RATE_IN_3430ES2 },
458 { .div = 31, .val = 31, .flags = RATE_IN_3430ES2 },
459 { .div = 0 },
460};
461
462static const struct clksel div31_dpll3m2_clksel[] = {
463 { .parent = &dpll3_ck, .rates = div31_dpll3_rates },
464 { .parent = NULL }
465};
466
467/* DPLL3 output M2 - primary control point for CORE speed */
468static struct clk dpll3_m2_ck = {
469 .name = "dpll3_m2_ck",
470 .ops = &clkops_null,
471 .parent = &dpll3_ck,
472 .init = &omap2_init_clksel_parent,
473 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
474 .clksel_mask = OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK,
475 .clksel = div31_dpll3m2_clksel,
476 .clkdm_name = "dpll3_clkdm",
477 .round_rate = &omap2_clksel_round_rate,
478 .set_rate = &omap3_core_dpll_m2_set_rate,
479 .recalc = &omap2_clksel_recalc,
480};
481
482static struct clk core_ck = {
483 .name = "core_ck",
484 .ops = &clkops_null,
485 .parent = &dpll3_m2_ck,
486 .recalc = &followparent_recalc,
487};
488
489static struct clk dpll3_m2x2_ck = {
490 .name = "dpll3_m2x2_ck",
491 .ops = &clkops_null,
492 .parent = &dpll3_m2_ck,
493 .clkdm_name = "dpll3_clkdm",
494 .recalc = &omap3_clkoutx2_recalc,
495};
496
497/* The PWRDN bit is apparently only available on 3430ES2 and above */
498static const struct clksel div16_dpll3_clksel[] = {
499 { .parent = &dpll3_ck, .rates = div16_dpll_rates },
500 { .parent = NULL }
501};
502
503/* This virtual clock is the source for dpll3_m3x2_ck */
504static struct clk dpll3_m3_ck = {
505 .name = "dpll3_m3_ck",
506 .ops = &clkops_null,
507 .parent = &dpll3_ck,
508 .init = &omap2_init_clksel_parent,
509 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
510 .clksel_mask = OMAP3430_DIV_DPLL3_MASK,
511 .clksel = div16_dpll3_clksel,
512 .clkdm_name = "dpll3_clkdm",
513 .recalc = &omap2_clksel_recalc,
514};
515
516/* The PWRDN bit is apparently only available on 3430ES2 and above */
517static struct clk dpll3_m3x2_ck = {
518 .name = "dpll3_m3x2_ck",
519 .ops = &clkops_omap2_dflt_wait,
520 .parent = &dpll3_m3_ck,
521 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
522 .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT,
523 .flags = INVERT_ENABLE,
524 .clkdm_name = "dpll3_clkdm",
525 .recalc = &omap3_clkoutx2_recalc,
526};
527
528static struct clk emu_core_alwon_ck = {
529 .name = "emu_core_alwon_ck",
530 .ops = &clkops_null,
531 .parent = &dpll3_m3x2_ck,
532 .clkdm_name = "dpll3_clkdm",
533 .recalc = &followparent_recalc,
534};
535
536/* DPLL4 */
537/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
538/* Type: DPLL */
539static struct dpll_data dpll4_dd = {
540 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
541 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
542 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
543 .clk_bypass = &sys_ck,
544 .clk_ref = &sys_ck,
545 .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK,
546 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
547 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
548 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
549 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
550 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
551 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
552 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
553 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
554 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
555 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
556 .max_multiplier = OMAP3_MAX_DPLL_MULT,
557 .min_divider = 1,
558 .max_divider = OMAP3_MAX_DPLL_DIV,
559 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
560};
561
562static struct clk dpll4_ck = {
563 .name = "dpll4_ck",
564 .ops = &clkops_noncore_dpll_ops,
565 .parent = &sys_ck,
566 .dpll_data = &dpll4_dd,
567 .round_rate = &omap2_dpll_round_rate,
568 .set_rate = &omap3_dpll4_set_rate,
569 .clkdm_name = "dpll4_clkdm",
570 .recalc = &omap3_dpll_recalc,
571};
572
573/*
574 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
575 * DPLL isn't bypassed --
576 * XXX does this serve any downstream clocks?
577 */
578static struct clk dpll4_x2_ck = {
579 .name = "dpll4_x2_ck",
580 .ops = &clkops_null,
581 .parent = &dpll4_ck,
582 .clkdm_name = "dpll4_clkdm",
583 .recalc = &omap3_clkoutx2_recalc,
584};
585
586static const struct clksel div16_dpll4_clksel[] = {
587 { .parent = &dpll4_ck, .rates = div16_dpll_rates },
588 { .parent = NULL }
589};
590
591/* This virtual clock is the source for dpll4_m2x2_ck */
592static struct clk dpll4_m2_ck = {
593 .name = "dpll4_m2_ck",
594 .ops = &clkops_null,
595 .parent = &dpll4_ck,
596 .init = &omap2_init_clksel_parent,
597 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3),
598 .clksel_mask = OMAP3430_DIV_96M_MASK,
599 .clksel = div16_dpll4_clksel,
600 .clkdm_name = "dpll4_clkdm",
601 .recalc = &omap2_clksel_recalc,
602};
603
604/* The PWRDN bit is apparently only available on 3430ES2 and above */
605static struct clk dpll4_m2x2_ck = {
606 .name = "dpll4_m2x2_ck",
607 .ops = &clkops_omap2_dflt_wait,
608 .parent = &dpll4_m2_ck,
609 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
610 .enable_bit = OMAP3430_PWRDN_96M_SHIFT,
611 .flags = INVERT_ENABLE,
612 .clkdm_name = "dpll4_clkdm",
613 .recalc = &omap3_clkoutx2_recalc,
614};
615
616/*
617 * DPLL4 generates DPLL4_M2X2_CLK which is then routed into the PRM as
618 * PRM_96M_ALWON_(F)CLK. Two clocks then emerge from the PRM:
619 * 96M_ALWON_FCLK (called "omap_96m_alwon_fck" below) and
620 * CM_96K_(F)CLK.
621 */
622static struct clk omap_96m_alwon_fck = {
623 .name = "omap_96m_alwon_fck",
624 .ops = &clkops_null,
625 .parent = &dpll4_m2x2_ck,
626 .recalc = &followparent_recalc,
627};
628
629static struct clk cm_96m_fck = {
630 .name = "cm_96m_fck",
631 .ops = &clkops_null,
632 .parent = &omap_96m_alwon_fck,
633 .recalc = &followparent_recalc,
634};
635
636static const struct clksel_rate omap_96m_dpll_rates[] = {
637 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
638 { .div = 0 }
639};
640
641static const struct clksel_rate omap_96m_sys_rates[] = {
642 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
643 { .div = 0 }
644};
645
646static const struct clksel omap_96m_fck_clksel[] = {
647 { .parent = &cm_96m_fck, .rates = omap_96m_dpll_rates },
648 { .parent = &sys_ck, .rates = omap_96m_sys_rates },
649 { .parent = NULL }
650};
651
652static struct clk omap_96m_fck = {
653 .name = "omap_96m_fck",
654 .ops = &clkops_null,
655 .parent = &sys_ck,
656 .init = &omap2_init_clksel_parent,
657 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
658 .clksel_mask = OMAP3430_SOURCE_96M_MASK,
659 .clksel = omap_96m_fck_clksel,
660 .recalc = &omap2_clksel_recalc,
661};
662
663/* This virtual clock is the source for dpll4_m3x2_ck */
664static struct clk dpll4_m3_ck = {
665 .name = "dpll4_m3_ck",
666 .ops = &clkops_null,
667 .parent = &dpll4_ck,
668 .init = &omap2_init_clksel_parent,
669 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
670 .clksel_mask = OMAP3430_CLKSEL_TV_MASK,
671 .clksel = div16_dpll4_clksel,
672 .clkdm_name = "dpll4_clkdm",
673 .recalc = &omap2_clksel_recalc,
674};
675
676/* The PWRDN bit is apparently only available on 3430ES2 and above */
677static struct clk dpll4_m3x2_ck = {
678 .name = "dpll4_m3x2_ck",
679 .ops = &clkops_omap2_dflt_wait,
680 .parent = &dpll4_m3_ck,
681 .init = &omap2_init_clksel_parent,
682 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
683 .enable_bit = OMAP3430_PWRDN_TV_SHIFT,
684 .flags = INVERT_ENABLE,
685 .clkdm_name = "dpll4_clkdm",
686 .recalc = &omap3_clkoutx2_recalc,
687};
688
689static const struct clksel_rate omap_54m_d4m3x2_rates[] = {
690 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
691 { .div = 0 }
692};
693
694static const struct clksel_rate omap_54m_alt_rates[] = {
695 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
696 { .div = 0 }
697};
698
699static const struct clksel omap_54m_clksel[] = {
700 { .parent = &dpll4_m3x2_ck, .rates = omap_54m_d4m3x2_rates },
701 { .parent = &sys_altclk, .rates = omap_54m_alt_rates },
702 { .parent = NULL }
703};
704
705static struct clk omap_54m_fck = {
706 .name = "omap_54m_fck",
707 .ops = &clkops_null,
708 .init = &omap2_init_clksel_parent,
709 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
710 .clksel_mask = OMAP3430_SOURCE_54M_MASK,
711 .clksel = omap_54m_clksel,
712 .recalc = &omap2_clksel_recalc,
713};
714
715static const struct clksel_rate omap_48m_cm96m_rates[] = {
716 { .div = 2, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
717 { .div = 0 }
718};
719
720static const struct clksel_rate omap_48m_alt_rates[] = {
721 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
722 { .div = 0 }
723};
724
725static const struct clksel omap_48m_clksel[] = {
726 { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates },
727 { .parent = &sys_altclk, .rates = omap_48m_alt_rates },
728 { .parent = NULL }
729};
730
731static struct clk omap_48m_fck = {
732 .name = "omap_48m_fck",
733 .ops = &clkops_null,
734 .init = &omap2_init_clksel_parent,
735 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
736 .clksel_mask = OMAP3430_SOURCE_48M_MASK,
737 .clksel = omap_48m_clksel,
738 .recalc = &omap2_clksel_recalc,
739};
740
741static struct clk omap_12m_fck = {
742 .name = "omap_12m_fck",
743 .ops = &clkops_null,
744 .parent = &omap_48m_fck,
745 .fixed_div = 4,
746 .recalc = &omap2_fixed_divisor_recalc,
747};
748
749/* This virstual clock is the source for dpll4_m4x2_ck */
750static struct clk dpll4_m4_ck = {
751 .name = "dpll4_m4_ck",
752 .ops = &clkops_null,
753 .parent = &dpll4_ck,
754 .init = &omap2_init_clksel_parent,
755 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
756 .clksel_mask = OMAP3430_CLKSEL_DSS1_MASK,
757 .clksel = div16_dpll4_clksel,
758 .clkdm_name = "dpll4_clkdm",
759 .recalc = &omap2_clksel_recalc,
760 .set_rate = &omap2_clksel_set_rate,
761 .round_rate = &omap2_clksel_round_rate,
762};
763
764/* The PWRDN bit is apparently only available on 3430ES2 and above */
765static struct clk dpll4_m4x2_ck = {
766 .name = "dpll4_m4x2_ck",
767 .ops = &clkops_omap2_dflt_wait,
768 .parent = &dpll4_m4_ck,
769 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
770 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
771 .flags = INVERT_ENABLE,
772 .clkdm_name = "dpll4_clkdm",
773 .recalc = &omap3_clkoutx2_recalc,
774};
775
776/* This virtual clock is the source for dpll4_m5x2_ck */
777static struct clk dpll4_m5_ck = {
778 .name = "dpll4_m5_ck",
779 .ops = &clkops_null,
780 .parent = &dpll4_ck,
781 .init = &omap2_init_clksel_parent,
782 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
783 .clksel_mask = OMAP3430_CLKSEL_CAM_MASK,
784 .clksel = div16_dpll4_clksel,
785 .clkdm_name = "dpll4_clkdm",
786 .recalc = &omap2_clksel_recalc,
787};
788
789/* The PWRDN bit is apparently only available on 3430ES2 and above */
790static struct clk dpll4_m5x2_ck = {
791 .name = "dpll4_m5x2_ck",
792 .ops = &clkops_omap2_dflt_wait,
793 .parent = &dpll4_m5_ck,
794 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
795 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
796 .flags = INVERT_ENABLE,
797 .clkdm_name = "dpll4_clkdm",
798 .recalc = &omap3_clkoutx2_recalc,
799};
800
801/* This virtual clock is the source for dpll4_m6x2_ck */
802static struct clk dpll4_m6_ck = {
803 .name = "dpll4_m6_ck",
804 .ops = &clkops_null,
805 .parent = &dpll4_ck,
806 .init = &omap2_init_clksel_parent,
807 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
808 .clksel_mask = OMAP3430_DIV_DPLL4_MASK,
809 .clksel = div16_dpll4_clksel,
810 .clkdm_name = "dpll4_clkdm",
811 .recalc = &omap2_clksel_recalc,
812};
813
814/* The PWRDN bit is apparently only available on 3430ES2 and above */
815static struct clk dpll4_m6x2_ck = {
816 .name = "dpll4_m6x2_ck",
817 .ops = &clkops_omap2_dflt_wait,
818 .parent = &dpll4_m6_ck,
819 .init = &omap2_init_clksel_parent,
820 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
821 .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
822 .flags = INVERT_ENABLE,
823 .clkdm_name = "dpll4_clkdm",
824 .recalc = &omap3_clkoutx2_recalc,
825};
826
827static struct clk emu_per_alwon_ck = {
828 .name = "emu_per_alwon_ck",
829 .ops = &clkops_null,
830 .parent = &dpll4_m6x2_ck,
831 .clkdm_name = "dpll4_clkdm",
832 .recalc = &followparent_recalc,
833};
834
835/* DPLL5 */
836/* Supplies 120MHz clock, USIM source clock */
837/* Type: DPLL */
838/* 3430ES2 only */
839static struct dpll_data dpll5_dd = {
840 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
841 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
842 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
843 .clk_bypass = &sys_ck,
844 .clk_ref = &sys_ck,
845 .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK,
846 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
847 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
848 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
849 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
850 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
851 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
852 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
853 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
854 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
855 .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK,
856 .max_multiplier = OMAP3_MAX_DPLL_MULT,
857 .min_divider = 1,
858 .max_divider = OMAP3_MAX_DPLL_DIV,
859 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
860};
861
862static struct clk dpll5_ck = {
863 .name = "dpll5_ck",
864 .ops = &clkops_noncore_dpll_ops,
865 .parent = &sys_ck,
866 .dpll_data = &dpll5_dd,
867 .round_rate = &omap2_dpll_round_rate,
868 .set_rate = &omap3_noncore_dpll_set_rate,
869 .clkdm_name = "dpll5_clkdm",
870 .recalc = &omap3_dpll_recalc,
871};
872
873static const struct clksel div16_dpll5_clksel[] = {
874 { .parent = &dpll5_ck, .rates = div16_dpll_rates },
875 { .parent = NULL }
876};
877
878static struct clk dpll5_m2_ck = {
879 .name = "dpll5_m2_ck",
880 .ops = &clkops_null,
881 .parent = &dpll5_ck,
882 .init = &omap2_init_clksel_parent,
883 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
884 .clksel_mask = OMAP3430ES2_DIV_120M_MASK,
885 .clksel = div16_dpll5_clksel,
886 .clkdm_name = "dpll5_clkdm",
887 .recalc = &omap2_clksel_recalc,
888};
889
890/* CM EXTERNAL CLOCK OUTPUTS */
891
892static const struct clksel_rate clkout2_src_core_rates[] = {
893 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
894 { .div = 0 }
895};
896
897static const struct clksel_rate clkout2_src_sys_rates[] = {
898 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
899 { .div = 0 }
900};
901
902static const struct clksel_rate clkout2_src_96m_rates[] = {
903 { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE },
904 { .div = 0 }
905};
906
907static const struct clksel_rate clkout2_src_54m_rates[] = {
908 { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
909 { .div = 0 }
910};
911
912static const struct clksel clkout2_src_clksel[] = {
913 { .parent = &core_ck, .rates = clkout2_src_core_rates },
914 { .parent = &sys_ck, .rates = clkout2_src_sys_rates },
915 { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates },
916 { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates },
917 { .parent = NULL }
918};
919
920static struct clk clkout2_src_ck = {
921 .name = "clkout2_src_ck",
922 .ops = &clkops_omap2_dflt,
923 .init = &omap2_init_clksel_parent,
924 .enable_reg = OMAP3430_CM_CLKOUT_CTRL,
925 .enable_bit = OMAP3430_CLKOUT2_EN_SHIFT,
926 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
927 .clksel_mask = OMAP3430_CLKOUT2SOURCE_MASK,
928 .clksel = clkout2_src_clksel,
929 .clkdm_name = "core_clkdm",
930 .recalc = &omap2_clksel_recalc,
931};
932
933static const struct clksel_rate sys_clkout2_rates[] = {
934 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
935 { .div = 2, .val = 1, .flags = RATE_IN_343X },
936 { .div = 4, .val = 2, .flags = RATE_IN_343X },
937 { .div = 8, .val = 3, .flags = RATE_IN_343X },
938 { .div = 16, .val = 4, .flags = RATE_IN_343X },
939 { .div = 0 },
940};
941
942static const struct clksel sys_clkout2_clksel[] = {
943 { .parent = &clkout2_src_ck, .rates = sys_clkout2_rates },
944 { .parent = NULL },
945};
946
947static struct clk sys_clkout2 = {
948 .name = "sys_clkout2",
949 .ops = &clkops_null,
950 .init = &omap2_init_clksel_parent,
951 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
952 .clksel_mask = OMAP3430_CLKOUT2_DIV_MASK,
953 .clksel = sys_clkout2_clksel,
954 .recalc = &omap2_clksel_recalc,
955};
956
957/* CM OUTPUT CLOCKS */
958
959static struct clk corex2_fck = {
960 .name = "corex2_fck",
961 .ops = &clkops_null,
962 .parent = &dpll3_m2x2_ck,
963 .recalc = &followparent_recalc,
964};
965
966/* DPLL power domain clock controls */
967
968static const struct clksel_rate div4_rates[] = {
969 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
970 { .div = 2, .val = 2, .flags = RATE_IN_343X },
971 { .div = 4, .val = 4, .flags = RATE_IN_343X },
972 { .div = 0 }
973};
974
975static const struct clksel div4_core_clksel[] = {
976 { .parent = &core_ck, .rates = div4_rates },
977 { .parent = NULL }
978};
979
980/*
981 * REVISIT: Are these in DPLL power domain or CM power domain? docs
982 * may be inconsistent here?
983 */
984static struct clk dpll1_fck = {
985 .name = "dpll1_fck",
986 .ops = &clkops_null,
987 .parent = &core_ck,
988 .init = &omap2_init_clksel_parent,
989 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
990 .clksel_mask = OMAP3430_MPU_CLK_SRC_MASK,
991 .clksel = div4_core_clksel,
992 .recalc = &omap2_clksel_recalc,
993};
994
995static struct clk mpu_ck = {
996 .name = "mpu_ck",
997 .ops = &clkops_null,
998 .parent = &dpll1_x2m2_ck,
999 .clkdm_name = "mpu_clkdm",
1000 .recalc = &followparent_recalc,
1001};
1002
1003/* arm_fck is divided by two when DPLL1 locked; otherwise, passthrough mpu_ck */
1004static const struct clksel_rate arm_fck_rates[] = {
1005 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
1006 { .div = 2, .val = 1, .flags = RATE_IN_343X },
1007 { .div = 0 },
1008};
1009
1010static const struct clksel arm_fck_clksel[] = {
1011 { .parent = &mpu_ck, .rates = arm_fck_rates },
1012 { .parent = NULL }
1013};
1014
1015static struct clk arm_fck = {
1016 .name = "arm_fck",
1017 .ops = &clkops_null,
1018 .parent = &mpu_ck,
1019 .init = &omap2_init_clksel_parent,
1020 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
1021 .clksel_mask = OMAP3430_ST_MPU_CLK_MASK,
1022 .clksel = arm_fck_clksel,
1023 .clkdm_name = "mpu_clkdm",
1024 .recalc = &omap2_clksel_recalc,
1025};
1026
1027/* XXX What about neon_clkdm ? */
1028
1029/*
1030 * REVISIT: This clock is never specifically defined in the 3430 TRM,
1031 * although it is referenced - so this is a guess
1032 */
1033static struct clk emu_mpu_alwon_ck = {
1034 .name = "emu_mpu_alwon_ck",
1035 .ops = &clkops_null,
1036 .parent = &mpu_ck,
1037 .recalc = &followparent_recalc,
1038};
1039
1040static struct clk dpll2_fck = {
1041 .name = "dpll2_fck",
1042 .ops = &clkops_null,
1043 .parent = &core_ck,
1044 .init = &omap2_init_clksel_parent,
1045 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
1046 .clksel_mask = OMAP3430_IVA2_CLK_SRC_MASK,
1047 .clksel = div4_core_clksel,
1048 .recalc = &omap2_clksel_recalc,
1049};
1050
1051static struct clk iva2_ck = {
1052 .name = "iva2_ck",
1053 .ops = &clkops_omap2_dflt_wait,
1054 .parent = &dpll2_m2_ck,
1055 .init = &omap2_init_clksel_parent,
1056 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1057 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1058 .clkdm_name = "iva2_clkdm",
1059 .recalc = &followparent_recalc,
1060};
1061
1062/* Common interface clocks */
1063
1064static const struct clksel div2_core_clksel[] = {
1065 { .parent = &core_ck, .rates = div2_rates },
1066 { .parent = NULL }
1067};
1068
1069static struct clk l3_ick = {
1070 .name = "l3_ick",
1071 .ops = &clkops_null,
1072 .parent = &core_ck,
1073 .init = &omap2_init_clksel_parent,
1074 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1075 .clksel_mask = OMAP3430_CLKSEL_L3_MASK,
1076 .clksel = div2_core_clksel,
1077 .clkdm_name = "core_l3_clkdm",
1078 .recalc = &omap2_clksel_recalc,
1079};
1080
1081static const struct clksel div2_l3_clksel[] = {
1082 { .parent = &l3_ick, .rates = div2_rates },
1083 { .parent = NULL }
1084};
1085
1086static struct clk l4_ick = {
1087 .name = "l4_ick",
1088 .ops = &clkops_null,
1089 .parent = &l3_ick,
1090 .init = &omap2_init_clksel_parent,
1091 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1092 .clksel_mask = OMAP3430_CLKSEL_L4_MASK,
1093 .clksel = div2_l3_clksel,
1094 .clkdm_name = "core_l4_clkdm",
1095 .recalc = &omap2_clksel_recalc,
1096
1097};
1098
1099static const struct clksel div2_l4_clksel[] = {
1100 { .parent = &l4_ick, .rates = div2_rates },
1101 { .parent = NULL }
1102};
1103
1104static struct clk rm_ick = {
1105 .name = "rm_ick",
1106 .ops = &clkops_null,
1107 .parent = &l4_ick,
1108 .init = &omap2_init_clksel_parent,
1109 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
1110 .clksel_mask = OMAP3430_CLKSEL_RM_MASK,
1111 .clksel = div2_l4_clksel,
1112 .recalc = &omap2_clksel_recalc,
1113};
1114
1115/* GFX power domain */
1116
1117/* GFX clocks are in 3430ES1 only. 3430ES2 and later uses the SGX instead */
1118
1119static const struct clksel gfx_l3_clksel[] = {
1120 { .parent = &l3_ick, .rates = gfx_l3_rates },
1121 { .parent = NULL }
1122};
1123
1124/* Virtual parent clock for gfx_l3_ick and gfx_l3_fck */
1125static struct clk gfx_l3_ck = {
1126 .name = "gfx_l3_ck",
1127 .ops = &clkops_omap2_dflt_wait,
1128 .parent = &l3_ick,
1129 .init = &omap2_init_clksel_parent,
1130 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
1131 .enable_bit = OMAP_EN_GFX_SHIFT,
1132 .recalc = &followparent_recalc,
1133};
1134
1135static struct clk gfx_l3_fck = {
1136 .name = "gfx_l3_fck",
1137 .ops = &clkops_null,
1138 .parent = &gfx_l3_ck,
1139 .init = &omap2_init_clksel_parent,
1140 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
1141 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
1142 .clksel = gfx_l3_clksel,
1143 .clkdm_name = "gfx_3430es1_clkdm",
1144 .recalc = &omap2_clksel_recalc,
1145};
1146
1147static struct clk gfx_l3_ick = {
1148 .name = "gfx_l3_ick",
1149 .ops = &clkops_null,
1150 .parent = &gfx_l3_ck,
1151 .clkdm_name = "gfx_3430es1_clkdm",
1152 .recalc = &followparent_recalc,
1153};
1154
1155static struct clk gfx_cg1_ck = {
1156 .name = "gfx_cg1_ck",
1157 .ops = &clkops_omap2_dflt_wait,
1158 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1159 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1160 .enable_bit = OMAP3430ES1_EN_2D_SHIFT,
1161 .clkdm_name = "gfx_3430es1_clkdm",
1162 .recalc = &followparent_recalc,
1163};
1164
1165static struct clk gfx_cg2_ck = {
1166 .name = "gfx_cg2_ck",
1167 .ops = &clkops_omap2_dflt_wait,
1168 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1169 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1170 .enable_bit = OMAP3430ES1_EN_3D_SHIFT,
1171 .clkdm_name = "gfx_3430es1_clkdm",
1172 .recalc = &followparent_recalc,
1173};
1174
1175/* SGX power domain - 3430ES2 only */
1176
1177static const struct clksel_rate sgx_core_rates[] = {
1178 { .div = 3, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
1179 { .div = 4, .val = 1, .flags = RATE_IN_343X },
1180 { .div = 6, .val = 2, .flags = RATE_IN_343X },
1181 { .div = 0 },
1182};
1183
1184static const struct clksel_rate sgx_96m_rates[] = {
1185 { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
1186 { .div = 0 },
1187};
1188
1189static const struct clksel sgx_clksel[] = {
1190 { .parent = &core_ck, .rates = sgx_core_rates },
1191 { .parent = &cm_96m_fck, .rates = sgx_96m_rates },
1192 { .parent = NULL },
1193};
1194
1195static struct clk sgx_fck = {
1196 .name = "sgx_fck",
1197 .ops = &clkops_omap2_dflt_wait,
1198 .init = &omap2_init_clksel_parent,
1199 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN),
1200 .enable_bit = OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT,
1201 .clksel_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL),
1202 .clksel_mask = OMAP3430ES2_CLKSEL_SGX_MASK,
1203 .clksel = sgx_clksel,
1204 .clkdm_name = "sgx_clkdm",
1205 .recalc = &omap2_clksel_recalc,
1206};
1207
1208static struct clk sgx_ick = {
1209 .name = "sgx_ick",
1210 .ops = &clkops_omap2_dflt_wait,
1211 .parent = &l3_ick,
1212 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN),
1213 .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT,
1214 .clkdm_name = "sgx_clkdm",
1215 .recalc = &followparent_recalc,
1216};
1217
1218/* CORE power domain */
1219
1220static struct clk d2d_26m_fck = {
1221 .name = "d2d_26m_fck",
1222 .ops = &clkops_omap2_dflt_wait,
1223 .parent = &sys_ck,
1224 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1225 .enable_bit = OMAP3430ES1_EN_D2D_SHIFT,
1226 .clkdm_name = "d2d_clkdm",
1227 .recalc = &followparent_recalc,
1228};
1229
1230static struct clk modem_fck = {
1231 .name = "modem_fck",
1232 .ops = &clkops_omap2_dflt_wait,
1233 .parent = &sys_ck,
1234 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1235 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
1236 .clkdm_name = "d2d_clkdm",
1237 .recalc = &followparent_recalc,
1238};
1239
1240static struct clk sad2d_ick = {
1241 .name = "sad2d_ick",
1242 .ops = &clkops_omap2_dflt_wait,
1243 .parent = &l3_ick,
1244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1245 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
1246 .clkdm_name = "d2d_clkdm",
1247 .recalc = &followparent_recalc,
1248};
1249
1250static struct clk mad2d_ick = {
1251 .name = "mad2d_ick",
1252 .ops = &clkops_omap2_dflt_wait,
1253 .parent = &l3_ick,
1254 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1255 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
1256 .clkdm_name = "d2d_clkdm",
1257 .recalc = &followparent_recalc,
1258};
1259
1260static const struct clksel omap343x_gpt_clksel[] = {
1261 { .parent = &omap_32k_fck, .rates = gpt_32k_rates },
1262 { .parent = &sys_ck, .rates = gpt_sys_rates },
1263 { .parent = NULL}
1264};
1265
1266static struct clk gpt10_fck = {
1267 .name = "gpt10_fck",
1268 .ops = &clkops_omap2_dflt_wait,
1269 .parent = &sys_ck,
1270 .init = &omap2_init_clksel_parent,
1271 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1272 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1273 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1274 .clksel_mask = OMAP3430_CLKSEL_GPT10_MASK,
1275 .clksel = omap343x_gpt_clksel,
1276 .clkdm_name = "core_l4_clkdm",
1277 .recalc = &omap2_clksel_recalc,
1278};
1279
1280static struct clk gpt11_fck = {
1281 .name = "gpt11_fck",
1282 .ops = &clkops_omap2_dflt_wait,
1283 .parent = &sys_ck,
1284 .init = &omap2_init_clksel_parent,
1285 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1286 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1287 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1288 .clksel_mask = OMAP3430_CLKSEL_GPT11_MASK,
1289 .clksel = omap343x_gpt_clksel,
1290 .clkdm_name = "core_l4_clkdm",
1291 .recalc = &omap2_clksel_recalc,
1292};
1293
1294static struct clk cpefuse_fck = {
1295 .name = "cpefuse_fck",
1296 .ops = &clkops_omap2_dflt,
1297 .parent = &sys_ck,
1298 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1299 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
1300 .recalc = &followparent_recalc,
1301};
1302
1303static struct clk ts_fck = {
1304 .name = "ts_fck",
1305 .ops = &clkops_omap2_dflt,
1306 .parent = &omap_32k_fck,
1307 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1308 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
1309 .recalc = &followparent_recalc,
1310};
1311
1312static struct clk usbtll_fck = {
1313 .name = "usbtll_fck",
1314 .ops = &clkops_omap2_dflt,
1315 .parent = &dpll5_m2_ck,
1316 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1317 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1318 .recalc = &followparent_recalc,
1319};
1320
1321/* CORE 96M FCLK-derived clocks */
1322
1323static struct clk core_96m_fck = {
1324 .name = "core_96m_fck",
1325 .ops = &clkops_null,
1326 .parent = &omap_96m_fck,
1327 .clkdm_name = "core_l4_clkdm",
1328 .recalc = &followparent_recalc,
1329};
1330
1331static struct clk mmchs3_fck = {
1332 .name = "mmchs_fck",
1333 .ops = &clkops_omap2_dflt_wait,
1334 .id = 2,
1335 .parent = &core_96m_fck,
1336 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1337 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1338 .clkdm_name = "core_l4_clkdm",
1339 .recalc = &followparent_recalc,
1340};
1341
1342static struct clk mmchs2_fck = {
1343 .name = "mmchs_fck",
1344 .ops = &clkops_omap2_dflt_wait,
1345 .id = 1,
1346 .parent = &core_96m_fck,
1347 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1348 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1349 .clkdm_name = "core_l4_clkdm",
1350 .recalc = &followparent_recalc,
1351};
1352
1353static struct clk mspro_fck = {
1354 .name = "mspro_fck",
1355 .ops = &clkops_omap2_dflt_wait,
1356 .parent = &core_96m_fck,
1357 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1358 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1359 .clkdm_name = "core_l4_clkdm",
1360 .recalc = &followparent_recalc,
1361};
1362
1363static struct clk mmchs1_fck = {
1364 .name = "mmchs_fck",
1365 .ops = &clkops_omap2_dflt_wait,
1366 .parent = &core_96m_fck,
1367 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1368 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1369 .clkdm_name = "core_l4_clkdm",
1370 .recalc = &followparent_recalc,
1371};
1372
1373static struct clk i2c3_fck = {
1374 .name = "i2c_fck",
1375 .ops = &clkops_omap2_dflt_wait,
1376 .id = 3,
1377 .parent = &core_96m_fck,
1378 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1379 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1380 .clkdm_name = "core_l4_clkdm",
1381 .recalc = &followparent_recalc,
1382};
1383
1384static struct clk i2c2_fck = {
1385 .name = "i2c_fck",
1386 .ops = &clkops_omap2_dflt_wait,
1387 .id = 2,
1388 .parent = &core_96m_fck,
1389 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1390 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1391 .clkdm_name = "core_l4_clkdm",
1392 .recalc = &followparent_recalc,
1393};
1394
1395static struct clk i2c1_fck = {
1396 .name = "i2c_fck",
1397 .ops = &clkops_omap2_dflt_wait,
1398 .id = 1,
1399 .parent = &core_96m_fck,
1400 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1401 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1402 .clkdm_name = "core_l4_clkdm",
1403 .recalc = &followparent_recalc,
1404};
1405
1406/*
1407 * MCBSP 1 & 5 get their 96MHz clock from core_96m_fck;
1408 * MCBSP 2, 3, 4 get their 96MHz clock from per_96m_fck.
1409 */
1410static const struct clksel_rate common_mcbsp_96m_rates[] = {
1411 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
1412 { .div = 0 }
1413};
1414
1415static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1416 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
1417 { .div = 0 }
1418};
1419
1420static const struct clksel mcbsp_15_clksel[] = {
1421 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
1422 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1423 { .parent = NULL }
1424};
1425
1426static struct clk mcbsp5_fck = {
1427 .name = "mcbsp_fck",
1428 .ops = &clkops_omap2_dflt_wait,
1429 .id = 5,
1430 .init = &omap2_init_clksel_parent,
1431 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1432 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1433 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
1434 .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
1435 .clksel = mcbsp_15_clksel,
1436 .clkdm_name = "core_l4_clkdm",
1437 .recalc = &omap2_clksel_recalc,
1438};
1439
1440static struct clk mcbsp1_fck = {
1441 .name = "mcbsp_fck",
1442 .ops = &clkops_omap2_dflt_wait,
1443 .id = 1,
1444 .init = &omap2_init_clksel_parent,
1445 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1446 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
1447 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1448 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1449 .clksel = mcbsp_15_clksel,
1450 .clkdm_name = "core_l4_clkdm",
1451 .recalc = &omap2_clksel_recalc,
1452};
1453
1454/* CORE_48M_FCK-derived clocks */
1455
1456static struct clk core_48m_fck = {
1457 .name = "core_48m_fck",
1458 .ops = &clkops_null,
1459 .parent = &omap_48m_fck,
1460 .clkdm_name = "core_l4_clkdm",
1461 .recalc = &followparent_recalc,
1462};
1463
1464static struct clk mcspi4_fck = {
1465 .name = "mcspi_fck",
1466 .ops = &clkops_omap2_dflt_wait,
1467 .id = 4,
1468 .parent = &core_48m_fck,
1469 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1470 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1471 .recalc = &followparent_recalc,
1472};
1473
1474static struct clk mcspi3_fck = {
1475 .name = "mcspi_fck",
1476 .ops = &clkops_omap2_dflt_wait,
1477 .id = 3,
1478 .parent = &core_48m_fck,
1479 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1480 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1481 .recalc = &followparent_recalc,
1482};
1483
1484static struct clk mcspi2_fck = {
1485 .name = "mcspi_fck",
1486 .ops = &clkops_omap2_dflt_wait,
1487 .id = 2,
1488 .parent = &core_48m_fck,
1489 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1490 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1491 .recalc = &followparent_recalc,
1492};
1493
1494static struct clk mcspi1_fck = {
1495 .name = "mcspi_fck",
1496 .ops = &clkops_omap2_dflt_wait,
1497 .id = 1,
1498 .parent = &core_48m_fck,
1499 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1500 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1501 .recalc = &followparent_recalc,
1502};
1503
1504static struct clk uart2_fck = {
1505 .name = "uart2_fck",
1506 .ops = &clkops_omap2_dflt_wait,
1507 .parent = &core_48m_fck,
1508 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1509 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1510 .recalc = &followparent_recalc,
1511};
1512
1513static struct clk uart1_fck = {
1514 .name = "uart1_fck",
1515 .ops = &clkops_omap2_dflt_wait,
1516 .parent = &core_48m_fck,
1517 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1518 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1519 .recalc = &followparent_recalc,
1520};
1521
1522static struct clk fshostusb_fck = {
1523 .name = "fshostusb_fck",
1524 .ops = &clkops_omap2_dflt_wait,
1525 .parent = &core_48m_fck,
1526 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1527 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1528 .recalc = &followparent_recalc,
1529};
1530
1531/* CORE_12M_FCK based clocks */
1532
1533static struct clk core_12m_fck = {
1534 .name = "core_12m_fck",
1535 .ops = &clkops_null,
1536 .parent = &omap_12m_fck,
1537 .clkdm_name = "core_l4_clkdm",
1538 .recalc = &followparent_recalc,
1539};
1540
1541static struct clk hdq_fck = {
1542 .name = "hdq_fck",
1543 .ops = &clkops_omap2_dflt_wait,
1544 .parent = &core_12m_fck,
1545 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1546 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1547 .recalc = &followparent_recalc,
1548};
1549
1550/* DPLL3-derived clock */
1551
1552static const struct clksel_rate ssi_ssr_corex2_rates[] = {
1553 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
1554 { .div = 2, .val = 2, .flags = RATE_IN_343X },
1555 { .div = 3, .val = 3, .flags = RATE_IN_343X },
1556 { .div = 4, .val = 4, .flags = RATE_IN_343X },
1557 { .div = 6, .val = 6, .flags = RATE_IN_343X },
1558 { .div = 8, .val = 8, .flags = RATE_IN_343X },
1559 { .div = 0 }
1560};
1561
1562static const struct clksel ssi_ssr_clksel[] = {
1563 { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates },
1564 { .parent = NULL }
1565};
1566
1567static struct clk ssi_ssr_fck_3430es1 = {
1568 .name = "ssi_ssr_fck",
1569 .ops = &clkops_omap2_dflt,
1570 .init = &omap2_init_clksel_parent,
1571 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1572 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1573 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1574 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1575 .clksel = ssi_ssr_clksel,
1576 .clkdm_name = "core_l4_clkdm",
1577 .recalc = &omap2_clksel_recalc,
1578};
1579
1580static struct clk ssi_ssr_fck_3430es2 = {
1581 .name = "ssi_ssr_fck",
1582 .ops = &clkops_omap3430es2_ssi_wait,
1583 .init = &omap2_init_clksel_parent,
1584 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1585 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1586 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1587 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1588 .clksel = ssi_ssr_clksel,
1589 .clkdm_name = "core_l4_clkdm",
1590 .recalc = &omap2_clksel_recalc,
1591};
1592
1593static struct clk ssi_sst_fck_3430es1 = {
1594 .name = "ssi_sst_fck",
1595 .ops = &clkops_null,
1596 .parent = &ssi_ssr_fck_3430es1,
1597 .fixed_div = 2,
1598 .recalc = &omap2_fixed_divisor_recalc,
1599};
1600
1601static struct clk ssi_sst_fck_3430es2 = {
1602 .name = "ssi_sst_fck",
1603 .ops = &clkops_null,
1604 .parent = &ssi_ssr_fck_3430es2,
1605 .fixed_div = 2,
1606 .recalc = &omap2_fixed_divisor_recalc,
1607};
1608
1609
1610
1611/* CORE_L3_ICK based clocks */
1612
1613/*
1614 * XXX must add clk_enable/clk_disable for these if standard code won't
1615 * handle it
1616 */
1617static struct clk core_l3_ick = {
1618 .name = "core_l3_ick",
1619 .ops = &clkops_null,
1620 .parent = &l3_ick,
1621 .clkdm_name = "core_l3_clkdm",
1622 .recalc = &followparent_recalc,
1623};
1624
1625static struct clk hsotgusb_ick_3430es1 = {
1626 .name = "hsotgusb_ick",
1627 .ops = &clkops_omap2_dflt,
1628 .parent = &core_l3_ick,
1629 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1630 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1631 .clkdm_name = "core_l3_clkdm",
1632 .recalc = &followparent_recalc,
1633};
1634
1635static struct clk hsotgusb_ick_3430es2 = {
1636 .name = "hsotgusb_ick",
1637 .ops = &clkops_omap3430es2_hsotgusb_wait,
1638 .parent = &core_l3_ick,
1639 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1640 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1641 .clkdm_name = "core_l3_clkdm",
1642 .recalc = &followparent_recalc,
1643};
1644
1645static struct clk sdrc_ick = {
1646 .name = "sdrc_ick",
1647 .ops = &clkops_omap2_dflt_wait,
1648 .parent = &core_l3_ick,
1649 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1650 .enable_bit = OMAP3430_EN_SDRC_SHIFT,
1651 .flags = ENABLE_ON_INIT,
1652 .clkdm_name = "core_l3_clkdm",
1653 .recalc = &followparent_recalc,
1654};
1655
1656static struct clk gpmc_fck = {
1657 .name = "gpmc_fck",
1658 .ops = &clkops_null,
1659 .parent = &core_l3_ick,
1660 .flags = ENABLE_ON_INIT, /* huh? */
1661 .clkdm_name = "core_l3_clkdm",
1662 .recalc = &followparent_recalc,
1663};
1664
1665/* SECURITY_L3_ICK based clocks */
1666
1667static struct clk security_l3_ick = {
1668 .name = "security_l3_ick",
1669 .ops = &clkops_null,
1670 .parent = &l3_ick,
1671 .recalc = &followparent_recalc,
1672};
1673
1674static struct clk pka_ick = {
1675 .name = "pka_ick",
1676 .ops = &clkops_omap2_dflt_wait,
1677 .parent = &security_l3_ick,
1678 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1679 .enable_bit = OMAP3430_EN_PKA_SHIFT,
1680 .recalc = &followparent_recalc,
1681};
1682
1683/* CORE_L4_ICK based clocks */
1684
1685static struct clk core_l4_ick = {
1686 .name = "core_l4_ick",
1687 .ops = &clkops_null,
1688 .parent = &l4_ick,
1689 .clkdm_name = "core_l4_clkdm",
1690 .recalc = &followparent_recalc,
1691};
1692
1693static struct clk usbtll_ick = {
1694 .name = "usbtll_ick",
1695 .ops = &clkops_omap2_dflt_wait,
1696 .parent = &core_l4_ick,
1697 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1698 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1699 .clkdm_name = "core_l4_clkdm",
1700 .recalc = &followparent_recalc,
1701};
1702
1703static struct clk mmchs3_ick = {
1704 .name = "mmchs_ick",
1705 .ops = &clkops_omap2_dflt_wait,
1706 .id = 2,
1707 .parent = &core_l4_ick,
1708 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1709 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1710 .clkdm_name = "core_l4_clkdm",
1711 .recalc = &followparent_recalc,
1712};
1713
1714/* Intersystem Communication Registers - chassis mode only */
1715static struct clk icr_ick = {
1716 .name = "icr_ick",
1717 .ops = &clkops_omap2_dflt_wait,
1718 .parent = &core_l4_ick,
1719 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1720 .enable_bit = OMAP3430_EN_ICR_SHIFT,
1721 .clkdm_name = "core_l4_clkdm",
1722 .recalc = &followparent_recalc,
1723};
1724
1725static struct clk aes2_ick = {
1726 .name = "aes2_ick",
1727 .ops = &clkops_omap2_dflt_wait,
1728 .parent = &core_l4_ick,
1729 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1730 .enable_bit = OMAP3430_EN_AES2_SHIFT,
1731 .clkdm_name = "core_l4_clkdm",
1732 .recalc = &followparent_recalc,
1733};
1734
1735static struct clk sha12_ick = {
1736 .name = "sha12_ick",
1737 .ops = &clkops_omap2_dflt_wait,
1738 .parent = &core_l4_ick,
1739 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1740 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
1741 .clkdm_name = "core_l4_clkdm",
1742 .recalc = &followparent_recalc,
1743};
1744
1745static struct clk des2_ick = {
1746 .name = "des2_ick",
1747 .ops = &clkops_omap2_dflt_wait,
1748 .parent = &core_l4_ick,
1749 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1750 .enable_bit = OMAP3430_EN_DES2_SHIFT,
1751 .clkdm_name = "core_l4_clkdm",
1752 .recalc = &followparent_recalc,
1753};
1754
1755static struct clk mmchs2_ick = {
1756 .name = "mmchs_ick",
1757 .ops = &clkops_omap2_dflt_wait,
1758 .id = 1,
1759 .parent = &core_l4_ick,
1760 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1761 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1762 .clkdm_name = "core_l4_clkdm",
1763 .recalc = &followparent_recalc,
1764};
1765
1766static struct clk mmchs1_ick = {
1767 .name = "mmchs_ick",
1768 .ops = &clkops_omap2_dflt_wait,
1769 .parent = &core_l4_ick,
1770 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1771 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1772 .clkdm_name = "core_l4_clkdm",
1773 .recalc = &followparent_recalc,
1774};
1775
1776static struct clk mspro_ick = {
1777 .name = "mspro_ick",
1778 .ops = &clkops_omap2_dflt_wait,
1779 .parent = &core_l4_ick,
1780 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1781 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1782 .clkdm_name = "core_l4_clkdm",
1783 .recalc = &followparent_recalc,
1784};
1785
1786static struct clk hdq_ick = {
1787 .name = "hdq_ick",
1788 .ops = &clkops_omap2_dflt_wait,
1789 .parent = &core_l4_ick,
1790 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1791 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1792 .clkdm_name = "core_l4_clkdm",
1793 .recalc = &followparent_recalc,
1794};
1795
1796static struct clk mcspi4_ick = {
1797 .name = "mcspi_ick",
1798 .ops = &clkops_omap2_dflt_wait,
1799 .id = 4,
1800 .parent = &core_l4_ick,
1801 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1802 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1803 .clkdm_name = "core_l4_clkdm",
1804 .recalc = &followparent_recalc,
1805};
1806
1807static struct clk mcspi3_ick = {
1808 .name = "mcspi_ick",
1809 .ops = &clkops_omap2_dflt_wait,
1810 .id = 3,
1811 .parent = &core_l4_ick,
1812 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1813 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1814 .clkdm_name = "core_l4_clkdm",
1815 .recalc = &followparent_recalc,
1816};
1817
1818static struct clk mcspi2_ick = {
1819 .name = "mcspi_ick",
1820 .ops = &clkops_omap2_dflt_wait,
1821 .id = 2,
1822 .parent = &core_l4_ick,
1823 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1824 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1825 .clkdm_name = "core_l4_clkdm",
1826 .recalc = &followparent_recalc,
1827};
1828
1829static struct clk mcspi1_ick = {
1830 .name = "mcspi_ick",
1831 .ops = &clkops_omap2_dflt_wait,
1832 .id = 1,
1833 .parent = &core_l4_ick,
1834 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1835 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1836 .clkdm_name = "core_l4_clkdm",
1837 .recalc = &followparent_recalc,
1838};
1839
1840static struct clk i2c3_ick = {
1841 .name = "i2c_ick",
1842 .ops = &clkops_omap2_dflt_wait,
1843 .id = 3,
1844 .parent = &core_l4_ick,
1845 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1846 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1847 .clkdm_name = "core_l4_clkdm",
1848 .recalc = &followparent_recalc,
1849};
1850
1851static struct clk i2c2_ick = {
1852 .name = "i2c_ick",
1853 .ops = &clkops_omap2_dflt_wait,
1854 .id = 2,
1855 .parent = &core_l4_ick,
1856 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1857 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1858 .clkdm_name = "core_l4_clkdm",
1859 .recalc = &followparent_recalc,
1860};
1861
1862static struct clk i2c1_ick = {
1863 .name = "i2c_ick",
1864 .ops = &clkops_omap2_dflt_wait,
1865 .id = 1,
1866 .parent = &core_l4_ick,
1867 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1868 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1869 .clkdm_name = "core_l4_clkdm",
1870 .recalc = &followparent_recalc,
1871};
1872
1873static struct clk uart2_ick = {
1874 .name = "uart2_ick",
1875 .ops = &clkops_omap2_dflt_wait,
1876 .parent = &core_l4_ick,
1877 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1878 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1879 .clkdm_name = "core_l4_clkdm",
1880 .recalc = &followparent_recalc,
1881};
1882
1883static struct clk uart1_ick = {
1884 .name = "uart1_ick",
1885 .ops = &clkops_omap2_dflt_wait,
1886 .parent = &core_l4_ick,
1887 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1888 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1889 .clkdm_name = "core_l4_clkdm",
1890 .recalc = &followparent_recalc,
1891};
1892
1893static struct clk gpt11_ick = {
1894 .name = "gpt11_ick",
1895 .ops = &clkops_omap2_dflt_wait,
1896 .parent = &core_l4_ick,
1897 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1898 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1899 .clkdm_name = "core_l4_clkdm",
1900 .recalc = &followparent_recalc,
1901};
1902
1903static struct clk gpt10_ick = {
1904 .name = "gpt10_ick",
1905 .ops = &clkops_omap2_dflt_wait,
1906 .parent = &core_l4_ick,
1907 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1908 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1909 .clkdm_name = "core_l4_clkdm",
1910 .recalc = &followparent_recalc,
1911};
1912
1913static struct clk mcbsp5_ick = {
1914 .name = "mcbsp_ick",
1915 .ops = &clkops_omap2_dflt_wait,
1916 .id = 5,
1917 .parent = &core_l4_ick,
1918 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1919 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1920 .clkdm_name = "core_l4_clkdm",
1921 .recalc = &followparent_recalc,
1922};
1923
1924static struct clk mcbsp1_ick = {
1925 .name = "mcbsp_ick",
1926 .ops = &clkops_omap2_dflt_wait,
1927 .id = 1,
1928 .parent = &core_l4_ick,
1929 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1930 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
1931 .clkdm_name = "core_l4_clkdm",
1932 .recalc = &followparent_recalc,
1933};
1934
1935static struct clk fac_ick = {
1936 .name = "fac_ick",
1937 .ops = &clkops_omap2_dflt_wait,
1938 .parent = &core_l4_ick,
1939 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1940 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
1941 .clkdm_name = "core_l4_clkdm",
1942 .recalc = &followparent_recalc,
1943};
1944
1945static struct clk mailboxes_ick = {
1946 .name = "mailboxes_ick",
1947 .ops = &clkops_omap2_dflt_wait,
1948 .parent = &core_l4_ick,
1949 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1950 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
1951 .clkdm_name = "core_l4_clkdm",
1952 .recalc = &followparent_recalc,
1953};
1954
1955static struct clk omapctrl_ick = {
1956 .name = "omapctrl_ick",
1957 .ops = &clkops_omap2_dflt_wait,
1958 .parent = &core_l4_ick,
1959 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1960 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
1961 .flags = ENABLE_ON_INIT,
1962 .recalc = &followparent_recalc,
1963};
1964
1965/* SSI_L4_ICK based clocks */
1966
1967static struct clk ssi_l4_ick = {
1968 .name = "ssi_l4_ick",
1969 .ops = &clkops_null,
1970 .parent = &l4_ick,
1971 .clkdm_name = "core_l4_clkdm",
1972 .recalc = &followparent_recalc,
1973};
1974
1975static struct clk ssi_ick_3430es1 = {
1976 .name = "ssi_ick",
1977 .ops = &clkops_omap2_dflt,
1978 .parent = &ssi_l4_ick,
1979 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1980 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1981 .clkdm_name = "core_l4_clkdm",
1982 .recalc = &followparent_recalc,
1983};
1984
1985static struct clk ssi_ick_3430es2 = {
1986 .name = "ssi_ick",
1987 .ops = &clkops_omap3430es2_ssi_wait,
1988 .parent = &ssi_l4_ick,
1989 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1990 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1991 .clkdm_name = "core_l4_clkdm",
1992 .recalc = &followparent_recalc,
1993};
1994
1995/* REVISIT: Technically the TRM claims that this is CORE_CLK based,
1996 * but l4_ick makes more sense to me */
1997
1998static const struct clksel usb_l4_clksel[] = {
1999 { .parent = &l4_ick, .rates = div2_rates },
2000 { .parent = NULL },
2001};
2002
2003static struct clk usb_l4_ick = {
2004 .name = "usb_l4_ick",
2005 .ops = &clkops_omap2_dflt_wait,
2006 .parent = &l4_ick,
2007 .init = &omap2_init_clksel_parent,
2008 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2009 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
2010 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2011 .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2012 .clksel = usb_l4_clksel,
2013 .recalc = &omap2_clksel_recalc,
2014};
2015
2016/* SECURITY_L4_ICK2 based clocks */
2017
2018static struct clk security_l4_ick2 = {
2019 .name = "security_l4_ick2",
2020 .ops = &clkops_null,
2021 .parent = &l4_ick,
2022 .recalc = &followparent_recalc,
2023};
2024
2025static struct clk aes1_ick = {
2026 .name = "aes1_ick",
2027 .ops = &clkops_omap2_dflt_wait,
2028 .parent = &security_l4_ick2,
2029 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2030 .enable_bit = OMAP3430_EN_AES1_SHIFT,
2031 .recalc = &followparent_recalc,
2032};
2033
2034static struct clk rng_ick = {
2035 .name = "rng_ick",
2036 .ops = &clkops_omap2_dflt_wait,
2037 .parent = &security_l4_ick2,
2038 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2039 .enable_bit = OMAP3430_EN_RNG_SHIFT,
2040 .recalc = &followparent_recalc,
2041};
2042
2043static struct clk sha11_ick = {
2044 .name = "sha11_ick",
2045 .ops = &clkops_omap2_dflt_wait,
2046 .parent = &security_l4_ick2,
2047 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2048 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
2049 .recalc = &followparent_recalc,
2050};
2051
2052static struct clk des1_ick = {
2053 .name = "des1_ick",
2054 .ops = &clkops_omap2_dflt_wait,
2055 .parent = &security_l4_ick2,
2056 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2057 .enable_bit = OMAP3430_EN_DES1_SHIFT,
2058 .recalc = &followparent_recalc,
2059};
2060
2061/* DSS */
2062static struct clk dss1_alwon_fck_3430es1 = {
2063 .name = "dss1_alwon_fck",
2064 .ops = &clkops_omap2_dflt,
2065 .parent = &dpll4_m4x2_ck,
2066 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2067 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2068 .clkdm_name = "dss_clkdm",
2069 .recalc = &followparent_recalc,
2070};
2071
2072static struct clk dss1_alwon_fck_3430es2 = {
2073 .name = "dss1_alwon_fck",
2074 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2075 .parent = &dpll4_m4x2_ck,
2076 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2077 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2078 .clkdm_name = "dss_clkdm",
2079 .recalc = &followparent_recalc,
2080};
2081
2082static struct clk dss_tv_fck = {
2083 .name = "dss_tv_fck",
2084 .ops = &clkops_omap2_dflt,
2085 .parent = &omap_54m_fck,
2086 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2087 .enable_bit = OMAP3430_EN_TV_SHIFT,
2088 .clkdm_name = "dss_clkdm",
2089 .recalc = &followparent_recalc,
2090};
2091
2092static struct clk dss_96m_fck = {
2093 .name = "dss_96m_fck",
2094 .ops = &clkops_omap2_dflt,
2095 .parent = &omap_96m_fck,
2096 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2097 .enable_bit = OMAP3430_EN_TV_SHIFT,
2098 .clkdm_name = "dss_clkdm",
2099 .recalc = &followparent_recalc,
2100};
2101
2102static struct clk dss2_alwon_fck = {
2103 .name = "dss2_alwon_fck",
2104 .ops = &clkops_omap2_dflt,
2105 .parent = &sys_ck,
2106 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2107 .enable_bit = OMAP3430_EN_DSS2_SHIFT,
2108 .clkdm_name = "dss_clkdm",
2109 .recalc = &followparent_recalc,
2110};
2111
2112static struct clk dss_ick_3430es1 = {
2113 /* Handles both L3 and L4 clocks */
2114 .name = "dss_ick",
2115 .ops = &clkops_omap2_dflt,
2116 .parent = &l4_ick,
2117 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2118 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2119 .clkdm_name = "dss_clkdm",
2120 .recalc = &followparent_recalc,
2121};
2122
2123static struct clk dss_ick_3430es2 = {
2124 /* Handles both L3 and L4 clocks */
2125 .name = "dss_ick",
2126 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2127 .parent = &l4_ick,
2128 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2129 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2130 .clkdm_name = "dss_clkdm",
2131 .recalc = &followparent_recalc,
2132};
2133
2134/* CAM */
2135
2136static struct clk cam_mclk = {
2137 .name = "cam_mclk",
2138 .ops = &clkops_omap2_dflt,
2139 .parent = &dpll4_m5x2_ck,
2140 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2141 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2142 .clkdm_name = "cam_clkdm",
2143 .recalc = &followparent_recalc,
2144};
2145
2146static struct clk cam_ick = {
2147 /* Handles both L3 and L4 clocks */
2148 .name = "cam_ick",
2149 .ops = &clkops_omap2_dflt,
2150 .parent = &l4_ick,
2151 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
2152 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2153 .clkdm_name = "cam_clkdm",
2154 .recalc = &followparent_recalc,
2155};
2156
2157static struct clk csi2_96m_fck = {
2158 .name = "csi2_96m_fck",
2159 .ops = &clkops_omap2_dflt,
2160 .parent = &core_96m_fck,
2161 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2162 .enable_bit = OMAP3430_EN_CSI2_SHIFT,
2163 .clkdm_name = "cam_clkdm",
2164 .recalc = &followparent_recalc,
2165};
2166
2167/* USBHOST - 3430ES2 only */
2168
2169static struct clk usbhost_120m_fck = {
2170 .name = "usbhost_120m_fck",
2171 .ops = &clkops_omap2_dflt,
2172 .parent = &dpll5_m2_ck,
2173 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2174 .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT,
2175 .clkdm_name = "usbhost_clkdm",
2176 .recalc = &followparent_recalc,
2177};
2178
2179static struct clk usbhost_48m_fck = {
2180 .name = "usbhost_48m_fck",
2181 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2182 .parent = &omap_48m_fck,
2183 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2184 .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
2185 .clkdm_name = "usbhost_clkdm",
2186 .recalc = &followparent_recalc,
2187};
2188
2189static struct clk usbhost_ick = {
2190 /* Handles both L3 and L4 clocks */
2191 .name = "usbhost_ick",
2192 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2193 .parent = &l4_ick,
2194 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
2195 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
2196 .clkdm_name = "usbhost_clkdm",
2197 .recalc = &followparent_recalc,
2198};
2199
2200/* WKUP */
2201
2202static const struct clksel_rate usim_96m_rates[] = {
2203 { .div = 2, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
2204 { .div = 4, .val = 4, .flags = RATE_IN_343X },
2205 { .div = 8, .val = 5, .flags = RATE_IN_343X },
2206 { .div = 10, .val = 6, .flags = RATE_IN_343X },
2207 { .div = 0 },
2208};
2209
2210static const struct clksel_rate usim_120m_rates[] = {
2211 { .div = 4, .val = 7, .flags = RATE_IN_343X | DEFAULT_RATE },
2212 { .div = 8, .val = 8, .flags = RATE_IN_343X },
2213 { .div = 16, .val = 9, .flags = RATE_IN_343X },
2214 { .div = 20, .val = 10, .flags = RATE_IN_343X },
2215 { .div = 0 },
2216};
2217
2218static const struct clksel usim_clksel[] = {
2219 { .parent = &omap_96m_fck, .rates = usim_96m_rates },
2220 { .parent = &dpll5_m2_ck, .rates = usim_120m_rates },
2221 { .parent = &sys_ck, .rates = div2_rates },
2222 { .parent = NULL },
2223};
2224
2225/* 3430ES2 only */
2226static struct clk usim_fck = {
2227 .name = "usim_fck",
2228 .ops = &clkops_omap2_dflt_wait,
2229 .init = &omap2_init_clksel_parent,
2230 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2231 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2232 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2233 .clksel_mask = OMAP3430ES2_CLKSEL_USIMOCP_MASK,
2234 .clksel = usim_clksel,
2235 .recalc = &omap2_clksel_recalc,
2236};
2237
2238/* XXX should gpt1's clksel have wkup_32k_fck as the 32k opt? */
2239static struct clk gpt1_fck = {
2240 .name = "gpt1_fck",
2241 .ops = &clkops_omap2_dflt_wait,
2242 .init = &omap2_init_clksel_parent,
2243 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2244 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2245 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2246 .clksel_mask = OMAP3430_CLKSEL_GPT1_MASK,
2247 .clksel = omap343x_gpt_clksel,
2248 .clkdm_name = "wkup_clkdm",
2249 .recalc = &omap2_clksel_recalc,
2250};
2251
2252static struct clk wkup_32k_fck = {
2253 .name = "wkup_32k_fck",
2254 .ops = &clkops_null,
2255 .parent = &omap_32k_fck,
2256 .clkdm_name = "wkup_clkdm",
2257 .recalc = &followparent_recalc,
2258};
2259
2260static struct clk gpio1_dbck = {
2261 .name = "gpio1_dbck",
2262 .ops = &clkops_omap2_dflt,
2263 .parent = &wkup_32k_fck,
2264 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2265 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2266 .clkdm_name = "wkup_clkdm",
2267 .recalc = &followparent_recalc,
2268};
2269
2270static struct clk wdt2_fck = {
2271 .name = "wdt2_fck",
2272 .ops = &clkops_omap2_dflt_wait,
2273 .parent = &wkup_32k_fck,
2274 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2275 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2276 .clkdm_name = "wkup_clkdm",
2277 .recalc = &followparent_recalc,
2278};
2279
2280static struct clk wkup_l4_ick = {
2281 .name = "wkup_l4_ick",
2282 .ops = &clkops_null,
2283 .parent = &sys_ck,
2284 .clkdm_name = "wkup_clkdm",
2285 .recalc = &followparent_recalc,
2286};
2287
2288/* 3430ES2 only */
2289/* Never specifically named in the TRM, so we have to infer a likely name */
2290static struct clk usim_ick = {
2291 .name = "usim_ick",
2292 .ops = &clkops_omap2_dflt_wait,
2293 .parent = &wkup_l4_ick,
2294 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2295 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2296 .clkdm_name = "wkup_clkdm",
2297 .recalc = &followparent_recalc,
2298};
2299
2300static struct clk wdt2_ick = {
2301 .name = "wdt2_ick",
2302 .ops = &clkops_omap2_dflt_wait,
2303 .parent = &wkup_l4_ick,
2304 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2305 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2306 .clkdm_name = "wkup_clkdm",
2307 .recalc = &followparent_recalc,
2308};
2309
2310static struct clk wdt1_ick = {
2311 .name = "wdt1_ick",
2312 .ops = &clkops_omap2_dflt_wait,
2313 .parent = &wkup_l4_ick,
2314 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2315 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
2316 .clkdm_name = "wkup_clkdm",
2317 .recalc = &followparent_recalc,
2318};
2319
2320static struct clk gpio1_ick = {
2321 .name = "gpio1_ick",
2322 .ops = &clkops_omap2_dflt_wait,
2323 .parent = &wkup_l4_ick,
2324 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2325 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2326 .clkdm_name = "wkup_clkdm",
2327 .recalc = &followparent_recalc,
2328};
2329
2330static struct clk omap_32ksync_ick = {
2331 .name = "omap_32ksync_ick",
2332 .ops = &clkops_omap2_dflt_wait,
2333 .parent = &wkup_l4_ick,
2334 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2335 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
2336 .clkdm_name = "wkup_clkdm",
2337 .recalc = &followparent_recalc,
2338};
2339
2340/* XXX This clock no longer exists in 3430 TRM rev F */
2341static struct clk gpt12_ick = {
2342 .name = "gpt12_ick",
2343 .ops = &clkops_omap2_dflt_wait,
2344 .parent = &wkup_l4_ick,
2345 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2346 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
2347 .clkdm_name = "wkup_clkdm",
2348 .recalc = &followparent_recalc,
2349};
2350
2351static struct clk gpt1_ick = {
2352 .name = "gpt1_ick",
2353 .ops = &clkops_omap2_dflt_wait,
2354 .parent = &wkup_l4_ick,
2355 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2356 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2357 .clkdm_name = "wkup_clkdm",
2358 .recalc = &followparent_recalc,
2359};
2360
2361
2362
2363/* PER clock domain */
2364
2365static struct clk per_96m_fck = {
2366 .name = "per_96m_fck",
2367 .ops = &clkops_null,
2368 .parent = &omap_96m_alwon_fck,
2369 .clkdm_name = "per_clkdm",
2370 .recalc = &followparent_recalc,
2371};
2372
2373static struct clk per_48m_fck = {
2374 .name = "per_48m_fck",
2375 .ops = &clkops_null,
2376 .parent = &omap_48m_fck,
2377 .clkdm_name = "per_clkdm",
2378 .recalc = &followparent_recalc,
2379};
2380
2381static struct clk uart3_fck = {
2382 .name = "uart3_fck",
2383 .ops = &clkops_omap2_dflt_wait,
2384 .parent = &per_48m_fck,
2385 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2386 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2387 .clkdm_name = "per_clkdm",
2388 .recalc = &followparent_recalc,
2389};
2390
2391static struct clk gpt2_fck = {
2392 .name = "gpt2_fck",
2393 .ops = &clkops_omap2_dflt_wait,
2394 .init = &omap2_init_clksel_parent,
2395 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2396 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2397 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2398 .clksel_mask = OMAP3430_CLKSEL_GPT2_MASK,
2399 .clksel = omap343x_gpt_clksel,
2400 .clkdm_name = "per_clkdm",
2401 .recalc = &omap2_clksel_recalc,
2402};
2403
2404static struct clk gpt3_fck = {
2405 .name = "gpt3_fck",
2406 .ops = &clkops_omap2_dflt_wait,
2407 .init = &omap2_init_clksel_parent,
2408 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2409 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2410 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2411 .clksel_mask = OMAP3430_CLKSEL_GPT3_MASK,
2412 .clksel = omap343x_gpt_clksel,
2413 .clkdm_name = "per_clkdm",
2414 .recalc = &omap2_clksel_recalc,
2415};
2416
2417static struct clk gpt4_fck = {
2418 .name = "gpt4_fck",
2419 .ops = &clkops_omap2_dflt_wait,
2420 .init = &omap2_init_clksel_parent,
2421 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2422 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2423 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2424 .clksel_mask = OMAP3430_CLKSEL_GPT4_MASK,
2425 .clksel = omap343x_gpt_clksel,
2426 .clkdm_name = "per_clkdm",
2427 .recalc = &omap2_clksel_recalc,
2428};
2429
2430static struct clk gpt5_fck = {
2431 .name = "gpt5_fck",
2432 .ops = &clkops_omap2_dflt_wait,
2433 .init = &omap2_init_clksel_parent,
2434 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2435 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2436 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2437 .clksel_mask = OMAP3430_CLKSEL_GPT5_MASK,
2438 .clksel = omap343x_gpt_clksel,
2439 .clkdm_name = "per_clkdm",
2440 .recalc = &omap2_clksel_recalc,
2441};
2442
2443static struct clk gpt6_fck = {
2444 .name = "gpt6_fck",
2445 .ops = &clkops_omap2_dflt_wait,
2446 .init = &omap2_init_clksel_parent,
2447 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2448 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2449 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2450 .clksel_mask = OMAP3430_CLKSEL_GPT6_MASK,
2451 .clksel = omap343x_gpt_clksel,
2452 .clkdm_name = "per_clkdm",
2453 .recalc = &omap2_clksel_recalc,
2454};
2455
2456static struct clk gpt7_fck = {
2457 .name = "gpt7_fck",
2458 .ops = &clkops_omap2_dflt_wait,
2459 .init = &omap2_init_clksel_parent,
2460 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2461 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2462 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2463 .clksel_mask = OMAP3430_CLKSEL_GPT7_MASK,
2464 .clksel = omap343x_gpt_clksel,
2465 .clkdm_name = "per_clkdm",
2466 .recalc = &omap2_clksel_recalc,
2467};
2468
2469static struct clk gpt8_fck = {
2470 .name = "gpt8_fck",
2471 .ops = &clkops_omap2_dflt_wait,
2472 .init = &omap2_init_clksel_parent,
2473 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2474 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2475 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2476 .clksel_mask = OMAP3430_CLKSEL_GPT8_MASK,
2477 .clksel = omap343x_gpt_clksel,
2478 .clkdm_name = "per_clkdm",
2479 .recalc = &omap2_clksel_recalc,
2480};
2481
2482static struct clk gpt9_fck = {
2483 .name = "gpt9_fck",
2484 .ops = &clkops_omap2_dflt_wait,
2485 .init = &omap2_init_clksel_parent,
2486 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2487 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2488 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2489 .clksel_mask = OMAP3430_CLKSEL_GPT9_MASK,
2490 .clksel = omap343x_gpt_clksel,
2491 .clkdm_name = "per_clkdm",
2492 .recalc = &omap2_clksel_recalc,
2493};
2494
2495static struct clk per_32k_alwon_fck = {
2496 .name = "per_32k_alwon_fck",
2497 .ops = &clkops_null,
2498 .parent = &omap_32k_fck,
2499 .clkdm_name = "per_clkdm",
2500 .recalc = &followparent_recalc,
2501};
2502
2503static struct clk gpio6_dbck = {
2504 .name = "gpio6_dbck",
2505 .ops = &clkops_omap2_dflt,
2506 .parent = &per_32k_alwon_fck,
2507 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2508 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2509 .clkdm_name = "per_clkdm",
2510 .recalc = &followparent_recalc,
2511};
2512
2513static struct clk gpio5_dbck = {
2514 .name = "gpio5_dbck",
2515 .ops = &clkops_omap2_dflt,
2516 .parent = &per_32k_alwon_fck,
2517 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2518 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2519 .clkdm_name = "per_clkdm",
2520 .recalc = &followparent_recalc,
2521};
2522
2523static struct clk gpio4_dbck = {
2524 .name = "gpio4_dbck",
2525 .ops = &clkops_omap2_dflt,
2526 .parent = &per_32k_alwon_fck,
2527 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2528 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2529 .clkdm_name = "per_clkdm",
2530 .recalc = &followparent_recalc,
2531};
2532
2533static struct clk gpio3_dbck = {
2534 .name = "gpio3_dbck",
2535 .ops = &clkops_omap2_dflt,
2536 .parent = &per_32k_alwon_fck,
2537 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2538 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2539 .clkdm_name = "per_clkdm",
2540 .recalc = &followparent_recalc,
2541};
2542
2543static struct clk gpio2_dbck = {
2544 .name = "gpio2_dbck",
2545 .ops = &clkops_omap2_dflt,
2546 .parent = &per_32k_alwon_fck,
2547 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2548 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2549 .clkdm_name = "per_clkdm",
2550 .recalc = &followparent_recalc,
2551};
2552
2553static struct clk wdt3_fck = {
2554 .name = "wdt3_fck",
2555 .ops = &clkops_omap2_dflt_wait,
2556 .parent = &per_32k_alwon_fck,
2557 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2558 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2559 .clkdm_name = "per_clkdm",
2560 .recalc = &followparent_recalc,
2561};
2562
2563static struct clk per_l4_ick = {
2564 .name = "per_l4_ick",
2565 .ops = &clkops_null,
2566 .parent = &l4_ick,
2567 .clkdm_name = "per_clkdm",
2568 .recalc = &followparent_recalc,
2569};
2570
2571static struct clk gpio6_ick = {
2572 .name = "gpio6_ick",
2573 .ops = &clkops_omap2_dflt_wait,
2574 .parent = &per_l4_ick,
2575 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2576 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2577 .clkdm_name = "per_clkdm",
2578 .recalc = &followparent_recalc,
2579};
2580
2581static struct clk gpio5_ick = {
2582 .name = "gpio5_ick",
2583 .ops = &clkops_omap2_dflt_wait,
2584 .parent = &per_l4_ick,
2585 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2586 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2587 .clkdm_name = "per_clkdm",
2588 .recalc = &followparent_recalc,
2589};
2590
2591static struct clk gpio4_ick = {
2592 .name = "gpio4_ick",
2593 .ops = &clkops_omap2_dflt_wait,
2594 .parent = &per_l4_ick,
2595 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2596 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2597 .clkdm_name = "per_clkdm",
2598 .recalc = &followparent_recalc,
2599};
2600
2601static struct clk gpio3_ick = {
2602 .name = "gpio3_ick",
2603 .ops = &clkops_omap2_dflt_wait,
2604 .parent = &per_l4_ick,
2605 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2606 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2607 .clkdm_name = "per_clkdm",
2608 .recalc = &followparent_recalc,
2609};
2610
2611static struct clk gpio2_ick = {
2612 .name = "gpio2_ick",
2613 .ops = &clkops_omap2_dflt_wait,
2614 .parent = &per_l4_ick,
2615 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2616 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2617 .clkdm_name = "per_clkdm",
2618 .recalc = &followparent_recalc,
2619};
2620
2621static struct clk wdt3_ick = {
2622 .name = "wdt3_ick",
2623 .ops = &clkops_omap2_dflt_wait,
2624 .parent = &per_l4_ick,
2625 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2626 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2627 .clkdm_name = "per_clkdm",
2628 .recalc = &followparent_recalc,
2629};
2630
2631static struct clk uart3_ick = {
2632 .name = "uart3_ick",
2633 .ops = &clkops_omap2_dflt_wait,
2634 .parent = &per_l4_ick,
2635 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2636 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2637 .clkdm_name = "per_clkdm",
2638 .recalc = &followparent_recalc,
2639};
2640
2641static struct clk gpt9_ick = {
2642 .name = "gpt9_ick",
2643 .ops = &clkops_omap2_dflt_wait,
2644 .parent = &per_l4_ick,
2645 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2646 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2647 .clkdm_name = "per_clkdm",
2648 .recalc = &followparent_recalc,
2649};
2650
2651static struct clk gpt8_ick = {
2652 .name = "gpt8_ick",
2653 .ops = &clkops_omap2_dflt_wait,
2654 .parent = &per_l4_ick,
2655 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2656 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2657 .clkdm_name = "per_clkdm",
2658 .recalc = &followparent_recalc,
2659};
2660
2661static struct clk gpt7_ick = {
2662 .name = "gpt7_ick",
2663 .ops = &clkops_omap2_dflt_wait,
2664 .parent = &per_l4_ick,
2665 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2666 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2667 .clkdm_name = "per_clkdm",
2668 .recalc = &followparent_recalc,
2669};
2670
2671static struct clk gpt6_ick = {
2672 .name = "gpt6_ick",
2673 .ops = &clkops_omap2_dflt_wait,
2674 .parent = &per_l4_ick,
2675 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2676 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2677 .clkdm_name = "per_clkdm",
2678 .recalc = &followparent_recalc,
2679};
2680
2681static struct clk gpt5_ick = {
2682 .name = "gpt5_ick",
2683 .ops = &clkops_omap2_dflt_wait,
2684 .parent = &per_l4_ick,
2685 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2686 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2687 .clkdm_name = "per_clkdm",
2688 .recalc = &followparent_recalc,
2689};
2690
2691static struct clk gpt4_ick = {
2692 .name = "gpt4_ick",
2693 .ops = &clkops_omap2_dflt_wait,
2694 .parent = &per_l4_ick,
2695 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2696 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2697 .clkdm_name = "per_clkdm",
2698 .recalc = &followparent_recalc,
2699};
2700
2701static struct clk gpt3_ick = {
2702 .name = "gpt3_ick",
2703 .ops = &clkops_omap2_dflt_wait,
2704 .parent = &per_l4_ick,
2705 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2706 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2707 .clkdm_name = "per_clkdm",
2708 .recalc = &followparent_recalc,
2709};
2710
2711static struct clk gpt2_ick = {
2712 .name = "gpt2_ick",
2713 .ops = &clkops_omap2_dflt_wait,
2714 .parent = &per_l4_ick,
2715 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2716 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2717 .clkdm_name = "per_clkdm",
2718 .recalc = &followparent_recalc,
2719};
2720
2721static struct clk mcbsp2_ick = {
2722 .name = "mcbsp_ick",
2723 .ops = &clkops_omap2_dflt_wait,
2724 .id = 2,
2725 .parent = &per_l4_ick,
2726 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2727 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2728 .clkdm_name = "per_clkdm",
2729 .recalc = &followparent_recalc,
2730};
2731
2732static struct clk mcbsp3_ick = {
2733 .name = "mcbsp_ick",
2734 .ops = &clkops_omap2_dflt_wait,
2735 .id = 3,
2736 .parent = &per_l4_ick,
2737 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2738 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2739 .clkdm_name = "per_clkdm",
2740 .recalc = &followparent_recalc,
2741};
2742
2743static struct clk mcbsp4_ick = {
2744 .name = "mcbsp_ick",
2745 .ops = &clkops_omap2_dflt_wait,
2746 .id = 4,
2747 .parent = &per_l4_ick,
2748 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2749 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2750 .clkdm_name = "per_clkdm",
2751 .recalc = &followparent_recalc,
2752};
2753
2754static const struct clksel mcbsp_234_clksel[] = {
2755 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
2756 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2757 { .parent = NULL }
2758};
2759
2760static struct clk mcbsp2_fck = {
2761 .name = "mcbsp_fck",
2762 .ops = &clkops_omap2_dflt_wait,
2763 .id = 2,
2764 .init = &omap2_init_clksel_parent,
2765 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2766 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2767 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2768 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
2769 .clksel = mcbsp_234_clksel,
2770 .clkdm_name = "per_clkdm",
2771 .recalc = &omap2_clksel_recalc,
2772};
2773
2774static struct clk mcbsp3_fck = {
2775 .name = "mcbsp_fck",
2776 .ops = &clkops_omap2_dflt_wait,
2777 .id = 3,
2778 .init = &omap2_init_clksel_parent,
2779 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2780 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2781 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2782 .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
2783 .clksel = mcbsp_234_clksel,
2784 .clkdm_name = "per_clkdm",
2785 .recalc = &omap2_clksel_recalc,
2786};
2787
2788static struct clk mcbsp4_fck = {
2789 .name = "mcbsp_fck",
2790 .ops = &clkops_omap2_dflt_wait,
2791 .id = 4,
2792 .init = &omap2_init_clksel_parent,
2793 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2794 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2795 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2796 .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
2797 .clksel = mcbsp_234_clksel,
2798 .clkdm_name = "per_clkdm",
2799 .recalc = &omap2_clksel_recalc,
2800};
2801
2802/* EMU clocks */
2803
2804/* More information: ARM Cortex-A8 Technical Reference Manual, sect 10.1 */
2805
2806static const struct clksel_rate emu_src_sys_rates[] = {
2807 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
2808 { .div = 0 },
2809};
2810
2811static const struct clksel_rate emu_src_core_rates[] = {
2812 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
2813 { .div = 0 },
2814};
2815
2816static const struct clksel_rate emu_src_per_rates[] = {
2817 { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE },
2818 { .div = 0 },
2819};
2820
2821static const struct clksel_rate emu_src_mpu_rates[] = {
2822 { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
2823 { .div = 0 },
2824};
2825
2826static const struct clksel emu_src_clksel[] = {
2827 { .parent = &sys_ck, .rates = emu_src_sys_rates },
2828 { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates },
2829 { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates },
2830 { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates },
2831 { .parent = NULL },
2832};
2833
2834/*
2835 * Like the clkout_src clocks, emu_src_clk is a virtual clock, existing only
2836 * to switch the source of some of the EMU clocks.
2837 * XXX Are there CLKEN bits for these EMU clks?
2838 */ 6 */
2839static struct clk emu_src_ck = {
2840 .name = "emu_src_ck",
2841 .ops = &clkops_null,
2842 .init = &omap2_init_clksel_parent,
2843 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2844 .clksel_mask = OMAP3430_MUX_CTRL_MASK,
2845 .clksel = emu_src_clksel,
2846 .clkdm_name = "emu_clkdm",
2847 .recalc = &omap2_clksel_recalc,
2848};
2849
2850static const struct clksel_rate pclk_emu_rates[] = {
2851 { .div = 2, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE },
2852 { .div = 3, .val = 3, .flags = RATE_IN_343X },
2853 { .div = 4, .val = 4, .flags = RATE_IN_343X },
2854 { .div = 6, .val = 6, .flags = RATE_IN_343X },
2855 { .div = 0 },
2856};
2857
2858static const struct clksel pclk_emu_clksel[] = {
2859 { .parent = &emu_src_ck, .rates = pclk_emu_rates },
2860 { .parent = NULL },
2861};
2862
2863static struct clk pclk_fck = {
2864 .name = "pclk_fck",
2865 .ops = &clkops_null,
2866 .init = &omap2_init_clksel_parent,
2867 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2868 .clksel_mask = OMAP3430_CLKSEL_PCLK_MASK,
2869 .clksel = pclk_emu_clksel,
2870 .clkdm_name = "emu_clkdm",
2871 .recalc = &omap2_clksel_recalc,
2872};
2873
2874static const struct clksel_rate pclkx2_emu_rates[] = {
2875 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
2876 { .div = 2, .val = 2, .flags = RATE_IN_343X },
2877 { .div = 3, .val = 3, .flags = RATE_IN_343X },
2878 { .div = 0 },
2879};
2880
2881static const struct clksel pclkx2_emu_clksel[] = {
2882 { .parent = &emu_src_ck, .rates = pclkx2_emu_rates },
2883 { .parent = NULL },
2884};
2885
2886static struct clk pclkx2_fck = {
2887 .name = "pclkx2_fck",
2888 .ops = &clkops_null,
2889 .init = &omap2_init_clksel_parent,
2890 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2891 .clksel_mask = OMAP3430_CLKSEL_PCLKX2_MASK,
2892 .clksel = pclkx2_emu_clksel,
2893 .clkdm_name = "emu_clkdm",
2894 .recalc = &omap2_clksel_recalc,
2895};
2896
2897static const struct clksel atclk_emu_clksel[] = {
2898 { .parent = &emu_src_ck, .rates = div2_rates },
2899 { .parent = NULL },
2900};
2901
2902static struct clk atclk_fck = {
2903 .name = "atclk_fck",
2904 .ops = &clkops_null,
2905 .init = &omap2_init_clksel_parent,
2906 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2907 .clksel_mask = OMAP3430_CLKSEL_ATCLK_MASK,
2908 .clksel = atclk_emu_clksel,
2909 .clkdm_name = "emu_clkdm",
2910 .recalc = &omap2_clksel_recalc,
2911};
2912
2913static struct clk traceclk_src_fck = {
2914 .name = "traceclk_src_fck",
2915 .ops = &clkops_null,
2916 .init = &omap2_init_clksel_parent,
2917 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2918 .clksel_mask = OMAP3430_TRACE_MUX_CTRL_MASK,
2919 .clksel = emu_src_clksel,
2920 .clkdm_name = "emu_clkdm",
2921 .recalc = &omap2_clksel_recalc,
2922};
2923
2924static const struct clksel_rate traceclk_rates[] = {
2925 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
2926 { .div = 2, .val = 2, .flags = RATE_IN_343X },
2927 { .div = 4, .val = 4, .flags = RATE_IN_343X },
2928 { .div = 0 },
2929};
2930
2931static const struct clksel traceclk_clksel[] = {
2932 { .parent = &traceclk_src_fck, .rates = traceclk_rates },
2933 { .parent = NULL },
2934};
2935
2936static struct clk traceclk_fck = {
2937 .name = "traceclk_fck",
2938 .ops = &clkops_null,
2939 .init = &omap2_init_clksel_parent,
2940 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2941 .clksel_mask = OMAP3430_CLKSEL_TRACECLK_MASK,
2942 .clksel = traceclk_clksel,
2943 .clkdm_name = "emu_clkdm",
2944 .recalc = &omap2_clksel_recalc,
2945};
2946
2947/* SR clocks */
2948
2949/* SmartReflex fclk (VDD1) */
2950static struct clk sr1_fck = {
2951 .name = "sr1_fck",
2952 .ops = &clkops_omap2_dflt_wait,
2953 .parent = &sys_ck,
2954 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2955 .enable_bit = OMAP3430_EN_SR1_SHIFT,
2956 .recalc = &followparent_recalc,
2957};
2958
2959/* SmartReflex fclk (VDD2) */
2960static struct clk sr2_fck = {
2961 .name = "sr2_fck",
2962 .ops = &clkops_omap2_dflt_wait,
2963 .parent = &sys_ck,
2964 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2965 .enable_bit = OMAP3430_EN_SR2_SHIFT,
2966 .recalc = &followparent_recalc,
2967};
2968 7
2969static struct clk sr_l4_ick = { 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_34XX_H
2970 .name = "sr_l4_ick", 9#define __ARCH_ARM_MACH_OMAP2_CLOCK_34XX_H
2971 .ops = &clkops_null, /* RMK: missing? */
2972 .parent = &l4_ick,
2973 .clkdm_name = "core_l4_clkdm",
2974 .recalc = &followparent_recalc,
2975};
2976 10
2977/* SECURE_32K_FCK clocks */ 11int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate);
12int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate);
13void omap3_clk_lock_dpll5(void);
2978 14
2979static struct clk gpt12_fck = { 15extern struct clk *sdrc_ick_p;
2980 .name = "gpt12_fck", 16extern struct clk *arm_fck_p;
2981 .ops = &clkops_null,
2982 .parent = &secure_32k_fck,
2983 .recalc = &followparent_recalc,
2984};
2985 17
2986static struct clk wdt1_fck = { 18/* OMAP34xx-specific clkops */
2987 .name = "wdt1_fck", 19extern const struct clkops clkops_omap3430es2_ssi_wait;
2988 .ops = &clkops_null, 20extern const struct clkops clkops_omap3430es2_hsotgusb_wait;
2989 .parent = &secure_32k_fck, 21extern const struct clkops clkops_omap3430es2_dss_usbhost_wait;
2990 .recalc = &followparent_recalc, 22extern const struct clkops clkops_noncore_dpll_ops;
2991};
2992 23
2993#endif 24#endif
diff --git a/arch/arm/mach-omap2/clock34xx_data.c b/arch/arm/mach-omap2/clock34xx_data.c
new file mode 100644
index 000000000000..8bdcc9cc7f9a
--- /dev/null
+++ b/arch/arm/mach-omap2/clock34xx_data.c
@@ -0,0 +1,3289 @@
1/*
2 * OMAP3 clock data
3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander
9 * DPLL bypass clock support added by Roman Tereshonkov
10 *
11 */
12
13/*
14 * Virtual clocks are introduced as convenient tools.
15 * They are sources for other clocks and not supposed
16 * to be requested from drivers directly.
17 */
18
19#include <linux/module.h>
20#include <linux/kernel.h>
21#include <linux/clk.h>
22
23#include <plat/control.h>
24#include <plat/clkdev_omap.h>
25
26#include "clock.h"
27#include "clock34xx.h"
28#include "cm.h"
29#include "cm-regbits-34xx.h"
30#include "prm.h"
31#include "prm-regbits-34xx.h"
32
33/*
34 * clocks
35 */
36
37#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
38
39/* Maximum DPLL multiplier, divider values for OMAP3 */
40#define OMAP3_MAX_DPLL_MULT 2048
41#define OMAP3_MAX_DPLL_DIV 128
42
43/*
44 * DPLL1 supplies clock to the MPU.
45 * DPLL2 supplies clock to the IVA2.
46 * DPLL3 supplies CORE domain clocks.
47 * DPLL4 supplies peripheral clocks.
48 * DPLL5 supplies other peripheral clocks (USBHOST, USIM).
49 */
50
51/* Forward declarations for DPLL bypass clocks */
52static struct clk dpll1_fck;
53static struct clk dpll2_fck;
54
55/* PRM CLOCKS */
56
57/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */
58static struct clk omap_32k_fck = {
59 .name = "omap_32k_fck",
60 .ops = &clkops_null,
61 .rate = 32768,
62 .flags = RATE_FIXED,
63};
64
65static struct clk secure_32k_fck = {
66 .name = "secure_32k_fck",
67 .ops = &clkops_null,
68 .rate = 32768,
69 .flags = RATE_FIXED,
70};
71
72/* Virtual source clocks for osc_sys_ck */
73static struct clk virt_12m_ck = {
74 .name = "virt_12m_ck",
75 .ops = &clkops_null,
76 .rate = 12000000,
77 .flags = RATE_FIXED,
78};
79
80static struct clk virt_13m_ck = {
81 .name = "virt_13m_ck",
82 .ops = &clkops_null,
83 .rate = 13000000,
84 .flags = RATE_FIXED,
85};
86
87static struct clk virt_16_8m_ck = {
88 .name = "virt_16_8m_ck",
89 .ops = &clkops_null,
90 .rate = 16800000,
91 .flags = RATE_FIXED,
92};
93
94static struct clk virt_19_2m_ck = {
95 .name = "virt_19_2m_ck",
96 .ops = &clkops_null,
97 .rate = 19200000,
98 .flags = RATE_FIXED,
99};
100
101static struct clk virt_26m_ck = {
102 .name = "virt_26m_ck",
103 .ops = &clkops_null,
104 .rate = 26000000,
105 .flags = RATE_FIXED,
106};
107
108static struct clk virt_38_4m_ck = {
109 .name = "virt_38_4m_ck",
110 .ops = &clkops_null,
111 .rate = 38400000,
112 .flags = RATE_FIXED,
113};
114
115static const struct clksel_rate osc_sys_12m_rates[] = {
116 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
117 { .div = 0 }
118};
119
120static const struct clksel_rate osc_sys_13m_rates[] = {
121 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
122 { .div = 0 }
123};
124
125static const struct clksel_rate osc_sys_16_8m_rates[] = {
126 { .div = 1, .val = 5, .flags = RATE_IN_3430ES2 | DEFAULT_RATE },
127 { .div = 0 }
128};
129
130static const struct clksel_rate osc_sys_19_2m_rates[] = {
131 { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE },
132 { .div = 0 }
133};
134
135static const struct clksel_rate osc_sys_26m_rates[] = {
136 { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
137 { .div = 0 }
138};
139
140static const struct clksel_rate osc_sys_38_4m_rates[] = {
141 { .div = 1, .val = 4, .flags = RATE_IN_343X | DEFAULT_RATE },
142 { .div = 0 }
143};
144
145static const struct clksel osc_sys_clksel[] = {
146 { .parent = &virt_12m_ck, .rates = osc_sys_12m_rates },
147 { .parent = &virt_13m_ck, .rates = osc_sys_13m_rates },
148 { .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates },
149 { .parent = &virt_19_2m_ck, .rates = osc_sys_19_2m_rates },
150 { .parent = &virt_26m_ck, .rates = osc_sys_26m_rates },
151 { .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates },
152 { .parent = NULL },
153};
154
155/* Oscillator clock */
156/* 12, 13, 16.8, 19.2, 26, or 38.4 MHz */
157static struct clk osc_sys_ck = {
158 .name = "osc_sys_ck",
159 .ops = &clkops_null,
160 .init = &omap2_init_clksel_parent,
161 .clksel_reg = OMAP3430_PRM_CLKSEL,
162 .clksel_mask = OMAP3430_SYS_CLKIN_SEL_MASK,
163 .clksel = osc_sys_clksel,
164 /* REVISIT: deal with autoextclkmode? */
165 .flags = RATE_FIXED,
166 .recalc = &omap2_clksel_recalc,
167};
168
169static const struct clksel_rate div2_rates[] = {
170 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
171 { .div = 2, .val = 2, .flags = RATE_IN_343X },
172 { .div = 0 }
173};
174
175static const struct clksel sys_clksel[] = {
176 { .parent = &osc_sys_ck, .rates = div2_rates },
177 { .parent = NULL }
178};
179
180/* Latency: this clock is only enabled after PRM_CLKSETUP.SETUP_TIME */
181/* Feeds DPLLs - divided first by PRM_CLKSRC_CTRL.SYSCLKDIV? */
182static struct clk sys_ck = {
183 .name = "sys_ck",
184 .ops = &clkops_null,
185 .parent = &osc_sys_ck,
186 .init = &omap2_init_clksel_parent,
187 .clksel_reg = OMAP3430_PRM_CLKSRC_CTRL,
188 .clksel_mask = OMAP_SYSCLKDIV_MASK,
189 .clksel = sys_clksel,
190 .recalc = &omap2_clksel_recalc,
191};
192
193static struct clk sys_altclk = {
194 .name = "sys_altclk",
195 .ops = &clkops_null,
196};
197
198/* Optional external clock input for some McBSPs */
199static struct clk mcbsp_clks = {
200 .name = "mcbsp_clks",
201 .ops = &clkops_null,
202};
203
204/* PRM EXTERNAL CLOCK OUTPUT */
205
206static struct clk sys_clkout1 = {
207 .name = "sys_clkout1",
208 .ops = &clkops_omap2_dflt,
209 .parent = &osc_sys_ck,
210 .enable_reg = OMAP3430_PRM_CLKOUT_CTRL,
211 .enable_bit = OMAP3430_CLKOUT_EN_SHIFT,
212 .recalc = &followparent_recalc,
213};
214
215/* DPLLS */
216
217/* CM CLOCKS */
218
219static const struct clksel_rate div16_dpll_rates[] = {
220 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
221 { .div = 2, .val = 2, .flags = RATE_IN_343X },
222 { .div = 3, .val = 3, .flags = RATE_IN_343X },
223 { .div = 4, .val = 4, .flags = RATE_IN_343X },
224 { .div = 5, .val = 5, .flags = RATE_IN_343X },
225 { .div = 6, .val = 6, .flags = RATE_IN_343X },
226 { .div = 7, .val = 7, .flags = RATE_IN_343X },
227 { .div = 8, .val = 8, .flags = RATE_IN_343X },
228 { .div = 9, .val = 9, .flags = RATE_IN_343X },
229 { .div = 10, .val = 10, .flags = RATE_IN_343X },
230 { .div = 11, .val = 11, .flags = RATE_IN_343X },
231 { .div = 12, .val = 12, .flags = RATE_IN_343X },
232 { .div = 13, .val = 13, .flags = RATE_IN_343X },
233 { .div = 14, .val = 14, .flags = RATE_IN_343X },
234 { .div = 15, .val = 15, .flags = RATE_IN_343X },
235 { .div = 16, .val = 16, .flags = RATE_IN_343X },
236 { .div = 0 }
237};
238
239/* DPLL1 */
240/* MPU clock source */
241/* Type: DPLL */
242static struct dpll_data dpll1_dd = {
243 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
244 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
245 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
246 .clk_bypass = &dpll1_fck,
247 .clk_ref = &sys_ck,
248 .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK,
249 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
250 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
251 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
252 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
253 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
254 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
255 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
256 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
257 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
258 .idlest_mask = OMAP3430_ST_MPU_CLK_MASK,
259 .max_multiplier = OMAP3_MAX_DPLL_MULT,
260 .min_divider = 1,
261 .max_divider = OMAP3_MAX_DPLL_DIV,
262 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
263};
264
265static struct clk dpll1_ck = {
266 .name = "dpll1_ck",
267 .ops = &clkops_null,
268 .parent = &sys_ck,
269 .dpll_data = &dpll1_dd,
270 .round_rate = &omap2_dpll_round_rate,
271 .set_rate = &omap3_noncore_dpll_set_rate,
272 .clkdm_name = "dpll1_clkdm",
273 .recalc = &omap3_dpll_recalc,
274};
275
276/*
277 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
278 * DPLL isn't bypassed.
279 */
280static struct clk dpll1_x2_ck = {
281 .name = "dpll1_x2_ck",
282 .ops = &clkops_null,
283 .parent = &dpll1_ck,
284 .clkdm_name = "dpll1_clkdm",
285 .recalc = &omap3_clkoutx2_recalc,
286};
287
288/* On DPLL1, unlike other DPLLs, the divider is downstream from CLKOUTX2 */
289static const struct clksel div16_dpll1_x2m2_clksel[] = {
290 { .parent = &dpll1_x2_ck, .rates = div16_dpll_rates },
291 { .parent = NULL }
292};
293
294/*
295 * Does not exist in the TRM - needed to separate the M2 divider from
296 * bypass selection in mpu_ck
297 */
298static struct clk dpll1_x2m2_ck = {
299 .name = "dpll1_x2m2_ck",
300 .ops = &clkops_null,
301 .parent = &dpll1_x2_ck,
302 .init = &omap2_init_clksel_parent,
303 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
304 .clksel_mask = OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK,
305 .clksel = div16_dpll1_x2m2_clksel,
306 .clkdm_name = "dpll1_clkdm",
307 .recalc = &omap2_clksel_recalc,
308};
309
310/* DPLL2 */
311/* IVA2 clock source */
312/* Type: DPLL */
313
314static struct dpll_data dpll2_dd = {
315 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
316 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
317 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
318 .clk_bypass = &dpll2_fck,
319 .clk_ref = &sys_ck,
320 .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK,
321 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
322 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
323 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
324 (1 << DPLL_LOW_POWER_BYPASS),
325 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
326 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
327 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
328 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
329 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
330 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
331 .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK,
332 .max_multiplier = OMAP3_MAX_DPLL_MULT,
333 .min_divider = 1,
334 .max_divider = OMAP3_MAX_DPLL_DIV,
335 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
336};
337
338static struct clk dpll2_ck = {
339 .name = "dpll2_ck",
340 .ops = &clkops_noncore_dpll_ops,
341 .parent = &sys_ck,
342 .dpll_data = &dpll2_dd,
343 .round_rate = &omap2_dpll_round_rate,
344 .set_rate = &omap3_noncore_dpll_set_rate,
345 .clkdm_name = "dpll2_clkdm",
346 .recalc = &omap3_dpll_recalc,
347};
348
349static const struct clksel div16_dpll2_m2x2_clksel[] = {
350 { .parent = &dpll2_ck, .rates = div16_dpll_rates },
351 { .parent = NULL }
352};
353
354/*
355 * The TRM is conflicted on whether IVA2 clock comes from DPLL2 CLKOUT
356 * or CLKOUTX2. CLKOUT seems most plausible.
357 */
358static struct clk dpll2_m2_ck = {
359 .name = "dpll2_m2_ck",
360 .ops = &clkops_null,
361 .parent = &dpll2_ck,
362 .init = &omap2_init_clksel_parent,
363 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD,
364 OMAP3430_CM_CLKSEL2_PLL),
365 .clksel_mask = OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK,
366 .clksel = div16_dpll2_m2x2_clksel,
367 .clkdm_name = "dpll2_clkdm",
368 .recalc = &omap2_clksel_recalc,
369};
370
371/*
372 * DPLL3
373 * Source clock for all interfaces and for some device fclks
374 * REVISIT: Also supports fast relock bypass - not included below
375 */
376static struct dpll_data dpll3_dd = {
377 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
378 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
379 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
380 .clk_bypass = &sys_ck,
381 .clk_ref = &sys_ck,
382 .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK,
383 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
384 .enable_mask = OMAP3430_EN_CORE_DPLL_MASK,
385 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
386 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
387 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
388 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
389 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
390 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
391 .idlest_mask = OMAP3430_ST_CORE_CLK_MASK,
392 .max_multiplier = OMAP3_MAX_DPLL_MULT,
393 .min_divider = 1,
394 .max_divider = OMAP3_MAX_DPLL_DIV,
395 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
396};
397
398static struct clk dpll3_ck = {
399 .name = "dpll3_ck",
400 .ops = &clkops_null,
401 .parent = &sys_ck,
402 .dpll_data = &dpll3_dd,
403 .round_rate = &omap2_dpll_round_rate,
404 .clkdm_name = "dpll3_clkdm",
405 .recalc = &omap3_dpll_recalc,
406};
407
408/*
409 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
410 * DPLL isn't bypassed
411 */
412static struct clk dpll3_x2_ck = {
413 .name = "dpll3_x2_ck",
414 .ops = &clkops_null,
415 .parent = &dpll3_ck,
416 .clkdm_name = "dpll3_clkdm",
417 .recalc = &omap3_clkoutx2_recalc,
418};
419
420static const struct clksel_rate div31_dpll3_rates[] = {
421 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
422 { .div = 2, .val = 2, .flags = RATE_IN_343X },
423 { .div = 3, .val = 3, .flags = RATE_IN_3430ES2 },
424 { .div = 4, .val = 4, .flags = RATE_IN_3430ES2 },
425 { .div = 5, .val = 5, .flags = RATE_IN_3430ES2 },
426 { .div = 6, .val = 6, .flags = RATE_IN_3430ES2 },
427 { .div = 7, .val = 7, .flags = RATE_IN_3430ES2 },
428 { .div = 8, .val = 8, .flags = RATE_IN_3430ES2 },
429 { .div = 9, .val = 9, .flags = RATE_IN_3430ES2 },
430 { .div = 10, .val = 10, .flags = RATE_IN_3430ES2 },
431 { .div = 11, .val = 11, .flags = RATE_IN_3430ES2 },
432 { .div = 12, .val = 12, .flags = RATE_IN_3430ES2 },
433 { .div = 13, .val = 13, .flags = RATE_IN_3430ES2 },
434 { .div = 14, .val = 14, .flags = RATE_IN_3430ES2 },
435 { .div = 15, .val = 15, .flags = RATE_IN_3430ES2 },
436 { .div = 16, .val = 16, .flags = RATE_IN_3430ES2 },
437 { .div = 17, .val = 17, .flags = RATE_IN_3430ES2 },
438 { .div = 18, .val = 18, .flags = RATE_IN_3430ES2 },
439 { .div = 19, .val = 19, .flags = RATE_IN_3430ES2 },
440 { .div = 20, .val = 20, .flags = RATE_IN_3430ES2 },
441 { .div = 21, .val = 21, .flags = RATE_IN_3430ES2 },
442 { .div = 22, .val = 22, .flags = RATE_IN_3430ES2 },
443 { .div = 23, .val = 23, .flags = RATE_IN_3430ES2 },
444 { .div = 24, .val = 24, .flags = RATE_IN_3430ES2 },
445 { .div = 25, .val = 25, .flags = RATE_IN_3430ES2 },
446 { .div = 26, .val = 26, .flags = RATE_IN_3430ES2 },
447 { .div = 27, .val = 27, .flags = RATE_IN_3430ES2 },
448 { .div = 28, .val = 28, .flags = RATE_IN_3430ES2 },
449 { .div = 29, .val = 29, .flags = RATE_IN_3430ES2 },
450 { .div = 30, .val = 30, .flags = RATE_IN_3430ES2 },
451 { .div = 31, .val = 31, .flags = RATE_IN_3430ES2 },
452 { .div = 0 },
453};
454
455static const struct clksel div31_dpll3m2_clksel[] = {
456 { .parent = &dpll3_ck, .rates = div31_dpll3_rates },
457 { .parent = NULL }
458};
459
460/* DPLL3 output M2 - primary control point for CORE speed */
461static struct clk dpll3_m2_ck = {
462 .name = "dpll3_m2_ck",
463 .ops = &clkops_null,
464 .parent = &dpll3_ck,
465 .init = &omap2_init_clksel_parent,
466 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
467 .clksel_mask = OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK,
468 .clksel = div31_dpll3m2_clksel,
469 .clkdm_name = "dpll3_clkdm",
470 .round_rate = &omap2_clksel_round_rate,
471 .set_rate = &omap3_core_dpll_m2_set_rate,
472 .recalc = &omap2_clksel_recalc,
473};
474
475static struct clk core_ck = {
476 .name = "core_ck",
477 .ops = &clkops_null,
478 .parent = &dpll3_m2_ck,
479 .recalc = &followparent_recalc,
480};
481
482static struct clk dpll3_m2x2_ck = {
483 .name = "dpll3_m2x2_ck",
484 .ops = &clkops_null,
485 .parent = &dpll3_m2_ck,
486 .clkdm_name = "dpll3_clkdm",
487 .recalc = &omap3_clkoutx2_recalc,
488};
489
490/* The PWRDN bit is apparently only available on 3430ES2 and above */
491static const struct clksel div16_dpll3_clksel[] = {
492 { .parent = &dpll3_ck, .rates = div16_dpll_rates },
493 { .parent = NULL }
494};
495
496/* This virtual clock is the source for dpll3_m3x2_ck */
497static struct clk dpll3_m3_ck = {
498 .name = "dpll3_m3_ck",
499 .ops = &clkops_null,
500 .parent = &dpll3_ck,
501 .init = &omap2_init_clksel_parent,
502 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
503 .clksel_mask = OMAP3430_DIV_DPLL3_MASK,
504 .clksel = div16_dpll3_clksel,
505 .clkdm_name = "dpll3_clkdm",
506 .recalc = &omap2_clksel_recalc,
507};
508
509/* The PWRDN bit is apparently only available on 3430ES2 and above */
510static struct clk dpll3_m3x2_ck = {
511 .name = "dpll3_m3x2_ck",
512 .ops = &clkops_omap2_dflt_wait,
513 .parent = &dpll3_m3_ck,
514 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
515 .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT,
516 .flags = INVERT_ENABLE,
517 .clkdm_name = "dpll3_clkdm",
518 .recalc = &omap3_clkoutx2_recalc,
519};
520
521static struct clk emu_core_alwon_ck = {
522 .name = "emu_core_alwon_ck",
523 .ops = &clkops_null,
524 .parent = &dpll3_m3x2_ck,
525 .clkdm_name = "dpll3_clkdm",
526 .recalc = &followparent_recalc,
527};
528
529/* DPLL4 */
530/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
531/* Type: DPLL */
532static struct dpll_data dpll4_dd = {
533 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
534 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
535 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
536 .clk_bypass = &sys_ck,
537 .clk_ref = &sys_ck,
538 .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK,
539 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
540 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
541 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
542 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
543 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
544 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
545 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
546 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
547 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
548 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
549 .max_multiplier = OMAP3_MAX_DPLL_MULT,
550 .min_divider = 1,
551 .max_divider = OMAP3_MAX_DPLL_DIV,
552 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
553};
554
555static struct clk dpll4_ck = {
556 .name = "dpll4_ck",
557 .ops = &clkops_noncore_dpll_ops,
558 .parent = &sys_ck,
559 .dpll_data = &dpll4_dd,
560 .round_rate = &omap2_dpll_round_rate,
561 .set_rate = &omap3_dpll4_set_rate,
562 .clkdm_name = "dpll4_clkdm",
563 .recalc = &omap3_dpll_recalc,
564};
565
566/*
567 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
568 * DPLL isn't bypassed --
569 * XXX does this serve any downstream clocks?
570 */
571static struct clk dpll4_x2_ck = {
572 .name = "dpll4_x2_ck",
573 .ops = &clkops_null,
574 .parent = &dpll4_ck,
575 .clkdm_name = "dpll4_clkdm",
576 .recalc = &omap3_clkoutx2_recalc,
577};
578
579static const struct clksel div16_dpll4_clksel[] = {
580 { .parent = &dpll4_ck, .rates = div16_dpll_rates },
581 { .parent = NULL }
582};
583
584/* This virtual clock is the source for dpll4_m2x2_ck */
585static struct clk dpll4_m2_ck = {
586 .name = "dpll4_m2_ck",
587 .ops = &clkops_null,
588 .parent = &dpll4_ck,
589 .init = &omap2_init_clksel_parent,
590 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3),
591 .clksel_mask = OMAP3430_DIV_96M_MASK,
592 .clksel = div16_dpll4_clksel,
593 .clkdm_name = "dpll4_clkdm",
594 .recalc = &omap2_clksel_recalc,
595};
596
597/* The PWRDN bit is apparently only available on 3430ES2 and above */
598static struct clk dpll4_m2x2_ck = {
599 .name = "dpll4_m2x2_ck",
600 .ops = &clkops_omap2_dflt_wait,
601 .parent = &dpll4_m2_ck,
602 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
603 .enable_bit = OMAP3430_PWRDN_96M_SHIFT,
604 .flags = INVERT_ENABLE,
605 .clkdm_name = "dpll4_clkdm",
606 .recalc = &omap3_clkoutx2_recalc,
607};
608
609/*
610 * DPLL4 generates DPLL4_M2X2_CLK which is then routed into the PRM as
611 * PRM_96M_ALWON_(F)CLK. Two clocks then emerge from the PRM:
612 * 96M_ALWON_FCLK (called "omap_96m_alwon_fck" below) and
613 * CM_96K_(F)CLK.
614 */
615static struct clk omap_96m_alwon_fck = {
616 .name = "omap_96m_alwon_fck",
617 .ops = &clkops_null,
618 .parent = &dpll4_m2x2_ck,
619 .recalc = &followparent_recalc,
620};
621
622static struct clk cm_96m_fck = {
623 .name = "cm_96m_fck",
624 .ops = &clkops_null,
625 .parent = &omap_96m_alwon_fck,
626 .recalc = &followparent_recalc,
627};
628
629static const struct clksel_rate omap_96m_dpll_rates[] = {
630 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
631 { .div = 0 }
632};
633
634static const struct clksel_rate omap_96m_sys_rates[] = {
635 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
636 { .div = 0 }
637};
638
639static const struct clksel omap_96m_fck_clksel[] = {
640 { .parent = &cm_96m_fck, .rates = omap_96m_dpll_rates },
641 { .parent = &sys_ck, .rates = omap_96m_sys_rates },
642 { .parent = NULL }
643};
644
645static struct clk omap_96m_fck = {
646 .name = "omap_96m_fck",
647 .ops = &clkops_null,
648 .parent = &sys_ck,
649 .init = &omap2_init_clksel_parent,
650 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
651 .clksel_mask = OMAP3430_SOURCE_96M_MASK,
652 .clksel = omap_96m_fck_clksel,
653 .recalc = &omap2_clksel_recalc,
654};
655
656/* This virtual clock is the source for dpll4_m3x2_ck */
657static struct clk dpll4_m3_ck = {
658 .name = "dpll4_m3_ck",
659 .ops = &clkops_null,
660 .parent = &dpll4_ck,
661 .init = &omap2_init_clksel_parent,
662 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
663 .clksel_mask = OMAP3430_CLKSEL_TV_MASK,
664 .clksel = div16_dpll4_clksel,
665 .clkdm_name = "dpll4_clkdm",
666 .recalc = &omap2_clksel_recalc,
667};
668
669/* The PWRDN bit is apparently only available on 3430ES2 and above */
670static struct clk dpll4_m3x2_ck = {
671 .name = "dpll4_m3x2_ck",
672 .ops = &clkops_omap2_dflt_wait,
673 .parent = &dpll4_m3_ck,
674 .init = &omap2_init_clksel_parent,
675 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
676 .enable_bit = OMAP3430_PWRDN_TV_SHIFT,
677 .flags = INVERT_ENABLE,
678 .clkdm_name = "dpll4_clkdm",
679 .recalc = &omap3_clkoutx2_recalc,
680};
681
682static const struct clksel_rate omap_54m_d4m3x2_rates[] = {
683 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
684 { .div = 0 }
685};
686
687static const struct clksel_rate omap_54m_alt_rates[] = {
688 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
689 { .div = 0 }
690};
691
692static const struct clksel omap_54m_clksel[] = {
693 { .parent = &dpll4_m3x2_ck, .rates = omap_54m_d4m3x2_rates },
694 { .parent = &sys_altclk, .rates = omap_54m_alt_rates },
695 { .parent = NULL }
696};
697
698static struct clk omap_54m_fck = {
699 .name = "omap_54m_fck",
700 .ops = &clkops_null,
701 .init = &omap2_init_clksel_parent,
702 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
703 .clksel_mask = OMAP3430_SOURCE_54M_MASK,
704 .clksel = omap_54m_clksel,
705 .recalc = &omap2_clksel_recalc,
706};
707
708static const struct clksel_rate omap_48m_cm96m_rates[] = {
709 { .div = 2, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
710 { .div = 0 }
711};
712
713static const struct clksel_rate omap_48m_alt_rates[] = {
714 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
715 { .div = 0 }
716};
717
718static const struct clksel omap_48m_clksel[] = {
719 { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates },
720 { .parent = &sys_altclk, .rates = omap_48m_alt_rates },
721 { .parent = NULL }
722};
723
724static struct clk omap_48m_fck = {
725 .name = "omap_48m_fck",
726 .ops = &clkops_null,
727 .init = &omap2_init_clksel_parent,
728 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
729 .clksel_mask = OMAP3430_SOURCE_48M_MASK,
730 .clksel = omap_48m_clksel,
731 .recalc = &omap2_clksel_recalc,
732};
733
734static struct clk omap_12m_fck = {
735 .name = "omap_12m_fck",
736 .ops = &clkops_null,
737 .parent = &omap_48m_fck,
738 .fixed_div = 4,
739 .recalc = &omap2_fixed_divisor_recalc,
740};
741
742/* This virstual clock is the source for dpll4_m4x2_ck */
743static struct clk dpll4_m4_ck = {
744 .name = "dpll4_m4_ck",
745 .ops = &clkops_null,
746 .parent = &dpll4_ck,
747 .init = &omap2_init_clksel_parent,
748 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
749 .clksel_mask = OMAP3430_CLKSEL_DSS1_MASK,
750 .clksel = div16_dpll4_clksel,
751 .clkdm_name = "dpll4_clkdm",
752 .recalc = &omap2_clksel_recalc,
753 .set_rate = &omap2_clksel_set_rate,
754 .round_rate = &omap2_clksel_round_rate,
755};
756
757/* The PWRDN bit is apparently only available on 3430ES2 and above */
758static struct clk dpll4_m4x2_ck = {
759 .name = "dpll4_m4x2_ck",
760 .ops = &clkops_omap2_dflt_wait,
761 .parent = &dpll4_m4_ck,
762 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
763 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
764 .flags = INVERT_ENABLE,
765 .clkdm_name = "dpll4_clkdm",
766 .recalc = &omap3_clkoutx2_recalc,
767};
768
769/* This virtual clock is the source for dpll4_m5x2_ck */
770static struct clk dpll4_m5_ck = {
771 .name = "dpll4_m5_ck",
772 .ops = &clkops_null,
773 .parent = &dpll4_ck,
774 .init = &omap2_init_clksel_parent,
775 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
776 .clksel_mask = OMAP3430_CLKSEL_CAM_MASK,
777 .clksel = div16_dpll4_clksel,
778 .clkdm_name = "dpll4_clkdm",
779 .recalc = &omap2_clksel_recalc,
780};
781
782/* The PWRDN bit is apparently only available on 3430ES2 and above */
783static struct clk dpll4_m5x2_ck = {
784 .name = "dpll4_m5x2_ck",
785 .ops = &clkops_omap2_dflt_wait,
786 .parent = &dpll4_m5_ck,
787 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
788 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
789 .flags = INVERT_ENABLE,
790 .clkdm_name = "dpll4_clkdm",
791 .recalc = &omap3_clkoutx2_recalc,
792};
793
794/* This virtual clock is the source for dpll4_m6x2_ck */
795static struct clk dpll4_m6_ck = {
796 .name = "dpll4_m6_ck",
797 .ops = &clkops_null,
798 .parent = &dpll4_ck,
799 .init = &omap2_init_clksel_parent,
800 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
801 .clksel_mask = OMAP3430_DIV_DPLL4_MASK,
802 .clksel = div16_dpll4_clksel,
803 .clkdm_name = "dpll4_clkdm",
804 .recalc = &omap2_clksel_recalc,
805};
806
807/* The PWRDN bit is apparently only available on 3430ES2 and above */
808static struct clk dpll4_m6x2_ck = {
809 .name = "dpll4_m6x2_ck",
810 .ops = &clkops_omap2_dflt_wait,
811 .parent = &dpll4_m6_ck,
812 .init = &omap2_init_clksel_parent,
813 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
814 .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
815 .flags = INVERT_ENABLE,
816 .clkdm_name = "dpll4_clkdm",
817 .recalc = &omap3_clkoutx2_recalc,
818};
819
820static struct clk emu_per_alwon_ck = {
821 .name = "emu_per_alwon_ck",
822 .ops = &clkops_null,
823 .parent = &dpll4_m6x2_ck,
824 .clkdm_name = "dpll4_clkdm",
825 .recalc = &followparent_recalc,
826};
827
828/* DPLL5 */
829/* Supplies 120MHz clock, USIM source clock */
830/* Type: DPLL */
831/* 3430ES2 only */
832static struct dpll_data dpll5_dd = {
833 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
834 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
835 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
836 .clk_bypass = &sys_ck,
837 .clk_ref = &sys_ck,
838 .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK,
839 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
840 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
841 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
842 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
843 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
844 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
845 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
846 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
847 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
848 .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK,
849 .max_multiplier = OMAP3_MAX_DPLL_MULT,
850 .min_divider = 1,
851 .max_divider = OMAP3_MAX_DPLL_DIV,
852 .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE
853};
854
855static struct clk dpll5_ck = {
856 .name = "dpll5_ck",
857 .ops = &clkops_noncore_dpll_ops,
858 .parent = &sys_ck,
859 .dpll_data = &dpll5_dd,
860 .round_rate = &omap2_dpll_round_rate,
861 .set_rate = &omap3_noncore_dpll_set_rate,
862 .clkdm_name = "dpll5_clkdm",
863 .recalc = &omap3_dpll_recalc,
864};
865
866static const struct clksel div16_dpll5_clksel[] = {
867 { .parent = &dpll5_ck, .rates = div16_dpll_rates },
868 { .parent = NULL }
869};
870
871static struct clk dpll5_m2_ck = {
872 .name = "dpll5_m2_ck",
873 .ops = &clkops_null,
874 .parent = &dpll5_ck,
875 .init = &omap2_init_clksel_parent,
876 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
877 .clksel_mask = OMAP3430ES2_DIV_120M_MASK,
878 .clksel = div16_dpll5_clksel,
879 .clkdm_name = "dpll5_clkdm",
880 .recalc = &omap2_clksel_recalc,
881};
882
883/* CM EXTERNAL CLOCK OUTPUTS */
884
885static const struct clksel_rate clkout2_src_core_rates[] = {
886 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
887 { .div = 0 }
888};
889
890static const struct clksel_rate clkout2_src_sys_rates[] = {
891 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
892 { .div = 0 }
893};
894
895static const struct clksel_rate clkout2_src_96m_rates[] = {
896 { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE },
897 { .div = 0 }
898};
899
900static const struct clksel_rate clkout2_src_54m_rates[] = {
901 { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
902 { .div = 0 }
903};
904
905static const struct clksel clkout2_src_clksel[] = {
906 { .parent = &core_ck, .rates = clkout2_src_core_rates },
907 { .parent = &sys_ck, .rates = clkout2_src_sys_rates },
908 { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates },
909 { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates },
910 { .parent = NULL }
911};
912
913static struct clk clkout2_src_ck = {
914 .name = "clkout2_src_ck",
915 .ops = &clkops_omap2_dflt,
916 .init = &omap2_init_clksel_parent,
917 .enable_reg = OMAP3430_CM_CLKOUT_CTRL,
918 .enable_bit = OMAP3430_CLKOUT2_EN_SHIFT,
919 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
920 .clksel_mask = OMAP3430_CLKOUT2SOURCE_MASK,
921 .clksel = clkout2_src_clksel,
922 .clkdm_name = "core_clkdm",
923 .recalc = &omap2_clksel_recalc,
924};
925
926static const struct clksel_rate sys_clkout2_rates[] = {
927 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
928 { .div = 2, .val = 1, .flags = RATE_IN_343X },
929 { .div = 4, .val = 2, .flags = RATE_IN_343X },
930 { .div = 8, .val = 3, .flags = RATE_IN_343X },
931 { .div = 16, .val = 4, .flags = RATE_IN_343X },
932 { .div = 0 },
933};
934
935static const struct clksel sys_clkout2_clksel[] = {
936 { .parent = &clkout2_src_ck, .rates = sys_clkout2_rates },
937 { .parent = NULL },
938};
939
940static struct clk sys_clkout2 = {
941 .name = "sys_clkout2",
942 .ops = &clkops_null,
943 .init = &omap2_init_clksel_parent,
944 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
945 .clksel_mask = OMAP3430_CLKOUT2_DIV_MASK,
946 .clksel = sys_clkout2_clksel,
947 .recalc = &omap2_clksel_recalc,
948};
949
950/* CM OUTPUT CLOCKS */
951
952static struct clk corex2_fck = {
953 .name = "corex2_fck",
954 .ops = &clkops_null,
955 .parent = &dpll3_m2x2_ck,
956 .recalc = &followparent_recalc,
957};
958
959/* DPLL power domain clock controls */
960
961static const struct clksel_rate div4_rates[] = {
962 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
963 { .div = 2, .val = 2, .flags = RATE_IN_343X },
964 { .div = 4, .val = 4, .flags = RATE_IN_343X },
965 { .div = 0 }
966};
967
968static const struct clksel div4_core_clksel[] = {
969 { .parent = &core_ck, .rates = div4_rates },
970 { .parent = NULL }
971};
972
973/*
974 * REVISIT: Are these in DPLL power domain or CM power domain? docs
975 * may be inconsistent here?
976 */
977static struct clk dpll1_fck = {
978 .name = "dpll1_fck",
979 .ops = &clkops_null,
980 .parent = &core_ck,
981 .init = &omap2_init_clksel_parent,
982 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
983 .clksel_mask = OMAP3430_MPU_CLK_SRC_MASK,
984 .clksel = div4_core_clksel,
985 .recalc = &omap2_clksel_recalc,
986};
987
988static struct clk mpu_ck = {
989 .name = "mpu_ck",
990 .ops = &clkops_null,
991 .parent = &dpll1_x2m2_ck,
992 .clkdm_name = "mpu_clkdm",
993 .recalc = &followparent_recalc,
994};
995
996/* arm_fck is divided by two when DPLL1 locked; otherwise, passthrough mpu_ck */
997static const struct clksel_rate arm_fck_rates[] = {
998 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
999 { .div = 2, .val = 1, .flags = RATE_IN_343X },
1000 { .div = 0 },
1001};
1002
1003static const struct clksel arm_fck_clksel[] = {
1004 { .parent = &mpu_ck, .rates = arm_fck_rates },
1005 { .parent = NULL }
1006};
1007
1008static struct clk arm_fck = {
1009 .name = "arm_fck",
1010 .ops = &clkops_null,
1011 .parent = &mpu_ck,
1012 .init = &omap2_init_clksel_parent,
1013 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
1014 .clksel_mask = OMAP3430_ST_MPU_CLK_MASK,
1015 .clksel = arm_fck_clksel,
1016 .clkdm_name = "mpu_clkdm",
1017 .recalc = &omap2_clksel_recalc,
1018};
1019
1020/* XXX What about neon_clkdm ? */
1021
1022/*
1023 * REVISIT: This clock is never specifically defined in the 3430 TRM,
1024 * although it is referenced - so this is a guess
1025 */
1026static struct clk emu_mpu_alwon_ck = {
1027 .name = "emu_mpu_alwon_ck",
1028 .ops = &clkops_null,
1029 .parent = &mpu_ck,
1030 .recalc = &followparent_recalc,
1031};
1032
1033static struct clk dpll2_fck = {
1034 .name = "dpll2_fck",
1035 .ops = &clkops_null,
1036 .parent = &core_ck,
1037 .init = &omap2_init_clksel_parent,
1038 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
1039 .clksel_mask = OMAP3430_IVA2_CLK_SRC_MASK,
1040 .clksel = div4_core_clksel,
1041 .recalc = &omap2_clksel_recalc,
1042};
1043
1044static struct clk iva2_ck = {
1045 .name = "iva2_ck",
1046 .ops = &clkops_omap2_dflt_wait,
1047 .parent = &dpll2_m2_ck,
1048 .init = &omap2_init_clksel_parent,
1049 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1050 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1051 .clkdm_name = "iva2_clkdm",
1052 .recalc = &followparent_recalc,
1053};
1054
1055/* Common interface clocks */
1056
1057static const struct clksel div2_core_clksel[] = {
1058 { .parent = &core_ck, .rates = div2_rates },
1059 { .parent = NULL }
1060};
1061
1062static struct clk l3_ick = {
1063 .name = "l3_ick",
1064 .ops = &clkops_null,
1065 .parent = &core_ck,
1066 .init = &omap2_init_clksel_parent,
1067 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1068 .clksel_mask = OMAP3430_CLKSEL_L3_MASK,
1069 .clksel = div2_core_clksel,
1070 .clkdm_name = "core_l3_clkdm",
1071 .recalc = &omap2_clksel_recalc,
1072};
1073
1074static const struct clksel div2_l3_clksel[] = {
1075 { .parent = &l3_ick, .rates = div2_rates },
1076 { .parent = NULL }
1077};
1078
1079static struct clk l4_ick = {
1080 .name = "l4_ick",
1081 .ops = &clkops_null,
1082 .parent = &l3_ick,
1083 .init = &omap2_init_clksel_parent,
1084 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1085 .clksel_mask = OMAP3430_CLKSEL_L4_MASK,
1086 .clksel = div2_l3_clksel,
1087 .clkdm_name = "core_l4_clkdm",
1088 .recalc = &omap2_clksel_recalc,
1089
1090};
1091
1092static const struct clksel div2_l4_clksel[] = {
1093 { .parent = &l4_ick, .rates = div2_rates },
1094 { .parent = NULL }
1095};
1096
1097static struct clk rm_ick = {
1098 .name = "rm_ick",
1099 .ops = &clkops_null,
1100 .parent = &l4_ick,
1101 .init = &omap2_init_clksel_parent,
1102 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
1103 .clksel_mask = OMAP3430_CLKSEL_RM_MASK,
1104 .clksel = div2_l4_clksel,
1105 .recalc = &omap2_clksel_recalc,
1106};
1107
1108/* GFX power domain */
1109
1110/* GFX clocks are in 3430ES1 only. 3430ES2 and later uses the SGX instead */
1111
1112static const struct clksel gfx_l3_clksel[] = {
1113 { .parent = &l3_ick, .rates = gfx_l3_rates },
1114 { .parent = NULL }
1115};
1116
1117/* Virtual parent clock for gfx_l3_ick and gfx_l3_fck */
1118static struct clk gfx_l3_ck = {
1119 .name = "gfx_l3_ck",
1120 .ops = &clkops_omap2_dflt_wait,
1121 .parent = &l3_ick,
1122 .init = &omap2_init_clksel_parent,
1123 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
1124 .enable_bit = OMAP_EN_GFX_SHIFT,
1125 .recalc = &followparent_recalc,
1126};
1127
1128static struct clk gfx_l3_fck = {
1129 .name = "gfx_l3_fck",
1130 .ops = &clkops_null,
1131 .parent = &gfx_l3_ck,
1132 .init = &omap2_init_clksel_parent,
1133 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
1134 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
1135 .clksel = gfx_l3_clksel,
1136 .clkdm_name = "gfx_3430es1_clkdm",
1137 .recalc = &omap2_clksel_recalc,
1138};
1139
1140static struct clk gfx_l3_ick = {
1141 .name = "gfx_l3_ick",
1142 .ops = &clkops_null,
1143 .parent = &gfx_l3_ck,
1144 .clkdm_name = "gfx_3430es1_clkdm",
1145 .recalc = &followparent_recalc,
1146};
1147
1148static struct clk gfx_cg1_ck = {
1149 .name = "gfx_cg1_ck",
1150 .ops = &clkops_omap2_dflt_wait,
1151 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1152 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1153 .enable_bit = OMAP3430ES1_EN_2D_SHIFT,
1154 .clkdm_name = "gfx_3430es1_clkdm",
1155 .recalc = &followparent_recalc,
1156};
1157
1158static struct clk gfx_cg2_ck = {
1159 .name = "gfx_cg2_ck",
1160 .ops = &clkops_omap2_dflt_wait,
1161 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1162 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1163 .enable_bit = OMAP3430ES1_EN_3D_SHIFT,
1164 .clkdm_name = "gfx_3430es1_clkdm",
1165 .recalc = &followparent_recalc,
1166};
1167
1168/* SGX power domain - 3430ES2 only */
1169
1170static const struct clksel_rate sgx_core_rates[] = {
1171 { .div = 3, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
1172 { .div = 4, .val = 1, .flags = RATE_IN_343X },
1173 { .div = 6, .val = 2, .flags = RATE_IN_343X },
1174 { .div = 0 },
1175};
1176
1177static const struct clksel_rate sgx_96m_rates[] = {
1178 { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
1179 { .div = 0 },
1180};
1181
1182static const struct clksel sgx_clksel[] = {
1183 { .parent = &core_ck, .rates = sgx_core_rates },
1184 { .parent = &cm_96m_fck, .rates = sgx_96m_rates },
1185 { .parent = NULL },
1186};
1187
1188static struct clk sgx_fck = {
1189 .name = "sgx_fck",
1190 .ops = &clkops_omap2_dflt_wait,
1191 .init = &omap2_init_clksel_parent,
1192 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN),
1193 .enable_bit = OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT,
1194 .clksel_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL),
1195 .clksel_mask = OMAP3430ES2_CLKSEL_SGX_MASK,
1196 .clksel = sgx_clksel,
1197 .clkdm_name = "sgx_clkdm",
1198 .recalc = &omap2_clksel_recalc,
1199};
1200
1201static struct clk sgx_ick = {
1202 .name = "sgx_ick",
1203 .ops = &clkops_omap2_dflt_wait,
1204 .parent = &l3_ick,
1205 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN),
1206 .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT,
1207 .clkdm_name = "sgx_clkdm",
1208 .recalc = &followparent_recalc,
1209};
1210
1211/* CORE power domain */
1212
1213static struct clk d2d_26m_fck = {
1214 .name = "d2d_26m_fck",
1215 .ops = &clkops_omap2_dflt_wait,
1216 .parent = &sys_ck,
1217 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1218 .enable_bit = OMAP3430ES1_EN_D2D_SHIFT,
1219 .clkdm_name = "d2d_clkdm",
1220 .recalc = &followparent_recalc,
1221};
1222
1223static struct clk modem_fck = {
1224 .name = "modem_fck",
1225 .ops = &clkops_omap2_dflt_wait,
1226 .parent = &sys_ck,
1227 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1228 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
1229 .clkdm_name = "d2d_clkdm",
1230 .recalc = &followparent_recalc,
1231};
1232
1233static struct clk sad2d_ick = {
1234 .name = "sad2d_ick",
1235 .ops = &clkops_omap2_dflt_wait,
1236 .parent = &l3_ick,
1237 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1238 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
1239 .clkdm_name = "d2d_clkdm",
1240 .recalc = &followparent_recalc,
1241};
1242
1243static struct clk mad2d_ick = {
1244 .name = "mad2d_ick",
1245 .ops = &clkops_omap2_dflt_wait,
1246 .parent = &l3_ick,
1247 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1248 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
1249 .clkdm_name = "d2d_clkdm",
1250 .recalc = &followparent_recalc,
1251};
1252
1253static const struct clksel omap343x_gpt_clksel[] = {
1254 { .parent = &omap_32k_fck, .rates = gpt_32k_rates },
1255 { .parent = &sys_ck, .rates = gpt_sys_rates },
1256 { .parent = NULL}
1257};
1258
1259static struct clk gpt10_fck = {
1260 .name = "gpt10_fck",
1261 .ops = &clkops_omap2_dflt_wait,
1262 .parent = &sys_ck,
1263 .init = &omap2_init_clksel_parent,
1264 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1265 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1266 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1267 .clksel_mask = OMAP3430_CLKSEL_GPT10_MASK,
1268 .clksel = omap343x_gpt_clksel,
1269 .clkdm_name = "core_l4_clkdm",
1270 .recalc = &omap2_clksel_recalc,
1271};
1272
1273static struct clk gpt11_fck = {
1274 .name = "gpt11_fck",
1275 .ops = &clkops_omap2_dflt_wait,
1276 .parent = &sys_ck,
1277 .init = &omap2_init_clksel_parent,
1278 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1279 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1280 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1281 .clksel_mask = OMAP3430_CLKSEL_GPT11_MASK,
1282 .clksel = omap343x_gpt_clksel,
1283 .clkdm_name = "core_l4_clkdm",
1284 .recalc = &omap2_clksel_recalc,
1285};
1286
1287static struct clk cpefuse_fck = {
1288 .name = "cpefuse_fck",
1289 .ops = &clkops_omap2_dflt,
1290 .parent = &sys_ck,
1291 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1292 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
1293 .recalc = &followparent_recalc,
1294};
1295
1296static struct clk ts_fck = {
1297 .name = "ts_fck",
1298 .ops = &clkops_omap2_dflt,
1299 .parent = &omap_32k_fck,
1300 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1301 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
1302 .recalc = &followparent_recalc,
1303};
1304
1305static struct clk usbtll_fck = {
1306 .name = "usbtll_fck",
1307 .ops = &clkops_omap2_dflt,
1308 .parent = &dpll5_m2_ck,
1309 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1310 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1311 .recalc = &followparent_recalc,
1312};
1313
1314/* CORE 96M FCLK-derived clocks */
1315
1316static struct clk core_96m_fck = {
1317 .name = "core_96m_fck",
1318 .ops = &clkops_null,
1319 .parent = &omap_96m_fck,
1320 .clkdm_name = "core_l4_clkdm",
1321 .recalc = &followparent_recalc,
1322};
1323
1324static struct clk mmchs3_fck = {
1325 .name = "mmchs_fck",
1326 .ops = &clkops_omap2_dflt_wait,
1327 .id = 2,
1328 .parent = &core_96m_fck,
1329 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1330 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1331 .clkdm_name = "core_l4_clkdm",
1332 .recalc = &followparent_recalc,
1333};
1334
1335static struct clk mmchs2_fck = {
1336 .name = "mmchs_fck",
1337 .ops = &clkops_omap2_dflt_wait,
1338 .id = 1,
1339 .parent = &core_96m_fck,
1340 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1341 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1342 .clkdm_name = "core_l4_clkdm",
1343 .recalc = &followparent_recalc,
1344};
1345
1346static struct clk mspro_fck = {
1347 .name = "mspro_fck",
1348 .ops = &clkops_omap2_dflt_wait,
1349 .parent = &core_96m_fck,
1350 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1351 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1352 .clkdm_name = "core_l4_clkdm",
1353 .recalc = &followparent_recalc,
1354};
1355
1356static struct clk mmchs1_fck = {
1357 .name = "mmchs_fck",
1358 .ops = &clkops_omap2_dflt_wait,
1359 .parent = &core_96m_fck,
1360 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1361 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1362 .clkdm_name = "core_l4_clkdm",
1363 .recalc = &followparent_recalc,
1364};
1365
1366static struct clk i2c3_fck = {
1367 .name = "i2c_fck",
1368 .ops = &clkops_omap2_dflt_wait,
1369 .id = 3,
1370 .parent = &core_96m_fck,
1371 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1372 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1373 .clkdm_name = "core_l4_clkdm",
1374 .recalc = &followparent_recalc,
1375};
1376
1377static struct clk i2c2_fck = {
1378 .name = "i2c_fck",
1379 .ops = &clkops_omap2_dflt_wait,
1380 .id = 2,
1381 .parent = &core_96m_fck,
1382 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1383 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1384 .clkdm_name = "core_l4_clkdm",
1385 .recalc = &followparent_recalc,
1386};
1387
1388static struct clk i2c1_fck = {
1389 .name = "i2c_fck",
1390 .ops = &clkops_omap2_dflt_wait,
1391 .id = 1,
1392 .parent = &core_96m_fck,
1393 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1394 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1395 .clkdm_name = "core_l4_clkdm",
1396 .recalc = &followparent_recalc,
1397};
1398
1399/*
1400 * MCBSP 1 & 5 get their 96MHz clock from core_96m_fck;
1401 * MCBSP 2, 3, 4 get their 96MHz clock from per_96m_fck.
1402 */
1403static const struct clksel_rate common_mcbsp_96m_rates[] = {
1404 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
1405 { .div = 0 }
1406};
1407
1408static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1409 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
1410 { .div = 0 }
1411};
1412
1413static const struct clksel mcbsp_15_clksel[] = {
1414 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
1415 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1416 { .parent = NULL }
1417};
1418
1419static struct clk mcbsp5_fck = {
1420 .name = "mcbsp_fck",
1421 .ops = &clkops_omap2_dflt_wait,
1422 .id = 5,
1423 .init = &omap2_init_clksel_parent,
1424 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1425 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1426 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
1427 .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
1428 .clksel = mcbsp_15_clksel,
1429 .clkdm_name = "core_l4_clkdm",
1430 .recalc = &omap2_clksel_recalc,
1431};
1432
1433static struct clk mcbsp1_fck = {
1434 .name = "mcbsp_fck",
1435 .ops = &clkops_omap2_dflt_wait,
1436 .id = 1,
1437 .init = &omap2_init_clksel_parent,
1438 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1439 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
1440 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1441 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1442 .clksel = mcbsp_15_clksel,
1443 .clkdm_name = "core_l4_clkdm",
1444 .recalc = &omap2_clksel_recalc,
1445};
1446
1447/* CORE_48M_FCK-derived clocks */
1448
1449static struct clk core_48m_fck = {
1450 .name = "core_48m_fck",
1451 .ops = &clkops_null,
1452 .parent = &omap_48m_fck,
1453 .clkdm_name = "core_l4_clkdm",
1454 .recalc = &followparent_recalc,
1455};
1456
1457static struct clk mcspi4_fck = {
1458 .name = "mcspi_fck",
1459 .ops = &clkops_omap2_dflt_wait,
1460 .id = 4,
1461 .parent = &core_48m_fck,
1462 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1463 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1464 .recalc = &followparent_recalc,
1465};
1466
1467static struct clk mcspi3_fck = {
1468 .name = "mcspi_fck",
1469 .ops = &clkops_omap2_dflt_wait,
1470 .id = 3,
1471 .parent = &core_48m_fck,
1472 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1473 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1474 .recalc = &followparent_recalc,
1475};
1476
1477static struct clk mcspi2_fck = {
1478 .name = "mcspi_fck",
1479 .ops = &clkops_omap2_dflt_wait,
1480 .id = 2,
1481 .parent = &core_48m_fck,
1482 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1483 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1484 .recalc = &followparent_recalc,
1485};
1486
1487static struct clk mcspi1_fck = {
1488 .name = "mcspi_fck",
1489 .ops = &clkops_omap2_dflt_wait,
1490 .id = 1,
1491 .parent = &core_48m_fck,
1492 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1493 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1494 .recalc = &followparent_recalc,
1495};
1496
1497static struct clk uart2_fck = {
1498 .name = "uart2_fck",
1499 .ops = &clkops_omap2_dflt_wait,
1500 .parent = &core_48m_fck,
1501 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1502 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1503 .recalc = &followparent_recalc,
1504};
1505
1506static struct clk uart1_fck = {
1507 .name = "uart1_fck",
1508 .ops = &clkops_omap2_dflt_wait,
1509 .parent = &core_48m_fck,
1510 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1511 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1512 .recalc = &followparent_recalc,
1513};
1514
1515static struct clk fshostusb_fck = {
1516 .name = "fshostusb_fck",
1517 .ops = &clkops_omap2_dflt_wait,
1518 .parent = &core_48m_fck,
1519 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1520 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1521 .recalc = &followparent_recalc,
1522};
1523
1524/* CORE_12M_FCK based clocks */
1525
1526static struct clk core_12m_fck = {
1527 .name = "core_12m_fck",
1528 .ops = &clkops_null,
1529 .parent = &omap_12m_fck,
1530 .clkdm_name = "core_l4_clkdm",
1531 .recalc = &followparent_recalc,
1532};
1533
1534static struct clk hdq_fck = {
1535 .name = "hdq_fck",
1536 .ops = &clkops_omap2_dflt_wait,
1537 .parent = &core_12m_fck,
1538 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1539 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1540 .recalc = &followparent_recalc,
1541};
1542
1543/* DPLL3-derived clock */
1544
1545static const struct clksel_rate ssi_ssr_corex2_rates[] = {
1546 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
1547 { .div = 2, .val = 2, .flags = RATE_IN_343X },
1548 { .div = 3, .val = 3, .flags = RATE_IN_343X },
1549 { .div = 4, .val = 4, .flags = RATE_IN_343X },
1550 { .div = 6, .val = 6, .flags = RATE_IN_343X },
1551 { .div = 8, .val = 8, .flags = RATE_IN_343X },
1552 { .div = 0 }
1553};
1554
1555static const struct clksel ssi_ssr_clksel[] = {
1556 { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates },
1557 { .parent = NULL }
1558};
1559
1560static struct clk ssi_ssr_fck_3430es1 = {
1561 .name = "ssi_ssr_fck",
1562 .ops = &clkops_omap2_dflt,
1563 .init = &omap2_init_clksel_parent,
1564 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1565 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1566 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1567 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1568 .clksel = ssi_ssr_clksel,
1569 .clkdm_name = "core_l4_clkdm",
1570 .recalc = &omap2_clksel_recalc,
1571};
1572
1573static struct clk ssi_ssr_fck_3430es2 = {
1574 .name = "ssi_ssr_fck",
1575 .ops = &clkops_omap3430es2_ssi_wait,
1576 .init = &omap2_init_clksel_parent,
1577 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1578 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1579 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1580 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1581 .clksel = ssi_ssr_clksel,
1582 .clkdm_name = "core_l4_clkdm",
1583 .recalc = &omap2_clksel_recalc,
1584};
1585
1586static struct clk ssi_sst_fck_3430es1 = {
1587 .name = "ssi_sst_fck",
1588 .ops = &clkops_null,
1589 .parent = &ssi_ssr_fck_3430es1,
1590 .fixed_div = 2,
1591 .recalc = &omap2_fixed_divisor_recalc,
1592};
1593
1594static struct clk ssi_sst_fck_3430es2 = {
1595 .name = "ssi_sst_fck",
1596 .ops = &clkops_null,
1597 .parent = &ssi_ssr_fck_3430es2,
1598 .fixed_div = 2,
1599 .recalc = &omap2_fixed_divisor_recalc,
1600};
1601
1602
1603
1604/* CORE_L3_ICK based clocks */
1605
1606/*
1607 * XXX must add clk_enable/clk_disable for these if standard code won't
1608 * handle it
1609 */
1610static struct clk core_l3_ick = {
1611 .name = "core_l3_ick",
1612 .ops = &clkops_null,
1613 .parent = &l3_ick,
1614 .clkdm_name = "core_l3_clkdm",
1615 .recalc = &followparent_recalc,
1616};
1617
1618static struct clk hsotgusb_ick_3430es1 = {
1619 .name = "hsotgusb_ick",
1620 .ops = &clkops_omap2_dflt,
1621 .parent = &core_l3_ick,
1622 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1623 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1624 .clkdm_name = "core_l3_clkdm",
1625 .recalc = &followparent_recalc,
1626};
1627
1628static struct clk hsotgusb_ick_3430es2 = {
1629 .name = "hsotgusb_ick",
1630 .ops = &clkops_omap3430es2_hsotgusb_wait,
1631 .parent = &core_l3_ick,
1632 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1633 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1634 .clkdm_name = "core_l3_clkdm",
1635 .recalc = &followparent_recalc,
1636};
1637
1638static struct clk sdrc_ick = {
1639 .name = "sdrc_ick",
1640 .ops = &clkops_omap2_dflt_wait,
1641 .parent = &core_l3_ick,
1642 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1643 .enable_bit = OMAP3430_EN_SDRC_SHIFT,
1644 .flags = ENABLE_ON_INIT,
1645 .clkdm_name = "core_l3_clkdm",
1646 .recalc = &followparent_recalc,
1647};
1648
1649static struct clk gpmc_fck = {
1650 .name = "gpmc_fck",
1651 .ops = &clkops_null,
1652 .parent = &core_l3_ick,
1653 .flags = ENABLE_ON_INIT, /* huh? */
1654 .clkdm_name = "core_l3_clkdm",
1655 .recalc = &followparent_recalc,
1656};
1657
1658/* SECURITY_L3_ICK based clocks */
1659
1660static struct clk security_l3_ick = {
1661 .name = "security_l3_ick",
1662 .ops = &clkops_null,
1663 .parent = &l3_ick,
1664 .recalc = &followparent_recalc,
1665};
1666
1667static struct clk pka_ick = {
1668 .name = "pka_ick",
1669 .ops = &clkops_omap2_dflt_wait,
1670 .parent = &security_l3_ick,
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1672 .enable_bit = OMAP3430_EN_PKA_SHIFT,
1673 .recalc = &followparent_recalc,
1674};
1675
1676/* CORE_L4_ICK based clocks */
1677
1678static struct clk core_l4_ick = {
1679 .name = "core_l4_ick",
1680 .ops = &clkops_null,
1681 .parent = &l4_ick,
1682 .clkdm_name = "core_l4_clkdm",
1683 .recalc = &followparent_recalc,
1684};
1685
1686static struct clk usbtll_ick = {
1687 .name = "usbtll_ick",
1688 .ops = &clkops_omap2_dflt_wait,
1689 .parent = &core_l4_ick,
1690 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1691 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1692 .clkdm_name = "core_l4_clkdm",
1693 .recalc = &followparent_recalc,
1694};
1695
1696static struct clk mmchs3_ick = {
1697 .name = "mmchs_ick",
1698 .ops = &clkops_omap2_dflt_wait,
1699 .id = 2,
1700 .parent = &core_l4_ick,
1701 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1702 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1703 .clkdm_name = "core_l4_clkdm",
1704 .recalc = &followparent_recalc,
1705};
1706
1707/* Intersystem Communication Registers - chassis mode only */
1708static struct clk icr_ick = {
1709 .name = "icr_ick",
1710 .ops = &clkops_omap2_dflt_wait,
1711 .parent = &core_l4_ick,
1712 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1713 .enable_bit = OMAP3430_EN_ICR_SHIFT,
1714 .clkdm_name = "core_l4_clkdm",
1715 .recalc = &followparent_recalc,
1716};
1717
1718static struct clk aes2_ick = {
1719 .name = "aes2_ick",
1720 .ops = &clkops_omap2_dflt_wait,
1721 .parent = &core_l4_ick,
1722 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1723 .enable_bit = OMAP3430_EN_AES2_SHIFT,
1724 .clkdm_name = "core_l4_clkdm",
1725 .recalc = &followparent_recalc,
1726};
1727
1728static struct clk sha12_ick = {
1729 .name = "sha12_ick",
1730 .ops = &clkops_omap2_dflt_wait,
1731 .parent = &core_l4_ick,
1732 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1733 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
1734 .clkdm_name = "core_l4_clkdm",
1735 .recalc = &followparent_recalc,
1736};
1737
1738static struct clk des2_ick = {
1739 .name = "des2_ick",
1740 .ops = &clkops_omap2_dflt_wait,
1741 .parent = &core_l4_ick,
1742 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1743 .enable_bit = OMAP3430_EN_DES2_SHIFT,
1744 .clkdm_name = "core_l4_clkdm",
1745 .recalc = &followparent_recalc,
1746};
1747
1748static struct clk mmchs2_ick = {
1749 .name = "mmchs_ick",
1750 .ops = &clkops_omap2_dflt_wait,
1751 .id = 1,
1752 .parent = &core_l4_ick,
1753 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1754 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1755 .clkdm_name = "core_l4_clkdm",
1756 .recalc = &followparent_recalc,
1757};
1758
1759static struct clk mmchs1_ick = {
1760 .name = "mmchs_ick",
1761 .ops = &clkops_omap2_dflt_wait,
1762 .parent = &core_l4_ick,
1763 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1764 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1765 .clkdm_name = "core_l4_clkdm",
1766 .recalc = &followparent_recalc,
1767};
1768
1769static struct clk mspro_ick = {
1770 .name = "mspro_ick",
1771 .ops = &clkops_omap2_dflt_wait,
1772 .parent = &core_l4_ick,
1773 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1774 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1775 .clkdm_name = "core_l4_clkdm",
1776 .recalc = &followparent_recalc,
1777};
1778
1779static struct clk hdq_ick = {
1780 .name = "hdq_ick",
1781 .ops = &clkops_omap2_dflt_wait,
1782 .parent = &core_l4_ick,
1783 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1784 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1785 .clkdm_name = "core_l4_clkdm",
1786 .recalc = &followparent_recalc,
1787};
1788
1789static struct clk mcspi4_ick = {
1790 .name = "mcspi_ick",
1791 .ops = &clkops_omap2_dflt_wait,
1792 .id = 4,
1793 .parent = &core_l4_ick,
1794 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1795 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1796 .clkdm_name = "core_l4_clkdm",
1797 .recalc = &followparent_recalc,
1798};
1799
1800static struct clk mcspi3_ick = {
1801 .name = "mcspi_ick",
1802 .ops = &clkops_omap2_dflt_wait,
1803 .id = 3,
1804 .parent = &core_l4_ick,
1805 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1806 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1807 .clkdm_name = "core_l4_clkdm",
1808 .recalc = &followparent_recalc,
1809};
1810
1811static struct clk mcspi2_ick = {
1812 .name = "mcspi_ick",
1813 .ops = &clkops_omap2_dflt_wait,
1814 .id = 2,
1815 .parent = &core_l4_ick,
1816 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1817 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1818 .clkdm_name = "core_l4_clkdm",
1819 .recalc = &followparent_recalc,
1820};
1821
1822static struct clk mcspi1_ick = {
1823 .name = "mcspi_ick",
1824 .ops = &clkops_omap2_dflt_wait,
1825 .id = 1,
1826 .parent = &core_l4_ick,
1827 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1828 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1829 .clkdm_name = "core_l4_clkdm",
1830 .recalc = &followparent_recalc,
1831};
1832
1833static struct clk i2c3_ick = {
1834 .name = "i2c_ick",
1835 .ops = &clkops_omap2_dflt_wait,
1836 .id = 3,
1837 .parent = &core_l4_ick,
1838 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1839 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1840 .clkdm_name = "core_l4_clkdm",
1841 .recalc = &followparent_recalc,
1842};
1843
1844static struct clk i2c2_ick = {
1845 .name = "i2c_ick",
1846 .ops = &clkops_omap2_dflt_wait,
1847 .id = 2,
1848 .parent = &core_l4_ick,
1849 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1850 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1851 .clkdm_name = "core_l4_clkdm",
1852 .recalc = &followparent_recalc,
1853};
1854
1855static struct clk i2c1_ick = {
1856 .name = "i2c_ick",
1857 .ops = &clkops_omap2_dflt_wait,
1858 .id = 1,
1859 .parent = &core_l4_ick,
1860 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1861 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1862 .clkdm_name = "core_l4_clkdm",
1863 .recalc = &followparent_recalc,
1864};
1865
1866static struct clk uart2_ick = {
1867 .name = "uart2_ick",
1868 .ops = &clkops_omap2_dflt_wait,
1869 .parent = &core_l4_ick,
1870 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1871 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1872 .clkdm_name = "core_l4_clkdm",
1873 .recalc = &followparent_recalc,
1874};
1875
1876static struct clk uart1_ick = {
1877 .name = "uart1_ick",
1878 .ops = &clkops_omap2_dflt_wait,
1879 .parent = &core_l4_ick,
1880 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1881 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1882 .clkdm_name = "core_l4_clkdm",
1883 .recalc = &followparent_recalc,
1884};
1885
1886static struct clk gpt11_ick = {
1887 .name = "gpt11_ick",
1888 .ops = &clkops_omap2_dflt_wait,
1889 .parent = &core_l4_ick,
1890 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1891 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1892 .clkdm_name = "core_l4_clkdm",
1893 .recalc = &followparent_recalc,
1894};
1895
1896static struct clk gpt10_ick = {
1897 .name = "gpt10_ick",
1898 .ops = &clkops_omap2_dflt_wait,
1899 .parent = &core_l4_ick,
1900 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1901 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1902 .clkdm_name = "core_l4_clkdm",
1903 .recalc = &followparent_recalc,
1904};
1905
1906static struct clk mcbsp5_ick = {
1907 .name = "mcbsp_ick",
1908 .ops = &clkops_omap2_dflt_wait,
1909 .id = 5,
1910 .parent = &core_l4_ick,
1911 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1912 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1913 .clkdm_name = "core_l4_clkdm",
1914 .recalc = &followparent_recalc,
1915};
1916
1917static struct clk mcbsp1_ick = {
1918 .name = "mcbsp_ick",
1919 .ops = &clkops_omap2_dflt_wait,
1920 .id = 1,
1921 .parent = &core_l4_ick,
1922 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1923 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
1924 .clkdm_name = "core_l4_clkdm",
1925 .recalc = &followparent_recalc,
1926};
1927
1928static struct clk fac_ick = {
1929 .name = "fac_ick",
1930 .ops = &clkops_omap2_dflt_wait,
1931 .parent = &core_l4_ick,
1932 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1933 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
1934 .clkdm_name = "core_l4_clkdm",
1935 .recalc = &followparent_recalc,
1936};
1937
1938static struct clk mailboxes_ick = {
1939 .name = "mailboxes_ick",
1940 .ops = &clkops_omap2_dflt_wait,
1941 .parent = &core_l4_ick,
1942 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1943 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
1944 .clkdm_name = "core_l4_clkdm",
1945 .recalc = &followparent_recalc,
1946};
1947
1948static struct clk omapctrl_ick = {
1949 .name = "omapctrl_ick",
1950 .ops = &clkops_omap2_dflt_wait,
1951 .parent = &core_l4_ick,
1952 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1953 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
1954 .flags = ENABLE_ON_INIT,
1955 .recalc = &followparent_recalc,
1956};
1957
1958/* SSI_L4_ICK based clocks */
1959
1960static struct clk ssi_l4_ick = {
1961 .name = "ssi_l4_ick",
1962 .ops = &clkops_null,
1963 .parent = &l4_ick,
1964 .clkdm_name = "core_l4_clkdm",
1965 .recalc = &followparent_recalc,
1966};
1967
1968static struct clk ssi_ick_3430es1 = {
1969 .name = "ssi_ick",
1970 .ops = &clkops_omap2_dflt,
1971 .parent = &ssi_l4_ick,
1972 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1973 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1974 .clkdm_name = "core_l4_clkdm",
1975 .recalc = &followparent_recalc,
1976};
1977
1978static struct clk ssi_ick_3430es2 = {
1979 .name = "ssi_ick",
1980 .ops = &clkops_omap3430es2_ssi_wait,
1981 .parent = &ssi_l4_ick,
1982 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1983 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1984 .clkdm_name = "core_l4_clkdm",
1985 .recalc = &followparent_recalc,
1986};
1987
1988/* REVISIT: Technically the TRM claims that this is CORE_CLK based,
1989 * but l4_ick makes more sense to me */
1990
1991static const struct clksel usb_l4_clksel[] = {
1992 { .parent = &l4_ick, .rates = div2_rates },
1993 { .parent = NULL },
1994};
1995
1996static struct clk usb_l4_ick = {
1997 .name = "usb_l4_ick",
1998 .ops = &clkops_omap2_dflt_wait,
1999 .parent = &l4_ick,
2000 .init = &omap2_init_clksel_parent,
2001 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2002 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
2003 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2004 .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2005 .clksel = usb_l4_clksel,
2006 .recalc = &omap2_clksel_recalc,
2007};
2008
2009/* SECURITY_L4_ICK2 based clocks */
2010
2011static struct clk security_l4_ick2 = {
2012 .name = "security_l4_ick2",
2013 .ops = &clkops_null,
2014 .parent = &l4_ick,
2015 .recalc = &followparent_recalc,
2016};
2017
2018static struct clk aes1_ick = {
2019 .name = "aes1_ick",
2020 .ops = &clkops_omap2_dflt_wait,
2021 .parent = &security_l4_ick2,
2022 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2023 .enable_bit = OMAP3430_EN_AES1_SHIFT,
2024 .recalc = &followparent_recalc,
2025};
2026
2027static struct clk rng_ick = {
2028 .name = "rng_ick",
2029 .ops = &clkops_omap2_dflt_wait,
2030 .parent = &security_l4_ick2,
2031 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2032 .enable_bit = OMAP3430_EN_RNG_SHIFT,
2033 .recalc = &followparent_recalc,
2034};
2035
2036static struct clk sha11_ick = {
2037 .name = "sha11_ick",
2038 .ops = &clkops_omap2_dflt_wait,
2039 .parent = &security_l4_ick2,
2040 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2041 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
2042 .recalc = &followparent_recalc,
2043};
2044
2045static struct clk des1_ick = {
2046 .name = "des1_ick",
2047 .ops = &clkops_omap2_dflt_wait,
2048 .parent = &security_l4_ick2,
2049 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2050 .enable_bit = OMAP3430_EN_DES1_SHIFT,
2051 .recalc = &followparent_recalc,
2052};
2053
2054/* DSS */
2055static struct clk dss1_alwon_fck_3430es1 = {
2056 .name = "dss1_alwon_fck",
2057 .ops = &clkops_omap2_dflt,
2058 .parent = &dpll4_m4x2_ck,
2059 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2060 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2061 .clkdm_name = "dss_clkdm",
2062 .recalc = &followparent_recalc,
2063};
2064
2065static struct clk dss1_alwon_fck_3430es2 = {
2066 .name = "dss1_alwon_fck",
2067 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2068 .parent = &dpll4_m4x2_ck,
2069 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2070 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2071 .clkdm_name = "dss_clkdm",
2072 .recalc = &followparent_recalc,
2073};
2074
2075static struct clk dss_tv_fck = {
2076 .name = "dss_tv_fck",
2077 .ops = &clkops_omap2_dflt,
2078 .parent = &omap_54m_fck,
2079 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2080 .enable_bit = OMAP3430_EN_TV_SHIFT,
2081 .clkdm_name = "dss_clkdm",
2082 .recalc = &followparent_recalc,
2083};
2084
2085static struct clk dss_96m_fck = {
2086 .name = "dss_96m_fck",
2087 .ops = &clkops_omap2_dflt,
2088 .parent = &omap_96m_fck,
2089 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2090 .enable_bit = OMAP3430_EN_TV_SHIFT,
2091 .clkdm_name = "dss_clkdm",
2092 .recalc = &followparent_recalc,
2093};
2094
2095static struct clk dss2_alwon_fck = {
2096 .name = "dss2_alwon_fck",
2097 .ops = &clkops_omap2_dflt,
2098 .parent = &sys_ck,
2099 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2100 .enable_bit = OMAP3430_EN_DSS2_SHIFT,
2101 .clkdm_name = "dss_clkdm",
2102 .recalc = &followparent_recalc,
2103};
2104
2105static struct clk dss_ick_3430es1 = {
2106 /* Handles both L3 and L4 clocks */
2107 .name = "dss_ick",
2108 .ops = &clkops_omap2_dflt,
2109 .parent = &l4_ick,
2110 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2111 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2112 .clkdm_name = "dss_clkdm",
2113 .recalc = &followparent_recalc,
2114};
2115
2116static struct clk dss_ick_3430es2 = {
2117 /* Handles both L3 and L4 clocks */
2118 .name = "dss_ick",
2119 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2120 .parent = &l4_ick,
2121 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2122 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2123 .clkdm_name = "dss_clkdm",
2124 .recalc = &followparent_recalc,
2125};
2126
2127/* CAM */
2128
2129static struct clk cam_mclk = {
2130 .name = "cam_mclk",
2131 .ops = &clkops_omap2_dflt,
2132 .parent = &dpll4_m5x2_ck,
2133 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2134 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2135 .clkdm_name = "cam_clkdm",
2136 .recalc = &followparent_recalc,
2137};
2138
2139static struct clk cam_ick = {
2140 /* Handles both L3 and L4 clocks */
2141 .name = "cam_ick",
2142 .ops = &clkops_omap2_dflt,
2143 .parent = &l4_ick,
2144 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
2145 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2146 .clkdm_name = "cam_clkdm",
2147 .recalc = &followparent_recalc,
2148};
2149
2150static struct clk csi2_96m_fck = {
2151 .name = "csi2_96m_fck",
2152 .ops = &clkops_omap2_dflt,
2153 .parent = &core_96m_fck,
2154 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2155 .enable_bit = OMAP3430_EN_CSI2_SHIFT,
2156 .clkdm_name = "cam_clkdm",
2157 .recalc = &followparent_recalc,
2158};
2159
2160/* USBHOST - 3430ES2 only */
2161
2162static struct clk usbhost_120m_fck = {
2163 .name = "usbhost_120m_fck",
2164 .ops = &clkops_omap2_dflt,
2165 .parent = &dpll5_m2_ck,
2166 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2167 .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT,
2168 .clkdm_name = "usbhost_clkdm",
2169 .recalc = &followparent_recalc,
2170};
2171
2172static struct clk usbhost_48m_fck = {
2173 .name = "usbhost_48m_fck",
2174 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2175 .parent = &omap_48m_fck,
2176 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2177 .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
2178 .clkdm_name = "usbhost_clkdm",
2179 .recalc = &followparent_recalc,
2180};
2181
2182static struct clk usbhost_ick = {
2183 /* Handles both L3 and L4 clocks */
2184 .name = "usbhost_ick",
2185 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2186 .parent = &l4_ick,
2187 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
2188 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
2189 .clkdm_name = "usbhost_clkdm",
2190 .recalc = &followparent_recalc,
2191};
2192
2193/* WKUP */
2194
2195static const struct clksel_rate usim_96m_rates[] = {
2196 { .div = 2, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
2197 { .div = 4, .val = 4, .flags = RATE_IN_343X },
2198 { .div = 8, .val = 5, .flags = RATE_IN_343X },
2199 { .div = 10, .val = 6, .flags = RATE_IN_343X },
2200 { .div = 0 },
2201};
2202
2203static const struct clksel_rate usim_120m_rates[] = {
2204 { .div = 4, .val = 7, .flags = RATE_IN_343X | DEFAULT_RATE },
2205 { .div = 8, .val = 8, .flags = RATE_IN_343X },
2206 { .div = 16, .val = 9, .flags = RATE_IN_343X },
2207 { .div = 20, .val = 10, .flags = RATE_IN_343X },
2208 { .div = 0 },
2209};
2210
2211static const struct clksel usim_clksel[] = {
2212 { .parent = &omap_96m_fck, .rates = usim_96m_rates },
2213 { .parent = &dpll5_m2_ck, .rates = usim_120m_rates },
2214 { .parent = &sys_ck, .rates = div2_rates },
2215 { .parent = NULL },
2216};
2217
2218/* 3430ES2 only */
2219static struct clk usim_fck = {
2220 .name = "usim_fck",
2221 .ops = &clkops_omap2_dflt_wait,
2222 .init = &omap2_init_clksel_parent,
2223 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2224 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2225 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2226 .clksel_mask = OMAP3430ES2_CLKSEL_USIMOCP_MASK,
2227 .clksel = usim_clksel,
2228 .recalc = &omap2_clksel_recalc,
2229};
2230
2231/* XXX should gpt1's clksel have wkup_32k_fck as the 32k opt? */
2232static struct clk gpt1_fck = {
2233 .name = "gpt1_fck",
2234 .ops = &clkops_omap2_dflt_wait,
2235 .init = &omap2_init_clksel_parent,
2236 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2237 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2238 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2239 .clksel_mask = OMAP3430_CLKSEL_GPT1_MASK,
2240 .clksel = omap343x_gpt_clksel,
2241 .clkdm_name = "wkup_clkdm",
2242 .recalc = &omap2_clksel_recalc,
2243};
2244
2245static struct clk wkup_32k_fck = {
2246 .name = "wkup_32k_fck",
2247 .ops = &clkops_null,
2248 .parent = &omap_32k_fck,
2249 .clkdm_name = "wkup_clkdm",
2250 .recalc = &followparent_recalc,
2251};
2252
2253static struct clk gpio1_dbck = {
2254 .name = "gpio1_dbck",
2255 .ops = &clkops_omap2_dflt,
2256 .parent = &wkup_32k_fck,
2257 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2258 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2259 .clkdm_name = "wkup_clkdm",
2260 .recalc = &followparent_recalc,
2261};
2262
2263static struct clk wdt2_fck = {
2264 .name = "wdt2_fck",
2265 .ops = &clkops_omap2_dflt_wait,
2266 .parent = &wkup_32k_fck,
2267 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2268 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2269 .clkdm_name = "wkup_clkdm",
2270 .recalc = &followparent_recalc,
2271};
2272
2273static struct clk wkup_l4_ick = {
2274 .name = "wkup_l4_ick",
2275 .ops = &clkops_null,
2276 .parent = &sys_ck,
2277 .clkdm_name = "wkup_clkdm",
2278 .recalc = &followparent_recalc,
2279};
2280
2281/* 3430ES2 only */
2282/* Never specifically named in the TRM, so we have to infer a likely name */
2283static struct clk usim_ick = {
2284 .name = "usim_ick",
2285 .ops = &clkops_omap2_dflt_wait,
2286 .parent = &wkup_l4_ick,
2287 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2288 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2289 .clkdm_name = "wkup_clkdm",
2290 .recalc = &followparent_recalc,
2291};
2292
2293static struct clk wdt2_ick = {
2294 .name = "wdt2_ick",
2295 .ops = &clkops_omap2_dflt_wait,
2296 .parent = &wkup_l4_ick,
2297 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2298 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2299 .clkdm_name = "wkup_clkdm",
2300 .recalc = &followparent_recalc,
2301};
2302
2303static struct clk wdt1_ick = {
2304 .name = "wdt1_ick",
2305 .ops = &clkops_omap2_dflt_wait,
2306 .parent = &wkup_l4_ick,
2307 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2308 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
2309 .clkdm_name = "wkup_clkdm",
2310 .recalc = &followparent_recalc,
2311};
2312
2313static struct clk gpio1_ick = {
2314 .name = "gpio1_ick",
2315 .ops = &clkops_omap2_dflt_wait,
2316 .parent = &wkup_l4_ick,
2317 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2318 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2319 .clkdm_name = "wkup_clkdm",
2320 .recalc = &followparent_recalc,
2321};
2322
2323static struct clk omap_32ksync_ick = {
2324 .name = "omap_32ksync_ick",
2325 .ops = &clkops_omap2_dflt_wait,
2326 .parent = &wkup_l4_ick,
2327 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2328 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
2329 .clkdm_name = "wkup_clkdm",
2330 .recalc = &followparent_recalc,
2331};
2332
2333/* XXX This clock no longer exists in 3430 TRM rev F */
2334static struct clk gpt12_ick = {
2335 .name = "gpt12_ick",
2336 .ops = &clkops_omap2_dflt_wait,
2337 .parent = &wkup_l4_ick,
2338 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2339 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
2340 .clkdm_name = "wkup_clkdm",
2341 .recalc = &followparent_recalc,
2342};
2343
2344static struct clk gpt1_ick = {
2345 .name = "gpt1_ick",
2346 .ops = &clkops_omap2_dflt_wait,
2347 .parent = &wkup_l4_ick,
2348 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2349 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2350 .clkdm_name = "wkup_clkdm",
2351 .recalc = &followparent_recalc,
2352};
2353
2354
2355
2356/* PER clock domain */
2357
2358static struct clk per_96m_fck = {
2359 .name = "per_96m_fck",
2360 .ops = &clkops_null,
2361 .parent = &omap_96m_alwon_fck,
2362 .clkdm_name = "per_clkdm",
2363 .recalc = &followparent_recalc,
2364};
2365
2366static struct clk per_48m_fck = {
2367 .name = "per_48m_fck",
2368 .ops = &clkops_null,
2369 .parent = &omap_48m_fck,
2370 .clkdm_name = "per_clkdm",
2371 .recalc = &followparent_recalc,
2372};
2373
2374static struct clk uart3_fck = {
2375 .name = "uart3_fck",
2376 .ops = &clkops_omap2_dflt_wait,
2377 .parent = &per_48m_fck,
2378 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2379 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2380 .clkdm_name = "per_clkdm",
2381 .recalc = &followparent_recalc,
2382};
2383
2384static struct clk gpt2_fck = {
2385 .name = "gpt2_fck",
2386 .ops = &clkops_omap2_dflt_wait,
2387 .init = &omap2_init_clksel_parent,
2388 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2389 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2390 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2391 .clksel_mask = OMAP3430_CLKSEL_GPT2_MASK,
2392 .clksel = omap343x_gpt_clksel,
2393 .clkdm_name = "per_clkdm",
2394 .recalc = &omap2_clksel_recalc,
2395};
2396
2397static struct clk gpt3_fck = {
2398 .name = "gpt3_fck",
2399 .ops = &clkops_omap2_dflt_wait,
2400 .init = &omap2_init_clksel_parent,
2401 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2402 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2403 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2404 .clksel_mask = OMAP3430_CLKSEL_GPT3_MASK,
2405 .clksel = omap343x_gpt_clksel,
2406 .clkdm_name = "per_clkdm",
2407 .recalc = &omap2_clksel_recalc,
2408};
2409
2410static struct clk gpt4_fck = {
2411 .name = "gpt4_fck",
2412 .ops = &clkops_omap2_dflt_wait,
2413 .init = &omap2_init_clksel_parent,
2414 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2415 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2416 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2417 .clksel_mask = OMAP3430_CLKSEL_GPT4_MASK,
2418 .clksel = omap343x_gpt_clksel,
2419 .clkdm_name = "per_clkdm",
2420 .recalc = &omap2_clksel_recalc,
2421};
2422
2423static struct clk gpt5_fck = {
2424 .name = "gpt5_fck",
2425 .ops = &clkops_omap2_dflt_wait,
2426 .init = &omap2_init_clksel_parent,
2427 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2428 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2429 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2430 .clksel_mask = OMAP3430_CLKSEL_GPT5_MASK,
2431 .clksel = omap343x_gpt_clksel,
2432 .clkdm_name = "per_clkdm",
2433 .recalc = &omap2_clksel_recalc,
2434};
2435
2436static struct clk gpt6_fck = {
2437 .name = "gpt6_fck",
2438 .ops = &clkops_omap2_dflt_wait,
2439 .init = &omap2_init_clksel_parent,
2440 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2441 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2442 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2443 .clksel_mask = OMAP3430_CLKSEL_GPT6_MASK,
2444 .clksel = omap343x_gpt_clksel,
2445 .clkdm_name = "per_clkdm",
2446 .recalc = &omap2_clksel_recalc,
2447};
2448
2449static struct clk gpt7_fck = {
2450 .name = "gpt7_fck",
2451 .ops = &clkops_omap2_dflt_wait,
2452 .init = &omap2_init_clksel_parent,
2453 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2454 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2455 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2456 .clksel_mask = OMAP3430_CLKSEL_GPT7_MASK,
2457 .clksel = omap343x_gpt_clksel,
2458 .clkdm_name = "per_clkdm",
2459 .recalc = &omap2_clksel_recalc,
2460};
2461
2462static struct clk gpt8_fck = {
2463 .name = "gpt8_fck",
2464 .ops = &clkops_omap2_dflt_wait,
2465 .init = &omap2_init_clksel_parent,
2466 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2467 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2468 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2469 .clksel_mask = OMAP3430_CLKSEL_GPT8_MASK,
2470 .clksel = omap343x_gpt_clksel,
2471 .clkdm_name = "per_clkdm",
2472 .recalc = &omap2_clksel_recalc,
2473};
2474
2475static struct clk gpt9_fck = {
2476 .name = "gpt9_fck",
2477 .ops = &clkops_omap2_dflt_wait,
2478 .init = &omap2_init_clksel_parent,
2479 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2480 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2481 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2482 .clksel_mask = OMAP3430_CLKSEL_GPT9_MASK,
2483 .clksel = omap343x_gpt_clksel,
2484 .clkdm_name = "per_clkdm",
2485 .recalc = &omap2_clksel_recalc,
2486};
2487
2488static struct clk per_32k_alwon_fck = {
2489 .name = "per_32k_alwon_fck",
2490 .ops = &clkops_null,
2491 .parent = &omap_32k_fck,
2492 .clkdm_name = "per_clkdm",
2493 .recalc = &followparent_recalc,
2494};
2495
2496static struct clk gpio6_dbck = {
2497 .name = "gpio6_dbck",
2498 .ops = &clkops_omap2_dflt,
2499 .parent = &per_32k_alwon_fck,
2500 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2501 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2502 .clkdm_name = "per_clkdm",
2503 .recalc = &followparent_recalc,
2504};
2505
2506static struct clk gpio5_dbck = {
2507 .name = "gpio5_dbck",
2508 .ops = &clkops_omap2_dflt,
2509 .parent = &per_32k_alwon_fck,
2510 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2511 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2512 .clkdm_name = "per_clkdm",
2513 .recalc = &followparent_recalc,
2514};
2515
2516static struct clk gpio4_dbck = {
2517 .name = "gpio4_dbck",
2518 .ops = &clkops_omap2_dflt,
2519 .parent = &per_32k_alwon_fck,
2520 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2521 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2522 .clkdm_name = "per_clkdm",
2523 .recalc = &followparent_recalc,
2524};
2525
2526static struct clk gpio3_dbck = {
2527 .name = "gpio3_dbck",
2528 .ops = &clkops_omap2_dflt,
2529 .parent = &per_32k_alwon_fck,
2530 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2531 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2532 .clkdm_name = "per_clkdm",
2533 .recalc = &followparent_recalc,
2534};
2535
2536static struct clk gpio2_dbck = {
2537 .name = "gpio2_dbck",
2538 .ops = &clkops_omap2_dflt,
2539 .parent = &per_32k_alwon_fck,
2540 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2541 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2542 .clkdm_name = "per_clkdm",
2543 .recalc = &followparent_recalc,
2544};
2545
2546static struct clk wdt3_fck = {
2547 .name = "wdt3_fck",
2548 .ops = &clkops_omap2_dflt_wait,
2549 .parent = &per_32k_alwon_fck,
2550 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2551 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2552 .clkdm_name = "per_clkdm",
2553 .recalc = &followparent_recalc,
2554};
2555
2556static struct clk per_l4_ick = {
2557 .name = "per_l4_ick",
2558 .ops = &clkops_null,
2559 .parent = &l4_ick,
2560 .clkdm_name = "per_clkdm",
2561 .recalc = &followparent_recalc,
2562};
2563
2564static struct clk gpio6_ick = {
2565 .name = "gpio6_ick",
2566 .ops = &clkops_omap2_dflt_wait,
2567 .parent = &per_l4_ick,
2568 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2569 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2570 .clkdm_name = "per_clkdm",
2571 .recalc = &followparent_recalc,
2572};
2573
2574static struct clk gpio5_ick = {
2575 .name = "gpio5_ick",
2576 .ops = &clkops_omap2_dflt_wait,
2577 .parent = &per_l4_ick,
2578 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2579 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2580 .clkdm_name = "per_clkdm",
2581 .recalc = &followparent_recalc,
2582};
2583
2584static struct clk gpio4_ick = {
2585 .name = "gpio4_ick",
2586 .ops = &clkops_omap2_dflt_wait,
2587 .parent = &per_l4_ick,
2588 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2589 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2590 .clkdm_name = "per_clkdm",
2591 .recalc = &followparent_recalc,
2592};
2593
2594static struct clk gpio3_ick = {
2595 .name = "gpio3_ick",
2596 .ops = &clkops_omap2_dflt_wait,
2597 .parent = &per_l4_ick,
2598 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2599 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2600 .clkdm_name = "per_clkdm",
2601 .recalc = &followparent_recalc,
2602};
2603
2604static struct clk gpio2_ick = {
2605 .name = "gpio2_ick",
2606 .ops = &clkops_omap2_dflt_wait,
2607 .parent = &per_l4_ick,
2608 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2609 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2610 .clkdm_name = "per_clkdm",
2611 .recalc = &followparent_recalc,
2612};
2613
2614static struct clk wdt3_ick = {
2615 .name = "wdt3_ick",
2616 .ops = &clkops_omap2_dflt_wait,
2617 .parent = &per_l4_ick,
2618 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2619 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2620 .clkdm_name = "per_clkdm",
2621 .recalc = &followparent_recalc,
2622};
2623
2624static struct clk uart3_ick = {
2625 .name = "uart3_ick",
2626 .ops = &clkops_omap2_dflt_wait,
2627 .parent = &per_l4_ick,
2628 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2629 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2630 .clkdm_name = "per_clkdm",
2631 .recalc = &followparent_recalc,
2632};
2633
2634static struct clk gpt9_ick = {
2635 .name = "gpt9_ick",
2636 .ops = &clkops_omap2_dflt_wait,
2637 .parent = &per_l4_ick,
2638 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2639 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2640 .clkdm_name = "per_clkdm",
2641 .recalc = &followparent_recalc,
2642};
2643
2644static struct clk gpt8_ick = {
2645 .name = "gpt8_ick",
2646 .ops = &clkops_omap2_dflt_wait,
2647 .parent = &per_l4_ick,
2648 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2649 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2650 .clkdm_name = "per_clkdm",
2651 .recalc = &followparent_recalc,
2652};
2653
2654static struct clk gpt7_ick = {
2655 .name = "gpt7_ick",
2656 .ops = &clkops_omap2_dflt_wait,
2657 .parent = &per_l4_ick,
2658 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2659 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2660 .clkdm_name = "per_clkdm",
2661 .recalc = &followparent_recalc,
2662};
2663
2664static struct clk gpt6_ick = {
2665 .name = "gpt6_ick",
2666 .ops = &clkops_omap2_dflt_wait,
2667 .parent = &per_l4_ick,
2668 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2669 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2670 .clkdm_name = "per_clkdm",
2671 .recalc = &followparent_recalc,
2672};
2673
2674static struct clk gpt5_ick = {
2675 .name = "gpt5_ick",
2676 .ops = &clkops_omap2_dflt_wait,
2677 .parent = &per_l4_ick,
2678 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2679 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2680 .clkdm_name = "per_clkdm",
2681 .recalc = &followparent_recalc,
2682};
2683
2684static struct clk gpt4_ick = {
2685 .name = "gpt4_ick",
2686 .ops = &clkops_omap2_dflt_wait,
2687 .parent = &per_l4_ick,
2688 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2689 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2690 .clkdm_name = "per_clkdm",
2691 .recalc = &followparent_recalc,
2692};
2693
2694static struct clk gpt3_ick = {
2695 .name = "gpt3_ick",
2696 .ops = &clkops_omap2_dflt_wait,
2697 .parent = &per_l4_ick,
2698 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2699 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2700 .clkdm_name = "per_clkdm",
2701 .recalc = &followparent_recalc,
2702};
2703
2704static struct clk gpt2_ick = {
2705 .name = "gpt2_ick",
2706 .ops = &clkops_omap2_dflt_wait,
2707 .parent = &per_l4_ick,
2708 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2709 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2710 .clkdm_name = "per_clkdm",
2711 .recalc = &followparent_recalc,
2712};
2713
2714static struct clk mcbsp2_ick = {
2715 .name = "mcbsp_ick",
2716 .ops = &clkops_omap2_dflt_wait,
2717 .id = 2,
2718 .parent = &per_l4_ick,
2719 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2720 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2721 .clkdm_name = "per_clkdm",
2722 .recalc = &followparent_recalc,
2723};
2724
2725static struct clk mcbsp3_ick = {
2726 .name = "mcbsp_ick",
2727 .ops = &clkops_omap2_dflt_wait,
2728 .id = 3,
2729 .parent = &per_l4_ick,
2730 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2731 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2732 .clkdm_name = "per_clkdm",
2733 .recalc = &followparent_recalc,
2734};
2735
2736static struct clk mcbsp4_ick = {
2737 .name = "mcbsp_ick",
2738 .ops = &clkops_omap2_dflt_wait,
2739 .id = 4,
2740 .parent = &per_l4_ick,
2741 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2742 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2743 .clkdm_name = "per_clkdm",
2744 .recalc = &followparent_recalc,
2745};
2746
2747static const struct clksel mcbsp_234_clksel[] = {
2748 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
2749 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2750 { .parent = NULL }
2751};
2752
2753static struct clk mcbsp2_fck = {
2754 .name = "mcbsp_fck",
2755 .ops = &clkops_omap2_dflt_wait,
2756 .id = 2,
2757 .init = &omap2_init_clksel_parent,
2758 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2759 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2760 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2761 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
2762 .clksel = mcbsp_234_clksel,
2763 .clkdm_name = "per_clkdm",
2764 .recalc = &omap2_clksel_recalc,
2765};
2766
2767static struct clk mcbsp3_fck = {
2768 .name = "mcbsp_fck",
2769 .ops = &clkops_omap2_dflt_wait,
2770 .id = 3,
2771 .init = &omap2_init_clksel_parent,
2772 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2773 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2774 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2775 .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
2776 .clksel = mcbsp_234_clksel,
2777 .clkdm_name = "per_clkdm",
2778 .recalc = &omap2_clksel_recalc,
2779};
2780
2781static struct clk mcbsp4_fck = {
2782 .name = "mcbsp_fck",
2783 .ops = &clkops_omap2_dflt_wait,
2784 .id = 4,
2785 .init = &omap2_init_clksel_parent,
2786 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2787 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2788 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2789 .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
2790 .clksel = mcbsp_234_clksel,
2791 .clkdm_name = "per_clkdm",
2792 .recalc = &omap2_clksel_recalc,
2793};
2794
2795/* EMU clocks */
2796
2797/* More information: ARM Cortex-A8 Technical Reference Manual, sect 10.1 */
2798
2799static const struct clksel_rate emu_src_sys_rates[] = {
2800 { .div = 1, .val = 0, .flags = RATE_IN_343X | DEFAULT_RATE },
2801 { .div = 0 },
2802};
2803
2804static const struct clksel_rate emu_src_core_rates[] = {
2805 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
2806 { .div = 0 },
2807};
2808
2809static const struct clksel_rate emu_src_per_rates[] = {
2810 { .div = 1, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE },
2811 { .div = 0 },
2812};
2813
2814static const struct clksel_rate emu_src_mpu_rates[] = {
2815 { .div = 1, .val = 3, .flags = RATE_IN_343X | DEFAULT_RATE },
2816 { .div = 0 },
2817};
2818
2819static const struct clksel emu_src_clksel[] = {
2820 { .parent = &sys_ck, .rates = emu_src_sys_rates },
2821 { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates },
2822 { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates },
2823 { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates },
2824 { .parent = NULL },
2825};
2826
2827/*
2828 * Like the clkout_src clocks, emu_src_clk is a virtual clock, existing only
2829 * to switch the source of some of the EMU clocks.
2830 * XXX Are there CLKEN bits for these EMU clks?
2831 */
2832static struct clk emu_src_ck = {
2833 .name = "emu_src_ck",
2834 .ops = &clkops_null,
2835 .init = &omap2_init_clksel_parent,
2836 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2837 .clksel_mask = OMAP3430_MUX_CTRL_MASK,
2838 .clksel = emu_src_clksel,
2839 .clkdm_name = "emu_clkdm",
2840 .recalc = &omap2_clksel_recalc,
2841};
2842
2843static const struct clksel_rate pclk_emu_rates[] = {
2844 { .div = 2, .val = 2, .flags = RATE_IN_343X | DEFAULT_RATE },
2845 { .div = 3, .val = 3, .flags = RATE_IN_343X },
2846 { .div = 4, .val = 4, .flags = RATE_IN_343X },
2847 { .div = 6, .val = 6, .flags = RATE_IN_343X },
2848 { .div = 0 },
2849};
2850
2851static const struct clksel pclk_emu_clksel[] = {
2852 { .parent = &emu_src_ck, .rates = pclk_emu_rates },
2853 { .parent = NULL },
2854};
2855
2856static struct clk pclk_fck = {
2857 .name = "pclk_fck",
2858 .ops = &clkops_null,
2859 .init = &omap2_init_clksel_parent,
2860 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2861 .clksel_mask = OMAP3430_CLKSEL_PCLK_MASK,
2862 .clksel = pclk_emu_clksel,
2863 .clkdm_name = "emu_clkdm",
2864 .recalc = &omap2_clksel_recalc,
2865};
2866
2867static const struct clksel_rate pclkx2_emu_rates[] = {
2868 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
2869 { .div = 2, .val = 2, .flags = RATE_IN_343X },
2870 { .div = 3, .val = 3, .flags = RATE_IN_343X },
2871 { .div = 0 },
2872};
2873
2874static const struct clksel pclkx2_emu_clksel[] = {
2875 { .parent = &emu_src_ck, .rates = pclkx2_emu_rates },
2876 { .parent = NULL },
2877};
2878
2879static struct clk pclkx2_fck = {
2880 .name = "pclkx2_fck",
2881 .ops = &clkops_null,
2882 .init = &omap2_init_clksel_parent,
2883 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2884 .clksel_mask = OMAP3430_CLKSEL_PCLKX2_MASK,
2885 .clksel = pclkx2_emu_clksel,
2886 .clkdm_name = "emu_clkdm",
2887 .recalc = &omap2_clksel_recalc,
2888};
2889
2890static const struct clksel atclk_emu_clksel[] = {
2891 { .parent = &emu_src_ck, .rates = div2_rates },
2892 { .parent = NULL },
2893};
2894
2895static struct clk atclk_fck = {
2896 .name = "atclk_fck",
2897 .ops = &clkops_null,
2898 .init = &omap2_init_clksel_parent,
2899 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2900 .clksel_mask = OMAP3430_CLKSEL_ATCLK_MASK,
2901 .clksel = atclk_emu_clksel,
2902 .clkdm_name = "emu_clkdm",
2903 .recalc = &omap2_clksel_recalc,
2904};
2905
2906static struct clk traceclk_src_fck = {
2907 .name = "traceclk_src_fck",
2908 .ops = &clkops_null,
2909 .init = &omap2_init_clksel_parent,
2910 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2911 .clksel_mask = OMAP3430_TRACE_MUX_CTRL_MASK,
2912 .clksel = emu_src_clksel,
2913 .clkdm_name = "emu_clkdm",
2914 .recalc = &omap2_clksel_recalc,
2915};
2916
2917static const struct clksel_rate traceclk_rates[] = {
2918 { .div = 1, .val = 1, .flags = RATE_IN_343X | DEFAULT_RATE },
2919 { .div = 2, .val = 2, .flags = RATE_IN_343X },
2920 { .div = 4, .val = 4, .flags = RATE_IN_343X },
2921 { .div = 0 },
2922};
2923
2924static const struct clksel traceclk_clksel[] = {
2925 { .parent = &traceclk_src_fck, .rates = traceclk_rates },
2926 { .parent = NULL },
2927};
2928
2929static struct clk traceclk_fck = {
2930 .name = "traceclk_fck",
2931 .ops = &clkops_null,
2932 .init = &omap2_init_clksel_parent,
2933 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2934 .clksel_mask = OMAP3430_CLKSEL_TRACECLK_MASK,
2935 .clksel = traceclk_clksel,
2936 .clkdm_name = "emu_clkdm",
2937 .recalc = &omap2_clksel_recalc,
2938};
2939
2940/* SR clocks */
2941
2942/* SmartReflex fclk (VDD1) */
2943static struct clk sr1_fck = {
2944 .name = "sr1_fck",
2945 .ops = &clkops_omap2_dflt_wait,
2946 .parent = &sys_ck,
2947 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2948 .enable_bit = OMAP3430_EN_SR1_SHIFT,
2949 .recalc = &followparent_recalc,
2950};
2951
2952/* SmartReflex fclk (VDD2) */
2953static struct clk sr2_fck = {
2954 .name = "sr2_fck",
2955 .ops = &clkops_omap2_dflt_wait,
2956 .parent = &sys_ck,
2957 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2958 .enable_bit = OMAP3430_EN_SR2_SHIFT,
2959 .recalc = &followparent_recalc,
2960};
2961
2962static struct clk sr_l4_ick = {
2963 .name = "sr_l4_ick",
2964 .ops = &clkops_null, /* RMK: missing? */
2965 .parent = &l4_ick,
2966 .clkdm_name = "core_l4_clkdm",
2967 .recalc = &followparent_recalc,
2968};
2969
2970/* SECURE_32K_FCK clocks */
2971
2972static struct clk gpt12_fck = {
2973 .name = "gpt12_fck",
2974 .ops = &clkops_null,
2975 .parent = &secure_32k_fck,
2976 .recalc = &followparent_recalc,
2977};
2978
2979static struct clk wdt1_fck = {
2980 .name = "wdt1_fck",
2981 .ops = &clkops_null,
2982 .parent = &secure_32k_fck,
2983 .recalc = &followparent_recalc,
2984};
2985
2986
2987/*
2988 * clkdev
2989 */
2990
2991static struct omap_clk omap34xx_clks[] = {
2992 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_343X),
2993 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_343X),
2994 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_343X),
2995 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2),
2996 CLK(NULL, "virt_19_2m_ck", &virt_19_2m_ck, CK_343X),
2997 CLK(NULL, "virt_26m_ck", &virt_26m_ck, CK_343X),
2998 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_343X),
2999 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_343X),
3000 CLK(NULL, "sys_ck", &sys_ck, CK_343X),
3001 CLK(NULL, "sys_altclk", &sys_altclk, CK_343X),
3002 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_343X),
3003 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_343X),
3004 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_343X),
3005 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_343X),
3006 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_343X),
3007 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_343X),
3008 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_343X),
3009 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_343X),
3010 CLK(NULL, "core_ck", &core_ck, CK_343X),
3011 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_343X),
3012 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_343X),
3013 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_343X),
3014 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_343X),
3015 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_343X),
3016 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_343X),
3017 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_343X),
3018 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_343X),
3019 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_343X),
3020 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_343X),
3021 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_343X),
3022 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_343X),
3023 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_343X),
3024 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_343X),
3025 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_343X),
3026 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_343X),
3027 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_343X),
3028 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_343X),
3029 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_343X),
3030 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_343X),
3031 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_343X),
3032 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_343X),
3033 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_343X),
3034 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_343X),
3035 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_343X),
3036 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2),
3037 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2),
3038 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_343X),
3039 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_343X),
3040 CLK(NULL, "corex2_fck", &corex2_fck, CK_343X),
3041 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_343X),
3042 CLK(NULL, "mpu_ck", &mpu_ck, CK_343X),
3043 CLK(NULL, "arm_fck", &arm_fck, CK_343X),
3044 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_343X),
3045 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_343X),
3046 CLK(NULL, "iva2_ck", &iva2_ck, CK_343X),
3047 CLK(NULL, "l3_ick", &l3_ick, CK_343X),
3048 CLK(NULL, "l4_ick", &l4_ick, CK_343X),
3049 CLK(NULL, "rm_ick", &rm_ick, CK_343X),
3050 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
3051 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
3052 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
3053 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
3054 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
3055 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2),
3056 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2),
3057 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
3058 CLK(NULL, "modem_fck", &modem_fck, CK_343X),
3059 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_343X),
3060 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_343X),
3061 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_343X),
3062 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_343X),
3063 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2),
3064 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2),
3065 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2),
3066 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_343X),
3067 CLK("mmci-omap-hs.2", "fck", &mmchs3_fck, CK_3430ES2),
3068 CLK("mmci-omap-hs.1", "fck", &mmchs2_fck, CK_343X),
3069 CLK(NULL, "mspro_fck", &mspro_fck, CK_343X),
3070 CLK("mmci-omap-hs.0", "fck", &mmchs1_fck, CK_343X),
3071 CLK("i2c_omap.3", "fck", &i2c3_fck, CK_343X),
3072 CLK("i2c_omap.2", "fck", &i2c2_fck, CK_343X),
3073 CLK("i2c_omap.1", "fck", &i2c1_fck, CK_343X),
3074 CLK("omap-mcbsp.5", "fck", &mcbsp5_fck, CK_343X),
3075 CLK("omap-mcbsp.1", "fck", &mcbsp1_fck, CK_343X),
3076 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_343X),
3077 CLK("omap2_mcspi.4", "fck", &mcspi4_fck, CK_343X),
3078 CLK("omap2_mcspi.3", "fck", &mcspi3_fck, CK_343X),
3079 CLK("omap2_mcspi.2", "fck", &mcspi2_fck, CK_343X),
3080 CLK("omap2_mcspi.1", "fck", &mcspi1_fck, CK_343X),
3081 CLK(NULL, "uart2_fck", &uart2_fck, CK_343X),
3082 CLK(NULL, "uart1_fck", &uart1_fck, CK_343X),
3083 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3084 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_343X),
3085 CLK("omap_hdq.0", "fck", &hdq_fck, CK_343X),
3086 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3087 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2),
3088 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
3089 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2),
3090 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_343X),
3091 CLK("musb_hdrc", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3092 CLK("musb_hdrc", "ick", &hsotgusb_ick_3430es2, CK_3430ES2),
3093 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_343X),
3094 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_343X),
3095 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_343X),
3096 CLK(NULL, "pka_ick", &pka_ick, CK_343X),
3097 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_343X),
3098 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2),
3099 CLK("mmci-omap-hs.2", "ick", &mmchs3_ick, CK_3430ES2),
3100 CLK(NULL, "icr_ick", &icr_ick, CK_343X),
3101 CLK(NULL, "aes2_ick", &aes2_ick, CK_343X),
3102 CLK(NULL, "sha12_ick", &sha12_ick, CK_343X),
3103 CLK(NULL, "des2_ick", &des2_ick, CK_343X),
3104 CLK("mmci-omap-hs.1", "ick", &mmchs2_ick, CK_343X),
3105 CLK("mmci-omap-hs.0", "ick", &mmchs1_ick, CK_343X),
3106 CLK(NULL, "mspro_ick", &mspro_ick, CK_343X),
3107 CLK("omap_hdq.0", "ick", &hdq_ick, CK_343X),
3108 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_343X),
3109 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_343X),
3110 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_343X),
3111 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_343X),
3112 CLK("i2c_omap.3", "ick", &i2c3_ick, CK_343X),
3113 CLK("i2c_omap.2", "ick", &i2c2_ick, CK_343X),
3114 CLK("i2c_omap.1", "ick", &i2c1_ick, CK_343X),
3115 CLK(NULL, "uart2_ick", &uart2_ick, CK_343X),
3116 CLK(NULL, "uart1_ick", &uart1_ick, CK_343X),
3117 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_343X),
3118 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_343X),
3119 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_343X),
3120 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_343X),
3121 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
3122 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_343X),
3123 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_343X),
3124 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_343X),
3125 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1),
3126 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2),
3127 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
3128 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_343X),
3129 CLK(NULL, "aes1_ick", &aes1_ick, CK_343X),
3130 CLK("omap_rng", "ick", &rng_ick, CK_343X),
3131 CLK(NULL, "sha11_ick", &sha11_ick, CK_343X),
3132 CLK(NULL, "des1_ick", &des1_ick, CK_343X),
3133 CLK("omapdss", "dss1_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
3134 CLK("omapdss", "dss1_fck", &dss1_alwon_fck_3430es2, CK_3430ES2),
3135 CLK("omapdss", "tv_fck", &dss_tv_fck, CK_343X),
3136 CLK("omapdss", "video_fck", &dss_96m_fck, CK_343X),
3137 CLK("omapdss", "dss2_fck", &dss2_alwon_fck, CK_343X),
3138 CLK("omapdss", "ick", &dss_ick_3430es1, CK_3430ES1),
3139 CLK("omapdss", "ick", &dss_ick_3430es2, CK_3430ES2),
3140 CLK(NULL, "cam_mclk", &cam_mclk, CK_343X),
3141 CLK(NULL, "cam_ick", &cam_ick, CK_343X),
3142 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_343X),
3143 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2),
3144 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2),
3145 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2),
3146 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2),
3147 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_343X),
3148 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_343X),
3149 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_343X),
3150 CLK("omap_wdt", "fck", &wdt2_fck, CK_343X),
3151 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_343X),
3152 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2),
3153 CLK("omap_wdt", "ick", &wdt2_ick, CK_343X),
3154 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_343X),
3155 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_343X),
3156 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_343X),
3157 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_343X),
3158 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_343X),
3159 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_343X),
3160 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_343X),
3161 CLK(NULL, "uart3_fck", &uart3_fck, CK_343X),
3162 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_343X),
3163 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_343X),
3164 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_343X),
3165 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_343X),
3166 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_343X),
3167 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_343X),
3168 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_343X),
3169 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_343X),
3170 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_343X),
3171 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_343X),
3172 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_343X),
3173 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_343X),
3174 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_343X),
3175 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_343X),
3176 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_343X),
3177 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_343X),
3178 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_343X),
3179 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_343X),
3180 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_343X),
3181 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_343X),
3182 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_343X),
3183 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_343X),
3184 CLK(NULL, "uart3_ick", &uart3_ick, CK_343X),
3185 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_343X),
3186 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_343X),
3187 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_343X),
3188 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_343X),
3189 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_343X),
3190 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_343X),
3191 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_343X),
3192 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_343X),
3193 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_343X),
3194 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_343X),
3195 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_343X),
3196 CLK("omap-mcbsp.2", "fck", &mcbsp2_fck, CK_343X),
3197 CLK("omap-mcbsp.3", "fck", &mcbsp3_fck, CK_343X),
3198 CLK("omap-mcbsp.4", "fck", &mcbsp4_fck, CK_343X),
3199 CLK("etb", "emu_src_ck", &emu_src_ck, CK_343X),
3200 CLK(NULL, "pclk_fck", &pclk_fck, CK_343X),
3201 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_343X),
3202 CLK(NULL, "atclk_fck", &atclk_fck, CK_343X),
3203 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_343X),
3204 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_343X),
3205 CLK(NULL, "sr1_fck", &sr1_fck, CK_343X),
3206 CLK(NULL, "sr2_fck", &sr2_fck, CK_343X),
3207 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_343X),
3208 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_343X),
3209 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_343X),
3210 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_343X),
3211};
3212
3213
3214int __init omap2_clk_init(void)
3215{
3216 /* struct prcm_config *prcm; */
3217 struct omap_clk *c;
3218 /* u32 clkrate; */
3219 u32 cpu_clkflg;
3220
3221 if (cpu_is_omap34xx()) {
3222 cpu_mask = RATE_IN_343X;
3223 cpu_clkflg = CK_343X;
3224
3225 /*
3226 * Update this if there are further clock changes between ES2
3227 * and production parts
3228 */
3229 if (omap_rev() == OMAP3430_REV_ES1_0) {
3230 /* No 3430ES1-only rates exist, so no RATE_IN_3430ES1 */
3231 cpu_clkflg |= CK_3430ES1;
3232 } else {
3233 cpu_mask |= RATE_IN_3430ES2;
3234 cpu_clkflg |= CK_3430ES2;
3235 }
3236 }
3237
3238 clk_init(&omap2_clk_functions);
3239
3240 for (c = omap34xx_clks; c < omap34xx_clks + ARRAY_SIZE(omap34xx_clks); c++)
3241 clk_preinit(c->lk.clk);
3242
3243 for (c = omap34xx_clks; c < omap34xx_clks + ARRAY_SIZE(omap34xx_clks); c++)
3244 if (c->cpu & cpu_clkflg) {
3245 clkdev_add(&c->lk);
3246 clk_register(c->lk.clk);
3247 omap2_init_clk_clkdm(c->lk.clk);
3248 }
3249
3250 /* REVISIT: Not yet ready for OMAP3 */
3251#if 0
3252 /* Check the MPU rate set by bootloader */
3253 clkrate = omap2_get_dpll_rate_24xx(&dpll_ck);
3254 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
3255 if (!(prcm->flags & cpu_mask))
3256 continue;
3257 if (prcm->xtal_speed != sys_ck.rate)
3258 continue;
3259 if (prcm->dpll_speed <= clkrate)
3260 break;
3261 }
3262 curr_prcm_set = prcm;
3263#endif
3264
3265 recalculate_root_clocks();
3266
3267 printk(KERN_INFO "Clocking rate (Crystal/Core/MPU): "
3268 "%ld.%01ld/%ld/%ld MHz\n",
3269 (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
3270 (core_ck.rate / 1000000), (arm_fck.rate / 1000000));
3271
3272 /*
3273 * Only enable those clocks we will need, let the drivers
3274 * enable other clocks as necessary
3275 */
3276 clk_enable_init_clocks();
3277
3278 /*
3279 * Lock DPLL5 and put it in autoidle.
3280 */
3281 if (omap_rev() >= OMAP3430_REV_ES2_0)
3282 omap3_clk_lock_dpll5();
3283
3284 /* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
3285 sdrc_ick_p = clk_get(NULL, "sdrc_ick");
3286 arm_fck_p = clk_get(NULL, "arm_fck");
3287
3288 return 0;
3289}
diff --git a/arch/arm/mach-omap2/clock44xx.c b/arch/arm/mach-omap2/clock44xx.c
new file mode 100644
index 000000000000..e370868a79a8
--- /dev/null
+++ b/arch/arm/mach-omap2/clock44xx.c
@@ -0,0 +1,33 @@
1/*
2 * OMAP4-specific clock framework functions
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 *
6 * Rajendra Nayak (rnayak@ti.com)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/errno.h>
14#include "clock.h"
15
16struct clk_functions omap2_clk_functions = {
17 .clk_enable = omap2_clk_enable,
18 .clk_disable = omap2_clk_disable,
19 .clk_round_rate = omap2_clk_round_rate,
20 .clk_set_rate = omap2_clk_set_rate,
21 .clk_set_parent = omap2_clk_set_parent,
22 .clk_disable_unused = omap2_clk_disable_unused,
23};
24
25const struct clkops clkops_noncore_dpll_ops = {
26 .enable = &omap3_noncore_dpll_enable,
27 .disable = &omap3_noncore_dpll_disable,
28};
29
30void omap2_clk_prepare_for_reboot(void)
31{
32 return;
33}
diff --git a/arch/arm/mach-omap2/clock44xx.h b/arch/arm/mach-omap2/clock44xx.h
new file mode 100644
index 000000000000..59b9ced4daa1
--- /dev/null
+++ b/arch/arm/mach-omap2/clock44xx.h
@@ -0,0 +1,15 @@
1/*
2 * OMAP4 clock function prototypes and macros
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 */
6
7#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK_44XX_H
8#define __ARCH_ARM_MACH_OMAP2_CLOCK_44XX_H
9
10#define OMAP4430_MAX_DPLL_MULT 2048
11#define OMAP4430_MAX_DPLL_DIV 128
12
13extern const struct clkops clkops_noncore_dpll_ops;
14
15#endif
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
new file mode 100644
index 000000000000..2210e227d78a
--- /dev/null
+++ b/arch/arm/mach-omap2/clock44xx_data.c
@@ -0,0 +1,2766 @@
1/*
2 * OMAP4 Clock data
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#include <linux/kernel.h>
23#include <linux/module.h>
24#include <linux/clk.h>
25
26#include <plat/control.h>
27#include <plat/clkdev_omap.h>
28
29#include "clock.h"
30#include "clock44xx.h"
31#include "cm.h"
32#include "cm-regbits-44xx.h"
33#include "prm.h"
34#include "prm-regbits-44xx.h"
35
36/* Root clocks */
37
38static struct clk extalt_clkin_ck = {
39 .name = "extalt_clkin_ck",
40 .rate = 59000000,
41 .ops = &clkops_null,
42 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
43};
44
45static struct clk pad_clks_ck = {
46 .name = "pad_clks_ck",
47 .rate = 12000000,
48 .ops = &clkops_null,
49 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
50};
51
52static struct clk pad_slimbus_core_clks_ck = {
53 .name = "pad_slimbus_core_clks_ck",
54 .rate = 12000000,
55 .ops = &clkops_null,
56 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
57};
58
59static struct clk secure_32k_clk_src_ck = {
60 .name = "secure_32k_clk_src_ck",
61 .rate = 32768,
62 .ops = &clkops_null,
63 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
64};
65
66static struct clk slimbus_clk = {
67 .name = "slimbus_clk",
68 .rate = 12000000,
69 .ops = &clkops_null,
70 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
71};
72
73static struct clk sys_32k_ck = {
74 .name = "sys_32k_ck",
75 .rate = 32768,
76 .ops = &clkops_null,
77 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
78};
79
80static struct clk virt_12000000_ck = {
81 .name = "virt_12000000_ck",
82 .ops = &clkops_null,
83 .rate = 12000000,
84};
85
86static struct clk virt_13000000_ck = {
87 .name = "virt_13000000_ck",
88 .ops = &clkops_null,
89 .rate = 13000000,
90};
91
92static struct clk virt_16800000_ck = {
93 .name = "virt_16800000_ck",
94 .ops = &clkops_null,
95 .rate = 16800000,
96};
97
98static struct clk virt_19200000_ck = {
99 .name = "virt_19200000_ck",
100 .ops = &clkops_null,
101 .rate = 19200000,
102};
103
104static struct clk virt_26000000_ck = {
105 .name = "virt_26000000_ck",
106 .ops = &clkops_null,
107 .rate = 26000000,
108};
109
110static struct clk virt_27000000_ck = {
111 .name = "virt_27000000_ck",
112 .ops = &clkops_null,
113 .rate = 27000000,
114};
115
116static struct clk virt_38400000_ck = {
117 .name = "virt_38400000_ck",
118 .ops = &clkops_null,
119 .rate = 38400000,
120};
121
122static const struct clksel_rate div_1_0_rates[] = {
123 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
124 { .div = 0 },
125};
126
127static const struct clksel_rate div_1_1_rates[] = {
128 { .div = 1, .val = 1, .flags = RATE_IN_4430 },
129 { .div = 0 },
130};
131
132static const struct clksel_rate div_1_2_rates[] = {
133 { .div = 1, .val = 2, .flags = RATE_IN_4430 },
134 { .div = 0 },
135};
136
137static const struct clksel_rate div_1_3_rates[] = {
138 { .div = 1, .val = 3, .flags = RATE_IN_4430 },
139 { .div = 0 },
140};
141
142static const struct clksel_rate div_1_4_rates[] = {
143 { .div = 1, .val = 4, .flags = RATE_IN_4430 },
144 { .div = 0 },
145};
146
147static const struct clksel_rate div_1_5_rates[] = {
148 { .div = 1, .val = 5, .flags = RATE_IN_4430 },
149 { .div = 0 },
150};
151
152static const struct clksel_rate div_1_6_rates[] = {
153 { .div = 1, .val = 6, .flags = RATE_IN_4430 },
154 { .div = 0 },
155};
156
157static const struct clksel_rate div_1_7_rates[] = {
158 { .div = 1, .val = 7, .flags = RATE_IN_4430 },
159 { .div = 0 },
160};
161
162static const struct clksel sys_clkin_sel[] = {
163 { .parent = &virt_12000000_ck, .rates = div_1_1_rates },
164 { .parent = &virt_13000000_ck, .rates = div_1_2_rates },
165 { .parent = &virt_16800000_ck, .rates = div_1_3_rates },
166 { .parent = &virt_19200000_ck, .rates = div_1_4_rates },
167 { .parent = &virt_26000000_ck, .rates = div_1_5_rates },
168 { .parent = &virt_27000000_ck, .rates = div_1_6_rates },
169 { .parent = &virt_38400000_ck, .rates = div_1_7_rates },
170 { .parent = NULL },
171};
172
173static struct clk sys_clkin_ck = {
174 .name = "sys_clkin_ck",
175 .rate = 38400000,
176 .clksel = sys_clkin_sel,
177 .init = &omap2_init_clksel_parent,
178 .clksel_reg = OMAP4430_CM_SYS_CLKSEL,
179 .clksel_mask = OMAP4430_SYS_CLKSEL_MASK,
180 .ops = &clkops_null,
181 .recalc = &omap2_clksel_recalc,
182 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
183};
184
185static struct clk utmi_phy_clkout_ck = {
186 .name = "utmi_phy_clkout_ck",
187 .rate = 12000000,
188 .ops = &clkops_null,
189 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
190};
191
192static struct clk xclk60mhsp1_ck = {
193 .name = "xclk60mhsp1_ck",
194 .rate = 12000000,
195 .ops = &clkops_null,
196 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
197};
198
199static struct clk xclk60mhsp2_ck = {
200 .name = "xclk60mhsp2_ck",
201 .rate = 12000000,
202 .ops = &clkops_null,
203 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
204};
205
206static struct clk xclk60motg_ck = {
207 .name = "xclk60motg_ck",
208 .rate = 60000000,
209 .ops = &clkops_null,
210 .flags = CLOCK_IN_OMAP4430 | ALWAYS_ENABLED,
211};
212
213/* Module clocks and DPLL outputs */
214
215static const struct clksel_rate div2_1to2_rates[] = {
216 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
217 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
218 { .div = 0 },
219};
220
221static const struct clksel dpll_sys_ref_clk_div[] = {
222 { .parent = &sys_clkin_ck, .rates = div2_1to2_rates },
223 { .parent = NULL },
224};
225
226static struct clk dpll_sys_ref_clk = {
227 .name = "dpll_sys_ref_clk",
228 .parent = &sys_clkin_ck,
229 .clksel = dpll_sys_ref_clk_div,
230 .clksel_reg = OMAP4430_CM_DPLL_SYS_REF_CLKSEL,
231 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
232 .ops = &clkops_null,
233 .recalc = &omap2_clksel_recalc,
234 .round_rate = &omap2_clksel_round_rate,
235 .set_rate = &omap2_clksel_set_rate,
236 .flags = CLOCK_IN_OMAP4430,
237};
238
239static const struct clksel abe_dpll_refclk_mux_sel[] = {
240 { .parent = &dpll_sys_ref_clk, .rates = div_1_0_rates },
241 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
242 { .parent = NULL },
243};
244
245static struct clk abe_dpll_refclk_mux_ck = {
246 .name = "abe_dpll_refclk_mux_ck",
247 .parent = &dpll_sys_ref_clk,
248 .clksel = abe_dpll_refclk_mux_sel,
249 .init = &omap2_init_clksel_parent,
250 .clksel_reg = OMAP4430_CM_ABE_PLL_REF_CLKSEL,
251 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
252 .ops = &clkops_null,
253 .recalc = &omap2_clksel_recalc,
254 .flags = CLOCK_IN_OMAP4430,
255};
256
257/* DPLL_ABE */
258static struct dpll_data dpll_abe_dd = {
259 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
260 .clk_bypass = &sys_clkin_ck,
261 .clk_ref = &abe_dpll_refclk_mux_ck,
262 .control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
263 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
264 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
265 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
266 .mult_mask = OMAP4430_DPLL_MULT_MASK,
267 .div1_mask = OMAP4430_DPLL_DIV_MASK,
268 .enable_mask = OMAP4430_DPLL_EN_MASK,
269 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
270 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
271 .max_multiplier = OMAP4430_MAX_DPLL_MULT,
272 .max_divider = OMAP4430_MAX_DPLL_DIV,
273 .min_divider = 1,
274};
275
276
277static struct clk dpll_abe_ck = {
278 .name = "dpll_abe_ck",
279 .parent = &abe_dpll_refclk_mux_ck,
280 .dpll_data = &dpll_abe_dd,
281 .init = &omap2_init_dpll_parent,
282 .ops = &clkops_noncore_dpll_ops,
283 .recalc = &omap3_dpll_recalc,
284 .round_rate = &omap2_dpll_round_rate,
285 .set_rate = &omap3_noncore_dpll_set_rate,
286 .flags = CLOCK_IN_OMAP4430,
287};
288
289static struct clk dpll_abe_m2x2_ck = {
290 .name = "dpll_abe_m2x2_ck",
291 .parent = &dpll_abe_ck,
292 .ops = &clkops_null,
293 .recalc = &followparent_recalc,
294 .flags = CLOCK_IN_OMAP4430,
295};
296
297static struct clk abe_24m_fclk = {
298 .name = "abe_24m_fclk",
299 .parent = &dpll_abe_m2x2_ck,
300 .ops = &clkops_null,
301 .recalc = &followparent_recalc,
302 .flags = CLOCK_IN_OMAP4430,
303};
304
305static const struct clksel_rate div3_1to4_rates[] = {
306 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
307 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
308 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
309 { .div = 0 },
310};
311
312static const struct clksel abe_clk_div[] = {
313 { .parent = &dpll_abe_m2x2_ck, .rates = div3_1to4_rates },
314 { .parent = NULL },
315};
316
317static struct clk abe_clk = {
318 .name = "abe_clk",
319 .parent = &dpll_abe_m2x2_ck,
320 .clksel = abe_clk_div,
321 .clksel_reg = OMAP4430_CM_CLKSEL_ABE,
322 .clksel_mask = OMAP4430_CLKSEL_OPP_MASK,
323 .ops = &clkops_null,
324 .recalc = &omap2_clksel_recalc,
325 .round_rate = &omap2_clksel_round_rate,
326 .set_rate = &omap2_clksel_set_rate,
327 .flags = CLOCK_IN_OMAP4430,
328};
329
330static const struct clksel aess_fclk_div[] = {
331 { .parent = &abe_clk, .rates = div2_1to2_rates },
332 { .parent = NULL },
333};
334
335static struct clk aess_fclk = {
336 .name = "aess_fclk",
337 .parent = &abe_clk,
338 .clksel = aess_fclk_div,
339 .clksel_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
340 .clksel_mask = OMAP4430_CLKSEL_AESS_FCLK_MASK,
341 .ops = &clkops_null,
342 .recalc = &omap2_clksel_recalc,
343 .round_rate = &omap2_clksel_round_rate,
344 .set_rate = &omap2_clksel_set_rate,
345 .flags = CLOCK_IN_OMAP4430,
346};
347
348static const struct clksel_rate div31_1to31_rates[] = {
349 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
350 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
351 { .div = 3, .val = 2, .flags = RATE_IN_4430 },
352 { .div = 4, .val = 3, .flags = RATE_IN_4430 },
353 { .div = 5, .val = 4, .flags = RATE_IN_4430 },
354 { .div = 6, .val = 5, .flags = RATE_IN_4430 },
355 { .div = 7, .val = 6, .flags = RATE_IN_4430 },
356 { .div = 8, .val = 7, .flags = RATE_IN_4430 },
357 { .div = 9, .val = 8, .flags = RATE_IN_4430 },
358 { .div = 10, .val = 9, .flags = RATE_IN_4430 },
359 { .div = 11, .val = 10, .flags = RATE_IN_4430 },
360 { .div = 12, .val = 11, .flags = RATE_IN_4430 },
361 { .div = 13, .val = 12, .flags = RATE_IN_4430 },
362 { .div = 14, .val = 13, .flags = RATE_IN_4430 },
363 { .div = 15, .val = 14, .flags = RATE_IN_4430 },
364 { .div = 16, .val = 15, .flags = RATE_IN_4430 },
365 { .div = 17, .val = 16, .flags = RATE_IN_4430 },
366 { .div = 18, .val = 17, .flags = RATE_IN_4430 },
367 { .div = 19, .val = 18, .flags = RATE_IN_4430 },
368 { .div = 20, .val = 19, .flags = RATE_IN_4430 },
369 { .div = 21, .val = 20, .flags = RATE_IN_4430 },
370 { .div = 22, .val = 21, .flags = RATE_IN_4430 },
371 { .div = 23, .val = 22, .flags = RATE_IN_4430 },
372 { .div = 24, .val = 23, .flags = RATE_IN_4430 },
373 { .div = 25, .val = 24, .flags = RATE_IN_4430 },
374 { .div = 26, .val = 25, .flags = RATE_IN_4430 },
375 { .div = 27, .val = 26, .flags = RATE_IN_4430 },
376 { .div = 28, .val = 27, .flags = RATE_IN_4430 },
377 { .div = 29, .val = 28, .flags = RATE_IN_4430 },
378 { .div = 30, .val = 29, .flags = RATE_IN_4430 },
379 { .div = 31, .val = 30, .flags = RATE_IN_4430 },
380 { .div = 0 },
381};
382
383static const struct clksel dpll_abe_m3_div[] = {
384 { .parent = &dpll_abe_ck, .rates = div31_1to31_rates },
385 { .parent = NULL },
386};
387
388static struct clk dpll_abe_m3_ck = {
389 .name = "dpll_abe_m3_ck",
390 .parent = &dpll_abe_ck,
391 .clksel = dpll_abe_m3_div,
392 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_ABE,
393 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
394 .ops = &clkops_null,
395 .recalc = &omap2_clksel_recalc,
396 .round_rate = &omap2_clksel_round_rate,
397 .set_rate = &omap2_clksel_set_rate,
398 .flags = CLOCK_IN_OMAP4430,
399};
400
401static const struct clksel core_hsd_byp_clk_mux_sel[] = {
402 { .parent = &dpll_sys_ref_clk, .rates = div_1_0_rates },
403 { .parent = &dpll_abe_m3_ck, .rates = div_1_1_rates },
404 { .parent = NULL },
405};
406
407static struct clk core_hsd_byp_clk_mux_ck = {
408 .name = "core_hsd_byp_clk_mux_ck",
409 .parent = &dpll_sys_ref_clk,
410 .clksel = core_hsd_byp_clk_mux_sel,
411 .init = &omap2_init_clksel_parent,
412 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
413 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
414 .ops = &clkops_null,
415 .recalc = &omap2_clksel_recalc,
416 .flags = CLOCK_IN_OMAP4430,
417};
418
419/* DPLL_CORE */
420static struct dpll_data dpll_core_dd = {
421 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
422 .clk_bypass = &core_hsd_byp_clk_mux_ck,
423 .clk_ref = &dpll_sys_ref_clk,
424 .control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
425 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
426 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
427 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
428 .mult_mask = OMAP4430_DPLL_MULT_MASK,
429 .div1_mask = OMAP4430_DPLL_DIV_MASK,
430 .enable_mask = OMAP4430_DPLL_EN_MASK,
431 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
432 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
433 .max_multiplier = OMAP4430_MAX_DPLL_MULT,
434 .max_divider = OMAP4430_MAX_DPLL_DIV,
435 .min_divider = 1,
436};
437
438
439static struct clk dpll_core_ck = {
440 .name = "dpll_core_ck",
441 .parent = &dpll_sys_ref_clk,
442 .dpll_data = &dpll_core_dd,
443 .init = &omap2_init_dpll_parent,
444 .ops = &clkops_null,
445 .recalc = &omap3_dpll_recalc,
446 .flags = CLOCK_IN_OMAP4430,
447};
448
449static const struct clksel dpll_core_m6_div[] = {
450 { .parent = &dpll_core_ck, .rates = div31_1to31_rates },
451 { .parent = NULL },
452};
453
454static struct clk dpll_core_m6_ck = {
455 .name = "dpll_core_m6_ck",
456 .parent = &dpll_core_ck,
457 .clksel = dpll_core_m6_div,
458 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_CORE,
459 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
460 .ops = &clkops_null,
461 .recalc = &omap2_clksel_recalc,
462 .round_rate = &omap2_clksel_round_rate,
463 .set_rate = &omap2_clksel_set_rate,
464 .flags = CLOCK_IN_OMAP4430,
465};
466
467static const struct clksel dbgclk_mux_sel[] = {
468 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
469 { .parent = &dpll_core_m6_ck, .rates = div_1_1_rates },
470 { .parent = NULL },
471};
472
473static struct clk dbgclk_mux_ck = {
474 .name = "dbgclk_mux_ck",
475 .parent = &sys_clkin_ck,
476 .ops = &clkops_null,
477 .recalc = &followparent_recalc,
478 .flags = CLOCK_IN_OMAP4430,
479};
480
481static struct clk dpll_core_m2_ck = {
482 .name = "dpll_core_m2_ck",
483 .parent = &dpll_core_ck,
484 .clksel = dpll_core_m6_div,
485 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_CORE,
486 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
487 .ops = &clkops_null,
488 .recalc = &omap2_clksel_recalc,
489 .round_rate = &omap2_clksel_round_rate,
490 .set_rate = &omap2_clksel_set_rate,
491 .flags = CLOCK_IN_OMAP4430,
492};
493
494static struct clk ddrphy_ck = {
495 .name = "ddrphy_ck",
496 .parent = &dpll_core_m2_ck,
497 .ops = &clkops_null,
498 .recalc = &followparent_recalc,
499 .flags = CLOCK_IN_OMAP4430,
500};
501
502static struct clk dpll_core_m5_ck = {
503 .name = "dpll_core_m5_ck",
504 .parent = &dpll_core_ck,
505 .clksel = dpll_core_m6_div,
506 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_CORE,
507 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
508 .ops = &clkops_null,
509 .recalc = &omap2_clksel_recalc,
510 .round_rate = &omap2_clksel_round_rate,
511 .set_rate = &omap2_clksel_set_rate,
512 .flags = CLOCK_IN_OMAP4430,
513};
514
515static const struct clksel div_core_div[] = {
516 { .parent = &dpll_core_m5_ck, .rates = div2_1to2_rates },
517 { .parent = NULL },
518};
519
520static struct clk div_core_ck = {
521 .name = "div_core_ck",
522 .parent = &dpll_core_m5_ck,
523 .clksel = div_core_div,
524 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
525 .clksel_mask = OMAP4430_CLKSEL_CORE_MASK,
526 .ops = &clkops_null,
527 .recalc = &omap2_clksel_recalc,
528 .round_rate = &omap2_clksel_round_rate,
529 .set_rate = &omap2_clksel_set_rate,
530 .flags = CLOCK_IN_OMAP4430,
531};
532
533static const struct clksel_rate div4_1to8_rates[] = {
534 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
535 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
536 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
537 { .div = 8, .val = 3, .flags = RATE_IN_4430 },
538 { .div = 0 },
539};
540
541static const struct clksel div_iva_hs_clk_div[] = {
542 { .parent = &dpll_core_m5_ck, .rates = div4_1to8_rates },
543 { .parent = NULL },
544};
545
546static struct clk div_iva_hs_clk = {
547 .name = "div_iva_hs_clk",
548 .parent = &dpll_core_m5_ck,
549 .clksel = div_iva_hs_clk_div,
550 .clksel_reg = OMAP4430_CM_BYPCLK_DPLL_IVA,
551 .clksel_mask = OMAP4430_CLKSEL_0_1_MASK,
552 .ops = &clkops_null,
553 .recalc = &omap2_clksel_recalc,
554 .round_rate = &omap2_clksel_round_rate,
555 .set_rate = &omap2_clksel_set_rate,
556 .flags = CLOCK_IN_OMAP4430,
557};
558
559static struct clk div_mpu_hs_clk = {
560 .name = "div_mpu_hs_clk",
561 .parent = &dpll_core_m5_ck,
562 .clksel = div_iva_hs_clk_div,
563 .clksel_reg = OMAP4430_CM_BYPCLK_DPLL_MPU,
564 .clksel_mask = OMAP4430_CLKSEL_0_1_MASK,
565 .ops = &clkops_null,
566 .recalc = &omap2_clksel_recalc,
567 .round_rate = &omap2_clksel_round_rate,
568 .set_rate = &omap2_clksel_set_rate,
569 .flags = CLOCK_IN_OMAP4430,
570};
571
572static struct clk dpll_core_m4_ck = {
573 .name = "dpll_core_m4_ck",
574 .parent = &dpll_core_ck,
575 .clksel = dpll_core_m6_div,
576 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_CORE,
577 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
578 .ops = &clkops_null,
579 .recalc = &omap2_clksel_recalc,
580 .round_rate = &omap2_clksel_round_rate,
581 .set_rate = &omap2_clksel_set_rate,
582 .flags = CLOCK_IN_OMAP4430,
583};
584
585static struct clk dll_clk_div_ck = {
586 .name = "dll_clk_div_ck",
587 .parent = &dpll_core_m4_ck,
588 .ops = &clkops_null,
589 .recalc = &followparent_recalc,
590 .flags = CLOCK_IN_OMAP4430,
591};
592
593static struct clk dpll_abe_m2_ck = {
594 .name = "dpll_abe_m2_ck",
595 .parent = &dpll_abe_ck,
596 .clksel = dpll_abe_m3_div,
597 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
598 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
599 .ops = &clkops_null,
600 .recalc = &omap2_clksel_recalc,
601 .round_rate = &omap2_clksel_round_rate,
602 .set_rate = &omap2_clksel_set_rate,
603 .flags = CLOCK_IN_OMAP4430,
604};
605
606static struct clk dpll_core_m3_ck = {
607 .name = "dpll_core_m3_ck",
608 .parent = &dpll_core_ck,
609 .clksel = dpll_core_m6_div,
610 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_CORE,
611 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
612 .ops = &clkops_null,
613 .recalc = &omap2_clksel_recalc,
614 .round_rate = &omap2_clksel_round_rate,
615 .set_rate = &omap2_clksel_set_rate,
616 .flags = CLOCK_IN_OMAP4430,
617};
618
619static struct clk dpll_core_m7_ck = {
620 .name = "dpll_core_m7_ck",
621 .parent = &dpll_core_ck,
622 .clksel = dpll_core_m6_div,
623 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_CORE,
624 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
625 .ops = &clkops_null,
626 .recalc = &omap2_clksel_recalc,
627 .round_rate = &omap2_clksel_round_rate,
628 .set_rate = &omap2_clksel_set_rate,
629 .flags = CLOCK_IN_OMAP4430,
630};
631
632static const struct clksel iva_hsd_byp_clk_mux_sel[] = {
633 { .parent = &dpll_sys_ref_clk, .rates = div_1_0_rates },
634 { .parent = &div_iva_hs_clk, .rates = div_1_1_rates },
635 { .parent = NULL },
636};
637
638static struct clk iva_hsd_byp_clk_mux_ck = {
639 .name = "iva_hsd_byp_clk_mux_ck",
640 .parent = &dpll_sys_ref_clk,
641 .ops = &clkops_null,
642 .recalc = &followparent_recalc,
643 .flags = CLOCK_IN_OMAP4430,
644};
645
646/* DPLL_IVA */
647static struct dpll_data dpll_iva_dd = {
648 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
649 .clk_bypass = &iva_hsd_byp_clk_mux_ck,
650 .clk_ref = &dpll_sys_ref_clk,
651 .control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
652 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
653 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
654 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
655 .mult_mask = OMAP4430_DPLL_MULT_MASK,
656 .div1_mask = OMAP4430_DPLL_DIV_MASK,
657 .enable_mask = OMAP4430_DPLL_EN_MASK,
658 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
659 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
660 .max_multiplier = OMAP4430_MAX_DPLL_MULT,
661 .max_divider = OMAP4430_MAX_DPLL_DIV,
662 .min_divider = 1,
663};
664
665
666static struct clk dpll_iva_ck = {
667 .name = "dpll_iva_ck",
668 .parent = &dpll_sys_ref_clk,
669 .dpll_data = &dpll_iva_dd,
670 .init = &omap2_init_dpll_parent,
671 .ops = &clkops_noncore_dpll_ops,
672 .recalc = &omap3_dpll_recalc,
673 .round_rate = &omap2_dpll_round_rate,
674 .set_rate = &omap3_noncore_dpll_set_rate,
675 .flags = CLOCK_IN_OMAP4430,
676};
677
678static const struct clksel dpll_iva_m4_div[] = {
679 { .parent = &dpll_iva_ck, .rates = div31_1to31_rates },
680 { .parent = NULL },
681};
682
683static struct clk dpll_iva_m4_ck = {
684 .name = "dpll_iva_m4_ck",
685 .parent = &dpll_iva_ck,
686 .clksel = dpll_iva_m4_div,
687 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_IVA,
688 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
689 .ops = &clkops_null,
690 .recalc = &omap2_clksel_recalc,
691 .round_rate = &omap2_clksel_round_rate,
692 .set_rate = &omap2_clksel_set_rate,
693 .flags = CLOCK_IN_OMAP4430,
694};
695
696static struct clk dpll_iva_m5_ck = {
697 .name = "dpll_iva_m5_ck",
698 .parent = &dpll_iva_ck,
699 .clksel = dpll_iva_m4_div,
700 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_IVA,
701 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
702 .ops = &clkops_null,
703 .recalc = &omap2_clksel_recalc,
704 .round_rate = &omap2_clksel_round_rate,
705 .set_rate = &omap2_clksel_set_rate,
706 .flags = CLOCK_IN_OMAP4430,
707};
708
709/* DPLL_MPU */
710static struct dpll_data dpll_mpu_dd = {
711 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
712 .clk_bypass = &div_mpu_hs_clk,
713 .clk_ref = &dpll_sys_ref_clk,
714 .control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
715 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
716 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
717 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
718 .mult_mask = OMAP4430_DPLL_MULT_MASK,
719 .div1_mask = OMAP4430_DPLL_DIV_MASK,
720 .enable_mask = OMAP4430_DPLL_EN_MASK,
721 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
722 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
723 .max_multiplier = OMAP4430_MAX_DPLL_MULT,
724 .max_divider = OMAP4430_MAX_DPLL_DIV,
725 .min_divider = 1,
726};
727
728
729static struct clk dpll_mpu_ck = {
730 .name = "dpll_mpu_ck",
731 .parent = &dpll_sys_ref_clk,
732 .dpll_data = &dpll_mpu_dd,
733 .init = &omap2_init_dpll_parent,
734 .ops = &clkops_noncore_dpll_ops,
735 .recalc = &omap3_dpll_recalc,
736 .round_rate = &omap2_dpll_round_rate,
737 .set_rate = &omap3_noncore_dpll_set_rate,
738 .flags = CLOCK_IN_OMAP4430,
739};
740
741static const struct clksel dpll_mpu_m2_div[] = {
742 { .parent = &dpll_mpu_ck, .rates = div31_1to31_rates },
743 { .parent = NULL },
744};
745
746static struct clk dpll_mpu_m2_ck = {
747 .name = "dpll_mpu_m2_ck",
748 .parent = &dpll_mpu_ck,
749 .clksel = dpll_mpu_m2_div,
750 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU,
751 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
752 .ops = &clkops_null,
753 .recalc = &omap2_clksel_recalc,
754 .round_rate = &omap2_clksel_round_rate,
755 .set_rate = &omap2_clksel_set_rate,
756 .flags = CLOCK_IN_OMAP4430,
757};
758
759static struct clk per_hs_clk_div_ck = {
760 .name = "per_hs_clk_div_ck",
761 .parent = &dpll_abe_m3_ck,
762 .ops = &clkops_null,
763 .recalc = &followparent_recalc,
764 .flags = CLOCK_IN_OMAP4430,
765};
766
767static const struct clksel per_hsd_byp_clk_mux_sel[] = {
768 { .parent = &dpll_sys_ref_clk, .rates = div_1_0_rates },
769 { .parent = &per_hs_clk_div_ck, .rates = div_1_1_rates },
770 { .parent = NULL },
771};
772
773static struct clk per_hsd_byp_clk_mux_ck = {
774 .name = "per_hsd_byp_clk_mux_ck",
775 .parent = &dpll_sys_ref_clk,
776 .clksel = per_hsd_byp_clk_mux_sel,
777 .init = &omap2_init_clksel_parent,
778 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
779 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
780 .ops = &clkops_null,
781 .recalc = &omap2_clksel_recalc,
782 .flags = CLOCK_IN_OMAP4430,
783};
784
785/* DPLL_PER */
786static struct dpll_data dpll_per_dd = {
787 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
788 .clk_bypass = &per_hsd_byp_clk_mux_ck,
789 .clk_ref = &dpll_sys_ref_clk,
790 .control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
791 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
792 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
793 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
794 .mult_mask = OMAP4430_DPLL_MULT_MASK,
795 .div1_mask = OMAP4430_DPLL_DIV_MASK,
796 .enable_mask = OMAP4430_DPLL_EN_MASK,
797 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
798 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
799 .max_multiplier = OMAP4430_MAX_DPLL_MULT,
800 .max_divider = OMAP4430_MAX_DPLL_DIV,
801 .min_divider = 1,
802};
803
804
805static struct clk dpll_per_ck = {
806 .name = "dpll_per_ck",
807 .parent = &dpll_sys_ref_clk,
808 .dpll_data = &dpll_per_dd,
809 .init = &omap2_init_dpll_parent,
810 .ops = &clkops_noncore_dpll_ops,
811 .recalc = &omap3_dpll_recalc,
812 .round_rate = &omap2_dpll_round_rate,
813 .set_rate = &omap3_noncore_dpll_set_rate,
814 .flags = CLOCK_IN_OMAP4430,
815};
816
817static const struct clksel dpll_per_m2_div[] = {
818 { .parent = &dpll_per_ck, .rates = div31_1to31_rates },
819 { .parent = NULL },
820};
821
822static struct clk dpll_per_m2_ck = {
823 .name = "dpll_per_m2_ck",
824 .parent = &dpll_per_ck,
825 .clksel = dpll_per_m2_div,
826 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
827 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
828 .ops = &clkops_null,
829 .recalc = &omap2_clksel_recalc,
830 .round_rate = &omap2_clksel_round_rate,
831 .set_rate = &omap2_clksel_set_rate,
832 .flags = CLOCK_IN_OMAP4430,
833};
834
835static struct clk dpll_per_m2x2_ck = {
836 .name = "dpll_per_m2x2_ck",
837 .parent = &dpll_per_ck,
838 .ops = &clkops_null,
839 .recalc = &followparent_recalc,
840 .flags = CLOCK_IN_OMAP4430,
841};
842
843static struct clk dpll_per_m3_ck = {
844 .name = "dpll_per_m3_ck",
845 .parent = &dpll_per_ck,
846 .clksel = dpll_per_m2_div,
847 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_PER,
848 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
849 .ops = &clkops_null,
850 .recalc = &omap2_clksel_recalc,
851 .round_rate = &omap2_clksel_round_rate,
852 .set_rate = &omap2_clksel_set_rate,
853 .flags = CLOCK_IN_OMAP4430,
854};
855
856static struct clk dpll_per_m4_ck = {
857 .name = "dpll_per_m4_ck",
858 .parent = &dpll_per_ck,
859 .clksel = dpll_per_m2_div,
860 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_PER,
861 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
862 .ops = &clkops_null,
863 .recalc = &omap2_clksel_recalc,
864 .round_rate = &omap2_clksel_round_rate,
865 .set_rate = &omap2_clksel_set_rate,
866 .flags = CLOCK_IN_OMAP4430,
867};
868
869static struct clk dpll_per_m5_ck = {
870 .name = "dpll_per_m5_ck",
871 .parent = &dpll_per_ck,
872 .clksel = dpll_per_m2_div,
873 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_PER,
874 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
875 .ops = &clkops_null,
876 .recalc = &omap2_clksel_recalc,
877 .round_rate = &omap2_clksel_round_rate,
878 .set_rate = &omap2_clksel_set_rate,
879 .flags = CLOCK_IN_OMAP4430,
880};
881
882static struct clk dpll_per_m6_ck = {
883 .name = "dpll_per_m6_ck",
884 .parent = &dpll_per_ck,
885 .clksel = dpll_per_m2_div,
886 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_PER,
887 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
888 .ops = &clkops_null,
889 .recalc = &omap2_clksel_recalc,
890 .round_rate = &omap2_clksel_round_rate,
891 .set_rate = &omap2_clksel_set_rate,
892 .flags = CLOCK_IN_OMAP4430,
893};
894
895static struct clk dpll_per_m7_ck = {
896 .name = "dpll_per_m7_ck",
897 .parent = &dpll_per_ck,
898 .clksel = dpll_per_m2_div,
899 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_PER,
900 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
901 .ops = &clkops_null,
902 .recalc = &omap2_clksel_recalc,
903 .round_rate = &omap2_clksel_round_rate,
904 .set_rate = &omap2_clksel_set_rate,
905 .flags = CLOCK_IN_OMAP4430,
906};
907
908/* DPLL_UNIPRO */
909static struct dpll_data dpll_unipro_dd = {
910 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_UNIPRO,
911 .clk_bypass = &dpll_sys_ref_clk,
912 .clk_ref = &dpll_sys_ref_clk,
913 .control_reg = OMAP4430_CM_CLKMODE_DPLL_UNIPRO,
914 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
915 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_UNIPRO,
916 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_UNIPRO,
917 .mult_mask = OMAP4430_DPLL_MULT_MASK,
918 .div1_mask = OMAP4430_DPLL_DIV_MASK,
919 .enable_mask = OMAP4430_DPLL_EN_MASK,
920 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
921 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
922 .max_multiplier = OMAP4430_MAX_DPLL_MULT,
923 .max_divider = OMAP4430_MAX_DPLL_DIV,
924 .min_divider = 1,
925};
926
927
928static struct clk dpll_unipro_ck = {
929 .name = "dpll_unipro_ck",
930 .parent = &dpll_sys_ref_clk,
931 .dpll_data = &dpll_unipro_dd,
932 .init = &omap2_init_dpll_parent,
933 .ops = &clkops_noncore_dpll_ops,
934 .recalc = &omap3_dpll_recalc,
935 .round_rate = &omap2_dpll_round_rate,
936 .set_rate = &omap3_noncore_dpll_set_rate,
937 .flags = CLOCK_IN_OMAP4430,
938};
939
940static const struct clksel dpll_unipro_m2x2_div[] = {
941 { .parent = &dpll_unipro_ck, .rates = div31_1to31_rates },
942 { .parent = NULL },
943};
944
945static struct clk dpll_unipro_m2x2_ck = {
946 .name = "dpll_unipro_m2x2_ck",
947 .parent = &dpll_unipro_ck,
948 .clksel = dpll_unipro_m2x2_div,
949 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_UNIPRO,
950 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
951 .ops = &clkops_null,
952 .recalc = &omap2_clksel_recalc,
953 .round_rate = &omap2_clksel_round_rate,
954 .set_rate = &omap2_clksel_set_rate,
955 .flags = CLOCK_IN_OMAP4430,
956};
957
958static struct clk usb_hs_clk_div_ck = {
959 .name = "usb_hs_clk_div_ck",
960 .parent = &dpll_abe_m3_ck,
961 .ops = &clkops_null,
962 .recalc = &followparent_recalc,
963 .flags = CLOCK_IN_OMAP4430,
964};
965
966/* DPLL_USB */
967static struct dpll_data dpll_usb_dd = {
968 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
969 .clk_bypass = &usb_hs_clk_div_ck,
970 .clk_ref = &dpll_sys_ref_clk,
971 .control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
972 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
973 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
974 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
975 .mult_mask = OMAP4430_DPLL_MULT_MASK,
976 .div1_mask = OMAP4430_DPLL_DIV_MASK,
977 .enable_mask = OMAP4430_DPLL_EN_MASK,
978 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
979 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
980 .max_multiplier = OMAP4430_MAX_DPLL_MULT,
981 .max_divider = OMAP4430_MAX_DPLL_DIV,
982 .min_divider = 1,
983};
984
985
986static struct clk dpll_usb_ck = {
987 .name = "dpll_usb_ck",
988 .parent = &dpll_sys_ref_clk,
989 .dpll_data = &dpll_usb_dd,
990 .init = &omap2_init_dpll_parent,
991 .ops = &clkops_noncore_dpll_ops,
992 .recalc = &omap3_dpll_recalc,
993 .round_rate = &omap2_dpll_round_rate,
994 .set_rate = &omap3_noncore_dpll_set_rate,
995 .flags = CLOCK_IN_OMAP4430,
996};
997
998static struct clk dpll_usb_clkdcoldo_ck = {
999 .name = "dpll_usb_clkdcoldo_ck",
1000 .parent = &dpll_usb_ck,
1001 .ops = &clkops_null,
1002 .recalc = &followparent_recalc,
1003 .flags = CLOCK_IN_OMAP4430,
1004};
1005
1006static const struct clksel dpll_usb_m2_div[] = {
1007 { .parent = &dpll_usb_ck, .rates = div31_1to31_rates },
1008 { .parent = NULL },
1009};
1010
1011static struct clk dpll_usb_m2_ck = {
1012 .name = "dpll_usb_m2_ck",
1013 .parent = &dpll_usb_ck,
1014 .clksel = dpll_usb_m2_div,
1015 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_USB,
1016 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK,
1017 .ops = &clkops_null,
1018 .recalc = &omap2_clksel_recalc,
1019 .round_rate = &omap2_clksel_round_rate,
1020 .set_rate = &omap2_clksel_set_rate,
1021 .flags = CLOCK_IN_OMAP4430,
1022};
1023
1024static const struct clksel ducati_clk_mux_sel[] = {
1025 { .parent = &div_core_ck, .rates = div_1_0_rates },
1026 { .parent = &dpll_per_m6_ck, .rates = div_1_1_rates },
1027 { .parent = NULL },
1028};
1029
1030static struct clk ducati_clk_mux_ck = {
1031 .name = "ducati_clk_mux_ck",
1032 .parent = &div_core_ck,
1033 .clksel = ducati_clk_mux_sel,
1034 .init = &omap2_init_clksel_parent,
1035 .clksel_reg = OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT,
1036 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1037 .ops = &clkops_null,
1038 .recalc = &omap2_clksel_recalc,
1039 .flags = CLOCK_IN_OMAP4430,
1040};
1041
1042static struct clk func_12m_fclk = {
1043 .name = "func_12m_fclk",
1044 .parent = &dpll_per_m2x2_ck,
1045 .ops = &clkops_null,
1046 .recalc = &followparent_recalc,
1047 .flags = CLOCK_IN_OMAP4430,
1048};
1049
1050static struct clk func_24m_clk = {
1051 .name = "func_24m_clk",
1052 .parent = &dpll_per_m2_ck,
1053 .ops = &clkops_null,
1054 .recalc = &followparent_recalc,
1055 .flags = CLOCK_IN_OMAP4430,
1056};
1057
1058static struct clk func_24mc_fclk = {
1059 .name = "func_24mc_fclk",
1060 .parent = &dpll_per_m2x2_ck,
1061 .ops = &clkops_null,
1062 .recalc = &followparent_recalc,
1063 .flags = CLOCK_IN_OMAP4430,
1064};
1065
1066static const struct clksel_rate div2_4to8_rates[] = {
1067 { .div = 4, .val = 0, .flags = RATE_IN_4430 },
1068 { .div = 8, .val = 1, .flags = RATE_IN_4430 },
1069 { .div = 0 },
1070};
1071
1072static const struct clksel func_48m_fclk_div[] = {
1073 { .parent = &dpll_per_m2x2_ck, .rates = div2_4to8_rates },
1074 { .parent = NULL },
1075};
1076
1077static struct clk func_48m_fclk = {
1078 .name = "func_48m_fclk",
1079 .parent = &dpll_per_m2x2_ck,
1080 .clksel = func_48m_fclk_div,
1081 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1082 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1083 .ops = &clkops_null,
1084 .recalc = &omap2_clksel_recalc,
1085 .round_rate = &omap2_clksel_round_rate,
1086 .set_rate = &omap2_clksel_set_rate,
1087 .flags = CLOCK_IN_OMAP4430,
1088};
1089
1090static struct clk func_48mc_fclk = {
1091 .name = "func_48mc_fclk",
1092 .parent = &dpll_per_m2x2_ck,
1093 .ops = &clkops_null,
1094 .recalc = &followparent_recalc,
1095 .flags = CLOCK_IN_OMAP4430,
1096};
1097
1098static const struct clksel_rate div2_2to4_rates[] = {
1099 { .div = 2, .val = 0, .flags = RATE_IN_4430 },
1100 { .div = 4, .val = 1, .flags = RATE_IN_4430 },
1101 { .div = 0 },
1102};
1103
1104static const struct clksel func_64m_fclk_div[] = {
1105 { .parent = &dpll_per_m4_ck, .rates = div2_2to4_rates },
1106 { .parent = NULL },
1107};
1108
1109static struct clk func_64m_fclk = {
1110 .name = "func_64m_fclk",
1111 .parent = &dpll_per_m4_ck,
1112 .clksel = func_64m_fclk_div,
1113 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1114 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1115 .ops = &clkops_null,
1116 .recalc = &omap2_clksel_recalc,
1117 .round_rate = &omap2_clksel_round_rate,
1118 .set_rate = &omap2_clksel_set_rate,
1119 .flags = CLOCK_IN_OMAP4430,
1120};
1121
1122static const struct clksel func_96m_fclk_div[] = {
1123 { .parent = &dpll_per_m2x2_ck, .rates = div2_2to4_rates },
1124 { .parent = NULL },
1125};
1126
1127static struct clk func_96m_fclk = {
1128 .name = "func_96m_fclk",
1129 .parent = &dpll_per_m2x2_ck,
1130 .clksel = func_96m_fclk_div,
1131 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1132 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1133 .ops = &clkops_null,
1134 .recalc = &omap2_clksel_recalc,
1135 .round_rate = &omap2_clksel_round_rate,
1136 .set_rate = &omap2_clksel_set_rate,
1137 .flags = CLOCK_IN_OMAP4430,
1138};
1139
1140static const struct clksel hsmmc6_fclk_sel[] = {
1141 { .parent = &func_64m_fclk, .rates = div_1_0_rates },
1142 { .parent = &func_96m_fclk, .rates = div_1_1_rates },
1143 { .parent = NULL },
1144};
1145
1146static struct clk hsmmc6_fclk = {
1147 .name = "hsmmc6_fclk",
1148 .parent = &func_64m_fclk,
1149 .ops = &clkops_null,
1150 .recalc = &followparent_recalc,
1151 .flags = CLOCK_IN_OMAP4430,
1152};
1153
1154static const struct clksel_rate div2_1to8_rates[] = {
1155 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
1156 { .div = 8, .val = 1, .flags = RATE_IN_4430 },
1157 { .div = 0 },
1158};
1159
1160static const struct clksel init_60m_fclk_div[] = {
1161 { .parent = &dpll_usb_m2_ck, .rates = div2_1to8_rates },
1162 { .parent = NULL },
1163};
1164
1165static struct clk init_60m_fclk = {
1166 .name = "init_60m_fclk",
1167 .parent = &dpll_usb_m2_ck,
1168 .clksel = init_60m_fclk_div,
1169 .clksel_reg = OMAP4430_CM_CLKSEL_USB_60MHZ,
1170 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1171 .ops = &clkops_null,
1172 .recalc = &omap2_clksel_recalc,
1173 .round_rate = &omap2_clksel_round_rate,
1174 .set_rate = &omap2_clksel_set_rate,
1175 .flags = CLOCK_IN_OMAP4430,
1176};
1177
1178static const struct clksel l3_div_div[] = {
1179 { .parent = &div_core_ck, .rates = div2_1to2_rates },
1180 { .parent = NULL },
1181};
1182
1183static struct clk l3_div_ck = {
1184 .name = "l3_div_ck",
1185 .parent = &div_core_ck,
1186 .clksel = l3_div_div,
1187 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1188 .clksel_mask = OMAP4430_CLKSEL_L3_MASK,
1189 .ops = &clkops_null,
1190 .recalc = &omap2_clksel_recalc,
1191 .round_rate = &omap2_clksel_round_rate,
1192 .set_rate = &omap2_clksel_set_rate,
1193 .flags = CLOCK_IN_OMAP4430,
1194};
1195
1196static const struct clksel l4_div_div[] = {
1197 { .parent = &l3_div_ck, .rates = div2_1to2_rates },
1198 { .parent = NULL },
1199};
1200
1201static struct clk l4_div_ck = {
1202 .name = "l4_div_ck",
1203 .parent = &l3_div_ck,
1204 .clksel = l4_div_div,
1205 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1206 .clksel_mask = OMAP4430_CLKSEL_L4_MASK,
1207 .ops = &clkops_null,
1208 .recalc = &omap2_clksel_recalc,
1209 .round_rate = &omap2_clksel_round_rate,
1210 .set_rate = &omap2_clksel_set_rate,
1211 .flags = CLOCK_IN_OMAP4430,
1212};
1213
1214static struct clk lp_clk_div_ck = {
1215 .name = "lp_clk_div_ck",
1216 .parent = &dpll_abe_m2x2_ck,
1217 .ops = &clkops_null,
1218 .recalc = &followparent_recalc,
1219 .flags = CLOCK_IN_OMAP4430,
1220};
1221
1222static const struct clksel l4_wkup_clk_mux_sel[] = {
1223 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1224 { .parent = &lp_clk_div_ck, .rates = div_1_1_rates },
1225 { .parent = NULL },
1226};
1227
1228static struct clk l4_wkup_clk_mux_ck = {
1229 .name = "l4_wkup_clk_mux_ck",
1230 .parent = &sys_clkin_ck,
1231 .clksel = l4_wkup_clk_mux_sel,
1232 .init = &omap2_init_clksel_parent,
1233 .clksel_reg = OMAP4430_CM_L4_WKUP_CLKSEL,
1234 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1235 .ops = &clkops_null,
1236 .recalc = &omap2_clksel_recalc,
1237 .flags = CLOCK_IN_OMAP4430,
1238};
1239
1240static const struct clksel per_abe_nc_fclk_div[] = {
1241 { .parent = &dpll_abe_m2_ck, .rates = div2_1to2_rates },
1242 { .parent = NULL },
1243};
1244
1245static struct clk per_abe_nc_fclk = {
1246 .name = "per_abe_nc_fclk",
1247 .parent = &dpll_abe_m2_ck,
1248 .clksel = per_abe_nc_fclk_div,
1249 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1250 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1251 .ops = &clkops_null,
1252 .recalc = &omap2_clksel_recalc,
1253 .round_rate = &omap2_clksel_round_rate,
1254 .set_rate = &omap2_clksel_set_rate,
1255 .flags = CLOCK_IN_OMAP4430,
1256};
1257
1258static const struct clksel mcasp2_fclk_sel[] = {
1259 { .parent = &func_96m_fclk, .rates = div_1_0_rates },
1260 { .parent = &per_abe_nc_fclk, .rates = div_1_1_rates },
1261 { .parent = NULL },
1262};
1263
1264static struct clk mcasp2_fclk = {
1265 .name = "mcasp2_fclk",
1266 .parent = &func_96m_fclk,
1267 .ops = &clkops_null,
1268 .recalc = &followparent_recalc,
1269 .flags = CLOCK_IN_OMAP4430,
1270};
1271
1272static struct clk mcasp3_fclk = {
1273 .name = "mcasp3_fclk",
1274 .parent = &func_96m_fclk,
1275 .ops = &clkops_null,
1276 .recalc = &followparent_recalc,
1277 .flags = CLOCK_IN_OMAP4430,
1278};
1279
1280static struct clk ocp_abe_iclk = {
1281 .name = "ocp_abe_iclk",
1282 .parent = &aess_fclk,
1283 .ops = &clkops_null,
1284 .recalc = &followparent_recalc,
1285 .flags = CLOCK_IN_OMAP4430,
1286};
1287
1288static struct clk per_abe_24m_fclk = {
1289 .name = "per_abe_24m_fclk",
1290 .parent = &dpll_abe_m2_ck,
1291 .ops = &clkops_null,
1292 .recalc = &followparent_recalc,
1293 .flags = CLOCK_IN_OMAP4430,
1294};
1295
1296static const struct clksel pmd_stm_clock_mux_sel[] = {
1297 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1298 { .parent = &dpll_core_m6_ck, .rates = div_1_1_rates },
1299 { .parent = &dpll_per_m7_ck, .rates = div_1_2_rates },
1300 { .parent = NULL },
1301};
1302
1303static struct clk pmd_stm_clock_mux_ck = {
1304 .name = "pmd_stm_clock_mux_ck",
1305 .parent = &sys_clkin_ck,
1306 .ops = &clkops_null,
1307 .recalc = &followparent_recalc,
1308 .flags = CLOCK_IN_OMAP4430,
1309};
1310
1311static struct clk pmd_trace_clk_mux_ck = {
1312 .name = "pmd_trace_clk_mux_ck",
1313 .parent = &sys_clkin_ck,
1314 .ops = &clkops_null,
1315 .recalc = &followparent_recalc,
1316 .flags = CLOCK_IN_OMAP4430,
1317};
1318
1319static struct clk syc_clk_div_ck = {
1320 .name = "syc_clk_div_ck",
1321 .parent = &sys_clkin_ck,
1322 .clksel = dpll_sys_ref_clk_div,
1323 .clksel_reg = OMAP4430_CM_ABE_DSS_SYS_CLKSEL,
1324 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1325 .ops = &clkops_null,
1326 .recalc = &omap2_clksel_recalc,
1327 .round_rate = &omap2_clksel_round_rate,
1328 .set_rate = &omap2_clksel_set_rate,
1329 .flags = CLOCK_IN_OMAP4430,
1330};
1331
1332/* Leaf clocks controlled by modules */
1333
1334static struct clk aes1_ck = {
1335 .name = "aes1_ck",
1336 .ops = &clkops_omap2_dflt,
1337 .enable_reg = OMAP4430_CM_L4SEC_AES1_CLKCTRL,
1338 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1339 .clkdm_name = "l4_secure_clkdm",
1340 .parent = &l3_div_ck,
1341 .recalc = &followparent_recalc,
1342};
1343
1344static struct clk aes2_ck = {
1345 .name = "aes2_ck",
1346 .ops = &clkops_omap2_dflt,
1347 .enable_reg = OMAP4430_CM_L4SEC_AES2_CLKCTRL,
1348 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1349 .clkdm_name = "l4_secure_clkdm",
1350 .parent = &l3_div_ck,
1351 .recalc = &followparent_recalc,
1352};
1353
1354static struct clk aess_ck = {
1355 .name = "aess_ck",
1356 .ops = &clkops_omap2_dflt,
1357 .enable_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
1358 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1359 .clkdm_name = "abe_clkdm",
1360 .parent = &aess_fclk,
1361 .recalc = &followparent_recalc,
1362};
1363
1364static struct clk cust_efuse_ck = {
1365 .name = "cust_efuse_ck",
1366 .ops = &clkops_omap2_dflt,
1367 .enable_reg = OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL,
1368 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1369 .clkdm_name = "l4_cefuse_clkdm",
1370 .parent = &sys_clkin_ck,
1371 .recalc = &followparent_recalc,
1372};
1373
1374static struct clk des3des_ck = {
1375 .name = "des3des_ck",
1376 .ops = &clkops_omap2_dflt,
1377 .enable_reg = OMAP4430_CM_L4SEC_DES3DES_CLKCTRL,
1378 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1379 .clkdm_name = "l4_secure_clkdm",
1380 .parent = &l4_div_ck,
1381 .recalc = &followparent_recalc,
1382};
1383
1384static const struct clksel dmic_sync_mux_sel[] = {
1385 { .parent = &abe_24m_fclk, .rates = div_1_0_rates },
1386 { .parent = &syc_clk_div_ck, .rates = div_1_1_rates },
1387 { .parent = &func_24m_clk, .rates = div_1_2_rates },
1388 { .parent = NULL },
1389};
1390
1391static struct clk dmic_sync_mux_ck = {
1392 .name = "dmic_sync_mux_ck",
1393 .parent = &abe_24m_fclk,
1394 .clksel = dmic_sync_mux_sel,
1395 .init = &omap2_init_clksel_parent,
1396 .clksel_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1397 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1398 .ops = &clkops_null,
1399 .recalc = &omap2_clksel_recalc,
1400 .flags = CLOCK_IN_OMAP4430,
1401};
1402
1403static const struct clksel func_dmic_abe_gfclk_sel[] = {
1404 { .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
1405 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1406 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1407 { .parent = NULL },
1408};
1409
1410/* Merged func_dmic_abe_gfclk into dmic_ck */
1411static struct clk dmic_ck = {
1412 .name = "dmic_ck",
1413 .parent = &dmic_sync_mux_ck,
1414 .clksel = func_dmic_abe_gfclk_sel,
1415 .init = &omap2_init_clksel_parent,
1416 .clksel_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1417 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1418 .ops = &clkops_omap2_dflt,
1419 .recalc = &omap2_clksel_recalc,
1420 .flags = CLOCK_IN_OMAP4430,
1421 .enable_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1422 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1423 .clkdm_name = "abe_clkdm",
1424};
1425
1426static struct clk dss_ck = {
1427 .name = "dss_ck",
1428 .ops = &clkops_omap2_dflt,
1429 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1430 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1431 .clkdm_name = "l3_dss_clkdm",
1432 .parent = &l3_div_ck,
1433 .recalc = &followparent_recalc,
1434};
1435
1436static struct clk ducati_ck = {
1437 .name = "ducati_ck",
1438 .ops = &clkops_omap2_dflt,
1439 .enable_reg = OMAP4430_CM_DUCATI_DUCATI_CLKCTRL,
1440 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1441 .clkdm_name = "ducati_clkdm",
1442 .parent = &ducati_clk_mux_ck,
1443 .recalc = &followparent_recalc,
1444};
1445
1446static struct clk emif1_ck = {
1447 .name = "emif1_ck",
1448 .ops = &clkops_omap2_dflt,
1449 .enable_reg = OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
1450 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1451 .clkdm_name = "l3_emif_clkdm",
1452 .parent = &ddrphy_ck,
1453 .recalc = &followparent_recalc,
1454};
1455
1456static struct clk emif2_ck = {
1457 .name = "emif2_ck",
1458 .ops = &clkops_omap2_dflt,
1459 .enable_reg = OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
1460 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1461 .clkdm_name = "l3_emif_clkdm",
1462 .parent = &ddrphy_ck,
1463 .recalc = &followparent_recalc,
1464};
1465
1466static const struct clksel fdif_fclk_div[] = {
1467 { .parent = &dpll_per_m4_ck, .rates = div3_1to4_rates },
1468 { .parent = NULL },
1469};
1470
1471/* Merged fdif_fclk into fdif_ck */
1472static struct clk fdif_ck = {
1473 .name = "fdif_ck",
1474 .parent = &dpll_per_m4_ck,
1475 .clksel = fdif_fclk_div,
1476 .clksel_reg = OMAP4430_CM_CAM_FDIF_CLKCTRL,
1477 .clksel_mask = OMAP4430_CLKSEL_FCLK_MASK,
1478 .ops = &clkops_omap2_dflt,
1479 .recalc = &omap2_clksel_recalc,
1480 .round_rate = &omap2_clksel_round_rate,
1481 .set_rate = &omap2_clksel_set_rate,
1482 .flags = CLOCK_IN_OMAP4430,
1483 .enable_reg = OMAP4430_CM_CAM_FDIF_CLKCTRL,
1484 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1485 .clkdm_name = "iss_clkdm",
1486};
1487
1488static const struct clksel per_sgx_fclk_div[] = {
1489 { .parent = &dpll_per_m2x2_ck, .rates = div3_1to4_rates },
1490 { .parent = NULL },
1491};
1492
1493static struct clk per_sgx_fclk = {
1494 .name = "per_sgx_fclk",
1495 .parent = &dpll_per_m2x2_ck,
1496 .clksel = per_sgx_fclk_div,
1497 .clksel_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1498 .clksel_mask = OMAP4430_CLKSEL_PER_192M_MASK,
1499 .ops = &clkops_null,
1500 .recalc = &omap2_clksel_recalc,
1501 .round_rate = &omap2_clksel_round_rate,
1502 .set_rate = &omap2_clksel_set_rate,
1503 .flags = CLOCK_IN_OMAP4430,
1504};
1505
1506static const struct clksel sgx_clk_mux_sel[] = {
1507 { .parent = &dpll_core_m7_ck, .rates = div_1_0_rates },
1508 { .parent = &per_sgx_fclk, .rates = div_1_1_rates },
1509 { .parent = NULL },
1510};
1511
1512/* Merged sgx_clk_mux into gfx_ck */
1513static struct clk gfx_ck = {
1514 .name = "gfx_ck",
1515 .parent = &dpll_core_m7_ck,
1516 .clksel = sgx_clk_mux_sel,
1517 .init = &omap2_init_clksel_parent,
1518 .clksel_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1519 .clksel_mask = OMAP4430_CLKSEL_SGX_FCLK_MASK,
1520 .ops = &clkops_omap2_dflt,
1521 .recalc = &omap2_clksel_recalc,
1522 .flags = CLOCK_IN_OMAP4430,
1523 .enable_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1524 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1525 .clkdm_name = "l3_gfx_clkdm",
1526};
1527
1528static struct clk gpio1_ck = {
1529 .name = "gpio1_ck",
1530 .ops = &clkops_omap2_dflt,
1531 .enable_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
1532 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1533 .clkdm_name = "l4_wkup_clkdm",
1534 .parent = &l4_wkup_clk_mux_ck,
1535 .recalc = &followparent_recalc,
1536};
1537
1538static struct clk gpio2_ck = {
1539 .name = "gpio2_ck",
1540 .ops = &clkops_omap2_dflt,
1541 .enable_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
1542 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1543 .clkdm_name = "l4_per_clkdm",
1544 .parent = &l4_div_ck,
1545 .recalc = &followparent_recalc,
1546};
1547
1548static struct clk gpio3_ck = {
1549 .name = "gpio3_ck",
1550 .ops = &clkops_omap2_dflt,
1551 .enable_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
1552 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1553 .clkdm_name = "l4_per_clkdm",
1554 .parent = &l4_div_ck,
1555 .recalc = &followparent_recalc,
1556};
1557
1558static struct clk gpio4_ck = {
1559 .name = "gpio4_ck",
1560 .ops = &clkops_omap2_dflt,
1561 .enable_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
1562 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1563 .clkdm_name = "l4_per_clkdm",
1564 .parent = &l4_div_ck,
1565 .recalc = &followparent_recalc,
1566};
1567
1568static struct clk gpio5_ck = {
1569 .name = "gpio5_ck",
1570 .ops = &clkops_omap2_dflt,
1571 .enable_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
1572 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1573 .clkdm_name = "l4_per_clkdm",
1574 .parent = &l4_div_ck,
1575 .recalc = &followparent_recalc,
1576};
1577
1578static struct clk gpio6_ck = {
1579 .name = "gpio6_ck",
1580 .ops = &clkops_omap2_dflt,
1581 .enable_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
1582 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1583 .clkdm_name = "l4_per_clkdm",
1584 .parent = &l4_div_ck,
1585 .recalc = &followparent_recalc,
1586};
1587
1588static struct clk gpmc_ck = {
1589 .name = "gpmc_ck",
1590 .ops = &clkops_omap2_dflt,
1591 .enable_reg = OMAP4430_CM_L3_2_GPMC_CLKCTRL,
1592 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1593 .clkdm_name = "l3_2_clkdm",
1594 .parent = &l3_div_ck,
1595 .recalc = &followparent_recalc,
1596};
1597
1598static const struct clksel dmt1_clk_mux_sel[] = {
1599 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1600 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1601 { .parent = NULL },
1602};
1603
1604/* Merged dmt1_clk_mux into gptimer1_ck */
1605static struct clk gptimer1_ck = {
1606 .name = "gptimer1_ck",
1607 .parent = &sys_clkin_ck,
1608 .clksel = dmt1_clk_mux_sel,
1609 .init = &omap2_init_clksel_parent,
1610 .clksel_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
1611 .clksel_mask = OMAP4430_CLKSEL_MASK,
1612 .ops = &clkops_omap2_dflt,
1613 .recalc = &omap2_clksel_recalc,
1614 .flags = CLOCK_IN_OMAP4430,
1615 .enable_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
1616 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1617 .clkdm_name = "l4_wkup_clkdm",
1618};
1619
1620/* Merged cm2_dm10_mux into gptimer10_ck */
1621static struct clk gptimer10_ck = {
1622 .name = "gptimer10_ck",
1623 .parent = &sys_clkin_ck,
1624 .clksel = dmt1_clk_mux_sel,
1625 .init = &omap2_init_clksel_parent,
1626 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
1627 .clksel_mask = OMAP4430_CLKSEL_MASK,
1628 .ops = &clkops_omap2_dflt,
1629 .recalc = &omap2_clksel_recalc,
1630 .flags = CLOCK_IN_OMAP4430,
1631 .enable_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
1632 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1633 .clkdm_name = "l4_per_clkdm",
1634};
1635
1636/* Merged cm2_dm11_mux into gptimer11_ck */
1637static struct clk gptimer11_ck = {
1638 .name = "gptimer11_ck",
1639 .parent = &sys_clkin_ck,
1640 .clksel = dmt1_clk_mux_sel,
1641 .init = &omap2_init_clksel_parent,
1642 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
1643 .clksel_mask = OMAP4430_CLKSEL_MASK,
1644 .ops = &clkops_omap2_dflt,
1645 .recalc = &omap2_clksel_recalc,
1646 .flags = CLOCK_IN_OMAP4430,
1647 .enable_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
1648 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1649 .clkdm_name = "l4_per_clkdm",
1650};
1651
1652/* Merged cm2_dm2_mux into gptimer2_ck */
1653static struct clk gptimer2_ck = {
1654 .name = "gptimer2_ck",
1655 .parent = &sys_clkin_ck,
1656 .clksel = dmt1_clk_mux_sel,
1657 .init = &omap2_init_clksel_parent,
1658 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
1659 .clksel_mask = OMAP4430_CLKSEL_MASK,
1660 .ops = &clkops_omap2_dflt,
1661 .recalc = &omap2_clksel_recalc,
1662 .flags = CLOCK_IN_OMAP4430,
1663 .enable_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
1664 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1665 .clkdm_name = "l4_per_clkdm",
1666};
1667
1668/* Merged cm2_dm3_mux into gptimer3_ck */
1669static struct clk gptimer3_ck = {
1670 .name = "gptimer3_ck",
1671 .parent = &sys_clkin_ck,
1672 .clksel = dmt1_clk_mux_sel,
1673 .init = &omap2_init_clksel_parent,
1674 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
1675 .clksel_mask = OMAP4430_CLKSEL_MASK,
1676 .ops = &clkops_omap2_dflt,
1677 .recalc = &omap2_clksel_recalc,
1678 .flags = CLOCK_IN_OMAP4430,
1679 .enable_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
1680 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1681 .clkdm_name = "l4_per_clkdm",
1682};
1683
1684/* Merged cm2_dm4_mux into gptimer4_ck */
1685static struct clk gptimer4_ck = {
1686 .name = "gptimer4_ck",
1687 .parent = &sys_clkin_ck,
1688 .clksel = dmt1_clk_mux_sel,
1689 .init = &omap2_init_clksel_parent,
1690 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
1691 .clksel_mask = OMAP4430_CLKSEL_MASK,
1692 .ops = &clkops_omap2_dflt,
1693 .recalc = &omap2_clksel_recalc,
1694 .flags = CLOCK_IN_OMAP4430,
1695 .enable_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
1696 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1697 .clkdm_name = "l4_per_clkdm",
1698};
1699
1700static const struct clksel timer5_sync_mux_sel[] = {
1701 { .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
1702 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1703 { .parent = NULL },
1704};
1705
1706/* Merged timer5_sync_mux into gptimer5_ck */
1707static struct clk gptimer5_ck = {
1708 .name = "gptimer5_ck",
1709 .parent = &syc_clk_div_ck,
1710 .clksel = timer5_sync_mux_sel,
1711 .init = &omap2_init_clksel_parent,
1712 .clksel_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
1713 .clksel_mask = OMAP4430_CLKSEL_MASK,
1714 .ops = &clkops_omap2_dflt,
1715 .recalc = &omap2_clksel_recalc,
1716 .flags = CLOCK_IN_OMAP4430,
1717 .enable_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
1718 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1719 .clkdm_name = "abe_clkdm",
1720};
1721
1722/* Merged timer6_sync_mux into gptimer6_ck */
1723static struct clk gptimer6_ck = {
1724 .name = "gptimer6_ck",
1725 .parent = &syc_clk_div_ck,
1726 .clksel = timer5_sync_mux_sel,
1727 .init = &omap2_init_clksel_parent,
1728 .clksel_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
1729 .clksel_mask = OMAP4430_CLKSEL_MASK,
1730 .ops = &clkops_omap2_dflt,
1731 .recalc = &omap2_clksel_recalc,
1732 .flags = CLOCK_IN_OMAP4430,
1733 .enable_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
1734 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1735 .clkdm_name = "abe_clkdm",
1736};
1737
1738/* Merged timer7_sync_mux into gptimer7_ck */
1739static struct clk gptimer7_ck = {
1740 .name = "gptimer7_ck",
1741 .parent = &syc_clk_div_ck,
1742 .clksel = timer5_sync_mux_sel,
1743 .init = &omap2_init_clksel_parent,
1744 .clksel_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
1745 .clksel_mask = OMAP4430_CLKSEL_MASK,
1746 .ops = &clkops_omap2_dflt,
1747 .recalc = &omap2_clksel_recalc,
1748 .flags = CLOCK_IN_OMAP4430,
1749 .enable_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
1750 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1751 .clkdm_name = "abe_clkdm",
1752};
1753
1754/* Merged timer8_sync_mux into gptimer8_ck */
1755static struct clk gptimer8_ck = {
1756 .name = "gptimer8_ck",
1757 .parent = &syc_clk_div_ck,
1758 .clksel = timer5_sync_mux_sel,
1759 .init = &omap2_init_clksel_parent,
1760 .clksel_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
1761 .clksel_mask = OMAP4430_CLKSEL_MASK,
1762 .ops = &clkops_omap2_dflt,
1763 .recalc = &omap2_clksel_recalc,
1764 .flags = CLOCK_IN_OMAP4430,
1765 .enable_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
1766 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1767 .clkdm_name = "abe_clkdm",
1768};
1769
1770/* Merged cm2_dm9_mux into gptimer9_ck */
1771static struct clk gptimer9_ck = {
1772 .name = "gptimer9_ck",
1773 .parent = &sys_clkin_ck,
1774 .clksel = dmt1_clk_mux_sel,
1775 .init = &omap2_init_clksel_parent,
1776 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
1777 .clksel_mask = OMAP4430_CLKSEL_MASK,
1778 .ops = &clkops_omap2_dflt,
1779 .recalc = &omap2_clksel_recalc,
1780 .flags = CLOCK_IN_OMAP4430,
1781 .enable_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
1782 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1783 .clkdm_name = "l4_per_clkdm",
1784};
1785
1786static struct clk hdq1w_ck = {
1787 .name = "hdq1w_ck",
1788 .ops = &clkops_omap2_dflt,
1789 .enable_reg = OMAP4430_CM_L4PER_HDQ1W_CLKCTRL,
1790 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1791 .clkdm_name = "l4_per_clkdm",
1792 .parent = &func_12m_fclk,
1793 .recalc = &followparent_recalc,
1794};
1795
1796/* Merged hsi_fclk into hsi_ck */
1797static struct clk hsi_ck = {
1798 .name = "hsi_ck",
1799 .parent = &dpll_per_m2x2_ck,
1800 .clksel = per_sgx_fclk_div,
1801 .clksel_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL,
1802 .clksel_mask = OMAP4430_CLKSEL_24_25_MASK,
1803 .ops = &clkops_omap2_dflt,
1804 .recalc = &omap2_clksel_recalc,
1805 .round_rate = &omap2_clksel_round_rate,
1806 .set_rate = &omap2_clksel_set_rate,
1807 .flags = CLOCK_IN_OMAP4430,
1808 .enable_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL,
1809 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1810 .clkdm_name = "l3_init_clkdm",
1811};
1812
1813static struct clk i2c1_ck = {
1814 .name = "i2c1_ck",
1815 .ops = &clkops_omap2_dflt,
1816 .enable_reg = OMAP4430_CM_L4PER_I2C1_CLKCTRL,
1817 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1818 .clkdm_name = "l4_per_clkdm",
1819 .parent = &func_96m_fclk,
1820 .recalc = &followparent_recalc,
1821};
1822
1823static struct clk i2c2_ck = {
1824 .name = "i2c2_ck",
1825 .ops = &clkops_omap2_dflt,
1826 .enable_reg = OMAP4430_CM_L4PER_I2C2_CLKCTRL,
1827 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1828 .clkdm_name = "l4_per_clkdm",
1829 .parent = &func_96m_fclk,
1830 .recalc = &followparent_recalc,
1831};
1832
1833static struct clk i2c3_ck = {
1834 .name = "i2c3_ck",
1835 .ops = &clkops_omap2_dflt,
1836 .enable_reg = OMAP4430_CM_L4PER_I2C3_CLKCTRL,
1837 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1838 .clkdm_name = "l4_per_clkdm",
1839 .parent = &func_96m_fclk,
1840 .recalc = &followparent_recalc,
1841};
1842
1843static struct clk i2c4_ck = {
1844 .name = "i2c4_ck",
1845 .ops = &clkops_omap2_dflt,
1846 .enable_reg = OMAP4430_CM_L4PER_I2C4_CLKCTRL,
1847 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1848 .clkdm_name = "l4_per_clkdm",
1849 .parent = &func_96m_fclk,
1850 .recalc = &followparent_recalc,
1851};
1852
1853static struct clk iss_ck = {
1854 .name = "iss_ck",
1855 .ops = &clkops_omap2_dflt,
1856 .enable_reg = OMAP4430_CM_CAM_ISS_CLKCTRL,
1857 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1858 .clkdm_name = "iss_clkdm",
1859 .parent = &ducati_clk_mux_ck,
1860 .recalc = &followparent_recalc,
1861};
1862
1863static struct clk ivahd_ck = {
1864 .name = "ivahd_ck",
1865 .ops = &clkops_omap2_dflt,
1866 .enable_reg = OMAP4430_CM_IVAHD_IVAHD_CLKCTRL,
1867 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1868 .clkdm_name = "ivahd_clkdm",
1869 .parent = &dpll_iva_m5_ck,
1870 .recalc = &followparent_recalc,
1871};
1872
1873static struct clk keyboard_ck = {
1874 .name = "keyboard_ck",
1875 .ops = &clkops_omap2_dflt,
1876 .enable_reg = OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
1877 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1878 .clkdm_name = "l4_wkup_clkdm",
1879 .parent = &sys_32k_ck,
1880 .recalc = &followparent_recalc,
1881};
1882
1883static struct clk l3_instr_interconnect_ck = {
1884 .name = "l3_instr_interconnect_ck",
1885 .ops = &clkops_omap2_dflt,
1886 .enable_reg = OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL,
1887 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1888 .clkdm_name = "l3_instr_clkdm",
1889 .parent = &l3_div_ck,
1890 .recalc = &followparent_recalc,
1891};
1892
1893static struct clk l3_interconnect_3_ck = {
1894 .name = "l3_interconnect_3_ck",
1895 .ops = &clkops_omap2_dflt,
1896 .enable_reg = OMAP4430_CM_L3INSTR_L3_3_CLKCTRL,
1897 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1898 .clkdm_name = "l3_instr_clkdm",
1899 .parent = &l3_div_ck,
1900 .recalc = &followparent_recalc,
1901};
1902
1903static struct clk mcasp_sync_mux_ck = {
1904 .name = "mcasp_sync_mux_ck",
1905 .parent = &abe_24m_fclk,
1906 .clksel = dmic_sync_mux_sel,
1907 .init = &omap2_init_clksel_parent,
1908 .clksel_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1909 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1910 .ops = &clkops_null,
1911 .recalc = &omap2_clksel_recalc,
1912 .flags = CLOCK_IN_OMAP4430,
1913};
1914
1915static const struct clksel func_mcasp_abe_gfclk_sel[] = {
1916 { .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
1917 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1918 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1919 { .parent = NULL },
1920};
1921
1922/* Merged func_mcasp_abe_gfclk into mcasp_ck */
1923static struct clk mcasp_ck = {
1924 .name = "mcasp_ck",
1925 .parent = &mcasp_sync_mux_ck,
1926 .clksel = func_mcasp_abe_gfclk_sel,
1927 .init = &omap2_init_clksel_parent,
1928 .clksel_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1929 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1930 .ops = &clkops_omap2_dflt,
1931 .recalc = &omap2_clksel_recalc,
1932 .flags = CLOCK_IN_OMAP4430,
1933 .enable_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1934 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1935 .clkdm_name = "abe_clkdm",
1936};
1937
1938static struct clk mcbsp1_sync_mux_ck = {
1939 .name = "mcbsp1_sync_mux_ck",
1940 .parent = &abe_24m_fclk,
1941 .clksel = dmic_sync_mux_sel,
1942 .init = &omap2_init_clksel_parent,
1943 .clksel_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1944 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1945 .ops = &clkops_null,
1946 .recalc = &omap2_clksel_recalc,
1947 .flags = CLOCK_IN_OMAP4430,
1948};
1949
1950static const struct clksel func_mcbsp1_gfclk_sel[] = {
1951 { .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
1952 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1953 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1954 { .parent = NULL },
1955};
1956
1957/* Merged func_mcbsp1_gfclk into mcbsp1_ck */
1958static struct clk mcbsp1_ck = {
1959 .name = "mcbsp1_ck",
1960 .parent = &mcbsp1_sync_mux_ck,
1961 .clksel = func_mcbsp1_gfclk_sel,
1962 .init = &omap2_init_clksel_parent,
1963 .clksel_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1964 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1965 .ops = &clkops_omap2_dflt,
1966 .recalc = &omap2_clksel_recalc,
1967 .flags = CLOCK_IN_OMAP4430,
1968 .enable_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1969 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1970 .clkdm_name = "abe_clkdm",
1971};
1972
1973static struct clk mcbsp2_sync_mux_ck = {
1974 .name = "mcbsp2_sync_mux_ck",
1975 .parent = &abe_24m_fclk,
1976 .clksel = dmic_sync_mux_sel,
1977 .init = &omap2_init_clksel_parent,
1978 .clksel_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1979 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1980 .ops = &clkops_null,
1981 .recalc = &omap2_clksel_recalc,
1982 .flags = CLOCK_IN_OMAP4430,
1983};
1984
1985static const struct clksel func_mcbsp2_gfclk_sel[] = {
1986 { .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
1987 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1988 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1989 { .parent = NULL },
1990};
1991
1992/* Merged func_mcbsp2_gfclk into mcbsp2_ck */
1993static struct clk mcbsp2_ck = {
1994 .name = "mcbsp2_ck",
1995 .parent = &mcbsp2_sync_mux_ck,
1996 .clksel = func_mcbsp2_gfclk_sel,
1997 .init = &omap2_init_clksel_parent,
1998 .clksel_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1999 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
2000 .ops = &clkops_omap2_dflt,
2001 .recalc = &omap2_clksel_recalc,
2002 .flags = CLOCK_IN_OMAP4430,
2003 .enable_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
2004 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2005 .clkdm_name = "abe_clkdm",
2006};
2007
2008static struct clk mcbsp3_sync_mux_ck = {
2009 .name = "mcbsp3_sync_mux_ck",
2010 .parent = &abe_24m_fclk,
2011 .clksel = dmic_sync_mux_sel,
2012 .init = &omap2_init_clksel_parent,
2013 .clksel_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
2014 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
2015 .ops = &clkops_null,
2016 .recalc = &omap2_clksel_recalc,
2017 .flags = CLOCK_IN_OMAP4430,
2018};
2019
2020static const struct clksel func_mcbsp3_gfclk_sel[] = {
2021 { .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
2022 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
2023 { .parent = &slimbus_clk, .rates = div_1_2_rates },
2024 { .parent = NULL },
2025};
2026
2027/* Merged func_mcbsp3_gfclk into mcbsp3_ck */
2028static struct clk mcbsp3_ck = {
2029 .name = "mcbsp3_ck",
2030 .parent = &mcbsp3_sync_mux_ck,
2031 .clksel = func_mcbsp3_gfclk_sel,
2032 .init = &omap2_init_clksel_parent,
2033 .clksel_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
2034 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
2035 .ops = &clkops_omap2_dflt,
2036 .recalc = &omap2_clksel_recalc,
2037 .flags = CLOCK_IN_OMAP4430,
2038 .enable_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
2039 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2040 .clkdm_name = "abe_clkdm",
2041};
2042
2043static struct clk mcbsp4_sync_mux_ck = {
2044 .name = "mcbsp4_sync_mux_ck",
2045 .parent = &func_96m_fclk,
2046 .clksel = mcasp2_fclk_sel,
2047 .init = &omap2_init_clksel_parent,
2048 .clksel_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
2049 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
2050 .ops = &clkops_null,
2051 .recalc = &omap2_clksel_recalc,
2052 .flags = CLOCK_IN_OMAP4430,
2053};
2054
2055static const struct clksel per_mcbsp4_gfclk_sel[] = {
2056 { .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
2057 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
2058 { .parent = NULL },
2059};
2060
2061/* Merged per_mcbsp4_gfclk into mcbsp4_ck */
2062static struct clk mcbsp4_ck = {
2063 .name = "mcbsp4_ck",
2064 .parent = &mcbsp4_sync_mux_ck,
2065 .clksel = per_mcbsp4_gfclk_sel,
2066 .init = &omap2_init_clksel_parent,
2067 .clksel_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
2068 .clksel_mask = OMAP4430_CLKSEL_SOURCE_24_24_MASK,
2069 .ops = &clkops_omap2_dflt,
2070 .recalc = &omap2_clksel_recalc,
2071 .flags = CLOCK_IN_OMAP4430,
2072 .enable_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
2073 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2074 .clkdm_name = "l4_per_clkdm",
2075};
2076
2077static struct clk mcspi1_ck = {
2078 .name = "mcspi1_ck",
2079 .ops = &clkops_omap2_dflt,
2080 .enable_reg = OMAP4430_CM_L4PER_MCSPI1_CLKCTRL,
2081 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2082 .clkdm_name = "l4_per_clkdm",
2083 .parent = &func_48m_fclk,
2084 .recalc = &followparent_recalc,
2085};
2086
2087static struct clk mcspi2_ck = {
2088 .name = "mcspi2_ck",
2089 .ops = &clkops_omap2_dflt,
2090 .enable_reg = OMAP4430_CM_L4PER_MCSPI2_CLKCTRL,
2091 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2092 .clkdm_name = "l4_per_clkdm",
2093 .parent = &func_48m_fclk,
2094 .recalc = &followparent_recalc,
2095};
2096
2097static struct clk mcspi3_ck = {
2098 .name = "mcspi3_ck",
2099 .ops = &clkops_omap2_dflt,
2100 .enable_reg = OMAP4430_CM_L4PER_MCSPI3_CLKCTRL,
2101 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2102 .clkdm_name = "l4_per_clkdm",
2103 .parent = &func_48m_fclk,
2104 .recalc = &followparent_recalc,
2105};
2106
2107static struct clk mcspi4_ck = {
2108 .name = "mcspi4_ck",
2109 .ops = &clkops_omap2_dflt,
2110 .enable_reg = OMAP4430_CM_L4PER_MCSPI4_CLKCTRL,
2111 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2112 .clkdm_name = "l4_per_clkdm",
2113 .parent = &func_48m_fclk,
2114 .recalc = &followparent_recalc,
2115};
2116
2117/* Merged hsmmc1_fclk into mmc1_ck */
2118static struct clk mmc1_ck = {
2119 .name = "mmc1_ck",
2120 .parent = &func_64m_fclk,
2121 .clksel = hsmmc6_fclk_sel,
2122 .init = &omap2_init_clksel_parent,
2123 .clksel_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
2124 .clksel_mask = OMAP4430_CLKSEL_MASK,
2125 .ops = &clkops_omap2_dflt,
2126 .recalc = &omap2_clksel_recalc,
2127 .flags = CLOCK_IN_OMAP4430,
2128 .enable_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
2129 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2130 .clkdm_name = "l3_init_clkdm",
2131};
2132
2133/* Merged hsmmc2_fclk into mmc2_ck */
2134static struct clk mmc2_ck = {
2135 .name = "mmc2_ck",
2136 .parent = &func_64m_fclk,
2137 .clksel = hsmmc6_fclk_sel,
2138 .init = &omap2_init_clksel_parent,
2139 .clksel_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
2140 .clksel_mask = OMAP4430_CLKSEL_MASK,
2141 .ops = &clkops_omap2_dflt,
2142 .recalc = &omap2_clksel_recalc,
2143 .flags = CLOCK_IN_OMAP4430,
2144 .enable_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
2145 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2146 .clkdm_name = "l3_init_clkdm",
2147};
2148
2149static struct clk mmc3_ck = {
2150 .name = "mmc3_ck",
2151 .ops = &clkops_omap2_dflt,
2152 .enable_reg = OMAP4430_CM_L4PER_MMCSD3_CLKCTRL,
2153 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2154 .clkdm_name = "l4_per_clkdm",
2155 .parent = &func_48m_fclk,
2156 .recalc = &followparent_recalc,
2157};
2158
2159static struct clk mmc4_ck = {
2160 .name = "mmc4_ck",
2161 .ops = &clkops_omap2_dflt,
2162 .enable_reg = OMAP4430_CM_L4PER_MMCSD4_CLKCTRL,
2163 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2164 .clkdm_name = "l4_per_clkdm",
2165 .parent = &func_48m_fclk,
2166 .recalc = &followparent_recalc,
2167};
2168
2169static struct clk mmc5_ck = {
2170 .name = "mmc5_ck",
2171 .ops = &clkops_omap2_dflt,
2172 .enable_reg = OMAP4430_CM_L4PER_MMCSD5_CLKCTRL,
2173 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2174 .clkdm_name = "l4_per_clkdm",
2175 .parent = &func_48m_fclk,
2176 .recalc = &followparent_recalc,
2177};
2178
2179static struct clk ocp_wp1_ck = {
2180 .name = "ocp_wp1_ck",
2181 .ops = &clkops_omap2_dflt,
2182 .enable_reg = OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL,
2183 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2184 .clkdm_name = "l3_instr_clkdm",
2185 .parent = &l3_div_ck,
2186 .recalc = &followparent_recalc,
2187};
2188
2189static struct clk pdm_ck = {
2190 .name = "pdm_ck",
2191 .ops = &clkops_omap2_dflt,
2192 .enable_reg = OMAP4430_CM1_ABE_PDM_CLKCTRL,
2193 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2194 .clkdm_name = "abe_clkdm",
2195 .parent = &pad_clks_ck,
2196 .recalc = &followparent_recalc,
2197};
2198
2199static struct clk pkaeip29_ck = {
2200 .name = "pkaeip29_ck",
2201 .ops = &clkops_omap2_dflt,
2202 .enable_reg = OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL,
2203 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2204 .clkdm_name = "l4_secure_clkdm",
2205 .parent = &l4_div_ck,
2206 .recalc = &followparent_recalc,
2207};
2208
2209static struct clk rng_ck = {
2210 .name = "rng_ck",
2211 .ops = &clkops_omap2_dflt,
2212 .enable_reg = OMAP4430_CM_L4SEC_RNG_CLKCTRL,
2213 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2214 .clkdm_name = "l4_secure_clkdm",
2215 .parent = &l4_div_ck,
2216 .recalc = &followparent_recalc,
2217};
2218
2219static struct clk sha2md51_ck = {
2220 .name = "sha2md51_ck",
2221 .ops = &clkops_omap2_dflt,
2222 .enable_reg = OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
2223 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2224 .clkdm_name = "l4_secure_clkdm",
2225 .parent = &l3_div_ck,
2226 .recalc = &followparent_recalc,
2227};
2228
2229static struct clk sl2_ck = {
2230 .name = "sl2_ck",
2231 .ops = &clkops_omap2_dflt,
2232 .enable_reg = OMAP4430_CM_IVAHD_SL2_CLKCTRL,
2233 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2234 .clkdm_name = "ivahd_clkdm",
2235 .parent = &dpll_iva_m5_ck,
2236 .recalc = &followparent_recalc,
2237};
2238
2239static struct clk slimbus1_ck = {
2240 .name = "slimbus1_ck",
2241 .ops = &clkops_omap2_dflt,
2242 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2243 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2244 .clkdm_name = "abe_clkdm",
2245 .parent = &ocp_abe_iclk,
2246 .recalc = &followparent_recalc,
2247};
2248
2249static struct clk slimbus2_ck = {
2250 .name = "slimbus2_ck",
2251 .ops = &clkops_omap2_dflt,
2252 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2253 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2254 .clkdm_name = "l4_per_clkdm",
2255 .parent = &l4_div_ck,
2256 .recalc = &followparent_recalc,
2257};
2258
2259static struct clk sr_core_ck = {
2260 .name = "sr_core_ck",
2261 .ops = &clkops_omap2_dflt,
2262 .enable_reg = OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
2263 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2264 .clkdm_name = "l4_ao_clkdm",
2265 .parent = &l4_wkup_clk_mux_ck,
2266 .recalc = &followparent_recalc,
2267};
2268
2269static struct clk sr_iva_ck = {
2270 .name = "sr_iva_ck",
2271 .ops = &clkops_omap2_dflt,
2272 .enable_reg = OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
2273 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2274 .clkdm_name = "l4_ao_clkdm",
2275 .parent = &l4_wkup_clk_mux_ck,
2276 .recalc = &followparent_recalc,
2277};
2278
2279static struct clk sr_mpu_ck = {
2280 .name = "sr_mpu_ck",
2281 .ops = &clkops_omap2_dflt,
2282 .enable_reg = OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
2283 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2284 .clkdm_name = "l4_ao_clkdm",
2285 .parent = &l4_wkup_clk_mux_ck,
2286 .recalc = &followparent_recalc,
2287};
2288
2289static struct clk tesla_ck = {
2290 .name = "tesla_ck",
2291 .ops = &clkops_omap2_dflt,
2292 .enable_reg = OMAP4430_CM_TESLA_TESLA_CLKCTRL,
2293 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2294 .clkdm_name = "tesla_clkdm",
2295 .parent = &dpll_iva_m4_ck,
2296 .recalc = &followparent_recalc,
2297};
2298
2299static struct clk uart1_ck = {
2300 .name = "uart1_ck",
2301 .ops = &clkops_omap2_dflt,
2302 .enable_reg = OMAP4430_CM_L4PER_UART1_CLKCTRL,
2303 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2304 .clkdm_name = "l4_per_clkdm",
2305 .parent = &func_48m_fclk,
2306 .recalc = &followparent_recalc,
2307};
2308
2309static struct clk uart2_ck = {
2310 .name = "uart2_ck",
2311 .ops = &clkops_omap2_dflt,
2312 .enable_reg = OMAP4430_CM_L4PER_UART2_CLKCTRL,
2313 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2314 .clkdm_name = "l4_per_clkdm",
2315 .parent = &func_48m_fclk,
2316 .recalc = &followparent_recalc,
2317};
2318
2319static struct clk uart3_ck = {
2320 .name = "uart3_ck",
2321 .ops = &clkops_omap2_dflt,
2322 .enable_reg = OMAP4430_CM_L4PER_UART3_CLKCTRL,
2323 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2324 .clkdm_name = "l4_per_clkdm",
2325 .parent = &func_48m_fclk,
2326 .recalc = &followparent_recalc,
2327};
2328
2329static struct clk uart4_ck = {
2330 .name = "uart4_ck",
2331 .ops = &clkops_omap2_dflt,
2332 .enable_reg = OMAP4430_CM_L4PER_UART4_CLKCTRL,
2333 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2334 .clkdm_name = "l4_per_clkdm",
2335 .parent = &func_48m_fclk,
2336 .recalc = &followparent_recalc,
2337};
2338
2339static struct clk unipro1_ck = {
2340 .name = "unipro1_ck",
2341 .ops = &clkops_omap2_dflt,
2342 .enable_reg = OMAP4430_CM_L3INIT_UNIPRO1_CLKCTRL,
2343 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2344 .clkdm_name = "l3_init_clkdm",
2345 .parent = &func_96m_fclk,
2346 .recalc = &followparent_recalc,
2347};
2348
2349static struct clk usb_host_ck = {
2350 .name = "usb_host_ck",
2351 .ops = &clkops_omap2_dflt,
2352 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2353 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2354 .clkdm_name = "l3_init_clkdm",
2355 .parent = &init_60m_fclk,
2356 .recalc = &followparent_recalc,
2357};
2358
2359static struct clk usb_host_fs_ck = {
2360 .name = "usb_host_fs_ck",
2361 .ops = &clkops_omap2_dflt,
2362 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
2363 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2364 .clkdm_name = "l3_init_clkdm",
2365 .parent = &func_48mc_fclk,
2366 .recalc = &followparent_recalc,
2367};
2368
2369static struct clk usb_otg_ck = {
2370 .name = "usb_otg_ck",
2371 .ops = &clkops_omap2_dflt,
2372 .enable_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2373 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2374 .clkdm_name = "l3_init_clkdm",
2375 .parent = &l3_div_ck,
2376 .recalc = &followparent_recalc,
2377};
2378
2379static struct clk usb_tll_ck = {
2380 .name = "usb_tll_ck",
2381 .ops = &clkops_omap2_dflt,
2382 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2383 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2384 .clkdm_name = "l3_init_clkdm",
2385 .parent = &l4_div_ck,
2386 .recalc = &followparent_recalc,
2387};
2388
2389static struct clk usbphyocp2scp_ck = {
2390 .name = "usbphyocp2scp_ck",
2391 .ops = &clkops_omap2_dflt,
2392 .enable_reg = OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
2393 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2394 .clkdm_name = "l3_init_clkdm",
2395 .parent = &l4_div_ck,
2396 .recalc = &followparent_recalc,
2397};
2398
2399static struct clk usim_ck = {
2400 .name = "usim_ck",
2401 .ops = &clkops_omap2_dflt,
2402 .enable_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2403 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2404 .clkdm_name = "l4_wkup_clkdm",
2405 .parent = &sys_32k_ck,
2406 .recalc = &followparent_recalc,
2407};
2408
2409static struct clk wdt2_ck = {
2410 .name = "wdt2_ck",
2411 .ops = &clkops_omap2_dflt,
2412 .enable_reg = OMAP4430_CM_WKUP_WDT2_CLKCTRL,
2413 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2414 .clkdm_name = "l4_wkup_clkdm",
2415 .parent = &sys_32k_ck,
2416 .recalc = &followparent_recalc,
2417};
2418
2419static struct clk wdt3_ck = {
2420 .name = "wdt3_ck",
2421 .ops = &clkops_omap2_dflt,
2422 .enable_reg = OMAP4430_CM1_ABE_WDT3_CLKCTRL,
2423 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2424 .clkdm_name = "abe_clkdm",
2425 .parent = &sys_32k_ck,
2426 .recalc = &followparent_recalc,
2427};
2428
2429/* Remaining optional clocks */
2430static const struct clksel otg_60m_gfclk_sel[] = {
2431 { .parent = &utmi_phy_clkout_ck, .rates = div_1_0_rates },
2432 { .parent = &xclk60motg_ck, .rates = div_1_1_rates },
2433 { .parent = NULL },
2434};
2435
2436static struct clk otg_60m_gfclk_ck = {
2437 .name = "otg_60m_gfclk_ck",
2438 .parent = &utmi_phy_clkout_ck,
2439 .clksel = otg_60m_gfclk_sel,
2440 .init = &omap2_init_clksel_parent,
2441 .clksel_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2442 .clksel_mask = OMAP4430_CLKSEL_60M_MASK,
2443 .ops = &clkops_null,
2444 .recalc = &omap2_clksel_recalc,
2445 .flags = CLOCK_IN_OMAP4430,
2446};
2447
2448static const struct clksel stm_clk_div_div[] = {
2449 { .parent = &pmd_stm_clock_mux_ck, .rates = div3_1to4_rates },
2450 { .parent = NULL },
2451};
2452
2453static struct clk stm_clk_div_ck = {
2454 .name = "stm_clk_div_ck",
2455 .parent = &pmd_stm_clock_mux_ck,
2456 .clksel = stm_clk_div_div,
2457 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2458 .clksel_mask = OMAP4430_CLKSEL_PMD_STM_CLK_MASK,
2459 .ops = &clkops_null,
2460 .recalc = &omap2_clksel_recalc,
2461 .round_rate = &omap2_clksel_round_rate,
2462 .set_rate = &omap2_clksel_set_rate,
2463 .flags = CLOCK_IN_OMAP4430,
2464};
2465
2466static const struct clksel trace_clk_div_div[] = {
2467 { .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
2468 { .parent = NULL },
2469};
2470
2471static struct clk trace_clk_div_ck = {
2472 .name = "trace_clk_div_ck",
2473 .parent = &pmd_trace_clk_mux_ck,
2474 .clksel = trace_clk_div_div,
2475 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2476 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
2477 .ops = &clkops_null,
2478 .recalc = &omap2_clksel_recalc,
2479 .round_rate = &omap2_clksel_round_rate,
2480 .set_rate = &omap2_clksel_set_rate,
2481 .flags = CLOCK_IN_OMAP4430,
2482};
2483
2484static const struct clksel_rate div2_14to18_rates[] = {
2485 { .div = 14, .val = 0, .flags = RATE_IN_4430 },
2486 { .div = 18, .val = 1, .flags = RATE_IN_4430 },
2487 { .div = 0 },
2488};
2489
2490static const struct clksel usim_fclk_div[] = {
2491 { .parent = &dpll_per_m4_ck, .rates = div2_14to18_rates },
2492 { .parent = NULL },
2493};
2494
2495static struct clk usim_fclk = {
2496 .name = "usim_fclk",
2497 .parent = &dpll_per_m4_ck,
2498 .clksel = usim_fclk_div,
2499 .clksel_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2500 .clksel_mask = OMAP4430_CLKSEL_DIV_MASK,
2501 .ops = &clkops_null,
2502 .recalc = &omap2_clksel_recalc,
2503 .round_rate = &omap2_clksel_round_rate,
2504 .set_rate = &omap2_clksel_set_rate,
2505 .flags = CLOCK_IN_OMAP4430,
2506};
2507
2508static const struct clksel utmi_p1_gfclk_sel[] = {
2509 { .parent = &init_60m_fclk, .rates = div_1_0_rates },
2510 { .parent = &xclk60mhsp1_ck, .rates = div_1_1_rates },
2511 { .parent = NULL },
2512};
2513
2514static struct clk utmi_p1_gfclk_ck = {
2515 .name = "utmi_p1_gfclk_ck",
2516 .parent = &init_60m_fclk,
2517 .clksel = utmi_p1_gfclk_sel,
2518 .init = &omap2_init_clksel_parent,
2519 .clksel_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2520 .clksel_mask = OMAP4430_CLKSEL_UTMI_P1_MASK,
2521 .ops = &clkops_null,
2522 .recalc = &omap2_clksel_recalc,
2523 .flags = CLOCK_IN_OMAP4430,
2524};
2525
2526static const struct clksel utmi_p2_gfclk_sel[] = {
2527 { .parent = &init_60m_fclk, .rates = div_1_0_rates },
2528 { .parent = &xclk60mhsp2_ck, .rates = div_1_1_rates },
2529 { .parent = NULL },
2530};
2531
2532static struct clk utmi_p2_gfclk_ck = {
2533 .name = "utmi_p2_gfclk_ck",
2534 .parent = &init_60m_fclk,
2535 .clksel = utmi_p2_gfclk_sel,
2536 .init = &omap2_init_clksel_parent,
2537 .clksel_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2538 .clksel_mask = OMAP4430_CLKSEL_UTMI_P2_MASK,
2539 .ops = &clkops_null,
2540 .recalc = &omap2_clksel_recalc,
2541 .flags = CLOCK_IN_OMAP4430,
2542};
2543
2544/*
2545 * clkdev
2546 */
2547
2548static struct omap_clk omap44xx_clks[] = {
2549 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X),
2550 CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X),
2551 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X),
2552 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X),
2553 CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X),
2554 CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X),
2555 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X),
2556 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X),
2557 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X),
2558 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X),
2559 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X),
2560 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X),
2561 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X),
2562 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X),
2563 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X),
2564 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X),
2565 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X),
2566 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X),
2567 CLK(NULL, "dpll_sys_ref_clk", &dpll_sys_ref_clk, CK_443X),
2568 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X),
2569 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X),
2570 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X),
2571 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X),
2572 CLK(NULL, "abe_clk", &abe_clk, CK_443X),
2573 CLK(NULL, "aess_fclk", &aess_fclk, CK_443X),
2574 CLK(NULL, "dpll_abe_m3_ck", &dpll_abe_m3_ck, CK_443X),
2575 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X),
2576 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X),
2577 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_443X),
2578 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X),
2579 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X),
2580 CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X),
2581 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_443X),
2582 CLK(NULL, "div_core_ck", &div_core_ck, CK_443X),
2583 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X),
2584 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X),
2585 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck, CK_443X),
2586 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X),
2587 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X),
2588 CLK(NULL, "dpll_core_m3_ck", &dpll_core_m3_ck, CK_443X),
2589 CLK(NULL, "dpll_core_m7_ck", &dpll_core_m7_ck, CK_443X),
2590 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X),
2591 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X),
2592 CLK(NULL, "dpll_iva_m4_ck", &dpll_iva_m4_ck, CK_443X),
2593 CLK(NULL, "dpll_iva_m5_ck", &dpll_iva_m5_ck, CK_443X),
2594 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X),
2595 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X),
2596 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X),
2597 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X),
2598 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X),
2599 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X),
2600 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X),
2601 CLK(NULL, "dpll_per_m3_ck", &dpll_per_m3_ck, CK_443X),
2602 CLK(NULL, "dpll_per_m4_ck", &dpll_per_m4_ck, CK_443X),
2603 CLK(NULL, "dpll_per_m5_ck", &dpll_per_m5_ck, CK_443X),
2604 CLK(NULL, "dpll_per_m6_ck", &dpll_per_m6_ck, CK_443X),
2605 CLK(NULL, "dpll_per_m7_ck", &dpll_per_m7_ck, CK_443X),
2606 CLK(NULL, "dpll_unipro_ck", &dpll_unipro_ck, CK_443X),
2607 CLK(NULL, "dpll_unipro_m2x2_ck", &dpll_unipro_m2x2_ck, CK_443X),
2608 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X),
2609 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X),
2610 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X),
2611 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X),
2612 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X),
2613 CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X),
2614 CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X),
2615 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X),
2616 CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X),
2617 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X),
2618 CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X),
2619 CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X),
2620 CLK(NULL, "hsmmc6_fclk", &hsmmc6_fclk, CK_443X),
2621 CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X),
2622 CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X),
2623 CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
2624 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
2625 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
2626 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
2627 CLK(NULL, "mcasp2_fclk", &mcasp2_fclk, CK_443X),
2628 CLK(NULL, "mcasp3_fclk", &mcasp3_fclk, CK_443X),
2629 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
2630 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
2631 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X),
2632 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X),
2633 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X),
2634 CLK(NULL, "aes1_ck", &aes1_ck, CK_443X),
2635 CLK(NULL, "aes2_ck", &aes2_ck, CK_443X),
2636 CLK(NULL, "aess_ck", &aess_ck, CK_443X),
2637 CLK(NULL, "cust_efuse_ck", &cust_efuse_ck, CK_443X),
2638 CLK(NULL, "des3des_ck", &des3des_ck, CK_443X),
2639 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
2640 CLK(NULL, "dmic_ck", &dmic_ck, CK_443X),
2641 CLK(NULL, "dss_ck", &dss_ck, CK_443X),
2642 CLK(NULL, "ducati_ck", &ducati_ck, CK_443X),
2643 CLK(NULL, "emif1_ck", &emif1_ck, CK_443X),
2644 CLK(NULL, "emif2_ck", &emif2_ck, CK_443X),
2645 CLK(NULL, "fdif_ck", &fdif_ck, CK_443X),
2646 CLK(NULL, "per_sgx_fclk", &per_sgx_fclk, CK_443X),
2647 CLK(NULL, "gfx_ck", &gfx_ck, CK_443X),
2648 CLK(NULL, "gpio1_ck", &gpio1_ck, CK_443X),
2649 CLK(NULL, "gpio2_ck", &gpio2_ck, CK_443X),
2650 CLK(NULL, "gpio3_ck", &gpio3_ck, CK_443X),
2651 CLK(NULL, "gpio4_ck", &gpio4_ck, CK_443X),
2652 CLK(NULL, "gpio5_ck", &gpio5_ck, CK_443X),
2653 CLK(NULL, "gpio6_ck", &gpio6_ck, CK_443X),
2654 CLK(NULL, "gpmc_ck", &gpmc_ck, CK_443X),
2655 CLK(NULL, "gptimer1_ck", &gptimer1_ck, CK_443X),
2656 CLK(NULL, "gptimer10_ck", &gptimer10_ck, CK_443X),
2657 CLK(NULL, "gptimer11_ck", &gptimer11_ck, CK_443X),
2658 CLK(NULL, "gptimer2_ck", &gptimer2_ck, CK_443X),
2659 CLK(NULL, "gptimer3_ck", &gptimer3_ck, CK_443X),
2660 CLK(NULL, "gptimer4_ck", &gptimer4_ck, CK_443X),
2661 CLK(NULL, "gptimer5_ck", &gptimer5_ck, CK_443X),
2662 CLK(NULL, "gptimer6_ck", &gptimer6_ck, CK_443X),
2663 CLK(NULL, "gptimer7_ck", &gptimer7_ck, CK_443X),
2664 CLK(NULL, "gptimer8_ck", &gptimer8_ck, CK_443X),
2665 CLK(NULL, "gptimer9_ck", &gptimer9_ck, CK_443X),
2666 CLK("omap2_hdq.0", "ick", &hdq1w_ck, CK_443X),
2667 CLK(NULL, "hsi_ck", &hsi_ck, CK_443X),
2668 CLK("i2c_omap.1", "ick", &i2c1_ck, CK_443X),
2669 CLK("i2c_omap.2", "ick", &i2c2_ck, CK_443X),
2670 CLK("i2c_omap.3", "ick", &i2c3_ck, CK_443X),
2671 CLK("i2c_omap.4", "ick", &i2c4_ck, CK_443X),
2672 CLK(NULL, "iss_ck", &iss_ck, CK_443X),
2673 CLK(NULL, "ivahd_ck", &ivahd_ck, CK_443X),
2674 CLK(NULL, "keyboard_ck", &keyboard_ck, CK_443X),
2675 CLK(NULL, "l3_instr_interconnect_ck", &l3_instr_interconnect_ck, CK_443X),
2676 CLK(NULL, "l3_interconnect_3_ck", &l3_interconnect_3_ck, CK_443X),
2677 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
2678 CLK(NULL, "mcasp_ck", &mcasp_ck, CK_443X),
2679 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
2680 CLK("omap-mcbsp.1", "fck", &mcbsp1_ck, CK_443X),
2681 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
2682 CLK("omap-mcbsp.2", "fck", &mcbsp2_ck, CK_443X),
2683 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
2684 CLK("omap-mcbsp.3", "fck", &mcbsp3_ck, CK_443X),
2685 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
2686 CLK("omap-mcbsp.4", "fck", &mcbsp4_ck, CK_443X),
2687 CLK("omap2_mcspi.1", "fck", &mcspi1_ck, CK_443X),
2688 CLK("omap2_mcspi.2", "fck", &mcspi2_ck, CK_443X),
2689 CLK("omap2_mcspi.3", "fck", &mcspi3_ck, CK_443X),
2690 CLK("omap2_mcspi.4", "fck", &mcspi4_ck, CK_443X),
2691 CLK("mmci-omap-hs.0", "fck", &mmc1_ck, CK_443X),
2692 CLK("mmci-omap-hs.1", "fck", &mmc2_ck, CK_443X),
2693 CLK("mmci-omap-hs.2", "fck", &mmc3_ck, CK_443X),
2694 CLK("mmci-omap-hs.3", "fck", &mmc4_ck, CK_443X),
2695 CLK("mmci-omap-hs.4", "fck", &mmc5_ck, CK_443X),
2696 CLK(NULL, "ocp_wp1_ck", &ocp_wp1_ck, CK_443X),
2697 CLK(NULL, "pdm_ck", &pdm_ck, CK_443X),
2698 CLK(NULL, "pkaeip29_ck", &pkaeip29_ck, CK_443X),
2699 CLK("omap_rng", "ick", &rng_ck, CK_443X),
2700 CLK(NULL, "sha2md51_ck", &sha2md51_ck, CK_443X),
2701 CLK(NULL, "sl2_ck", &sl2_ck, CK_443X),
2702 CLK(NULL, "slimbus1_ck", &slimbus1_ck, CK_443X),
2703 CLK(NULL, "slimbus2_ck", &slimbus2_ck, CK_443X),
2704 CLK(NULL, "sr_core_ck", &sr_core_ck, CK_443X),
2705 CLK(NULL, "sr_iva_ck", &sr_iva_ck, CK_443X),
2706 CLK(NULL, "sr_mpu_ck", &sr_mpu_ck, CK_443X),
2707 CLK(NULL, "tesla_ck", &tesla_ck, CK_443X),
2708 CLK(NULL, "uart1_ck", &uart1_ck, CK_443X),
2709 CLK(NULL, "uart2_ck", &uart2_ck, CK_443X),
2710 CLK(NULL, "uart3_ck", &uart3_ck, CK_443X),
2711 CLK(NULL, "uart4_ck", &uart4_ck, CK_443X),
2712 CLK(NULL, "unipro1_ck", &unipro1_ck, CK_443X),
2713 CLK(NULL, "usb_host_ck", &usb_host_ck, CK_443X),
2714 CLK(NULL, "usb_host_fs_ck", &usb_host_fs_ck, CK_443X),
2715 CLK("musb_hdrc", "ick", &usb_otg_ck, CK_443X),
2716 CLK(NULL, "usb_tll_ck", &usb_tll_ck, CK_443X),
2717 CLK(NULL, "usbphyocp2scp_ck", &usbphyocp2scp_ck, CK_443X),
2718 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
2719 CLK("omap_wdt", "fck", &wdt2_ck, CK_443X),
2720 CLK(NULL, "wdt3_ck", &wdt3_ck, CK_443X),
2721 CLK(NULL, "otg_60m_gfclk_ck", &otg_60m_gfclk_ck, CK_443X),
2722 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
2723 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
2724 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
2725 CLK(NULL, "utmi_p1_gfclk_ck", &utmi_p1_gfclk_ck, CK_443X),
2726 CLK(NULL, "utmi_p2_gfclk_ck", &utmi_p2_gfclk_ck, CK_443X),
2727};
2728
2729int __init omap2_clk_init(void)
2730{
2731 /* struct prcm_config *prcm; */
2732 struct omap_clk *c;
2733 /* u32 clkrate; */
2734 u32 cpu_clkflg;
2735
2736 if (cpu_is_omap44xx()) {
2737 cpu_mask = RATE_IN_4430;
2738 cpu_clkflg = CK_443X;
2739 }
2740
2741 clk_init(&omap2_clk_functions);
2742
2743 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
2744 c++)
2745 clk_preinit(c->lk.clk);
2746
2747 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
2748 c++)
2749 if (c->cpu & cpu_clkflg) {
2750 clkdev_add(&c->lk);
2751 clk_register(c->lk.clk);
2752 /* TODO
2753 omap2_init_clk_clkdm(c->lk.clk);
2754 */
2755 }
2756
2757 recalculate_root_clocks();
2758
2759 /*
2760 * Only enable those clocks we will need, let the drivers
2761 * enable other clocks as necessary
2762 */
2763 clk_enable_init_clocks();
2764
2765 return 0;
2766}
diff --git a/arch/arm/mach-omap2/clock_common_data.c b/arch/arm/mach-omap2/clock_common_data.c
new file mode 100644
index 000000000000..f69096b88cdb
--- /dev/null
+++ b/arch/arm/mach-omap2/clock_common_data.c
@@ -0,0 +1,39 @@
1/*
2 * linux/arch/arm/mach-omap2/clock_common_data.c
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2009 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 * This file contains clock data that is common to both the OMAP2xxx and
16 * OMAP3xxx clock definition files.
17 */
18
19#include "clock.h"
20
21/* clksel_rate data common to 24xx/343x */
22const struct clksel_rate gpt_32k_rates[] = {
23 { .div = 1, .val = 0, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
24 { .div = 0 }
25};
26
27const struct clksel_rate gpt_sys_rates[] = {
28 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
29 { .div = 0 }
30};
31
32const struct clksel_rate gfx_l3_rates[] = {
33 { .div = 1, .val = 1, .flags = RATE_IN_24XX | RATE_IN_343X },
34 { .div = 2, .val = 2, .flags = RATE_IN_24XX | RATE_IN_343X | DEFAULT_RATE },
35 { .div = 3, .val = 3, .flags = RATE_IN_243X | RATE_IN_343X },
36 { .div = 4, .val = 4, .flags = RATE_IN_243X | RATE_IN_343X },
37 { .div = 0 }
38};
39
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index fcd82320a6a3..1a45ed1e8ba1 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -2,7 +2,7 @@
2 * OMAP2/3 clockdomain framework functions 2 * OMAP2/3 clockdomain framework functions
3 * 3 *
4 * Copyright (C) 2008 Texas Instruments, Inc. 4 * Copyright (C) 2008 Texas Instruments, Inc.
5 * Copyright (C) 2008 Nokia Corporation 5 * Copyright (C) 2008-2009 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley and Jouni Högander 7 * Written by Paul Walmsley and Jouni Högander
8 * 8 *
@@ -10,9 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#ifdef CONFIG_OMAP_DEBUG_CLOCKDOMAIN 13#undef DEBUG
14# define DEBUG
15#endif
16 14
17#include <linux/module.h> 15#include <linux/module.h>
18#include <linux/kernel.h> 16#include <linux/kernel.h>
diff --git a/arch/arm/mach-omap2/cm-regbits-44xx.h b/arch/arm/mach-omap2/cm-regbits-44xx.h
new file mode 100644
index 000000000000..0e67f75aa35c
--- /dev/null
+++ b/arch/arm/mach-omap2/cm-regbits-44xx.h
@@ -0,0 +1,1474 @@
1/*
2 * OMAP44xx Clock Management register bits
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_CM_REGBITS_44XX_H
23#define __ARCH_ARM_MACH_OMAP2_CM_REGBITS_44XX_H
24
25#include "cm.h"
26
27
28/* Used by CM_L3_1_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP */
29#define OMAP4430_ABE_DYNDEP_SHIFT (1 << 3)
30#define OMAP4430_ABE_DYNDEP_MASK BITFIELD(3, 3)
31
32/*
33 * Used by CM_D2D_STATICDEP, CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP,
34 * CM_L3INIT_STATICDEP, CM_SDMA_STATICDEP_RESTORE, CM_MPU_STATICDEP,
35 * CM_TESLA_STATICDEP
36 */
37#define OMAP4430_ABE_STATDEP_SHIFT (1 << 3)
38#define OMAP4430_ABE_STATDEP_MASK BITFIELD(3, 3)
39
40/* Used by CM_L4CFG_DYNAMICDEP */
41#define OMAP4430_ALWONCORE_DYNDEP_SHIFT (1 << 16)
42#define OMAP4430_ALWONCORE_DYNDEP_MASK BITFIELD(16, 16)
43
44/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP, CM_TESLA_STATICDEP */
45#define OMAP4430_ALWONCORE_STATDEP_SHIFT (1 << 16)
46#define OMAP4430_ALWONCORE_STATDEP_MASK BITFIELD(16, 16)
47
48/*
49 * Used by CM_AUTOIDLE_DPLL_PER, CM_AUTOIDLE_DPLL_UNIPRO, CM_AUTOIDLE_DPLL_USB,
50 * CM_AUTOIDLE_DPLL_CORE_RESTORE, CM_AUTOIDLE_DPLL_ABE, CM_AUTOIDLE_DPLL_CORE,
51 * CM_AUTOIDLE_DPLL_DDRPHY, CM_AUTOIDLE_DPLL_IVA, CM_AUTOIDLE_DPLL_MPU
52 */
53#define OMAP4430_AUTO_DPLL_MODE_SHIFT (1 << 0)
54#define OMAP4430_AUTO_DPLL_MODE_MASK BITFIELD(0, 2)
55
56/* Used by CM_L4CFG_DYNAMICDEP */
57#define OMAP4430_CEFUSE_DYNDEP_SHIFT (1 << 17)
58#define OMAP4430_CEFUSE_DYNDEP_MASK BITFIELD(17, 17)
59
60/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP, CM_TESLA_STATICDEP */
61#define OMAP4430_CEFUSE_STATDEP_SHIFT (1 << 17)
62#define OMAP4430_CEFUSE_STATDEP_MASK BITFIELD(17, 17)
63
64/* Used by CM1_ABE_CLKSTCTRL */
65#define OMAP4430_CLKACTIVITY_ABE_24M_GFCLK_SHIFT (1 << 13)
66#define OMAP4430_CLKACTIVITY_ABE_24M_GFCLK_MASK BITFIELD(13, 13)
67
68/* Used by CM1_ABE_CLKSTCTRL */
69#define OMAP4430_CLKACTIVITY_ABE_ALWON_32K_CLK_SHIFT (1 << 12)
70#define OMAP4430_CLKACTIVITY_ABE_ALWON_32K_CLK_MASK BITFIELD(12, 12)
71
72/* Used by CM_WKUP_CLKSTCTRL */
73#define OMAP4430_CLKACTIVITY_ABE_LP_CLK_SHIFT (1 << 9)
74#define OMAP4430_CLKACTIVITY_ABE_LP_CLK_MASK BITFIELD(9, 9)
75
76/* Used by CM1_ABE_CLKSTCTRL */
77#define OMAP4430_CLKACTIVITY_ABE_SYSCLK_SHIFT (1 << 11)
78#define OMAP4430_CLKACTIVITY_ABE_SYSCLK_MASK BITFIELD(11, 11)
79
80/* Used by CM1_ABE_CLKSTCTRL */
81#define OMAP4430_CLKACTIVITY_ABE_X2_CLK_SHIFT (1 << 8)
82#define OMAP4430_CLKACTIVITY_ABE_X2_CLK_MASK BITFIELD(8, 8)
83
84/* Used by CM_MEMIF_CLKSTCTRL, CM_MEMIF_CLKSTCTRL_RESTORE */
85#define OMAP4430_CLKACTIVITY_ASYNC_DLL_CLK_SHIFT (1 << 11)
86#define OMAP4430_CLKACTIVITY_ASYNC_DLL_CLK_MASK BITFIELD(11, 11)
87
88/* Used by CM_MEMIF_CLKSTCTRL, CM_MEMIF_CLKSTCTRL_RESTORE */
89#define OMAP4430_CLKACTIVITY_ASYNC_PHY1_CLK_SHIFT (1 << 12)
90#define OMAP4430_CLKACTIVITY_ASYNC_PHY1_CLK_MASK BITFIELD(12, 12)
91
92/* Used by CM_MEMIF_CLKSTCTRL, CM_MEMIF_CLKSTCTRL_RESTORE */
93#define OMAP4430_CLKACTIVITY_ASYNC_PHY2_CLK_SHIFT (1 << 13)
94#define OMAP4430_CLKACTIVITY_ASYNC_PHY2_CLK_MASK BITFIELD(13, 13)
95
96/* Used by CM_CAM_CLKSTCTRL */
97#define OMAP4430_CLKACTIVITY_CAM_PHY_CTRL_GCLK_SHIFT (1 << 9)
98#define OMAP4430_CLKACTIVITY_CAM_PHY_CTRL_GCLK_MASK BITFIELD(9, 9)
99
100/* Used by CM_EMU_CLKSTCTRL */
101#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_SHIFT (1 << 9)
102#define OMAP4430_CLKACTIVITY_CORE_DPLL_EMU_CLK_MASK BITFIELD(9, 9)
103
104/* Used by CM_CEFUSE_CLKSTCTRL */
105#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_SHIFT (1 << 9)
106#define OMAP4430_CLKACTIVITY_CUST_EFUSE_SYS_CLK_MASK BITFIELD(9, 9)
107
108/* Used by CM_MEMIF_CLKSTCTRL, CM_MEMIF_CLKSTCTRL_RESTORE */
109#define OMAP4430_CLKACTIVITY_DLL_CLK_SHIFT (1 << 9)
110#define OMAP4430_CLKACTIVITY_DLL_CLK_MASK BITFIELD(9, 9)
111
112/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
113#define OMAP4430_CLKACTIVITY_DMT10_GFCLK_SHIFT (1 << 9)
114#define OMAP4430_CLKACTIVITY_DMT10_GFCLK_MASK BITFIELD(9, 9)
115
116/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
117#define OMAP4430_CLKACTIVITY_DMT11_GFCLK_SHIFT (1 << 10)
118#define OMAP4430_CLKACTIVITY_DMT11_GFCLK_MASK BITFIELD(10, 10)
119
120/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
121#define OMAP4430_CLKACTIVITY_DMT2_GFCLK_SHIFT (1 << 11)
122#define OMAP4430_CLKACTIVITY_DMT2_GFCLK_MASK BITFIELD(11, 11)
123
124/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
125#define OMAP4430_CLKACTIVITY_DMT3_GFCLK_SHIFT (1 << 12)
126#define OMAP4430_CLKACTIVITY_DMT3_GFCLK_MASK BITFIELD(12, 12)
127
128/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
129#define OMAP4430_CLKACTIVITY_DMT4_GFCLK_SHIFT (1 << 13)
130#define OMAP4430_CLKACTIVITY_DMT4_GFCLK_MASK BITFIELD(13, 13)
131
132/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
133#define OMAP4430_CLKACTIVITY_DMT9_GFCLK_SHIFT (1 << 14)
134#define OMAP4430_CLKACTIVITY_DMT9_GFCLK_MASK BITFIELD(14, 14)
135
136/* Used by CM_DSS_CLKSTCTRL */
137#define OMAP4430_CLKACTIVITY_DSS_ALWON_SYS_CLK_SHIFT (1 << 10)
138#define OMAP4430_CLKACTIVITY_DSS_ALWON_SYS_CLK_MASK BITFIELD(10, 10)
139
140/* Used by CM_DSS_CLKSTCTRL */
141#define OMAP4430_CLKACTIVITY_DSS_FCLK_SHIFT (1 << 9)
142#define OMAP4430_CLKACTIVITY_DSS_FCLK_MASK BITFIELD(9, 9)
143
144/* Used by CM_DUCATI_CLKSTCTRL */
145#define OMAP4430_CLKACTIVITY_DUCATI_GCLK_SHIFT (1 << 8)
146#define OMAP4430_CLKACTIVITY_DUCATI_GCLK_MASK BITFIELD(8, 8)
147
148/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
149#define OMAP4430_CLKACTIVITY_EMAC_50MHZ_CLK_SHIFT (1 << 10)
150#define OMAP4430_CLKACTIVITY_EMAC_50MHZ_CLK_MASK BITFIELD(10, 10)
151
152/* Used by CM_EMU_CLKSTCTRL */
153#define OMAP4430_CLKACTIVITY_EMU_SYS_CLK_SHIFT (1 << 8)
154#define OMAP4430_CLKACTIVITY_EMU_SYS_CLK_MASK BITFIELD(8, 8)
155
156/* Used by CM_CAM_CLKSTCTRL */
157#define OMAP4430_CLKACTIVITY_FDIF_GFCLK_SHIFT (1 << 10)
158#define OMAP4430_CLKACTIVITY_FDIF_GFCLK_MASK BITFIELD(10, 10)
159
160/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
161#define OMAP4430_CLKACTIVITY_FUNC_12M_GFCLK_SHIFT (1 << 15)
162#define OMAP4430_CLKACTIVITY_FUNC_12M_GFCLK_MASK BITFIELD(15, 15)
163
164/* Used by CM1_ABE_CLKSTCTRL */
165#define OMAP4430_CLKACTIVITY_FUNC_24M_GFCLK_SHIFT (1 << 10)
166#define OMAP4430_CLKACTIVITY_FUNC_24M_GFCLK_MASK BITFIELD(10, 10)
167
168/* Used by CM_DSS_CLKSTCTRL */
169#define OMAP4430_CLKACTIVITY_HDMI_PHY_48MHZ_GFCLK_SHIFT (1 << 11)
170#define OMAP4430_CLKACTIVITY_HDMI_PHY_48MHZ_GFCLK_MASK BITFIELD(11, 11)
171
172/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
173#define OMAP4430_CLKACTIVITY_HSIC_P1_480M_GFCLK_SHIFT (1 << 20)
174#define OMAP4430_CLKACTIVITY_HSIC_P1_480M_GFCLK_MASK BITFIELD(20, 20)
175
176/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
177#define OMAP4430_CLKACTIVITY_HSIC_P1_GFCLK_SHIFT (1 << 26)
178#define OMAP4430_CLKACTIVITY_HSIC_P1_GFCLK_MASK BITFIELD(26, 26)
179
180/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
181#define OMAP4430_CLKACTIVITY_HSIC_P2_480M_GFCLK_SHIFT (1 << 21)
182#define OMAP4430_CLKACTIVITY_HSIC_P2_480M_GFCLK_MASK BITFIELD(21, 21)
183
184/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
185#define OMAP4430_CLKACTIVITY_HSIC_P2_GFCLK_SHIFT (1 << 27)
186#define OMAP4430_CLKACTIVITY_HSIC_P2_GFCLK_MASK BITFIELD(27, 27)
187
188/* Used by CM_L3INIT_CLKSTCTRL */
189#define OMAP4430_CLKACTIVITY_INIT_32K_GFCLK_SHIFT (1 << 31)
190#define OMAP4430_CLKACTIVITY_INIT_32K_GFCLK_MASK BITFIELD(31, 31)
191
192/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
193#define OMAP4430_CLKACTIVITY_INIT_48MC_GFCLK_SHIFT (1 << 13)
194#define OMAP4430_CLKACTIVITY_INIT_48MC_GFCLK_MASK BITFIELD(13, 13)
195
196/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
197#define OMAP4430_CLKACTIVITY_INIT_48M_GFCLK_SHIFT (1 << 12)
198#define OMAP4430_CLKACTIVITY_INIT_48M_GFCLK_MASK BITFIELD(12, 12)
199
200/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
201#define OMAP4430_CLKACTIVITY_INIT_60M_P1_GFCLK_SHIFT (1 << 28)
202#define OMAP4430_CLKACTIVITY_INIT_60M_P1_GFCLK_MASK BITFIELD(28, 28)
203
204/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
205#define OMAP4430_CLKACTIVITY_INIT_60M_P2_GFCLK_SHIFT (1 << 29)
206#define OMAP4430_CLKACTIVITY_INIT_60M_P2_GFCLK_MASK BITFIELD(29, 29)
207
208/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
209#define OMAP4430_CLKACTIVITY_INIT_96M_GFCLK_SHIFT (1 << 11)
210#define OMAP4430_CLKACTIVITY_INIT_96M_GFCLK_MASK BITFIELD(11, 11)
211
212/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
213#define OMAP4430_CLKACTIVITY_INIT_HSI_GFCLK_SHIFT (1 << 16)
214#define OMAP4430_CLKACTIVITY_INIT_HSI_GFCLK_MASK BITFIELD(16, 16)
215
216/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
217#define OMAP4430_CLKACTIVITY_INIT_HSMMC1_GFCLK_SHIFT (1 << 17)
218#define OMAP4430_CLKACTIVITY_INIT_HSMMC1_GFCLK_MASK BITFIELD(17, 17)
219
220/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
221#define OMAP4430_CLKACTIVITY_INIT_HSMMC2_GFCLK_SHIFT (1 << 18)
222#define OMAP4430_CLKACTIVITY_INIT_HSMMC2_GFCLK_MASK BITFIELD(18, 18)
223
224/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
225#define OMAP4430_CLKACTIVITY_INIT_HSMMC6_GFCLK_SHIFT (1 << 19)
226#define OMAP4430_CLKACTIVITY_INIT_HSMMC6_GFCLK_MASK BITFIELD(19, 19)
227
228/* Used by CM_CAM_CLKSTCTRL */
229#define OMAP4430_CLKACTIVITY_ISS_GCLK_SHIFT (1 << 8)
230#define OMAP4430_CLKACTIVITY_ISS_GCLK_MASK BITFIELD(8, 8)
231
232/* Used by CM_IVAHD_CLKSTCTRL */
233#define OMAP4430_CLKACTIVITY_IVAHD_ROOT_CLK_SHIFT (1 << 8)
234#define OMAP4430_CLKACTIVITY_IVAHD_ROOT_CLK_MASK BITFIELD(8, 8)
235
236/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
237#define OMAP4430_CLKACTIVITY_L3INIT_DPLL_ALWON_CLK_SHIFT (1 << 14)
238#define OMAP4430_CLKACTIVITY_L3INIT_DPLL_ALWON_CLK_MASK BITFIELD(14, 14)
239
240/* Used by CM_L3_1_CLKSTCTRL, CM_L3_1_CLKSTCTRL_RESTORE */
241#define OMAP4430_CLKACTIVITY_L3_1_GICLK_SHIFT (1 << 8)
242#define OMAP4430_CLKACTIVITY_L3_1_GICLK_MASK BITFIELD(8, 8)
243
244/* Used by CM_L3_2_CLKSTCTRL, CM_L3_2_CLKSTCTRL_RESTORE */
245#define OMAP4430_CLKACTIVITY_L3_2_GICLK_SHIFT (1 << 8)
246#define OMAP4430_CLKACTIVITY_L3_2_GICLK_MASK BITFIELD(8, 8)
247
248/* Used by CM_D2D_CLKSTCTRL */
249#define OMAP4430_CLKACTIVITY_L3_D2D_GICLK_SHIFT (1 << 8)
250#define OMAP4430_CLKACTIVITY_L3_D2D_GICLK_MASK BITFIELD(8, 8)
251
252/* Used by CM_SDMA_CLKSTCTRL */
253#define OMAP4430_CLKACTIVITY_L3_DMA_GICLK_SHIFT (1 << 8)
254#define OMAP4430_CLKACTIVITY_L3_DMA_GICLK_MASK BITFIELD(8, 8)
255
256/* Used by CM_DSS_CLKSTCTRL */
257#define OMAP4430_CLKACTIVITY_L3_DSS_GICLK_SHIFT (1 << 8)
258#define OMAP4430_CLKACTIVITY_L3_DSS_GICLK_MASK BITFIELD(8, 8)
259
260/* Used by CM_MEMIF_CLKSTCTRL, CM_MEMIF_CLKSTCTRL_RESTORE */
261#define OMAP4430_CLKACTIVITY_L3_EMIF_GICLK_SHIFT (1 << 8)
262#define OMAP4430_CLKACTIVITY_L3_EMIF_GICLK_MASK BITFIELD(8, 8)
263
264/* Used by CM_GFX_CLKSTCTRL */
265#define OMAP4430_CLKACTIVITY_L3_GFX_GICLK_SHIFT (1 << 8)
266#define OMAP4430_CLKACTIVITY_L3_GFX_GICLK_MASK BITFIELD(8, 8)
267
268/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
269#define OMAP4430_CLKACTIVITY_L3_INIT_GICLK_SHIFT (1 << 8)
270#define OMAP4430_CLKACTIVITY_L3_INIT_GICLK_MASK BITFIELD(8, 8)
271
272/* Used by CM_L3INSTR_CLKSTCTRL */
273#define OMAP4430_CLKACTIVITY_L3_INSTR_GICLK_SHIFT (1 << 8)
274#define OMAP4430_CLKACTIVITY_L3_INSTR_GICLK_MASK BITFIELD(8, 8)
275
276/* Used by CM_L4SEC_CLKSTCTRL */
277#define OMAP4430_CLKACTIVITY_L3_SECURE_GICLK_SHIFT (1 << 8)
278#define OMAP4430_CLKACTIVITY_L3_SECURE_GICLK_MASK BITFIELD(8, 8)
279
280/* Used by CM_ALWON_CLKSTCTRL */
281#define OMAP4430_CLKACTIVITY_L4_AO_ICLK_SHIFT (1 << 8)
282#define OMAP4430_CLKACTIVITY_L4_AO_ICLK_MASK BITFIELD(8, 8)
283
284/* Used by CM_CEFUSE_CLKSTCTRL */
285#define OMAP4430_CLKACTIVITY_L4_CEFUSE_GICLK_SHIFT (1 << 8)
286#define OMAP4430_CLKACTIVITY_L4_CEFUSE_GICLK_MASK BITFIELD(8, 8)
287
288/* Used by CM_L4CFG_CLKSTCTRL, CM_L4CFG_CLKSTCTRL_RESTORE */
289#define OMAP4430_CLKACTIVITY_L4_CFG_GICLK_SHIFT (1 << 8)
290#define OMAP4430_CLKACTIVITY_L4_CFG_GICLK_MASK BITFIELD(8, 8)
291
292/* Used by CM_D2D_CLKSTCTRL */
293#define OMAP4430_CLKACTIVITY_L4_D2D_GICLK_SHIFT (1 << 9)
294#define OMAP4430_CLKACTIVITY_L4_D2D_GICLK_MASK BITFIELD(9, 9)
295
296/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
297#define OMAP4430_CLKACTIVITY_L4_INIT_GICLK_SHIFT (1 << 9)
298#define OMAP4430_CLKACTIVITY_L4_INIT_GICLK_MASK BITFIELD(9, 9)
299
300/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
301#define OMAP4430_CLKACTIVITY_L4_PER_GICLK_SHIFT (1 << 8)
302#define OMAP4430_CLKACTIVITY_L4_PER_GICLK_MASK BITFIELD(8, 8)
303
304/* Used by CM_L4SEC_CLKSTCTRL */
305#define OMAP4430_CLKACTIVITY_L4_SECURE_GICLK_SHIFT (1 << 9)
306#define OMAP4430_CLKACTIVITY_L4_SECURE_GICLK_MASK BITFIELD(9, 9)
307
308/* Used by CM_WKUP_CLKSTCTRL */
309#define OMAP4430_CLKACTIVITY_L4_WKUP_GICLK_SHIFT (1 << 12)
310#define OMAP4430_CLKACTIVITY_L4_WKUP_GICLK_MASK BITFIELD(12, 12)
311
312/* Used by CM_MPU_CLKSTCTRL, CM_MPU_CLKSTCTRL_RESTORE */
313#define OMAP4430_CLKACTIVITY_MPU_DPLL_CLK_SHIFT (1 << 8)
314#define OMAP4430_CLKACTIVITY_MPU_DPLL_CLK_MASK BITFIELD(8, 8)
315
316/* Used by CM1_ABE_CLKSTCTRL */
317#define OMAP4430_CLKACTIVITY_OCP_ABE_GICLK_SHIFT (1 << 9)
318#define OMAP4430_CLKACTIVITY_OCP_ABE_GICLK_MASK BITFIELD(9, 9)
319
320/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
321#define OMAP4430_CLKACTIVITY_PER_24MC_GFCLK_SHIFT (1 << 16)
322#define OMAP4430_CLKACTIVITY_PER_24MC_GFCLK_MASK BITFIELD(16, 16)
323
324/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
325#define OMAP4430_CLKACTIVITY_PER_32K_GFCLK_SHIFT (1 << 17)
326#define OMAP4430_CLKACTIVITY_PER_32K_GFCLK_MASK BITFIELD(17, 17)
327
328/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
329#define OMAP4430_CLKACTIVITY_PER_48M_GFCLK_SHIFT (1 << 18)
330#define OMAP4430_CLKACTIVITY_PER_48M_GFCLK_MASK BITFIELD(18, 18)
331
332/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
333#define OMAP4430_CLKACTIVITY_PER_96M_GFCLK_SHIFT (1 << 19)
334#define OMAP4430_CLKACTIVITY_PER_96M_GFCLK_MASK BITFIELD(19, 19)
335
336/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
337#define OMAP4430_CLKACTIVITY_PER_ABE_24M_GFCLK_SHIFT (1 << 25)
338#define OMAP4430_CLKACTIVITY_PER_ABE_24M_GFCLK_MASK BITFIELD(25, 25)
339
340/* Used by CM_EMU_CLKSTCTRL */
341#define OMAP4430_CLKACTIVITY_PER_DPLL_EMU_CLK_SHIFT (1 << 10)
342#define OMAP4430_CLKACTIVITY_PER_DPLL_EMU_CLK_MASK BITFIELD(10, 10)
343
344/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
345#define OMAP4430_CLKACTIVITY_PER_MCASP2_GFCLK_SHIFT (1 << 20)
346#define OMAP4430_CLKACTIVITY_PER_MCASP2_GFCLK_MASK BITFIELD(20, 20)
347
348/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
349#define OMAP4430_CLKACTIVITY_PER_MCASP3_GFCLK_SHIFT (1 << 21)
350#define OMAP4430_CLKACTIVITY_PER_MCASP3_GFCLK_MASK BITFIELD(21, 21)
351
352/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
353#define OMAP4430_CLKACTIVITY_PER_MCBSP4_GFCLK_SHIFT (1 << 22)
354#define OMAP4430_CLKACTIVITY_PER_MCBSP4_GFCLK_MASK BITFIELD(22, 22)
355
356/* Used by CM_L4PER_CLKSTCTRL, CM_L4PER_CLKSTCTRL_RESTORE */
357#define OMAP4430_CLKACTIVITY_PER_SYS_GFCLK_SHIFT (1 << 24)
358#define OMAP4430_CLKACTIVITY_PER_SYS_GFCLK_MASK BITFIELD(24, 24)
359
360/* Used by CM_MEMIF_CLKSTCTRL, CM_MEMIF_CLKSTCTRL_RESTORE */
361#define OMAP4430_CLKACTIVITY_PHY_ROOT_CLK_SHIFT (1 << 10)
362#define OMAP4430_CLKACTIVITY_PHY_ROOT_CLK_MASK BITFIELD(10, 10)
363
364/* Used by CM_GFX_CLKSTCTRL */
365#define OMAP4430_CLKACTIVITY_SGX_GFCLK_SHIFT (1 << 9)
366#define OMAP4430_CLKACTIVITY_SGX_GFCLK_MASK BITFIELD(9, 9)
367
368/* Used by CM_ALWON_CLKSTCTRL */
369#define OMAP4430_CLKACTIVITY_SR_CORE_SYSCLK_SHIFT (1 << 11)
370#define OMAP4430_CLKACTIVITY_SR_CORE_SYSCLK_MASK BITFIELD(11, 11)
371
372/* Used by CM_ALWON_CLKSTCTRL */
373#define OMAP4430_CLKACTIVITY_SR_IVA_SYSCLK_SHIFT (1 << 10)
374#define OMAP4430_CLKACTIVITY_SR_IVA_SYSCLK_MASK BITFIELD(10, 10)
375
376/* Used by CM_ALWON_CLKSTCTRL */
377#define OMAP4430_CLKACTIVITY_SR_MPU_SYSCLK_SHIFT (1 << 9)
378#define OMAP4430_CLKACTIVITY_SR_MPU_SYSCLK_MASK BITFIELD(9, 9)
379
380/* Used by CM_WKUP_CLKSTCTRL */
381#define OMAP4430_CLKACTIVITY_SYS_CLK_SHIFT (1 << 8)
382#define OMAP4430_CLKACTIVITY_SYS_CLK_MASK BITFIELD(8, 8)
383
384/* Used by CM_TESLA_CLKSTCTRL */
385#define OMAP4430_CLKACTIVITY_TESLA_ROOT_CLK_SHIFT (1 << 8)
386#define OMAP4430_CLKACTIVITY_TESLA_ROOT_CLK_MASK BITFIELD(8, 8)
387
388/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
389#define OMAP4430_CLKACTIVITY_TLL_CH0_GFCLK_SHIFT (1 << 22)
390#define OMAP4430_CLKACTIVITY_TLL_CH0_GFCLK_MASK BITFIELD(22, 22)
391
392/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
393#define OMAP4430_CLKACTIVITY_TLL_CH1_GFCLK_SHIFT (1 << 23)
394#define OMAP4430_CLKACTIVITY_TLL_CH1_GFCLK_MASK BITFIELD(23, 23)
395
396/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
397#define OMAP4430_CLKACTIVITY_TLL_CH2_GFCLK_SHIFT (1 << 24)
398#define OMAP4430_CLKACTIVITY_TLL_CH2_GFCLK_MASK BITFIELD(24, 24)
399
400/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
401#define OMAP4430_CLKACTIVITY_USB_DPLL_HS_CLK_SHIFT (1 << 15)
402#define OMAP4430_CLKACTIVITY_USB_DPLL_HS_CLK_MASK BITFIELD(15, 15)
403
404/* Used by CM_WKUP_CLKSTCTRL */
405#define OMAP4430_CLKACTIVITY_USIM_GFCLK_SHIFT (1 << 10)
406#define OMAP4430_CLKACTIVITY_USIM_GFCLK_MASK BITFIELD(10, 10)
407
408/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
409#define OMAP4430_CLKACTIVITY_UTMI_P3_GFCLK_SHIFT (1 << 30)
410#define OMAP4430_CLKACTIVITY_UTMI_P3_GFCLK_MASK BITFIELD(30, 30)
411
412/* Used by CM_L3INIT_CLKSTCTRL, CM_L3INIT_CLKSTCTRL_RESTORE */
413#define OMAP4430_CLKACTIVITY_UTMI_ROOT_GFCLK_SHIFT (1 << 25)
414#define OMAP4430_CLKACTIVITY_UTMI_ROOT_GFCLK_MASK BITFIELD(25, 25)
415
416/* Used by CM_WKUP_CLKSTCTRL */
417#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_SHIFT (1 << 11)
418#define OMAP4430_CLKACTIVITY_WKUP_32K_GFCLK_MASK BITFIELD(11, 11)
419
420/*
421 * Used by CM_WKUP_TIMER1_CLKCTRL, CM_L4PER_DMTIMER10_CLKCTRL,
422 * CM_L4PER_DMTIMER11_CLKCTRL, CM_L4PER_DMTIMER2_CLKCTRL,
423 * CM_L4PER_DMTIMER3_CLKCTRL, CM_L4PER_DMTIMER4_CLKCTRL,
424 * CM_L4PER_DMTIMER9_CLKCTRL, CM_L4PER_MCASP2_CLKCTRL, CM_L4PER_MCASP3_CLKCTRL,
425 * CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL, CM_L3INIT_MMC6_CLKCTRL,
426 * CM1_ABE_TIMER5_CLKCTRL, CM1_ABE_TIMER6_CLKCTRL, CM1_ABE_TIMER7_CLKCTRL,
427 * CM1_ABE_TIMER8_CLKCTRL
428 */
429#define OMAP4430_CLKSEL_SHIFT (1 << 24)
430#define OMAP4430_CLKSEL_MASK BITFIELD(24, 24)
431
432/*
433 * Renamed from CLKSEL Used by CM_ABE_DSS_SYS_CLKSEL, CM_ABE_PLL_REF_CLKSEL,
434 * CM_DPLL_SYS_REF_CLKSEL, CM_L4_WKUP_CLKSEL, CM_CLKSEL_DUCATI_ISS_ROOT,
435 * CM_CLKSEL_USB_60MHZ
436 */
437#define OMAP4430_CLKSEL_0_0_SHIFT (1 << 0)
438#define OMAP4430_CLKSEL_0_0_MASK BITFIELD(0, 0)
439
440/* Renamed from CLKSEL Used by CM_BYPCLK_DPLL_IVA, CM_BYPCLK_DPLL_MPU */
441#define OMAP4430_CLKSEL_0_1_SHIFT (1 << 0)
442#define OMAP4430_CLKSEL_0_1_MASK BITFIELD(0, 1)
443
444/* Renamed from CLKSEL Used by CM_L3INIT_HSI_CLKCTRL */
445#define OMAP4430_CLKSEL_24_25_SHIFT (1 << 24)
446#define OMAP4430_CLKSEL_24_25_MASK BITFIELD(24, 25)
447
448/* Used by CM_L3INIT_USB_OTG_CLKCTRL */
449#define OMAP4430_CLKSEL_60M_SHIFT (1 << 24)
450#define OMAP4430_CLKSEL_60M_MASK BITFIELD(24, 24)
451
452/* Used by CM1_ABE_AESS_CLKCTRL */
453#define OMAP4430_CLKSEL_AESS_FCLK_SHIFT (1 << 24)
454#define OMAP4430_CLKSEL_AESS_FCLK_MASK BITFIELD(24, 24)
455
456/* Used by CM_CLKSEL_CORE_RESTORE, CM_CLKSEL_CORE */
457#define OMAP4430_CLKSEL_CORE_SHIFT (1 << 0)
458#define OMAP4430_CLKSEL_CORE_MASK BITFIELD(0, 0)
459
460/* Renamed from CLKSEL_CORE Used by CM_SHADOW_FREQ_CONFIG2 */
461#define OMAP4430_CLKSEL_CORE_1_1_SHIFT (1 << 1)
462#define OMAP4430_CLKSEL_CORE_1_1_MASK BITFIELD(1, 1)
463
464/* Used by CM_WKUP_USIM_CLKCTRL */
465#define OMAP4430_CLKSEL_DIV_SHIFT (1 << 24)
466#define OMAP4430_CLKSEL_DIV_MASK BITFIELD(24, 24)
467
468/* Used by CM_CAM_FDIF_CLKCTRL */
469#define OMAP4430_CLKSEL_FCLK_SHIFT (1 << 24)
470#define OMAP4430_CLKSEL_FCLK_MASK BITFIELD(24, 25)
471
472/* Used by CM_L4PER_MCBSP4_CLKCTRL */
473#define OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT (1 << 25)
474#define OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK BITFIELD(25, 25)
475
476/*
477 * Renamed from CLKSEL_INTERNAL_SOURCE Used by CM1_ABE_DMIC_CLKCTRL,
478 * CM1_ABE_MCASP_CLKCTRL, CM1_ABE_MCBSP1_CLKCTRL, CM1_ABE_MCBSP2_CLKCTRL,
479 * CM1_ABE_MCBSP3_CLKCTRL
480 */
481#define OMAP4430_CLKSEL_INTERNAL_SOURCE_CM1_ABE_DMIC_SHIFT (1 << 26)
482#define OMAP4430_CLKSEL_INTERNAL_SOURCE_CM1_ABE_DMIC_MASK BITFIELD(26, 27)
483
484/* Used by CM_CLKSEL_CORE_RESTORE, CM_CLKSEL_CORE */
485#define OMAP4430_CLKSEL_L3_SHIFT (1 << 4)
486#define OMAP4430_CLKSEL_L3_MASK BITFIELD(4, 4)
487
488/* Renamed from CLKSEL_L3 Used by CM_SHADOW_FREQ_CONFIG2 */
489#define OMAP4430_CLKSEL_L3_SHADOW_SHIFT (1 << 2)
490#define OMAP4430_CLKSEL_L3_SHADOW_MASK BITFIELD(2, 2)
491
492/* Used by CM_CLKSEL_CORE_RESTORE, CM_CLKSEL_CORE */
493#define OMAP4430_CLKSEL_L4_SHIFT (1 << 8)
494#define OMAP4430_CLKSEL_L4_MASK BITFIELD(8, 8)
495
496/* Used by CM_CLKSEL_ABE */
497#define OMAP4430_CLKSEL_OPP_SHIFT (1 << 0)
498#define OMAP4430_CLKSEL_OPP_MASK BITFIELD(0, 1)
499
500/* Used by CM_GFX_GFX_CLKCTRL */
501#define OMAP4430_CLKSEL_PER_192M_SHIFT (1 << 25)
502#define OMAP4430_CLKSEL_PER_192M_MASK BITFIELD(25, 26)
503
504/* Used by CM_EMU_DEBUGSS_CLKCTRL */
505#define OMAP4430_CLKSEL_PMD_STM_CLK_SHIFT (1 << 27)
506#define OMAP4430_CLKSEL_PMD_STM_CLK_MASK BITFIELD(27, 29)
507
508/* Used by CM_EMU_DEBUGSS_CLKCTRL */
509#define OMAP4430_CLKSEL_PMD_TRACE_CLK_SHIFT (1 << 24)
510#define OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK BITFIELD(24, 26)
511
512/* Used by CM_GFX_GFX_CLKCTRL */
513#define OMAP4430_CLKSEL_SGX_FCLK_SHIFT (1 << 24)
514#define OMAP4430_CLKSEL_SGX_FCLK_MASK BITFIELD(24, 24)
515
516/*
517 * Used by CM1_ABE_DMIC_CLKCTRL, CM1_ABE_MCASP_CLKCTRL, CM1_ABE_MCBSP1_CLKCTRL,
518 * CM1_ABE_MCBSP2_CLKCTRL, CM1_ABE_MCBSP3_CLKCTRL
519 */
520#define OMAP4430_CLKSEL_SOURCE_SHIFT (1 << 24)
521#define OMAP4430_CLKSEL_SOURCE_MASK BITFIELD(24, 25)
522
523/* Renamed from CLKSEL_SOURCE Used by CM_L4PER_MCBSP4_CLKCTRL */
524#define OMAP4430_CLKSEL_SOURCE_24_24_SHIFT (1 << 24)
525#define OMAP4430_CLKSEL_SOURCE_24_24_MASK BITFIELD(24, 24)
526
527/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
528#define OMAP4430_CLKSEL_UTMI_P1_SHIFT (1 << 24)
529#define OMAP4430_CLKSEL_UTMI_P1_MASK BITFIELD(24, 24)
530
531/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
532#define OMAP4430_CLKSEL_UTMI_P2_SHIFT (1 << 25)
533#define OMAP4430_CLKSEL_UTMI_P2_MASK BITFIELD(25, 25)
534
535/*
536 * Used by CM_WKUP_CLKSTCTRL, CM_EMU_CLKSTCTRL, CM_D2D_CLKSTCTRL,
537 * CM_DUCATI_CLKSTCTRL, CM_L3INSTR_CLKSTCTRL, CM_L3_1_CLKSTCTRL,
538 * CM_L3_2_CLKSTCTRL, CM_L4CFG_CLKSTCTRL, CM_MEMIF_CLKSTCTRL,
539 * CM_SDMA_CLKSTCTRL, CM_GFX_CLKSTCTRL, CM_L4PER_CLKSTCTRL, CM_L4SEC_CLKSTCTRL,
540 * CM_L3INIT_CLKSTCTRL, CM_CAM_CLKSTCTRL, CM_CEFUSE_CLKSTCTRL,
541 * CM_L3INIT_CLKSTCTRL_RESTORE, CM_L3_1_CLKSTCTRL_RESTORE,
542 * CM_L3_2_CLKSTCTRL_RESTORE, CM_L4CFG_CLKSTCTRL_RESTORE,
543 * CM_L4PER_CLKSTCTRL_RESTORE, CM_MEMIF_CLKSTCTRL_RESTORE, CM_ALWON_CLKSTCTRL,
544 * CM_IVAHD_CLKSTCTRL, CM_DSS_CLKSTCTRL, CM_MPU_CLKSTCTRL, CM_TESLA_CLKSTCTRL,
545 * CM1_ABE_CLKSTCTRL, CM_MPU_CLKSTCTRL_RESTORE
546 */
547#define OMAP4430_CLKTRCTRL_SHIFT (1 << 0)
548#define OMAP4430_CLKTRCTRL_MASK BITFIELD(0, 1)
549
550/* Used by CM_EMU_OVERRIDE_DPLL_CORE */
551#define OMAP4430_CORE_DPLL_EMU_DIV_SHIFT (1 << 0)
552#define OMAP4430_CORE_DPLL_EMU_DIV_MASK BITFIELD(0, 6)
553
554/* Used by CM_EMU_OVERRIDE_DPLL_CORE */
555#define OMAP4430_CORE_DPLL_EMU_MULT_SHIFT (1 << 8)
556#define OMAP4430_CORE_DPLL_EMU_MULT_MASK BITFIELD(8, 18)
557
558/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */
559#define OMAP4430_D2D_DYNDEP_SHIFT (1 << 18)
560#define OMAP4430_D2D_DYNDEP_MASK BITFIELD(18, 18)
561
562/* Used by CM_MPU_STATICDEP */
563#define OMAP4430_D2D_STATDEP_SHIFT (1 << 18)
564#define OMAP4430_D2D_STATDEP_MASK BITFIELD(18, 18)
565
566/*
567 * Used by CM_SSC_DELTAMSTEP_DPLL_PER, CM_SSC_DELTAMSTEP_DPLL_UNIPRO,
568 * CM_SSC_DELTAMSTEP_DPLL_USB, CM_SSC_DELTAMSTEP_DPLL_CORE_RESTORE,
569 * CM_SSC_DELTAMSTEP_DPLL_ABE, CM_SSC_DELTAMSTEP_DPLL_CORE,
570 * CM_SSC_DELTAMSTEP_DPLL_DDRPHY, CM_SSC_DELTAMSTEP_DPLL_IVA,
571 * CM_SSC_DELTAMSTEP_DPLL_MPU
572 */
573#define OMAP4430_DELTAMSTEP_SHIFT (1 << 0)
574#define OMAP4430_DELTAMSTEP_MASK BITFIELD(0, 19)
575
576/* Used by CM_SHADOW_FREQ_CONFIG1_RESTORE, CM_SHADOW_FREQ_CONFIG1 */
577#define OMAP4430_DLL_OVERRIDE_SHIFT (1 << 2)
578#define OMAP4430_DLL_OVERRIDE_MASK BITFIELD(2, 2)
579
580/* Renamed from DLL_OVERRIDE Used by CM_DLL_CTRL */
581#define OMAP4430_DLL_OVERRIDE_0_0_SHIFT (1 << 0)
582#define OMAP4430_DLL_OVERRIDE_0_0_MASK BITFIELD(0, 0)
583
584/* Used by CM_SHADOW_FREQ_CONFIG1_RESTORE, CM_SHADOW_FREQ_CONFIG1 */
585#define OMAP4430_DLL_RESET_SHIFT (1 << 3)
586#define OMAP4430_DLL_RESET_MASK BITFIELD(3, 3)
587
588/*
589 * Used by CM_CLKSEL_DPLL_PER, CM_CLKSEL_DPLL_UNIPRO, CM_CLKSEL_DPLL_USB,
590 * CM_CLKSEL_DPLL_CORE_RESTORE, CM_CLKSEL_DPLL_ABE, CM_CLKSEL_DPLL_CORE,
591 * CM_CLKSEL_DPLL_DDRPHY, CM_CLKSEL_DPLL_IVA, CM_CLKSEL_DPLL_MPU
592 */
593#define OMAP4430_DPLL_BYP_CLKSEL_SHIFT (1 << 23)
594#define OMAP4430_DPLL_BYP_CLKSEL_MASK BITFIELD(23, 23)
595
596/* Used by CM_CLKDCOLDO_DPLL_USB */
597#define OMAP4430_DPLL_CLKDCOLDO_GATE_CTRL_SHIFT (1 << 8)
598#define OMAP4430_DPLL_CLKDCOLDO_GATE_CTRL_MASK BITFIELD(8, 8)
599
600/* Used by CM_CLKSEL_DPLL_CORE_RESTORE, CM_CLKSEL_DPLL_CORE */
601#define OMAP4430_DPLL_CLKOUTHIF_CLKSEL_SHIFT (1 << 20)
602#define OMAP4430_DPLL_CLKOUTHIF_CLKSEL_MASK BITFIELD(20, 20)
603
604/*
605 * Used by CM_DIV_M3_DPLL_PER, CM_DIV_M3_DPLL_CORE_RESTORE, CM_DIV_M3_DPLL_ABE,
606 * CM_DIV_M3_DPLL_CORE
607 */
608#define OMAP4430_DPLL_CLKOUTHIF_DIV_SHIFT (1 << 0)
609#define OMAP4430_DPLL_CLKOUTHIF_DIV_MASK BITFIELD(0, 4)
610
611/*
612 * Used by CM_DIV_M3_DPLL_PER, CM_DIV_M3_DPLL_CORE_RESTORE, CM_DIV_M3_DPLL_ABE,
613 * CM_DIV_M3_DPLL_CORE
614 */
615#define OMAP4430_DPLL_CLKOUTHIF_DIVCHACK_SHIFT (1 << 5)
616#define OMAP4430_DPLL_CLKOUTHIF_DIVCHACK_MASK BITFIELD(5, 5)
617
618/*
619 * Used by CM_DIV_M3_DPLL_PER, CM_DIV_M3_DPLL_CORE_RESTORE, CM_DIV_M3_DPLL_ABE,
620 * CM_DIV_M3_DPLL_CORE
621 */
622#define OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT (1 << 8)
623#define OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_MASK BITFIELD(8, 8)
624
625/* Used by CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO, CM_DIV_M2_DPLL_ABE */
626#define OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_SHIFT (1 << 10)
627#define OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK BITFIELD(10, 10)
628
629/*
630 * Used by CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO,
631 * CM_DIV_M2_DPLL_CORE_RESTORE, CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_CORE,
632 * CM_DIV_M2_DPLL_DDRPHY, CM_DIV_M2_DPLL_MPU
633 */
634#define OMAP4430_DPLL_CLKOUT_DIV_SHIFT (1 << 0)
635#define OMAP4430_DPLL_CLKOUT_DIV_MASK BITFIELD(0, 4)
636
637/* Renamed from DPLL_CLKOUT_DIV Used by CM_DIV_M2_DPLL_USB */
638#define OMAP4430_DPLL_CLKOUT_DIV_0_6_SHIFT (1 << 0)
639#define OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK BITFIELD(0, 6)
640
641/*
642 * Used by CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO,
643 * CM_DIV_M2_DPLL_CORE_RESTORE, CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_CORE,
644 * CM_DIV_M2_DPLL_DDRPHY, CM_DIV_M2_DPLL_MPU
645 */
646#define OMAP4430_DPLL_CLKOUT_DIVCHACK_SHIFT (1 << 5)
647#define OMAP4430_DPLL_CLKOUT_DIVCHACK_MASK BITFIELD(5, 5)
648
649/* Renamed from DPLL_CLKOUT_DIVCHACK Used by CM_DIV_M2_DPLL_USB */
650#define OMAP4430_DPLL_CLKOUT_DIVCHACK_M2_USB_SHIFT (1 << 7)
651#define OMAP4430_DPLL_CLKOUT_DIVCHACK_M2_USB_MASK BITFIELD(7, 7)
652
653/*
654 * Used by CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_USB, CM_DIV_M2_DPLL_CORE_RESTORE,
655 * CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_CORE, CM_DIV_M2_DPLL_DDRPHY,
656 * CM_DIV_M2_DPLL_MPU
657 */
658#define OMAP4430_DPLL_CLKOUT_GATE_CTRL_SHIFT (1 << 8)
659#define OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK BITFIELD(8, 8)
660
661/* Used by CM_SHADOW_FREQ_CONFIG1_RESTORE, CM_SHADOW_FREQ_CONFIG1 */
662#define OMAP4430_DPLL_CORE_DPLL_EN_SHIFT (1 << 8)
663#define OMAP4430_DPLL_CORE_DPLL_EN_MASK BITFIELD(8, 10)
664
665/* Used by CM_SHADOW_FREQ_CONFIG1_RESTORE, CM_SHADOW_FREQ_CONFIG1 */
666#define OMAP4430_DPLL_CORE_M2_DIV_SHIFT (1 << 11)
667#define OMAP4430_DPLL_CORE_M2_DIV_MASK BITFIELD(11, 15)
668
669/* Used by CM_SHADOW_FREQ_CONFIG2 */
670#define OMAP4430_DPLL_CORE_M5_DIV_SHIFT (1 << 3)
671#define OMAP4430_DPLL_CORE_M5_DIV_MASK BITFIELD(3, 7)
672
673/* Used by CM_SHADOW_FREQ_CONFIG1_RESTORE, CM_SHADOW_FREQ_CONFIG1 */
674#define OMAP4430_DPLL_CORE_SYS_REF_CLKSEL_SHIFT (1 << 1)
675#define OMAP4430_DPLL_CORE_SYS_REF_CLKSEL_MASK BITFIELD(1, 1)
676
677/*
678 * Used by CM_CLKSEL_DPLL_PER, CM_CLKSEL_DPLL_UNIPRO,
679 * CM_CLKSEL_DPLL_CORE_RESTORE, CM_CLKSEL_DPLL_ABE, CM_CLKSEL_DPLL_CORE,
680 * CM_CLKSEL_DPLL_DDRPHY, CM_CLKSEL_DPLL_IVA, CM_CLKSEL_DPLL_MPU
681 */
682#define OMAP4430_DPLL_DIV_SHIFT (1 << 0)
683#define OMAP4430_DPLL_DIV_MASK BITFIELD(0, 6)
684
685/* Renamed from DPLL_DIV Used by CM_CLKSEL_DPLL_USB */
686#define OMAP4430_DPLL_DIV_0_7_SHIFT (1 << 0)
687#define OMAP4430_DPLL_DIV_0_7_MASK BITFIELD(0, 7)
688
689/*
690 * Used by CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_USB,
691 * CM_CLKMODE_DPLL_CORE_RESTORE, CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE,
692 * CM_CLKMODE_DPLL_DDRPHY, CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU
693 */
694#define OMAP4430_DPLL_DRIFTGUARD_EN_SHIFT (1 << 8)
695#define OMAP4430_DPLL_DRIFTGUARD_EN_MASK BITFIELD(8, 8)
696
697/* Renamed from DPLL_DRIFTGUARD_EN Used by CM_CLKMODE_DPLL_UNIPRO */
698#define OMAP4430_DPLL_DRIFTGUARD_EN_3_3_SHIFT (1 << 3)
699#define OMAP4430_DPLL_DRIFTGUARD_EN_3_3_MASK BITFIELD(3, 3)
700
701/*
702 * Used by CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB,
703 * CM_CLKMODE_DPLL_CORE_RESTORE, CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE,
704 * CM_CLKMODE_DPLL_DDRPHY, CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU
705 */
706#define OMAP4430_DPLL_EN_SHIFT (1 << 0)
707#define OMAP4430_DPLL_EN_MASK BITFIELD(0, 2)
708
709/*
710 * Used by CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO,
711 * CM_CLKMODE_DPLL_CORE_RESTORE, CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE,
712 * CM_CLKMODE_DPLL_DDRPHY, CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU
713 */
714#define OMAP4430_DPLL_LPMODE_EN_SHIFT (1 << 10)
715#define OMAP4430_DPLL_LPMODE_EN_MASK BITFIELD(10, 10)
716
717/*
718 * Used by CM_CLKSEL_DPLL_PER, CM_CLKSEL_DPLL_UNIPRO,
719 * CM_CLKSEL_DPLL_CORE_RESTORE, CM_CLKSEL_DPLL_ABE, CM_CLKSEL_DPLL_CORE,
720 * CM_CLKSEL_DPLL_DDRPHY, CM_CLKSEL_DPLL_IVA, CM_CLKSEL_DPLL_MPU
721 */
722#define OMAP4430_DPLL_MULT_SHIFT (1 << 8)
723#define OMAP4430_DPLL_MULT_MASK BITFIELD(8, 18)
724
725/* Renamed from DPLL_MULT Used by CM_CLKSEL_DPLL_USB */
726#define OMAP4430_DPLL_MULT_USB_SHIFT (1 << 8)
727#define OMAP4430_DPLL_MULT_USB_MASK BITFIELD(8, 19)
728
729/*
730 * Used by CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO,
731 * CM_CLKMODE_DPLL_CORE_RESTORE, CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE,
732 * CM_CLKMODE_DPLL_DDRPHY, CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU
733 */
734#define OMAP4430_DPLL_REGM4XEN_SHIFT (1 << 11)
735#define OMAP4430_DPLL_REGM4XEN_MASK BITFIELD(11, 11)
736
737/* Used by CM_CLKSEL_DPLL_USB */
738#define OMAP4430_DPLL_SD_DIV_SHIFT (1 << 24)
739#define OMAP4430_DPLL_SD_DIV_MASK BITFIELD(24, 31)
740
741/*
742 * Used by CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB,
743 * CM_CLKMODE_DPLL_CORE_RESTORE, CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE,
744 * CM_CLKMODE_DPLL_DDRPHY, CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU
745 */
746#define OMAP4430_DPLL_SSC_ACK_SHIFT (1 << 13)
747#define OMAP4430_DPLL_SSC_ACK_MASK BITFIELD(13, 13)
748
749/*
750 * Used by CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB,
751 * CM_CLKMODE_DPLL_CORE_RESTORE, CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE,
752 * CM_CLKMODE_DPLL_DDRPHY, CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU
753 */
754#define OMAP4430_DPLL_SSC_DOWNSPREAD_SHIFT (1 << 14)
755#define OMAP4430_DPLL_SSC_DOWNSPREAD_MASK BITFIELD(14, 14)
756
757/*
758 * Used by CM_CLKMODE_DPLL_PER, CM_CLKMODE_DPLL_UNIPRO, CM_CLKMODE_DPLL_USB,
759 * CM_CLKMODE_DPLL_CORE_RESTORE, CM_CLKMODE_DPLL_ABE, CM_CLKMODE_DPLL_CORE,
760 * CM_CLKMODE_DPLL_DDRPHY, CM_CLKMODE_DPLL_IVA, CM_CLKMODE_DPLL_MPU
761 */
762#define OMAP4430_DPLL_SSC_EN_SHIFT (1 << 12)
763#define OMAP4430_DPLL_SSC_EN_MASK BITFIELD(12, 12)
764
765/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
766#define OMAP4430_DSS_DYNDEP_SHIFT (1 << 8)
767#define OMAP4430_DSS_DYNDEP_MASK BITFIELD(8, 8)
768
769/*
770 * Used by CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP, CM_SDMA_STATICDEP_RESTORE,
771 * CM_MPU_STATICDEP
772 */
773#define OMAP4430_DSS_STATDEP_SHIFT (1 << 8)
774#define OMAP4430_DSS_STATDEP_MASK BITFIELD(8, 8)
775
776/* Used by CM_L3_2_DYNAMICDEP */
777#define OMAP4430_DUCATI_DYNDEP_SHIFT (1 << 0)
778#define OMAP4430_DUCATI_DYNDEP_MASK BITFIELD(0, 0)
779
780/* Used by CM_SDMA_STATICDEP, CM_SDMA_STATICDEP_RESTORE, CM_MPU_STATICDEP */
781#define OMAP4430_DUCATI_STATDEP_SHIFT (1 << 0)
782#define OMAP4430_DUCATI_STATDEP_MASK BITFIELD(0, 0)
783
784/* Used by CM_SHADOW_FREQ_CONFIG1_RESTORE, CM_SHADOW_FREQ_CONFIG1 */
785#define OMAP4430_FREQ_UPDATE_SHIFT (1 << 0)
786#define OMAP4430_FREQ_UPDATE_MASK BITFIELD(0, 0)
787
788/* Used by CM_L3_2_DYNAMICDEP */
789#define OMAP4430_GFX_DYNDEP_SHIFT (1 << 10)
790#define OMAP4430_GFX_DYNDEP_MASK BITFIELD(10, 10)
791
792/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */
793#define OMAP4430_GFX_STATDEP_SHIFT (1 << 10)
794#define OMAP4430_GFX_STATDEP_MASK BITFIELD(10, 10)
795
796/* Used by CM_SHADOW_FREQ_CONFIG2 */
797#define OMAP4430_GPMC_FREQ_UPDATE_SHIFT (1 << 0)
798#define OMAP4430_GPMC_FREQ_UPDATE_MASK BITFIELD(0, 0)
799
800/*
801 * Used by CM_DIV_M4_DPLL_PER, CM_DIV_M4_DPLL_CORE_RESTORE,
802 * CM_DIV_M4_DPLL_CORE, CM_DIV_M4_DPLL_DDRPHY, CM_DIV_M4_DPLL_IVA
803 */
804#define OMAP4430_HSDIVIDER_CLKOUT1_DIV_SHIFT (1 << 0)
805#define OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK BITFIELD(0, 4)
806
807/*
808 * Used by CM_DIV_M4_DPLL_PER, CM_DIV_M4_DPLL_CORE_RESTORE,
809 * CM_DIV_M4_DPLL_CORE, CM_DIV_M4_DPLL_DDRPHY, CM_DIV_M4_DPLL_IVA
810 */
811#define OMAP4430_HSDIVIDER_CLKOUT1_DIVCHACK_SHIFT (1 << 5)
812#define OMAP4430_HSDIVIDER_CLKOUT1_DIVCHACK_MASK BITFIELD(5, 5)
813
814/*
815 * Used by CM_DIV_M4_DPLL_PER, CM_DIV_M4_DPLL_CORE_RESTORE,
816 * CM_DIV_M4_DPLL_CORE, CM_DIV_M4_DPLL_DDRPHY, CM_DIV_M4_DPLL_IVA
817 */
818#define OMAP4430_HSDIVIDER_CLKOUT1_GATE_CTRL_SHIFT (1 << 8)
819#define OMAP4430_HSDIVIDER_CLKOUT1_GATE_CTRL_MASK BITFIELD(8, 8)
820
821/*
822 * Used by CM_DIV_M4_DPLL_PER, CM_DIV_M4_DPLL_CORE_RESTORE,
823 * CM_DIV_M4_DPLL_CORE, CM_DIV_M4_DPLL_DDRPHY, CM_DIV_M4_DPLL_IVA
824 */
825#define OMAP4430_HSDIVIDER_CLKOUT1_PWDN_SHIFT (1 << 12)
826#define OMAP4430_HSDIVIDER_CLKOUT1_PWDN_MASK BITFIELD(12, 12)
827
828/*
829 * Used by CM_DIV_M5_DPLL_PER, CM_DIV_M5_DPLL_CORE_RESTORE,
830 * CM_DIV_M5_DPLL_CORE, CM_DIV_M5_DPLL_DDRPHY, CM_DIV_M5_DPLL_IVA
831 */
832#define OMAP4430_HSDIVIDER_CLKOUT2_DIV_SHIFT (1 << 0)
833#define OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK BITFIELD(0, 4)
834
835/*
836 * Used by CM_DIV_M5_DPLL_PER, CM_DIV_M5_DPLL_CORE_RESTORE,
837 * CM_DIV_M5_DPLL_CORE, CM_DIV_M5_DPLL_DDRPHY, CM_DIV_M5_DPLL_IVA
838 */
839#define OMAP4430_HSDIVIDER_CLKOUT2_DIVCHACK_SHIFT (1 << 5)
840#define OMAP4430_HSDIVIDER_CLKOUT2_DIVCHACK_MASK BITFIELD(5, 5)
841
842/*
843 * Used by CM_DIV_M5_DPLL_PER, CM_DIV_M5_DPLL_CORE_RESTORE,
844 * CM_DIV_M5_DPLL_CORE, CM_DIV_M5_DPLL_DDRPHY, CM_DIV_M5_DPLL_IVA
845 */
846#define OMAP4430_HSDIVIDER_CLKOUT2_GATE_CTRL_SHIFT (1 << 8)
847#define OMAP4430_HSDIVIDER_CLKOUT2_GATE_CTRL_MASK BITFIELD(8, 8)
848
849/*
850 * Used by CM_DIV_M5_DPLL_PER, CM_DIV_M5_DPLL_CORE_RESTORE,
851 * CM_DIV_M5_DPLL_CORE, CM_DIV_M5_DPLL_DDRPHY, CM_DIV_M5_DPLL_IVA
852 */
853#define OMAP4430_HSDIVIDER_CLKOUT2_PWDN_SHIFT (1 << 12)
854#define OMAP4430_HSDIVIDER_CLKOUT2_PWDN_MASK BITFIELD(12, 12)
855
856/*
857 * Used by CM_DIV_M6_DPLL_PER, CM_DIV_M6_DPLL_CORE_RESTORE,
858 * CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY
859 */
860#define OMAP4430_HSDIVIDER_CLKOUT3_DIV_SHIFT (1 << 0)
861#define OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK BITFIELD(0, 4)
862
863/*
864 * Used by CM_DIV_M6_DPLL_PER, CM_DIV_M6_DPLL_CORE_RESTORE,
865 * CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY
866 */
867#define OMAP4430_HSDIVIDER_CLKOUT3_DIVCHACK_SHIFT (1 << 5)
868#define OMAP4430_HSDIVIDER_CLKOUT3_DIVCHACK_MASK BITFIELD(5, 5)
869
870/*
871 * Used by CM_DIV_M6_DPLL_PER, CM_DIV_M6_DPLL_CORE_RESTORE,
872 * CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY
873 */
874#define OMAP4430_HSDIVIDER_CLKOUT3_GATE_CTRL_SHIFT (1 << 8)
875#define OMAP4430_HSDIVIDER_CLKOUT3_GATE_CTRL_MASK BITFIELD(8, 8)
876
877/*
878 * Used by CM_DIV_M6_DPLL_PER, CM_DIV_M6_DPLL_CORE_RESTORE,
879 * CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY
880 */
881#define OMAP4430_HSDIVIDER_CLKOUT3_PWDN_SHIFT (1 << 12)
882#define OMAP4430_HSDIVIDER_CLKOUT3_PWDN_MASK BITFIELD(12, 12)
883
884/*
885 * Used by CM_DIV_M7_DPLL_PER, CM_DIV_M7_DPLL_CORE_RESTORE,
886 * CM_DIV_M7_DPLL_CORE
887 */
888#define OMAP4430_HSDIVIDER_CLKOUT4_DIV_SHIFT (1 << 0)
889#define OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK BITFIELD(0, 4)
890
891/*
892 * Used by CM_DIV_M7_DPLL_PER, CM_DIV_M7_DPLL_CORE_RESTORE,
893 * CM_DIV_M7_DPLL_CORE
894 */
895#define OMAP4430_HSDIVIDER_CLKOUT4_DIVCHACK_SHIFT (1 << 5)
896#define OMAP4430_HSDIVIDER_CLKOUT4_DIVCHACK_MASK BITFIELD(5, 5)
897
898/*
899 * Used by CM_DIV_M7_DPLL_PER, CM_DIV_M7_DPLL_CORE_RESTORE,
900 * CM_DIV_M7_DPLL_CORE
901 */
902#define OMAP4430_HSDIVIDER_CLKOUT4_GATE_CTRL_SHIFT (1 << 8)
903#define OMAP4430_HSDIVIDER_CLKOUT4_GATE_CTRL_MASK BITFIELD(8, 8)
904
905/*
906 * Used by CM_DIV_M7_DPLL_PER, CM_DIV_M7_DPLL_CORE_RESTORE,
907 * CM_DIV_M7_DPLL_CORE
908 */
909#define OMAP4430_HSDIVIDER_CLKOUT4_PWDN_SHIFT (1 << 12)
910#define OMAP4430_HSDIVIDER_CLKOUT4_PWDN_MASK BITFIELD(12, 12)
911
912/*
913 * Used by PRM_PRM_PROFILING_CLKCTRL, CM_WKUP_GPIO1_CLKCTRL,
914 * CM_WKUP_KEYBOARD_CLKCTRL, CM_WKUP_L4WKUP_CLKCTRL, CM_WKUP_RTC_CLKCTRL,
915 * CM_WKUP_SARRAM_CLKCTRL, CM_WKUP_SYNCTIMER_CLKCTRL, CM_WKUP_TIMER12_CLKCTRL,
916 * CM_WKUP_TIMER1_CLKCTRL, CM_WKUP_USIM_CLKCTRL, CM_WKUP_WDT1_CLKCTRL,
917 * CM_WKUP_WDT2_CLKCTRL, CM_EMU_DEBUGSS_CLKCTRL, CM_D2D_MODEM_ICR_CLKCTRL,
918 * CM_D2D_SAD2D_CLKCTRL, CM_D2D_SAD2D_FW_CLKCTRL, CM_DUCATI_DUCATI_CLKCTRL,
919 * CM_L3INSTR_L3_3_CLKCTRL, CM_L3INSTR_L3_INSTR_CLKCTRL,
920 * CM_L3INSTR_OCP_WP1_CLKCTRL, CM_L3_1_L3_1_CLKCTRL, CM_L3_2_GPMC_CLKCTRL,
921 * CM_L3_2_L3_2_CLKCTRL, CM_L3_2_OCMC_RAM_CLKCTRL, CM_L4CFG_HW_SEM_CLKCTRL,
922 * CM_L4CFG_L4_CFG_CLKCTRL, CM_L4CFG_MAILBOX_CLKCTRL, CM_L4CFG_SAR_ROM_CLKCTRL,
923 * CM_MEMIF_DMM_CLKCTRL, CM_MEMIF_EMIF_1_CLKCTRL, CM_MEMIF_EMIF_2_CLKCTRL,
924 * CM_MEMIF_EMIF_FW_CLKCTRL, CM_MEMIF_EMIF_H1_CLKCTRL,
925 * CM_MEMIF_EMIF_H2_CLKCTRL, CM_SDMA_SDMA_CLKCTRL, CM_GFX_GFX_CLKCTRL,
926 * CM_L4PER_ADC_CLKCTRL, CM_L4PER_DMTIMER10_CLKCTRL,
927 * CM_L4PER_DMTIMER11_CLKCTRL, CM_L4PER_DMTIMER2_CLKCTRL,
928 * CM_L4PER_DMTIMER3_CLKCTRL, CM_L4PER_DMTIMER4_CLKCTRL,
929 * CM_L4PER_DMTIMER9_CLKCTRL, CM_L4PER_ELM_CLKCTRL, CM_L4PER_GPIO2_CLKCTRL,
930 * CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL, CM_L4PER_GPIO5_CLKCTRL,
931 * CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_HDQ1W_CLKCTRL, CM_L4PER_HECC1_CLKCTRL,
932 * CM_L4PER_HECC2_CLKCTRL, CM_L4PER_I2C1_CLKCTRL, CM_L4PER_I2C2_CLKCTRL,
933 * CM_L4PER_I2C3_CLKCTRL, CM_L4PER_I2C4_CLKCTRL, CM_L4PER_I2C5_CLKCTRL,
934 * CM_L4PER_L4PER_CLKCTRL, CM_L4PER_MCASP2_CLKCTRL, CM_L4PER_MCASP3_CLKCTRL,
935 * CM_L4PER_MCBSP4_CLKCTRL, CM_L4PER_MCSPI1_CLKCTRL, CM_L4PER_MCSPI2_CLKCTRL,
936 * CM_L4PER_MCSPI3_CLKCTRL, CM_L4PER_MCSPI4_CLKCTRL, CM_L4PER_MGATE_CLKCTRL,
937 * CM_L4PER_MMCSD3_CLKCTRL, CM_L4PER_MMCSD4_CLKCTRL, CM_L4PER_MMCSD5_CLKCTRL,
938 * CM_L4PER_MSPROHG_CLKCTRL, CM_L4PER_SLIMBUS2_CLKCTRL, CM_L4PER_UART1_CLKCTRL,
939 * CM_L4PER_UART2_CLKCTRL, CM_L4PER_UART3_CLKCTRL, CM_L4PER_UART4_CLKCTRL,
940 * CM_L4SEC_AES1_CLKCTRL, CM_L4SEC_AES2_CLKCTRL, CM_L4SEC_CRYPTODMA_CLKCTRL,
941 * CM_L4SEC_DES3DES_CLKCTRL, CM_L4SEC_PKAEIP29_CLKCTRL, CM_L4SEC_RNG_CLKCTRL,
942 * CM_L4SEC_SHA2MD51_CLKCTRL, CM_L3INIT_CCPTX_CLKCTRL, CM_L3INIT_EMAC_CLKCTRL,
943 * CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL,
944 * CM_L3INIT_MMC6_CLKCTRL, CM_L3INIT_P1500_CLKCTRL, CM_L3INIT_PCIESS_CLKCTRL,
945 * CM_L3INIT_SATA_CLKCTRL, CM_L3INIT_TPPSS_CLKCTRL, CM_L3INIT_UNIPRO1_CLKCTRL,
946 * CM_L3INIT_USBPHYOCP2SCP_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL,
947 * CM_L3INIT_USB_HOST_FS_CLKCTRL, CM_L3INIT_USB_OTG_CLKCTRL,
948 * CM_L3INIT_USB_TLL_CLKCTRL, CM_L3INIT_XHPI_CLKCTRL, CM_CAM_FDIF_CLKCTRL,
949 * CM_CAM_ISS_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL,
950 * CM_L3INIT_USB_HOST_CLKCTRL_RESTORE, CM_L3INIT_USB_TLL_CLKCTRL_RESTORE,
951 * CM_L3INSTR_L3_3_CLKCTRL_RESTORE, CM_L3INSTR_L3_INSTR_CLKCTRL_RESTORE,
952 * CM_L3INSTR_OCP_WP1_CLKCTRL_RESTORE, CM_L4PER_GPIO2_CLKCTRL_RESTORE,
953 * CM_L4PER_GPIO3_CLKCTRL_RESTORE, CM_L4PER_GPIO4_CLKCTRL_RESTORE,
954 * CM_L4PER_GPIO5_CLKCTRL_RESTORE, CM_L4PER_GPIO6_CLKCTRL_RESTORE,
955 * CM_ALWON_MDMINTC_CLKCTRL, CM_ALWON_SR_CORE_CLKCTRL, CM_ALWON_SR_IVA_CLKCTRL,
956 * CM_ALWON_SR_MPU_CLKCTRL, CM_IVAHD_IVAHD_CLKCTRL, CM_IVAHD_SL2_CLKCTRL,
957 * CM_DSS_DEISS_CLKCTRL, CM_DSS_DSS_CLKCTRL, CM_CM2_PROFILING_CLKCTRL,
958 * CM_MPU_MPU_CLKCTRL, CM_TESLA_TESLA_CLKCTRL, CM1_ABE_AESS_CLKCTRL,
959 * CM1_ABE_DMIC_CLKCTRL, CM1_ABE_L4ABE_CLKCTRL, CM1_ABE_MCASP_CLKCTRL,
960 * CM1_ABE_MCBSP1_CLKCTRL, CM1_ABE_MCBSP2_CLKCTRL, CM1_ABE_MCBSP3_CLKCTRL,
961 * CM1_ABE_PDM_CLKCTRL, CM1_ABE_SLIMBUS_CLKCTRL, CM1_ABE_TIMER5_CLKCTRL,
962 * CM1_ABE_TIMER6_CLKCTRL, CM1_ABE_TIMER7_CLKCTRL, CM1_ABE_TIMER8_CLKCTRL,
963 * CM1_ABE_WDT3_CLKCTRL, CM_CM1_PROFILING_CLKCTRL
964 */
965#define OMAP4430_IDLEST_SHIFT (1 << 16)
966#define OMAP4430_IDLEST_MASK BITFIELD(16, 17)
967
968/* Used by CM_DUCATI_DYNAMICDEP, CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP */
969#define OMAP4430_ISS_DYNDEP_SHIFT (1 << 9)
970#define OMAP4430_ISS_DYNDEP_MASK BITFIELD(9, 9)
971
972/*
973 * Used by CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP, CM_SDMA_STATICDEP_RESTORE,
974 * CM_MPU_STATICDEP, CM_TESLA_STATICDEP
975 */
976#define OMAP4430_ISS_STATDEP_SHIFT (1 << 9)
977#define OMAP4430_ISS_STATDEP_MASK BITFIELD(9, 9)
978
979/* Used by CM_L3_2_DYNAMICDEP, CM_TESLA_DYNAMICDEP */
980#define OMAP4430_IVAHD_DYNDEP_SHIFT (1 << 2)
981#define OMAP4430_IVAHD_DYNDEP_MASK BITFIELD(2, 2)
982
983/*
984 * Used by CM_D2D_STATICDEP, CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP,
985 * CM_GFX_STATICDEP, CM_L3INIT_STATICDEP, CM_CAM_STATICDEP,
986 * CM_SDMA_STATICDEP_RESTORE, CM_DSS_STATICDEP, CM_MPU_STATICDEP,
987 * CM_TESLA_STATICDEP
988 */
989#define OMAP4430_IVAHD_STATDEP_SHIFT (1 << 2)
990#define OMAP4430_IVAHD_STATDEP_MASK BITFIELD(2, 2)
991
992/* Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
993#define OMAP4430_L3INIT_DYNDEP_SHIFT (1 << 7)
994#define OMAP4430_L3INIT_DYNDEP_MASK BITFIELD(7, 7)
995
996/*
997 * Used by CM_D2D_STATICDEP, CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP,
998 * CM_SDMA_STATICDEP_RESTORE, CM_MPU_STATICDEP, CM_TESLA_STATICDEP
999 */
1000#define OMAP4430_L3INIT_STATDEP_SHIFT (1 << 7)
1001#define OMAP4430_L3INIT_STATDEP_MASK BITFIELD(7, 7)
1002
1003/*
1004 * Used by CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_L3INIT_DYNAMICDEP,
1005 * CM_DSS_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP
1006 */
1007#define OMAP4430_L3_1_DYNDEP_SHIFT (1 << 5)
1008#define OMAP4430_L3_1_DYNDEP_MASK BITFIELD(5, 5)
1009
1010/*
1011 * Used by CM_D2D_STATICDEP, CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP,
1012 * CM_GFX_STATICDEP, CM_L4SEC_STATICDEP, CM_L3INIT_STATICDEP, CM_CAM_STATICDEP,
1013 * CM_SDMA_STATICDEP_RESTORE, CM_IVAHD_STATICDEP, CM_DSS_STATICDEP,
1014 * CM_MPU_STATICDEP, CM_TESLA_STATICDEP
1015 */
1016#define OMAP4430_L3_1_STATDEP_SHIFT (1 << 5)
1017#define OMAP4430_L3_1_STATDEP_MASK BITFIELD(5, 5)
1018
1019/*
1020 * Used by CM_EMU_DYNAMICDEP, CM_D2D_DYNAMICDEP, CM_DUCATI_DYNAMICDEP,
1021 * CM_L3_1_DYNAMICDEP, CM_L4CFG_DYNAMICDEP, CM_SDMA_DYNAMICDEP,
1022 * CM_GFX_DYNAMICDEP, CM_L4SEC_DYNAMICDEP, CM_L3INIT_DYNAMICDEP,
1023 * CM_CAM_DYNAMICDEP, CM_IVAHD_DYNAMICDEP
1024 */
1025#define OMAP4430_L3_2_DYNDEP_SHIFT (1 << 6)
1026#define OMAP4430_L3_2_DYNDEP_MASK BITFIELD(6, 6)
1027
1028/*
1029 * Used by CM_D2D_STATICDEP, CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP,
1030 * CM_GFX_STATICDEP, CM_L4SEC_STATICDEP, CM_L3INIT_STATICDEP, CM_CAM_STATICDEP,
1031 * CM_SDMA_STATICDEP_RESTORE, CM_IVAHD_STATICDEP, CM_DSS_STATICDEP,
1032 * CM_MPU_STATICDEP, CM_TESLA_STATICDEP
1033 */
1034#define OMAP4430_L3_2_STATDEP_SHIFT (1 << 6)
1035#define OMAP4430_L3_2_STATDEP_MASK BITFIELD(6, 6)
1036
1037/* Used by CM_L3_1_DYNAMICDEP */
1038#define OMAP4430_L4CFG_DYNDEP_SHIFT (1 << 12)
1039#define OMAP4430_L4CFG_DYNDEP_MASK BITFIELD(12, 12)
1040
1041/*
1042 * Used by CM_D2D_STATICDEP, CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP,
1043 * CM_L3INIT_STATICDEP, CM_SDMA_STATICDEP_RESTORE, CM_MPU_STATICDEP,
1044 * CM_TESLA_STATICDEP
1045 */
1046#define OMAP4430_L4CFG_STATDEP_SHIFT (1 << 12)
1047#define OMAP4430_L4CFG_STATDEP_MASK BITFIELD(12, 12)
1048
1049/* Used by CM_L3_2_DYNAMICDEP */
1050#define OMAP4430_L4PER_DYNDEP_SHIFT (1 << 13)
1051#define OMAP4430_L4PER_DYNDEP_MASK BITFIELD(13, 13)
1052
1053/*
1054 * Used by CM_D2D_STATICDEP, CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP,
1055 * CM_L4SEC_STATICDEP, CM_L3INIT_STATICDEP, CM_SDMA_STATICDEP_RESTORE,
1056 * CM_MPU_STATICDEP, CM_TESLA_STATICDEP
1057 */
1058#define OMAP4430_L4PER_STATDEP_SHIFT (1 << 13)
1059#define OMAP4430_L4PER_STATDEP_MASK BITFIELD(13, 13)
1060
1061/* Used by CM_L3_2_DYNAMICDEP, CM_L4PER_DYNAMICDEP */
1062#define OMAP4430_L4SEC_DYNDEP_SHIFT (1 << 14)
1063#define OMAP4430_L4SEC_DYNDEP_MASK BITFIELD(14, 14)
1064
1065/*
1066 * Used by CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP, CM_L3INIT_STATICDEP,
1067 * CM_SDMA_STATICDEP_RESTORE, CM_MPU_STATICDEP
1068 */
1069#define OMAP4430_L4SEC_STATDEP_SHIFT (1 << 14)
1070#define OMAP4430_L4SEC_STATDEP_MASK BITFIELD(14, 14)
1071
1072/* Used by CM_L4CFG_DYNAMICDEP */
1073#define OMAP4430_L4WKUP_DYNDEP_SHIFT (1 << 15)
1074#define OMAP4430_L4WKUP_DYNDEP_MASK BITFIELD(15, 15)
1075
1076/*
1077 * Used by CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP, CM_L3INIT_STATICDEP,
1078 * CM_SDMA_STATICDEP_RESTORE, CM_MPU_STATICDEP, CM_TESLA_STATICDEP
1079 */
1080#define OMAP4430_L4WKUP_STATDEP_SHIFT (1 << 15)
1081#define OMAP4430_L4WKUP_STATDEP_MASK BITFIELD(15, 15)
1082
1083/*
1084 * Used by CM_D2D_DYNAMICDEP, CM_L3_1_DYNAMICDEP, CM_L4CFG_DYNAMICDEP,
1085 * CM_MPU_DYNAMICDEP
1086 */
1087#define OMAP4430_MEMIF_DYNDEP_SHIFT (1 << 4)
1088#define OMAP4430_MEMIF_DYNDEP_MASK BITFIELD(4, 4)
1089
1090/*
1091 * Used by CM_D2D_STATICDEP, CM_DUCATI_STATICDEP, CM_SDMA_STATICDEP,
1092 * CM_GFX_STATICDEP, CM_L4SEC_STATICDEP, CM_L3INIT_STATICDEP, CM_CAM_STATICDEP,
1093 * CM_SDMA_STATICDEP_RESTORE, CM_IVAHD_STATICDEP, CM_DSS_STATICDEP,
1094 * CM_MPU_STATICDEP, CM_TESLA_STATICDEP
1095 */
1096#define OMAP4430_MEMIF_STATDEP_SHIFT (1 << 4)
1097#define OMAP4430_MEMIF_STATDEP_MASK BITFIELD(4, 4)
1098
1099/*
1100 * Used by CM_SSC_MODFREQDIV_DPLL_PER, CM_SSC_MODFREQDIV_DPLL_UNIPRO,
1101 * CM_SSC_MODFREQDIV_DPLL_USB, CM_SSC_MODFREQDIV_DPLL_CORE_RESTORE,
1102 * CM_SSC_MODFREQDIV_DPLL_ABE, CM_SSC_MODFREQDIV_DPLL_CORE,
1103 * CM_SSC_MODFREQDIV_DPLL_DDRPHY, CM_SSC_MODFREQDIV_DPLL_IVA,
1104 * CM_SSC_MODFREQDIV_DPLL_MPU
1105 */
1106#define OMAP4430_MODFREQDIV_EXPONENT_SHIFT (1 << 8)
1107#define OMAP4430_MODFREQDIV_EXPONENT_MASK BITFIELD(8, 10)
1108
1109/*
1110 * Used by CM_SSC_MODFREQDIV_DPLL_PER, CM_SSC_MODFREQDIV_DPLL_UNIPRO,
1111 * CM_SSC_MODFREQDIV_DPLL_USB, CM_SSC_MODFREQDIV_DPLL_CORE_RESTORE,
1112 * CM_SSC_MODFREQDIV_DPLL_ABE, CM_SSC_MODFREQDIV_DPLL_CORE,
1113 * CM_SSC_MODFREQDIV_DPLL_DDRPHY, CM_SSC_MODFREQDIV_DPLL_IVA,
1114 * CM_SSC_MODFREQDIV_DPLL_MPU
1115 */
1116#define OMAP4430_MODFREQDIV_MANTISSA_SHIFT (1 << 0)
1117#define OMAP4430_MODFREQDIV_MANTISSA_MASK BITFIELD(0, 6)
1118
1119/*
1120 * Used by PRM_PRM_PROFILING_CLKCTRL, CM_WKUP_GPIO1_CLKCTRL,
1121 * CM_WKUP_KEYBOARD_CLKCTRL, CM_WKUP_L4WKUP_CLKCTRL, CM_WKUP_RTC_CLKCTRL,
1122 * CM_WKUP_SARRAM_CLKCTRL, CM_WKUP_SYNCTIMER_CLKCTRL, CM_WKUP_TIMER12_CLKCTRL,
1123 * CM_WKUP_TIMER1_CLKCTRL, CM_WKUP_USIM_CLKCTRL, CM_WKUP_WDT1_CLKCTRL,
1124 * CM_WKUP_WDT2_CLKCTRL, CM_EMU_DEBUGSS_CLKCTRL, CM_D2D_MODEM_ICR_CLKCTRL,
1125 * CM_D2D_SAD2D_CLKCTRL, CM_D2D_SAD2D_FW_CLKCTRL, CM_DUCATI_DUCATI_CLKCTRL,
1126 * CM_L3INSTR_L3_3_CLKCTRL, CM_L3INSTR_L3_INSTR_CLKCTRL,
1127 * CM_L3INSTR_OCP_WP1_CLKCTRL, CM_L3_1_L3_1_CLKCTRL, CM_L3_2_GPMC_CLKCTRL,
1128 * CM_L3_2_L3_2_CLKCTRL, CM_L3_2_OCMC_RAM_CLKCTRL, CM_L4CFG_HW_SEM_CLKCTRL,
1129 * CM_L4CFG_L4_CFG_CLKCTRL, CM_L4CFG_MAILBOX_CLKCTRL, CM_L4CFG_SAR_ROM_CLKCTRL,
1130 * CM_MEMIF_DMM_CLKCTRL, CM_MEMIF_EMIF_1_CLKCTRL, CM_MEMIF_EMIF_2_CLKCTRL,
1131 * CM_MEMIF_EMIF_FW_CLKCTRL, CM_MEMIF_EMIF_H1_CLKCTRL,
1132 * CM_MEMIF_EMIF_H2_CLKCTRL, CM_SDMA_SDMA_CLKCTRL, CM_GFX_GFX_CLKCTRL,
1133 * CM_L4PER_ADC_CLKCTRL, CM_L4PER_DMTIMER10_CLKCTRL,
1134 * CM_L4PER_DMTIMER11_CLKCTRL, CM_L4PER_DMTIMER2_CLKCTRL,
1135 * CM_L4PER_DMTIMER3_CLKCTRL, CM_L4PER_DMTIMER4_CLKCTRL,
1136 * CM_L4PER_DMTIMER9_CLKCTRL, CM_L4PER_ELM_CLKCTRL, CM_L4PER_GPIO2_CLKCTRL,
1137 * CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL, CM_L4PER_GPIO5_CLKCTRL,
1138 * CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_HDQ1W_CLKCTRL, CM_L4PER_HECC1_CLKCTRL,
1139 * CM_L4PER_HECC2_CLKCTRL, CM_L4PER_I2C1_CLKCTRL, CM_L4PER_I2C2_CLKCTRL,
1140 * CM_L4PER_I2C3_CLKCTRL, CM_L4PER_I2C4_CLKCTRL, CM_L4PER_I2C5_CLKCTRL,
1141 * CM_L4PER_L4PER_CLKCTRL, CM_L4PER_MCASP2_CLKCTRL, CM_L4PER_MCASP3_CLKCTRL,
1142 * CM_L4PER_MCBSP4_CLKCTRL, CM_L4PER_MCSPI1_CLKCTRL, CM_L4PER_MCSPI2_CLKCTRL,
1143 * CM_L4PER_MCSPI3_CLKCTRL, CM_L4PER_MCSPI4_CLKCTRL, CM_L4PER_MGATE_CLKCTRL,
1144 * CM_L4PER_MMCSD3_CLKCTRL, CM_L4PER_MMCSD4_CLKCTRL, CM_L4PER_MMCSD5_CLKCTRL,
1145 * CM_L4PER_MSPROHG_CLKCTRL, CM_L4PER_SLIMBUS2_CLKCTRL, CM_L4PER_UART1_CLKCTRL,
1146 * CM_L4PER_UART2_CLKCTRL, CM_L4PER_UART3_CLKCTRL, CM_L4PER_UART4_CLKCTRL,
1147 * CM_L4SEC_AES1_CLKCTRL, CM_L4SEC_AES2_CLKCTRL, CM_L4SEC_CRYPTODMA_CLKCTRL,
1148 * CM_L4SEC_DES3DES_CLKCTRL, CM_L4SEC_PKAEIP29_CLKCTRL, CM_L4SEC_RNG_CLKCTRL,
1149 * CM_L4SEC_SHA2MD51_CLKCTRL, CM_L3INIT_CCPTX_CLKCTRL, CM_L3INIT_EMAC_CLKCTRL,
1150 * CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL,
1151 * CM_L3INIT_MMC6_CLKCTRL, CM_L3INIT_P1500_CLKCTRL, CM_L3INIT_PCIESS_CLKCTRL,
1152 * CM_L3INIT_SATA_CLKCTRL, CM_L3INIT_TPPSS_CLKCTRL, CM_L3INIT_UNIPRO1_CLKCTRL,
1153 * CM_L3INIT_USBPHYOCP2SCP_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL,
1154 * CM_L3INIT_USB_HOST_FS_CLKCTRL, CM_L3INIT_USB_OTG_CLKCTRL,
1155 * CM_L3INIT_USB_TLL_CLKCTRL, CM_L3INIT_XHPI_CLKCTRL, CM_CAM_FDIF_CLKCTRL,
1156 * CM_CAM_ISS_CLKCTRL, CM_CEFUSE_CEFUSE_CLKCTRL,
1157 * CM_L3INIT_USB_HOST_CLKCTRL_RESTORE, CM_L3INIT_USB_TLL_CLKCTRL_RESTORE,
1158 * CM_L3INSTR_L3_3_CLKCTRL_RESTORE, CM_L3INSTR_L3_INSTR_CLKCTRL_RESTORE,
1159 * CM_L3INSTR_OCP_WP1_CLKCTRL_RESTORE, CM_L4PER_GPIO2_CLKCTRL_RESTORE,
1160 * CM_L4PER_GPIO3_CLKCTRL_RESTORE, CM_L4PER_GPIO4_CLKCTRL_RESTORE,
1161 * CM_L4PER_GPIO5_CLKCTRL_RESTORE, CM_L4PER_GPIO6_CLKCTRL_RESTORE,
1162 * CM_ALWON_MDMINTC_CLKCTRL, CM_ALWON_SR_CORE_CLKCTRL, CM_ALWON_SR_IVA_CLKCTRL,
1163 * CM_ALWON_SR_MPU_CLKCTRL, CM_IVAHD_IVAHD_CLKCTRL, CM_IVAHD_SL2_CLKCTRL,
1164 * CM_DSS_DEISS_CLKCTRL, CM_DSS_DSS_CLKCTRL, CM_CM2_PROFILING_CLKCTRL,
1165 * CM_MPU_MPU_CLKCTRL, CM_TESLA_TESLA_CLKCTRL, CM1_ABE_AESS_CLKCTRL,
1166 * CM1_ABE_DMIC_CLKCTRL, CM1_ABE_L4ABE_CLKCTRL, CM1_ABE_MCASP_CLKCTRL,
1167 * CM1_ABE_MCBSP1_CLKCTRL, CM1_ABE_MCBSP2_CLKCTRL, CM1_ABE_MCBSP3_CLKCTRL,
1168 * CM1_ABE_PDM_CLKCTRL, CM1_ABE_SLIMBUS_CLKCTRL, CM1_ABE_TIMER5_CLKCTRL,
1169 * CM1_ABE_TIMER6_CLKCTRL, CM1_ABE_TIMER7_CLKCTRL, CM1_ABE_TIMER8_CLKCTRL,
1170 * CM1_ABE_WDT3_CLKCTRL, CM_CM1_PROFILING_CLKCTRL
1171 */
1172#define OMAP4430_MODULEMODE_SHIFT (1 << 0)
1173#define OMAP4430_MODULEMODE_MASK BITFIELD(0, 1)
1174
1175/* Used by CM_DSS_DSS_CLKCTRL */
1176#define OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT (1 << 9)
1177#define OMAP4430_OPTFCLKEN_48MHZ_CLK_MASK BITFIELD(9, 9)
1178
1179/* Used by CM_WKUP_BANDGAP_CLKCTRL */
1180#define OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT (1 << 8)
1181#define OMAP4430_OPTFCLKEN_BGAP_32K_MASK BITFIELD(8, 8)
1182
1183/* Used by CM_L3INIT_USBPHYOCP2SCP_CLKCTRL */
1184#define OMAP4430_OPTFCLKEN_CLK32K_SHIFT (1 << 9)
1185#define OMAP4430_OPTFCLKEN_CLK32K_MASK BITFIELD(9, 9)
1186
1187/* Used by CM_CAM_ISS_CLKCTRL */
1188#define OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT (1 << 8)
1189#define OMAP4430_OPTFCLKEN_CTRLCLK_MASK BITFIELD(8, 8)
1190
1191/*
1192 * Used by CM_WKUP_GPIO1_CLKCTRL, CM_L4PER_GPIO2_CLKCTRL,
1193 * CM_L4PER_GPIO3_CLKCTRL, CM_L4PER_GPIO4_CLKCTRL, CM_L4PER_GPIO5_CLKCTRL,
1194 * CM_L4PER_GPIO6_CLKCTRL, CM_L4PER_GPIO2_CLKCTRL_RESTORE,
1195 * CM_L4PER_GPIO3_CLKCTRL_RESTORE, CM_L4PER_GPIO4_CLKCTRL_RESTORE,
1196 * CM_L4PER_GPIO5_CLKCTRL_RESTORE, CM_L4PER_GPIO6_CLKCTRL_RESTORE
1197 */
1198#define OMAP4430_OPTFCLKEN_DBCLK_SHIFT (1 << 8)
1199#define OMAP4430_OPTFCLKEN_DBCLK_MASK BITFIELD(8, 8)
1200
1201/* Used by CM_MEMIF_DLL_CLKCTRL, CM_MEMIF_DLL_H_CLKCTRL */
1202#define OMAP4430_OPTFCLKEN_DLL_CLK_SHIFT (1 << 8)
1203#define OMAP4430_OPTFCLKEN_DLL_CLK_MASK BITFIELD(8, 8)
1204
1205/* Used by CM_DSS_DSS_CLKCTRL */
1206#define OMAP4430_OPTFCLKEN_DSSCLK_SHIFT (1 << 8)
1207#define OMAP4430_OPTFCLKEN_DSSCLK_MASK BITFIELD(8, 8)
1208
1209/* Used by CM1_ABE_SLIMBUS_CLKCTRL */
1210#define OMAP4430_OPTFCLKEN_FCLK0_SHIFT (1 << 8)
1211#define OMAP4430_OPTFCLKEN_FCLK0_MASK BITFIELD(8, 8)
1212
1213/* Used by CM1_ABE_SLIMBUS_CLKCTRL */
1214#define OMAP4430_OPTFCLKEN_FCLK1_SHIFT (1 << 9)
1215#define OMAP4430_OPTFCLKEN_FCLK1_MASK BITFIELD(9, 9)
1216
1217/* Used by CM1_ABE_SLIMBUS_CLKCTRL */
1218#define OMAP4430_OPTFCLKEN_FCLK2_SHIFT (1 << 10)
1219#define OMAP4430_OPTFCLKEN_FCLK2_MASK BITFIELD(10, 10)
1220
1221/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
1222#define OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT (1 << 15)
1223#define OMAP4430_OPTFCLKEN_FUNC48MCLK_MASK BITFIELD(15, 15)
1224
1225/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
1226#define OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT (1 << 13)
1227#define OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_MASK BITFIELD(13, 13)
1228
1229/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
1230#define OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT (1 << 14)
1231#define OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_MASK BITFIELD(14, 14)
1232
1233/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
1234#define OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT (1 << 11)
1235#define OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_MASK BITFIELD(11, 11)
1236
1237/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
1238#define OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT (1 << 12)
1239#define OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_MASK BITFIELD(12, 12)
1240
1241/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */
1242#define OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT (1 << 8)
1243#define OMAP4430_OPTFCLKEN_PER24MC_GFCLK_MASK BITFIELD(8, 8)
1244
1245/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */
1246#define OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT (1 << 9)
1247#define OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_MASK BITFIELD(9, 9)
1248
1249/* Used by CM_L3INIT_USBPHYOCP2SCP_CLKCTRL */
1250#define OMAP4430_OPTFCLKEN_PHY_48M_SHIFT (1 << 8)
1251#define OMAP4430_OPTFCLKEN_PHY_48M_MASK BITFIELD(8, 8)
1252
1253/* Used by CM_L4PER_SLIMBUS2_CLKCTRL */
1254#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT (1 << 10)
1255#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_MASK BITFIELD(10, 10)
1256
1257/* Renamed from OPTFCLKEN_SLIMBUS_CLK Used by CM1_ABE_SLIMBUS_CLKCTRL */
1258#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT (1 << 11)
1259#define OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_MASK BITFIELD(11, 11)
1260
1261/* Used by CM_DSS_DSS_CLKCTRL */
1262#define OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT (1 << 10)
1263#define OMAP4430_OPTFCLKEN_SYS_CLK_MASK BITFIELD(10, 10)
1264
1265/* Used by CM_DSS_DSS_CLKCTRL */
1266#define OMAP4430_OPTFCLKEN_TV_CLK_SHIFT (1 << 11)
1267#define OMAP4430_OPTFCLKEN_TV_CLK_MASK BITFIELD(11, 11)
1268
1269/* Used by CM_L3INIT_UNIPRO1_CLKCTRL */
1270#define OMAP4430_OPTFCLKEN_TXPHYCLK_SHIFT (1 << 8)
1271#define OMAP4430_OPTFCLKEN_TXPHYCLK_MASK BITFIELD(8, 8)
1272
1273/* Used by CM_L3INIT_USB_TLL_CLKCTRL, CM_L3INIT_USB_TLL_CLKCTRL_RESTORE */
1274#define OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT (1 << 8)
1275#define OMAP4430_OPTFCLKEN_USB_CH0_CLK_MASK BITFIELD(8, 8)
1276
1277/* Used by CM_L3INIT_USB_TLL_CLKCTRL, CM_L3INIT_USB_TLL_CLKCTRL_RESTORE */
1278#define OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT (1 << 9)
1279#define OMAP4430_OPTFCLKEN_USB_CH1_CLK_MASK BITFIELD(9, 9)
1280
1281/* Used by CM_L3INIT_USB_TLL_CLKCTRL, CM_L3INIT_USB_TLL_CLKCTRL_RESTORE */
1282#define OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT (1 << 10)
1283#define OMAP4430_OPTFCLKEN_USB_CH2_CLK_MASK BITFIELD(10, 10)
1284
1285/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
1286#define OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT (1 << 8)
1287#define OMAP4430_OPTFCLKEN_UTMI_P1_CLK_MASK BITFIELD(8, 8)
1288
1289/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
1290#define OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT (1 << 9)
1291#define OMAP4430_OPTFCLKEN_UTMI_P2_CLK_MASK BITFIELD(9, 9)
1292
1293/* Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE */
1294#define OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT (1 << 10)
1295#define OMAP4430_OPTFCLKEN_UTMI_P3_CLK_MASK BITFIELD(10, 10)
1296
1297/* Used by CM_L3INIT_USB_OTG_CLKCTRL */
1298#define OMAP4430_OPTFCLKEN_XCLK_SHIFT (1 << 8)
1299#define OMAP4430_OPTFCLKEN_XCLK_MASK BITFIELD(8, 8)
1300
1301/* Used by CM_EMU_OVERRIDE_DPLL_PER, CM_EMU_OVERRIDE_DPLL_CORE */
1302#define OMAP4430_OVERRIDE_ENABLE_SHIFT (1 << 19)
1303#define OMAP4430_OVERRIDE_ENABLE_MASK BITFIELD(19, 19)
1304
1305/* Used by CM_CLKSEL_ABE */
1306#define OMAP4430_PAD_CLKS_GATE_SHIFT (1 << 8)
1307#define OMAP4430_PAD_CLKS_GATE_MASK BITFIELD(8, 8)
1308
1309/* Used by CM_CORE_DVFS_CURRENT, CM_IVA_DVFS_CURRENT */
1310#define OMAP4430_PERF_CURRENT_SHIFT (1 << 0)
1311#define OMAP4430_PERF_CURRENT_MASK BITFIELD(0, 7)
1312
1313/*
1314 * Used by CM_CORE_DVFS_PERF1, CM_CORE_DVFS_PERF2, CM_CORE_DVFS_PERF3,
1315 * CM_CORE_DVFS_PERF4, CM_IVA_DVFS_PERF_ABE, CM_IVA_DVFS_PERF_IVAHD,
1316 * CM_IVA_DVFS_PERF_TESLA
1317 */
1318#define OMAP4430_PERF_REQ_SHIFT (1 << 0)
1319#define OMAP4430_PERF_REQ_MASK BITFIELD(0, 7)
1320
1321/* Used by CM_EMU_OVERRIDE_DPLL_PER */
1322#define OMAP4430_PER_DPLL_EMU_DIV_SHIFT (1 << 0)
1323#define OMAP4430_PER_DPLL_EMU_DIV_MASK BITFIELD(0, 6)
1324
1325/* Used by CM_EMU_OVERRIDE_DPLL_PER */
1326#define OMAP4430_PER_DPLL_EMU_MULT_SHIFT (1 << 8)
1327#define OMAP4430_PER_DPLL_EMU_MULT_MASK BITFIELD(8, 18)
1328
1329/* Used by CM_RESTORE_ST */
1330#define OMAP4430_PHASE1_COMPLETED_SHIFT (1 << 0)
1331#define OMAP4430_PHASE1_COMPLETED_MASK BITFIELD(0, 0)
1332
1333/* Used by CM_RESTORE_ST */
1334#define OMAP4430_PHASE2A_COMPLETED_SHIFT (1 << 1)
1335#define OMAP4430_PHASE2A_COMPLETED_MASK BITFIELD(1, 1)
1336
1337/* Used by CM_RESTORE_ST */
1338#define OMAP4430_PHASE2B_COMPLETED_SHIFT (1 << 2)
1339#define OMAP4430_PHASE2B_COMPLETED_MASK BITFIELD(2, 2)
1340
1341/* Used by CM_EMU_DEBUGSS_CLKCTRL */
1342#define OMAP4430_PMD_STM_MUX_CTRL_SHIFT (1 << 20)
1343#define OMAP4430_PMD_STM_MUX_CTRL_MASK BITFIELD(20, 21)
1344
1345/* Used by CM_EMU_DEBUGSS_CLKCTRL */
1346#define OMAP4430_PMD_TRACE_MUX_CTRL_SHIFT (1 << 22)
1347#define OMAP4430_PMD_TRACE_MUX_CTRL_MASK BITFIELD(22, 23)
1348
1349/* Used by CM_DYN_DEP_PRESCAL */
1350#define OMAP4430_PRESCAL_SHIFT (1 << 0)
1351#define OMAP4430_PRESCAL_MASK BITFIELD(0, 5)
1352
1353/* Used by REVISION_CM2, REVISION_CM1 */
1354#define OMAP4430_REV_SHIFT (1 << 0)
1355#define OMAP4430_REV_MASK BITFIELD(0, 7)
1356
1357/*
1358 * Used by CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_TLL_CLKCTRL,
1359 * CM_L3INIT_USB_HOST_CLKCTRL_RESTORE, CM_L3INIT_USB_TLL_CLKCTRL_RESTORE
1360 */
1361#define OMAP4430_SAR_MODE_SHIFT (1 << 4)
1362#define OMAP4430_SAR_MODE_MASK BITFIELD(4, 4)
1363
1364/* Used by CM_SCALE_FCLK */
1365#define OMAP4430_SCALE_FCLK_SHIFT (1 << 0)
1366#define OMAP4430_SCALE_FCLK_MASK BITFIELD(0, 0)
1367
1368/* Used by CM_L4CFG_DYNAMICDEP */
1369#define OMAP4430_SDMA_DYNDEP_SHIFT (1 << 11)
1370#define OMAP4430_SDMA_DYNDEP_MASK BITFIELD(11, 11)
1371
1372/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */
1373#define OMAP4430_SDMA_STATDEP_SHIFT (1 << 11)
1374#define OMAP4430_SDMA_STATDEP_MASK BITFIELD(11, 11)
1375
1376/* Used by CM_CLKSEL_ABE */
1377#define OMAP4430_SLIMBUS_CLK_GATE_SHIFT (1 << 10)
1378#define OMAP4430_SLIMBUS_CLK_GATE_MASK BITFIELD(10, 10)
1379
1380/*
1381 * Used by CM_EMU_DEBUGSS_CLKCTRL, CM_D2D_SAD2D_CLKCTRL,
1382 * CM_DUCATI_DUCATI_CLKCTRL, CM_SDMA_SDMA_CLKCTRL, CM_GFX_GFX_CLKCTRL,
1383 * CM_L4SEC_CRYPTODMA_CLKCTRL, CM_L3INIT_CCPTX_CLKCTRL, CM_L3INIT_EMAC_CLKCTRL,
1384 * CM_L3INIT_HSI_CLKCTRL, CM_L3INIT_MMC1_CLKCTRL, CM_L3INIT_MMC2_CLKCTRL,
1385 * CM_L3INIT_MMC6_CLKCTRL, CM_L3INIT_P1500_CLKCTRL, CM_L3INIT_PCIESS_CLKCTRL,
1386 * CM_L3INIT_SATA_CLKCTRL, CM_L3INIT_TPPSS_CLKCTRL, CM_L3INIT_UNIPRO1_CLKCTRL,
1387 * CM_L3INIT_USB_HOST_CLKCTRL, CM_L3INIT_USB_HOST_FS_CLKCTRL,
1388 * CM_L3INIT_USB_OTG_CLKCTRL, CM_L3INIT_XHPI_CLKCTRL, CM_CAM_FDIF_CLKCTRL,
1389 * CM_CAM_ISS_CLKCTRL, CM_L3INIT_USB_HOST_CLKCTRL_RESTORE,
1390 * CM_IVAHD_IVAHD_CLKCTRL, CM_DSS_DEISS_CLKCTRL, CM_DSS_DSS_CLKCTRL,
1391 * CM_MPU_MPU_CLKCTRL, CM_TESLA_TESLA_CLKCTRL, CM1_ABE_AESS_CLKCTRL
1392 */
1393#define OMAP4430_STBYST_SHIFT (1 << 18)
1394#define OMAP4430_STBYST_MASK BITFIELD(18, 18)
1395
1396/*
1397 * Used by CM_IDLEST_DPLL_PER, CM_IDLEST_DPLL_UNIPRO, CM_IDLEST_DPLL_USB,
1398 * CM_IDLEST_DPLL_ABE, CM_IDLEST_DPLL_CORE, CM_IDLEST_DPLL_DDRPHY,
1399 * CM_IDLEST_DPLL_IVA, CM_IDLEST_DPLL_MPU
1400 */
1401#define OMAP4430_ST_DPLL_CLK_SHIFT (1 << 0)
1402#define OMAP4430_ST_DPLL_CLK_MASK BITFIELD(0, 0)
1403
1404/* Used by CM_CLKDCOLDO_DPLL_USB */
1405#define OMAP4430_ST_DPLL_CLKDCOLDO_SHIFT (1 << 9)
1406#define OMAP4430_ST_DPLL_CLKDCOLDO_MASK BITFIELD(9, 9)
1407
1408/*
1409 * Used by CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_USB, CM_DIV_M2_DPLL_CORE_RESTORE,
1410 * CM_DIV_M2_DPLL_ABE, CM_DIV_M2_DPLL_CORE, CM_DIV_M2_DPLL_DDRPHY,
1411 * CM_DIV_M2_DPLL_MPU
1412 */
1413#define OMAP4430_ST_DPLL_CLKOUT_SHIFT (1 << 9)
1414#define OMAP4430_ST_DPLL_CLKOUT_MASK BITFIELD(9, 9)
1415
1416/*
1417 * Used by CM_DIV_M3_DPLL_PER, CM_DIV_M3_DPLL_CORE_RESTORE, CM_DIV_M3_DPLL_ABE,
1418 * CM_DIV_M3_DPLL_CORE
1419 */
1420#define OMAP4430_ST_DPLL_CLKOUTHIF_SHIFT (1 << 9)
1421#define OMAP4430_ST_DPLL_CLKOUTHIF_MASK BITFIELD(9, 9)
1422
1423/* Used by CM_DIV_M2_DPLL_PER, CM_DIV_M2_DPLL_UNIPRO, CM_DIV_M2_DPLL_ABE */
1424#define OMAP4430_ST_DPLL_CLKOUTX2_SHIFT (1 << 11)
1425#define OMAP4430_ST_DPLL_CLKOUTX2_MASK BITFIELD(11, 11)
1426
1427/*
1428 * Used by CM_DIV_M4_DPLL_PER, CM_DIV_M4_DPLL_CORE_RESTORE,
1429 * CM_DIV_M4_DPLL_CORE, CM_DIV_M4_DPLL_DDRPHY, CM_DIV_M4_DPLL_IVA
1430 */
1431#define OMAP4430_ST_HSDIVIDER_CLKOUT1_SHIFT (1 << 9)
1432#define OMAP4430_ST_HSDIVIDER_CLKOUT1_MASK BITFIELD(9, 9)
1433
1434/*
1435 * Used by CM_DIV_M5_DPLL_PER, CM_DIV_M5_DPLL_CORE_RESTORE,
1436 * CM_DIV_M5_DPLL_CORE, CM_DIV_M5_DPLL_DDRPHY, CM_DIV_M5_DPLL_IVA
1437 */
1438#define OMAP4430_ST_HSDIVIDER_CLKOUT2_SHIFT (1 << 9)
1439#define OMAP4430_ST_HSDIVIDER_CLKOUT2_MASK BITFIELD(9, 9)
1440
1441/*
1442 * Used by CM_DIV_M6_DPLL_PER, CM_DIV_M6_DPLL_CORE_RESTORE,
1443 * CM_DIV_M6_DPLL_CORE, CM_DIV_M6_DPLL_DDRPHY
1444 */
1445#define OMAP4430_ST_HSDIVIDER_CLKOUT3_SHIFT (1 << 9)
1446#define OMAP4430_ST_HSDIVIDER_CLKOUT3_MASK BITFIELD(9, 9)
1447
1448/*
1449 * Used by CM_DIV_M7_DPLL_PER, CM_DIV_M7_DPLL_CORE_RESTORE,
1450 * CM_DIV_M7_DPLL_CORE
1451 */
1452#define OMAP4430_ST_HSDIVIDER_CLKOUT4_SHIFT (1 << 9)
1453#define OMAP4430_ST_HSDIVIDER_CLKOUT4_MASK BITFIELD(9, 9)
1454
1455/* Used by CM_SYS_CLKSEL */
1456#define OMAP4430_SYS_CLKSEL_SHIFT (1 << 0)
1457#define OMAP4430_SYS_CLKSEL_MASK BITFIELD(0, 2)
1458
1459/* Used by CM_L4CFG_DYNAMICDEP */
1460#define OMAP4430_TESLA_DYNDEP_SHIFT (1 << 1)
1461#define OMAP4430_TESLA_DYNDEP_MASK BITFIELD(1, 1)
1462
1463/* Used by CM_DUCATI_STATICDEP, CM_MPU_STATICDEP */
1464#define OMAP4430_TESLA_STATDEP_SHIFT (1 << 1)
1465#define OMAP4430_TESLA_STATDEP_MASK BITFIELD(1, 1)
1466
1467/*
1468 * Used by CM_EMU_DYNAMICDEP, CM_D2D_DYNAMICDEP, CM_DUCATI_DYNAMICDEP,
1469 * CM_L3_1_DYNAMICDEP, CM_L3_2_DYNAMICDEP, CM_L4CFG_DYNAMICDEP,
1470 * CM_L4PER_DYNAMICDEP, CM_MPU_DYNAMICDEP, CM_TESLA_DYNAMICDEP
1471 */
1472#define OMAP4430_WINDOWSIZE_SHIFT (1 << 24)
1473#define OMAP4430_WINDOWSIZE_MASK BITFIELD(24, 27)
1474#endif
diff --git a/arch/arm/mach-omap2/cm.c b/arch/arm/mach-omap2/cm.c
index 8eb2dab8c7db..58e4a1c557d8 100644
--- a/arch/arm/mach-omap2/cm.c
+++ b/arch/arm/mach-omap2/cm.c
@@ -21,6 +21,8 @@
21 21
22#include <asm/atomic.h> 22#include <asm/atomic.h>
23 23
24#include <plat/common.h>
25
24#include "cm.h" 26#include "cm.h"
25#include "cm-regbits-24xx.h" 27#include "cm-regbits-24xx.h"
26#include "cm-regbits-34xx.h" 28#include "cm-regbits-34xx.h"
@@ -61,9 +63,8 @@ int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
61 mask = 1 << idlest_shift; 63 mask = 1 << idlest_shift;
62 64
63 /* XXX should be OMAP2 CM */ 65 /* XXX should be OMAP2 CM */
64 while (((cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) != ena) && 66 omap_test_timeout(((cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena),
65 (i++ < MAX_MODULE_READY_TIME)) 67 MAX_MODULE_READY_TIME, i);
66 udelay(1);
67 68
68 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 69 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
69} 70}
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index a2fcfcc253cc..90a4086fbdf4 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -4,8 +4,8 @@
4/* 4/*
5 * OMAP2/3 Clock Management (CM) register definitions 5 * OMAP2/3 Clock Management (CM) register definitions
6 * 6 *
7 * Copyright (C) 2007-2008 Texas Instruments, Inc. 7 * Copyright (C) 2007-2009 Texas Instruments, Inc.
8 * Copyright (C) 2007-2008 Nokia Corporation 8 * Copyright (C) 2007-2009 Nokia Corporation
9 * 9 *
10 * Written by Paul Walmsley 10 * Written by Paul Walmsley
11 * 11 *
@@ -22,6 +22,12 @@
22 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg)) 22 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
23#define OMAP34XX_CM_REGADDR(module, reg) \ 23#define OMAP34XX_CM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg)) 24 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
25#define OMAP44XX_CM1_REGADDR(module, reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP4430_CM1_BASE + (module) + (reg))
27#define OMAP44XX_CM2_REGADDR(module, reg) \
28 OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE + (module) + (reg))
29
30#include "cm44xx.h"
25 31
26/* 32/*
27 * Architecture-specific global CM registers 33 * Architecture-specific global CM registers
@@ -89,6 +95,11 @@
89#define OMAP3430_CM_CLKSEL2_EMU 0x0050 95#define OMAP3430_CM_CLKSEL2_EMU 0x0050
90#define OMAP3430_CM_CLKSEL3_EMU 0x0054 96#define OMAP3430_CM_CLKSEL3_EMU 0x0054
91 97
98/* CM2.CEFUSE_CM2 register offsets */
99
100/* OMAP4 modulemode control */
101#define OMAP4430_MODULEMODE_HWCTRL 0
102#define OMAP4430_MODULEMODE_SWCTRL 1
92 103
93/* Clock management domain register get/set */ 104/* Clock management domain register get/set */
94 105
diff --git a/arch/arm/mach-omap2/cm44xx.h b/arch/arm/mach-omap2/cm44xx.h
new file mode 100644
index 000000000000..c575b9b0c041
--- /dev/null
+++ b/arch/arm/mach-omap2/cm44xx.h
@@ -0,0 +1,358 @@
1/*
2 * OMAP44xx CM1 & CM2 instance offset macros
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_CM44XX_H
23#define __ARCH_ARM_MACH_OMAP2_CM44XX_H
24
25
26/* CM1 */
27
28
29/* CM1.OCP_SOCKET_CM1 register offsets */
30#define OMAP4430_REVISION_CM1 OMAP44XX_CM1_REGADDR(OMAP4430_CM1_OCP_SOCKET_MOD, 0x0000)
31#define OMAP4430_CM_CM1_PROFILING_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_OCP_SOCKET_MOD, 0x0040)
32
33/* CM1.CKGEN_CM1 register offsets */
34#define OMAP4430_CM_CLKSEL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0000)
35#define OMAP4430_CM_CLKSEL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0008)
36#define OMAP4430_CM_DLL_CTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0010)
37#define OMAP4430_CM_CLKMODE_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0020)
38#define OMAP4430_CM_IDLEST_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0024)
39#define OMAP4430_CM_AUTOIDLE_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0028)
40#define OMAP4430_CM_CLKSEL_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x002c)
41#define OMAP4430_CM_DIV_M2_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0030)
42#define OMAP4430_CM_DIV_M3_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0034)
43#define OMAP4430_CM_DIV_M4_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0038)
44#define OMAP4430_CM_DIV_M5_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x003c)
45#define OMAP4430_CM_DIV_M6_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0040)
46#define OMAP4430_CM_DIV_M7_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0044)
47#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0048)
48#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x004c)
49#define OMAP4430_CM_EMU_OVERRIDE_DPLL_CORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0050)
50#define OMAP4430_CM_CLKMODE_DPLL_MPU OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0060)
51#define OMAP4430_CM_IDLEST_DPLL_MPU OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0064)
52#define OMAP4430_CM_AUTOIDLE_DPLL_MPU OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0068)
53#define OMAP4430_CM_CLKSEL_DPLL_MPU OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x006c)
54#define OMAP4430_CM_DIV_M2_DPLL_MPU OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0070)
55#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_MPU OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0088)
56#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_MPU OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x008c)
57#define OMAP4430_CM_BYPCLK_DPLL_MPU OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x009c)
58#define OMAP4430_CM_CLKMODE_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00a0)
59#define OMAP4430_CM_IDLEST_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00a4)
60#define OMAP4430_CM_AUTOIDLE_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00a8)
61#define OMAP4430_CM_CLKSEL_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00ac)
62#define OMAP4430_CM_DIV_M4_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00b8)
63#define OMAP4430_CM_DIV_M5_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00bc)
64#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00c8)
65#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00cc)
66#define OMAP4430_CM_BYPCLK_DPLL_IVA OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00dc)
67#define OMAP4430_CM_CLKMODE_DPLL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00e0)
68#define OMAP4430_CM_IDLEST_DPLL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00e4)
69#define OMAP4430_CM_AUTOIDLE_DPLL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00e8)
70#define OMAP4430_CM_CLKSEL_DPLL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00ec)
71#define OMAP4430_CM_DIV_M2_DPLL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00f0)
72#define OMAP4430_CM_DIV_M3_DPLL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x00f4)
73#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0108)
74#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_ABE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x010c)
75#define OMAP4430_CM_CLKMODE_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0120)
76#define OMAP4430_CM_IDLEST_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0124)
77#define OMAP4430_CM_AUTOIDLE_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0128)
78#define OMAP4430_CM_CLKSEL_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x012c)
79#define OMAP4430_CM_DIV_M2_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0130)
80#define OMAP4430_CM_DIV_M4_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0138)
81#define OMAP4430_CM_DIV_M5_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x013c)
82#define OMAP4430_CM_DIV_M6_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0140)
83#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0148)
84#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_DDRPHY OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x014c)
85#define OMAP4430_CM_SHADOW_FREQ_CONFIG1 OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0160)
86#define OMAP4430_CM_SHADOW_FREQ_CONFIG2 OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0164)
87#define OMAP4430_CM_DYN_DEP_PRESCAL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0170)
88#define OMAP4430_CM_RESTORE_ST OMAP44XX_CM1_REGADDR(OMAP4430_CM1_CKGEN_MOD, 0x0180)
89
90/* CM1.MPU_CM1 register offsets */
91#define OMAP4430_CM_MPU_CLKSTCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_MPU_MOD, 0x0000)
92#define OMAP4430_CM_MPU_STATICDEP OMAP44XX_CM1_REGADDR(OMAP4430_CM1_MPU_MOD, 0x0004)
93#define OMAP4430_CM_MPU_DYNAMICDEP OMAP44XX_CM1_REGADDR(OMAP4430_CM1_MPU_MOD, 0x0008)
94#define OMAP4430_CM_MPU_MPU_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_MPU_MOD, 0x0020)
95
96/* CM1.TESLA_CM1 register offsets */
97#define OMAP4430_CM_TESLA_CLKSTCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_TESLA_MOD, 0x0000)
98#define OMAP4430_CM_TESLA_STATICDEP OMAP44XX_CM1_REGADDR(OMAP4430_CM1_TESLA_MOD, 0x0004)
99#define OMAP4430_CM_TESLA_DYNAMICDEP OMAP44XX_CM1_REGADDR(OMAP4430_CM1_TESLA_MOD, 0x0008)
100#define OMAP4430_CM_TESLA_TESLA_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_TESLA_MOD, 0x0020)
101
102/* CM1.ABE_CM1 register offsets */
103#define OMAP4430_CM1_ABE_CLKSTCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0000)
104#define OMAP4430_CM1_ABE_L4ABE_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0020)
105#define OMAP4430_CM1_ABE_AESS_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0028)
106#define OMAP4430_CM1_ABE_PDM_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0030)
107#define OMAP4430_CM1_ABE_DMIC_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0038)
108#define OMAP4430_CM1_ABE_MCASP_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0040)
109#define OMAP4430_CM1_ABE_MCBSP1_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0048)
110#define OMAP4430_CM1_ABE_MCBSP2_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0050)
111#define OMAP4430_CM1_ABE_MCBSP3_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0058)
112#define OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0060)
113#define OMAP4430_CM1_ABE_TIMER5_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0068)
114#define OMAP4430_CM1_ABE_TIMER6_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0070)
115#define OMAP4430_CM1_ABE_TIMER7_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0078)
116#define OMAP4430_CM1_ABE_TIMER8_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0080)
117#define OMAP4430_CM1_ABE_WDT3_CLKCTRL OMAP44XX_CM1_REGADDR(OMAP4430_CM1_ABE_MOD, 0x0088)
118
119/* CM1.RESTORE_CM1 register offsets */
120#define OMAP4430_CM_CLKSEL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0000)
121#define OMAP4430_CM_DIV_M2_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0004)
122#define OMAP4430_CM_DIV_M3_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0008)
123#define OMAP4430_CM_DIV_M4_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x000c)
124#define OMAP4430_CM_DIV_M5_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0010)
125#define OMAP4430_CM_DIV_M6_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0014)
126#define OMAP4430_CM_DIV_M7_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0018)
127#define OMAP4430_CM_CLKSEL_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x001c)
128#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0020)
129#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0024)
130#define OMAP4430_CM_CLKMODE_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0028)
131#define OMAP4430_CM_SHADOW_FREQ_CONFIG1_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x002c)
132#define OMAP4430_CM_AUTOIDLE_DPLL_CORE_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0030)
133#define OMAP4430_CM_MPU_CLKSTCTRL_RESTORE OMAP44XX_CM1_REGADDR(OMAP4430_CM1_RESTORE_MOD, 0x0034)
134
135/* CM2 */
136
137
138/* CM2.OCP_SOCKET_CM2 register offsets */
139#define OMAP4430_REVISION_CM2 OMAP44XX_CM2_REGADDR(OMAP4430_CM2_OCP_SOCKET_MOD, 0x0000)
140#define OMAP4430_CM_CM2_PROFILING_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_OCP_SOCKET_MOD, 0x0040)
141
142/* CM2.CKGEN_CM2 register offsets */
143#define OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0000)
144#define OMAP4430_CM_CLKSEL_USB_60MHZ OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0004)
145#define OMAP4430_CM_SCALE_FCLK OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0008)
146#define OMAP4430_CM_CORE_DVFS_PERF1 OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0010)
147#define OMAP4430_CM_CORE_DVFS_PERF2 OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0014)
148#define OMAP4430_CM_CORE_DVFS_PERF3 OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0018)
149#define OMAP4430_CM_CORE_DVFS_PERF4 OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x001c)
150#define OMAP4430_CM_CORE_DVFS_CURRENT OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0024)
151#define OMAP4430_CM_IVA_DVFS_PERF_TESLA OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0028)
152#define OMAP4430_CM_IVA_DVFS_PERF_IVAHD OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x002c)
153#define OMAP4430_CM_IVA_DVFS_PERF_ABE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0030)
154#define OMAP4430_CM_IVA_DVFS_CURRENT OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0038)
155#define OMAP4430_CM_CLKMODE_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0040)
156#define OMAP4430_CM_IDLEST_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0044)
157#define OMAP4430_CM_AUTOIDLE_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0048)
158#define OMAP4430_CM_CLKSEL_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x004c)
159#define OMAP4430_CM_DIV_M2_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0050)
160#define OMAP4430_CM_DIV_M3_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0054)
161#define OMAP4430_CM_DIV_M4_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0058)
162#define OMAP4430_CM_DIV_M5_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x005c)
163#define OMAP4430_CM_DIV_M6_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0060)
164#define OMAP4430_CM_DIV_M7_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0064)
165#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0068)
166#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x006c)
167#define OMAP4430_CM_EMU_OVERRIDE_DPLL_PER OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0070)
168#define OMAP4430_CM_CLKMODE_DPLL_USB OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0080)
169#define OMAP4430_CM_IDLEST_DPLL_USB OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0084)
170#define OMAP4430_CM_AUTOIDLE_DPLL_USB OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0088)
171#define OMAP4430_CM_CLKSEL_DPLL_USB OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x008c)
172#define OMAP4430_CM_DIV_M2_DPLL_USB OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x0090)
173#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_USB OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00a8)
174#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_USB OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00ac)
175#define OMAP4430_CM_CLKDCOLDO_DPLL_USB OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00b4)
176#define OMAP4430_CM_CLKMODE_DPLL_UNIPRO OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00c0)
177#define OMAP4430_CM_IDLEST_DPLL_UNIPRO OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00c4)
178#define OMAP4430_CM_AUTOIDLE_DPLL_UNIPRO OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00c8)
179#define OMAP4430_CM_CLKSEL_DPLL_UNIPRO OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00cc)
180#define OMAP4430_CM_DIV_M2_DPLL_UNIPRO OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00d0)
181#define OMAP4430_CM_SSC_DELTAMSTEP_DPLL_UNIPRO OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00e8)
182#define OMAP4430_CM_SSC_MODFREQDIV_DPLL_UNIPRO OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CKGEN_MOD, 0x00ec)
183
184/* CM2.ALWAYS_ON_CM2 register offsets */
185#define OMAP4430_CM_ALWON_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_ALWAYS_ON_MOD, 0x0000)
186#define OMAP4430_CM_ALWON_MDMINTC_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_ALWAYS_ON_MOD, 0x0020)
187#define OMAP4430_CM_ALWON_SR_MPU_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_ALWAYS_ON_MOD, 0x0028)
188#define OMAP4430_CM_ALWON_SR_IVA_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_ALWAYS_ON_MOD, 0x0030)
189#define OMAP4430_CM_ALWON_SR_CORE_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_ALWAYS_ON_MOD, 0x0038)
190
191/* CM2.CORE_CM2 register offsets */
192#define OMAP4430_CM_L3_1_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0000)
193#define OMAP4430_CM_L3_1_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0008)
194#define OMAP4430_CM_L3_1_L3_1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0020)
195#define OMAP4430_CM_L3_2_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0100)
196#define OMAP4430_CM_L3_2_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0108)
197#define OMAP4430_CM_L3_2_L3_2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0120)
198#define OMAP4430_CM_L3_2_GPMC_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0128)
199#define OMAP4430_CM_L3_2_OCMC_RAM_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0130)
200#define OMAP4430_CM_DUCATI_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0200)
201#define OMAP4430_CM_DUCATI_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0204)
202#define OMAP4430_CM_DUCATI_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0208)
203#define OMAP4430_CM_DUCATI_DUCATI_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0220)
204#define OMAP4430_CM_SDMA_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0300)
205#define OMAP4430_CM_SDMA_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0304)
206#define OMAP4430_CM_SDMA_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0308)
207#define OMAP4430_CM_SDMA_SDMA_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0320)
208#define OMAP4430_CM_MEMIF_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0400)
209#define OMAP4430_CM_MEMIF_DMM_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0420)
210#define OMAP4430_CM_MEMIF_EMIF_FW_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0428)
211#define OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0430)
212#define OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0438)
213#define OMAP4430_CM_MEMIF_DLL_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0440)
214#define OMAP4430_CM_MEMIF_EMIF_H1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0450)
215#define OMAP4430_CM_MEMIF_EMIF_H2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0458)
216#define OMAP4430_CM_MEMIF_DLL_H_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0460)
217#define OMAP4430_CM_D2D_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0500)
218#define OMAP4430_CM_D2D_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0504)
219#define OMAP4430_CM_D2D_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0508)
220#define OMAP4430_CM_D2D_SAD2D_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0520)
221#define OMAP4430_CM_D2D_MODEM_ICR_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0528)
222#define OMAP4430_CM_D2D_SAD2D_FW_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0530)
223#define OMAP4430_CM_L4CFG_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0600)
224#define OMAP4430_CM_L4CFG_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0608)
225#define OMAP4430_CM_L4CFG_L4_CFG_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0620)
226#define OMAP4430_CM_L4CFG_HW_SEM_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0628)
227#define OMAP4430_CM_L4CFG_MAILBOX_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0630)
228#define OMAP4430_CM_L4CFG_SAR_ROM_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0638)
229#define OMAP4430_CM_L3INSTR_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0700)
230#define OMAP4430_CM_L3INSTR_L3_3_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0720)
231#define OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0728)
232#define OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CORE_MOD, 0x0740)
233
234/* CM2.IVAHD_CM2 register offsets */
235#define OMAP4430_CM_IVAHD_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_IVAHD_MOD, 0x0000)
236#define OMAP4430_CM_IVAHD_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_IVAHD_MOD, 0x0004)
237#define OMAP4430_CM_IVAHD_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_IVAHD_MOD, 0x0008)
238#define OMAP4430_CM_IVAHD_IVAHD_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_IVAHD_MOD, 0x0020)
239#define OMAP4430_CM_IVAHD_SL2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_IVAHD_MOD, 0x0028)
240
241/* CM2.CAM_CM2 register offsets */
242#define OMAP4430_CM_CAM_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CAM_MOD, 0x0000)
243#define OMAP4430_CM_CAM_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CAM_MOD, 0x0004)
244#define OMAP4430_CM_CAM_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CAM_MOD, 0x0008)
245#define OMAP4430_CM_CAM_ISS_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CAM_MOD, 0x0020)
246#define OMAP4430_CM_CAM_FDIF_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CAM_MOD, 0x0028)
247
248/* CM2.DSS_CM2 register offsets */
249#define OMAP4430_CM_DSS_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_DSS_MOD, 0x0000)
250#define OMAP4430_CM_DSS_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_DSS_MOD, 0x0004)
251#define OMAP4430_CM_DSS_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_DSS_MOD, 0x0008)
252#define OMAP4430_CM_DSS_DSS_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_DSS_MOD, 0x0020)
253#define OMAP4430_CM_DSS_DEISS_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_DSS_MOD, 0x0028)
254
255/* CM2.GFX_CM2 register offsets */
256#define OMAP4430_CM_GFX_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_GFX_MOD, 0x0000)
257#define OMAP4430_CM_GFX_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_GFX_MOD, 0x0004)
258#define OMAP4430_CM_GFX_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_GFX_MOD, 0x0008)
259#define OMAP4430_CM_GFX_GFX_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_GFX_MOD, 0x0020)
260
261/* CM2.L3INIT_CM2 register offsets */
262#define OMAP4430_CM_L3INIT_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0000)
263#define OMAP4430_CM_L3INIT_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0004)
264#define OMAP4430_CM_L3INIT_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0008)
265#define OMAP4430_CM_L3INIT_MMC1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0028)
266#define OMAP4430_CM_L3INIT_MMC2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0030)
267#define OMAP4430_CM_L3INIT_HSI_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0038)
268#define OMAP4430_CM_L3INIT_UNIPRO1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0040)
269#define OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0058)
270#define OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0060)
271#define OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0068)
272#define OMAP4430_CM_L3INIT_P1500_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0078)
273#define OMAP4430_CM_L3INIT_EMAC_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0080)
274#define OMAP4430_CM_L3INIT_SATA_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0088)
275#define OMAP4430_CM_L3INIT_TPPSS_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0090)
276#define OMAP4430_CM_L3INIT_PCIESS_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x0098)
277#define OMAP4430_CM_L3INIT_CCPTX_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x00a8)
278#define OMAP4430_CM_L3INIT_XHPI_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x00c0)
279#define OMAP4430_CM_L3INIT_MMC6_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x00c8)
280#define OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x00d0)
281#define OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L3INIT_MOD, 0x00e0)
282
283/* CM2.L4PER_CM2 register offsets */
284#define OMAP4430_CM_L4PER_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0000)
285#define OMAP4430_CM_L4PER_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0008)
286#define OMAP4430_CM_L4PER_ADC_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0020)
287#define OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0028)
288#define OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0030)
289#define OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0038)
290#define OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0040)
291#define OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0048)
292#define OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0050)
293#define OMAP4430_CM_L4PER_ELM_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0058)
294#define OMAP4430_CM_L4PER_GPIO2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0060)
295#define OMAP4430_CM_L4PER_GPIO3_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0068)
296#define OMAP4430_CM_L4PER_GPIO4_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0070)
297#define OMAP4430_CM_L4PER_GPIO5_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0078)
298#define OMAP4430_CM_L4PER_GPIO6_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0080)
299#define OMAP4430_CM_L4PER_HDQ1W_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0088)
300#define OMAP4430_CM_L4PER_HECC1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0090)
301#define OMAP4430_CM_L4PER_HECC2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0098)
302#define OMAP4430_CM_L4PER_I2C1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00a0)
303#define OMAP4430_CM_L4PER_I2C2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00a8)
304#define OMAP4430_CM_L4PER_I2C3_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00b0)
305#define OMAP4430_CM_L4PER_I2C4_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00b8)
306#define OMAP4430_CM_L4PER_L4PER_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00c0)
307#define OMAP4430_CM_L4PER_MCASP2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00d0)
308#define OMAP4430_CM_L4PER_MCASP3_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00d8)
309#define OMAP4430_CM_L4PER_MCBSP4_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00e0)
310#define OMAP4430_CM_L4PER_MGATE_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00e8)
311#define OMAP4430_CM_L4PER_MCSPI1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00f0)
312#define OMAP4430_CM_L4PER_MCSPI2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x00f8)
313#define OMAP4430_CM_L4PER_MCSPI3_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0100)
314#define OMAP4430_CM_L4PER_MCSPI4_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0108)
315#define OMAP4430_CM_L4PER_MMCSD3_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0120)
316#define OMAP4430_CM_L4PER_MMCSD4_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0128)
317#define OMAP4430_CM_L4PER_MSPROHG_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0130)
318#define OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0138)
319#define OMAP4430_CM_L4PER_UART1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0140)
320#define OMAP4430_CM_L4PER_UART2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0148)
321#define OMAP4430_CM_L4PER_UART3_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0150)
322#define OMAP4430_CM_L4PER_UART4_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0158)
323#define OMAP4430_CM_L4PER_MMCSD5_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0160)
324#define OMAP4430_CM_L4PER_I2C5_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0168)
325#define OMAP4430_CM_L4SEC_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0180)
326#define OMAP4430_CM_L4SEC_STATICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0184)
327#define OMAP4430_CM_L4SEC_DYNAMICDEP OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x0188)
328#define OMAP4430_CM_L4SEC_AES1_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x01a0)
329#define OMAP4430_CM_L4SEC_AES2_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x01a8)
330#define OMAP4430_CM_L4SEC_DES3DES_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x01b0)
331#define OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x01b8)
332#define OMAP4430_CM_L4SEC_RNG_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x01c0)
333#define OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x01c8)
334#define OMAP4430_CM_L4SEC_CRYPTODMA_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_L4PER_MOD, 0x01d8)
335
336/* CM2.CEFUSE_CM2 register offsets */
337#define OMAP4430_CM_CEFUSE_CLKSTCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CEFUSE_MOD, 0x0000)
338#define OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL OMAP44XX_CM2_REGADDR(OMAP4430_CM2_CEFUSE_MOD, 0x0020)
339
340/* CM2.RESTORE_CM2 register offsets */
341#define OMAP4430_CM_L3_1_CLKSTCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0000)
342#define OMAP4430_CM_L3_2_CLKSTCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0004)
343#define OMAP4430_CM_L4CFG_CLKSTCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0008)
344#define OMAP4430_CM_MEMIF_CLKSTCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x000c)
345#define OMAP4430_CM_L4PER_CLKSTCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0010)
346#define OMAP4430_CM_L3INIT_CLKSTCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0014)
347#define OMAP4430_CM_L3INSTR_L3_3_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0018)
348#define OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x001c)
349#define OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0020)
350#define OMAP4430_CM_L4PER_GPIO2_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0024)
351#define OMAP4430_CM_L4PER_GPIO3_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0028)
352#define OMAP4430_CM_L4PER_GPIO4_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x002c)
353#define OMAP4430_CM_L4PER_GPIO5_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0030)
354#define OMAP4430_CM_L4PER_GPIO6_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0034)
355#define OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0038)
356#define OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x003c)
357#define OMAP4430_CM_SDMA_STATICDEP_RESTORE OMAP44XX_CM2_REGADDR(OMAP4430_CM2_RESTORE_MOD, 0x0040)
358#endif
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 733d3dcff98b..18ad93160abb 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -27,6 +27,8 @@
27#include <mach/gpio.h> 27#include <mach/gpio.h>
28#include <plat/mmc.h> 28#include <plat/mmc.h>
29 29
30#include "mux.h"
31
30#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) 32#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
31 33
32static struct resource cam_resources[] = { 34static struct resource cam_resources[] = {
@@ -595,27 +597,40 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
595 597
596 if (cpu_is_omap34xx()) { 598 if (cpu_is_omap34xx()) {
597 if (controller_nr == 0) { 599 if (controller_nr == 0) {
598 omap_cfg_reg(N28_3430_MMC1_CLK); 600 omap_mux_init_signal("sdmmc1_clk",
599 omap_cfg_reg(M27_3430_MMC1_CMD); 601 OMAP_PIN_INPUT_PULLUP);
600 omap_cfg_reg(N27_3430_MMC1_DAT0); 602 omap_mux_init_signal("sdmmc1_cmd",
603 OMAP_PIN_INPUT_PULLUP);
604 omap_mux_init_signal("sdmmc1_dat0",
605 OMAP_PIN_INPUT_PULLUP);
601 if (mmc_controller->slots[0].wires == 4 || 606 if (mmc_controller->slots[0].wires == 4 ||
602 mmc_controller->slots[0].wires == 8) { 607 mmc_controller->slots[0].wires == 8) {
603 omap_cfg_reg(N26_3430_MMC1_DAT1); 608 omap_mux_init_signal("sdmmc1_dat1",
604 omap_cfg_reg(N25_3430_MMC1_DAT2); 609 OMAP_PIN_INPUT_PULLUP);
605 omap_cfg_reg(P28_3430_MMC1_DAT3); 610 omap_mux_init_signal("sdmmc1_dat2",
611 OMAP_PIN_INPUT_PULLUP);
612 omap_mux_init_signal("sdmmc1_dat3",
613 OMAP_PIN_INPUT_PULLUP);
606 } 614 }
607 if (mmc_controller->slots[0].wires == 8) { 615 if (mmc_controller->slots[0].wires == 8) {
608 omap_cfg_reg(P27_3430_MMC1_DAT4); 616 omap_mux_init_signal("sdmmc1_dat4",
609 omap_cfg_reg(P26_3430_MMC1_DAT5); 617 OMAP_PIN_INPUT_PULLUP);
610 omap_cfg_reg(R27_3430_MMC1_DAT6); 618 omap_mux_init_signal("sdmmc1_dat5",
611 omap_cfg_reg(R25_3430_MMC1_DAT7); 619 OMAP_PIN_INPUT_PULLUP);
620 omap_mux_init_signal("sdmmc1_dat6",
621 OMAP_PIN_INPUT_PULLUP);
622 omap_mux_init_signal("sdmmc1_dat7",
623 OMAP_PIN_INPUT_PULLUP);
612 } 624 }
613 } 625 }
614 if (controller_nr == 1) { 626 if (controller_nr == 1) {
615 /* MMC2 */ 627 /* MMC2 */
616 omap_cfg_reg(AE2_3430_MMC2_CLK); 628 omap_mux_init_signal("sdmmc2_clk",
617 omap_cfg_reg(AG5_3430_MMC2_CMD); 629 OMAP_PIN_INPUT_PULLUP);
618 omap_cfg_reg(AH5_3430_MMC2_DAT0); 630 omap_mux_init_signal("sdmmc2_cmd",
631 OMAP_PIN_INPUT_PULLUP);
632 omap_mux_init_signal("sdmmc2_dat0",
633 OMAP_PIN_INPUT_PULLUP);
619 634
620 /* 635 /*
621 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed 636 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
@@ -623,15 +638,22 @@ static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
623 */ 638 */
624 if (mmc_controller->slots[0].wires == 4 || 639 if (mmc_controller->slots[0].wires == 4 ||
625 mmc_controller->slots[0].wires == 8) { 640 mmc_controller->slots[0].wires == 8) {
626 omap_cfg_reg(AH4_3430_MMC2_DAT1); 641 omap_mux_init_signal("sdmmc2_dat1",
627 omap_cfg_reg(AG4_3430_MMC2_DAT2); 642 OMAP_PIN_INPUT_PULLUP);
628 omap_cfg_reg(AF4_3430_MMC2_DAT3); 643 omap_mux_init_signal("sdmmc2_dat2",
644 OMAP_PIN_INPUT_PULLUP);
645 omap_mux_init_signal("sdmmc2_dat3",
646 OMAP_PIN_INPUT_PULLUP);
629 } 647 }
630 if (mmc_controller->slots[0].wires == 8) { 648 if (mmc_controller->slots[0].wires == 8) {
631 omap_cfg_reg(AE4_3430_MMC2_DAT4); 649 omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
632 omap_cfg_reg(AH3_3430_MMC2_DAT5); 650 OMAP_PIN_INPUT_PULLUP);
633 omap_cfg_reg(AF3_3430_MMC2_DAT6); 651 omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
634 omap_cfg_reg(AE3_3430_MMC2_DAT7); 652 OMAP_PIN_INPUT_PULLUP);
653 omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
654 OMAP_PIN_INPUT_PULLUP);
655 omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
656 OMAP_PIN_INPUT_PULLUP);
635 } 657 }
636 } 658 }
637 659
diff --git a/arch/arm/mach-omap2/dpll.c b/arch/arm/mach-omap2/dpll.c
new file mode 100644
index 000000000000..f6055b493294
--- /dev/null
+++ b/arch/arm/mach-omap2/dpll.c
@@ -0,0 +1,538 @@
1/*
2 * OMAP3/4 - specific DPLL control functions
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * Testing and integration fixes by Jouni Högander
9 *
10 * Parts of this code are based on code written by
11 * Richard Woodruff, Tony Lindgren, Tuukka Tikkanen, Karthik Dasu
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/module.h>
19#include <linux/kernel.h>
20#include <linux/device.h>
21#include <linux/list.h>
22#include <linux/errno.h>
23#include <linux/delay.h>
24#include <linux/clk.h>
25#include <linux/io.h>
26#include <linux/limits.h>
27#include <linux/bitops.h>
28
29#include <plat/cpu.h>
30#include <plat/clock.h>
31#include <plat/sram.h>
32#include <asm/div64.h>
33#include <asm/clkdev.h>
34
35#include "clock.h"
36#include "prm.h"
37#include "prm-regbits-34xx.h"
38#include "cm.h"
39#include "cm-regbits-34xx.h"
40
41/* CM_AUTOIDLE_PLL*.AUTO_* bit values */
42#define DPLL_AUTOIDLE_DISABLE 0x0
43#define DPLL_AUTOIDLE_LOW_POWER_STOP 0x1
44
45#define MAX_DPLL_WAIT_TRIES 1000000
46
47
48/**
49 * omap3_dpll_recalc - recalculate DPLL rate
50 * @clk: DPLL struct clk
51 *
52 * Recalculate and propagate the DPLL rate.
53 */
54unsigned long omap3_dpll_recalc(struct clk *clk)
55{
56 return omap2_get_dpll_rate(clk);
57}
58
59/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
60static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
61{
62 const struct dpll_data *dd;
63 u32 v;
64
65 dd = clk->dpll_data;
66
67 v = __raw_readl(dd->control_reg);
68 v &= ~dd->enable_mask;
69 v |= clken_bits << __ffs(dd->enable_mask);
70 __raw_writel(v, dd->control_reg);
71}
72
73/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
74static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
75{
76 const struct dpll_data *dd;
77 int i = 0;
78 int ret = -EINVAL;
79
80 dd = clk->dpll_data;
81
82 state <<= __ffs(dd->idlest_mask);
83
84 while (((__raw_readl(dd->idlest_reg) & dd->idlest_mask) != state) &&
85 i < MAX_DPLL_WAIT_TRIES) {
86 i++;
87 udelay(1);
88 }
89
90 if (i == MAX_DPLL_WAIT_TRIES) {
91 printk(KERN_ERR "clock: %s failed transition to '%s'\n",
92 clk->name, (state) ? "locked" : "bypassed");
93 } else {
94 pr_debug("clock: %s transition to '%s' in %d loops\n",
95 clk->name, (state) ? "locked" : "bypassed", i);
96
97 ret = 0;
98 }
99
100 return ret;
101}
102
103/* From 3430 TRM ES2 4.7.6.2 */
104static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
105{
106 unsigned long fint;
107 u16 f = 0;
108
109 fint = clk->dpll_data->clk_ref->rate / n;
110
111 pr_debug("clock: fint is %lu\n", fint);
112
113 if (fint >= 750000 && fint <= 1000000)
114 f = 0x3;
115 else if (fint > 1000000 && fint <= 1250000)
116 f = 0x4;
117 else if (fint > 1250000 && fint <= 1500000)
118 f = 0x5;
119 else if (fint > 1500000 && fint <= 1750000)
120 f = 0x6;
121 else if (fint > 1750000 && fint <= 2100000)
122 f = 0x7;
123 else if (fint > 7500000 && fint <= 10000000)
124 f = 0xB;
125 else if (fint > 10000000 && fint <= 12500000)
126 f = 0xC;
127 else if (fint > 12500000 && fint <= 15000000)
128 f = 0xD;
129 else if (fint > 15000000 && fint <= 17500000)
130 f = 0xE;
131 else if (fint > 17500000 && fint <= 21000000)
132 f = 0xF;
133 else
134 pr_debug("clock: unknown freqsel setting for %d\n", n);
135
136 return f;
137}
138
139/* Non-CORE DPLL (e.g., DPLLs that do not control SDRC) clock functions */
140
141/*
142 * _omap3_noncore_dpll_lock - instruct a DPLL to lock and wait for readiness
143 * @clk: pointer to a DPLL struct clk
144 *
145 * Instructs a non-CORE DPLL to lock. Waits for the DPLL to report
146 * readiness before returning. Will save and restore the DPLL's
147 * autoidle state across the enable, per the CDP code. If the DPLL
148 * locked successfully, return 0; if the DPLL did not lock in the time
149 * allotted, or DPLL3 was passed in, return -EINVAL.
150 */
151static int _omap3_noncore_dpll_lock(struct clk *clk)
152{
153 u8 ai;
154 int r;
155
156 pr_debug("clock: locking DPLL %s\n", clk->name);
157
158 ai = omap3_dpll_autoidle_read(clk);
159
160 omap3_dpll_deny_idle(clk);
161
162 _omap3_dpll_write_clken(clk, DPLL_LOCKED);
163
164 r = _omap3_wait_dpll_status(clk, 1);
165
166 if (ai)
167 omap3_dpll_allow_idle(clk);
168
169 return r;
170}
171
172/*
173 * _omap3_noncore_dpll_bypass - instruct a DPLL to bypass and wait for readiness
174 * @clk: pointer to a DPLL struct clk
175 *
176 * Instructs a non-CORE DPLL to enter low-power bypass mode. In
177 * bypass mode, the DPLL's rate is set equal to its parent clock's
178 * rate. Waits for the DPLL to report readiness before returning.
179 * Will save and restore the DPLL's autoidle state across the enable,
180 * per the CDP code. If the DPLL entered bypass mode successfully,
181 * return 0; if the DPLL did not enter bypass in the time allotted, or
182 * DPLL3 was passed in, or the DPLL does not support low-power bypass,
183 * return -EINVAL.
184 */
185static int _omap3_noncore_dpll_bypass(struct clk *clk)
186{
187 int r;
188 u8 ai;
189
190 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS)))
191 return -EINVAL;
192
193 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
194 clk->name);
195
196 ai = omap3_dpll_autoidle_read(clk);
197
198 _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_BYPASS);
199
200 r = _omap3_wait_dpll_status(clk, 0);
201
202 if (ai)
203 omap3_dpll_allow_idle(clk);
204 else
205 omap3_dpll_deny_idle(clk);
206
207 return r;
208}
209
210/*
211 * _omap3_noncore_dpll_stop - instruct a DPLL to stop
212 * @clk: pointer to a DPLL struct clk
213 *
214 * Instructs a non-CORE DPLL to enter low-power stop. Will save and
215 * restore the DPLL's autoidle state across the stop, per the CDP
216 * code. If DPLL3 was passed in, or the DPLL does not support
217 * low-power stop, return -EINVAL; otherwise, return 0.
218 */
219static int _omap3_noncore_dpll_stop(struct clk *clk)
220{
221 u8 ai;
222
223 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
224 return -EINVAL;
225
226 pr_debug("clock: stopping DPLL %s\n", clk->name);
227
228 ai = omap3_dpll_autoidle_read(clk);
229
230 _omap3_dpll_write_clken(clk, DPLL_LOW_POWER_STOP);
231
232 if (ai)
233 omap3_dpll_allow_idle(clk);
234 else
235 omap3_dpll_deny_idle(clk);
236
237 return 0;
238}
239
240/**
241 * omap3_noncore_dpll_enable - instruct a DPLL to enter bypass or lock mode
242 * @clk: pointer to a DPLL struct clk
243 *
244 * Instructs a non-CORE DPLL to enable, e.g., to enter bypass or lock.
245 * The choice of modes depends on the DPLL's programmed rate: if it is
246 * the same as the DPLL's parent clock, it will enter bypass;
247 * otherwise, it will enter lock. This code will wait for the DPLL to
248 * indicate readiness before returning, unless the DPLL takes too long
249 * to enter the target state. Intended to be used as the struct clk's
250 * enable function. If DPLL3 was passed in, or the DPLL does not
251 * support low-power stop, or if the DPLL took too long to enter
252 * bypass or lock, return -EINVAL; otherwise, return 0.
253 */
254int omap3_noncore_dpll_enable(struct clk *clk)
255{
256 int r;
257 struct dpll_data *dd;
258
259 dd = clk->dpll_data;
260 if (!dd)
261 return -EINVAL;
262
263 if (clk->rate == dd->clk_bypass->rate) {
264 WARN_ON(clk->parent != dd->clk_bypass);
265 r = _omap3_noncore_dpll_bypass(clk);
266 } else {
267 WARN_ON(clk->parent != dd->clk_ref);
268 r = _omap3_noncore_dpll_lock(clk);
269 }
270 /*
271 *FIXME: this is dubious - if clk->rate has changed, what about
272 * propagating?
273 */
274 if (!r)
275 clk->rate = omap2_get_dpll_rate(clk);
276
277 return r;
278}
279
280/**
281 * omap3_noncore_dpll_disable - instruct a DPLL to enter low-power stop
282 * @clk: pointer to a DPLL struct clk
283 *
284 * Instructs a non-CORE DPLL to enter low-power stop. This function is
285 * intended for use in struct clkops. No return value.
286 */
287void omap3_noncore_dpll_disable(struct clk *clk)
288{
289 _omap3_noncore_dpll_stop(clk);
290}
291
292
293/* Non-CORE DPLL rate set code */
294
295/*
296 * omap3_noncore_dpll_program - set non-core DPLL M,N values directly
297 * @clk: struct clk * of DPLL to set
298 * @m: DPLL multiplier to set
299 * @n: DPLL divider to set
300 * @freqsel: FREQSEL value to set
301 *
302 * Program the DPLL with the supplied M, N values, and wait for the DPLL to
303 * lock.. Returns -EINVAL upon error, or 0 upon success.
304 */
305int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
306{
307 struct dpll_data *dd = clk->dpll_data;
308 u32 v;
309
310 /* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */
311 _omap3_noncore_dpll_bypass(clk);
312
313 /* Set jitter correction */
314 if (!cpu_is_omap44xx()) {
315 v = __raw_readl(dd->control_reg);
316 v &= ~dd->freqsel_mask;
317 v |= freqsel << __ffs(dd->freqsel_mask);
318 __raw_writel(v, dd->control_reg);
319 }
320
321 /* Set DPLL multiplier, divider */
322 v = __raw_readl(dd->mult_div1_reg);
323 v &= ~(dd->mult_mask | dd->div1_mask);
324 v |= m << __ffs(dd->mult_mask);
325 v |= (n - 1) << __ffs(dd->div1_mask);
326 __raw_writel(v, dd->mult_div1_reg);
327
328 /* We let the clock framework set the other output dividers later */
329
330 /* REVISIT: Set ramp-up delay? */
331
332 _omap3_noncore_dpll_lock(clk);
333
334 return 0;
335}
336
337/**
338 * omap3_noncore_dpll_set_rate - set non-core DPLL rate
339 * @clk: struct clk * of DPLL to set
340 * @rate: rounded target rate
341 *
342 * Set the DPLL CLKOUT to the target rate. If the DPLL can enter
343 * low-power bypass, and the target rate is the bypass source clock
344 * rate, then configure the DPLL for bypass. Otherwise, round the
345 * target rate if it hasn't been done already, then program and lock
346 * the DPLL. Returns -EINVAL upon error, or 0 upon success.
347 */
348int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
349{
350 struct clk *new_parent = NULL;
351 u16 freqsel = 0;
352 struct dpll_data *dd;
353 int ret;
354
355 if (!clk || !rate)
356 return -EINVAL;
357
358 dd = clk->dpll_data;
359 if (!dd)
360 return -EINVAL;
361
362 if (rate == omap2_get_dpll_rate(clk))
363 return 0;
364
365 /*
366 * Ensure both the bypass and ref clocks are enabled prior to
367 * doing anything; we need the bypass clock running to reprogram
368 * the DPLL.
369 */
370 omap2_clk_enable(dd->clk_bypass);
371 omap2_clk_enable(dd->clk_ref);
372
373 if (dd->clk_bypass->rate == rate &&
374 (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
375 pr_debug("clock: %s: set rate: entering bypass.\n", clk->name);
376
377 ret = _omap3_noncore_dpll_bypass(clk);
378 if (!ret)
379 new_parent = dd->clk_bypass;
380 } else {
381 if (dd->last_rounded_rate != rate)
382 omap2_dpll_round_rate(clk, rate);
383
384 if (dd->last_rounded_rate == 0)
385 return -EINVAL;
386
387 /* No freqsel on OMAP4 */
388 if (!cpu_is_omap44xx()) {
389 freqsel = _omap3_dpll_compute_freqsel(clk,
390 dd->last_rounded_n);
391 if (!freqsel)
392 WARN_ON(1);
393 }
394
395 pr_debug("clock: %s: set rate: locking rate to %lu.\n",
396 clk->name, rate);
397
398 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m,
399 dd->last_rounded_n, freqsel);
400 if (!ret)
401 new_parent = dd->clk_ref;
402 }
403 if (!ret) {
404 /*
405 * Switch the parent clock in the heirarchy, and make sure
406 * that the new parent's usecount is correct. Note: we
407 * enable the new parent before disabling the old to avoid
408 * any unnecessary hardware disable->enable transitions.
409 */
410 if (clk->usecount) {
411 omap2_clk_enable(new_parent);
412 omap2_clk_disable(clk->parent);
413 }
414 clk_reparent(clk, new_parent);
415 clk->rate = rate;
416 }
417 omap2_clk_disable(dd->clk_ref);
418 omap2_clk_disable(dd->clk_bypass);
419
420 return 0;
421}
422
423/* DPLL autoidle read/set code */
424
425/**
426 * omap3_dpll_autoidle_read - read a DPLL's autoidle bits
427 * @clk: struct clk * of the DPLL to read
428 *
429 * Return the DPLL's autoidle bits, shifted down to bit 0. Returns
430 * -EINVAL if passed a null pointer or if the struct clk does not
431 * appear to refer to a DPLL.
432 */
433u32 omap3_dpll_autoidle_read(struct clk *clk)
434{
435 const struct dpll_data *dd;
436 u32 v;
437
438 if (!clk || !clk->dpll_data)
439 return -EINVAL;
440
441 dd = clk->dpll_data;
442
443 v = __raw_readl(dd->autoidle_reg);
444 v &= dd->autoidle_mask;
445 v >>= __ffs(dd->autoidle_mask);
446
447 return v;
448}
449
450/**
451 * omap3_dpll_allow_idle - enable DPLL autoidle bits
452 * @clk: struct clk * of the DPLL to operate on
453 *
454 * Enable DPLL automatic idle control. This automatic idle mode
455 * switching takes effect only when the DPLL is locked, at least on
456 * OMAP3430. The DPLL will enter low-power stop when its downstream
457 * clocks are gated. No return value.
458 */
459void omap3_dpll_allow_idle(struct clk *clk)
460{
461 const struct dpll_data *dd;
462 u32 v;
463
464 if (!clk || !clk->dpll_data)
465 return;
466
467 dd = clk->dpll_data;
468
469 /*
470 * REVISIT: CORE DPLL can optionally enter low-power bypass
471 * by writing 0x5 instead of 0x1. Add some mechanism to
472 * optionally enter this mode.
473 */
474 v = __raw_readl(dd->autoidle_reg);
475 v &= ~dd->autoidle_mask;
476 v |= DPLL_AUTOIDLE_LOW_POWER_STOP << __ffs(dd->autoidle_mask);
477 __raw_writel(v, dd->autoidle_reg);
478}
479
480/**
481 * omap3_dpll_deny_idle - prevent DPLL from automatically idling
482 * @clk: struct clk * of the DPLL to operate on
483 *
484 * Disable DPLL automatic idle control. No return value.
485 */
486void omap3_dpll_deny_idle(struct clk *clk)
487{
488 const struct dpll_data *dd;
489 u32 v;
490
491 if (!clk || !clk->dpll_data)
492 return;
493
494 dd = clk->dpll_data;
495
496 v = __raw_readl(dd->autoidle_reg);
497 v &= ~dd->autoidle_mask;
498 v |= DPLL_AUTOIDLE_DISABLE << __ffs(dd->autoidle_mask);
499 __raw_writel(v, dd->autoidle_reg);
500
501}
502
503/* Clock control for DPLL outputs */
504
505/**
506 * omap3_clkoutx2_recalc - recalculate DPLL X2 output virtual clock rate
507 * @clk: DPLL output struct clk
508 *
509 * Using parent clock DPLL data, look up DPLL state. If locked, set our
510 * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
511 */
512unsigned long omap3_clkoutx2_recalc(struct clk *clk)
513{
514 const struct dpll_data *dd;
515 unsigned long rate;
516 u32 v;
517 struct clk *pclk;
518
519 /* Walk up the parents of clk, looking for a DPLL */
520 pclk = clk->parent;
521 while (pclk && !pclk->dpll_data)
522 pclk = pclk->parent;
523
524 /* clk does not have a DPLL as a parent? */
525 WARN_ON(!pclk);
526
527 dd = pclk->dpll_data;
528
529 WARN_ON(!dd->enable_mask);
530
531 v = __raw_readl(dd->control_reg) & dd->enable_mask;
532 v >>= __ffs(dd->enable_mask);
533 if (v != OMAP3XXX_EN_DPLL_LOCKED)
534 rate = clk->parent->rate;
535 else
536 rate = clk->parent->rate * 2;
537 return rate;
538}
diff --git a/arch/arm/mach-omap2/gpmc-smc91x.c b/arch/arm/mach-omap2/gpmc-smc91x.c
index 6083e21b3be6..877c6f5807b7 100644
--- a/arch/arm/mach-omap2/gpmc-smc91x.c
+++ b/arch/arm/mach-omap2/gpmc-smc91x.c
@@ -33,17 +33,19 @@ static struct resource gpmc_smc91x_resources[] = {
33}; 33};
34 34
35static struct smc91x_platdata gpmc_smc91x_info = { 35static struct smc91x_platdata gpmc_smc91x_info = {
36 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_IO_SHIFT_0, 36 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT | SMC91X_IO_SHIFT_0,
37 .leda = RPC_LED_100_10,
38 .ledb = RPC_LED_TX_RX,
37}; 39};
38 40
39static struct platform_device gpmc_smc91x_device = { 41static struct platform_device gpmc_smc91x_device = {
40 .name = "smc91x", 42 .name = "smc91x",
41 .id = -1, 43 .id = -1,
42 .num_resources = ARRAY_SIZE(gpmc_smc91x_resources),
43 .resource = gpmc_smc91x_resources,
44 .dev = { 44 .dev = {
45 .platform_data = &gpmc_smc91x_info, 45 .platform_data = &gpmc_smc91x_info,
46 }, 46 },
47 .num_resources = ARRAY_SIZE(gpmc_smc91x_resources),
48 .resource = gpmc_smc91x_resources,
47}; 49};
48 50
49/* 51/*
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index e86f5ca180ea..bd8cb5974726 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -517,7 +517,7 @@ void __init gpmc_init(void)
517 ck = "gpmc_fck"; 517 ck = "gpmc_fck";
518 l = OMAP34XX_GPMC_BASE; 518 l = OMAP34XX_GPMC_BASE;
519 } else if (cpu_is_omap44xx()) { 519 } else if (cpu_is_omap44xx()) {
520 ck = "gpmc_fck"; 520 ck = "gpmc_ck";
521 l = OMAP44XX_GPMC_BASE; 521 l = OMAP44XX_GPMC_BASE;
522 } 522 }
523 523
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
new file mode 100644
index 000000000000..789ca8c02f0c
--- /dev/null
+++ b/arch/arm/mach-omap2/i2c.c
@@ -0,0 +1,56 @@
1/*
2 * Helper module for board specific I2C bus registration
3 *
4 * Copyright (C) 2009 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <plat/cpu.h>
23#include <plat/i2c.h>
24#include <plat/mux.h>
25
26#include "mux.h"
27
28int __init omap_register_i2c_bus(int bus_id, u32 clkrate,
29 struct i2c_board_info const *info,
30 unsigned len)
31{
32 if (cpu_is_omap24xx()) {
33 const int omap24xx_pins[][2] = {
34 { M19_24XX_I2C1_SCL, L15_24XX_I2C1_SDA },
35 { J15_24XX_I2C2_SCL, H19_24XX_I2C2_SDA },
36 };
37 int scl, sda;
38
39 scl = omap24xx_pins[bus_id - 1][0];
40 sda = omap24xx_pins[bus_id - 1][1];
41 omap_cfg_reg(sda);
42 omap_cfg_reg(scl);
43 }
44
45 /* First I2C bus is not muxable */
46 if (cpu_is_omap34xx() && bus_id > 1) {
47 char mux_name[sizeof("i2c2_scl.i2c2_scl")];
48
49 sprintf(mux_name, "i2c%i_scl.i2c%i_scl", bus_id, bus_id);
50 omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
51 sprintf(mux_name, "i2c%i_sda.i2c%i_sda", bus_id, bus_id);
52 omap_mux_init_signal(mux_name, OMAP_PIN_INPUT);
53 }
54
55 return omap_plat_register_i2c_bus(bus_id, clkrate, info, len);
56}
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index f48a4b2654dd..a091b53657b9 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -246,6 +246,31 @@ void __init omap3_check_revision(void)
246 } 246 }
247} 247}
248 248
249void __init omap4_check_revision(void)
250{
251 u32 idcode;
252 u16 hawkeye;
253 u8 rev;
254 char *rev_name = "ES1.0";
255
256 /*
257 * The IC rev detection is done with hawkeye and rev.
258 * Note that rev does not map directly to defined processor
259 * revision numbers as ES1.0 uses value 0.
260 */
261 idcode = read_tap_reg(OMAP_TAP_IDCODE);
262 hawkeye = (idcode >> 12) & 0xffff;
263 rev = (idcode >> 28) & 0xff;
264
265 if ((hawkeye == 0xb852) && (rev == 0x0)) {
266 omap_revision = OMAP4430_REV_ES1_0;
267 pr_info("OMAP%04x %s\n", omap_rev() >> 16, rev_name);
268 return;
269 }
270
271 pr_err("Unknown OMAP4 CPU id\n");
272}
273
249#define OMAP3_SHOW_FEATURE(feat) \ 274#define OMAP3_SHOW_FEATURE(feat) \
250 if (omap3_has_ ##feat()) \ 275 if (omap3_has_ ##feat()) \
251 printk(#feat" "); 276 printk(#feat" ");
@@ -277,10 +302,10 @@ void __init omap3_cpuinfo(void)
277 } else if (omap3_has_iva() && omap3_has_sgx()) { 302 } else if (omap3_has_iva() && omap3_has_sgx()) {
278 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */ 303 /* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */
279 strcpy(cpu_name, "OMAP3430/3530"); 304 strcpy(cpu_name, "OMAP3430/3530");
280 } else if (omap3_has_sgx()) { 305 } else if (omap3_has_iva()) {
281 omap_revision = OMAP3525_REV(rev); 306 omap_revision = OMAP3525_REV(rev);
282 strcpy(cpu_name, "OMAP3525"); 307 strcpy(cpu_name, "OMAP3525");
283 } else if (omap3_has_iva()) { 308 } else if (omap3_has_sgx()) {
284 omap_revision = OMAP3515_REV(rev); 309 omap_revision = OMAP3515_REV(rev);
285 strcpy(cpu_name, "OMAP3515"); 310 strcpy(cpu_name, "OMAP3515");
286 } else { 311 } else {
@@ -336,7 +361,7 @@ void __init omap2_check_revision(void)
336 omap3_check_features(); 361 omap3_check_features();
337 omap3_cpuinfo(); 362 omap3_cpuinfo();
338 } else if (cpu_is_omap44xx()) { 363 } else if (cpu_is_omap44xx()) {
339 printk(KERN_INFO "FIXME: CPU revision = OMAP4430\n"); 364 omap4_check_revision();
340 return; 365 return;
341 } else { 366 } else {
342 pr_err("OMAP revision unknown, please fix!\n"); 367 pr_err("OMAP revision unknown, please fix!\n");
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 59d28b2fd8c5..a8749e8017b9 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -22,19 +22,20 @@
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/clk.h> 24#include <linux/clk.h>
25#include <linux/omapfb.h>
25 26
26#include <asm/tlb.h> 27#include <asm/tlb.h>
27 28
28#include <asm/mach/map.h> 29#include <asm/mach/map.h>
29 30
30#include <plat/mux.h> 31#include <plat/mux.h>
31#include <plat/omapfb.h>
32#include <plat/sram.h> 32#include <plat/sram.h>
33#include <plat/sdrc.h> 33#include <plat/sdrc.h>
34#include <plat/gpmc.h> 34#include <plat/gpmc.h>
35#include <plat/serial.h> 35#include <plat/serial.h>
36#include <plat/mux.h>
37#include <plat/vram.h>
36 38
37#ifndef CONFIG_ARCH_OMAP4 /* FIXME: Remove this once clkdev is ready */
38#include "clock.h" 39#include "clock.h"
39 40
40#include <plat/omap-pm.h> 41#include <plat/omap-pm.h>
@@ -43,7 +44,6 @@
43 44
44#include <plat/clockdomain.h> 45#include <plat/clockdomain.h>
45#include "clockdomains.h" 46#include "clockdomains.h"
46#endif
47#include <plat/omap_hwmod.h> 47#include <plat/omap_hwmod.h>
48#include "omap_hwmod_2420.h" 48#include "omap_hwmod_2420.h"
49#include "omap_hwmod_2430.h" 49#include "omap_hwmod_2430.h"
@@ -264,6 +264,7 @@ void __init omap2_map_common_io(void)
264 omap2_check_revision(); 264 omap2_check_revision();
265 omap_sram_init(); 265 omap_sram_init();
266 omapfb_reserve_sdram(); 266 omapfb_reserve_sdram();
267 omap_vram_reserve_sdram();
267} 268}
268 269
269/* 270/*
@@ -319,8 +320,8 @@ void __init omap2_init_common_hw(struct omap_sdrc_params *sdrc_cs0,
319 omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps); 320 omap_pm_if_early_init(mpu_opps, dsp_opps, l3_opps);
320 pwrdm_init(powerdomains_omap); 321 pwrdm_init(powerdomains_omap);
321 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps); 322 clkdm_init(clockdomains_omap, clkdm_pwrdm_autodeps);
322 omap2_clk_init();
323#endif 323#endif
324 omap2_clk_init();
324 omap_serial_early_init(); 325 omap_serial_early_init();
325#ifndef CONFIG_ARCH_OMAP4 326#ifndef CONFIG_ARCH_OMAP4
326 omap_hwmod_late_init(); 327 omap_hwmod_late_init();
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c
index c18a94eca641..e071b3fd1878 100644
--- a/arch/arm/mach-omap2/mux.c
+++ b/arch/arm/mach-omap2/mux.c
@@ -27,19 +27,52 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/spinlock.h> 29#include <linux/spinlock.h>
30#include <linux/list.h>
31#include <linux/ctype.h>
32#include <linux/debugfs.h>
33#include <linux/seq_file.h>
34#include <linux/uaccess.h>
30 35
31#include <asm/system.h> 36#include <asm/system.h>
32 37
33#include <plat/control.h> 38#include <plat/control.h>
34#include <plat/mux.h> 39#include <plat/mux.h>
35 40
36#ifdef CONFIG_OMAP_MUX 41#include "mux.h"
42
43#define OMAP_MUX_BASE_OFFSET 0x30 /* Offset from CTRL_BASE */
44#define OMAP_MUX_BASE_SZ 0x5ca
45
46struct omap_mux_entry {
47 struct omap_mux mux;
48 struct list_head node;
49};
50
51static unsigned long mux_phys;
52static void __iomem *mux_base;
53
54static inline u16 omap_mux_read(u16 reg)
55{
56 if (cpu_is_omap24xx())
57 return __raw_readb(mux_base + reg);
58 else
59 return __raw_readw(mux_base + reg);
60}
61
62static inline void omap_mux_write(u16 val, u16 reg)
63{
64 if (cpu_is_omap24xx())
65 __raw_writeb(val, mux_base + reg);
66 else
67 __raw_writew(val, mux_base + reg);
68}
69
70#if defined(CONFIG_ARCH_OMAP24XX) && defined(CONFIG_OMAP_MUX)
37 71
38static struct omap_mux_cfg arch_mux_cfg; 72static struct omap_mux_cfg arch_mux_cfg;
39 73
40/* NOTE: See mux.h for the enumeration */ 74/* NOTE: See mux.h for the enumeration */
41 75
42#ifdef CONFIG_ARCH_OMAP24XX
43static struct pin_config __initdata_or_module omap24xx_pins[] = { 76static struct pin_config __initdata_or_module omap24xx_pins[] = {
44/* 77/*
45 * description mux mux pull pull debug 78 * description mux mux pull pull debug
@@ -249,342 +282,14 @@ MUX_CFG_24XX("AF19_2430_GPIO_85", 0x0113, 3, 0, 0, 1)
249 282
250#define OMAP24XX_PINS_SZ ARRAY_SIZE(omap24xx_pins) 283#define OMAP24XX_PINS_SZ ARRAY_SIZE(omap24xx_pins)
251 284
252#else
253#define omap24xx_pins NULL
254#define OMAP24XX_PINS_SZ 0
255#endif /* CONFIG_ARCH_OMAP24XX */
256
257#ifdef CONFIG_ARCH_OMAP34XX
258static struct pin_config __initdata_or_module omap34xx_pins[] = {
259/*
260 * Name, reg-offset,
261 * mux-mode | [active-mode | off-mode]
262 */
263
264/* 34xx I2C */
265MUX_CFG_34XX("K21_34XX_I2C1_SCL", 0x1ba,
266 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
267MUX_CFG_34XX("J21_34XX_I2C1_SDA", 0x1bc,
268 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
269MUX_CFG_34XX("AF15_34XX_I2C2_SCL", 0x1be,
270 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
271MUX_CFG_34XX("AE15_34XX_I2C2_SDA", 0x1c0,
272 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
273MUX_CFG_34XX("AF14_34XX_I2C3_SCL", 0x1c2,
274 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
275MUX_CFG_34XX("AG14_34XX_I2C3_SDA", 0x1c4,
276 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
277MUX_CFG_34XX("AD26_34XX_I2C4_SCL", 0xa00,
278 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
279MUX_CFG_34XX("AE26_34XX_I2C4_SDA", 0xa02,
280 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
281
282/* PHY - HSUSB: 12-pin ULPI PHY: Port 1*/
283MUX_CFG_34XX("Y8_3430_USB1HS_PHY_CLK", 0x5da,
284 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_OUTPUT)
285MUX_CFG_34XX("Y9_3430_USB1HS_PHY_STP", 0x5d8,
286 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_OUTPUT)
287MUX_CFG_34XX("AA14_3430_USB1HS_PHY_DIR", 0x5ec,
288 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
289MUX_CFG_34XX("AA11_3430_USB1HS_PHY_NXT", 0x5ee,
290 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
291MUX_CFG_34XX("W13_3430_USB1HS_PHY_D0", 0x5dc,
292 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
293MUX_CFG_34XX("W12_3430_USB1HS_PHY_D1", 0x5de,
294 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
295MUX_CFG_34XX("W11_3430_USB1HS_PHY_D2", 0x5e0,
296 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
297MUX_CFG_34XX("Y11_3430_USB1HS_PHY_D3", 0x5ea,
298 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
299MUX_CFG_34XX("W9_3430_USB1HS_PHY_D4", 0x5e4,
300 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
301MUX_CFG_34XX("Y12_3430_USB1HS_PHY_D5", 0x5e6,
302 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
303MUX_CFG_34XX("W8_3430_USB1HS_PHY_D6", 0x5e8,
304 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
305MUX_CFG_34XX("Y13_3430_USB1HS_PHY_D7", 0x5e2,
306 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
307
308/* PHY - HSUSB: 12-pin ULPI PHY: Port 2*/
309MUX_CFG_34XX("AA8_3430_USB2HS_PHY_CLK", 0x5f0,
310 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_OUTPUT)
311MUX_CFG_34XX("AA10_3430_USB2HS_PHY_STP", 0x5f2,
312 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_OUTPUT)
313MUX_CFG_34XX("AA9_3430_USB2HS_PHY_DIR", 0x5f4,
314 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
315MUX_CFG_34XX("AB11_3430_USB2HS_PHY_NXT", 0x5f6,
316 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
317MUX_CFG_34XX("AB10_3430_USB2HS_PHY_D0", 0x5f8,
318 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
319MUX_CFG_34XX("AB9_3430_USB2HS_PHY_D1", 0x5fa,
320 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
321MUX_CFG_34XX("W3_3430_USB2HS_PHY_D2", 0x1d4,
322 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
323MUX_CFG_34XX("T4_3430_USB2HS_PHY_D3", 0x1de,
324 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
325MUX_CFG_34XX("T3_3430_USB2HS_PHY_D4", 0x1d8,
326 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
327MUX_CFG_34XX("R3_3430_USB2HS_PHY_D5", 0x1da,
328 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
329MUX_CFG_34XX("R4_3430_USB2HS_PHY_D6", 0x1dc,
330 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
331MUX_CFG_34XX("T2_3430_USB2HS_PHY_D7", 0x1d6,
332 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLDOWN)
333
334/* TLL - HSUSB: 12-pin TLL Port 1*/
335MUX_CFG_34XX("Y8_3430_USB1HS_TLL_CLK", 0x5da,
336 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
337MUX_CFG_34XX("Y9_3430_USB1HS_TLL_STP", 0x5d8,
338 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLUP)
339MUX_CFG_34XX("AA14_3430_USB1HS_TLL_DIR", 0x5ec,
340 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
341MUX_CFG_34XX("AA11_3430_USB1HS_TLL_NXT", 0x5ee,
342 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
343MUX_CFG_34XX("W13_3430_USB1HS_TLL_D0", 0x5dc,
344 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
345MUX_CFG_34XX("W12_3430_USB1HS_TLL_D1", 0x5de,
346 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
347MUX_CFG_34XX("W11_3430_USB1HS_TLL_D2", 0x5e0,
348 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
349MUX_CFG_34XX("Y11_3430_USB1HS_TLL_D3", 0x5ea,
350 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
351MUX_CFG_34XX("W9_3430_USB1HS_TLL_D4", 0x5e4,
352 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
353MUX_CFG_34XX("Y12_3430_USB1HS_TLL_D5", 0x5e6,
354 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
355MUX_CFG_34XX("W8_3430_USB1HS_TLL_D6", 0x5e8,
356 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
357MUX_CFG_34XX("Y13_3430_USB1HS_TLL_D7", 0x5e2,
358 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
359
360/* TLL - HSUSB: 12-pin TLL Port 2*/
361MUX_CFG_34XX("AA8_3430_USB2HS_TLL_CLK", 0x5f0,
362 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
363MUX_CFG_34XX("AA10_3430_USB2HS_TLL_STP", 0x5f2,
364 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLUP)
365MUX_CFG_34XX("AA9_3430_USB2HS_TLL_DIR", 0x5f4,
366 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
367MUX_CFG_34XX("AB11_3430_USB2HS_TLL_NXT", 0x5f6,
368 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
369MUX_CFG_34XX("AB10_3430_USB2HS_TLL_D0", 0x5f8,
370 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
371MUX_CFG_34XX("AB9_3430_USB2HS_TLL_D1", 0x5fa,
372 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
373MUX_CFG_34XX("W3_3430_USB2HS_TLL_D2", 0x1d4,
374 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLDOWN)
375MUX_CFG_34XX("T4_3430_USB2HS_TLL_D3", 0x1de,
376 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLDOWN)
377MUX_CFG_34XX("T3_3430_USB2HS_TLL_D4", 0x1d8,
378 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLDOWN)
379MUX_CFG_34XX("R3_3430_USB2HS_TLL_D5", 0x1da,
380 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLDOWN)
381MUX_CFG_34XX("R4_3430_USB2HS_TLL_D6", 0x1dc,
382 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLDOWN)
383MUX_CFG_34XX("T2_3430_USB2HS_TLL_D7", 0x1d6,
384 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLDOWN)
385
386/* TLL - HSUSB: 12-pin TLL Port 3*/
387MUX_CFG_34XX("AA6_3430_USB3HS_TLL_CLK", 0x180,
388 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
389MUX_CFG_34XX("AB3_3430_USB3HS_TLL_STP", 0x166,
390 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLUP)
391MUX_CFG_34XX("AA3_3430_USB3HS_TLL_DIR", 0x168,
392 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
393MUX_CFG_34XX("Y3_3430_USB3HS_TLL_NXT", 0x16a,
394 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
395MUX_CFG_34XX("AA5_3430_USB3HS_TLL_D0", 0x186,
396 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
397MUX_CFG_34XX("Y4_3430_USB3HS_TLL_D1", 0x184,
398 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
399MUX_CFG_34XX("Y5_3430_USB3HS_TLL_D2", 0x188,
400 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
401MUX_CFG_34XX("W5_3430_USB3HS_TLL_D3", 0x18a,
402 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
403MUX_CFG_34XX("AB12_3430_USB3HS_TLL_D4", 0x16c,
404 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
405MUX_CFG_34XX("AB13_3430_USB3HS_TLL_D5", 0x16e,
406 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
407MUX_CFG_34XX("AA13_3430_USB3HS_TLL_D6", 0x170,
408 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
409MUX_CFG_34XX("AA12_3430_USB3HS_TLL_D7", 0x172,
410 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
411
412/* PHY FSUSB: FS Serial for Port 1 (multiple PHY modes supported) */
413MUX_CFG_34XX("AF10_3430_USB1FS_PHY_MM1_RXDP", 0x5d8,
414 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
415MUX_CFG_34XX("AG9_3430_USB1FS_PHY_MM1_RXDM", 0x5ee,
416 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
417MUX_CFG_34XX("W13_3430_USB1FS_PHY_MM1_RXRCV", 0x5dc,
418 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
419MUX_CFG_34XX("W12_3430_USB1FS_PHY_MM1_TXSE0", 0x5de,
420 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
421MUX_CFG_34XX("W11_3430_USB1FS_PHY_MM1_TXDAT", 0x5e0,
422 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
423MUX_CFG_34XX("Y11_3430_USB1FS_PHY_MM1_TXEN_N", 0x5ea,
424 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_OUTPUT)
425
426/* PHY FSUSB: FS Serial for Port 2 (multiple PHY modes supported) */
427MUX_CFG_34XX("AF7_3430_USB2FS_PHY_MM2_RXDP", 0x5f2,
428 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
429MUX_CFG_34XX("AH7_3430_USB2FS_PHY_MM2_RXDM", 0x5f6,
430 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
431MUX_CFG_34XX("AB10_3430_USB2FS_PHY_MM2_RXRCV", 0x5f8,
432 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
433MUX_CFG_34XX("AB9_3430_USB2FS_PHY_MM2_TXSE0", 0x5fa,
434 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
435MUX_CFG_34XX("W3_3430_USB2FS_PHY_MM2_TXDAT", 0x1d4,
436 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_INPUT_PULLDOWN)
437MUX_CFG_34XX("T4_3430_USB2FS_PHY_MM2_TXEN_N", 0x1de,
438 OMAP34XX_MUX_MODE5 | OMAP34XX_PIN_OUTPUT)
439
440/* PHY FSUSB: FS Serial for Port 3 (multiple PHY modes supported) */
441MUX_CFG_34XX("AH3_3430_USB3FS_PHY_MM3_RXDP", 0x166,
442 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
443MUX_CFG_34XX("AE3_3430_USB3FS_PHY_MM3_RXDM", 0x16a,
444 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
445MUX_CFG_34XX("AD1_3430_USB3FS_PHY_MM3_RXRCV", 0x186,
446 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
447MUX_CFG_34XX("AE1_3430_USB3FS_PHY_MM3_TXSE0", 0x184,
448 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
449MUX_CFG_34XX("AD2_3430_USB3FS_PHY_MM3_TXDAT", 0x188,
450 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_INPUT_PULLDOWN)
451MUX_CFG_34XX("AC1_3430_USB3FS_PHY_MM3_TXEN_N", 0x18a,
452 OMAP34XX_MUX_MODE6 | OMAP34XX_PIN_OUTPUT)
453
454
455/* 34XX GPIO - bidirectional, unless the name has an "_OUT" suffix.
456 * (Always specify PIN_INPUT, except for names suffixed by "_OUT".)
457 * No internal pullup/pulldown without "_UP" or "_DOWN" suffix.
458 */
459MUX_CFG_34XX("AF26_34XX_GPIO0", 0x1e0,
460 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
461MUX_CFG_34XX("AF22_34XX_GPIO9", 0xa18,
462 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
463MUX_CFG_34XX("AG9_34XX_GPIO23", 0x5ee,
464 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
465MUX_CFG_34XX("AH8_34XX_GPIO29", 0x5fa,
466 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
467MUX_CFG_34XX("U8_34XX_GPIO54_OUT", 0x0b4,
468 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
469MUX_CFG_34XX("U8_34XX_GPIO54_DOWN", 0x0b4,
470 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLDOWN)
471MUX_CFG_34XX("L8_34XX_GPIO63", 0x0ce,
472 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
473MUX_CFG_34XX("G25_34XX_GPIO86_OUT", 0x0fc,
474 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
475MUX_CFG_34XX("AG4_34XX_GPIO134_OUT", 0x160,
476 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
477MUX_CFG_34XX("AF4_34XX_GPIO135_OUT", 0x162,
478 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
479MUX_CFG_34XX("AE4_34XX_GPIO136_OUT", 0x164,
480 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
481MUX_CFG_34XX("AF6_34XX_GPIO140_UP", 0x16c,
482 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
483MUX_CFG_34XX("AE6_34XX_GPIO141", 0x16e,
484 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
485MUX_CFG_34XX("AF5_34XX_GPIO142", 0x170,
486 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
487MUX_CFG_34XX("AE5_34XX_GPIO143", 0x172,
488 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
489MUX_CFG_34XX("H19_34XX_GPIO164_OUT", 0x19c,
490 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_OUTPUT)
491MUX_CFG_34XX("J25_34XX_GPIO170", 0x1c6,
492 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT)
493
494/* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
495MUX_CFG_34XX("H16_34XX_SDRC_CKE0", 0x262,
496 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
497MUX_CFG_34XX("H17_34XX_SDRC_CKE1", 0x264,
498 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_OUTPUT)
499
500/* MMC1 */
501MUX_CFG_34XX("N28_3430_MMC1_CLK", 0x144,
502 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
503MUX_CFG_34XX("M27_3430_MMC1_CMD", 0x146,
504 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
505MUX_CFG_34XX("N27_3430_MMC1_DAT0", 0x148,
506 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
507MUX_CFG_34XX("N26_3430_MMC1_DAT1", 0x14a,
508 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
509MUX_CFG_34XX("N25_3430_MMC1_DAT2", 0x14c,
510 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
511MUX_CFG_34XX("P28_3430_MMC1_DAT3", 0x14e,
512 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
513MUX_CFG_34XX("P27_3430_MMC1_DAT4", 0x150,
514 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
515MUX_CFG_34XX("P26_3430_MMC1_DAT5", 0x152,
516 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
517MUX_CFG_34XX("R27_3430_MMC1_DAT6", 0x154,
518 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
519MUX_CFG_34XX("R25_3430_MMC1_DAT7", 0x156,
520 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
521
522/* MMC2 */
523MUX_CFG_34XX("AE2_3430_MMC2_CLK", 0x158,
524 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
525MUX_CFG_34XX("AG5_3430_MMC2_CMD", 0x15A,
526 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
527MUX_CFG_34XX("AH5_3430_MMC2_DAT0", 0x15c,
528 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
529MUX_CFG_34XX("AH4_3430_MMC2_DAT1", 0x15e,
530 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
531MUX_CFG_34XX("AG4_3430_MMC2_DAT2", 0x160,
532 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
533MUX_CFG_34XX("AF4_3430_MMC2_DAT3", 0x162,
534 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
535MUX_CFG_34XX("AE4_3430_MMC2_DAT4", 0x164,
536 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
537MUX_CFG_34XX("AH3_3430_MMC2_DAT5", 0x166,
538 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
539MUX_CFG_34XX("AF3_3430_MMC2_DAT6", 0x168,
540 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
541MUX_CFG_34XX("AE3_3430_MMC2_DAT7", 0x16A,
542 OMAP34XX_MUX_MODE0 | OMAP34XX_PIN_INPUT_PULLUP)
543
544/* MMC3 */
545MUX_CFG_34XX("AF10_3430_MMC3_CLK", 0x5d8,
546 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLUP)
547MUX_CFG_34XX("AC3_3430_MMC3_CMD", 0x1d0,
548 OMAP34XX_MUX_MODE3 | OMAP34XX_PIN_INPUT_PULLUP)
549MUX_CFG_34XX("AE11_3430_MMC3_DAT0", 0x5e4,
550 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLUP)
551MUX_CFG_34XX("AH9_3430_MMC3_DAT1", 0x5e6,
552 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLUP)
553MUX_CFG_34XX("AF13_3430_MMC3_DAT2", 0x5e8,
554 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLUP)
555MUX_CFG_34XX("AF13_3430_MMC3_DAT3", 0x5e2,
556 OMAP34XX_MUX_MODE2 | OMAP34XX_PIN_INPUT_PULLUP)
557
558/* SYS_NIRQ T2 INT1 */
559MUX_CFG_34XX("AF26_34XX_SYS_NIRQ", 0x1E0,
560 OMAP3_WAKEUP_EN | OMAP34XX_PIN_INPUT_PULLUP |
561 OMAP34XX_MUX_MODE0)
562/* EHCI GPIO's on OMAP3EVM (Rev >= E) */
563MUX_CFG_34XX("AH14_34XX_GPIO21", 0x5ea,
564 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
565MUX_CFG_34XX("AF9_34XX_GPIO22", 0x5ec,
566 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
567MUX_CFG_34XX("U3_34XX_GPIO61", 0x0c8,
568 OMAP34XX_MUX_MODE4 | OMAP34XX_PIN_INPUT_PULLUP)
569};
570
571#define OMAP34XX_PINS_SZ ARRAY_SIZE(omap34xx_pins)
572
573#else
574#define omap34xx_pins NULL
575#define OMAP34XX_PINS_SZ 0
576#endif /* CONFIG_ARCH_OMAP34XX */
577
578#if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS) 285#if defined(CONFIG_OMAP_MUX_DEBUG) || defined(CONFIG_OMAP_MUX_WARNINGS)
286
579static void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u16 reg) 287static void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u16 reg)
580{ 288{
581 u16 orig; 289 u16 orig;
582 u8 warn = 0, debug = 0; 290 u8 warn = 0, debug = 0;
583 291
584 if (cpu_is_omap24xx()) 292 orig = omap_mux_read(cfg->mux_reg - OMAP_MUX_BASE_OFFSET);
585 orig = omap_ctrl_readb(cfg->mux_reg);
586 else
587 orig = omap_ctrl_readw(cfg->mux_reg);
588 293
589#ifdef CONFIG_OMAP_MUX_DEBUG 294#ifdef CONFIG_OMAP_MUX_DEBUG
590 debug = cfg->debug; 295 debug = cfg->debug;
@@ -600,7 +305,6 @@ static void __init_or_module omap2_cfg_debug(const struct pin_config *cfg, u16 r
600#define omap2_cfg_debug(x, y) do {} while (0) 305#define omap2_cfg_debug(x, y) do {} while (0)
601#endif 306#endif
602 307
603#ifdef CONFIG_ARCH_OMAP24XX
604static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg) 308static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)
605{ 309{
606 static DEFINE_SPINLOCK(mux_spin_lock); 310 static DEFINE_SPINLOCK(mux_spin_lock);
@@ -614,47 +318,692 @@ static int __init_or_module omap24xx_cfg_reg(const struct pin_config *cfg)
614 if (cfg->pu_pd_val) 318 if (cfg->pu_pd_val)
615 reg |= OMAP2_PULL_UP; 319 reg |= OMAP2_PULL_UP;
616 omap2_cfg_debug(cfg, reg); 320 omap2_cfg_debug(cfg, reg);
617 omap_ctrl_writeb(reg, cfg->mux_reg); 321 omap_mux_write(reg, cfg->mux_reg - OMAP_MUX_BASE_OFFSET);
618 spin_unlock_irqrestore(&mux_spin_lock, flags); 322 spin_unlock_irqrestore(&mux_spin_lock, flags);
619 323
620 return 0; 324 return 0;
621} 325}
326
327int __init omap2_mux_init(void)
328{
329 u32 mux_pbase;
330
331 if (cpu_is_omap2420())
332 mux_pbase = OMAP2420_CTRL_BASE + OMAP_MUX_BASE_OFFSET;
333 else if (cpu_is_omap2430())
334 mux_pbase = OMAP243X_CTRL_BASE + OMAP_MUX_BASE_OFFSET;
335 else
336 return -ENODEV;
337
338 mux_base = ioremap(mux_pbase, OMAP_MUX_BASE_SZ);
339 if (!mux_base) {
340 printk(KERN_ERR "mux: Could not ioremap\n");
341 return -ENODEV;
342 }
343
344 if (cpu_is_omap24xx()) {
345 arch_mux_cfg.pins = omap24xx_pins;
346 arch_mux_cfg.size = OMAP24XX_PINS_SZ;
347 arch_mux_cfg.cfg_reg = omap24xx_cfg_reg;
348
349 return omap_mux_register(&arch_mux_cfg);
350 }
351
352 return 0;
353}
354
622#else 355#else
623#define omap24xx_cfg_reg NULL 356int __init omap2_mux_init(void)
624#endif 357{
358 return 0;
359}
360#endif /* CONFIG_OMAP_MUX */
361
362/*----------------------------------------------------------------------------*/
625 363
626#ifdef CONFIG_ARCH_OMAP34XX 364#ifdef CONFIG_ARCH_OMAP34XX
627static int __init_or_module omap34xx_cfg_reg(const struct pin_config *cfg) 365static LIST_HEAD(muxmodes);
366static DEFINE_MUTEX(muxmode_mutex);
367
368#ifdef CONFIG_OMAP_MUX
369
370static char *omap_mux_options;
371
372int __init omap_mux_init_gpio(int gpio, int val)
628{ 373{
629 static DEFINE_SPINLOCK(mux_spin_lock); 374 struct omap_mux_entry *e;
630 unsigned long flags; 375 int found = 0;
631 u16 reg = 0; 376
377 if (!gpio)
378 return -EINVAL;
379
380 list_for_each_entry(e, &muxmodes, node) {
381 struct omap_mux *m = &e->mux;
382 if (gpio == m->gpio) {
383 u16 old_mode;
384 u16 mux_mode;
385
386 old_mode = omap_mux_read(m->reg_offset);
387 mux_mode = val & ~(OMAP_MUX_NR_MODES - 1);
388 mux_mode |= OMAP_MUX_MODE4;
389 printk(KERN_DEBUG "mux: Setting signal "
390 "%s.gpio%i 0x%04x -> 0x%04x\n",
391 m->muxnames[0], gpio, old_mode, mux_mode);
392 omap_mux_write(mux_mode, m->reg_offset);
393 found++;
394 }
395 }
632 396
633 spin_lock_irqsave(&mux_spin_lock, flags); 397 if (found == 1)
634 reg |= cfg->mux_val; 398 return 0;
635 omap2_cfg_debug(cfg, reg); 399
636 omap_ctrl_writew(reg, cfg->mux_reg); 400 if (found > 1) {
637 spin_unlock_irqrestore(&mux_spin_lock, flags); 401 printk(KERN_ERR "mux: Multiple gpio paths for gpio%i\n", gpio);
402 return -EINVAL;
403 }
404
405 printk(KERN_ERR "mux: Could not set gpio%i\n", gpio);
406
407 return -ENODEV;
408}
409
410int __init omap_mux_init_signal(char *muxname, int val)
411{
412 struct omap_mux_entry *e;
413 char *m0_name = NULL, *mode_name = NULL;
414 int found = 0;
415
416 mode_name = strchr(muxname, '.');
417 if (mode_name) {
418 *mode_name = '\0';
419 mode_name++;
420 m0_name = muxname;
421 } else {
422 mode_name = muxname;
423 }
424
425 list_for_each_entry(e, &muxmodes, node) {
426 struct omap_mux *m = &e->mux;
427 char *m0_entry = m->muxnames[0];
428 int i;
429
430 if (m0_name && strcmp(m0_name, m0_entry))
431 continue;
432
433 for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
434 char *mode_cur = m->muxnames[i];
435
436 if (!mode_cur)
437 continue;
438
439 if (!strcmp(mode_name, mode_cur)) {
440 u16 old_mode;
441 u16 mux_mode;
442
443 old_mode = omap_mux_read(m->reg_offset);
444 mux_mode = val | i;
445 printk(KERN_DEBUG "mux: Setting signal "
446 "%s.%s 0x%04x -> 0x%04x\n",
447 m0_entry, muxname, old_mode, mux_mode);
448 omap_mux_write(mux_mode, m->reg_offset);
449 found++;
450 }
451 }
452 }
453
454 if (found == 1)
455 return 0;
456
457 if (found > 1) {
458 printk(KERN_ERR "mux: Multiple signal paths (%i) for %s\n",
459 found, muxname);
460 return -EINVAL;
461 }
462
463 printk(KERN_ERR "mux: Could not set signal %s\n", muxname);
464
465 return -ENODEV;
466}
467
468#ifdef CONFIG_DEBUG_FS
469
470#define OMAP_MUX_MAX_NR_FLAGS 10
471#define OMAP_MUX_TEST_FLAG(val, mask) \
472 if (((val) & (mask)) == (mask)) { \
473 i++; \
474 flags[i] = #mask; \
475 }
476
477/* REVISIT: Add checking for non-optimal mux settings */
478static inline void omap_mux_decode(struct seq_file *s, u16 val)
479{
480 char *flags[OMAP_MUX_MAX_NR_FLAGS];
481 char mode[14];
482 int i = -1;
483
484 sprintf(mode, "OMAP_MUX_MODE%d", val & 0x7);
485 i++;
486 flags[i] = mode;
487
488 OMAP_MUX_TEST_FLAG(val, OMAP_PIN_OFF_WAKEUPENABLE);
489 if (val & OMAP_OFF_EN) {
490 if (!(val & OMAP_OFFOUT_EN)) {
491 if (!(val & OMAP_OFF_PULL_UP)) {
492 OMAP_MUX_TEST_FLAG(val,
493 OMAP_PIN_OFF_INPUT_PULLDOWN);
494 } else {
495 OMAP_MUX_TEST_FLAG(val,
496 OMAP_PIN_OFF_INPUT_PULLUP);
497 }
498 } else {
499 if (!(val & OMAP_OFFOUT_VAL)) {
500 OMAP_MUX_TEST_FLAG(val,
501 OMAP_PIN_OFF_OUTPUT_LOW);
502 } else {
503 OMAP_MUX_TEST_FLAG(val,
504 OMAP_PIN_OFF_OUTPUT_HIGH);
505 }
506 }
507 }
508
509 if (val & OMAP_INPUT_EN) {
510 if (val & OMAP_PULL_ENA) {
511 if (!(val & OMAP_PULL_UP)) {
512 OMAP_MUX_TEST_FLAG(val,
513 OMAP_PIN_INPUT_PULLDOWN);
514 } else {
515 OMAP_MUX_TEST_FLAG(val, OMAP_PIN_INPUT_PULLUP);
516 }
517 } else {
518 OMAP_MUX_TEST_FLAG(val, OMAP_PIN_INPUT);
519 }
520 } else {
521 i++;
522 flags[i] = "OMAP_PIN_OUTPUT";
523 }
524
525 do {
526 seq_printf(s, "%s", flags[i]);
527 if (i > 0)
528 seq_printf(s, " | ");
529 } while (i-- > 0);
530}
531
532#define OMAP_MUX_DEFNAME_LEN 16
533
534static int omap_mux_dbg_board_show(struct seq_file *s, void *unused)
535{
536 struct omap_mux_entry *e;
537
538 list_for_each_entry(e, &muxmodes, node) {
539 struct omap_mux *m = &e->mux;
540 char m0_def[OMAP_MUX_DEFNAME_LEN];
541 char *m0_name = m->muxnames[0];
542 u16 val;
543 int i, mode;
544
545 if (!m0_name)
546 continue;
547
548 for (i = 0; i < OMAP_MUX_DEFNAME_LEN; i++) {
549 if (m0_name[i] == '\0') {
550 m0_def[i] = m0_name[i];
551 break;
552 }
553 m0_def[i] = toupper(m0_name[i]);
554 }
555 val = omap_mux_read(m->reg_offset);
556 mode = val & OMAP_MUX_MODE7;
557
558 seq_printf(s, "OMAP%i_MUX(%s, ",
559 cpu_is_omap34xx() ? 3 : 0, m0_def);
560 omap_mux_decode(s, val);
561 seq_printf(s, "),\n");
562 }
563
564 return 0;
565}
566
567static int omap_mux_dbg_board_open(struct inode *inode, struct file *file)
568{
569 return single_open(file, omap_mux_dbg_board_show, &inode->i_private);
570}
571
572static const struct file_operations omap_mux_dbg_board_fops = {
573 .open = omap_mux_dbg_board_open,
574 .read = seq_read,
575 .llseek = seq_lseek,
576 .release = single_release,
577};
578
579static int omap_mux_dbg_signal_show(struct seq_file *s, void *unused)
580{
581 struct omap_mux *m = s->private;
582 const char *none = "NA";
583 u16 val;
584 int mode;
585
586 val = omap_mux_read(m->reg_offset);
587 mode = val & OMAP_MUX_MODE7;
588
589 seq_printf(s, "name: %s.%s (0x%08lx/0x%03x = 0x%04x), b %s, t %s\n",
590 m->muxnames[0], m->muxnames[mode],
591 mux_phys + m->reg_offset, m->reg_offset, val,
592 m->balls[0] ? m->balls[0] : none,
593 m->balls[1] ? m->balls[1] : none);
594 seq_printf(s, "mode: ");
595 omap_mux_decode(s, val);
596 seq_printf(s, "\n");
597 seq_printf(s, "signals: %s | %s | %s | %s | %s | %s | %s | %s\n",
598 m->muxnames[0] ? m->muxnames[0] : none,
599 m->muxnames[1] ? m->muxnames[1] : none,
600 m->muxnames[2] ? m->muxnames[2] : none,
601 m->muxnames[3] ? m->muxnames[3] : none,
602 m->muxnames[4] ? m->muxnames[4] : none,
603 m->muxnames[5] ? m->muxnames[5] : none,
604 m->muxnames[6] ? m->muxnames[6] : none,
605 m->muxnames[7] ? m->muxnames[7] : none);
638 606
639 return 0; 607 return 0;
640} 608}
609
610#define OMAP_MUX_MAX_ARG_CHAR 7
611
612static ssize_t omap_mux_dbg_signal_write(struct file *file,
613 const char __user *user_buf,
614 size_t count, loff_t *ppos)
615{
616 char buf[OMAP_MUX_MAX_ARG_CHAR];
617 struct seq_file *seqf;
618 struct omap_mux *m;
619 unsigned long val;
620 int buf_size, ret;
621
622 if (count > OMAP_MUX_MAX_ARG_CHAR)
623 return -EINVAL;
624
625 memset(buf, 0, sizeof(buf));
626 buf_size = min(count, sizeof(buf) - 1);
627
628 if (copy_from_user(buf, user_buf, buf_size))
629 return -EFAULT;
630
631 ret = strict_strtoul(buf, 0x10, &val);
632 if (ret < 0)
633 return ret;
634
635 if (val > 0xffff)
636 return -EINVAL;
637
638 seqf = file->private_data;
639 m = seqf->private;
640
641 omap_mux_write((u16)val, m->reg_offset);
642 *ppos += count;
643
644 return count;
645}
646
647static int omap_mux_dbg_signal_open(struct inode *inode, struct file *file)
648{
649 return single_open(file, omap_mux_dbg_signal_show, inode->i_private);
650}
651
652static const struct file_operations omap_mux_dbg_signal_fops = {
653 .open = omap_mux_dbg_signal_open,
654 .read = seq_read,
655 .write = omap_mux_dbg_signal_write,
656 .llseek = seq_lseek,
657 .release = single_release,
658};
659
660static struct dentry *mux_dbg_dir;
661
662static void __init omap_mux_dbg_init(void)
663{
664 struct omap_mux_entry *e;
665
666 mux_dbg_dir = debugfs_create_dir("omap_mux", NULL);
667 if (!mux_dbg_dir)
668 return;
669
670 (void)debugfs_create_file("board", S_IRUGO, mux_dbg_dir,
671 NULL, &omap_mux_dbg_board_fops);
672
673 list_for_each_entry(e, &muxmodes, node) {
674 struct omap_mux *m = &e->mux;
675
676 (void)debugfs_create_file(m->muxnames[0], S_IWUGO, mux_dbg_dir,
677 m, &omap_mux_dbg_signal_fops);
678 }
679}
680
641#else 681#else
642#define omap34xx_cfg_reg NULL 682static inline void omap_mux_dbg_init(void)
683{
684}
685#endif /* CONFIG_DEBUG_FS */
686
687static void __init omap_mux_free_names(struct omap_mux *m)
688{
689 int i;
690
691 for (i = 0; i < OMAP_MUX_NR_MODES; i++)
692 kfree(m->muxnames[i]);
693
694#ifdef CONFIG_DEBUG_FS
695 for (i = 0; i < OMAP_MUX_NR_SIDES; i++)
696 kfree(m->balls[i]);
643#endif 697#endif
644 698
645int __init omap2_mux_init(void) 699}
700
701/* Free all data except for GPIO pins unless CONFIG_DEBUG_FS is set */
702static int __init omap_mux_late_init(void)
646{ 703{
647 if (cpu_is_omap24xx()) { 704 struct omap_mux_entry *e, *tmp;
648 arch_mux_cfg.pins = omap24xx_pins; 705
649 arch_mux_cfg.size = OMAP24XX_PINS_SZ; 706 list_for_each_entry_safe(e, tmp, &muxmodes, node) {
650 arch_mux_cfg.cfg_reg = omap24xx_cfg_reg; 707 struct omap_mux *m = &e->mux;
651 } else if (cpu_is_omap34xx()) { 708 u16 mode = omap_mux_read(m->reg_offset);
652 arch_mux_cfg.pins = omap34xx_pins; 709
653 arch_mux_cfg.size = OMAP34XX_PINS_SZ; 710 if (OMAP_MODE_GPIO(mode))
654 arch_mux_cfg.cfg_reg = omap34xx_cfg_reg; 711 continue;
712
713#ifndef CONFIG_DEBUG_FS
714 mutex_lock(&muxmode_mutex);
715 list_del(&e->node);
716 mutex_unlock(&muxmode_mutex);
717 omap_mux_free_names(m);
718 kfree(m);
719#endif
720
721 }
722
723 omap_mux_dbg_init();
724
725 return 0;
726}
727late_initcall(omap_mux_late_init);
728
729static void __init omap_mux_package_fixup(struct omap_mux *p,
730 struct omap_mux *superset)
731{
732 while (p->reg_offset != OMAP_MUX_TERMINATOR) {
733 struct omap_mux *s = superset;
734 int found = 0;
735
736 while (s->reg_offset != OMAP_MUX_TERMINATOR) {
737 if (s->reg_offset == p->reg_offset) {
738 *s = *p;
739 found++;
740 break;
741 }
742 s++;
743 }
744 if (!found)
745 printk(KERN_ERR "mux: Unknown entry offset 0x%x\n",
746 p->reg_offset);
747 p++;
748 }
749}
750
751#ifdef CONFIG_DEBUG_FS
752
753static void __init omap_mux_package_init_balls(struct omap_ball *b,
754 struct omap_mux *superset)
755{
756 while (b->reg_offset != OMAP_MUX_TERMINATOR) {
757 struct omap_mux *s = superset;
758 int found = 0;
759
760 while (s->reg_offset != OMAP_MUX_TERMINATOR) {
761 if (s->reg_offset == b->reg_offset) {
762 s->balls[0] = b->balls[0];
763 s->balls[1] = b->balls[1];
764 found++;
765 break;
766 }
767 s++;
768 }
769 if (!found)
770 printk(KERN_ERR "mux: Unknown ball offset 0x%x\n",
771 b->reg_offset);
772 b++;
773 }
774}
775
776#else /* CONFIG_DEBUG_FS */
777
778static inline void omap_mux_package_init_balls(struct omap_ball *b,
779 struct omap_mux *superset)
780{
781}
782
783#endif /* CONFIG_DEBUG_FS */
784
785static int __init omap_mux_setup(char *options)
786{
787 if (!options)
788 return 0;
789
790 omap_mux_options = options;
791
792 return 1;
793}
794__setup("omap_mux=", omap_mux_setup);
795
796/*
797 * Note that the omap_mux=some.signal1=0x1234,some.signal2=0x1234
798 * cmdline options only override the bootloader values.
799 * During development, please enable CONFIG_DEBUG_FS, and use the
800 * signal specific entries under debugfs.
801 */
802static void __init omap_mux_set_cmdline_signals(void)
803{
804 char *options, *next_opt, *token;
805
806 if (!omap_mux_options)
807 return;
808
809 options = kmalloc(strlen(omap_mux_options) + 1, GFP_KERNEL);
810 if (!options)
811 return;
812
813 strcpy(options, omap_mux_options);
814 next_opt = options;
815
816 while ((token = strsep(&next_opt, ",")) != NULL) {
817 char *keyval, *name;
818 unsigned long val;
819
820 keyval = token;
821 name = strsep(&keyval, "=");
822 if (name) {
823 int res;
824
825 res = strict_strtoul(keyval, 0x10, &val);
826 if (res < 0)
827 continue;
828
829 omap_mux_init_signal(name, (u16)val);
830 }
831 }
832
833 kfree(options);
834}
835
836static void __init omap_mux_set_board_signals(struct omap_board_mux *board_mux)
837{
838 while (board_mux->reg_offset != OMAP_MUX_TERMINATOR) {
839 omap_mux_write(board_mux->value, board_mux->reg_offset);
840 board_mux++;
841 }
842}
843
844static int __init omap_mux_copy_names(struct omap_mux *src,
845 struct omap_mux *dst)
846{
847 int i;
848
849 for (i = 0; i < OMAP_MUX_NR_MODES; i++) {
850 if (src->muxnames[i]) {
851 dst->muxnames[i] =
852 kmalloc(strlen(src->muxnames[i]) + 1,
853 GFP_KERNEL);
854 if (!dst->muxnames[i])
855 goto free;
856 strcpy(dst->muxnames[i], src->muxnames[i]);
857 }
858 }
859
860#ifdef CONFIG_DEBUG_FS
861 for (i = 0; i < OMAP_MUX_NR_SIDES; i++) {
862 if (src->balls[i]) {
863 dst->balls[i] =
864 kmalloc(strlen(src->balls[i]) + 1,
865 GFP_KERNEL);
866 if (!dst->balls[i])
867 goto free;
868 strcpy(dst->balls[i], src->balls[i]);
869 }
870 }
871#endif
872
873 return 0;
874
875free:
876 omap_mux_free_names(dst);
877 return -ENOMEM;
878
879}
880
881#endif /* CONFIG_OMAP_MUX */
882
883static u16 omap_mux_get_by_gpio(int gpio)
884{
885 struct omap_mux_entry *e;
886 u16 offset = OMAP_MUX_TERMINATOR;
887
888 list_for_each_entry(e, &muxmodes, node) {
889 struct omap_mux *m = &e->mux;
890 if (m->gpio == gpio) {
891 offset = m->reg_offset;
892 break;
893 }
894 }
895
896 return offset;
897}
898
899/* Needed for dynamic muxing of GPIO pins for off-idle */
900u16 omap_mux_get_gpio(int gpio)
901{
902 u16 offset;
903
904 offset = omap_mux_get_by_gpio(gpio);
905 if (offset == OMAP_MUX_TERMINATOR) {
906 printk(KERN_ERR "mux: Could not get gpio%i\n", gpio);
907 return offset;
908 }
909
910 return omap_mux_read(offset);
911}
912
913/* Needed for dynamic muxing of GPIO pins for off-idle */
914void omap_mux_set_gpio(u16 val, int gpio)
915{
916 u16 offset;
917
918 offset = omap_mux_get_by_gpio(gpio);
919 if (offset == OMAP_MUX_TERMINATOR) {
920 printk(KERN_ERR "mux: Could not set gpio%i\n", gpio);
921 return;
922 }
923
924 omap_mux_write(val, offset);
925}
926
927static struct omap_mux * __init omap_mux_list_add(struct omap_mux *src)
928{
929 struct omap_mux_entry *entry;
930 struct omap_mux *m;
931
932 entry = kzalloc(sizeof(struct omap_mux_entry), GFP_KERNEL);
933 if (!entry)
934 return NULL;
935
936 m = &entry->mux;
937 memcpy(m, src, sizeof(struct omap_mux_entry));
938
939#ifdef CONFIG_OMAP_MUX
940 if (omap_mux_copy_names(src, m)) {
941 kfree(entry);
942 return NULL;
655 } 943 }
944#endif
945
946 mutex_lock(&muxmode_mutex);
947 list_add_tail(&entry->node, &muxmodes);
948 mutex_unlock(&muxmode_mutex);
656 949
657 return omap_mux_register(&arch_mux_cfg); 950 return m;
658} 951}
659 952
953/*
954 * Note if CONFIG_OMAP_MUX is not selected, we will only initialize
955 * the GPIO to mux offset mapping that is needed for dynamic muxing
956 * of GPIO pins for off-idle.
957 */
958static void __init omap_mux_init_list(struct omap_mux *superset)
959{
960 while (superset->reg_offset != OMAP_MUX_TERMINATOR) {
961 struct omap_mux *entry;
962
963#ifndef CONFIG_OMAP_MUX
964 /* Skip pins that are not muxed as GPIO by bootloader */
965 if (!OMAP_MODE_GPIO(omap_mux_read(superset->reg_offset))) {
966 superset++;
967 continue;
968 }
660#endif 969#endif
970
971 entry = omap_mux_list_add(superset);
972 if (!entry) {
973 printk(KERN_ERR "mux: Could not add entry\n");
974 return;
975 }
976 superset++;
977 }
978}
979
980int __init omap_mux_init(u32 mux_pbase, u32 mux_size,
981 struct omap_mux *superset,
982 struct omap_mux *package_subset,
983 struct omap_board_mux *board_mux,
984 struct omap_ball *package_balls)
985{
986 if (mux_base)
987 return -EBUSY;
988
989 mux_phys = mux_pbase;
990 mux_base = ioremap(mux_pbase, mux_size);
991 if (!mux_base) {
992 printk(KERN_ERR "mux: Could not ioremap\n");
993 return -ENODEV;
994 }
995
996#ifdef CONFIG_OMAP_MUX
997 omap_mux_package_fixup(package_subset, superset);
998 omap_mux_package_init_balls(package_balls, superset);
999 omap_mux_set_cmdline_signals();
1000 omap_mux_set_board_signals(board_mux);
1001#endif
1002
1003 omap_mux_init_list(superset);
1004
1005 return 0;
1006}
1007
1008#endif /* CONFIG_ARCH_OMAP34XX */
1009
diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
new file mode 100644
index 000000000000..d8b4d5ad2278
--- /dev/null
+++ b/arch/arm/mach-omap2/mux.h
@@ -0,0 +1,163 @@
1/*
2 * Copyright (C) 2009 Nokia
3 * Copyright (C) 2009 Texas Instruments
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include "mux34xx.h"
11
12#define OMAP_MUX_TERMINATOR 0xffff
13
14/* 34xx mux mode options for each pin. See TRM for options */
15#define OMAP_MUX_MODE0 0
16#define OMAP_MUX_MODE1 1
17#define OMAP_MUX_MODE2 2
18#define OMAP_MUX_MODE3 3
19#define OMAP_MUX_MODE4 4
20#define OMAP_MUX_MODE5 5
21#define OMAP_MUX_MODE6 6
22#define OMAP_MUX_MODE7 7
23
24/* 24xx/34xx mux bit defines */
25#define OMAP_PULL_ENA (1 << 3)
26#define OMAP_PULL_UP (1 << 4)
27#define OMAP_ALTELECTRICALSEL (1 << 5)
28
29/* 34xx specific mux bit defines */
30#define OMAP_INPUT_EN (1 << 8)
31#define OMAP_OFF_EN (1 << 9)
32#define OMAP_OFFOUT_EN (1 << 10)
33#define OMAP_OFFOUT_VAL (1 << 11)
34#define OMAP_OFF_PULL_EN (1 << 12)
35#define OMAP_OFF_PULL_UP (1 << 13)
36#define OMAP_WAKEUP_EN (1 << 14)
37
38/* Active pin states */
39#define OMAP_PIN_OUTPUT 0
40#define OMAP_PIN_INPUT OMAP_INPUT_EN
41#define OMAP_PIN_INPUT_PULLUP (OMAP_PULL_ENA | OMAP_INPUT_EN \
42 | OMAP_PULL_UP)
43#define OMAP_PIN_INPUT_PULLDOWN (OMAP_PULL_ENA | OMAP_INPUT_EN)
44
45/* Off mode states */
46#define OMAP_PIN_OFF_NONE 0
47#define OMAP_PIN_OFF_OUTPUT_HIGH (OMAP_OFF_EN | OMAP_OFFOUT_EN \
48 | OMAP_OFFOUT_VAL)
49#define OMAP_PIN_OFF_OUTPUT_LOW (OMAP_OFF_EN | OMAP_OFFOUT_EN)
50#define OMAP_PIN_OFF_INPUT_PULLUP (OMAP_OFF_EN | OMAP_OFF_PULL_EN \
51 | OMAP_OFF_PULL_UP)
52#define OMAP_PIN_OFF_INPUT_PULLDOWN (OMAP_OFF_EN | OMAP_OFF_PULL_EN)
53#define OMAP_PIN_OFF_WAKEUPENABLE OMAP_WAKEUP_EN
54
55#define OMAP_MODE_GPIO(x) (((x) & OMAP_MUX_MODE7) == OMAP_MUX_MODE4)
56
57/* Flags for omap_mux_init */
58#define OMAP_PACKAGE_MASK 0xffff
59#define OMAP_PACKAGE_CBP 4 /* 515-pin 0.40 0.50 */
60#define OMAP_PACKAGE_CUS 3 /* 423-pin 0.65 */
61#define OMAP_PACKAGE_CBB 2 /* 515-pin 0.40 0.50 */
62#define OMAP_PACKAGE_CBC 1 /* 515-pin 0.50 0.65 */
63
64
65#define OMAP_MUX_NR_MODES 8 /* Available modes */
66#define OMAP_MUX_NR_SIDES 2 /* Bottom & top */
67
68/**
69 * struct omap_mux - data for omap mux register offset and it's value
70 * @reg_offset: mux register offset from the mux base
71 * @gpio: GPIO number
72 * @muxnames: available signal modes for a ball
73 */
74struct omap_mux {
75 u16 reg_offset;
76 u16 gpio;
77#ifdef CONFIG_OMAP_MUX
78 char *muxnames[OMAP_MUX_NR_MODES];
79#ifdef CONFIG_DEBUG_FS
80 char *balls[OMAP_MUX_NR_SIDES];
81#endif
82#endif
83};
84
85/**
86 * struct omap_ball - data for balls on omap package
87 * @reg_offset: mux register offset from the mux base
88 * @balls: available balls on the package
89 */
90struct omap_ball {
91 u16 reg_offset;
92 char *balls[OMAP_MUX_NR_SIDES];
93};
94
95/**
96 * struct omap_board_mux - data for initializing mux registers
97 * @reg_offset: mux register offset from the mux base
98 * @mux_value: desired mux value to set
99 */
100struct omap_board_mux {
101 u16 reg_offset;
102 u16 value;
103};
104
105#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_ARCH_OMAP34XX)
106
107/**
108 * omap_mux_init_gpio - initialize a signal based on the GPIO number
109 * @gpio: GPIO number
110 * @val: Options for the mux register value
111 */
112int omap_mux_init_gpio(int gpio, int val);
113
114/**
115 * omap_mux_init_signal - initialize a signal based on the signal name
116 * @muxname: Mux name in mode0_name.signal_name format
117 * @val: Options for the mux register value
118 */
119int omap_mux_init_signal(char *muxname, int val);
120
121#else
122
123static inline int omap_mux_init_gpio(int gpio, int val)
124{
125 return 0;
126}
127static inline int omap_mux_init_signal(char *muxname, int val)
128{
129 return 0;
130}
131
132#endif
133
134/**
135 * omap_mux_get_gpio() - get mux register value based on GPIO number
136 * @gpio: GPIO number
137 *
138 */
139u16 omap_mux_get_gpio(int gpio);
140
141/**
142 * omap_mux_set_gpio() - set mux register value based on GPIO number
143 * @val: New mux register value
144 * @gpio: GPIO number
145 *
146 */
147void omap_mux_set_gpio(u16 val, int gpio);
148
149/**
150 * omap3_mux_init() - initialize mux system with board specific set
151 * @board_mux: Board specific mux table
152 * @flags: OMAP package type used for the board
153 */
154int omap3_mux_init(struct omap_board_mux *board_mux, int flags);
155
156/**
157 * omap_mux_init - private mux init function, do not call
158 */
159int omap_mux_init(u32 mux_pbase, u32 mux_size,
160 struct omap_mux *superset,
161 struct omap_mux *package_subset,
162 struct omap_board_mux *board_mux,
163 struct omap_ball *package_balls);
diff --git a/arch/arm/mach-omap2/mux34xx.c b/arch/arm/mach-omap2/mux34xx.c
new file mode 100644
index 000000000000..68e0a595f9a1
--- /dev/null
+++ b/arch/arm/mach-omap2/mux34xx.c
@@ -0,0 +1,2099 @@
1/*
2 * Copyright (C) 2009 Nokia
3 * Copyright (C) 2009 Texas Instruments
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/module.h>
11#include <linux/init.h>
12
13#include "mux.h"
14
15#ifdef CONFIG_OMAP_MUX
16
17#define _OMAP3_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
18{ \
19 .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \
20 .gpio = (g), \
21 .muxnames = { m0, m1, m2, m3, m4, m5, m6, m7 }, \
22}
23
24#else
25
26#define _OMAP3_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7) \
27{ \
28 .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \
29 .gpio = (g), \
30}
31
32#endif
33
34#define _OMAP3_BALLENTRY(M0, bb, bt) \
35{ \
36 .reg_offset = (OMAP3_CONTROL_PADCONF_##M0##_OFFSET), \
37 .balls = { bb, bt }, \
38}
39
40/*
41 * Superset of all mux modes for omap3
42 */
43static struct omap_mux __initdata omap3_muxmodes[] = {
44 _OMAP3_MUXENTRY(CAM_D0, 99,
45 "cam_d0", NULL, NULL, NULL,
46 "gpio_99", NULL, NULL, "safe_mode"),
47 _OMAP3_MUXENTRY(CAM_D1, 100,
48 "cam_d1", NULL, NULL, NULL,
49 "gpio_100", NULL, NULL, "safe_mode"),
50 _OMAP3_MUXENTRY(CAM_D10, 109,
51 "cam_d10", NULL, NULL, NULL,
52 "gpio_109", "hw_dbg8", NULL, "safe_mode"),
53 _OMAP3_MUXENTRY(CAM_D11, 110,
54 "cam_d11", NULL, NULL, NULL,
55 "gpio_110", "hw_dbg9", NULL, "safe_mode"),
56 _OMAP3_MUXENTRY(CAM_D2, 101,
57 "cam_d2", NULL, NULL, NULL,
58 "gpio_101", "hw_dbg4", NULL, "safe_mode"),
59 _OMAP3_MUXENTRY(CAM_D3, 102,
60 "cam_d3", NULL, NULL, NULL,
61 "gpio_102", "hw_dbg5", NULL, "safe_mode"),
62 _OMAP3_MUXENTRY(CAM_D4, 103,
63 "cam_d4", NULL, NULL, NULL,
64 "gpio_103", "hw_dbg6", NULL, "safe_mode"),
65 _OMAP3_MUXENTRY(CAM_D5, 104,
66 "cam_d5", NULL, NULL, NULL,
67 "gpio_104", "hw_dbg7", NULL, "safe_mode"),
68 _OMAP3_MUXENTRY(CAM_D6, 105,
69 "cam_d6", NULL, NULL, NULL,
70 "gpio_105", NULL, NULL, "safe_mode"),
71 _OMAP3_MUXENTRY(CAM_D7, 106,
72 "cam_d7", NULL, NULL, NULL,
73 "gpio_106", NULL, NULL, "safe_mode"),
74 _OMAP3_MUXENTRY(CAM_D8, 107,
75 "cam_d8", NULL, NULL, NULL,
76 "gpio_107", NULL, NULL, "safe_mode"),
77 _OMAP3_MUXENTRY(CAM_D9, 108,
78 "cam_d9", NULL, NULL, NULL,
79 "gpio_108", NULL, NULL, "safe_mode"),
80 _OMAP3_MUXENTRY(CAM_FLD, 98,
81 "cam_fld", NULL, "cam_global_reset", NULL,
82 "gpio_98", "hw_dbg3", NULL, "safe_mode"),
83 _OMAP3_MUXENTRY(CAM_HS, 94,
84 "cam_hs", NULL, NULL, NULL,
85 "gpio_94", "hw_dbg0", NULL, "safe_mode"),
86 _OMAP3_MUXENTRY(CAM_PCLK, 97,
87 "cam_pclk", NULL, NULL, NULL,
88 "gpio_97", "hw_dbg2", NULL, "safe_mode"),
89 _OMAP3_MUXENTRY(CAM_STROBE, 126,
90 "cam_strobe", NULL, NULL, NULL,
91 "gpio_126", "hw_dbg11", NULL, "safe_mode"),
92 _OMAP3_MUXENTRY(CAM_VS, 95,
93 "cam_vs", NULL, NULL, NULL,
94 "gpio_95", "hw_dbg1", NULL, "safe_mode"),
95 _OMAP3_MUXENTRY(CAM_WEN, 167,
96 "cam_wen", NULL, "cam_shutter", NULL,
97 "gpio_167", "hw_dbg10", NULL, "safe_mode"),
98 _OMAP3_MUXENTRY(CAM_XCLKA, 96,
99 "cam_xclka", NULL, NULL, NULL,
100 "gpio_96", NULL, NULL, "safe_mode"),
101 _OMAP3_MUXENTRY(CAM_XCLKB, 111,
102 "cam_xclkb", NULL, NULL, NULL,
103 "gpio_111", NULL, NULL, "safe_mode"),
104 _OMAP3_MUXENTRY(CSI2_DX0, 112,
105 "csi2_dx0", NULL, NULL, NULL,
106 "gpio_112", NULL, NULL, "safe_mode"),
107 _OMAP3_MUXENTRY(CSI2_DX1, 114,
108 "csi2_dx1", NULL, NULL, NULL,
109 "gpio_114", NULL, NULL, "safe_mode"),
110 _OMAP3_MUXENTRY(CSI2_DY0, 113,
111 "csi2_dy0", NULL, NULL, NULL,
112 "gpio_113", NULL, NULL, "safe_mode"),
113 _OMAP3_MUXENTRY(CSI2_DY1, 115,
114 "csi2_dy1", NULL, NULL, NULL,
115 "gpio_115", NULL, NULL, "safe_mode"),
116 _OMAP3_MUXENTRY(DSS_ACBIAS, 69,
117 "dss_acbias", NULL, NULL, NULL,
118 "gpio_69", NULL, NULL, "safe_mode"),
119 _OMAP3_MUXENTRY(DSS_DATA0, 70,
120 "dss_data0", NULL, "uart1_cts", NULL,
121 "gpio_70", NULL, NULL, "safe_mode"),
122 _OMAP3_MUXENTRY(DSS_DATA1, 71,
123 "dss_data1", NULL, "uart1_rts", NULL,
124 "gpio_71", NULL, NULL, "safe_mode"),
125 _OMAP3_MUXENTRY(DSS_DATA10, 80,
126 "dss_data10", NULL, NULL, NULL,
127 "gpio_80", NULL, NULL, "safe_mode"),
128 _OMAP3_MUXENTRY(DSS_DATA11, 81,
129 "dss_data11", NULL, NULL, NULL,
130 "gpio_81", NULL, NULL, "safe_mode"),
131 _OMAP3_MUXENTRY(DSS_DATA12, 82,
132 "dss_data12", NULL, NULL, NULL,
133 "gpio_82", NULL, NULL, "safe_mode"),
134 _OMAP3_MUXENTRY(DSS_DATA13, 83,
135 "dss_data13", NULL, NULL, NULL,
136 "gpio_83", NULL, NULL, "safe_mode"),
137 _OMAP3_MUXENTRY(DSS_DATA14, 84,
138 "dss_data14", NULL, NULL, NULL,
139 "gpio_84", NULL, NULL, "safe_mode"),
140 _OMAP3_MUXENTRY(DSS_DATA15, 85,
141 "dss_data15", NULL, NULL, NULL,
142 "gpio_85", NULL, NULL, "safe_mode"),
143 _OMAP3_MUXENTRY(DSS_DATA16, 86,
144 "dss_data16", NULL, NULL, NULL,
145 "gpio_86", NULL, NULL, "safe_mode"),
146 _OMAP3_MUXENTRY(DSS_DATA17, 87,
147 "dss_data17", NULL, NULL, NULL,
148 "gpio_87", NULL, NULL, "safe_mode"),
149 _OMAP3_MUXENTRY(DSS_DATA18, 88,
150 "dss_data18", NULL, "mcspi3_clk", "dss_data0",
151 "gpio_88", NULL, NULL, "safe_mode"),
152 _OMAP3_MUXENTRY(DSS_DATA19, 89,
153 "dss_data19", NULL, "mcspi3_simo", "dss_data1",
154 "gpio_89", NULL, NULL, "safe_mode"),
155 _OMAP3_MUXENTRY(DSS_DATA20, 90,
156 "dss_data20", NULL, "mcspi3_somi", "dss_data2",
157 "gpio_90", NULL, NULL, "safe_mode"),
158 _OMAP3_MUXENTRY(DSS_DATA21, 91,
159 "dss_data21", NULL, "mcspi3_cs0", "dss_data3",
160 "gpio_91", NULL, NULL, "safe_mode"),
161 _OMAP3_MUXENTRY(DSS_DATA22, 92,
162 "dss_data22", NULL, "mcspi3_cs1", "dss_data4",
163 "gpio_92", NULL, NULL, "safe_mode"),
164 _OMAP3_MUXENTRY(DSS_DATA23, 93,
165 "dss_data23", NULL, NULL, "dss_data5",
166 "gpio_93", NULL, NULL, "safe_mode"),
167 _OMAP3_MUXENTRY(DSS_DATA2, 72,
168 "dss_data2", NULL, NULL, NULL,
169 "gpio_72", NULL, NULL, "safe_mode"),
170 _OMAP3_MUXENTRY(DSS_DATA3, 73,
171 "dss_data3", NULL, NULL, NULL,
172 "gpio_73", NULL, NULL, "safe_mode"),
173 _OMAP3_MUXENTRY(DSS_DATA4, 74,
174 "dss_data4", NULL, "uart3_rx_irrx", NULL,
175 "gpio_74", NULL, NULL, "safe_mode"),
176 _OMAP3_MUXENTRY(DSS_DATA5, 75,
177 "dss_data5", NULL, "uart3_tx_irtx", NULL,
178 "gpio_75", NULL, NULL, "safe_mode"),
179 _OMAP3_MUXENTRY(DSS_DATA6, 76,
180 "dss_data6", NULL, "uart1_tx", NULL,
181 "gpio_76", "hw_dbg14", NULL, "safe_mode"),
182 _OMAP3_MUXENTRY(DSS_DATA7, 77,
183 "dss_data7", NULL, "uart1_rx", NULL,
184 "gpio_77", "hw_dbg15", NULL, "safe_mode"),
185 _OMAP3_MUXENTRY(DSS_DATA8, 78,
186 "dss_data8", NULL, NULL, NULL,
187 "gpio_78", "hw_dbg16", NULL, "safe_mode"),
188 _OMAP3_MUXENTRY(DSS_DATA9, 79,
189 "dss_data9", NULL, NULL, NULL,
190 "gpio_79", "hw_dbg17", NULL, "safe_mode"),
191 _OMAP3_MUXENTRY(DSS_HSYNC, 67,
192 "dss_hsync", NULL, NULL, NULL,
193 "gpio_67", "hw_dbg13", NULL, "safe_mode"),
194 _OMAP3_MUXENTRY(DSS_PCLK, 66,
195 "dss_pclk", NULL, NULL, NULL,
196 "gpio_66", "hw_dbg12", NULL, "safe_mode"),
197 _OMAP3_MUXENTRY(DSS_VSYNC, 68,
198 "dss_vsync", NULL, NULL, NULL,
199 "gpio_68", NULL, NULL, "safe_mode"),
200 _OMAP3_MUXENTRY(ETK_CLK, 12,
201 "etk_clk", "mcbsp5_clkx", "sdmmc3_clk", "hsusb1_stp",
202 "gpio_12", "mm1_rxdp", "hsusb1_tll_stp", "hw_dbg0"),
203 _OMAP3_MUXENTRY(ETK_CTL, 13,
204 "etk_ctl", NULL, "sdmmc3_cmd", "hsusb1_clk",
205 "gpio_13", NULL, "hsusb1_tll_clk", "hw_dbg1"),
206 _OMAP3_MUXENTRY(ETK_D0, 14,
207 "etk_d0", "mcspi3_simo", "sdmmc3_dat4", "hsusb1_data0",
208 "gpio_14", "mm1_rxrcv", "hsusb1_tll_data0", "hw_dbg2"),
209 _OMAP3_MUXENTRY(ETK_D1, 15,
210 "etk_d1", "mcspi3_somi", NULL, "hsusb1_data1",
211 "gpio_15", "mm1_txse0", "hsusb1_tll_data1", "hw_dbg3"),
212 _OMAP3_MUXENTRY(ETK_D10, 24,
213 "etk_d10", NULL, "uart1_rx", "hsusb2_clk",
214 "gpio_24", NULL, "hsusb2_tll_clk", "hw_dbg12"),
215 _OMAP3_MUXENTRY(ETK_D11, 25,
216 "etk_d11", NULL, NULL, "hsusb2_stp",
217 "gpio_25", "mm2_rxdp", "hsusb2_tll_stp", "hw_dbg13"),
218 _OMAP3_MUXENTRY(ETK_D12, 26,
219 "etk_d12", NULL, NULL, "hsusb2_dir",
220 "gpio_26", NULL, "hsusb2_tll_dir", "hw_dbg14"),
221 _OMAP3_MUXENTRY(ETK_D13, 27,
222 "etk_d13", NULL, NULL, "hsusb2_nxt",
223 "gpio_27", "mm2_rxdm", "hsusb2_tll_nxt", "hw_dbg15"),
224 _OMAP3_MUXENTRY(ETK_D14, 28,
225 "etk_d14", NULL, NULL, "hsusb2_data0",
226 "gpio_28", "mm2_rxrcv", "hsusb2_tll_data0", "hw_dbg16"),
227 _OMAP3_MUXENTRY(ETK_D15, 29,
228 "etk_d15", NULL, NULL, "hsusb2_data1",
229 "gpio_29", "mm2_txse0", "hsusb2_tll_data1", "hw_dbg17"),
230 _OMAP3_MUXENTRY(ETK_D2, 16,
231 "etk_d2", "mcspi3_cs0", NULL, "hsusb1_data2",
232 "gpio_16", "mm1_txdat", "hsusb1_tll_data2", "hw_dbg4"),
233 _OMAP3_MUXENTRY(ETK_D3, 17,
234 "etk_d3", "mcspi3_clk", "sdmmc3_dat3", "hsusb1_data7",
235 "gpio_17", NULL, "hsusb1_tll_data7", "hw_dbg5"),
236 _OMAP3_MUXENTRY(ETK_D4, 18,
237 "etk_d4", "mcbsp5_dr", "sdmmc3_dat0", "hsusb1_data4",
238 "gpio_18", NULL, "hsusb1_tll_data4", "hw_dbg6"),
239 _OMAP3_MUXENTRY(ETK_D5, 19,
240 "etk_d5", "mcbsp5_fsx", "sdmmc3_dat1", "hsusb1_data5",
241 "gpio_19", NULL, "hsusb1_tll_data5", "hw_dbg7"),
242 _OMAP3_MUXENTRY(ETK_D6, 20,
243 "etk_d6", "mcbsp5_dx", "sdmmc3_dat2", "hsusb1_data6",
244 "gpio_20", NULL, "hsusb1_tll_data6", "hw_dbg8"),
245 _OMAP3_MUXENTRY(ETK_D7, 21,
246 "etk_d7", "mcspi3_cs1", "sdmmc3_dat7", "hsusb1_data3",
247 "gpio_21", "mm1_txen_n", "hsusb1_tll_data3", "hw_dbg9"),
248 _OMAP3_MUXENTRY(ETK_D8, 22,
249 "etk_d8", "sys_drm_msecure", "sdmmc3_dat6", "hsusb1_dir",
250 "gpio_22", NULL, "hsusb1_tll_dir", "hw_dbg10"),
251 _OMAP3_MUXENTRY(ETK_D9, 23,
252 "etk_d9", "sys_secure_indicator", "sdmmc3_dat5", "hsusb1_nxt",
253 "gpio_23", "mm1_rxdm", "hsusb1_tll_nxt", "hw_dbg11"),
254 _OMAP3_MUXENTRY(GPMC_A1, 34,
255 "gpmc_a1", NULL, NULL, NULL,
256 "gpio_34", NULL, NULL, "safe_mode"),
257 _OMAP3_MUXENTRY(GPMC_A10, 43,
258 "gpmc_a10", "sys_ndmareq3", NULL, NULL,
259 "gpio_43", NULL, NULL, "safe_mode"),
260 _OMAP3_MUXENTRY(GPMC_A2, 35,
261 "gpmc_a2", NULL, NULL, NULL,
262 "gpio_35", NULL, NULL, "safe_mode"),
263 _OMAP3_MUXENTRY(GPMC_A3, 36,
264 "gpmc_a3", NULL, NULL, NULL,
265 "gpio_36", NULL, NULL, "safe_mode"),
266 _OMAP3_MUXENTRY(GPMC_A4, 37,
267 "gpmc_a4", NULL, NULL, NULL,
268 "gpio_37", NULL, NULL, "safe_mode"),
269 _OMAP3_MUXENTRY(GPMC_A5, 38,
270 "gpmc_a5", NULL, NULL, NULL,
271 "gpio_38", NULL, NULL, "safe_mode"),
272 _OMAP3_MUXENTRY(GPMC_A6, 39,
273 "gpmc_a6", NULL, NULL, NULL,
274 "gpio_39", NULL, NULL, "safe_mode"),
275 _OMAP3_MUXENTRY(GPMC_A7, 40,
276 "gpmc_a7", NULL, NULL, NULL,
277 "gpio_40", NULL, NULL, "safe_mode"),
278 _OMAP3_MUXENTRY(GPMC_A8, 41,
279 "gpmc_a8", NULL, NULL, NULL,
280 "gpio_41", NULL, NULL, "safe_mode"),
281 _OMAP3_MUXENTRY(GPMC_A9, 42,
282 "gpmc_a9", "sys_ndmareq2", NULL, NULL,
283 "gpio_42", NULL, NULL, "safe_mode"),
284 _OMAP3_MUXENTRY(GPMC_CLK, 59,
285 "gpmc_clk", NULL, NULL, NULL,
286 "gpio_59", NULL, NULL, "safe_mode"),
287 _OMAP3_MUXENTRY(GPMC_D10, 46,
288 "gpmc_d10", NULL, NULL, NULL,
289 "gpio_46", NULL, NULL, "safe_mode"),
290 _OMAP3_MUXENTRY(GPMC_D11, 47,
291 "gpmc_d11", NULL, NULL, NULL,
292 "gpio_47", NULL, NULL, "safe_mode"),
293 _OMAP3_MUXENTRY(GPMC_D12, 48,
294 "gpmc_d12", NULL, NULL, NULL,
295 "gpio_48", NULL, NULL, "safe_mode"),
296 _OMAP3_MUXENTRY(GPMC_D13, 49,
297 "gpmc_d13", NULL, NULL, NULL,
298 "gpio_49", NULL, NULL, "safe_mode"),
299 _OMAP3_MUXENTRY(GPMC_D14, 50,
300 "gpmc_d14", NULL, NULL, NULL,
301 "gpio_50", NULL, NULL, "safe_mode"),
302 _OMAP3_MUXENTRY(GPMC_D15, 51,
303 "gpmc_d15", NULL, NULL, NULL,
304 "gpio_51", NULL, NULL, "safe_mode"),
305 _OMAP3_MUXENTRY(GPMC_D8, 44,
306 "gpmc_d8", NULL, NULL, NULL,
307 "gpio_44", NULL, NULL, "safe_mode"),
308 _OMAP3_MUXENTRY(GPMC_D9, 45,
309 "gpmc_d9", NULL, NULL, NULL,
310 "gpio_45", NULL, NULL, "safe_mode"),
311 _OMAP3_MUXENTRY(GPMC_NBE0_CLE, 60,
312 "gpmc_nbe0_cle", NULL, NULL, NULL,
313 "gpio_60", NULL, NULL, "safe_mode"),
314 _OMAP3_MUXENTRY(GPMC_NBE1, 61,
315 "gpmc_nbe1", NULL, NULL, NULL,
316 "gpio_61", NULL, NULL, "safe_mode"),
317 _OMAP3_MUXENTRY(GPMC_NCS1, 52,
318 "gpmc_ncs1", NULL, NULL, NULL,
319 "gpio_52", NULL, NULL, "safe_mode"),
320 _OMAP3_MUXENTRY(GPMC_NCS2, 53,
321 "gpmc_ncs2", NULL, NULL, NULL,
322 "gpio_53", NULL, NULL, "safe_mode"),
323 _OMAP3_MUXENTRY(GPMC_NCS3, 54,
324 "gpmc_ncs3", "sys_ndmareq0", NULL, NULL,
325 "gpio_54", NULL, NULL, "safe_mode"),
326 _OMAP3_MUXENTRY(GPMC_NCS4, 55,
327 "gpmc_ncs4", "sys_ndmareq1", "mcbsp4_clkx", "gpt9_pwm_evt",
328 "gpio_55", NULL, NULL, "safe_mode"),
329 _OMAP3_MUXENTRY(GPMC_NCS5, 56,
330 "gpmc_ncs5", "sys_ndmareq2", "mcbsp4_dr", "gpt10_pwm_evt",
331 "gpio_56", NULL, NULL, "safe_mode"),
332 _OMAP3_MUXENTRY(GPMC_NCS6, 57,
333 "gpmc_ncs6", "sys_ndmareq3", "mcbsp4_dx", "gpt11_pwm_evt",
334 "gpio_57", NULL, NULL, "safe_mode"),
335 _OMAP3_MUXENTRY(GPMC_NCS7, 58,
336 "gpmc_ncs7", "gpmc_io_dir", "mcbsp4_fsx", "gpt8_pwm_evt",
337 "gpio_58", NULL, NULL, "safe_mode"),
338 _OMAP3_MUXENTRY(GPMC_NWP, 62,
339 "gpmc_nwp", NULL, NULL, NULL,
340 "gpio_62", NULL, NULL, "safe_mode"),
341 _OMAP3_MUXENTRY(GPMC_WAIT1, 63,
342 "gpmc_wait1", NULL, NULL, NULL,
343 "gpio_63", NULL, NULL, "safe_mode"),
344 _OMAP3_MUXENTRY(GPMC_WAIT2, 64,
345 "gpmc_wait2", NULL, NULL, NULL,
346 "gpio_64", NULL, NULL, "safe_mode"),
347 _OMAP3_MUXENTRY(GPMC_WAIT3, 65,
348 "gpmc_wait3", "sys_ndmareq1", NULL, NULL,
349 "gpio_65", NULL, NULL, "safe_mode"),
350 _OMAP3_MUXENTRY(HDQ_SIO, 170,
351 "hdq_sio", "sys_altclk", "i2c2_sccbe", "i2c3_sccbe",
352 "gpio_170", NULL, NULL, "safe_mode"),
353 _OMAP3_MUXENTRY(HSUSB0_CLK, 120,
354 "hsusb0_clk", NULL, NULL, NULL,
355 "gpio_120", NULL, NULL, "safe_mode"),
356 _OMAP3_MUXENTRY(HSUSB0_DATA0, 125,
357 "hsusb0_data0", NULL, "uart3_tx_irtx", NULL,
358 "gpio_125", NULL, NULL, "safe_mode"),
359 _OMAP3_MUXENTRY(HSUSB0_DATA1, 130,
360 "hsusb0_data1", NULL, "uart3_rx_irrx", NULL,
361 "gpio_130", NULL, NULL, "safe_mode"),
362 _OMAP3_MUXENTRY(HSUSB0_DATA2, 131,
363 "hsusb0_data2", NULL, "uart3_rts_sd", NULL,
364 "gpio_131", NULL, NULL, "safe_mode"),
365 _OMAP3_MUXENTRY(HSUSB0_DATA3, 169,
366 "hsusb0_data3", NULL, "uart3_cts_rctx", NULL,
367 "gpio_169", NULL, NULL, "safe_mode"),
368 _OMAP3_MUXENTRY(HSUSB0_DATA4, 188,
369 "hsusb0_data4", NULL, NULL, NULL,
370 "gpio_188", NULL, NULL, "safe_mode"),
371 _OMAP3_MUXENTRY(HSUSB0_DATA5, 189,
372 "hsusb0_data5", NULL, NULL, NULL,
373 "gpio_189", NULL, NULL, "safe_mode"),
374 _OMAP3_MUXENTRY(HSUSB0_DATA6, 190,
375 "hsusb0_data6", NULL, NULL, NULL,
376 "gpio_190", NULL, NULL, "safe_mode"),
377 _OMAP3_MUXENTRY(HSUSB0_DATA7, 191,
378 "hsusb0_data7", NULL, NULL, NULL,
379 "gpio_191", NULL, NULL, "safe_mode"),
380 _OMAP3_MUXENTRY(HSUSB0_DIR, 122,
381 "hsusb0_dir", NULL, NULL, NULL,
382 "gpio_122", NULL, NULL, "safe_mode"),
383 _OMAP3_MUXENTRY(HSUSB0_NXT, 124,
384 "hsusb0_nxt", NULL, NULL, NULL,
385 "gpio_124", NULL, NULL, "safe_mode"),
386 _OMAP3_MUXENTRY(HSUSB0_STP, 121,
387 "hsusb0_stp", NULL, NULL, NULL,
388 "gpio_121", NULL, NULL, "safe_mode"),
389 _OMAP3_MUXENTRY(I2C2_SCL, 168,
390 "i2c2_scl", NULL, NULL, NULL,
391 "gpio_168", NULL, NULL, "safe_mode"),
392 _OMAP3_MUXENTRY(I2C2_SDA, 183,
393 "i2c2_sda", NULL, NULL, NULL,
394 "gpio_183", NULL, NULL, "safe_mode"),
395 _OMAP3_MUXENTRY(I2C3_SCL, 184,
396 "i2c3_scl", NULL, NULL, NULL,
397 "gpio_184", NULL, NULL, "safe_mode"),
398 _OMAP3_MUXENTRY(I2C3_SDA, 185,
399 "i2c3_sda", NULL, NULL, NULL,
400 "gpio_185", NULL, NULL, "safe_mode"),
401 _OMAP3_MUXENTRY(I2C4_SCL, 0,
402 "i2c4_scl", "sys_nvmode1", NULL, NULL,
403 NULL, NULL, NULL, "safe_mode"),
404 _OMAP3_MUXENTRY(I2C4_SDA, 0,
405 "i2c4_sda", "sys_nvmode2", NULL, NULL,
406 NULL, NULL, NULL, "safe_mode"),
407 _OMAP3_MUXENTRY(JTAG_EMU0, 11,
408 "jtag_emu0", NULL, NULL, NULL,
409 "gpio_11", NULL, NULL, "safe_mode"),
410 _OMAP3_MUXENTRY(JTAG_EMU1, 31,
411 "jtag_emu1", NULL, NULL, NULL,
412 "gpio_31", NULL, NULL, "safe_mode"),
413 _OMAP3_MUXENTRY(MCBSP1_CLKR, 156,
414 "mcbsp1_clkr", "mcspi4_clk", NULL, NULL,
415 "gpio_156", NULL, NULL, "safe_mode"),
416 _OMAP3_MUXENTRY(MCBSP1_CLKX, 162,
417 "mcbsp1_clkx", NULL, "mcbsp3_clkx", NULL,
418 "gpio_162", NULL, NULL, "safe_mode"),
419 _OMAP3_MUXENTRY(MCBSP1_DR, 159,
420 "mcbsp1_dr", "mcspi4_somi", "mcbsp3_dr", NULL,
421 "gpio_159", NULL, NULL, "safe_mode"),
422 _OMAP3_MUXENTRY(MCBSP1_DX, 158,
423 "mcbsp1_dx", "mcspi4_simo", "mcbsp3_dx", NULL,
424 "gpio_158", NULL, NULL, "safe_mode"),
425 _OMAP3_MUXENTRY(MCBSP1_FSR, 157,
426 "mcbsp1_fsr", NULL, "cam_global_reset", NULL,
427 "gpio_157", NULL, NULL, "safe_mode"),
428 _OMAP3_MUXENTRY(MCBSP1_FSX, 161,
429 "mcbsp1_fsx", "mcspi4_cs0", "mcbsp3_fsx", NULL,
430 "gpio_161", NULL, NULL, "safe_mode"),
431 _OMAP3_MUXENTRY(MCBSP2_CLKX, 117,
432 "mcbsp2_clkx", NULL, NULL, NULL,
433 "gpio_117", NULL, NULL, "safe_mode"),
434 _OMAP3_MUXENTRY(MCBSP2_DR, 118,
435 "mcbsp2_dr", NULL, NULL, NULL,
436 "gpio_118", NULL, NULL, "safe_mode"),
437 _OMAP3_MUXENTRY(MCBSP2_DX, 119,
438 "mcbsp2_dx", NULL, NULL, NULL,
439 "gpio_119", NULL, NULL, "safe_mode"),
440 _OMAP3_MUXENTRY(MCBSP2_FSX, 116,
441 "mcbsp2_fsx", NULL, NULL, NULL,
442 "gpio_116", NULL, NULL, "safe_mode"),
443 _OMAP3_MUXENTRY(MCBSP3_CLKX, 142,
444 "mcbsp3_clkx", "uart2_tx", NULL, NULL,
445 "gpio_142", "hsusb3_tll_data6", NULL, "safe_mode"),
446 _OMAP3_MUXENTRY(MCBSP3_DR, 141,
447 "mcbsp3_dr", "uart2_rts", NULL, NULL,
448 "gpio_141", "hsusb3_tll_data5", NULL, "safe_mode"),
449 _OMAP3_MUXENTRY(MCBSP3_DX, 140,
450 "mcbsp3_dx", "uart2_cts", NULL, NULL,
451 "gpio_140", "hsusb3_tll_data4", NULL, "safe_mode"),
452 _OMAP3_MUXENTRY(MCBSP3_FSX, 143,
453 "mcbsp3_fsx", "uart2_rx", NULL, NULL,
454 "gpio_143", "hsusb3_tll_data7", NULL, "safe_mode"),
455 _OMAP3_MUXENTRY(MCBSP4_CLKX, 152,
456 "mcbsp4_clkx", NULL, NULL, NULL,
457 "gpio_152", "hsusb3_tll_data1", "mm3_txse0", "safe_mode"),
458 _OMAP3_MUXENTRY(MCBSP4_DR, 153,
459 "mcbsp4_dr", NULL, NULL, NULL,
460 "gpio_153", "hsusb3_tll_data0", "mm3_rxrcv", "safe_mode"),
461 _OMAP3_MUXENTRY(MCBSP4_DX, 154,
462 "mcbsp4_dx", NULL, NULL, NULL,
463 "gpio_154", "hsusb3_tll_data2", "mm3_txdat", "safe_mode"),
464 _OMAP3_MUXENTRY(MCBSP4_FSX, 155,
465 "mcbsp4_fsx", NULL, NULL, NULL,
466 "gpio_155", "hsusb3_tll_data3", "mm3_txen_n", "safe_mode"),
467 _OMAP3_MUXENTRY(MCBSP_CLKS, 160,
468 "mcbsp_clks", NULL, "cam_shutter", NULL,
469 "gpio_160", "uart1_cts", NULL, "safe_mode"),
470 _OMAP3_MUXENTRY(MCSPI1_CLK, 171,
471 "mcspi1_clk", "sdmmc2_dat4", NULL, NULL,
472 "gpio_171", NULL, NULL, "safe_mode"),
473 _OMAP3_MUXENTRY(MCSPI1_CS0, 174,
474 "mcspi1_cs0", "sdmmc2_dat7", NULL, NULL,
475 "gpio_174", NULL, NULL, "safe_mode"),
476 _OMAP3_MUXENTRY(MCSPI1_CS1, 175,
477 "mcspi1_cs1", NULL, NULL, "sdmmc3_cmd",
478 "gpio_175", NULL, NULL, "safe_mode"),
479 _OMAP3_MUXENTRY(MCSPI1_CS2, 176,
480 "mcspi1_cs2", NULL, NULL, "sdmmc3_clk",
481 "gpio_176", NULL, NULL, "safe_mode"),
482 _OMAP3_MUXENTRY(MCSPI1_CS3, 177,
483 "mcspi1_cs3", NULL, "hsusb2_tll_data2", "hsusb2_data2",
484 "gpio_177", "mm2_txdat", NULL, "safe_mode"),
485 _OMAP3_MUXENTRY(MCSPI1_SIMO, 172,
486 "mcspi1_simo", "sdmmc2_dat5", NULL, NULL,
487 "gpio_172", NULL, NULL, "safe_mode"),
488 _OMAP3_MUXENTRY(MCSPI1_SOMI, 173,
489 "mcspi1_somi", "sdmmc2_dat6", NULL, NULL,
490 "gpio_173", NULL, NULL, "safe_mode"),
491 _OMAP3_MUXENTRY(MCSPI2_CLK, 178,
492 "mcspi2_clk", NULL, "hsusb2_tll_data7", "hsusb2_data7",
493 "gpio_178", NULL, NULL, "safe_mode"),
494 _OMAP3_MUXENTRY(MCSPI2_CS0, 181,
495 "mcspi2_cs0", "gpt11_pwm_evt",
496 "hsusb2_tll_data6", "hsusb2_data6",
497 "gpio_181", NULL, NULL, "safe_mode"),
498 _OMAP3_MUXENTRY(MCSPI2_CS1, 182,
499 "mcspi2_cs1", "gpt8_pwm_evt",
500 "hsusb2_tll_data3", "hsusb2_data3",
501 "gpio_182", "mm2_txen_n", NULL, "safe_mode"),
502 _OMAP3_MUXENTRY(MCSPI2_SIMO, 179,
503 "mcspi2_simo", "gpt9_pwm_evt",
504 "hsusb2_tll_data4", "hsusb2_data4",
505 "gpio_179", NULL, NULL, "safe_mode"),
506 _OMAP3_MUXENTRY(MCSPI2_SOMI, 180,
507 "mcspi2_somi", "gpt10_pwm_evt",
508 "hsusb2_tll_data5", "hsusb2_data5",
509 "gpio_180", NULL, NULL, "safe_mode"),
510 _OMAP3_MUXENTRY(SDMMC1_CLK, 120,
511 "sdmmc1_clk", NULL, NULL, NULL,
512 "gpio_120", NULL, NULL, "safe_mode"),
513 _OMAP3_MUXENTRY(SDMMC1_CMD, 121,
514 "sdmmc1_cmd", NULL, NULL, NULL,
515 "gpio_121", NULL, NULL, "safe_mode"),
516 _OMAP3_MUXENTRY(SDMMC1_DAT0, 122,
517 "sdmmc1_dat0", NULL, NULL, NULL,
518 "gpio_122", NULL, NULL, "safe_mode"),
519 _OMAP3_MUXENTRY(SDMMC1_DAT1, 123,
520 "sdmmc1_dat1", NULL, NULL, NULL,
521 "gpio_123", NULL, NULL, "safe_mode"),
522 _OMAP3_MUXENTRY(SDMMC1_DAT2, 124,
523 "sdmmc1_dat2", NULL, NULL, NULL,
524 "gpio_124", NULL, NULL, "safe_mode"),
525 _OMAP3_MUXENTRY(SDMMC1_DAT3, 125,
526 "sdmmc1_dat3", NULL, NULL, NULL,
527 "gpio_125", NULL, NULL, "safe_mode"),
528 _OMAP3_MUXENTRY(SDMMC1_DAT4, 126,
529 "sdmmc1_dat4", NULL, "sim_io", NULL,
530 "gpio_126", NULL, NULL, "safe_mode"),
531 _OMAP3_MUXENTRY(SDMMC1_DAT5, 127,
532 "sdmmc1_dat5", NULL, "sim_clk", NULL,
533 "gpio_127", NULL, NULL, "safe_mode"),
534 _OMAP3_MUXENTRY(SDMMC1_DAT6, 128,
535 "sdmmc1_dat6", NULL, "sim_pwrctrl", NULL,
536 "gpio_128", NULL, NULL, "safe_mode"),
537 _OMAP3_MUXENTRY(SDMMC1_DAT7, 129,
538 "sdmmc1_dat7", NULL, "sim_rst", NULL,
539 "gpio_129", NULL, NULL, "safe_mode"),
540 _OMAP3_MUXENTRY(SDMMC2_CLK, 130,
541 "sdmmc2_clk", "mcspi3_clk", NULL, NULL,
542 "gpio_130", NULL, NULL, "safe_mode"),
543 _OMAP3_MUXENTRY(SDMMC2_CMD, 131,
544 "sdmmc2_cmd", "mcspi3_simo", NULL, NULL,
545 "gpio_131", NULL, NULL, "safe_mode"),
546 _OMAP3_MUXENTRY(SDMMC2_DAT0, 132,
547 "sdmmc2_dat0", "mcspi3_somi", NULL, NULL,
548 "gpio_132", NULL, NULL, "safe_mode"),
549 _OMAP3_MUXENTRY(SDMMC2_DAT1, 133,
550 "sdmmc2_dat1", NULL, NULL, NULL,
551 "gpio_133", NULL, NULL, "safe_mode"),
552 _OMAP3_MUXENTRY(SDMMC2_DAT2, 134,
553 "sdmmc2_dat2", "mcspi3_cs1", NULL, NULL,
554 "gpio_134", NULL, NULL, "safe_mode"),
555 _OMAP3_MUXENTRY(SDMMC2_DAT3, 135,
556 "sdmmc2_dat3", "mcspi3_cs0", NULL, NULL,
557 "gpio_135", NULL, NULL, "safe_mode"),
558 _OMAP3_MUXENTRY(SDMMC2_DAT4, 136,
559 "sdmmc2_dat4", "sdmmc2_dir_dat0", NULL, "sdmmc3_dat0",
560 "gpio_136", NULL, NULL, "safe_mode"),
561 _OMAP3_MUXENTRY(SDMMC2_DAT5, 137,
562 "sdmmc2_dat5", "sdmmc2_dir_dat1",
563 "cam_global_reset", "sdmmc3_dat1",
564 "gpio_137", "hsusb3_tll_stp", "mm3_rxdp", "safe_mode"),
565 _OMAP3_MUXENTRY(SDMMC2_DAT6, 138,
566 "sdmmc2_dat6", "sdmmc2_dir_cmd", "cam_shutter", "sdmmc3_dat2",
567 "gpio_138", "hsusb3_tll_dir", NULL, "safe_mode"),
568 _OMAP3_MUXENTRY(SDMMC2_DAT7, 139,
569 "sdmmc2_dat7", "sdmmc2_clkin", NULL, "sdmmc3_dat3",
570 "gpio_139", "hsusb3_tll_nxt", "mm3_rxdm", "safe_mode"),
571 _OMAP3_MUXENTRY(SDRC_CKE0, 0,
572 "sdrc_cke0", NULL, NULL, NULL,
573 NULL, NULL, NULL, "safe_mode"),
574 _OMAP3_MUXENTRY(SDRC_CKE1, 0,
575 "sdrc_cke1", NULL, NULL, NULL,
576 NULL, NULL, NULL, "safe_mode"),
577 _OMAP3_MUXENTRY(SYS_BOOT0, 2,
578 "sys_boot0", NULL, NULL, NULL,
579 "gpio_2", NULL, NULL, "safe_mode"),
580 _OMAP3_MUXENTRY(SYS_BOOT1, 3,
581 "sys_boot1", NULL, NULL, NULL,
582 "gpio_3", NULL, NULL, "safe_mode"),
583 _OMAP3_MUXENTRY(SYS_BOOT2, 4,
584 "sys_boot2", NULL, NULL, NULL,
585 "gpio_4", NULL, NULL, "safe_mode"),
586 _OMAP3_MUXENTRY(SYS_BOOT3, 5,
587 "sys_boot3", NULL, NULL, NULL,
588 "gpio_5", NULL, NULL, "safe_mode"),
589 _OMAP3_MUXENTRY(SYS_BOOT4, 6,
590 "sys_boot4", "sdmmc2_dir_dat2", NULL, NULL,
591 "gpio_6", NULL, NULL, "safe_mode"),
592 _OMAP3_MUXENTRY(SYS_BOOT5, 7,
593 "sys_boot5", "sdmmc2_dir_dat3", NULL, NULL,
594 "gpio_7", NULL, NULL, "safe_mode"),
595 _OMAP3_MUXENTRY(SYS_BOOT6, 8,
596 "sys_boot6", NULL, NULL, NULL,
597 "gpio_8", NULL, NULL, "safe_mode"),
598 _OMAP3_MUXENTRY(SYS_CLKOUT1, 10,
599 "sys_clkout1", NULL, NULL, NULL,
600 "gpio_10", NULL, NULL, "safe_mode"),
601 _OMAP3_MUXENTRY(SYS_CLKOUT2, 186,
602 "sys_clkout2", NULL, NULL, NULL,
603 "gpio_186", NULL, NULL, "safe_mode"),
604 _OMAP3_MUXENTRY(SYS_CLKREQ, 1,
605 "sys_clkreq", NULL, NULL, NULL,
606 "gpio_1", NULL, NULL, "safe_mode"),
607 _OMAP3_MUXENTRY(SYS_NIRQ, 0,
608 "sys_nirq", NULL, NULL, NULL,
609 "gpio_0", NULL, NULL, "safe_mode"),
610 _OMAP3_MUXENTRY(SYS_NRESWARM, 30,
611 "sys_nreswarm", NULL, NULL, NULL,
612 "gpio_30", NULL, NULL, "safe_mode"),
613 _OMAP3_MUXENTRY(SYS_OFF_MODE, 9,
614 "sys_off_mode", NULL, NULL, NULL,
615 "gpio_9", NULL, NULL, "safe_mode"),
616 _OMAP3_MUXENTRY(UART1_CTS, 150,
617 "uart1_cts", NULL, NULL, NULL,
618 "gpio_150", "hsusb3_tll_clk", NULL, "safe_mode"),
619 _OMAP3_MUXENTRY(UART1_RTS, 149,
620 "uart1_rts", NULL, NULL, NULL,
621 "gpio_149", NULL, NULL, "safe_mode"),
622 _OMAP3_MUXENTRY(UART1_RX, 151,
623 "uart1_rx", NULL, "mcbsp1_clkr", "mcspi4_clk",
624 "gpio_151", NULL, NULL, "safe_mode"),
625 _OMAP3_MUXENTRY(UART1_TX, 148,
626 "uart1_tx", NULL, NULL, NULL,
627 "gpio_148", NULL, NULL, "safe_mode"),
628 _OMAP3_MUXENTRY(UART2_CTS, 144,
629 "uart2_cts", "mcbsp3_dx", "gpt9_pwm_evt", NULL,
630 "gpio_144", NULL, NULL, "safe_mode"),
631 _OMAP3_MUXENTRY(UART2_RTS, 145,
632 "uart2_rts", "mcbsp3_dr", "gpt10_pwm_evt", NULL,
633 "gpio_145", NULL, NULL, "safe_mode"),
634 _OMAP3_MUXENTRY(UART2_RX, 147,
635 "uart2_rx", "mcbsp3_fsx", "gpt8_pwm_evt", NULL,
636 "gpio_147", NULL, NULL, "safe_mode"),
637 _OMAP3_MUXENTRY(UART2_TX, 146,
638 "uart2_tx", "mcbsp3_clkx", "gpt11_pwm_evt", NULL,
639 "gpio_146", NULL, NULL, "safe_mode"),
640 _OMAP3_MUXENTRY(UART3_CTS_RCTX, 163,
641 "uart3_cts_rctx", NULL, NULL, NULL,
642 "gpio_163", NULL, NULL, "safe_mode"),
643 _OMAP3_MUXENTRY(UART3_RTS_SD, 164,
644 "uart3_rts_sd", NULL, NULL, NULL,
645 "gpio_164", NULL, NULL, "safe_mode"),
646 _OMAP3_MUXENTRY(UART3_RX_IRRX, 165,
647 "uart3_rx_irrx", NULL, NULL, NULL,
648 "gpio_165", NULL, NULL, "safe_mode"),
649 _OMAP3_MUXENTRY(UART3_TX_IRTX, 166,
650 "uart3_tx_irtx", NULL, NULL, NULL,
651 "gpio_166", NULL, NULL, "safe_mode"),
652 { .reg_offset = OMAP_MUX_TERMINATOR },
653};
654
655/*
656 * Signals different on CBC package compared to the superset
657 */
658#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_OMAP_PACKAGE_CBC)
659struct omap_mux __initdata omap3_cbc_subset[] = {
660 { .reg_offset = OMAP_MUX_TERMINATOR },
661};
662#else
663#define omap3_cbc_subset NULL
664#endif
665
666/*
667 * Balls for CBC package
668 * 515-pin s-PBGA Package, 0.65mm Ball Pitch (Top), 0.50mm Ball Pitch (Bottom)
669 *
670 * FIXME: What's up with the outdated TI documentation? See:
671 *
672 * http://wiki.davincidsp.com/index.php/Datasheet_Errata_for_OMAP35x_CBC_Package
673 * http://community.ti.com/forums/t/10982.aspx
674 */
675#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_DEBUG_FS) \
676 && defined(CONFIG_OMAP_PACKAGE_CBC)
677struct omap_ball __initdata omap3_cbc_ball[] = {
678 _OMAP3_BALLENTRY(CAM_D0, "ae16", NULL),
679 _OMAP3_BALLENTRY(CAM_D1, "ae15", NULL),
680 _OMAP3_BALLENTRY(CAM_D10, "d25", NULL),
681 _OMAP3_BALLENTRY(CAM_D11, "e26", NULL),
682 _OMAP3_BALLENTRY(CAM_D2, "a24", NULL),
683 _OMAP3_BALLENTRY(CAM_D3, "b24", NULL),
684 _OMAP3_BALLENTRY(CAM_D4, "d24", NULL),
685 _OMAP3_BALLENTRY(CAM_D5, "c24", NULL),
686 _OMAP3_BALLENTRY(CAM_D6, "p25", NULL),
687 _OMAP3_BALLENTRY(CAM_D7, "p26", NULL),
688 _OMAP3_BALLENTRY(CAM_D8, "n25", NULL),
689 _OMAP3_BALLENTRY(CAM_D9, "n26", NULL),
690 _OMAP3_BALLENTRY(CAM_FLD, "b23", NULL),
691 _OMAP3_BALLENTRY(CAM_HS, "c23", NULL),
692 _OMAP3_BALLENTRY(CAM_PCLK, "c26", NULL),
693 _OMAP3_BALLENTRY(CAM_STROBE, "d26", NULL),
694 _OMAP3_BALLENTRY(CAM_VS, "d23", NULL),
695 _OMAP3_BALLENTRY(CAM_WEN, "a23", NULL),
696 _OMAP3_BALLENTRY(CAM_XCLKA, "c25", NULL),
697 _OMAP3_BALLENTRY(CAM_XCLKB, "e25", NULL),
698 _OMAP3_BALLENTRY(CSI2_DX0, "ad17", NULL),
699 _OMAP3_BALLENTRY(CSI2_DX1, "ae18", NULL),
700 _OMAP3_BALLENTRY(CSI2_DY0, "ad16", NULL),
701 _OMAP3_BALLENTRY(CSI2_DY1, "ae17", NULL),
702 _OMAP3_BALLENTRY(DSS_ACBIAS, "f26", NULL),
703 _OMAP3_BALLENTRY(DSS_DATA0, "ae21", NULL),
704 _OMAP3_BALLENTRY(DSS_DATA1, "ae22", NULL),
705 _OMAP3_BALLENTRY(DSS_DATA10, "ac26", NULL),
706 _OMAP3_BALLENTRY(DSS_DATA11, "ad26", NULL),
707 _OMAP3_BALLENTRY(DSS_DATA12, "aa25", NULL),
708 _OMAP3_BALLENTRY(DSS_DATA13, "y25", NULL),
709 _OMAP3_BALLENTRY(DSS_DATA14, "aa26", NULL),
710 _OMAP3_BALLENTRY(DSS_DATA15, "ab26", NULL),
711 _OMAP3_BALLENTRY(DSS_DATA16, "l25", NULL),
712 _OMAP3_BALLENTRY(DSS_DATA17, "l26", NULL),
713 _OMAP3_BALLENTRY(DSS_DATA18, "m24", NULL),
714 _OMAP3_BALLENTRY(DSS_DATA19, "m26", NULL),
715 _OMAP3_BALLENTRY(DSS_DATA2, "ae23", NULL),
716 _OMAP3_BALLENTRY(DSS_DATA20, "f25", NULL),
717 _OMAP3_BALLENTRY(DSS_DATA21, "n24", NULL),
718 _OMAP3_BALLENTRY(DSS_DATA22, "ac25", NULL),
719 _OMAP3_BALLENTRY(DSS_DATA23, "ab25", NULL),
720 _OMAP3_BALLENTRY(DSS_DATA3, "ae24", NULL),
721 _OMAP3_BALLENTRY(DSS_DATA4, "ad23", NULL),
722 _OMAP3_BALLENTRY(DSS_DATA5, "ad24", NULL),
723 _OMAP3_BALLENTRY(DSS_DATA6, "g26", NULL),
724 _OMAP3_BALLENTRY(DSS_DATA7, "h25", NULL),
725 _OMAP3_BALLENTRY(DSS_DATA8, "h26", NULL),
726 _OMAP3_BALLENTRY(DSS_DATA9, "j26", NULL),
727 _OMAP3_BALLENTRY(DSS_HSYNC, "k24", NULL),
728 _OMAP3_BALLENTRY(DSS_PCLK, "g25", NULL),
729 _OMAP3_BALLENTRY(DSS_VSYNC, "m25", NULL),
730 _OMAP3_BALLENTRY(ETK_CLK, "ab2", NULL),
731 _OMAP3_BALLENTRY(ETK_CTL, "ab3", NULL),
732 _OMAP3_BALLENTRY(ETK_D0, "ac3", NULL),
733 _OMAP3_BALLENTRY(ETK_D1, "ad4", NULL),
734 _OMAP3_BALLENTRY(ETK_D10, "ae4", NULL),
735 _OMAP3_BALLENTRY(ETK_D11, "af6", NULL),
736 _OMAP3_BALLENTRY(ETK_D12, "ae6", NULL),
737 _OMAP3_BALLENTRY(ETK_D13, "af7", NULL),
738 _OMAP3_BALLENTRY(ETK_D14, "af9", NULL),
739 _OMAP3_BALLENTRY(ETK_D15, "ae9", NULL),
740 _OMAP3_BALLENTRY(ETK_D2, "ad3", NULL),
741 _OMAP3_BALLENTRY(ETK_D3, "aa3", NULL),
742 _OMAP3_BALLENTRY(ETK_D4, "y3", NULL),
743 _OMAP3_BALLENTRY(ETK_D5, "ab1", NULL),
744 _OMAP3_BALLENTRY(ETK_D6, "ae3", NULL),
745 _OMAP3_BALLENTRY(ETK_D7, "ad2", NULL),
746 _OMAP3_BALLENTRY(ETK_D8, "aa4", NULL),
747 _OMAP3_BALLENTRY(ETK_D9, "v2", NULL),
748 _OMAP3_BALLENTRY(GPMC_A1, "j2", NULL),
749 _OMAP3_BALLENTRY(GPMC_A10, "d2", NULL),
750 _OMAP3_BALLENTRY(GPMC_A2, "h1", NULL),
751 _OMAP3_BALLENTRY(GPMC_A3, "h2", NULL),
752 _OMAP3_BALLENTRY(GPMC_A4, "g2", NULL),
753 _OMAP3_BALLENTRY(GPMC_A5, "f1", NULL),
754 _OMAP3_BALLENTRY(GPMC_A6, "f2", NULL),
755 _OMAP3_BALLENTRY(GPMC_A7, "e1", NULL),
756 _OMAP3_BALLENTRY(GPMC_A8, "e2", NULL),
757 _OMAP3_BALLENTRY(GPMC_A9, "d1", NULL),
758 _OMAP3_BALLENTRY(GPMC_CLK, "n1", "l1"),
759 _OMAP3_BALLENTRY(GPMC_D10, "t1", "n1"),
760 _OMAP3_BALLENTRY(GPMC_D11, "u2", "p2"),
761 _OMAP3_BALLENTRY(GPMC_D12, "u1", "p1"),
762 _OMAP3_BALLENTRY(GPMC_D13, "p1", "m1"),
763 _OMAP3_BALLENTRY(GPMC_D14, "l2", "j2"),
764 _OMAP3_BALLENTRY(GPMC_D15, "m2", "k2"),
765 _OMAP3_BALLENTRY(GPMC_D8, "v1", "r1"),
766 _OMAP3_BALLENTRY(GPMC_D9, "y1", "t1"),
767 _OMAP3_BALLENTRY(GPMC_NBE0_CLE, "k2", NULL),
768 _OMAP3_BALLENTRY(GPMC_NBE1, "j1", NULL),
769 _OMAP3_BALLENTRY(GPMC_NCS1, "ad1", "w1"),
770 _OMAP3_BALLENTRY(GPMC_NCS2, "a3", NULL),
771 _OMAP3_BALLENTRY(GPMC_NCS3, "b6", NULL),
772 _OMAP3_BALLENTRY(GPMC_NCS4, "b4", NULL),
773 _OMAP3_BALLENTRY(GPMC_NCS5, "c4", NULL),
774 _OMAP3_BALLENTRY(GPMC_NCS6, "b5", NULL),
775 _OMAP3_BALLENTRY(GPMC_NCS7, "c5", NULL),
776 _OMAP3_BALLENTRY(GPMC_NWP, "ac6", "y5"),
777 _OMAP3_BALLENTRY(GPMC_WAIT1, "ac8", "y8"),
778 _OMAP3_BALLENTRY(GPMC_WAIT2, "b3", NULL),
779 _OMAP3_BALLENTRY(GPMC_WAIT3, "c6", NULL),
780 _OMAP3_BALLENTRY(HDQ_SIO, "j23", NULL),
781 _OMAP3_BALLENTRY(HSUSB0_CLK, "w19", NULL),
782 _OMAP3_BALLENTRY(HSUSB0_DATA0, "v20", NULL),
783 _OMAP3_BALLENTRY(HSUSB0_DATA1, "y20", NULL),
784 _OMAP3_BALLENTRY(HSUSB0_DATA2, "v18", NULL),
785 _OMAP3_BALLENTRY(HSUSB0_DATA3, "w20", NULL),
786 _OMAP3_BALLENTRY(HSUSB0_DATA4, "w17", NULL),
787 _OMAP3_BALLENTRY(HSUSB0_DATA5, "y18", NULL),
788 _OMAP3_BALLENTRY(HSUSB0_DATA6, "y19", NULL),
789 _OMAP3_BALLENTRY(HSUSB0_DATA7, "y17", NULL),
790 _OMAP3_BALLENTRY(HSUSB0_DIR, "v19", NULL),
791 _OMAP3_BALLENTRY(HSUSB0_NXT, "w18", NULL),
792 _OMAP3_BALLENTRY(HSUSB0_STP, "u20", NULL),
793 _OMAP3_BALLENTRY(I2C2_SCL, "c2", NULL),
794 _OMAP3_BALLENTRY(I2C2_SDA, "c1", NULL),
795 _OMAP3_BALLENTRY(I2C3_SCL, "ab4", NULL),
796 _OMAP3_BALLENTRY(I2C3_SDA, "ac4", NULL),
797 _OMAP3_BALLENTRY(I2C4_SCL, "ad15", NULL),
798 _OMAP3_BALLENTRY(I2C4_SDA, "w16", NULL),
799 _OMAP3_BALLENTRY(JTAG_EMU0, "y15", NULL),
800 _OMAP3_BALLENTRY(JTAG_EMU1, "y14", NULL),
801 _OMAP3_BALLENTRY(MCBSP1_CLKR, "u19", NULL),
802 _OMAP3_BALLENTRY(MCBSP1_CLKX, "t17", NULL),
803 _OMAP3_BALLENTRY(MCBSP1_DR, "t20", NULL),
804 _OMAP3_BALLENTRY(MCBSP1_DX, "u17", NULL),
805 _OMAP3_BALLENTRY(MCBSP1_FSR, "v17", NULL),
806 _OMAP3_BALLENTRY(MCBSP1_FSX, "p20", NULL),
807 _OMAP3_BALLENTRY(MCBSP2_CLKX, "r18", NULL),
808 _OMAP3_BALLENTRY(MCBSP2_DR, "t18", NULL),
809 _OMAP3_BALLENTRY(MCBSP2_DX, "r19", NULL),
810 _OMAP3_BALLENTRY(MCBSP2_FSX, "u18", NULL),
811 _OMAP3_BALLENTRY(MCBSP3_CLKX, "u3", NULL),
812 _OMAP3_BALLENTRY(MCBSP3_DR, "n3", NULL),
813 _OMAP3_BALLENTRY(MCBSP3_DX, "p3", NULL),
814 _OMAP3_BALLENTRY(MCBSP3_FSX, "w3", NULL),
815 _OMAP3_BALLENTRY(MCBSP4_CLKX, "v3", NULL),
816 _OMAP3_BALLENTRY(MCBSP4_DR, "u4", NULL),
817 _OMAP3_BALLENTRY(MCBSP4_DX, "r3", NULL),
818 _OMAP3_BALLENTRY(MCBSP4_FSX, "t3", NULL),
819 _OMAP3_BALLENTRY(MCBSP_CLKS, "t19", NULL),
820 _OMAP3_BALLENTRY(MCSPI1_CLK, "p9", NULL),
821 _OMAP3_BALLENTRY(MCSPI1_CS0, "r7", NULL),
822 _OMAP3_BALLENTRY(MCSPI1_CS1, "r8", NULL),
823 _OMAP3_BALLENTRY(MCSPI1_CS2, "r9", NULL),
824 _OMAP3_BALLENTRY(MCSPI1_CS3, "t8", NULL),
825 _OMAP3_BALLENTRY(MCSPI1_SIMO, "p8", NULL),
826 _OMAP3_BALLENTRY(MCSPI1_SOMI, "p7", NULL),
827 _OMAP3_BALLENTRY(MCSPI2_CLK, "w7", NULL),
828 _OMAP3_BALLENTRY(MCSPI2_CS0, "v8", NULL),
829 _OMAP3_BALLENTRY(MCSPI2_CS1, "v9", NULL),
830 _OMAP3_BALLENTRY(MCSPI2_SIMO, "w8", NULL),
831 _OMAP3_BALLENTRY(MCSPI2_SOMI, "u8", NULL),
832 _OMAP3_BALLENTRY(SDMMC1_CLK, "n19", NULL),
833 _OMAP3_BALLENTRY(SDMMC1_CMD, "l18", NULL),
834 _OMAP3_BALLENTRY(SDMMC1_DAT0, "m19", NULL),
835 _OMAP3_BALLENTRY(SDMMC1_DAT1, "m18", NULL),
836 _OMAP3_BALLENTRY(SDMMC1_DAT2, "k18", NULL),
837 _OMAP3_BALLENTRY(SDMMC1_DAT3, "n20", NULL),
838 _OMAP3_BALLENTRY(SDMMC1_DAT4, "m20", NULL),
839 _OMAP3_BALLENTRY(SDMMC1_DAT5, "p17", NULL),
840 _OMAP3_BALLENTRY(SDMMC1_DAT6, "p18", NULL),
841 _OMAP3_BALLENTRY(SDMMC1_DAT7, "p19", NULL),
842 _OMAP3_BALLENTRY(SDMMC2_CLK, "w10", NULL),
843 _OMAP3_BALLENTRY(SDMMC2_CMD, "r10", NULL),
844 _OMAP3_BALLENTRY(SDMMC2_DAT0, "t10", NULL),
845 _OMAP3_BALLENTRY(SDMMC2_DAT1, "t9", NULL),
846 _OMAP3_BALLENTRY(SDMMC2_DAT2, "u10", NULL),
847 _OMAP3_BALLENTRY(SDMMC2_DAT3, "u9", NULL),
848 _OMAP3_BALLENTRY(SDMMC2_DAT4, "v10", NULL),
849 _OMAP3_BALLENTRY(SDMMC2_DAT5, "m3", NULL),
850 _OMAP3_BALLENTRY(SDMMC2_DAT6, "l3", NULL),
851 _OMAP3_BALLENTRY(SDMMC2_DAT7, "k3", NULL),
852 _OMAP3_BALLENTRY(SYS_BOOT0, "f3", NULL),
853 _OMAP3_BALLENTRY(SYS_BOOT1, "d3", NULL),
854 _OMAP3_BALLENTRY(SYS_BOOT2, "c3", NULL),
855 _OMAP3_BALLENTRY(SYS_BOOT3, "e3", NULL),
856 _OMAP3_BALLENTRY(SYS_BOOT4, "e4", NULL),
857 _OMAP3_BALLENTRY(SYS_BOOT5, "g3", NULL),
858 _OMAP3_BALLENTRY(SYS_BOOT6, "d4", NULL),
859 _OMAP3_BALLENTRY(SYS_CLKOUT1, "ae14", NULL),
860 _OMAP3_BALLENTRY(SYS_CLKOUT2, "w11", NULL),
861 _OMAP3_BALLENTRY(SYS_CLKREQ, "w15", NULL),
862 _OMAP3_BALLENTRY(SYS_NIRQ, "v16", NULL),
863 _OMAP3_BALLENTRY(SYS_NRESWARM, "ad7", "aa5"),
864 _OMAP3_BALLENTRY(SYS_OFF_MODE, "v12", NULL),
865 _OMAP3_BALLENTRY(UART1_CTS, "w2", NULL),
866 _OMAP3_BALLENTRY(UART1_RTS, "r2", NULL),
867 _OMAP3_BALLENTRY(UART1_RX, "h3", NULL),
868 _OMAP3_BALLENTRY(UART1_TX, "l4", NULL),
869 _OMAP3_BALLENTRY(UART2_CTS, "y24", NULL),
870 _OMAP3_BALLENTRY(UART2_RTS, "aa24", NULL),
871 _OMAP3_BALLENTRY(UART2_RX, "ad21", NULL),
872 _OMAP3_BALLENTRY(UART2_TX, "ad22", NULL),
873 _OMAP3_BALLENTRY(UART3_CTS_RCTX, "f23", NULL),
874 _OMAP3_BALLENTRY(UART3_RTS_SD, "f24", NULL),
875 _OMAP3_BALLENTRY(UART3_RX_IRRX, "h24", NULL),
876 _OMAP3_BALLENTRY(UART3_TX_IRTX, "g24", NULL),
877 { .reg_offset = OMAP_MUX_TERMINATOR },
878};
879#else
880#define omap3_cbc_ball NULL
881#endif
882
883/*
884 * Signals different on CUS package compared to superset
885 */
886#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_OMAP_PACKAGE_CUS)
887struct omap_mux __initdata omap3_cus_subset[] = {
888 _OMAP3_MUXENTRY(CAM_D10, 109,
889 "cam_d10", NULL, NULL, NULL,
890 "gpio_109", NULL, NULL, "safe_mode"),
891 _OMAP3_MUXENTRY(CAM_D11, 110,
892 "cam_d11", NULL, NULL, NULL,
893 "gpio_110", NULL, NULL, "safe_mode"),
894 _OMAP3_MUXENTRY(CAM_D2, 101,
895 "cam_d2", NULL, NULL, NULL,
896 "gpio_101", NULL, NULL, "safe_mode"),
897 _OMAP3_MUXENTRY(CAM_D3, 102,
898 "cam_d3", NULL, NULL, NULL,
899 "gpio_102", NULL, NULL, "safe_mode"),
900 _OMAP3_MUXENTRY(CAM_D4, 103,
901 "cam_d4", NULL, NULL, NULL,
902 "gpio_103", NULL, NULL, "safe_mode"),
903 _OMAP3_MUXENTRY(CAM_D5, 104,
904 "cam_d5", NULL, NULL, NULL,
905 "gpio_104", NULL, NULL, "safe_mode"),
906 _OMAP3_MUXENTRY(CAM_FLD, 98,
907 "cam_fld", NULL, "cam_global_reset", NULL,
908 "gpio_98", NULL, NULL, "safe_mode"),
909 _OMAP3_MUXENTRY(CAM_HS, 94,
910 "cam_hs", NULL, NULL, NULL,
911 "gpio_94", NULL, NULL, "safe_mode"),
912 _OMAP3_MUXENTRY(CAM_PCLK, 97,
913 "cam_pclk", NULL, NULL, NULL,
914 "gpio_97", NULL, NULL, "safe_mode"),
915 _OMAP3_MUXENTRY(CAM_STROBE, 126,
916 "cam_strobe", NULL, NULL, NULL,
917 "gpio_126", NULL, NULL, "safe_mode"),
918 _OMAP3_MUXENTRY(CAM_VS, 95,
919 "cam_vs", NULL, NULL, NULL,
920 "gpio_95", NULL, NULL, "safe_mode"),
921 _OMAP3_MUXENTRY(CAM_WEN, 167,
922 "cam_wen", NULL, "cam_shutter", NULL,
923 "gpio_167", NULL, NULL, "safe_mode"),
924 _OMAP3_MUXENTRY(DSS_DATA6, 76,
925 "dss_data6", NULL, "uart1_tx", NULL,
926 "gpio_76", NULL, NULL, "safe_mode"),
927 _OMAP3_MUXENTRY(DSS_DATA7, 77,
928 "dss_data7", NULL, "uart1_rx", NULL,
929 "gpio_77", NULL, NULL, "safe_mode"),
930 _OMAP3_MUXENTRY(DSS_DATA8, 78,
931 "dss_data8", NULL, NULL, NULL,
932 "gpio_78", NULL, NULL, "safe_mode"),
933 _OMAP3_MUXENTRY(DSS_DATA9, 79,
934 "dss_data9", NULL, NULL, NULL,
935 "gpio_79", NULL, NULL, "safe_mode"),
936 _OMAP3_MUXENTRY(DSS_HSYNC, 67,
937 "dss_hsync", NULL, NULL, NULL,
938 "gpio_67", NULL, NULL, "safe_mode"),
939 _OMAP3_MUXENTRY(DSS_PCLK, 66,
940 "dss_pclk", NULL, NULL, NULL,
941 "gpio_66", NULL, NULL, "safe_mode"),
942 _OMAP3_MUXENTRY(ETK_CLK, 12,
943 "etk_clk", "mcbsp5_clkx", "sdmmc3_clk", "hsusb1_stp",
944 "gpio_12", "mm1_rxdp", "hsusb1_tll_stp", NULL),
945 _OMAP3_MUXENTRY(ETK_CTL, 13,
946 "etk_ctl", NULL, "sdmmc3_cmd", "hsusb1_clk",
947 "gpio_13", NULL, "hsusb1_tll_clk", NULL),
948 _OMAP3_MUXENTRY(ETK_D0, 14,
949 "etk_d0", "mcspi3_simo", "sdmmc3_dat4", "hsusb1_data0",
950 "gpio_14", "mm1_rxrcv", "hsusb1_tll_data0", NULL),
951 _OMAP3_MUXENTRY(ETK_D1, 15,
952 "etk_d1", "mcspi3_somi", NULL, "hsusb1_data1",
953 "gpio_15", "mm1_txse0", "hsusb1_tll_data1", NULL),
954 _OMAP3_MUXENTRY(ETK_D10, 24,
955 "etk_d10", NULL, "uart1_rx", "hsusb2_clk",
956 "gpio_24", NULL, "hsusb2_tll_clk", NULL),
957 _OMAP3_MUXENTRY(ETK_D11, 25,
958 "etk_d11", NULL, NULL, "hsusb2_stp",
959 "gpio_25", "mm2_rxdp", "hsusb2_tll_stp", NULL),
960 _OMAP3_MUXENTRY(ETK_D12, 26,
961 "etk_d12", NULL, NULL, "hsusb2_dir",
962 "gpio_26", NULL, "hsusb2_tll_dir", NULL),
963 _OMAP3_MUXENTRY(ETK_D13, 27,
964 "etk_d13", NULL, NULL, "hsusb2_nxt",
965 "gpio_27", "mm2_rxdm", "hsusb2_tll_nxt", NULL),
966 _OMAP3_MUXENTRY(ETK_D14, 28,
967 "etk_d14", NULL, NULL, "hsusb2_data0",
968 "gpio_28", "mm2_rxrcv", "hsusb2_tll_data0", NULL),
969 _OMAP3_MUXENTRY(ETK_D15, 29,
970 "etk_d15", NULL, NULL, "hsusb2_data1",
971 "gpio_29", "mm2_txse0", "hsusb2_tll_data1", NULL),
972 _OMAP3_MUXENTRY(ETK_D2, 16,
973 "etk_d2", "mcspi3_cs0", NULL, "hsusb1_data2",
974 "gpio_16", "mm1_txdat", "hsusb1_tll_data2", NULL),
975 _OMAP3_MUXENTRY(ETK_D3, 17,
976 "etk_d3", "mcspi3_clk", "sdmmc3_dat3", "hsusb1_data7",
977 "gpio_17", NULL, "hsusb1_tll_data7", NULL),
978 _OMAP3_MUXENTRY(ETK_D4, 18,
979 "etk_d4", "mcbsp5_dr", "sdmmc3_dat0", "hsusb1_data4",
980 "gpio_18", NULL, "hsusb1_tll_data4", NULL),
981 _OMAP3_MUXENTRY(ETK_D5, 19,
982 "etk_d5", "mcbsp5_fsx", "sdmmc3_dat1", "hsusb1_data5",
983 "gpio_19", NULL, "hsusb1_tll_data5", NULL),
984 _OMAP3_MUXENTRY(ETK_D6, 20,
985 "etk_d6", "mcbsp5_dx", "sdmmc3_dat2", "hsusb1_data6",
986 "gpio_20", NULL, "hsusb1_tll_data6", NULL),
987 _OMAP3_MUXENTRY(ETK_D7, 21,
988 "etk_d7", "mcspi3_cs1", "sdmmc3_dat7", "hsusb1_data3",
989 "gpio_21", "mm1_txen_n", "hsusb1_tll_data3", NULL),
990 _OMAP3_MUXENTRY(ETK_D8, 22,
991 "etk_d8", "sys_drm_msecure", "sdmmc3_dat6", "hsusb1_dir",
992 "gpio_22", NULL, "hsusb1_tll_dir", NULL),
993 _OMAP3_MUXENTRY(ETK_D9, 23,
994 "etk_d9", "sys_secure_indicator", "sdmmc3_dat5", "hsusb1_nxt",
995 "gpio_23", "mm1_rxdm", "hsusb1_tll_nxt", NULL),
996 _OMAP3_MUXENTRY(MCBSP3_CLKX, 142,
997 "mcbsp3_clkx", "uart2_tx", NULL, NULL,
998 "gpio_142", NULL, NULL, "safe_mode"),
999 _OMAP3_MUXENTRY(MCBSP3_DR, 141,
1000 "mcbsp3_dr", "uart2_rts", NULL, NULL,
1001 "gpio_141", NULL, NULL, "safe_mode"),
1002 _OMAP3_MUXENTRY(MCBSP3_DX, 140,
1003 "mcbsp3_dx", "uart2_cts", NULL, NULL,
1004 "gpio_140", NULL, NULL, "safe_mode"),
1005 _OMAP3_MUXENTRY(MCBSP3_FSX, 143,
1006 "mcbsp3_fsx", "uart2_rx", NULL, NULL,
1007 "gpio_143", NULL, NULL, "safe_mode"),
1008 _OMAP3_MUXENTRY(SDMMC2_DAT5, 137,
1009 "sdmmc2_dat5", "sdmmc2_dir_dat1",
1010 "cam_global_reset", "sdmmc3_dat1",
1011 "gpio_137", NULL, NULL, "safe_mode"),
1012 _OMAP3_MUXENTRY(SDMMC2_DAT6, 138,
1013 "sdmmc2_dat6", "sdmmc2_dir_cmd", "cam_shutter", "sdmmc3_dat2",
1014 "gpio_138", NULL, NULL, "safe_mode"),
1015 _OMAP3_MUXENTRY(SDMMC2_DAT7, 139,
1016 "sdmmc2_dat7", "sdmmc2_clkin", NULL, "sdmmc3_dat3",
1017 "gpio_139", NULL, NULL, "safe_mode"),
1018 _OMAP3_MUXENTRY(UART1_CTS, 150,
1019 "uart1_cts", NULL, NULL, NULL,
1020 "gpio_150", NULL, NULL, "safe_mode"),
1021 { .reg_offset = OMAP_MUX_TERMINATOR },
1022};
1023#else
1024#define omap3_cus_subset NULL
1025#endif
1026
1027/*
1028 * Balls for CUS package
1029 * 423-pin s-PBGA Package, 0.65mm Ball Pitch (Bottom)
1030 */
1031#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_DEBUG_FS) \
1032 && defined(CONFIG_OMAP_PACKAGE_CUS)
1033struct omap_ball __initdata omap3_cus_ball[] = {
1034 _OMAP3_BALLENTRY(CAM_D0, "ab18", NULL),
1035 _OMAP3_BALLENTRY(CAM_D1, "ac18", NULL),
1036 _OMAP3_BALLENTRY(CAM_D10, "f21", NULL),
1037 _OMAP3_BALLENTRY(CAM_D11, "g21", NULL),
1038 _OMAP3_BALLENTRY(CAM_D2, "g19", NULL),
1039 _OMAP3_BALLENTRY(CAM_D3, "f19", NULL),
1040 _OMAP3_BALLENTRY(CAM_D4, "g20", NULL),
1041 _OMAP3_BALLENTRY(CAM_D5, "b21", NULL),
1042 _OMAP3_BALLENTRY(CAM_D6, "l24", NULL),
1043 _OMAP3_BALLENTRY(CAM_D7, "k24", NULL),
1044 _OMAP3_BALLENTRY(CAM_D8, "j23", NULL),
1045 _OMAP3_BALLENTRY(CAM_D9, "k23", NULL),
1046 _OMAP3_BALLENTRY(CAM_FLD, "h24", NULL),
1047 _OMAP3_BALLENTRY(CAM_HS, "a22", NULL),
1048 _OMAP3_BALLENTRY(CAM_PCLK, "j19", NULL),
1049 _OMAP3_BALLENTRY(CAM_STROBE, "j20", NULL),
1050 _OMAP3_BALLENTRY(CAM_VS, "e18", NULL),
1051 _OMAP3_BALLENTRY(CAM_WEN, "f18", NULL),
1052 _OMAP3_BALLENTRY(CAM_XCLKA, "b22", NULL),
1053 _OMAP3_BALLENTRY(CAM_XCLKB, "c22", NULL),
1054 _OMAP3_BALLENTRY(DSS_ACBIAS, "j21", NULL),
1055 _OMAP3_BALLENTRY(DSS_DATA0, "ac19", NULL),
1056 _OMAP3_BALLENTRY(DSS_DATA1, "ab19", NULL),
1057 _OMAP3_BALLENTRY(DSS_DATA10, "ac22", NULL),
1058 _OMAP3_BALLENTRY(DSS_DATA11, "ac23", NULL),
1059 _OMAP3_BALLENTRY(DSS_DATA12, "ab22", NULL),
1060 _OMAP3_BALLENTRY(DSS_DATA13, "y22", NULL),
1061 _OMAP3_BALLENTRY(DSS_DATA14, "w22", NULL),
1062 _OMAP3_BALLENTRY(DSS_DATA15, "v22", NULL),
1063 _OMAP3_BALLENTRY(DSS_DATA16, "j22", NULL),
1064 _OMAP3_BALLENTRY(DSS_DATA17, "g23", NULL),
1065 _OMAP3_BALLENTRY(DSS_DATA18, "g24", NULL),
1066 _OMAP3_BALLENTRY(DSS_DATA19, "h23", NULL),
1067 _OMAP3_BALLENTRY(DSS_DATA2, "ad20", NULL),
1068 _OMAP3_BALLENTRY(DSS_DATA20, "d23", NULL),
1069 _OMAP3_BALLENTRY(DSS_DATA21, "k22", NULL),
1070 _OMAP3_BALLENTRY(DSS_DATA22, "v21", NULL),
1071 _OMAP3_BALLENTRY(DSS_DATA23, "w21", NULL),
1072 _OMAP3_BALLENTRY(DSS_DATA3, "ac20", NULL),
1073 _OMAP3_BALLENTRY(DSS_DATA4, "ad21", NULL),
1074 _OMAP3_BALLENTRY(DSS_DATA5, "ac21", NULL),
1075 _OMAP3_BALLENTRY(DSS_DATA6, "d24", NULL),
1076 _OMAP3_BALLENTRY(DSS_DATA7, "e23", NULL),
1077 _OMAP3_BALLENTRY(DSS_DATA8, "e24", NULL),
1078 _OMAP3_BALLENTRY(DSS_DATA9, "f23", NULL),
1079 _OMAP3_BALLENTRY(DSS_HSYNC, "e22", NULL),
1080 _OMAP3_BALLENTRY(DSS_PCLK, "g22", NULL),
1081 _OMAP3_BALLENTRY(DSS_VSYNC, "f22", NULL),
1082 _OMAP3_BALLENTRY(ETK_CLK, "ac1", NULL),
1083 _OMAP3_BALLENTRY(ETK_CTL, "ad3", NULL),
1084 _OMAP3_BALLENTRY(ETK_D0, "ad6", NULL),
1085 _OMAP3_BALLENTRY(ETK_D1, "ac6", NULL),
1086 _OMAP3_BALLENTRY(ETK_D10, "ac3", NULL),
1087 _OMAP3_BALLENTRY(ETK_D11, "ac9", NULL),
1088 _OMAP3_BALLENTRY(ETK_D12, "ac10", NULL),
1089 _OMAP3_BALLENTRY(ETK_D13, "ad11", NULL),
1090 _OMAP3_BALLENTRY(ETK_D14, "ac11", NULL),
1091 _OMAP3_BALLENTRY(ETK_D15, "ad12", NULL),
1092 _OMAP3_BALLENTRY(ETK_D2, "ac7", NULL),
1093 _OMAP3_BALLENTRY(ETK_D3, "ad8", NULL),
1094 _OMAP3_BALLENTRY(ETK_D4, "ac5", NULL),
1095 _OMAP3_BALLENTRY(ETK_D5, "ad2", NULL),
1096 _OMAP3_BALLENTRY(ETK_D6, "ac8", NULL),
1097 _OMAP3_BALLENTRY(ETK_D7, "ad9", NULL),
1098 _OMAP3_BALLENTRY(ETK_D8, "ac4", NULL),
1099 _OMAP3_BALLENTRY(ETK_D9, "ad5", NULL),
1100 _OMAP3_BALLENTRY(GPMC_A1, "k4", NULL),
1101 _OMAP3_BALLENTRY(GPMC_A10, "g2", NULL),
1102 _OMAP3_BALLENTRY(GPMC_A2, "k3", NULL),
1103 _OMAP3_BALLENTRY(GPMC_A3, "k2", NULL),
1104 _OMAP3_BALLENTRY(GPMC_A4, "j4", NULL),
1105 _OMAP3_BALLENTRY(GPMC_A5, "j3", NULL),
1106 _OMAP3_BALLENTRY(GPMC_A6, "j2", NULL),
1107 _OMAP3_BALLENTRY(GPMC_A7, "j1", NULL),
1108 _OMAP3_BALLENTRY(GPMC_A8, "h1", NULL),
1109 _OMAP3_BALLENTRY(GPMC_A9, "h2", NULL),
1110 _OMAP3_BALLENTRY(GPMC_CLK, "w2", NULL),
1111 _OMAP3_BALLENTRY(GPMC_D10, "u1", NULL),
1112 _OMAP3_BALLENTRY(GPMC_D11, "r3", NULL),
1113 _OMAP3_BALLENTRY(GPMC_D12, "t3", NULL),
1114 _OMAP3_BALLENTRY(GPMC_D13, "u2", NULL),
1115 _OMAP3_BALLENTRY(GPMC_D14, "v1", NULL),
1116 _OMAP3_BALLENTRY(GPMC_D15, "v2", NULL),
1117 _OMAP3_BALLENTRY(GPMC_D8, "r2", NULL),
1118 _OMAP3_BALLENTRY(GPMC_D9, "t2", NULL),
1119 _OMAP3_BALLENTRY(GPMC_NBE0_CLE, "k5", NULL),
1120 _OMAP3_BALLENTRY(GPMC_NBE1, "l1", NULL),
1121 _OMAP3_BALLENTRY(GPMC_NCS3, "d2", NULL),
1122 _OMAP3_BALLENTRY(GPMC_NCS4, "f4", NULL),
1123 _OMAP3_BALLENTRY(GPMC_NCS5, "g5", NULL),
1124 _OMAP3_BALLENTRY(GPMC_NCS6, "f3", NULL),
1125 _OMAP3_BALLENTRY(GPMC_NCS7, "g4", NULL),
1126 _OMAP3_BALLENTRY(GPMC_NWP, "e1", NULL),
1127 _OMAP3_BALLENTRY(GPMC_WAIT3, "c2", NULL),
1128 _OMAP3_BALLENTRY(HDQ_SIO, "a24", NULL),
1129 _OMAP3_BALLENTRY(HSUSB0_CLK, "r21", NULL),
1130 _OMAP3_BALLENTRY(HSUSB0_DATA0, "t24", NULL),
1131 _OMAP3_BALLENTRY(HSUSB0_DATA1, "t23", NULL),
1132 _OMAP3_BALLENTRY(HSUSB0_DATA2, "u24", NULL),
1133 _OMAP3_BALLENTRY(HSUSB0_DATA3, "u23", NULL),
1134 _OMAP3_BALLENTRY(HSUSB0_DATA4, "w24", NULL),
1135 _OMAP3_BALLENTRY(HSUSB0_DATA5, "v23", NULL),
1136 _OMAP3_BALLENTRY(HSUSB0_DATA6, "w23", NULL),
1137 _OMAP3_BALLENTRY(HSUSB0_DATA7, "t22", NULL),
1138 _OMAP3_BALLENTRY(HSUSB0_DIR, "p23", NULL),
1139 _OMAP3_BALLENTRY(HSUSB0_NXT, "r22", NULL),
1140 _OMAP3_BALLENTRY(HSUSB0_STP, "r23", NULL),
1141 _OMAP3_BALLENTRY(I2C2_SCL, "ac15", NULL),
1142 _OMAP3_BALLENTRY(I2C2_SDA, "ac14", NULL),
1143 _OMAP3_BALLENTRY(I2C3_SCL, "ac13", NULL),
1144 _OMAP3_BALLENTRY(I2C3_SDA, "ac12", NULL),
1145 _OMAP3_BALLENTRY(I2C4_SCL, "y16", NULL),
1146 _OMAP3_BALLENTRY(I2C4_SDA, "y15", NULL),
1147 _OMAP3_BALLENTRY(JTAG_EMU0, "ac24", NULL),
1148 _OMAP3_BALLENTRY(JTAG_EMU1, "ad24", NULL),
1149 _OMAP3_BALLENTRY(MCBSP1_CLKR, "w19", NULL),
1150 _OMAP3_BALLENTRY(MCBSP1_CLKX, "v18", NULL),
1151 _OMAP3_BALLENTRY(MCBSP1_DR, "y18", NULL),
1152 _OMAP3_BALLENTRY(MCBSP1_DX, "w18", NULL),
1153 _OMAP3_BALLENTRY(MCBSP1_FSR, "ab20", NULL),
1154 _OMAP3_BALLENTRY(MCBSP1_FSX, "aa19", NULL),
1155 _OMAP3_BALLENTRY(MCBSP2_CLKX, "t21", NULL),
1156 _OMAP3_BALLENTRY(MCBSP2_DR, "v19", NULL),
1157 _OMAP3_BALLENTRY(MCBSP2_DX, "r20", NULL),
1158 _OMAP3_BALLENTRY(MCBSP2_FSX, "v20", NULL),
1159 _OMAP3_BALLENTRY(MCBSP3_CLKX, "w4", NULL),
1160 _OMAP3_BALLENTRY(MCBSP3_DR, "v5", NULL),
1161 _OMAP3_BALLENTRY(MCBSP3_DX, "v6", NULL),
1162 _OMAP3_BALLENTRY(MCBSP3_FSX, "v4", NULL),
1163 _OMAP3_BALLENTRY(MCBSP_CLKS, "aa18", NULL),
1164 _OMAP3_BALLENTRY(MCSPI1_CLK, "t5", NULL),
1165 _OMAP3_BALLENTRY(MCSPI1_CS0, "t6", NULL),
1166 _OMAP3_BALLENTRY(MCSPI1_CS3, "r5", NULL),
1167 _OMAP3_BALLENTRY(MCSPI1_SIMO, "r4", NULL),
1168 _OMAP3_BALLENTRY(MCSPI1_SOMI, "t4", NULL),
1169 _OMAP3_BALLENTRY(MCSPI2_CLK, "n5", NULL),
1170 _OMAP3_BALLENTRY(MCSPI2_CS0, "m5", NULL),
1171 _OMAP3_BALLENTRY(MCSPI2_CS1, "m4", NULL),
1172 _OMAP3_BALLENTRY(MCSPI2_SIMO, "n4", NULL),
1173 _OMAP3_BALLENTRY(MCSPI2_SOMI, "n3", NULL),
1174 _OMAP3_BALLENTRY(SDMMC1_CLK, "m23", NULL),
1175 _OMAP3_BALLENTRY(SDMMC1_CMD, "l23", NULL),
1176 _OMAP3_BALLENTRY(SDMMC1_DAT0, "m22", NULL),
1177 _OMAP3_BALLENTRY(SDMMC1_DAT1, "m21", NULL),
1178 _OMAP3_BALLENTRY(SDMMC1_DAT2, "m20", NULL),
1179 _OMAP3_BALLENTRY(SDMMC1_DAT3, "n23", NULL),
1180 _OMAP3_BALLENTRY(SDMMC1_DAT4, "n22", NULL),
1181 _OMAP3_BALLENTRY(SDMMC1_DAT5, "n21", NULL),
1182 _OMAP3_BALLENTRY(SDMMC1_DAT6, "n20", NULL),
1183 _OMAP3_BALLENTRY(SDMMC1_DAT7, "p24", NULL),
1184 _OMAP3_BALLENTRY(SDMMC2_CLK, "y1", NULL),
1185 _OMAP3_BALLENTRY(SDMMC2_CMD, "ab5", NULL),
1186 _OMAP3_BALLENTRY(SDMMC2_DAT0, "ab3", NULL),
1187 _OMAP3_BALLENTRY(SDMMC2_DAT1, "y3", NULL),
1188 _OMAP3_BALLENTRY(SDMMC2_DAT2, "w3", NULL),
1189 _OMAP3_BALLENTRY(SDMMC2_DAT3, "v3", NULL),
1190 _OMAP3_BALLENTRY(SDMMC2_DAT4, "ab2", NULL),
1191 _OMAP3_BALLENTRY(SDMMC2_DAT5, "aa2", NULL),
1192 _OMAP3_BALLENTRY(SDMMC2_DAT6, "y2", NULL),
1193 _OMAP3_BALLENTRY(SDMMC2_DAT7, "aa1", NULL),
1194 _OMAP3_BALLENTRY(SYS_BOOT0, "ab12", NULL),
1195 _OMAP3_BALLENTRY(SYS_BOOT1, "ac16", NULL),
1196 _OMAP3_BALLENTRY(SYS_BOOT2, "ad17", NULL),
1197 _OMAP3_BALLENTRY(SYS_BOOT3, "ad18", NULL),
1198 _OMAP3_BALLENTRY(SYS_BOOT4, "ac17", NULL),
1199 _OMAP3_BALLENTRY(SYS_BOOT5, "ab16", NULL),
1200 _OMAP3_BALLENTRY(SYS_BOOT6, "aa15", NULL),
1201 _OMAP3_BALLENTRY(SYS_CLKOUT1, "y7", NULL),
1202 _OMAP3_BALLENTRY(SYS_CLKOUT2, "aa6", NULL),
1203 _OMAP3_BALLENTRY(SYS_CLKREQ, "y13", NULL),
1204 _OMAP3_BALLENTRY(SYS_NIRQ, "w16", NULL),
1205 _OMAP3_BALLENTRY(SYS_NRESWARM, "y10", NULL),
1206 _OMAP3_BALLENTRY(SYS_OFF_MODE, "ad23", NULL),
1207 _OMAP3_BALLENTRY(UART1_CTS, "ac2", NULL),
1208 _OMAP3_BALLENTRY(UART1_RTS, "w6", NULL),
1209 _OMAP3_BALLENTRY(UART1_RX, "v7", NULL),
1210 _OMAP3_BALLENTRY(UART1_TX, "w7", NULL),
1211 _OMAP3_BALLENTRY(UART3_CTS_RCTX, "a23", NULL),
1212 _OMAP3_BALLENTRY(UART3_RTS_SD, "b23", NULL),
1213 _OMAP3_BALLENTRY(UART3_RX_IRRX, "b24", NULL),
1214 _OMAP3_BALLENTRY(UART3_TX_IRTX, "c23", NULL),
1215 { .reg_offset = OMAP_MUX_TERMINATOR },
1216};
1217#else
1218#define omap3_cus_ball NULL
1219#endif
1220
1221/*
1222 * Signals different on CBB package comapared to superset
1223 */
1224#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_OMAP_PACKAGE_CBB)
1225struct omap_mux __initdata omap3_cbb_subset[] = {
1226 _OMAP3_MUXENTRY(CAM_D10, 109,
1227 "cam_d10", NULL, NULL, NULL,
1228 "gpio_109", NULL, NULL, "safe_mode"),
1229 _OMAP3_MUXENTRY(CAM_D11, 110,
1230 "cam_d11", NULL, NULL, NULL,
1231 "gpio_110", NULL, NULL, "safe_mode"),
1232 _OMAP3_MUXENTRY(CAM_D2, 101,
1233 "cam_d2", NULL, NULL, NULL,
1234 "gpio_101", NULL, NULL, "safe_mode"),
1235 _OMAP3_MUXENTRY(CAM_D3, 102,
1236 "cam_d3", NULL, NULL, NULL,
1237 "gpio_102", NULL, NULL, "safe_mode"),
1238 _OMAP3_MUXENTRY(CAM_D4, 103,
1239 "cam_d4", NULL, NULL, NULL,
1240 "gpio_103", NULL, NULL, "safe_mode"),
1241 _OMAP3_MUXENTRY(CAM_D5, 104,
1242 "cam_d5", NULL, NULL, NULL,
1243 "gpio_104", NULL, NULL, "safe_mode"),
1244 _OMAP3_MUXENTRY(CAM_FLD, 98,
1245 "cam_fld", NULL, "cam_global_reset", NULL,
1246 "gpio_98", NULL, NULL, "safe_mode"),
1247 _OMAP3_MUXENTRY(CAM_HS, 94,
1248 "cam_hs", NULL, NULL, NULL,
1249 "gpio_94", NULL, NULL, "safe_mode"),
1250 _OMAP3_MUXENTRY(CAM_PCLK, 97,
1251 "cam_pclk", NULL, NULL, NULL,
1252 "gpio_97", NULL, NULL, "safe_mode"),
1253 _OMAP3_MUXENTRY(CAM_STROBE, 126,
1254 "cam_strobe", NULL, NULL, NULL,
1255 "gpio_126", NULL, NULL, "safe_mode"),
1256 _OMAP3_MUXENTRY(CAM_VS, 95,
1257 "cam_vs", NULL, NULL, NULL,
1258 "gpio_95", NULL, NULL, "safe_mode"),
1259 _OMAP3_MUXENTRY(CAM_WEN, 167,
1260 "cam_wen", NULL, "cam_shutter", NULL,
1261 "gpio_167", NULL, NULL, "safe_mode"),
1262 _OMAP3_MUXENTRY(DSS_DATA6, 76,
1263 "dss_data6", NULL, "uart1_tx", NULL,
1264 "gpio_76", NULL, NULL, "safe_mode"),
1265 _OMAP3_MUXENTRY(DSS_DATA7, 77,
1266 "dss_data7", NULL, "uart1_rx", NULL,
1267 "gpio_77", NULL, NULL, "safe_mode"),
1268 _OMAP3_MUXENTRY(DSS_DATA8, 78,
1269 "dss_data8", NULL, NULL, NULL,
1270 "gpio_78", NULL, NULL, "safe_mode"),
1271 _OMAP3_MUXENTRY(DSS_DATA9, 79,
1272 "dss_data9", NULL, NULL, NULL,
1273 "gpio_79", NULL, NULL, "safe_mode"),
1274 _OMAP3_MUXENTRY(DSS_HSYNC, 67,
1275 "dss_hsync", NULL, NULL, NULL,
1276 "gpio_67", NULL, NULL, "safe_mode"),
1277 _OMAP3_MUXENTRY(DSS_PCLK, 66,
1278 "dss_pclk", NULL, NULL, NULL,
1279 "gpio_66", NULL, NULL, "safe_mode"),
1280 _OMAP3_MUXENTRY(ETK_CLK, 12,
1281 "etk_clk", "mcbsp5_clkx", "sdmmc3_clk", "hsusb1_stp",
1282 "gpio_12", "mm1_rxdp", "hsusb1_tll_stp", NULL),
1283 _OMAP3_MUXENTRY(ETK_CTL, 13,
1284 "etk_ctl", NULL, "sdmmc3_cmd", "hsusb1_clk",
1285 "gpio_13", NULL, "hsusb1_tll_clk", NULL),
1286 _OMAP3_MUXENTRY(ETK_D0, 14,
1287 "etk_d0", "mcspi3_simo", "sdmmc3_dat4", "hsusb1_data0",
1288 "gpio_14", "mm1_rxrcv", "hsusb1_tll_data0", NULL),
1289 _OMAP3_MUXENTRY(ETK_D1, 15,
1290 "etk_d1", "mcspi3_somi", NULL, "hsusb1_data1",
1291 "gpio_15", "mm1_txse0", "hsusb1_tll_data1", NULL),
1292 _OMAP3_MUXENTRY(ETK_D10, 24,
1293 "etk_d10", NULL, "uart1_rx", "hsusb2_clk",
1294 "gpio_24", NULL, "hsusb2_tll_clk", NULL),
1295 _OMAP3_MUXENTRY(ETK_D11, 25,
1296 "etk_d11", NULL, NULL, "hsusb2_stp",
1297 "gpio_25", "mm2_rxdp", "hsusb2_tll_stp", NULL),
1298 _OMAP3_MUXENTRY(ETK_D12, 26,
1299 "etk_d12", NULL, NULL, "hsusb2_dir",
1300 "gpio_26", NULL, "hsusb2_tll_dir", NULL),
1301 _OMAP3_MUXENTRY(ETK_D13, 27,
1302 "etk_d13", NULL, NULL, "hsusb2_nxt",
1303 "gpio_27", "mm2_rxdm", "hsusb2_tll_nxt", NULL),
1304 _OMAP3_MUXENTRY(ETK_D14, 28,
1305 "etk_d14", NULL, NULL, "hsusb2_data0",
1306 "gpio_28", "mm2_rxrcv", "hsusb2_tll_data0", NULL),
1307 _OMAP3_MUXENTRY(ETK_D15, 29,
1308 "etk_d15", NULL, NULL, "hsusb2_data1",
1309 "gpio_29", "mm2_txse0", "hsusb2_tll_data1", NULL),
1310 _OMAP3_MUXENTRY(ETK_D2, 16,
1311 "etk_d2", "mcspi3_cs0", NULL, "hsusb1_data2",
1312 "gpio_16", "mm1_txdat", "hsusb1_tll_data2", NULL),
1313 _OMAP3_MUXENTRY(ETK_D3, 17,
1314 "etk_d3", "mcspi3_clk", "sdmmc3_dat3", "hsusb1_data7",
1315 "gpio_17", NULL, "hsusb1_tll_data7", NULL),
1316 _OMAP3_MUXENTRY(ETK_D4, 18,
1317 "etk_d4", "mcbsp5_dr", "sdmmc3_dat0", "hsusb1_data4",
1318 "gpio_18", NULL, "hsusb1_tll_data4", NULL),
1319 _OMAP3_MUXENTRY(ETK_D5, 19,
1320 "etk_d5", "mcbsp5_fsx", "sdmmc3_dat1", "hsusb1_data5",
1321 "gpio_19", NULL, "hsusb1_tll_data5", NULL),
1322 _OMAP3_MUXENTRY(ETK_D6, 20,
1323 "etk_d6", "mcbsp5_dx", "sdmmc3_dat2", "hsusb1_data6",
1324 "gpio_20", NULL, "hsusb1_tll_data6", NULL),
1325 _OMAP3_MUXENTRY(ETK_D7, 21,
1326 "etk_d7", "mcspi3_cs1", "sdmmc3_dat7", "hsusb1_data3",
1327 "gpio_21", "mm1_txen_n", "hsusb1_tll_data3", NULL),
1328 _OMAP3_MUXENTRY(ETK_D8, 22,
1329 "etk_d8", "sys_drm_msecure", "sdmmc3_dat6", "hsusb1_dir",
1330 "gpio_22", NULL, "hsusb1_tll_dir", NULL),
1331 _OMAP3_MUXENTRY(ETK_D9, 23,
1332 "etk_d9", "sys_secure_indicator", "sdmmc3_dat5", "hsusb1_nxt",
1333 "gpio_23", "mm1_rxdm", "hsusb1_tll_nxt", NULL),
1334 { .reg_offset = OMAP_MUX_TERMINATOR },
1335};
1336#else
1337#define omap3_cbb_subset NULL
1338#endif
1339
1340/*
1341 * Balls for CBB package
1342 * 515-pin s-PBGA Package, 0.50mm Ball Pitch (Top), 0.40mm Ball Pitch (Bottom)
1343 */
1344#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_DEBUG_FS) \
1345 && defined(CONFIG_OMAP_PACKAGE_CBB)
1346struct omap_ball __initdata omap3_cbb_ball[] = {
1347 _OMAP3_BALLENTRY(CAM_D0, "ag17", NULL),
1348 _OMAP3_BALLENTRY(CAM_D1, "ah17", NULL),
1349 _OMAP3_BALLENTRY(CAM_D10, "b25", NULL),
1350 _OMAP3_BALLENTRY(CAM_D11, "c26", NULL),
1351 _OMAP3_BALLENTRY(CAM_D2, "b24", NULL),
1352 _OMAP3_BALLENTRY(CAM_D3, "c24", NULL),
1353 _OMAP3_BALLENTRY(CAM_D4, "d24", NULL),
1354 _OMAP3_BALLENTRY(CAM_D5, "a25", NULL),
1355 _OMAP3_BALLENTRY(CAM_D6, "k28", NULL),
1356 _OMAP3_BALLENTRY(CAM_D7, "l28", NULL),
1357 _OMAP3_BALLENTRY(CAM_D8, "k27", NULL),
1358 _OMAP3_BALLENTRY(CAM_D9, "l27", NULL),
1359 _OMAP3_BALLENTRY(CAM_FLD, "c23", NULL),
1360 _OMAP3_BALLENTRY(CAM_HS, "a24", NULL),
1361 _OMAP3_BALLENTRY(CAM_PCLK, "c27", NULL),
1362 _OMAP3_BALLENTRY(CAM_STROBE, "d25", NULL),
1363 _OMAP3_BALLENTRY(CAM_VS, "a23", NULL),
1364 _OMAP3_BALLENTRY(CAM_WEN, "b23", NULL),
1365 _OMAP3_BALLENTRY(CAM_XCLKA, "c25", NULL),
1366 _OMAP3_BALLENTRY(CAM_XCLKB, "b26", NULL),
1367 _OMAP3_BALLENTRY(CSI2_DX0, "ag19", NULL),
1368 _OMAP3_BALLENTRY(CSI2_DX1, "ag18", NULL),
1369 _OMAP3_BALLENTRY(CSI2_DY0, "ah19", NULL),
1370 _OMAP3_BALLENTRY(CSI2_DY1, "ah18", NULL),
1371 _OMAP3_BALLENTRY(DSS_ACBIAS, "e27", NULL),
1372 _OMAP3_BALLENTRY(DSS_DATA0, "ag22", NULL),
1373 _OMAP3_BALLENTRY(DSS_DATA1, "ah22", NULL),
1374 _OMAP3_BALLENTRY(DSS_DATA10, "ad28", NULL),
1375 _OMAP3_BALLENTRY(DSS_DATA11, "ad27", NULL),
1376 _OMAP3_BALLENTRY(DSS_DATA12, "ab28", NULL),
1377 _OMAP3_BALLENTRY(DSS_DATA13, "ab27", NULL),
1378 _OMAP3_BALLENTRY(DSS_DATA14, "aa28", NULL),
1379 _OMAP3_BALLENTRY(DSS_DATA15, "aa27", NULL),
1380 _OMAP3_BALLENTRY(DSS_DATA16, "g25", NULL),
1381 _OMAP3_BALLENTRY(DSS_DATA17, "h27", NULL),
1382 _OMAP3_BALLENTRY(DSS_DATA18, "h26", NULL),
1383 _OMAP3_BALLENTRY(DSS_DATA19, "h25", NULL),
1384 _OMAP3_BALLENTRY(DSS_DATA2, "ag23", NULL),
1385 _OMAP3_BALLENTRY(DSS_DATA20, "e28", NULL),
1386 _OMAP3_BALLENTRY(DSS_DATA21, "j26", NULL),
1387 _OMAP3_BALLENTRY(DSS_DATA22, "ac27", NULL),
1388 _OMAP3_BALLENTRY(DSS_DATA23, "ac28", NULL),
1389 _OMAP3_BALLENTRY(DSS_DATA3, "ah23", NULL),
1390 _OMAP3_BALLENTRY(DSS_DATA4, "ag24", NULL),
1391 _OMAP3_BALLENTRY(DSS_DATA5, "ah24", NULL),
1392 _OMAP3_BALLENTRY(DSS_DATA6, "e26", NULL),
1393 _OMAP3_BALLENTRY(DSS_DATA7, "f28", NULL),
1394 _OMAP3_BALLENTRY(DSS_DATA8, "f27", NULL),
1395 _OMAP3_BALLENTRY(DSS_DATA9, "g26", NULL),
1396 _OMAP3_BALLENTRY(DSS_HSYNC, "d26", NULL),
1397 _OMAP3_BALLENTRY(DSS_PCLK, "d28", NULL),
1398 _OMAP3_BALLENTRY(DSS_VSYNC, "d27", NULL),
1399 _OMAP3_BALLENTRY(ETK_CLK, "af10", NULL),
1400 _OMAP3_BALLENTRY(ETK_CTL, "ae10", NULL),
1401 _OMAP3_BALLENTRY(ETK_D0, "af11", NULL),
1402 _OMAP3_BALLENTRY(ETK_D1, "ag12", NULL),
1403 _OMAP3_BALLENTRY(ETK_D10, "ae7", NULL),
1404 _OMAP3_BALLENTRY(ETK_D11, "af7", NULL),
1405 _OMAP3_BALLENTRY(ETK_D12, "ag7", NULL),
1406 _OMAP3_BALLENTRY(ETK_D13, "ah7", NULL),
1407 _OMAP3_BALLENTRY(ETK_D14, "ag8", NULL),
1408 _OMAP3_BALLENTRY(ETK_D15, "ah8", NULL),
1409 _OMAP3_BALLENTRY(ETK_D2, "ah12", NULL),
1410 _OMAP3_BALLENTRY(ETK_D3, "ae13", NULL),
1411 _OMAP3_BALLENTRY(ETK_D4, "ae11", NULL),
1412 _OMAP3_BALLENTRY(ETK_D5, "ah9", NULL),
1413 _OMAP3_BALLENTRY(ETK_D6, "af13", NULL),
1414 _OMAP3_BALLENTRY(ETK_D7, "ah14", NULL),
1415 _OMAP3_BALLENTRY(ETK_D8, "af9", NULL),
1416 _OMAP3_BALLENTRY(ETK_D9, "ag9", NULL),
1417 _OMAP3_BALLENTRY(GPMC_A1, "n4", "ac15"),
1418 _OMAP3_BALLENTRY(GPMC_A10, "k3", "ab19"),
1419 _OMAP3_BALLENTRY(GPMC_A2, "m4", "ab15"),
1420 _OMAP3_BALLENTRY(GPMC_A3, "l4", "ac16"),
1421 _OMAP3_BALLENTRY(GPMC_A4, "k4", "ab16"),
1422 _OMAP3_BALLENTRY(GPMC_A5, "t3", "ac17"),
1423 _OMAP3_BALLENTRY(GPMC_A6, "r3", "ab17"),
1424 _OMAP3_BALLENTRY(GPMC_A7, "n3", "ac18"),
1425 _OMAP3_BALLENTRY(GPMC_A8, "m3", "ab18"),
1426 _OMAP3_BALLENTRY(GPMC_A9, "l3", "ac19"),
1427 _OMAP3_BALLENTRY(GPMC_CLK, "t4", "w2"),
1428 _OMAP3_BALLENTRY(GPMC_D10, "p1", "ab4"),
1429 _OMAP3_BALLENTRY(GPMC_D11, "r1", "ac4"),
1430 _OMAP3_BALLENTRY(GPMC_D12, "r2", "ab6"),
1431 _OMAP3_BALLENTRY(GPMC_D13, "t2", "ac6"),
1432 _OMAP3_BALLENTRY(GPMC_D14, "w1", "ab7"),
1433 _OMAP3_BALLENTRY(GPMC_D15, "y1", "ac7"),
1434 _OMAP3_BALLENTRY(GPMC_D8, "h2", "ab3"),
1435 _OMAP3_BALLENTRY(GPMC_D9, "k2", "ac3"),
1436 _OMAP3_BALLENTRY(GPMC_NBE0_CLE, "g3", "ac12"),
1437 _OMAP3_BALLENTRY(GPMC_NBE1, "u3", NULL),
1438 _OMAP3_BALLENTRY(GPMC_NCS1, "h3", "y1"),
1439 _OMAP3_BALLENTRY(GPMC_NCS2, "v8", NULL),
1440 _OMAP3_BALLENTRY(GPMC_NCS3, "u8", NULL),
1441 _OMAP3_BALLENTRY(GPMC_NCS4, "t8", NULL),
1442 _OMAP3_BALLENTRY(GPMC_NCS5, "r8", NULL),
1443 _OMAP3_BALLENTRY(GPMC_NCS6, "p8", NULL),
1444 _OMAP3_BALLENTRY(GPMC_NCS7, "n8", NULL),
1445 _OMAP3_BALLENTRY(GPMC_NWP, "h1", "ab10"),
1446 _OMAP3_BALLENTRY(GPMC_WAIT1, "l8", "ac10"),
1447 _OMAP3_BALLENTRY(GPMC_WAIT2, "k8", NULL),
1448 _OMAP3_BALLENTRY(GPMC_WAIT3, "j8", NULL),
1449 _OMAP3_BALLENTRY(HDQ_SIO, "j25", NULL),
1450 _OMAP3_BALLENTRY(HSUSB0_CLK, "t28", NULL),
1451 _OMAP3_BALLENTRY(HSUSB0_DATA0, "t27", NULL),
1452 _OMAP3_BALLENTRY(HSUSB0_DATA1, "u28", NULL),
1453 _OMAP3_BALLENTRY(HSUSB0_DATA2, "u27", NULL),
1454 _OMAP3_BALLENTRY(HSUSB0_DATA3, "u26", NULL),
1455 _OMAP3_BALLENTRY(HSUSB0_DATA4, "u25", NULL),
1456 _OMAP3_BALLENTRY(HSUSB0_DATA5, "v28", NULL),
1457 _OMAP3_BALLENTRY(HSUSB0_DATA6, "v27", NULL),
1458 _OMAP3_BALLENTRY(HSUSB0_DATA7, "v26", NULL),
1459 _OMAP3_BALLENTRY(HSUSB0_DIR, "r28", NULL),
1460 _OMAP3_BALLENTRY(HSUSB0_NXT, "t26", NULL),
1461 _OMAP3_BALLENTRY(HSUSB0_STP, "t25", NULL),
1462 _OMAP3_BALLENTRY(I2C2_SCL, "af15", NULL),
1463 _OMAP3_BALLENTRY(I2C2_SDA, "ae15", NULL),
1464 _OMAP3_BALLENTRY(I2C3_SCL, "af14", NULL),
1465 _OMAP3_BALLENTRY(I2C3_SDA, "ag14", NULL),
1466 _OMAP3_BALLENTRY(I2C4_SCL, "ad26", NULL),
1467 _OMAP3_BALLENTRY(I2C4_SDA, "ae26", NULL),
1468 _OMAP3_BALLENTRY(JTAG_EMU0, "aa11", NULL),
1469 _OMAP3_BALLENTRY(JTAG_EMU1, "aa10", NULL),
1470 _OMAP3_BALLENTRY(MCBSP1_CLKR, "y21", NULL),
1471 _OMAP3_BALLENTRY(MCBSP1_CLKX, "w21", NULL),
1472 _OMAP3_BALLENTRY(MCBSP1_DR, "u21", NULL),
1473 _OMAP3_BALLENTRY(MCBSP1_DX, "v21", NULL),
1474 _OMAP3_BALLENTRY(MCBSP1_FSR, "aa21", NULL),
1475 _OMAP3_BALLENTRY(MCBSP1_FSX, "k26", NULL),
1476 _OMAP3_BALLENTRY(MCBSP2_CLKX, "n21", NULL),
1477 _OMAP3_BALLENTRY(MCBSP2_DR, "r21", NULL),
1478 _OMAP3_BALLENTRY(MCBSP2_DX, "m21", NULL),
1479 _OMAP3_BALLENTRY(MCBSP2_FSX, "p21", NULL),
1480 _OMAP3_BALLENTRY(MCBSP3_CLKX, "af5", NULL),
1481 _OMAP3_BALLENTRY(MCBSP3_DR, "ae6", NULL),
1482 _OMAP3_BALLENTRY(MCBSP3_DX, "af6", NULL),
1483 _OMAP3_BALLENTRY(MCBSP3_FSX, "ae5", NULL),
1484 _OMAP3_BALLENTRY(MCBSP4_CLKX, "ae1", NULL),
1485 _OMAP3_BALLENTRY(MCBSP4_DR, "ad1", NULL),
1486 _OMAP3_BALLENTRY(MCBSP4_DX, "ad2", NULL),
1487 _OMAP3_BALLENTRY(MCBSP4_FSX, "ac1", NULL),
1488 _OMAP3_BALLENTRY(MCBSP_CLKS, "t21", NULL),
1489 _OMAP3_BALLENTRY(MCSPI1_CLK, "ab3", NULL),
1490 _OMAP3_BALLENTRY(MCSPI1_CS0, "ac2", NULL),
1491 _OMAP3_BALLENTRY(MCSPI1_CS1, "ac3", NULL),
1492 _OMAP3_BALLENTRY(MCSPI1_CS2, "ab1", NULL),
1493 _OMAP3_BALLENTRY(MCSPI1_CS3, "ab2", NULL),
1494 _OMAP3_BALLENTRY(MCSPI1_SIMO, "ab4", NULL),
1495 _OMAP3_BALLENTRY(MCSPI1_SOMI, "aa4", NULL),
1496 _OMAP3_BALLENTRY(MCSPI2_CLK, "aa3", NULL),
1497 _OMAP3_BALLENTRY(MCSPI2_CS0, "y4", NULL),
1498 _OMAP3_BALLENTRY(MCSPI2_CS1, "v3", NULL),
1499 _OMAP3_BALLENTRY(MCSPI2_SIMO, "y2", NULL),
1500 _OMAP3_BALLENTRY(MCSPI2_SOMI, "y3", NULL),
1501 _OMAP3_BALLENTRY(SDMMC1_CLK, "n28", NULL),
1502 _OMAP3_BALLENTRY(SDMMC1_CMD, "m27", NULL),
1503 _OMAP3_BALLENTRY(SDMMC1_DAT0, "n27", NULL),
1504 _OMAP3_BALLENTRY(SDMMC1_DAT1, "n26", NULL),
1505 _OMAP3_BALLENTRY(SDMMC1_DAT2, "n25", NULL),
1506 _OMAP3_BALLENTRY(SDMMC1_DAT3, "p28", NULL),
1507 _OMAP3_BALLENTRY(SDMMC1_DAT4, "p27", NULL),
1508 _OMAP3_BALLENTRY(SDMMC1_DAT5, "p26", NULL),
1509 _OMAP3_BALLENTRY(SDMMC1_DAT6, "r27", NULL),
1510 _OMAP3_BALLENTRY(SDMMC1_DAT7, "r25", NULL),
1511 _OMAP3_BALLENTRY(SDMMC2_CLK, "ae2", NULL),
1512 _OMAP3_BALLENTRY(SDMMC2_CMD, "ag5", NULL),
1513 _OMAP3_BALLENTRY(SDMMC2_DAT0, "ah5", NULL),
1514 _OMAP3_BALLENTRY(SDMMC2_DAT1, "ah4", NULL),
1515 _OMAP3_BALLENTRY(SDMMC2_DAT2, "ag4", NULL),
1516 _OMAP3_BALLENTRY(SDMMC2_DAT3, "af4", NULL),
1517 _OMAP3_BALLENTRY(SDMMC2_DAT4, "ae4", NULL),
1518 _OMAP3_BALLENTRY(SDMMC2_DAT5, "ah3", NULL),
1519 _OMAP3_BALLENTRY(SDMMC2_DAT6, "af3", NULL),
1520 _OMAP3_BALLENTRY(SDMMC2_DAT7, "ae3", NULL),
1521 _OMAP3_BALLENTRY(SYS_BOOT0, "ah26", NULL),
1522 _OMAP3_BALLENTRY(SYS_BOOT1, "ag26", NULL),
1523 _OMAP3_BALLENTRY(SYS_BOOT2, "ae14", NULL),
1524 _OMAP3_BALLENTRY(SYS_BOOT3, "af18", NULL),
1525 _OMAP3_BALLENTRY(SYS_BOOT4, "af19", NULL),
1526 _OMAP3_BALLENTRY(SYS_BOOT5, "ae21", NULL),
1527 _OMAP3_BALLENTRY(SYS_BOOT6, "af21", NULL),
1528 _OMAP3_BALLENTRY(SYS_CLKOUT1, "ag25", NULL),
1529 _OMAP3_BALLENTRY(SYS_CLKOUT2, "ae22", NULL),
1530 _OMAP3_BALLENTRY(SYS_CLKREQ, "af25", NULL),
1531 _OMAP3_BALLENTRY(SYS_NIRQ, "af26", NULL),
1532 _OMAP3_BALLENTRY(SYS_NRESWARM, "af24", NULL),
1533 _OMAP3_BALLENTRY(SYS_OFF_MODE, "af22", NULL),
1534 _OMAP3_BALLENTRY(UART1_CTS, "w8", NULL),
1535 _OMAP3_BALLENTRY(UART1_RTS, "aa9", NULL),
1536 _OMAP3_BALLENTRY(UART1_RX, "y8", NULL),
1537 _OMAP3_BALLENTRY(UART1_TX, "aa8", NULL),
1538 _OMAP3_BALLENTRY(UART2_CTS, "ab26", NULL),
1539 _OMAP3_BALLENTRY(UART2_RTS, "ab25", NULL),
1540 _OMAP3_BALLENTRY(UART2_RX, "ad25", NULL),
1541 _OMAP3_BALLENTRY(UART2_TX, "aa25", NULL),
1542 _OMAP3_BALLENTRY(UART3_CTS_RCTX, "h18", NULL),
1543 _OMAP3_BALLENTRY(UART3_RTS_SD, "h19", NULL),
1544 _OMAP3_BALLENTRY(UART3_RX_IRRX, "h20", NULL),
1545 _OMAP3_BALLENTRY(UART3_TX_IRTX, "h21", NULL),
1546 { .reg_offset = OMAP_MUX_TERMINATOR },
1547};
1548#else
1549#define omap3_cbb_ball NULL
1550#endif
1551
1552/*
1553 * Signals different on 36XX CBP package comapared to 34XX CBC package
1554 */
1555#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_OMAP_PACKAGE_CBP)
1556struct omap_mux __initdata omap36xx_cbp_subset[] = {
1557 _OMAP3_MUXENTRY(CAM_D0, 99,
1558 "cam_d0", NULL, "csi2_dx2", NULL,
1559 "gpio_99", NULL, NULL, "safe_mode"),
1560 _OMAP3_MUXENTRY(CAM_D1, 100,
1561 "cam_d1", NULL, "csi2_dy2", NULL,
1562 "gpio_100", NULL, NULL, "safe_mode"),
1563 _OMAP3_MUXENTRY(CAM_D10, 109,
1564 "cam_d10", "ssi2_wake", NULL, NULL,
1565 "gpio_109", "hw_dbg8", NULL, "safe_mode"),
1566 _OMAP3_MUXENTRY(CAM_D2, 101,
1567 "cam_d2", "ssi2_rdy_tx", NULL, NULL,
1568 "gpio_101", "hw_dbg4", NULL, "safe_mode"),
1569 _OMAP3_MUXENTRY(CAM_D3, 102,
1570 "cam_d3", "ssi2_dat_rx", NULL, NULL,
1571 "gpio_102", "hw_dbg5", NULL, "safe_mode"),
1572 _OMAP3_MUXENTRY(CAM_D4, 103,
1573 "cam_d4", "ssi2_flag_rx", NULL, NULL,
1574 "gpio_103", "hw_dbg6", NULL, "safe_mode"),
1575 _OMAP3_MUXENTRY(CAM_D5, 104,
1576 "cam_d5", "ssi2_rdy_rx", NULL, NULL,
1577 "gpio_104", "hw_dbg7", NULL, "safe_mode"),
1578 _OMAP3_MUXENTRY(CAM_HS, 94,
1579 "cam_hs", "ssi2_dat_tx", NULL, NULL,
1580 "gpio_94", "hw_dbg0", NULL, "safe_mode"),
1581 _OMAP3_MUXENTRY(CAM_VS, 95,
1582 "cam_vs", "ssi2_flag_tx", NULL, NULL,
1583 "gpio_95", "hw_dbg1", NULL, "safe_mode"),
1584 _OMAP3_MUXENTRY(DSS_DATA0, 70,
1585 "dss_data0", "dsi_dx0", "uart1_cts", NULL,
1586 "gpio_70", NULL, NULL, "safe_mode"),
1587 _OMAP3_MUXENTRY(DSS_DATA1, 71,
1588 "dss_data1", "dsi_dy0", "uart1_rts", NULL,
1589 "gpio_71", NULL, NULL, "safe_mode"),
1590 _OMAP3_MUXENTRY(DSS_DATA2, 72,
1591 "dss_data2", "dsi_dx1", NULL, NULL,
1592 "gpio_72", NULL, NULL, "safe_mode"),
1593 _OMAP3_MUXENTRY(DSS_DATA3, 73,
1594 "dss_data3", "dsi_dy1", NULL, NULL,
1595 "gpio_73", NULL, NULL, "safe_mode"),
1596 _OMAP3_MUXENTRY(DSS_DATA4, 74,
1597 "dss_data4", "dsi_dx2", "uart3_rx_irrx", NULL,
1598 "gpio_74", NULL, NULL, "safe_mode"),
1599 _OMAP3_MUXENTRY(DSS_DATA5, 75,
1600 "dss_data5", "dsi_dy2", "uart3_tx_irtx", NULL,
1601 "gpio_75", NULL, NULL, "safe_mode"),
1602 _OMAP3_MUXENTRY(DSS_DATA6, 76,
1603 "dss_data6", NULL, "uart1_tx", "dssvenc656_data6",
1604 "gpio_76", "hw_dbg14", NULL, "safe_mode"),
1605 _OMAP3_MUXENTRY(DSS_DATA7, 77,
1606 "dss_data7", NULL, "uart1_rx", "dssvenc656_data7",
1607 "gpio_77", "hw_dbg15", NULL, "safe_mode"),
1608 _OMAP3_MUXENTRY(DSS_DATA8, 78,
1609 "dss_data8", NULL, "uart3_rx_irrx", NULL,
1610 "gpio_78", "hw_dbg16", NULL, "safe_mode"),
1611 _OMAP3_MUXENTRY(DSS_DATA9, 79,
1612 "dss_data9", NULL, "uart3_tx_irtx", NULL,
1613 "gpio_79", "hw_dbg17", NULL, "safe_mode"),
1614 _OMAP3_MUXENTRY(ETK_D12, 26,
1615 "etk_d12", "sys_drm_msecure", NULL, "hsusb2_dir",
1616 "gpio_26", NULL, "hsusb2_tll_dir", "hw_dbg14"),
1617 _OMAP3_MUXENTRY(GPMC_A11, 0,
1618 "gpmc_a11", NULL, NULL, NULL,
1619 NULL, NULL, NULL, "safe_mode"),
1620 _OMAP3_MUXENTRY(GPMC_WAIT2, 64,
1621 "gpmc_wait2", NULL, "uart4_tx", NULL,
1622 "gpio_64", NULL, NULL, "safe_mode"),
1623 _OMAP3_MUXENTRY(GPMC_WAIT3, 65,
1624 "gpmc_wait3", "sys_ndmareq1", "uart4_rx", NULL,
1625 "gpio_65", NULL, NULL, "safe_mode"),
1626 _OMAP3_MUXENTRY(HSUSB0_DATA0, 125,
1627 "hsusb0_data0", NULL, "uart3_tx_irtx", NULL,
1628 "gpio_125", "uart2_tx", NULL, "safe_mode"),
1629 _OMAP3_MUXENTRY(HSUSB0_DATA1, 130,
1630 "hsusb0_data1", NULL, "uart3_rx_irrx", NULL,
1631 "gpio_130", "uart2_rx", NULL, "safe_mode"),
1632 _OMAP3_MUXENTRY(HSUSB0_DATA2, 131,
1633 "hsusb0_data2", NULL, "uart3_rts_sd", NULL,
1634 "gpio_131", "uart2_rts", NULL, "safe_mode"),
1635 _OMAP3_MUXENTRY(HSUSB0_DATA3, 169,
1636 "hsusb0_data3", NULL, "uart3_cts_rctx", NULL,
1637 "gpio_169", "uart2_cts", NULL, "safe_mode"),
1638 _OMAP3_MUXENTRY(MCBSP1_CLKR, 156,
1639 "mcbsp1_clkr", "mcspi4_clk", "sim_cd", NULL,
1640 "gpio_156", NULL, NULL, "safe_mode"),
1641 _OMAP3_MUXENTRY(MCBSP1_FSR, 157,
1642 "mcbsp1_fsr", "adpllv2d_dithering_en1",
1643 "cam_global_reset", NULL,
1644 "gpio_157", NULL, NULL, "safe_mode"),
1645 _OMAP3_MUXENTRY(MCBSP4_CLKX, 152,
1646 "mcbsp4_clkx", "ssi1_dat_rx", NULL, NULL,
1647 "gpio_152", "hsusb3_tll_data1", "mm3_txse0", "safe_mode"),
1648 _OMAP3_MUXENTRY(MCBSP4_DR, 153,
1649 "mcbsp4_dr", "ssi1_flag_rx", NULL, NULL,
1650 "gpio_153", "hsusb3_tll_data0", "mm3_rxrcv", "safe_mode"),
1651 _OMAP3_MUXENTRY(MCBSP4_DX, 154,
1652 "mcbsp4_dx", "ssi1_rdy_rx", NULL, NULL,
1653 "gpio_154", "hsusb3_tll_data2", "mm3_txdat", "safe_mode"),
1654 _OMAP3_MUXENTRY(MCBSP4_FSX, 155,
1655 "mcbsp4_fsx", "ssi1_wake", NULL, NULL,
1656 "gpio_155", "hsusb3_tll_data3", "mm3_txen_n", "safe_mode"),
1657 _OMAP3_MUXENTRY(MCSPI1_CS1, 175,
1658 "mcspi1_cs1", "adpllv2d_dithering_en2", NULL, "sdmmc3_cmd",
1659 "gpio_175", NULL, NULL, "safe_mode"),
1660 _OMAP3_MUXENTRY(SAD2D_MBUSFLAG, 0,
1661 "sad2d_mbusflag", "mad2d_sbusflag", NULL, NULL,
1662 NULL, NULL, NULL, NULL),
1663 _OMAP3_MUXENTRY(SAD2D_MCAD28, 0,
1664 "sad2d_mcad28", "mad2d_mcad28", NULL, NULL,
1665 NULL, NULL, NULL, NULL),
1666 _OMAP3_MUXENTRY(SAD2D_MCAD29, 0,
1667 "sad2d_mcad29", "mad2d_mcad29", NULL, NULL,
1668 NULL, NULL, NULL, NULL),
1669 _OMAP3_MUXENTRY(SAD2D_MCAD32, 0,
1670 "sad2d_mcad32", "mad2d_mcad32", NULL, NULL,
1671 NULL, NULL, NULL, NULL),
1672 _OMAP3_MUXENTRY(SAD2D_MCAD33, 0,
1673 "sad2d_mcad33", "mad2d_mcad33", NULL, NULL,
1674 NULL, NULL, NULL, NULL),
1675 _OMAP3_MUXENTRY(SAD2D_MCAD34, 0,
1676 "sad2d_mcad34", "mad2d_mcad34", NULL, NULL,
1677 NULL, NULL, NULL, NULL),
1678 _OMAP3_MUXENTRY(SAD2D_MCAD35, 0,
1679 "sad2d_mcad35", "mad2d_mcad35", NULL, NULL,
1680 NULL, NULL, NULL, NULL),
1681 _OMAP3_MUXENTRY(SAD2D_MCAD36, 0,
1682 "sad2d_mcad36", "mad2d_mcad36", NULL, NULL,
1683 NULL, NULL, NULL, NULL),
1684 _OMAP3_MUXENTRY(SAD2D_MREAD, 0,
1685 "sad2d_mread", "mad2d_sread", NULL, NULL,
1686 NULL, NULL, NULL, NULL),
1687 _OMAP3_MUXENTRY(SAD2D_MWRITE, 0,
1688 "sad2d_mwrite", "mad2d_swrite", NULL, NULL,
1689 NULL, NULL, NULL, NULL),
1690 _OMAP3_MUXENTRY(SAD2D_SBUSFLAG, 0,
1691 "sad2d_sbusflag", "mad2d_mbusflag", NULL, NULL,
1692 NULL, NULL, NULL, NULL),
1693 _OMAP3_MUXENTRY(SAD2D_SREAD, 0,
1694 "sad2d_sread", "mad2d_mread", NULL, NULL,
1695 NULL, NULL, NULL, NULL),
1696 _OMAP3_MUXENTRY(SAD2D_SWRITE, 0,
1697 "sad2d_swrite", "mad2d_mwrite", NULL, NULL,
1698 NULL, NULL, NULL, NULL),
1699 _OMAP3_MUXENTRY(SDMMC1_CLK, 120,
1700 "sdmmc1_clk", "ms_clk", NULL, NULL,
1701 "gpio_120", NULL, NULL, "safe_mode"),
1702 _OMAP3_MUXENTRY(SDMMC1_CMD, 121,
1703 "sdmmc1_cmd", "ms_bs", NULL, NULL,
1704 "gpio_121", NULL, NULL, "safe_mode"),
1705 _OMAP3_MUXENTRY(SDMMC1_DAT0, 122,
1706 "sdmmc1_dat0", "ms_dat0", NULL, NULL,
1707 "gpio_122", NULL, NULL, "safe_mode"),
1708 _OMAP3_MUXENTRY(SDMMC1_DAT1, 123,
1709 "sdmmc1_dat1", "ms_dat1", NULL, NULL,
1710 "gpio_123", NULL, NULL, "safe_mode"),
1711 _OMAP3_MUXENTRY(SDMMC1_DAT2, 124,
1712 "sdmmc1_dat2", "ms_dat2", NULL, NULL,
1713 "gpio_124", NULL, NULL, "safe_mode"),
1714 _OMAP3_MUXENTRY(SDMMC1_DAT3, 125,
1715 "sdmmc1_dat3", "ms_dat3", NULL, NULL,
1716 "gpio_125", NULL, NULL, "safe_mode"),
1717 _OMAP3_MUXENTRY(SDRC_CKE0, 0,
1718 "sdrc_cke0", NULL, NULL, NULL,
1719 NULL, NULL, NULL, "safe_mode_out1"),
1720 _OMAP3_MUXENTRY(SDRC_CKE1, 0,
1721 "sdrc_cke1", NULL, NULL, NULL,
1722 NULL, NULL, NULL, "safe_mode_out1"),
1723 _OMAP3_MUXENTRY(SIM_IO, 126,
1724 "sim_io", "sim_io_low_impedance", NULL, NULL,
1725 "gpio_126", NULL, NULL, "safe_mode"),
1726 _OMAP3_MUXENTRY(SIM_CLK, 127,
1727 "sim_clk", NULL, NULL, NULL,
1728 "gpio_127", NULL, NULL, "safe_mode"),
1729 _OMAP3_MUXENTRY(SIM_PWRCTRL, 128,
1730 "sim_pwrctrl", NULL, NULL, NULL,
1731 "gpio_128", NULL, NULL, "safe_mode"),
1732 _OMAP3_MUXENTRY(SIM_RST, 129,
1733 "sim_rst", NULL, NULL, NULL,
1734 "gpio_129", NULL, NULL, "safe_mode"),
1735 _OMAP3_MUXENTRY(SYS_BOOT0, 2,
1736 "sys_boot0", NULL, NULL, "dss_data18",
1737 "gpio_2", NULL, NULL, "safe_mode"),
1738 _OMAP3_MUXENTRY(SYS_BOOT1, 3,
1739 "sys_boot1", NULL, NULL, "dss_data19",
1740 "gpio_3", NULL, NULL, "safe_mode"),
1741 _OMAP3_MUXENTRY(SYS_BOOT3, 5,
1742 "sys_boot3", NULL, NULL, "dss_data20",
1743 "gpio_5", NULL, NULL, "safe_mode"),
1744 _OMAP3_MUXENTRY(SYS_BOOT4, 6,
1745 "sys_boot4", "sdmmc2_dir_dat2", NULL, "dss_data21",
1746 "gpio_6", NULL, NULL, "safe_mode"),
1747 _OMAP3_MUXENTRY(SYS_BOOT5, 7,
1748 "sys_boot5", "sdmmc2_dir_dat3", NULL, "dss_data22",
1749 "gpio_7", NULL, NULL, "safe_mode"),
1750 _OMAP3_MUXENTRY(SYS_BOOT6, 8,
1751 "sys_boot6", NULL, NULL, "dss_data23",
1752 "gpio_8", NULL, NULL, "safe_mode"),
1753 _OMAP3_MUXENTRY(UART1_CTS, 150,
1754 "uart1_cts", "ssi1_rdy_tx", NULL, NULL,
1755 "gpio_150", "hsusb3_tll_clk", NULL, "safe_mode"),
1756 _OMAP3_MUXENTRY(UART1_RTS, 149,
1757 "uart1_rts", "ssi1_flag_tx", NULL, NULL,
1758 "gpio_149", NULL, NULL, "safe_mode"),
1759 _OMAP3_MUXENTRY(UART1_TX, 148,
1760 "uart1_tx", "ssi1_dat_tx", NULL, NULL,
1761 "gpio_148", NULL, NULL, "safe_mode"),
1762 { .reg_offset = OMAP_MUX_TERMINATOR },
1763};
1764#else
1765#define omap36xx_cbp_subset NULL
1766#endif
1767
1768/*
1769 * Balls for 36XX CBP package
1770 * 515-pin s-PBGA Package, 0.50mm Ball Pitch (Top), 0.40mm Ball Pitch (Bottom)
1771 */
1772#if defined(CONFIG_OMAP_MUX) && defined(CONFIG_DEBUG_FS) \
1773 && defined (CONFIG_OMAP_PACKAGE_CBP)
1774struct omap_ball __initdata omap36xx_cbp_ball[] = {
1775 _OMAP3_BALLENTRY(CAM_D0, "ag17", NULL),
1776 _OMAP3_BALLENTRY(CAM_D1, "ah17", NULL),
1777 _OMAP3_BALLENTRY(CAM_D10, "b25", NULL),
1778 _OMAP3_BALLENTRY(CAM_D11, "c26", NULL),
1779 _OMAP3_BALLENTRY(CAM_D2, "b24", NULL),
1780 _OMAP3_BALLENTRY(CAM_D3, "c24", NULL),
1781 _OMAP3_BALLENTRY(CAM_D4, "d24", NULL),
1782 _OMAP3_BALLENTRY(CAM_D5, "a25", NULL),
1783 _OMAP3_BALLENTRY(CAM_D6, "k28", NULL),
1784 _OMAP3_BALLENTRY(CAM_D7, "l28", NULL),
1785 _OMAP3_BALLENTRY(CAM_D8, "k27", NULL),
1786 _OMAP3_BALLENTRY(CAM_D9, "l27", NULL),
1787 _OMAP3_BALLENTRY(CAM_FLD, "c23", NULL),
1788 _OMAP3_BALLENTRY(CAM_HS, "a24", NULL),
1789 _OMAP3_BALLENTRY(CAM_PCLK, "c27", NULL),
1790 _OMAP3_BALLENTRY(CAM_STROBE, "d25", NULL),
1791 _OMAP3_BALLENTRY(CAM_VS, "a23", NULL),
1792 _OMAP3_BALLENTRY(CAM_WEN, "b23", NULL),
1793 _OMAP3_BALLENTRY(CAM_XCLKA, "c25", NULL),
1794 _OMAP3_BALLENTRY(CAM_XCLKB, "b26", NULL),
1795 _OMAP3_BALLENTRY(CSI2_DX0, "ag19", NULL),
1796 _OMAP3_BALLENTRY(CSI2_DX1, "ag18", NULL),
1797 _OMAP3_BALLENTRY(CSI2_DY0, "ah19", NULL),
1798 _OMAP3_BALLENTRY(CSI2_DY1, "ah18", NULL),
1799 _OMAP3_BALLENTRY(DSS_ACBIAS, "e27", NULL),
1800 _OMAP3_BALLENTRY(DSS_DATA0, "ag22", NULL),
1801 _OMAP3_BALLENTRY(DSS_DATA1, "ah22", NULL),
1802 _OMAP3_BALLENTRY(DSS_DATA10, "ad28", NULL),
1803 _OMAP3_BALLENTRY(DSS_DATA11, "ad27", NULL),
1804 _OMAP3_BALLENTRY(DSS_DATA12, "ab28", NULL),
1805 _OMAP3_BALLENTRY(DSS_DATA13, "ab27", NULL),
1806 _OMAP3_BALLENTRY(DSS_DATA14, "aa28", NULL),
1807 _OMAP3_BALLENTRY(DSS_DATA15, "aa27", NULL),
1808 _OMAP3_BALLENTRY(DSS_DATA16, "g25", NULL),
1809 _OMAP3_BALLENTRY(DSS_DATA17, "h27", NULL),
1810 _OMAP3_BALLENTRY(DSS_DATA18, "h26", NULL),
1811 _OMAP3_BALLENTRY(DSS_DATA19, "h25", NULL),
1812 _OMAP3_BALLENTRY(DSS_DATA2, "ag23", NULL),
1813 _OMAP3_BALLENTRY(DSS_DATA20, "e28", NULL),
1814 _OMAP3_BALLENTRY(DSS_DATA21, "j26", NULL),
1815 _OMAP3_BALLENTRY(DSS_DATA22, "ac27", NULL),
1816 _OMAP3_BALLENTRY(DSS_DATA23, "ac28", NULL),
1817 _OMAP3_BALLENTRY(DSS_DATA3, "ah23", NULL),
1818 _OMAP3_BALLENTRY(DSS_DATA4, "ag24", NULL),
1819 _OMAP3_BALLENTRY(DSS_DATA5, "ah24", NULL),
1820 _OMAP3_BALLENTRY(DSS_DATA6, "e26", NULL),
1821 _OMAP3_BALLENTRY(DSS_DATA7, "f28", NULL),
1822 _OMAP3_BALLENTRY(DSS_DATA8, "f27", NULL),
1823 _OMAP3_BALLENTRY(DSS_DATA9, "g26", NULL),
1824 _OMAP3_BALLENTRY(DSS_HSYNC, "d26", NULL),
1825 _OMAP3_BALLENTRY(DSS_PCLK, "d28", NULL),
1826 _OMAP3_BALLENTRY(DSS_VSYNC, "d27", NULL),
1827 _OMAP3_BALLENTRY(ETK_CLK, "af10", NULL),
1828 _OMAP3_BALLENTRY(ETK_CTL, "ae10", NULL),
1829 _OMAP3_BALLENTRY(ETK_D0, "af11", NULL),
1830 _OMAP3_BALLENTRY(ETK_D1, "ag12", NULL),
1831 _OMAP3_BALLENTRY(ETK_D10, "ae7", NULL),
1832 _OMAP3_BALLENTRY(ETK_D11, "af7", NULL),
1833 _OMAP3_BALLENTRY(ETK_D12, "ag7", NULL),
1834 _OMAP3_BALLENTRY(ETK_D13, "ah7", NULL),
1835 _OMAP3_BALLENTRY(ETK_D14, "ag8", NULL),
1836 _OMAP3_BALLENTRY(ETK_D15, "ah8", NULL),
1837 _OMAP3_BALLENTRY(ETK_D2, "ah12", NULL),
1838 _OMAP3_BALLENTRY(ETK_D3, "ae13", NULL),
1839 _OMAP3_BALLENTRY(ETK_D4, "ae11", NULL),
1840 _OMAP3_BALLENTRY(ETK_D5, "ah9", NULL),
1841 _OMAP3_BALLENTRY(ETK_D6, "af13", NULL),
1842 _OMAP3_BALLENTRY(ETK_D7, "ah14", NULL),
1843 _OMAP3_BALLENTRY(ETK_D8, "af9", NULL),
1844 _OMAP3_BALLENTRY(ETK_D9, "ag9", NULL),
1845 _OMAP3_BALLENTRY(GPMC_A1, "n4", "ac15"),
1846 _OMAP3_BALLENTRY(GPMC_A10, "k3", "ab19"),
1847 _OMAP3_BALLENTRY(GPMC_A11, NULL, "ac20"),
1848 _OMAP3_BALLENTRY(GPMC_A2, "m4", "ab15"),
1849 _OMAP3_BALLENTRY(GPMC_A3, "l4", "ac16"),
1850 _OMAP3_BALLENTRY(GPMC_A4, "k4", "ab16"),
1851 _OMAP3_BALLENTRY(GPMC_A5, "t3", "ac17"),
1852 _OMAP3_BALLENTRY(GPMC_A6, "r3", "ab17"),
1853 _OMAP3_BALLENTRY(GPMC_A7, "n3", "ac18"),
1854 _OMAP3_BALLENTRY(GPMC_A8, "m3", "ab18"),
1855 _OMAP3_BALLENTRY(GPMC_A9, "l3", "ac19"),
1856 _OMAP3_BALLENTRY(GPMC_CLK, "t4", "w2"),
1857 _OMAP3_BALLENTRY(GPMC_D0, "k1", "m2"),
1858 _OMAP3_BALLENTRY(GPMC_D1, "l1", "m1"),
1859 _OMAP3_BALLENTRY(GPMC_D10, "p1", "ab4"),
1860 _OMAP3_BALLENTRY(GPMC_D11, "r1", "ac4"),
1861 _OMAP3_BALLENTRY(GPMC_D12, "r2", "ab6"),
1862 _OMAP3_BALLENTRY(GPMC_D13, "t2", "ac6"),
1863 _OMAP3_BALLENTRY(GPMC_D14, "w1", "ab7"),
1864 _OMAP3_BALLENTRY(GPMC_D15, "y1", "ac7"),
1865 _OMAP3_BALLENTRY(GPMC_D2, "l2", "n2"),
1866 _OMAP3_BALLENTRY(GPMC_D3, "p2", "n1"),
1867 _OMAP3_BALLENTRY(GPMC_D4, "t1", "r2"),
1868 _OMAP3_BALLENTRY(GPMC_D5, "v1", "r1"),
1869 _OMAP3_BALLENTRY(GPMC_D6, "v2", "t2"),
1870 _OMAP3_BALLENTRY(GPMC_D7, "w2", "t1"),
1871 _OMAP3_BALLENTRY(GPMC_D8, "h2", "ab3"),
1872 _OMAP3_BALLENTRY(GPMC_D9, "k2", "ac3"),
1873 _OMAP3_BALLENTRY(GPMC_NADV_ALE, "f3", "w1"),
1874 _OMAP3_BALLENTRY(GPMC_NBE0_CLE, "g3", "ac12"),
1875 _OMAP3_BALLENTRY(GPMC_NBE1, "u3", NULL),
1876 _OMAP3_BALLENTRY(GPMC_NCS0, "g4", "y2"),
1877 _OMAP3_BALLENTRY(GPMC_NCS1, "h3", "y1"),
1878 _OMAP3_BALLENTRY(GPMC_NCS2, "v8", NULL),
1879 _OMAP3_BALLENTRY(GPMC_NCS3, "u8", NULL),
1880 _OMAP3_BALLENTRY(GPMC_NCS4, "t8", NULL),
1881 _OMAP3_BALLENTRY(GPMC_NCS5, "r8", NULL),
1882 _OMAP3_BALLENTRY(GPMC_NCS6, "p8", NULL),
1883 _OMAP3_BALLENTRY(GPMC_NCS7, "n8", NULL),
1884 _OMAP3_BALLENTRY(GPMC_NOE, "g2", "v2"),
1885 _OMAP3_BALLENTRY(GPMC_NWE, "f4", "v1"),
1886 _OMAP3_BALLENTRY(GPMC_NWP, "h1", "ab10"),
1887 _OMAP3_BALLENTRY(GPMC_WAIT0, "m8", "ab12"),
1888 _OMAP3_BALLENTRY(GPMC_WAIT1, "l8", "ac10"),
1889 _OMAP3_BALLENTRY(GPMC_WAIT2, "k8", NULL),
1890 _OMAP3_BALLENTRY(GPMC_WAIT3, "j8", NULL),
1891 _OMAP3_BALLENTRY(HDQ_SIO, "j25", NULL),
1892 _OMAP3_BALLENTRY(HSUSB0_CLK, "t28", NULL),
1893 _OMAP3_BALLENTRY(HSUSB0_DATA0, "t27", NULL),
1894 _OMAP3_BALLENTRY(HSUSB0_DATA1, "u28", NULL),
1895 _OMAP3_BALLENTRY(HSUSB0_DATA2, "u27", NULL),
1896 _OMAP3_BALLENTRY(HSUSB0_DATA3, "u26", NULL),
1897 _OMAP3_BALLENTRY(HSUSB0_DATA4, "u25", NULL),
1898 _OMAP3_BALLENTRY(HSUSB0_DATA5, "v28", NULL),
1899 _OMAP3_BALLENTRY(HSUSB0_DATA6, "v27", NULL),
1900 _OMAP3_BALLENTRY(HSUSB0_DATA7, "v26", NULL),
1901 _OMAP3_BALLENTRY(HSUSB0_DIR, "r28", NULL),
1902 _OMAP3_BALLENTRY(HSUSB0_NXT, "t26", NULL),
1903 _OMAP3_BALLENTRY(HSUSB0_STP, "t25", NULL),
1904 _OMAP3_BALLENTRY(I2C1_SCL, "k21", NULL),
1905 _OMAP3_BALLENTRY(I2C1_SDA, "j21", NULL),
1906 _OMAP3_BALLENTRY(I2C2_SCL, "af15", NULL),
1907 _OMAP3_BALLENTRY(I2C2_SDA, "ae15", NULL),
1908 _OMAP3_BALLENTRY(I2C3_SCL, "af14", NULL),
1909 _OMAP3_BALLENTRY(I2C3_SDA, "ag14", NULL),
1910 _OMAP3_BALLENTRY(I2C4_SCL, "ad26", NULL),
1911 _OMAP3_BALLENTRY(I2C4_SDA, "ae26", NULL),
1912 _OMAP3_BALLENTRY(JTAG_EMU0, "aa11", NULL),
1913 _OMAP3_BALLENTRY(JTAG_EMU1, "aa10", NULL),
1914 _OMAP3_BALLENTRY(JTAG_RTCK, "aa12", NULL),
1915 _OMAP3_BALLENTRY(JTAG_TCK, "aa13", NULL),
1916 _OMAP3_BALLENTRY(JTAG_TDI, "aa20", NULL),
1917 _OMAP3_BALLENTRY(JTAG_TDO, "aa19", NULL),
1918 _OMAP3_BALLENTRY(JTAG_TMS_TMSC, "aa18", NULL),
1919 _OMAP3_BALLENTRY(MCBSP1_CLKR, "y21", NULL),
1920 _OMAP3_BALLENTRY(MCBSP1_CLKX, "w21", NULL),
1921 _OMAP3_BALLENTRY(MCBSP1_DR, "u21", NULL),
1922 _OMAP3_BALLENTRY(MCBSP1_DX, "v21", NULL),
1923 _OMAP3_BALLENTRY(MCBSP1_FSR, "aa21", NULL),
1924 _OMAP3_BALLENTRY(MCBSP1_FSX, "k26", NULL),
1925 _OMAP3_BALLENTRY(MCBSP2_CLKX, "n21", NULL),
1926 _OMAP3_BALLENTRY(MCBSP2_DR, "r21", NULL),
1927 _OMAP3_BALLENTRY(MCBSP2_DX, "m21", NULL),
1928 _OMAP3_BALLENTRY(MCBSP2_FSX, "p21", NULL),
1929 _OMAP3_BALLENTRY(MCBSP3_CLKX, "af5", NULL),
1930 _OMAP3_BALLENTRY(MCBSP3_DR, "ae6", NULL),
1931 _OMAP3_BALLENTRY(MCBSP3_DX, "af6", NULL),
1932 _OMAP3_BALLENTRY(MCBSP3_FSX, "ae5", NULL),
1933 _OMAP3_BALLENTRY(MCBSP4_CLKX, "ae1", NULL),
1934 _OMAP3_BALLENTRY(MCBSP4_DR, "ad1", NULL),
1935 _OMAP3_BALLENTRY(MCBSP4_DX, "ad2", NULL),
1936 _OMAP3_BALLENTRY(MCBSP4_FSX, "ac1", NULL),
1937 _OMAP3_BALLENTRY(MCBSP_CLKS, "t21", NULL),
1938 _OMAP3_BALLENTRY(MCSPI1_CLK, "ab3", NULL),
1939 _OMAP3_BALLENTRY(MCSPI1_CS0, "ac2", NULL),
1940 _OMAP3_BALLENTRY(MCSPI1_CS1, "ac3", NULL),
1941 _OMAP3_BALLENTRY(MCSPI1_CS2, "ab1", NULL),
1942 _OMAP3_BALLENTRY(MCSPI1_CS3, "ab2", NULL),
1943 _OMAP3_BALLENTRY(MCSPI1_SIMO, "ab4", NULL),
1944 _OMAP3_BALLENTRY(MCSPI1_SOMI, "aa4", NULL),
1945 _OMAP3_BALLENTRY(MCSPI2_CLK, "aa3", NULL),
1946 _OMAP3_BALLENTRY(MCSPI2_CS0, "y4", NULL),
1947 _OMAP3_BALLENTRY(MCSPI2_CS1, "v3", NULL),
1948 _OMAP3_BALLENTRY(MCSPI2_SIMO, "y2", NULL),
1949 _OMAP3_BALLENTRY(MCSPI2_SOMI, "y3", NULL),
1950 _OMAP3_BALLENTRY(SDMMC1_CLK, "n28", NULL),
1951 _OMAP3_BALLENTRY(SDMMC1_CMD, "m27", NULL),
1952 _OMAP3_BALLENTRY(SDMMC1_DAT0, "n27", NULL),
1953 _OMAP3_BALLENTRY(SDMMC1_DAT1, "n26", NULL),
1954 _OMAP3_BALLENTRY(SDMMC1_DAT2, "n25", NULL),
1955 _OMAP3_BALLENTRY(SDMMC1_DAT3, "p28", NULL),
1956 _OMAP3_BALLENTRY(SDMMC2_CLK, "ae2", NULL),
1957 _OMAP3_BALLENTRY(SDMMC2_CMD, "ag5", NULL),
1958 _OMAP3_BALLENTRY(SDMMC2_DAT0, "ah5", NULL),
1959 _OMAP3_BALLENTRY(SDMMC2_DAT1, "ah4", NULL),
1960 _OMAP3_BALLENTRY(SDMMC2_DAT2, "ag4", NULL),
1961 _OMAP3_BALLENTRY(SDMMC2_DAT3, "af4", NULL),
1962 _OMAP3_BALLENTRY(SDMMC2_DAT4, "ae4", NULL),
1963 _OMAP3_BALLENTRY(SDMMC2_DAT5, "ah3", NULL),
1964 _OMAP3_BALLENTRY(SDMMC2_DAT6, "af3", NULL),
1965 _OMAP3_BALLENTRY(SDMMC2_DAT7, "ae3", NULL),
1966 _OMAP3_BALLENTRY(SDRC_A0, NULL, "n22"),
1967 _OMAP3_BALLENTRY(SDRC_A1, NULL, "n23"),
1968 _OMAP3_BALLENTRY(SDRC_A10, NULL, "v22"),
1969 _OMAP3_BALLENTRY(SDRC_A11, NULL, "v23"),
1970 _OMAP3_BALLENTRY(SDRC_A12, NULL, "w22"),
1971 _OMAP3_BALLENTRY(SDRC_A13, NULL, "w23"),
1972 _OMAP3_BALLENTRY(SDRC_A14, NULL, "y22"),
1973 _OMAP3_BALLENTRY(SDRC_A2, NULL, "p22"),
1974 _OMAP3_BALLENTRY(SDRC_A3, NULL, "p23"),
1975 _OMAP3_BALLENTRY(SDRC_A4, NULL, "r22"),
1976 _OMAP3_BALLENTRY(SDRC_A5, NULL, "r23"),
1977 _OMAP3_BALLENTRY(SDRC_A6, NULL, "t22"),
1978 _OMAP3_BALLENTRY(SDRC_A7, NULL, "t23"),
1979 _OMAP3_BALLENTRY(SDRC_A8, NULL, "u22"),
1980 _OMAP3_BALLENTRY(SDRC_A9, NULL, "u23"),
1981 _OMAP3_BALLENTRY(SDRC_BA0, "h9", "ab21"),
1982 _OMAP3_BALLENTRY(SDRC_BA1, "h10", "ac21"),
1983 _OMAP3_BALLENTRY(SDRC_CKE0, "h16", "j22"),
1984 _OMAP3_BALLENTRY(SDRC_CKE1, "h17", "j23"),
1985 _OMAP3_BALLENTRY(SDRC_CLK, "a13", "a11"),
1986 _OMAP3_BALLENTRY(SDRC_D0, NULL, "j2"),
1987 _OMAP3_BALLENTRY(SDRC_D1, NULL, "j1"),
1988 _OMAP3_BALLENTRY(SDRC_D10, "c15", "b14"),
1989 _OMAP3_BALLENTRY(SDRC_D11, "b16", "a14"),
1990 _OMAP3_BALLENTRY(SDRC_D12, "d17", "b16"),
1991 _OMAP3_BALLENTRY(SDRC_D13, "c17", "a16"),
1992 _OMAP3_BALLENTRY(SDRC_D14, "b17", "b19"),
1993 _OMAP3_BALLENTRY(SDRC_D15, "d18", "a19"),
1994 _OMAP3_BALLENTRY(SDRC_D16, NULL, "b3"),
1995 _OMAP3_BALLENTRY(SDRC_D17, NULL, "a3"),
1996 _OMAP3_BALLENTRY(SDRC_D18, NULL, "b5"),
1997 _OMAP3_BALLENTRY(SDRC_D19, NULL, "a5"),
1998 _OMAP3_BALLENTRY(SDRC_D2, NULL, "g2"),
1999 _OMAP3_BALLENTRY(SDRC_D20, NULL, "b8"),
2000 _OMAP3_BALLENTRY(SDRC_D21, NULL, "a8"),
2001 _OMAP3_BALLENTRY(SDRC_D22, NULL, "b9"),
2002 _OMAP3_BALLENTRY(SDRC_D23, NULL, "a9"),
2003 _OMAP3_BALLENTRY(SDRC_D24, NULL, "b21"),
2004 _OMAP3_BALLENTRY(SDRC_D25, NULL, "a21"),
2005 _OMAP3_BALLENTRY(SDRC_D26, NULL, "d22"),
2006 _OMAP3_BALLENTRY(SDRC_D27, NULL, "d23"),
2007 _OMAP3_BALLENTRY(SDRC_D28, NULL, "e22"),
2008 _OMAP3_BALLENTRY(SDRC_D29, NULL, "e23"),
2009 _OMAP3_BALLENTRY(SDRC_D3, NULL, "g1"),
2010 _OMAP3_BALLENTRY(SDRC_D30, NULL, "g22"),
2011 _OMAP3_BALLENTRY(SDRC_D31, NULL, "g23"),
2012 _OMAP3_BALLENTRY(SDRC_D4, NULL, "f2"),
2013 _OMAP3_BALLENTRY(SDRC_D5, NULL, "f1"),
2014 _OMAP3_BALLENTRY(SDRC_D6, NULL, "d2"),
2015 _OMAP3_BALLENTRY(SDRC_D7, NULL, "d1"),
2016 _OMAP3_BALLENTRY(SDRC_D8, "c14", "b13"),
2017 _OMAP3_BALLENTRY(SDRC_D9, "b14", "a13"),
2018 _OMAP3_BALLENTRY(SDRC_DM0, NULL, "c1"),
2019 _OMAP3_BALLENTRY(SDRC_DM1, "a16", "a17"),
2020 _OMAP3_BALLENTRY(SDRC_DM2, NULL, "a6"),
2021 _OMAP3_BALLENTRY(SDRC_DM3, NULL, "a20"),
2022 _OMAP3_BALLENTRY(SDRC_DQS0, NULL, "c2"),
2023 _OMAP3_BALLENTRY(SDRC_DQS1, "a17", "b17"),
2024 _OMAP3_BALLENTRY(SDRC_DQS2, NULL, "b6"),
2025 _OMAP3_BALLENTRY(SDRC_DQS3, NULL, "b20"),
2026 _OMAP3_BALLENTRY(SDRC_NCAS, "h13", "l22"),
2027 _OMAP3_BALLENTRY(SDRC_NCLK, "a14", "b11"),
2028 _OMAP3_BALLENTRY(SDRC_NCS0, "h11", "m22"),
2029 _OMAP3_BALLENTRY(SDRC_NCS1, "h12", "m23"),
2030 _OMAP3_BALLENTRY(SDRC_NRAS, "h14", "l23"),
2031 _OMAP3_BALLENTRY(SDRC_NWE, "h15", "k23"),
2032 _OMAP3_BALLENTRY(SIM_CLK, "p26", NULL),
2033 _OMAP3_BALLENTRY(SIM_IO, "p27", NULL),
2034 _OMAP3_BALLENTRY(SIM_PWRCTRL, "r27", NULL),
2035 _OMAP3_BALLENTRY(SIM_RST, "r25", NULL),
2036 _OMAP3_BALLENTRY(SYS_32K, "ae25", NULL),
2037 _OMAP3_BALLENTRY(SYS_BOOT0, "ah26", NULL),
2038 _OMAP3_BALLENTRY(SYS_BOOT1, "ag26", NULL),
2039 _OMAP3_BALLENTRY(SYS_BOOT2, "ae14", NULL),
2040 _OMAP3_BALLENTRY(SYS_BOOT3, "af18", NULL),
2041 _OMAP3_BALLENTRY(SYS_BOOT4, "af19", NULL),
2042 _OMAP3_BALLENTRY(SYS_BOOT5, "ae21", NULL),
2043 _OMAP3_BALLENTRY(SYS_BOOT6, "af21", NULL),
2044 _OMAP3_BALLENTRY(SYS_CLKOUT1, "ag25", NULL),
2045 _OMAP3_BALLENTRY(SYS_CLKOUT2, "ae22", NULL),
2046 _OMAP3_BALLENTRY(SYS_CLKREQ, "af25", NULL),
2047 _OMAP3_BALLENTRY(SYS_NIRQ, "af26", NULL),
2048 _OMAP3_BALLENTRY(SYS_NRESWARM, "af24", NULL),
2049 _OMAP3_BALLENTRY(SYS_OFF_MODE, "af22", NULL),
2050 _OMAP3_BALLENTRY(UART1_CTS, "w8", NULL),
2051 _OMAP3_BALLENTRY(UART1_RTS, "aa9", NULL),
2052 _OMAP3_BALLENTRY(UART1_RX, "y8", NULL),
2053 _OMAP3_BALLENTRY(UART1_TX, "aa8", NULL),
2054 _OMAP3_BALLENTRY(UART2_CTS, "ab26", NULL),
2055 _OMAP3_BALLENTRY(UART2_RTS, "ab25", NULL),
2056 _OMAP3_BALLENTRY(UART2_RX, "ad25", NULL),
2057 _OMAP3_BALLENTRY(UART2_TX, "aa25", NULL),
2058 _OMAP3_BALLENTRY(UART3_CTS_RCTX, "h18", NULL),
2059 _OMAP3_BALLENTRY(UART3_RTS_SD, "h19", NULL),
2060 _OMAP3_BALLENTRY(UART3_RX_IRRX, "h20", NULL),
2061 _OMAP3_BALLENTRY(UART3_TX_IRTX, "h21", NULL),
2062 { .reg_offset = OMAP_MUX_TERMINATOR },
2063};
2064#else
2065#define omap36xx_cbp_ball NULL
2066#endif
2067
2068int __init omap3_mux_init(struct omap_board_mux *board_subset, int flags)
2069{
2070 struct omap_mux *package_subset;
2071 struct omap_ball *package_balls;
2072
2073 switch (flags & OMAP_PACKAGE_MASK) {
2074 case (OMAP_PACKAGE_CBC):
2075 package_subset = omap3_cbc_subset;
2076 package_balls = omap3_cbc_ball;
2077 break;
2078 case (OMAP_PACKAGE_CBB):
2079 package_subset = omap3_cbb_subset;
2080 package_balls = omap3_cbb_ball;
2081 break;
2082 case (OMAP_PACKAGE_CUS):
2083 package_subset = omap3_cus_subset;
2084 package_balls = omap3_cus_ball;
2085 break;
2086 case (OMAP_PACKAGE_CBP):
2087 package_subset = omap36xx_cbp_subset;
2088 package_balls = omap36xx_cbp_ball;
2089 break;
2090 default:
2091 printk(KERN_ERR "mux: Unknown omap package, mux disabled\n");
2092 return -EINVAL;
2093 }
2094
2095 return omap_mux_init(OMAP3_CONTROL_PADCONF_MUX_PBASE,
2096 OMAP3_CONTROL_PADCONF_MUX_SIZE,
2097 omap3_muxmodes, package_subset, board_subset,
2098 package_balls);
2099}
diff --git a/arch/arm/mach-omap2/mux34xx.h b/arch/arm/mach-omap2/mux34xx.h
new file mode 100644
index 000000000000..6543ebf8ecfc
--- /dev/null
+++ b/arch/arm/mach-omap2/mux34xx.h
@@ -0,0 +1,398 @@
1/*
2 * Copyright (C) 2009 Nokia
3 * Copyright (C) 2009 Texas Instruments
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#define OMAP3_CONTROL_PADCONF_MUX_PBASE 0x48002030LU
11
12#define OMAP3_MUX(mode0, mux_value) \
13{ \
14 .reg_offset = (OMAP3_CONTROL_PADCONF_##mode0##_OFFSET), \
15 .value = (mux_value), \
16}
17
18/*
19 * OMAP3 CONTROL_PADCONF* register offsets for pin-muxing
20 *
21 * Extracted from the TRM. Add 0x48002030 to these values to get the
22 * absolute addresses. The name in the macro is the mode-0 name of
23 * the pin. NOTE: These registers are 16-bits wide.
24 *
25 * Note that 34XX TRM uses MMC instead of SDMMC and SAD2D instead
26 * of CHASSIS for some registers. For the defines, we follow the
27 * 36XX naming, and use SDMMC and CHASSIS.
28 */
29#define OMAP3_CONTROL_PADCONF_SDRC_D0_OFFSET 0x000
30#define OMAP3_CONTROL_PADCONF_SDRC_D1_OFFSET 0x002
31#define OMAP3_CONTROL_PADCONF_SDRC_D2_OFFSET 0x004
32#define OMAP3_CONTROL_PADCONF_SDRC_D3_OFFSET 0x006
33#define OMAP3_CONTROL_PADCONF_SDRC_D4_OFFSET 0x008
34#define OMAP3_CONTROL_PADCONF_SDRC_D5_OFFSET 0x00a
35#define OMAP3_CONTROL_PADCONF_SDRC_D6_OFFSET 0x00c
36#define OMAP3_CONTROL_PADCONF_SDRC_D7_OFFSET 0x00e
37#define OMAP3_CONTROL_PADCONF_SDRC_D8_OFFSET 0x010
38#define OMAP3_CONTROL_PADCONF_SDRC_D9_OFFSET 0x012
39#define OMAP3_CONTROL_PADCONF_SDRC_D10_OFFSET 0x014
40#define OMAP3_CONTROL_PADCONF_SDRC_D11_OFFSET 0x016
41#define OMAP3_CONTROL_PADCONF_SDRC_D12_OFFSET 0x018
42#define OMAP3_CONTROL_PADCONF_SDRC_D13_OFFSET 0x01a
43#define OMAP3_CONTROL_PADCONF_SDRC_D14_OFFSET 0x01c
44#define OMAP3_CONTROL_PADCONF_SDRC_D15_OFFSET 0x01e
45#define OMAP3_CONTROL_PADCONF_SDRC_D16_OFFSET 0x020
46#define OMAP3_CONTROL_PADCONF_SDRC_D17_OFFSET 0x022
47#define OMAP3_CONTROL_PADCONF_SDRC_D18_OFFSET 0x024
48#define OMAP3_CONTROL_PADCONF_SDRC_D19_OFFSET 0x026
49#define OMAP3_CONTROL_PADCONF_SDRC_D20_OFFSET 0x028
50#define OMAP3_CONTROL_PADCONF_SDRC_D21_OFFSET 0x02a
51#define OMAP3_CONTROL_PADCONF_SDRC_D22_OFFSET 0x02c
52#define OMAP3_CONTROL_PADCONF_SDRC_D23_OFFSET 0x02e
53#define OMAP3_CONTROL_PADCONF_SDRC_D24_OFFSET 0x030
54#define OMAP3_CONTROL_PADCONF_SDRC_D25_OFFSET 0x032
55#define OMAP3_CONTROL_PADCONF_SDRC_D26_OFFSET 0x034
56#define OMAP3_CONTROL_PADCONF_SDRC_D27_OFFSET 0x036
57#define OMAP3_CONTROL_PADCONF_SDRC_D28_OFFSET 0x038
58#define OMAP3_CONTROL_PADCONF_SDRC_D29_OFFSET 0x03a
59#define OMAP3_CONTROL_PADCONF_SDRC_D30_OFFSET 0x03c
60#define OMAP3_CONTROL_PADCONF_SDRC_D31_OFFSET 0x03e
61#define OMAP3_CONTROL_PADCONF_SDRC_CLK_OFFSET 0x040
62#define OMAP3_CONTROL_PADCONF_SDRC_DQS0_OFFSET 0x042
63#define OMAP3_CONTROL_PADCONF_SDRC_DQS1_OFFSET 0x044
64#define OMAP3_CONTROL_PADCONF_SDRC_DQS2_OFFSET 0x046
65#define OMAP3_CONTROL_PADCONF_SDRC_DQS3_OFFSET 0x048
66#define OMAP3_CONTROL_PADCONF_GPMC_A1_OFFSET 0x04a
67#define OMAP3_CONTROL_PADCONF_GPMC_A2_OFFSET 0x04c
68#define OMAP3_CONTROL_PADCONF_GPMC_A3_OFFSET 0x04e
69#define OMAP3_CONTROL_PADCONF_GPMC_A4_OFFSET 0x050
70#define OMAP3_CONTROL_PADCONF_GPMC_A5_OFFSET 0x052
71#define OMAP3_CONTROL_PADCONF_GPMC_A6_OFFSET 0x054
72#define OMAP3_CONTROL_PADCONF_GPMC_A7_OFFSET 0x056
73#define OMAP3_CONTROL_PADCONF_GPMC_A8_OFFSET 0x058
74#define OMAP3_CONTROL_PADCONF_GPMC_A9_OFFSET 0x05a
75#define OMAP3_CONTROL_PADCONF_GPMC_A10_OFFSET 0x05c
76#define OMAP3_CONTROL_PADCONF_GPMC_D0_OFFSET 0x05e
77#define OMAP3_CONTROL_PADCONF_GPMC_D1_OFFSET 0x060
78#define OMAP3_CONTROL_PADCONF_GPMC_D2_OFFSET 0x062
79#define OMAP3_CONTROL_PADCONF_GPMC_D3_OFFSET 0x064
80#define OMAP3_CONTROL_PADCONF_GPMC_D4_OFFSET 0x066
81#define OMAP3_CONTROL_PADCONF_GPMC_D5_OFFSET 0x068
82#define OMAP3_CONTROL_PADCONF_GPMC_D6_OFFSET 0x06a
83#define OMAP3_CONTROL_PADCONF_GPMC_D7_OFFSET 0x06c
84#define OMAP3_CONTROL_PADCONF_GPMC_D8_OFFSET 0x06e
85#define OMAP3_CONTROL_PADCONF_GPMC_D9_OFFSET 0x070
86#define OMAP3_CONTROL_PADCONF_GPMC_D10_OFFSET 0x072
87#define OMAP3_CONTROL_PADCONF_GPMC_D11_OFFSET 0x074
88#define OMAP3_CONTROL_PADCONF_GPMC_D12_OFFSET 0x076
89#define OMAP3_CONTROL_PADCONF_GPMC_D13_OFFSET 0x078
90#define OMAP3_CONTROL_PADCONF_GPMC_D14_OFFSET 0x07a
91#define OMAP3_CONTROL_PADCONF_GPMC_D15_OFFSET 0x07c
92#define OMAP3_CONTROL_PADCONF_GPMC_NCS0_OFFSET 0x07e
93#define OMAP3_CONTROL_PADCONF_GPMC_NCS1_OFFSET 0x080
94#define OMAP3_CONTROL_PADCONF_GPMC_NCS2_OFFSET 0x082
95#define OMAP3_CONTROL_PADCONF_GPMC_NCS3_OFFSET 0x084
96#define OMAP3_CONTROL_PADCONF_GPMC_NCS4_OFFSET 0x086
97#define OMAP3_CONTROL_PADCONF_GPMC_NCS5_OFFSET 0x088
98#define OMAP3_CONTROL_PADCONF_GPMC_NCS6_OFFSET 0x08a
99#define OMAP3_CONTROL_PADCONF_GPMC_NCS7_OFFSET 0x08c
100#define OMAP3_CONTROL_PADCONF_GPMC_CLK_OFFSET 0x08e
101#define OMAP3_CONTROL_PADCONF_GPMC_NADV_ALE_OFFSET 0x090
102#define OMAP3_CONTROL_PADCONF_GPMC_NOE_OFFSET 0x092
103#define OMAP3_CONTROL_PADCONF_GPMC_NWE_OFFSET 0x094
104#define OMAP3_CONTROL_PADCONF_GPMC_NBE0_CLE_OFFSET 0x096
105#define OMAP3_CONTROL_PADCONF_GPMC_NBE1_OFFSET 0x098
106#define OMAP3_CONTROL_PADCONF_GPMC_NWP_OFFSET 0x09a
107#define OMAP3_CONTROL_PADCONF_GPMC_WAIT0_OFFSET 0x09c
108#define OMAP3_CONTROL_PADCONF_GPMC_WAIT1_OFFSET 0x09e
109#define OMAP3_CONTROL_PADCONF_GPMC_WAIT2_OFFSET 0x0a0
110#define OMAP3_CONTROL_PADCONF_GPMC_WAIT3_OFFSET 0x0a2
111#define OMAP3_CONTROL_PADCONF_DSS_PCLK_OFFSET 0x0a4
112#define OMAP3_CONTROL_PADCONF_DSS_HSYNC_OFFSET 0x0a6
113#define OMAP3_CONTROL_PADCONF_DSS_VSYNC_OFFSET 0x0a8
114#define OMAP3_CONTROL_PADCONF_DSS_ACBIAS_OFFSET 0x0aa
115#define OMAP3_CONTROL_PADCONF_DSS_DATA0_OFFSET 0x0ac
116#define OMAP3_CONTROL_PADCONF_DSS_DATA1_OFFSET 0x0ae
117#define OMAP3_CONTROL_PADCONF_DSS_DATA2_OFFSET 0x0b0
118#define OMAP3_CONTROL_PADCONF_DSS_DATA3_OFFSET 0x0b2
119#define OMAP3_CONTROL_PADCONF_DSS_DATA4_OFFSET 0x0b4
120#define OMAP3_CONTROL_PADCONF_DSS_DATA5_OFFSET 0x0b6
121#define OMAP3_CONTROL_PADCONF_DSS_DATA6_OFFSET 0x0b8
122#define OMAP3_CONTROL_PADCONF_DSS_DATA7_OFFSET 0x0ba
123#define OMAP3_CONTROL_PADCONF_DSS_DATA8_OFFSET 0x0bc
124#define OMAP3_CONTROL_PADCONF_DSS_DATA9_OFFSET 0x0be
125#define OMAP3_CONTROL_PADCONF_DSS_DATA10_OFFSET 0x0c0
126#define OMAP3_CONTROL_PADCONF_DSS_DATA11_OFFSET 0x0c2
127#define OMAP3_CONTROL_PADCONF_DSS_DATA12_OFFSET 0x0c4
128#define OMAP3_CONTROL_PADCONF_DSS_DATA13_OFFSET 0x0c6
129#define OMAP3_CONTROL_PADCONF_DSS_DATA14_OFFSET 0x0c8
130#define OMAP3_CONTROL_PADCONF_DSS_DATA15_OFFSET 0x0ca
131#define OMAP3_CONTROL_PADCONF_DSS_DATA16_OFFSET 0x0cc
132#define OMAP3_CONTROL_PADCONF_DSS_DATA17_OFFSET 0x0ce
133#define OMAP3_CONTROL_PADCONF_DSS_DATA18_OFFSET 0x0d0
134#define OMAP3_CONTROL_PADCONF_DSS_DATA19_OFFSET 0x0d2
135#define OMAP3_CONTROL_PADCONF_DSS_DATA20_OFFSET 0x0d4
136#define OMAP3_CONTROL_PADCONF_DSS_DATA21_OFFSET 0x0d6
137#define OMAP3_CONTROL_PADCONF_DSS_DATA22_OFFSET 0x0d8
138#define OMAP3_CONTROL_PADCONF_DSS_DATA23_OFFSET 0x0da
139#define OMAP3_CONTROL_PADCONF_CAM_HS_OFFSET 0x0dc
140#define OMAP3_CONTROL_PADCONF_CAM_VS_OFFSET 0x0de
141#define OMAP3_CONTROL_PADCONF_CAM_XCLKA_OFFSET 0x0e0
142#define OMAP3_CONTROL_PADCONF_CAM_PCLK_OFFSET 0x0e2
143#define OMAP3_CONTROL_PADCONF_CAM_FLD_OFFSET 0x0e4
144#define OMAP3_CONTROL_PADCONF_CAM_D0_OFFSET 0x0e6
145#define OMAP3_CONTROL_PADCONF_CAM_D1_OFFSET 0x0e8
146#define OMAP3_CONTROL_PADCONF_CAM_D2_OFFSET 0x0ea
147#define OMAP3_CONTROL_PADCONF_CAM_D3_OFFSET 0x0ec
148#define OMAP3_CONTROL_PADCONF_CAM_D4_OFFSET 0x0ee
149#define OMAP3_CONTROL_PADCONF_CAM_D5_OFFSET 0x0f0
150#define OMAP3_CONTROL_PADCONF_CAM_D6_OFFSET 0x0f2
151#define OMAP3_CONTROL_PADCONF_CAM_D7_OFFSET 0x0f4
152#define OMAP3_CONTROL_PADCONF_CAM_D8_OFFSET 0x0f6
153#define OMAP3_CONTROL_PADCONF_CAM_D9_OFFSET 0x0f8
154#define OMAP3_CONTROL_PADCONF_CAM_D10_OFFSET 0x0fa
155#define OMAP3_CONTROL_PADCONF_CAM_D11_OFFSET 0x0fc
156#define OMAP3_CONTROL_PADCONF_CAM_XCLKB_OFFSET 0x0fe
157#define OMAP3_CONTROL_PADCONF_CAM_WEN_OFFSET 0x100
158#define OMAP3_CONTROL_PADCONF_CAM_STROBE_OFFSET 0x102
159#define OMAP3_CONTROL_PADCONF_CSI2_DX0_OFFSET 0x104
160#define OMAP3_CONTROL_PADCONF_CSI2_DY0_OFFSET 0x106
161#define OMAP3_CONTROL_PADCONF_CSI2_DX1_OFFSET 0x108
162#define OMAP3_CONTROL_PADCONF_CSI2_DY1_OFFSET 0x10a
163#define OMAP3_CONTROL_PADCONF_MCBSP2_FSX_OFFSET 0x10c
164#define OMAP3_CONTROL_PADCONF_MCBSP2_CLKX_OFFSET 0x10e
165#define OMAP3_CONTROL_PADCONF_MCBSP2_DR_OFFSET 0x110
166#define OMAP3_CONTROL_PADCONF_MCBSP2_DX_OFFSET 0x112
167#define OMAP3_CONTROL_PADCONF_SDMMC1_CLK_OFFSET 0x114
168#define OMAP3_CONTROL_PADCONF_SDMMC1_CMD_OFFSET 0x116
169#define OMAP3_CONTROL_PADCONF_SDMMC1_DAT0_OFFSET 0x118
170#define OMAP3_CONTROL_PADCONF_SDMMC1_DAT1_OFFSET 0x11a
171#define OMAP3_CONTROL_PADCONF_SDMMC1_DAT2_OFFSET 0x11c
172#define OMAP3_CONTROL_PADCONF_SDMMC1_DAT3_OFFSET 0x11e
173
174/* SDMMC1_DAT4 - DAT7 are SIM_IO SIM_CLK SIM_PWRCTRL and SIM_RST on 36xx */
175#define OMAP3_CONTROL_PADCONF_SDMMC1_DAT4_OFFSET 0x120
176#define OMAP3_CONTROL_PADCONF_SDMMC1_DAT5_OFFSET 0x122
177#define OMAP3_CONTROL_PADCONF_SDMMC1_DAT6_OFFSET 0x124
178#define OMAP3_CONTROL_PADCONF_SDMMC1_DAT7_OFFSET 0x126
179
180#define OMAP3_CONTROL_PADCONF_SDMMC2_CLK_OFFSET 0x128
181#define OMAP3_CONTROL_PADCONF_SDMMC2_CMD_OFFSET 0x12a
182#define OMAP3_CONTROL_PADCONF_SDMMC2_DAT0_OFFSET 0x12c
183#define OMAP3_CONTROL_PADCONF_SDMMC2_DAT1_OFFSET 0x12e
184#define OMAP3_CONTROL_PADCONF_SDMMC2_DAT2_OFFSET 0x130
185#define OMAP3_CONTROL_PADCONF_SDMMC2_DAT3_OFFSET 0x132
186#define OMAP3_CONTROL_PADCONF_SDMMC2_DAT4_OFFSET 0x134
187#define OMAP3_CONTROL_PADCONF_SDMMC2_DAT5_OFFSET 0x136
188#define OMAP3_CONTROL_PADCONF_SDMMC2_DAT6_OFFSET 0x138
189#define OMAP3_CONTROL_PADCONF_SDMMC2_DAT7_OFFSET 0x13a
190#define OMAP3_CONTROL_PADCONF_MCBSP3_DX_OFFSET 0x13c
191#define OMAP3_CONTROL_PADCONF_MCBSP3_DR_OFFSET 0x13e
192#define OMAP3_CONTROL_PADCONF_MCBSP3_CLKX_OFFSET 0x140
193#define OMAP3_CONTROL_PADCONF_MCBSP3_FSX_OFFSET 0x142
194#define OMAP3_CONTROL_PADCONF_UART2_CTS_OFFSET 0x144
195#define OMAP3_CONTROL_PADCONF_UART2_RTS_OFFSET 0x146
196#define OMAP3_CONTROL_PADCONF_UART2_TX_OFFSET 0x148
197#define OMAP3_CONTROL_PADCONF_UART2_RX_OFFSET 0x14a
198#define OMAP3_CONTROL_PADCONF_UART1_TX_OFFSET 0x14c
199#define OMAP3_CONTROL_PADCONF_UART1_RTS_OFFSET 0x14e
200#define OMAP3_CONTROL_PADCONF_UART1_CTS_OFFSET 0x150
201#define OMAP3_CONTROL_PADCONF_UART1_RX_OFFSET 0x152
202#define OMAP3_CONTROL_PADCONF_MCBSP4_CLKX_OFFSET 0x154
203#define OMAP3_CONTROL_PADCONF_MCBSP4_DR_OFFSET 0x156
204#define OMAP3_CONTROL_PADCONF_MCBSP4_DX_OFFSET 0x158
205#define OMAP3_CONTROL_PADCONF_MCBSP4_FSX_OFFSET 0x15a
206#define OMAP3_CONTROL_PADCONF_MCBSP1_CLKR_OFFSET 0x15c
207#define OMAP3_CONTROL_PADCONF_MCBSP1_FSR_OFFSET 0x15e
208#define OMAP3_CONTROL_PADCONF_MCBSP1_DX_OFFSET 0x160
209#define OMAP3_CONTROL_PADCONF_MCBSP1_DR_OFFSET 0x162
210#define OMAP3_CONTROL_PADCONF_MCBSP_CLKS_OFFSET 0x164
211#define OMAP3_CONTROL_PADCONF_MCBSP1_FSX_OFFSET 0x166
212#define OMAP3_CONTROL_PADCONF_MCBSP1_CLKX_OFFSET 0x168
213#define OMAP3_CONTROL_PADCONF_UART3_CTS_RCTX_OFFSET 0x16a
214#define OMAP3_CONTROL_PADCONF_UART3_RTS_SD_OFFSET 0x16c
215#define OMAP3_CONTROL_PADCONF_UART3_RX_IRRX_OFFSET 0x16e
216#define OMAP3_CONTROL_PADCONF_UART3_TX_IRTX_OFFSET 0x170
217#define OMAP3_CONTROL_PADCONF_HSUSB0_CLK_OFFSET 0x172
218#define OMAP3_CONTROL_PADCONF_HSUSB0_STP_OFFSET 0x174
219#define OMAP3_CONTROL_PADCONF_HSUSB0_DIR_OFFSET 0x176
220#define OMAP3_CONTROL_PADCONF_HSUSB0_NXT_OFFSET 0x178
221#define OMAP3_CONTROL_PADCONF_HSUSB0_DATA0_OFFSET 0x17a
222#define OMAP3_CONTROL_PADCONF_HSUSB0_DATA1_OFFSET 0x17c
223#define OMAP3_CONTROL_PADCONF_HSUSB0_DATA2_OFFSET 0x17e
224#define OMAP3_CONTROL_PADCONF_HSUSB0_DATA3_OFFSET 0x180
225#define OMAP3_CONTROL_PADCONF_HSUSB0_DATA4_OFFSET 0x182
226#define OMAP3_CONTROL_PADCONF_HSUSB0_DATA5_OFFSET 0x184
227#define OMAP3_CONTROL_PADCONF_HSUSB0_DATA6_OFFSET 0x186
228#define OMAP3_CONTROL_PADCONF_HSUSB0_DATA7_OFFSET 0x188
229#define OMAP3_CONTROL_PADCONF_I2C1_SCL_OFFSET 0x18a
230#define OMAP3_CONTROL_PADCONF_I2C1_SDA_OFFSET 0x18c
231#define OMAP3_CONTROL_PADCONF_I2C2_SCL_OFFSET 0x18e
232#define OMAP3_CONTROL_PADCONF_I2C2_SDA_OFFSET 0x190
233#define OMAP3_CONTROL_PADCONF_I2C3_SCL_OFFSET 0x192
234#define OMAP3_CONTROL_PADCONF_I2C3_SDA_OFFSET 0x194
235#define OMAP3_CONTROL_PADCONF_HDQ_SIO_OFFSET 0x196
236#define OMAP3_CONTROL_PADCONF_MCSPI1_CLK_OFFSET 0x198
237#define OMAP3_CONTROL_PADCONF_MCSPI1_SIMO_OFFSET 0x19a
238#define OMAP3_CONTROL_PADCONF_MCSPI1_SOMI_OFFSET 0x19c
239#define OMAP3_CONTROL_PADCONF_MCSPI1_CS0_OFFSET 0x19e
240#define OMAP3_CONTROL_PADCONF_MCSPI1_CS1_OFFSET 0x1a0
241#define OMAP3_CONTROL_PADCONF_MCSPI1_CS2_OFFSET 0x1a2
242#define OMAP3_CONTROL_PADCONF_MCSPI1_CS3_OFFSET 0x1a4
243#define OMAP3_CONTROL_PADCONF_MCSPI2_CLK_OFFSET 0x1a6
244#define OMAP3_CONTROL_PADCONF_MCSPI2_SIMO_OFFSET 0x1a8
245#define OMAP3_CONTROL_PADCONF_MCSPI2_SOMI_OFFSET 0x1aa
246#define OMAP3_CONTROL_PADCONF_MCSPI2_CS0_OFFSET 0x1ac
247#define OMAP3_CONTROL_PADCONF_MCSPI2_CS1_OFFSET 0x1ae
248#define OMAP3_CONTROL_PADCONF_SYS_NIRQ_OFFSET 0x1b0
249#define OMAP3_CONTROL_PADCONF_SYS_CLKOUT2_OFFSET 0x1b2
250#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD0_OFFSET 0x1b4
251#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD1_OFFSET 0x1b6
252#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD2_OFFSET 0x1b8
253#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD3_OFFSET 0x1ba
254#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD4_OFFSET 0x1bc
255#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD5_OFFSET 0x1be
256#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD6_OFFSET 0x1c0
257#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD7_OFFSET 0x1c2
258#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD8_OFFSET 0x1c4
259#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD9_OFFSET 0x1c6
260#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD10_OFFSET 0x1c8
261#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD11_OFFSET 0x1ca
262#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD12_OFFSET 0x1cc
263#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD13_OFFSET 0x1ce
264#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD14_OFFSET 0x1d0
265#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD15_OFFSET 0x1d2
266#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD16_OFFSET 0x1d4
267#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD17_OFFSET 0x1d6
268#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD18_OFFSET 0x1d8
269#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD19_OFFSET 0x1da
270#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD20_OFFSET 0x1dc
271#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD21_OFFSET 0x1de
272#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD22_OFFSET 0x1e0
273#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD23_OFFSET 0x1e2
274#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD24_OFFSET 0x1e4
275#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD25_OFFSET 0x1e6
276#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD26_OFFSET 0x1e8
277#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD27_OFFSET 0x1ea
278#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD28_OFFSET 0x1ec
279#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD29_OFFSET 0x1ee
280#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD30_OFFSET 0x1f0
281#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD31_OFFSET 0x1f2
282#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD32_OFFSET 0x1f4
283#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD33_OFFSET 0x1f6
284#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD34_OFFSET 0x1f8
285#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD35_OFFSET 0x1fa
286#define OMAP3_CONTROL_PADCONF_SAD2D_MCAD36_OFFSET 0x1fc
287
288/* Note that 34xx TRM has SAD2D instead of CHASSIS for these */
289#define OMAP3_CONTROL_PADCONF_CHASSIS_CLK26MI_OFFSET 0x1fe
290#define OMAP3_CONTROL_PADCONF_CHASSIS_NRESPWRON_OFFSET 0x200
291#define OMAP3_CONTROL_PADCONF_CHASSIS_NRESWARW_OFFSET 0x202
292#define OMAP3_CONTROL_PADCONF_CHASSIS_NIRQ_OFFSET 0x204
293#define OMAP3_CONTROL_PADCONF_CHASSIS_FIQ_OFFSET 0x206
294#define OMAP3_CONTROL_PADCONF_CHASSIS_ARMIRQ_OFFSET 0x208
295#define OMAP3_CONTROL_PADCONF_CHASSIS_IVAIRQ_OFFSET 0x20a
296#define OMAP3_CONTROL_PADCONF_CHASSIS_DMAREQ0_OFFSET 0x20c
297#define OMAP3_CONTROL_PADCONF_CHASSIS_DMAREQ1_OFFSET 0x20e
298#define OMAP3_CONTROL_PADCONF_CHASSIS_DMAREQ2_OFFSET 0x210
299#define OMAP3_CONTROL_PADCONF_CHASSIS_DMAREQ3_OFFSET 0x212
300#define OMAP3_CONTROL_PADCONF_CHASSIS_NTRST_OFFSET 0x214
301#define OMAP3_CONTROL_PADCONF_CHASSIS_TDI_OFFSET 0x216
302#define OMAP3_CONTROL_PADCONF_CHASSIS_TDO_OFFSET 0x218
303#define OMAP3_CONTROL_PADCONF_CHASSIS_TMS_OFFSET 0x21a
304#define OMAP3_CONTROL_PADCONF_CHASSIS_TCK_OFFSET 0x21c
305#define OMAP3_CONTROL_PADCONF_CHASSIS_RTCK_OFFSET 0x21e
306#define OMAP3_CONTROL_PADCONF_CHASSIS_MSTDBY_OFFSET 0x220
307#define OMAP3_CONTROL_PADCONF_CHASSIS_IDLEREQ_OFFSET 0x222
308#define OMAP3_CONTROL_PADCONF_CHASSIS_IDLEACK_OFFSET 0x224
309
310#define OMAP3_CONTROL_PADCONF_SAD2D_MWRITE_OFFSET 0x226
311#define OMAP3_CONTROL_PADCONF_SAD2D_SWRITE_OFFSET 0x228
312#define OMAP3_CONTROL_PADCONF_SAD2D_MREAD_OFFSET 0x22a
313#define OMAP3_CONTROL_PADCONF_SAD2D_SREAD_OFFSET 0x22c
314#define OMAP3_CONTROL_PADCONF_SAD2D_MBUSFLAG_OFFSET 0x22e
315#define OMAP3_CONTROL_PADCONF_SAD2D_SBUSFLAG_OFFSET 0x230
316#define OMAP3_CONTROL_PADCONF_SDRC_CKE0_OFFSET 0x232
317#define OMAP3_CONTROL_PADCONF_SDRC_CKE1_OFFSET 0x234
318
319/* 36xx only */
320#define OMAP3_CONTROL_PADCONF_GPMC_A11_OFFSET 0x236
321#define OMAP3_CONTROL_PADCONF_SDRC_BA0_OFFSET 0x570
322#define OMAP3_CONTROL_PADCONF_SDRC_BA1_OFFSET 0x572
323#define OMAP3_CONTROL_PADCONF_SDRC_A0_OFFSET 0x574
324#define OMAP3_CONTROL_PADCONF_SDRC_A1_OFFSET 0x576
325#define OMAP3_CONTROL_PADCONF_SDRC_A2_OFFSET 0x578
326#define OMAP3_CONTROL_PADCONF_SDRC_A3_OFFSET 0x57a
327#define OMAP3_CONTROL_PADCONF_SDRC_A4_OFFSET 0x57c
328#define OMAP3_CONTROL_PADCONF_SDRC_A5_OFFSET 0x57e
329#define OMAP3_CONTROL_PADCONF_SDRC_A6_OFFSET 0x580
330#define OMAP3_CONTROL_PADCONF_SDRC_A7_OFFSET 0x582
331#define OMAP3_CONTROL_PADCONF_SDRC_A8_OFFSET 0x584
332#define OMAP3_CONTROL_PADCONF_SDRC_A9_OFFSET 0x586
333#define OMAP3_CONTROL_PADCONF_SDRC_A10_OFFSET 0x588
334#define OMAP3_CONTROL_PADCONF_SDRC_A11_OFFSET 0x58a
335#define OMAP3_CONTROL_PADCONF_SDRC_A12_OFFSET 0x58c
336#define OMAP3_CONTROL_PADCONF_SDRC_A13_OFFSET 0x58e
337#define OMAP3_CONTROL_PADCONF_SDRC_A14_OFFSET 0x590
338#define OMAP3_CONTROL_PADCONF_SDRC_NCS0_OFFSET 0x592
339#define OMAP3_CONTROL_PADCONF_SDRC_NCS1_OFFSET 0x594
340#define OMAP3_CONTROL_PADCONF_SDRC_NCLK_OFFSET 0x596
341#define OMAP3_CONTROL_PADCONF_SDRC_NRAS_OFFSET 0x598
342#define OMAP3_CONTROL_PADCONF_SDRC_NCAS_OFFSET 0x59a
343#define OMAP3_CONTROL_PADCONF_SDRC_NWE_OFFSET 0x59c
344#define OMAP3_CONTROL_PADCONF_SDRC_DM0_OFFSET 0x59e
345#define OMAP3_CONTROL_PADCONF_SDRC_DM1_OFFSET 0x5a0
346#define OMAP3_CONTROL_PADCONF_SDRC_DM2_OFFSET 0x5a2
347#define OMAP3_CONTROL_PADCONF_SDRC_DM3_OFFSET 0x5a4
348
349/* 36xx only, these are SDMMC1_DAT4 - DAT7 on 34xx */
350#define OMAP3_CONTROL_PADCONF_SIM_IO_OFFSET 0x120
351#define OMAP3_CONTROL_PADCONF_SIM_CLK_OFFSET 0x122
352#define OMAP3_CONTROL_PADCONF_SIM_PWRCTRL_OFFSET 0x124
353#define OMAP3_CONTROL_PADCONF_SIM_RST_OFFSET 0x126
354
355#define OMAP3_CONTROL_PADCONF_ETK_CLK_OFFSET 0x5a8
356#define OMAP3_CONTROL_PADCONF_ETK_CTL_OFFSET 0x5aa
357#define OMAP3_CONTROL_PADCONF_ETK_D0_OFFSET 0x5ac
358#define OMAP3_CONTROL_PADCONF_ETK_D1_OFFSET 0x5ae
359#define OMAP3_CONTROL_PADCONF_ETK_D2_OFFSET 0x5b0
360#define OMAP3_CONTROL_PADCONF_ETK_D3_OFFSET 0x5b2
361#define OMAP3_CONTROL_PADCONF_ETK_D4_OFFSET 0x5b4
362#define OMAP3_CONTROL_PADCONF_ETK_D5_OFFSET 0x5b6
363#define OMAP3_CONTROL_PADCONF_ETK_D6_OFFSET 0x5b8
364#define OMAP3_CONTROL_PADCONF_ETK_D7_OFFSET 0x5ba
365#define OMAP3_CONTROL_PADCONF_ETK_D8_OFFSET 0x5bc
366#define OMAP3_CONTROL_PADCONF_ETK_D9_OFFSET 0x5be
367#define OMAP3_CONTROL_PADCONF_ETK_D10_OFFSET 0x5c0
368#define OMAP3_CONTROL_PADCONF_ETK_D11_OFFSET 0x5c2
369#define OMAP3_CONTROL_PADCONF_ETK_D12_OFFSET 0x5c4
370#define OMAP3_CONTROL_PADCONF_ETK_D13_OFFSET 0x5c6
371#define OMAP3_CONTROL_PADCONF_ETK_D14_OFFSET 0x5c8
372#define OMAP3_CONTROL_PADCONF_ETK_D15_OFFSET 0x5ca
373#define OMAP3_CONTROL_PADCONF_I2C4_SCL_OFFSET 0x9d0
374#define OMAP3_CONTROL_PADCONF_I2C4_SDA_OFFSET 0x9d2
375#define OMAP3_CONTROL_PADCONF_SYS_32K_OFFSET 0x9d4
376#define OMAP3_CONTROL_PADCONF_SYS_CLKREQ_OFFSET 0x9d6
377#define OMAP3_CONTROL_PADCONF_SYS_NRESWARM_OFFSET 0x9d8
378#define OMAP3_CONTROL_PADCONF_SYS_BOOT0_OFFSET 0x9da
379#define OMAP3_CONTROL_PADCONF_SYS_BOOT1_OFFSET 0x9dc
380#define OMAP3_CONTROL_PADCONF_SYS_BOOT2_OFFSET 0x9de
381#define OMAP3_CONTROL_PADCONF_SYS_BOOT3_OFFSET 0x9e0
382#define OMAP3_CONTROL_PADCONF_SYS_BOOT4_OFFSET 0x9e2
383#define OMAP3_CONTROL_PADCONF_SYS_BOOT5_OFFSET 0x9e4
384#define OMAP3_CONTROL_PADCONF_SYS_BOOT6_OFFSET 0x9e6
385#define OMAP3_CONTROL_PADCONF_SYS_OFF_MODE_OFFSET 0x9e8
386#define OMAP3_CONTROL_PADCONF_SYS_CLKOUT1_OFFSET 0x9ea
387#define OMAP3_CONTROL_PADCONF_JTAG_NTRST_OFFSET 0x9ec
388#define OMAP3_CONTROL_PADCONF_JTAG_TCK_OFFSET 0x9ee
389#define OMAP3_CONTROL_PADCONF_JTAG_TMS_TMSC_OFFSET 0x9f0
390#define OMAP3_CONTROL_PADCONF_JTAG_TDI_OFFSET 0x9f2
391#define OMAP3_CONTROL_PADCONF_JTAG_EMU0_OFFSET 0x9f4
392#define OMAP3_CONTROL_PADCONF_JTAG_EMU1_OFFSET 0x9f6
393#define OMAP3_CONTROL_PADCONF_SAD2D_SWAKEUP_OFFSET 0xa1c
394#define OMAP3_CONTROL_PADCONF_JTAG_RTCK_OFFSET 0xa1e
395#define OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET 0xa20
396
397#define OMAP3_CONTROL_PADCONF_MUX_SIZE \
398 (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2)
diff --git a/arch/arm/mach-omap2/omap-headsmp.S b/arch/arm/mach-omap2/omap-headsmp.S
index 4afadba09477..aa3f65c2ac97 100644
--- a/arch/arm/mach-omap2/omap-headsmp.S
+++ b/arch/arm/mach-omap2/omap-headsmp.S
@@ -27,20 +27,39 @@
27 * OMAP4 specific entry point for secondary CPU to jump from ROM 27 * OMAP4 specific entry point for secondary CPU to jump from ROM
28 * code. This routine also provides a holding flag into which 28 * code. This routine also provides a holding flag into which
29 * secondary core is held until we're ready for it to initialise. 29 * secondary core is held until we're ready for it to initialise.
30 * The primary core will update the this flag using a hardware 30 * The primary core will update this flag using a hardware
31 * register AuxCoreBoot1. 31 * register AuxCoreBoot0.
32 */ 32 */
33ENTRY(omap_secondary_startup) 33ENTRY(omap_secondary_startup)
34 mrc p15, 0, r0, c0, c0, 5 34hold: ldr r12,=0x103
35 and r0, r0, #0x0f 35 dsb
36hold: ldr r1, =OMAP4_AUX_CORE_BOOT1_PA @ read from AuxCoreBoot1 36 smc @ read from AuxCoreBoot0
37 ldr r2, [r1] 37 mov r0, r0, lsr #9
38 cmp r2, r0 38 mrc p15, 0, r4, c0, c0, 5
39 and r4, r4, #0x0f
40 cmp r0, r4
39 bne hold 41 bne hold
40 42
41 /* 43 /*
42 * we've been released from the cpu_release,secondary_stack 44 * we've been released from the wait loop,secondary_stack
43 * should now contain the SVC stack for this core 45 * should now contain the SVC stack for this core
44 */ 46 */
45 b secondary_startup 47 b secondary_startup
48END(omap_secondary_startup)
46 49
50
51ENTRY(omap_modify_auxcoreboot0)
52 stmfd sp!, {r1-r12, lr}
53 ldr r12, =0x104
54 dsb
55 smc
56 ldmfd sp!, {r1-r12, pc}
57END(omap_modify_auxcoreboot0)
58
59ENTRY(omap_auxcoreboot_addr)
60 stmfd sp!, {r2-r12, lr}
61 ldr r12, =0x105
62 dsb
63 smc
64 ldmfd sp!, {r2-r12, pc}
65END(omap_auxcoreboot_addr)
diff --git a/arch/arm/mach-omap2/omap-smp.c b/arch/arm/mach-omap2/omap-smp.c
index 4890bcf4dadd..38153e5fbca0 100644
--- a/arch/arm/mach-omap2/omap-smp.c
+++ b/arch/arm/mach-omap2/omap-smp.c
@@ -17,19 +17,15 @@
17 */ 17 */
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/jiffies.h>
21#include <linux/smp.h> 20#include <linux/smp.h>
22#include <linux/io.h> 21#include <linux/io.h>
23 22
23#include <asm/cacheflush.h>
24#include <asm/localtimer.h> 24#include <asm/localtimer.h>
25#include <asm/smp_scu.h> 25#include <asm/smp_scu.h>
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <plat/common.h> 27#include <plat/common.h>
28 28
29/* Registers used for communicating startup information */
30static void __iomem *omap4_auxcoreboot_reg0;
31static void __iomem *omap4_auxcoreboot_reg1;
32
33/* SCU base address */ 29/* SCU base address */
34static void __iomem *scu_base; 30static void __iomem *scu_base;
35 31
@@ -65,8 +61,6 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
65 61
66int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 62int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
67{ 63{
68 unsigned long timeout;
69
70 /* 64 /*
71 * Set synchronisation state between this boot processor 65 * Set synchronisation state between this boot processor
72 * and the secondary one 66 * and the secondary one
@@ -74,18 +68,15 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
74 spin_lock(&boot_lock); 68 spin_lock(&boot_lock);
75 69
76 /* 70 /*
77 * Update the AuxCoreBoot1 with boot state for secondary core. 71 * Update the AuxCoreBoot0 with boot state for secondary core.
78 * omap_secondary_startup() routine will hold the secondary core till 72 * omap_secondary_startup() routine will hold the secondary core till
79 * the AuxCoreBoot1 register is updated with cpu state 73 * the AuxCoreBoot1 register is updated with cpu state
80 * A barrier is added to ensure that write buffer is drained 74 * A barrier is added to ensure that write buffer is drained
81 */ 75 */
82 __raw_writel(cpu, omap4_auxcoreboot_reg1); 76 omap_modify_auxcoreboot0(0x200, 0x0);
77 flush_cache_all();
83 smp_wmb(); 78 smp_wmb();
84 79
85 timeout = jiffies + (1 * HZ);
86 while (time_before(jiffies, timeout))
87 ;
88
89 /* 80 /*
90 * Now the secondary core is starting up let it run its 81 * Now the secondary core is starting up let it run its
91 * calibrations, then wait for it to finish 82 * calibrations, then wait for it to finish
@@ -99,17 +90,18 @@ static void __init wakeup_secondary(void)
99{ 90{
100 /* 91 /*
101 * Write the address of secondary startup routine into the 92 * Write the address of secondary startup routine into the
102 * AuxCoreBoot0 where ROM code will jump and start executing 93 * AuxCoreBoot1 where ROM code will jump and start executing
103 * on secondary core once out of WFE 94 * on secondary core once out of WFE
104 * A barrier is added to ensure that write buffer is drained 95 * A barrier is added to ensure that write buffer is drained
105 */ 96 */
106 __raw_writel(virt_to_phys(omap_secondary_startup), \ 97 omap_auxcoreboot_addr(virt_to_phys(omap_secondary_startup));
107 omap4_auxcoreboot_reg0);
108 smp_wmb(); 98 smp_wmb();
109 99
110 /* 100 /*
111 * Send a 'sev' to wake the secondary core from WFE. 101 * Send a 'sev' to wake the secondary core from WFE.
102 * Drain the outstanding writes to memory
112 */ 103 */
104 dsb();
113 set_event(); 105 set_event();
114 mb(); 106 mb();
115} 107}
@@ -136,7 +128,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
136{ 128{
137 unsigned int ncores = get_core_count(); 129 unsigned int ncores = get_core_count();
138 unsigned int cpu = smp_processor_id(); 130 unsigned int cpu = smp_processor_id();
139 void __iomem *omap4_wkupgen_base;
140 int i; 131 int i;
141 132
142 /* sanity check */ 133 /* sanity check */
@@ -168,12 +159,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
168 for (i = 0; i < max_cpus; i++) 159 for (i = 0; i < max_cpus; i++)
169 set_cpu_present(i, true); 160 set_cpu_present(i, true);
170 161
171 /* Never released */
172 omap4_wkupgen_base = ioremap(OMAP44XX_WKUPGEN_BASE, SZ_4K);
173 BUG_ON(!omap4_wkupgen_base);
174 omap4_auxcoreboot_reg0 = omap4_wkupgen_base + 0x800;
175 omap4_auxcoreboot_reg1 = omap4_wkupgen_base + 0x804;
176
177 if (max_cpus > 1) { 162 if (max_cpus > 1) {
178 /* 163 /*
179 * Enable the local timer or broadcast device for the 164 * Enable the local timer or broadcast device for the
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 633b216a8b26..d8c8545875b1 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -45,6 +45,7 @@
45#include <linux/mutex.h> 45#include <linux/mutex.h>
46#include <linux/bootmem.h> 46#include <linux/bootmem.h>
47 47
48#include <plat/common.h>
48#include <plat/cpu.h> 49#include <plat/cpu.h>
49#include <plat/clockdomain.h> 50#include <plat/clockdomain.h>
50#include <plat/powerdomain.h> 51#include <plat/powerdomain.h>
@@ -210,6 +211,32 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v)
210} 211}
211 212
212/** 213/**
214 * _set_module_autoidle: set the OCP_SYSCONFIG AUTOIDLE field in @v
215 * @oh: struct omap_hwmod *
216 * @autoidle: desired AUTOIDLE bitfield value (0 or 1)
217 * @v: pointer to register contents to modify
218 *
219 * Update the module autoidle bit in @v to be @autoidle for the @oh
220 * hwmod. The autoidle bit controls whether the module can gate
221 * internal clocks automatically when it isn't doing anything; the
222 * exact function of this bit varies on a per-module basis. This
223 * function does not write to the hardware. Returns -EINVAL upon
224 * error or 0 upon success.
225 */
226static int _set_module_autoidle(struct omap_hwmod *oh, u8 autoidle,
227 u32 *v)
228{
229 if (!oh->sysconfig ||
230 !(oh->sysconfig->sysc_flags & SYSC_HAS_AUTOIDLE))
231 return -EINVAL;
232
233 *v &= ~SYSC_AUTOIDLE_MASK;
234 *v |= autoidle << SYSC_AUTOIDLE_SHIFT;
235
236 return 0;
237}
238
239/**
213 * _enable_wakeup: set OCP_SYSCONFIG.ENAWAKEUP bit in the hardware 240 * _enable_wakeup: set OCP_SYSCONFIG.ENAWAKEUP bit in the hardware
214 * @oh: struct omap_hwmod * 241 * @oh: struct omap_hwmod *
215 * 242 *
@@ -326,6 +353,9 @@ static int _init_main_clk(struct omap_hwmod *oh)
326 ret = -EINVAL; 353 ret = -EINVAL;
327 oh->_clk = c; 354 oh->_clk = c;
328 355
356 WARN(!c->clkdm, "omap_hwmod: %s: missing clockdomain for %s.\n",
357 oh->clkdev_con_id, c->name);
358
329 return ret; 359 return ret;
330} 360}
331 361
@@ -557,8 +587,19 @@ static void _sysc_enable(struct omap_hwmod *oh)
557 _set_master_standbymode(oh, idlemode, &v); 587 _set_master_standbymode(oh, idlemode, &v);
558 } 588 }
559 589
560 /* XXX OCP AUTOIDLE bit? */ 590 if (oh->sysconfig->sysc_flags & SYSC_HAS_AUTOIDLE) {
591 idlemode = (oh->flags & HWMOD_NO_OCP_AUTOIDLE) ?
592 0 : 1;
593 _set_module_autoidle(oh, idlemode, &v);
594 }
595
596 /* XXX OCP ENAWAKEUP bit? */
561 597
598 /*
599 * XXX The clock framework should handle this, by
600 * calling into this code. But this must wait until the
601 * clock structures are tagged with omap_hwmod entries
602 */
562 if (oh->flags & HWMOD_SET_DEFAULT_CLOCKACT && 603 if (oh->flags & HWMOD_SET_DEFAULT_CLOCKACT &&
563 oh->sysconfig->sysc_flags & SYSC_HAS_CLOCKACTIVITY) 604 oh->sysconfig->sysc_flags & SYSC_HAS_CLOCKACTIVITY)
564 _set_clockactivity(oh, oh->sysconfig->clockact, &v); 605 _set_clockactivity(oh, oh->sysconfig->clockact, &v);
@@ -622,7 +663,8 @@ static void _sysc_shutdown(struct omap_hwmod *oh)
622 if (oh->sysconfig->sysc_flags & SYSC_HAS_MIDLEMODE) 663 if (oh->sysconfig->sysc_flags & SYSC_HAS_MIDLEMODE)
623 _set_master_standbymode(oh, HWMOD_IDLEMODE_FORCE, &v); 664 _set_master_standbymode(oh, HWMOD_IDLEMODE_FORCE, &v);
624 665
625 /* XXX clear OCP AUTOIDLE bit? */ 666 if (oh->sysconfig->sysc_flags & SYSC_HAS_AUTOIDLE)
667 _set_module_autoidle(oh, 1, &v);
626 668
627 _write_sysconfig(v, oh); 669 _write_sysconfig(v, oh);
628} 670}
@@ -736,7 +778,7 @@ static int _wait_target_ready(struct omap_hwmod *oh)
736static int _reset(struct omap_hwmod *oh) 778static int _reset(struct omap_hwmod *oh)
737{ 779{
738 u32 r, v; 780 u32 r, v;
739 int c; 781 int c = 0;
740 782
741 if (!oh->sysconfig || 783 if (!oh->sysconfig ||
742 !(oh->sysconfig->sysc_flags & SYSC_HAS_SOFTRESET) || 784 !(oh->sysconfig->sysc_flags & SYSC_HAS_SOFTRESET) ||
@@ -758,13 +800,9 @@ static int _reset(struct omap_hwmod *oh)
758 return r; 800 return r;
759 _write_sysconfig(v, oh); 801 _write_sysconfig(v, oh);
760 802
761 c = 0; 803 omap_test_timeout((omap_hwmod_readl(oh, oh->sysconfig->syss_offs) &
762 while (c < MAX_MODULE_RESET_WAIT && 804 SYSS_RESETDONE_MASK),
763 !(omap_hwmod_readl(oh, oh->sysconfig->syss_offs) & 805 MAX_MODULE_RESET_WAIT, c);
764 SYSS_RESETDONE_MASK)) {
765 udelay(1);
766 c++;
767 }
768 806
769 if (c == MAX_MODULE_RESET_WAIT) 807 if (c == MAX_MODULE_RESET_WAIT)
770 WARN(1, "omap_hwmod: %s: failed to reset in %d usec\n", 808 WARN(1, "omap_hwmod: %s: failed to reset in %d usec\n",
@@ -884,33 +922,6 @@ static int _shutdown(struct omap_hwmod *oh)
884} 922}
885 923
886/** 924/**
887 * _write_clockact_lock - set the module's clockactivity bits
888 * @oh: struct omap_hwmod *
889 * @clockact: CLOCKACTIVITY field bits
890 *
891 * Writes the CLOCKACTIVITY bits @clockact to the hwmod @oh
892 * OCP_SYSCONFIG register. Returns -EINVAL if the hwmod is in the
893 * wrong state or returns 0.
894 */
895static int _write_clockact_lock(struct omap_hwmod *oh, u8 clockact)
896{
897 u32 v;
898
899 if (!oh->sysconfig ||
900 !(oh->sysconfig->sysc_flags & SYSC_HAS_CLOCKACTIVITY))
901 return -EINVAL;
902
903 mutex_lock(&omap_hwmod_mutex);
904 v = oh->_sysc_cache;
905 _set_clockactivity(oh, clockact, &v);
906 _write_sysconfig(v, oh);
907 mutex_unlock(&omap_hwmod_mutex);
908
909 return 0;
910}
911
912
913/**
914 * _setup - do initial configuration of omap_hwmod 925 * _setup - do initial configuration of omap_hwmod
915 * @oh: struct omap_hwmod * 926 * @oh: struct omap_hwmod *
916 * 927 *
@@ -948,11 +959,19 @@ static int _setup(struct omap_hwmod *oh)
948 959
949 _enable(oh); 960 _enable(oh);
950 961
951 if (!(oh->flags & HWMOD_INIT_NO_RESET)) 962 if (!(oh->flags & HWMOD_INIT_NO_RESET)) {
952 _reset(oh); 963 /*
953 964 * XXX Do the OCP_SYSCONFIG bits need to be
954 /* XXX OCP AUTOIDLE bit? */ 965 * reprogrammed after a reset? If not, then this can
955 /* XXX OCP ENAWAKEUP bit? */ 966 * be removed. If they do, then probably the
967 * _enable() function should be split to avoid the
968 * rewrite of the OCP_SYSCONFIG register.
969 */
970 if (oh->sysconfig) {
971 _update_sysc_cache(oh);
972 _sysc_enable(oh);
973 }
974 }
956 975
957 if (!(oh->flags & HWMOD_INIT_NO_IDLE)) 976 if (!(oh->flags & HWMOD_INIT_NO_IDLE))
958 _idle(oh); 977 _idle(oh);
@@ -1348,8 +1367,9 @@ int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res)
1348 /* For each IRQ, DMA, memory area, fill in array.*/ 1367 /* For each IRQ, DMA, memory area, fill in array.*/
1349 1368
1350 for (i = 0; i < oh->mpu_irqs_cnt; i++) { 1369 for (i = 0; i < oh->mpu_irqs_cnt; i++) {
1351 (res + r)->start = *(oh->mpu_irqs + i); 1370 (res + r)->name = (oh->mpu_irqs + i)->name;
1352 (res + r)->end = *(oh->mpu_irqs + i); 1371 (res + r)->start = (oh->mpu_irqs + i)->irq;
1372 (res + r)->end = (oh->mpu_irqs + i)->irq;
1353 (res + r)->flags = IORESOURCE_IRQ; 1373 (res + r)->flags = IORESOURCE_IRQ;
1354 r++; 1374 r++;
1355 } 1375 }
@@ -1454,62 +1474,6 @@ int omap_hwmod_del_initiator_dep(struct omap_hwmod *oh,
1454} 1474}
1455 1475
1456/** 1476/**
1457 * omap_hwmod_set_clockact_none - set clockactivity test to BOTH
1458 * @oh: struct omap_hwmod *
1459 *
1460 * On some modules, this function can affect the wakeup latency vs.
1461 * power consumption balance. Intended to be called by the
1462 * omap_device layer. Passes along the return value from
1463 * _write_clockact_lock().
1464 */
1465int omap_hwmod_set_clockact_both(struct omap_hwmod *oh)
1466{
1467 return _write_clockact_lock(oh, CLOCKACT_TEST_BOTH);
1468}
1469
1470/**
1471 * omap_hwmod_set_clockact_none - set clockactivity test to MAIN
1472 * @oh: struct omap_hwmod *
1473 *
1474 * On some modules, this function can affect the wakeup latency vs.
1475 * power consumption balance. Intended to be called by the
1476 * omap_device layer. Passes along the return value from
1477 * _write_clockact_lock().
1478 */
1479int omap_hwmod_set_clockact_main(struct omap_hwmod *oh)
1480{
1481 return _write_clockact_lock(oh, CLOCKACT_TEST_MAIN);
1482}
1483
1484/**
1485 * omap_hwmod_set_clockact_none - set clockactivity test to ICLK
1486 * @oh: struct omap_hwmod *
1487 *
1488 * On some modules, this function can affect the wakeup latency vs.
1489 * power consumption balance. Intended to be called by the
1490 * omap_device layer. Passes along the return value from
1491 * _write_clockact_lock().
1492 */
1493int omap_hwmod_set_clockact_iclk(struct omap_hwmod *oh)
1494{
1495 return _write_clockact_lock(oh, CLOCKACT_TEST_ICLK);
1496}
1497
1498/**
1499 * omap_hwmod_set_clockact_none - set clockactivity test to NONE
1500 * @oh: struct omap_hwmod *
1501 *
1502 * On some modules, this function can affect the wakeup latency vs.
1503 * power consumption balance. Intended to be called by the
1504 * omap_device layer. Passes along the return value from
1505 * _write_clockact_lock().
1506 */
1507int omap_hwmod_set_clockact_none(struct omap_hwmod *oh)
1508{
1509 return _write_clockact_lock(oh, CLOCKACT_TEST_NONE);
1510}
1511
1512/**
1513 * omap_hwmod_enable_wakeup - allow device to wake up the system 1477 * omap_hwmod_enable_wakeup - allow device to wake up the system
1514 * @oh: struct omap_hwmod * 1478 * @oh: struct omap_hwmod *
1515 * 1479 *
diff --git a/arch/arm/mach-omap2/opp2420_data.c b/arch/arm/mach-omap2/opp2420_data.c
new file mode 100644
index 000000000000..126a9396b3a8
--- /dev/null
+++ b/arch/arm/mach-omap2/opp2420_data.c
@@ -0,0 +1,126 @@
1/*
2 * opp2420_data.c - old-style "OPP" table for OMAP2420
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2009 Nokia Corporation
6 *
7 * Richard Woodruff <r-woodruff2@ti.com>
8 *
9 * The OMAP2 processor can be run at several discrete 'PRCM configurations'.
10 * These configurations are characterized by voltage and speed for clocks.
11 * The device is only validated for certain combinations. One way to express
12 * these combinations is via the 'ratio's' which the clocks operate with
13 * respect to each other. These ratio sets are for a given voltage/DPLL
14 * setting. All configurations can be described by a DPLL setting and a ratio
15 * There are 3 ratio sets for the 2430 and X ratio sets for 2420.
16 *
17 * 2430 differs from 2420 in that there are no more phase synchronizers used.
18 * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs
19 * 2430 (iva2.1, NOdsp, mdm)
20 *
21 * XXX Missing voltage data.
22 *
23 * THe format described in this file is deprecated. Once a reasonable
24 * OPP API exists, the data in this file should be converted to use it.
25 *
26 * This is technically part of the OMAP2xxx clock code.
27 */
28
29#include "opp2xxx.h"
30#include "sdrc.h"
31#include "clock.h"
32
33/*-------------------------------------------------------------------------
34 * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
35 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,
36 * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL,
37 * CM_CLKSEL2_PLL, CM_CLKSEL_MDM
38 *
39 * Filling in table based on H4 boards and 2430-SDPs variants available.
40 * There are quite a few more rates combinations which could be defined.
41 *
42 * When multiple values are defined the start up will try and choose the
43 * fastest one. If a 'fast' value is defined, then automatically, the /2
44 * one should be included as it can be used. Generally having more that
45 * one fast set does not make sense, as static timings need to be changed
46 * to change the set. The exception is the bypass setting which is
47 * availble for low power bypass.
48 *
49 * Note: This table needs to be sorted, fastest to slowest.
50 *-------------------------------------------------------------------------*/
51const struct prcm_config omap2420_rate_table[] = {
52 /* PRCM I - FAST */
53 {S12M, S660M, S330M, RI_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */
54 RI_CM_CLKSEL_DSP_VAL, RI_CM_CLKSEL_GFX_VAL,
55 RI_CM_CLKSEL1_CORE_VAL, MI_CM_CLKSEL1_PLL_12_VAL,
56 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_165MHz,
57 RATE_IN_242X},
58
59 /* PRCM II - FAST */
60 {S12M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL, /* 300MHz ARM */
61 RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
62 RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL,
63 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
64 RATE_IN_242X},
65
66 {S13M, S600M, S300M, RII_CM_CLKSEL_MPU_VAL, /* 300MHz ARM */
67 RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
68 RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL,
69 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
70 RATE_IN_242X},
71
72 /* PRCM III - FAST */
73 {S12M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */
74 RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
75 RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL,
76 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
77 RATE_IN_242X},
78
79 {S13M, S532M, S266M, RIII_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */
80 RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
81 RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL,
82 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
83 RATE_IN_242X},
84
85 /* PRCM II - SLOW */
86 {S12M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL, /* 150MHz ARM */
87 RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
88 RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_12_VAL,
89 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
90 RATE_IN_242X},
91
92 {S13M, S300M, S150M, RII_CM_CLKSEL_MPU_VAL, /* 150MHz ARM */
93 RII_CM_CLKSEL_DSP_VAL, RII_CM_CLKSEL_GFX_VAL,
94 RII_CM_CLKSEL1_CORE_VAL, MII_CM_CLKSEL1_PLL_13_VAL,
95 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_100MHz,
96 RATE_IN_242X},
97
98 /* PRCM III - SLOW */
99 {S12M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */
100 RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
101 RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_12_VAL,
102 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
103 RATE_IN_242X},
104
105 {S13M, S266M, S133M, RIII_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */
106 RIII_CM_CLKSEL_DSP_VAL, RIII_CM_CLKSEL_GFX_VAL,
107 RIII_CM_CLKSEL1_CORE_VAL, MIII_CM_CLKSEL1_PLL_13_VAL,
108 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_133MHz,
109 RATE_IN_242X},
110
111 /* PRCM-VII (boot-bypass) */
112 {S12M, S12M, S12M, RVII_CM_CLKSEL_MPU_VAL, /* 12MHz ARM*/
113 RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL,
114 RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_12_VAL,
115 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_BYPASS,
116 RATE_IN_242X},
117
118 /* PRCM-VII (boot-bypass) */
119 {S13M, S13M, S13M, RVII_CM_CLKSEL_MPU_VAL, /* 13MHz ARM */
120 RVII_CM_CLKSEL_DSP_VAL, RVII_CM_CLKSEL_GFX_VAL,
121 RVII_CM_CLKSEL1_CORE_VAL, MVII_CM_CLKSEL1_PLL_13_VAL,
122 MX_CLKSEL2_PLL_2x_VAL, 0, SDRC_RFR_CTRL_BYPASS,
123 RATE_IN_242X},
124
125 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
126};
diff --git a/arch/arm/mach-omap2/opp2430_data.c b/arch/arm/mach-omap2/opp2430_data.c
new file mode 100644
index 000000000000..edb81672c844
--- /dev/null
+++ b/arch/arm/mach-omap2/opp2430_data.c
@@ -0,0 +1,133 @@
1/*
2 * opp2420_data.c - old-style "OPP" table for OMAP2420
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2009 Nokia Corporation
6 *
7 * Richard Woodruff <r-woodruff2@ti.com>
8 *
9 * The OMAP2 processor can be run at several discrete 'PRCM configurations'.
10 * These configurations are characterized by voltage and speed for clocks.
11 * The device is only validated for certain combinations. One way to express
12 * these combinations is via the 'ratio's' which the clocks operate with
13 * respect to each other. These ratio sets are for a given voltage/DPLL
14 * setting. All configurations can be described by a DPLL setting and a ratio
15 * There are 3 ratio sets for the 2430 and X ratio sets for 2420.
16 *
17 * 2430 differs from 2420 in that there are no more phase synchronizers used.
18 * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs
19 * 2430 (iva2.1, NOdsp, mdm)
20 *
21 * XXX Missing voltage data.
22 *
23 * THe format described in this file is deprecated. Once a reasonable
24 * OPP API exists, the data in this file should be converted to use it.
25 *
26 * This is technically part of the OMAP2xxx clock code.
27 */
28
29#include "opp2xxx.h"
30#include "sdrc.h"
31#include "clock.h"
32
33/*-------------------------------------------------------------------------
34 * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
35 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,
36 * CM_CLKSEL_DSP, CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL,
37 * CM_CLKSEL2_PLL, CM_CLKSEL_MDM
38 *
39 * Filling in table based on H4 boards and 2430-SDPs variants available.
40 * There are quite a few more rates combinations which could be defined.
41 *
42 * When multiple values are defined the start up will try and choose the
43 * fastest one. If a 'fast' value is defined, then automatically, the /2
44 * one should be included as it can be used. Generally having more that
45 * one fast set does not make sense, as static timings need to be changed
46 * to change the set. The exception is the bypass setting which is
47 * availble for low power bypass.
48 *
49 * Note: This table needs to be sorted, fastest to slowest.
50 *-------------------------------------------------------------------------*/
51const struct prcm_config omap2430_rate_table[] = {
52 /* PRCM #4 - ratio2 (ES2.1) - FAST */
53 {S13M, S798M, S399M, R2_CM_CLKSEL_MPU_VAL, /* 399MHz ARM */
54 R2_CM_CLKSEL_DSP_VAL, R2_CM_CLKSEL_GFX_VAL,
55 R2_CM_CLKSEL1_CORE_VAL, M4_CM_CLKSEL1_PLL_13_VAL,
56 MX_CLKSEL2_PLL_2x_VAL, R2_CM_CLKSEL_MDM_VAL,
57 SDRC_RFR_CTRL_133MHz,
58 RATE_IN_243X},
59
60 /* PRCM #2 - ratio1 (ES2) - FAST */
61 {S13M, S658M, S329M, R1_CM_CLKSEL_MPU_VAL, /* 330MHz ARM */
62 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
63 R1_CM_CLKSEL1_CORE_VAL, M2_CM_CLKSEL1_PLL_13_VAL,
64 MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL,
65 SDRC_RFR_CTRL_165MHz,
66 RATE_IN_243X},
67
68 /* PRCM #5a - ratio1 - FAST */
69 {S13M, S532M, S266M, R1_CM_CLKSEL_MPU_VAL, /* 266MHz ARM */
70 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
71 R1_CM_CLKSEL1_CORE_VAL, M5A_CM_CLKSEL1_PLL_13_VAL,
72 MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL,
73 SDRC_RFR_CTRL_133MHz,
74 RATE_IN_243X},
75
76 /* PRCM #5b - ratio1 - FAST */
77 {S13M, S400M, S200M, R1_CM_CLKSEL_MPU_VAL, /* 200MHz ARM */
78 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
79 R1_CM_CLKSEL1_CORE_VAL, M5B_CM_CLKSEL1_PLL_13_VAL,
80 MX_CLKSEL2_PLL_2x_VAL, R1_CM_CLKSEL_MDM_VAL,
81 SDRC_RFR_CTRL_100MHz,
82 RATE_IN_243X},
83
84 /* PRCM #4 - ratio1 (ES2.1) - SLOW */
85 {S13M, S399M, S199M, R2_CM_CLKSEL_MPU_VAL, /* 200MHz ARM */
86 R2_CM_CLKSEL_DSP_VAL, R2_CM_CLKSEL_GFX_VAL,
87 R2_CM_CLKSEL1_CORE_VAL, M4_CM_CLKSEL1_PLL_13_VAL,
88 MX_CLKSEL2_PLL_1x_VAL, R2_CM_CLKSEL_MDM_VAL,
89 SDRC_RFR_CTRL_133MHz,
90 RATE_IN_243X},
91
92 /* PRCM #2 - ratio1 (ES2) - SLOW */
93 {S13M, S329M, S164M, R1_CM_CLKSEL_MPU_VAL, /* 165MHz ARM */
94 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
95 R1_CM_CLKSEL1_CORE_VAL, M2_CM_CLKSEL1_PLL_13_VAL,
96 MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL,
97 SDRC_RFR_CTRL_165MHz,
98 RATE_IN_243X},
99
100 /* PRCM #5a - ratio1 - SLOW */
101 {S13M, S266M, S133M, R1_CM_CLKSEL_MPU_VAL, /* 133MHz ARM */
102 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
103 R1_CM_CLKSEL1_CORE_VAL, M5A_CM_CLKSEL1_PLL_13_VAL,
104 MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL,
105 SDRC_RFR_CTRL_133MHz,
106 RATE_IN_243X},
107
108 /* PRCM #5b - ratio1 - SLOW*/
109 {S13M, S200M, S100M, R1_CM_CLKSEL_MPU_VAL, /* 100MHz ARM */
110 R1_CM_CLKSEL_DSP_VAL, R1_CM_CLKSEL_GFX_VAL,
111 R1_CM_CLKSEL1_CORE_VAL, M5B_CM_CLKSEL1_PLL_13_VAL,
112 MX_CLKSEL2_PLL_1x_VAL, R1_CM_CLKSEL_MDM_VAL,
113 SDRC_RFR_CTRL_100MHz,
114 RATE_IN_243X},
115
116 /* PRCM-boot/bypass */
117 {S13M, S13M, S13M, RB_CM_CLKSEL_MPU_VAL, /* 13Mhz */
118 RB_CM_CLKSEL_DSP_VAL, RB_CM_CLKSEL_GFX_VAL,
119 RB_CM_CLKSEL1_CORE_VAL, MB_CM_CLKSEL1_PLL_13_VAL,
120 MX_CLKSEL2_PLL_2x_VAL, RB_CM_CLKSEL_MDM_VAL,
121 SDRC_RFR_CTRL_BYPASS,
122 RATE_IN_243X},
123
124 /* PRCM-boot/bypass */
125 {S12M, S12M, S12M, RB_CM_CLKSEL_MPU_VAL, /* 12Mhz */
126 RB_CM_CLKSEL_DSP_VAL, RB_CM_CLKSEL_GFX_VAL,
127 RB_CM_CLKSEL1_CORE_VAL, MB_CM_CLKSEL1_PLL_12_VAL,
128 MX_CLKSEL2_PLL_2x_VAL, RB_CM_CLKSEL_MDM_VAL,
129 SDRC_RFR_CTRL_BYPASS,
130 RATE_IN_243X},
131
132 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
133};
diff --git a/arch/arm/mach-omap2/opp2xxx.h b/arch/arm/mach-omap2/opp2xxx.h
new file mode 100644
index 000000000000..ed6df04e2f29
--- /dev/null
+++ b/arch/arm/mach-omap2/opp2xxx.h
@@ -0,0 +1,424 @@
1/*
2 * opp2xxx.h - macros for old-style OMAP2xxx "OPP" definitions
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2009 Nokia Corporation
6 *
7 * Richard Woodruff <r-woodruff2@ti.com>
8 *
9 * The OMAP2 processor can be run at several discrete 'PRCM configurations'.
10 * These configurations are characterized by voltage and speed for clocks.
11 * The device is only validated for certain combinations. One way to express
12 * these combinations is via the 'ratio's' which the clocks operate with
13 * respect to each other. These ratio sets are for a given voltage/DPLL
14 * setting. All configurations can be described by a DPLL setting and a ratio
15 * There are 3 ratio sets for the 2430 and X ratio sets for 2420.
16 *
17 * 2430 differs from 2420 in that there are no more phase synchronizers used.
18 * They both have a slightly different clock domain setup. 2420(iva1,dsp) vs
19 * 2430 (iva2.1, NOdsp, mdm)
20 *
21 * XXX Missing voltage data.
22 *
23 * THe format described in this file is deprecated. Once a reasonable
24 * OPP API exists, the data in this file should be converted to use it.
25 *
26 * This is technically part of the OMAP2xxx clock code.
27 */
28
29#ifndef __ARCH_ARM_MACH_OMAP2_OPP2XXX_H
30#define __ARCH_ARM_MACH_OMAP2_OPP2XXX_H
31
32/**
33 * struct prcm_config - define clock rates on a per-OPP basis (24xx)
34 *
35 * Key dividers which make up a PRCM set. Ratio's for a PRCM are mandated.
36 * xtal_speed, dpll_speed, mpu_speed, CM_CLKSEL_MPU,CM_CLKSEL_DSP
37 * CM_CLKSEL_GFX, CM_CLKSEL1_CORE, CM_CLKSEL1_PLL CM_CLKSEL2_PLL, CM_CLKSEL_MDM
38 *
39 * This is deprecated. As soon as we have a decent OPP API, we should
40 * move all this stuff to it.
41 */
42struct prcm_config {
43 unsigned long xtal_speed; /* crystal rate */
44 unsigned long dpll_speed; /* dpll: out*xtal*M/(N-1)table_recalc */
45 unsigned long mpu_speed; /* speed of MPU */
46 unsigned long cm_clksel_mpu; /* mpu divider */
47 unsigned long cm_clksel_dsp; /* dsp+iva1 div(2420), iva2.1(2430) */
48 unsigned long cm_clksel_gfx; /* gfx dividers */
49 unsigned long cm_clksel1_core; /* major subsystem dividers */
50 unsigned long cm_clksel1_pll; /* m,n */
51 unsigned long cm_clksel2_pll; /* dpllx1 or x2 out */
52 unsigned long cm_clksel_mdm; /* modem dividers 2430 only */
53 unsigned long base_sdrc_rfr; /* base refresh timing for a set */
54 unsigned char flags;
55};
56
57
58/* Core fields for cm_clksel, not ratio governed */
59#define RX_CLKSEL_DSS1 (0x10 << 8)
60#define RX_CLKSEL_DSS2 (0x0 << 13)
61#define RX_CLKSEL_SSI (0x5 << 20)
62
63/*-------------------------------------------------------------------------
64 * Voltage/DPLL ratios
65 *-------------------------------------------------------------------------*/
66
67/* 2430 Ratio's, 2430-Ratio Config 1 */
68#define R1_CLKSEL_L3 (4 << 0)
69#define R1_CLKSEL_L4 (2 << 5)
70#define R1_CLKSEL_USB (4 << 25)
71#define R1_CM_CLKSEL1_CORE_VAL (R1_CLKSEL_USB | RX_CLKSEL_SSI | \
72 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
73 R1_CLKSEL_L4 | R1_CLKSEL_L3)
74#define R1_CLKSEL_MPU (2 << 0)
75#define R1_CM_CLKSEL_MPU_VAL R1_CLKSEL_MPU
76#define R1_CLKSEL_DSP (2 << 0)
77#define R1_CLKSEL_DSP_IF (2 << 5)
78#define R1_CM_CLKSEL_DSP_VAL (R1_CLKSEL_DSP | R1_CLKSEL_DSP_IF)
79#define R1_CLKSEL_GFX (2 << 0)
80#define R1_CM_CLKSEL_GFX_VAL R1_CLKSEL_GFX
81#define R1_CLKSEL_MDM (4 << 0)
82#define R1_CM_CLKSEL_MDM_VAL R1_CLKSEL_MDM
83
84/* 2430-Ratio Config 2 */
85#define R2_CLKSEL_L3 (6 << 0)
86#define R2_CLKSEL_L4 (2 << 5)
87#define R2_CLKSEL_USB (2 << 25)
88#define R2_CM_CLKSEL1_CORE_VAL (R2_CLKSEL_USB | RX_CLKSEL_SSI | \
89 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
90 R2_CLKSEL_L4 | R2_CLKSEL_L3)
91#define R2_CLKSEL_MPU (2 << 0)
92#define R2_CM_CLKSEL_MPU_VAL R2_CLKSEL_MPU
93#define R2_CLKSEL_DSP (2 << 0)
94#define R2_CLKSEL_DSP_IF (3 << 5)
95#define R2_CM_CLKSEL_DSP_VAL (R2_CLKSEL_DSP | R2_CLKSEL_DSP_IF)
96#define R2_CLKSEL_GFX (2 << 0)
97#define R2_CM_CLKSEL_GFX_VAL R2_CLKSEL_GFX
98#define R2_CLKSEL_MDM (6 << 0)
99#define R2_CM_CLKSEL_MDM_VAL R2_CLKSEL_MDM
100
101/* 2430-Ratio Bootm (BYPASS) */
102#define RB_CLKSEL_L3 (1 << 0)
103#define RB_CLKSEL_L4 (1 << 5)
104#define RB_CLKSEL_USB (1 << 25)
105#define RB_CM_CLKSEL1_CORE_VAL (RB_CLKSEL_USB | RX_CLKSEL_SSI | \
106 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
107 RB_CLKSEL_L4 | RB_CLKSEL_L3)
108#define RB_CLKSEL_MPU (1 << 0)
109#define RB_CM_CLKSEL_MPU_VAL RB_CLKSEL_MPU
110#define RB_CLKSEL_DSP (1 << 0)
111#define RB_CLKSEL_DSP_IF (1 << 5)
112#define RB_CM_CLKSEL_DSP_VAL (RB_CLKSEL_DSP | RB_CLKSEL_DSP_IF)
113#define RB_CLKSEL_GFX (1 << 0)
114#define RB_CM_CLKSEL_GFX_VAL RB_CLKSEL_GFX
115#define RB_CLKSEL_MDM (1 << 0)
116#define RB_CM_CLKSEL_MDM_VAL RB_CLKSEL_MDM
117
118/* 2420 Ratio Equivalents */
119#define RXX_CLKSEL_VLYNQ (0x12 << 15)
120#define RXX_CLKSEL_SSI (0x8 << 20)
121
122/* 2420-PRCM III 532MHz core */
123#define RIII_CLKSEL_L3 (4 << 0) /* 133MHz */
124#define RIII_CLKSEL_L4 (2 << 5) /* 66.5MHz */
125#define RIII_CLKSEL_USB (4 << 25) /* 33.25MHz */
126#define RIII_CM_CLKSEL1_CORE_VAL (RIII_CLKSEL_USB | RXX_CLKSEL_SSI | \
127 RXX_CLKSEL_VLYNQ | RX_CLKSEL_DSS2 | \
128 RX_CLKSEL_DSS1 | RIII_CLKSEL_L4 | \
129 RIII_CLKSEL_L3)
130#define RIII_CLKSEL_MPU (2 << 0) /* 266MHz */
131#define RIII_CM_CLKSEL_MPU_VAL RIII_CLKSEL_MPU
132#define RIII_CLKSEL_DSP (3 << 0) /* c5x - 177.3MHz */
133#define RIII_CLKSEL_DSP_IF (2 << 5) /* c5x - 88.67MHz */
134#define RIII_SYNC_DSP (1 << 7) /* Enable sync */
135#define RIII_CLKSEL_IVA (6 << 8) /* iva1 - 88.67MHz */
136#define RIII_SYNC_IVA (1 << 13) /* Enable sync */
137#define RIII_CM_CLKSEL_DSP_VAL (RIII_SYNC_IVA | RIII_CLKSEL_IVA | \
138 RIII_SYNC_DSP | RIII_CLKSEL_DSP_IF | \
139 RIII_CLKSEL_DSP)
140#define RIII_CLKSEL_GFX (2 << 0) /* 66.5MHz */
141#define RIII_CM_CLKSEL_GFX_VAL RIII_CLKSEL_GFX
142
143/* 2420-PRCM II 600MHz core */
144#define RII_CLKSEL_L3 (6 << 0) /* 100MHz */
145#define RII_CLKSEL_L4 (2 << 5) /* 50MHz */
146#define RII_CLKSEL_USB (2 << 25) /* 50MHz */
147#define RII_CM_CLKSEL1_CORE_VAL (RII_CLKSEL_USB | RXX_CLKSEL_SSI | \
148 RXX_CLKSEL_VLYNQ | RX_CLKSEL_DSS2 | \
149 RX_CLKSEL_DSS1 | RII_CLKSEL_L4 | \
150 RII_CLKSEL_L3)
151#define RII_CLKSEL_MPU (2 << 0) /* 300MHz */
152#define RII_CM_CLKSEL_MPU_VAL RII_CLKSEL_MPU
153#define RII_CLKSEL_DSP (3 << 0) /* c5x - 200MHz */
154#define RII_CLKSEL_DSP_IF (2 << 5) /* c5x - 100MHz */
155#define RII_SYNC_DSP (0 << 7) /* Bypass sync */
156#define RII_CLKSEL_IVA (3 << 8) /* iva1 - 200MHz */
157#define RII_SYNC_IVA (0 << 13) /* Bypass sync */
158#define RII_CM_CLKSEL_DSP_VAL (RII_SYNC_IVA | RII_CLKSEL_IVA | \
159 RII_SYNC_DSP | RII_CLKSEL_DSP_IF | \
160 RII_CLKSEL_DSP)
161#define RII_CLKSEL_GFX (2 << 0) /* 50MHz */
162#define RII_CM_CLKSEL_GFX_VAL RII_CLKSEL_GFX
163
164/* 2420-PRCM I 660MHz core */
165#define RI_CLKSEL_L3 (4 << 0) /* 165MHz */
166#define RI_CLKSEL_L4 (2 << 5) /* 82.5MHz */
167#define RI_CLKSEL_USB (4 << 25) /* 41.25MHz */
168#define RI_CM_CLKSEL1_CORE_VAL (RI_CLKSEL_USB | \
169 RXX_CLKSEL_SSI | RXX_CLKSEL_VLYNQ | \
170 RX_CLKSEL_DSS2 | RX_CLKSEL_DSS1 | \
171 RI_CLKSEL_L4 | RI_CLKSEL_L3)
172#define RI_CLKSEL_MPU (2 << 0) /* 330MHz */
173#define RI_CM_CLKSEL_MPU_VAL RI_CLKSEL_MPU
174#define RI_CLKSEL_DSP (3 << 0) /* c5x - 220MHz */
175#define RI_CLKSEL_DSP_IF (2 << 5) /* c5x - 110MHz */
176#define RI_SYNC_DSP (1 << 7) /* Activate sync */
177#define RI_CLKSEL_IVA (4 << 8) /* iva1 - 165MHz */
178#define RI_SYNC_IVA (0 << 13) /* Bypass sync */
179#define RI_CM_CLKSEL_DSP_VAL (RI_SYNC_IVA | RI_CLKSEL_IVA | \
180 RI_SYNC_DSP | RI_CLKSEL_DSP_IF | \
181 RI_CLKSEL_DSP)
182#define RI_CLKSEL_GFX (1 << 0) /* 165MHz */
183#define RI_CM_CLKSEL_GFX_VAL RI_CLKSEL_GFX
184
185/* 2420-PRCM VII (boot) */
186#define RVII_CLKSEL_L3 (1 << 0)
187#define RVII_CLKSEL_L4 (1 << 5)
188#define RVII_CLKSEL_DSS1 (1 << 8)
189#define RVII_CLKSEL_DSS2 (0 << 13)
190#define RVII_CLKSEL_VLYNQ (1 << 15)
191#define RVII_CLKSEL_SSI (1 << 20)
192#define RVII_CLKSEL_USB (1 << 25)
193
194#define RVII_CM_CLKSEL1_CORE_VAL (RVII_CLKSEL_USB | RVII_CLKSEL_SSI | \
195 RVII_CLKSEL_VLYNQ | \
196 RVII_CLKSEL_DSS2 | RVII_CLKSEL_DSS1 | \
197 RVII_CLKSEL_L4 | RVII_CLKSEL_L3)
198
199#define RVII_CLKSEL_MPU (1 << 0) /* all divide by 1 */
200#define RVII_CM_CLKSEL_MPU_VAL RVII_CLKSEL_MPU
201
202#define RVII_CLKSEL_DSP (1 << 0)
203#define RVII_CLKSEL_DSP_IF (1 << 5)
204#define RVII_SYNC_DSP (0 << 7)
205#define RVII_CLKSEL_IVA (1 << 8)
206#define RVII_SYNC_IVA (0 << 13)
207#define RVII_CM_CLKSEL_DSP_VAL (RVII_SYNC_IVA | RVII_CLKSEL_IVA | \
208 RVII_SYNC_DSP | RVII_CLKSEL_DSP_IF | \
209 RVII_CLKSEL_DSP)
210
211#define RVII_CLKSEL_GFX (1 << 0)
212#define RVII_CM_CLKSEL_GFX_VAL RVII_CLKSEL_GFX
213
214/*-------------------------------------------------------------------------
215 * 2430 Target modes: Along with each configuration the CPU has several
216 * modes which goes along with them. Modes mainly are the addition of
217 * describe DPLL combinations to go along with a ratio.
218 *-------------------------------------------------------------------------*/
219
220/* Hardware governed */
221#define MX_48M_SRC (0 << 3)
222#define MX_54M_SRC (0 << 5)
223#define MX_APLLS_CLIKIN_12 (3 << 23)
224#define MX_APLLS_CLIKIN_13 (2 << 23)
225#define MX_APLLS_CLIKIN_19_2 (0 << 23)
226
227/*
228 * 2430 - standalone, 2*ref*M/(n+1), M/N is for exactness not relock speed
229 * #5a (ratio1) baseport-target, target DPLL = 266*2 = 532MHz
230 */
231#define M5A_DPLL_MULT_12 (133 << 12)
232#define M5A_DPLL_DIV_12 (5 << 8)
233#define M5A_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
234 M5A_DPLL_DIV_12 | M5A_DPLL_MULT_12 | \
235 MX_APLLS_CLIKIN_12)
236#define M5A_DPLL_MULT_13 (61 << 12)
237#define M5A_DPLL_DIV_13 (2 << 8)
238#define M5A_CM_CLKSEL1_PLL_13_VAL (MX_48M_SRC | MX_54M_SRC | \
239 M5A_DPLL_DIV_13 | M5A_DPLL_MULT_13 | \
240 MX_APLLS_CLIKIN_13)
241#define M5A_DPLL_MULT_19 (55 << 12)
242#define M5A_DPLL_DIV_19 (3 << 8)
243#define M5A_CM_CLKSEL1_PLL_19_VAL (MX_48M_SRC | MX_54M_SRC | \
244 M5A_DPLL_DIV_19 | M5A_DPLL_MULT_19 | \
245 MX_APLLS_CLIKIN_19_2)
246/* #5b (ratio1) target DPLL = 200*2 = 400MHz */
247#define M5B_DPLL_MULT_12 (50 << 12)
248#define M5B_DPLL_DIV_12 (2 << 8)
249#define M5B_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
250 M5B_DPLL_DIV_12 | M5B_DPLL_MULT_12 | \
251 MX_APLLS_CLIKIN_12)
252#define M5B_DPLL_MULT_13 (200 << 12)
253#define M5B_DPLL_DIV_13 (12 << 8)
254
255#define M5B_CM_CLKSEL1_PLL_13_VAL (MX_48M_SRC | MX_54M_SRC | \
256 M5B_DPLL_DIV_13 | M5B_DPLL_MULT_13 | \
257 MX_APLLS_CLIKIN_13)
258#define M5B_DPLL_MULT_19 (125 << 12)
259#define M5B_DPLL_DIV_19 (31 << 8)
260#define M5B_CM_CLKSEL1_PLL_19_VAL (MX_48M_SRC | MX_54M_SRC | \
261 M5B_DPLL_DIV_19 | M5B_DPLL_MULT_19 | \
262 MX_APLLS_CLIKIN_19_2)
263/*
264 * #4 (ratio2), DPLL = 399*2 = 798MHz, L3=133MHz
265 */
266#define M4_DPLL_MULT_12 (133 << 12)
267#define M4_DPLL_DIV_12 (3 << 8)
268#define M4_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
269 M4_DPLL_DIV_12 | M4_DPLL_MULT_12 | \
270 MX_APLLS_CLIKIN_12)
271
272#define M4_DPLL_MULT_13 (399 << 12)
273#define M4_DPLL_DIV_13 (12 << 8)
274#define M4_CM_CLKSEL1_PLL_13_VAL (MX_48M_SRC | MX_54M_SRC | \
275 M4_DPLL_DIV_13 | M4_DPLL_MULT_13 | \
276 MX_APLLS_CLIKIN_13)
277
278#define M4_DPLL_MULT_19 (145 << 12)
279#define M4_DPLL_DIV_19 (6 << 8)
280#define M4_CM_CLKSEL1_PLL_19_VAL (MX_48M_SRC | MX_54M_SRC | \
281 M4_DPLL_DIV_19 | M4_DPLL_MULT_19 | \
282 MX_APLLS_CLIKIN_19_2)
283
284/*
285 * #3 (ratio2) baseport-target, target DPLL = 330*2 = 660MHz
286 */
287#define M3_DPLL_MULT_12 (55 << 12)
288#define M3_DPLL_DIV_12 (1 << 8)
289#define M3_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
290 M3_DPLL_DIV_12 | M3_DPLL_MULT_12 | \
291 MX_APLLS_CLIKIN_12)
292#define M3_DPLL_MULT_13 (76 << 12)
293#define M3_DPLL_DIV_13 (2 << 8)
294#define M3_CM_CLKSEL1_PLL_13_VAL (MX_48M_SRC | MX_54M_SRC | \
295 M3_DPLL_DIV_13 | M3_DPLL_MULT_13 | \
296 MX_APLLS_CLIKIN_13)
297#define M3_DPLL_MULT_19 (17 << 12)
298#define M3_DPLL_DIV_19 (0 << 8)
299#define M3_CM_CLKSEL1_PLL_19_VAL (MX_48M_SRC | MX_54M_SRC | \
300 M3_DPLL_DIV_19 | M3_DPLL_MULT_19 | \
301 MX_APLLS_CLIKIN_19_2)
302
303/*
304 * #2 (ratio1) DPLL = 330*2 = 660MHz, L3=165MHz
305 */
306#define M2_DPLL_MULT_12 (55 << 12)
307#define M2_DPLL_DIV_12 (1 << 8)
308#define M2_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
309 M2_DPLL_DIV_12 | M2_DPLL_MULT_12 | \
310 MX_APLLS_CLIKIN_12)
311
312/* Speed changes - Used 658.7MHz instead of 660MHz for LP-Refresh M=76 N=2,
313 * relock time issue */
314/* Core frequency changed from 330/165 to 329/164 MHz*/
315#define M2_DPLL_MULT_13 (76 << 12)
316#define M2_DPLL_DIV_13 (2 << 8)
317#define M2_CM_CLKSEL1_PLL_13_VAL (MX_48M_SRC | MX_54M_SRC | \
318 M2_DPLL_DIV_13 | M2_DPLL_MULT_13 | \
319 MX_APLLS_CLIKIN_13)
320
321#define M2_DPLL_MULT_19 (17 << 12)
322#define M2_DPLL_DIV_19 (0 << 8)
323#define M2_CM_CLKSEL1_PLL_19_VAL (MX_48M_SRC | MX_54M_SRC | \
324 M2_DPLL_DIV_19 | M2_DPLL_MULT_19 | \
325 MX_APLLS_CLIKIN_19_2)
326
327/* boot (boot) */
328#define MB_DPLL_MULT (1 << 12)
329#define MB_DPLL_DIV (0 << 8)
330#define MB_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
331 MB_DPLL_DIV | MB_DPLL_MULT | \
332 MX_APLLS_CLIKIN_12)
333
334#define MB_CM_CLKSEL1_PLL_13_VAL (MX_48M_SRC | MX_54M_SRC | \
335 MB_DPLL_DIV | MB_DPLL_MULT | \
336 MX_APLLS_CLIKIN_13)
337
338#define MB_CM_CLKSEL1_PLL_19_VAL (MX_48M_SRC | MX_54M_SRC | \
339 MB_DPLL_DIV | MB_DPLL_MULT | \
340 MX_APLLS_CLIKIN_19)
341
342/*
343 * 2430 - chassis (sedna)
344 * 165 (ratio1) same as above #2
345 * 150 (ratio1)
346 * 133 (ratio2) same as above #4
347 * 110 (ratio2) same as above #3
348 * 104 (ratio2)
349 * boot (boot)
350 */
351
352/* PRCM I target DPLL = 2*330MHz = 660MHz */
353#define MI_DPLL_MULT_12 (55 << 12)
354#define MI_DPLL_DIV_12 (1 << 8)
355#define MI_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
356 MI_DPLL_DIV_12 | MI_DPLL_MULT_12 | \
357 MX_APLLS_CLIKIN_12)
358
359/*
360 * 2420 Equivalent - mode registers
361 * PRCM II , target DPLL = 2*300MHz = 600MHz
362 */
363#define MII_DPLL_MULT_12 (50 << 12)
364#define MII_DPLL_DIV_12 (1 << 8)
365#define MII_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
366 MII_DPLL_DIV_12 | MII_DPLL_MULT_12 | \
367 MX_APLLS_CLIKIN_12)
368#define MII_DPLL_MULT_13 (300 << 12)
369#define MII_DPLL_DIV_13 (12 << 8)
370#define MII_CM_CLKSEL1_PLL_13_VAL (MX_48M_SRC | MX_54M_SRC | \
371 MII_DPLL_DIV_13 | MII_DPLL_MULT_13 | \
372 MX_APLLS_CLIKIN_13)
373
374/* PRCM III target DPLL = 2*266 = 532MHz*/
375#define MIII_DPLL_MULT_12 (133 << 12)
376#define MIII_DPLL_DIV_12 (5 << 8)
377#define MIII_CM_CLKSEL1_PLL_12_VAL (MX_48M_SRC | MX_54M_SRC | \
378 MIII_DPLL_DIV_12 | \
379 MIII_DPLL_MULT_12 | MX_APLLS_CLIKIN_12)
380#define MIII_DPLL_MULT_13 (266 << 12)
381#define MIII_DPLL_DIV_13 (12 << 8)
382#define MIII_CM_CLKSEL1_PLL_13_VAL (MX_48M_SRC | MX_54M_SRC | \
383 MIII_DPLL_DIV_13 | \
384 MIII_DPLL_MULT_13 | MX_APLLS_CLIKIN_13)
385
386/* PRCM VII (boot bypass) */
387#define MVII_CM_CLKSEL1_PLL_12_VAL MB_CM_CLKSEL1_PLL_12_VAL
388#define MVII_CM_CLKSEL1_PLL_13_VAL MB_CM_CLKSEL1_PLL_13_VAL
389
390/* High and low operation value */
391#define MX_CLKSEL2_PLL_2x_VAL (2 << 0)
392#define MX_CLKSEL2_PLL_1x_VAL (1 << 0)
393
394/* MPU speed defines */
395#define S12M 12000000
396#define S13M 13000000
397#define S19M 19200000
398#define S26M 26000000
399#define S100M 100000000
400#define S133M 133000000
401#define S150M 150000000
402#define S164M 164000000
403#define S165M 165000000
404#define S199M 199000000
405#define S200M 200000000
406#define S266M 266000000
407#define S300M 300000000
408#define S329M 329000000
409#define S330M 330000000
410#define S399M 399000000
411#define S400M 400000000
412#define S532M 532000000
413#define S600M 600000000
414#define S658M 658000000
415#define S660M 660000000
416#define S798M 798000000
417
418
419extern const struct prcm_config omap2420_rate_table[];
420extern const struct prcm_config omap2430_rate_table[];
421extern const struct prcm_config *rate_table;
422extern const struct prcm_config *curr_prcm_set;
423
424#endif
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 8baa30d2acfb..860b755d2220 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -326,7 +326,7 @@ int pm_dbg_regset_save(int reg_set)
326 return 0; 326 return 0;
327} 327}
328 328
329static const char pwrdm_state_names[][4] = { 329static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = {
330 "OFF", 330 "OFF",
331 "RET", 331 "RET",
332 "INA", 332 "INA",
@@ -381,7 +381,7 @@ static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user)
381 381
382 seq_printf(s, "%s (%s)", pwrdm->name, 382 seq_printf(s, "%s (%s)", pwrdm->name,
383 pwrdm_state_names[pwrdm->state]); 383 pwrdm_state_names[pwrdm->state]);
384 for (i = 0; i < 4; i++) 384 for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
385 seq_printf(s, ",%s:%d", pwrdm_state_names[i], 385 seq_printf(s, ",%s:%d", pwrdm_state_names[i],
386 pwrdm->state_counter[i]); 386 pwrdm->state_counter[i]);
387 387
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index b6990e377783..26b3f3ee82a3 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -10,9 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13#ifdef CONFIG_OMAP_DEBUG_POWERDOMAIN 13#undef DEBUG
14# define DEBUG
15#endif
16 14
17#include <linux/kernel.h> 15#include <linux/kernel.h>
18#include <linux/module.h> 16#include <linux/module.h>
@@ -160,7 +158,7 @@ static __init void _pwrdm_setup(struct powerdomain *pwrdm)
160{ 158{
161 int i; 159 int i;
162 160
163 for (i = 0; i < 4; i++) 161 for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
164 pwrdm->state_counter[i] = 0; 162 pwrdm->state_counter[i] = 0;
165 163
166 pwrdm_wait_transition(pwrdm); 164 pwrdm_wait_transition(pwrdm);
@@ -480,7 +478,7 @@ int pwrdm_add_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
480 if (IS_ERR(p)) { 478 if (IS_ERR(p)) {
481 pr_debug("powerdomain: hardware cannot set/clear wake up of " 479 pr_debug("powerdomain: hardware cannot set/clear wake up of "
482 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name); 480 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name);
483 return IS_ERR(p); 481 return PTR_ERR(p);
484 } 482 }
485 483
486 pr_debug("powerdomain: hardware will wake up %s when %s wakes up\n", 484 pr_debug("powerdomain: hardware will wake up %s when %s wakes up\n",
@@ -513,7 +511,7 @@ int pwrdm_del_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
513 if (IS_ERR(p)) { 511 if (IS_ERR(p)) {
514 pr_debug("powerdomain: hardware cannot set/clear wake up of " 512 pr_debug("powerdomain: hardware cannot set/clear wake up of "
515 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name); 513 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name);
516 return IS_ERR(p); 514 return PTR_ERR(p);
517 } 515 }
518 516
519 pr_debug("powerdomain: hardware will no longer wake up %s after %s " 517 pr_debug("powerdomain: hardware will no longer wake up %s after %s "
@@ -550,7 +548,7 @@ int pwrdm_read_wkdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
550 if (IS_ERR(p)) { 548 if (IS_ERR(p)) {
551 pr_debug("powerdomain: hardware cannot set/clear wake up of " 549 pr_debug("powerdomain: hardware cannot set/clear wake up of "
552 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name); 550 "%s when %s wakes up\n", pwrdm1->name, pwrdm2->name);
553 return IS_ERR(p); 551 return PTR_ERR(p);
554 } 552 }
555 553
556 return prm_read_mod_bits_shift(pwrdm1->prcm_offs, PM_WKDEP, 554 return prm_read_mod_bits_shift(pwrdm1->prcm_offs, PM_WKDEP,
@@ -573,10 +571,10 @@ int pwrdm_add_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
573{ 571{
574 struct powerdomain *p; 572 struct powerdomain *p;
575 573
576 if (!pwrdm1) 574 if (!cpu_is_omap34xx())
577 return -EINVAL; 575 return -EINVAL;
578 576
579 if (!cpu_is_omap34xx()) 577 if (!pwrdm1)
580 return -EINVAL; 578 return -EINVAL;
581 579
582 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs); 580 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs);
@@ -584,7 +582,7 @@ int pwrdm_add_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
584 pr_debug("powerdomain: hardware cannot set/clear sleep " 582 pr_debug("powerdomain: hardware cannot set/clear sleep "
585 "dependency affecting %s from %s\n", pwrdm1->name, 583 "dependency affecting %s from %s\n", pwrdm1->name,
586 pwrdm2->name); 584 pwrdm2->name);
587 return IS_ERR(p); 585 return PTR_ERR(p);
588 } 586 }
589 587
590 pr_debug("powerdomain: will prevent %s from sleeping if %s is active\n", 588 pr_debug("powerdomain: will prevent %s from sleeping if %s is active\n",
@@ -612,10 +610,10 @@ int pwrdm_del_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
612{ 610{
613 struct powerdomain *p; 611 struct powerdomain *p;
614 612
615 if (!pwrdm1) 613 if (!cpu_is_omap34xx())
616 return -EINVAL; 614 return -EINVAL;
617 615
618 if (!cpu_is_omap34xx()) 616 if (!pwrdm1)
619 return -EINVAL; 617 return -EINVAL;
620 618
621 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs); 619 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs);
@@ -623,7 +621,7 @@ int pwrdm_del_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
623 pr_debug("powerdomain: hardware cannot set/clear sleep " 621 pr_debug("powerdomain: hardware cannot set/clear sleep "
624 "dependency affecting %s from %s\n", pwrdm1->name, 622 "dependency affecting %s from %s\n", pwrdm1->name,
625 pwrdm2->name); 623 pwrdm2->name);
626 return IS_ERR(p); 624 return PTR_ERR(p);
627 } 625 }
628 626
629 pr_debug("powerdomain: will no longer prevent %s from sleeping if " 627 pr_debug("powerdomain: will no longer prevent %s from sleeping if "
@@ -655,10 +653,10 @@ int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
655{ 653{
656 struct powerdomain *p; 654 struct powerdomain *p;
657 655
658 if (!pwrdm1) 656 if (!cpu_is_omap34xx())
659 return -EINVAL; 657 return -EINVAL;
660 658
661 if (!cpu_is_omap34xx()) 659 if (!pwrdm1)
662 return -EINVAL; 660 return -EINVAL;
663 661
664 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs); 662 p = _pwrdm_deps_lookup(pwrdm2, pwrdm1->sleepdep_srcs);
@@ -666,7 +664,7 @@ int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2)
666 pr_debug("powerdomain: hardware cannot set/clear sleep " 664 pr_debug("powerdomain: hardware cannot set/clear sleep "
667 "dependency affecting %s from %s\n", pwrdm1->name, 665 "dependency affecting %s from %s\n", pwrdm1->name,
668 pwrdm2->name); 666 pwrdm2->name);
669 return IS_ERR(p); 667 return PTR_ERR(p);
670 } 668 }
671 669
672 return prm_read_mod_bits_shift(pwrdm1->prcm_offs, OMAP3430_CM_SLEEPDEP, 670 return prm_read_mod_bits_shift(pwrdm1->prcm_offs, OMAP3430_CM_SLEEPDEP,
@@ -985,6 +983,9 @@ int pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
985 if (pwrdm->banks < (bank + 1)) 983 if (pwrdm->banks < (bank + 1))
986 return -EEXIST; 984 return -EEXIST;
987 985
986 if (pwrdm->flags & PWRDM_HAS_MPU_QUIRK)
987 bank = 1;
988
988 /* 989 /*
989 * The register bit names below may not correspond to the 990 * The register bit names below may not correspond to the
990 * actual names of the bits in each powerdomain's register, 991 * actual names of the bits in each powerdomain's register,
@@ -1032,6 +1033,9 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
1032 if (pwrdm->banks < (bank + 1)) 1033 if (pwrdm->banks < (bank + 1))
1033 return -EEXIST; 1034 return -EEXIST;
1034 1035
1036 if (pwrdm->flags & PWRDM_HAS_MPU_QUIRK)
1037 bank = 1;
1038
1035 /* 1039 /*
1036 * The register bit names below may not correspond to the 1040 * The register bit names below may not correspond to the
1037 * actual names of the bits in each powerdomain's register, 1041 * actual names of the bits in each powerdomain's register,
diff --git a/arch/arm/mach-omap2/powerdomains34xx.h b/arch/arm/mach-omap2/powerdomains34xx.h
index fd09b0827df0..588f7e07d0ea 100644
--- a/arch/arm/mach-omap2/powerdomains34xx.h
+++ b/arch/arm/mach-omap2/powerdomains34xx.h
@@ -190,6 +190,7 @@ static struct powerdomain mpu_34xx_pwrdm = {
190 .wkdep_srcs = mpu_34xx_wkdeps, 190 .wkdep_srcs = mpu_34xx_wkdeps,
191 .pwrsts = PWRSTS_OFF_RET_ON, 191 .pwrsts = PWRSTS_OFF_RET_ON,
192 .pwrsts_logic_ret = PWRSTS_OFF_RET, 192 .pwrsts_logic_ret = PWRSTS_OFF_RET,
193 .flags = PWRDM_HAS_MPU_QUIRK,
193 .banks = 1, 194 .banks = 1,
194 .pwrsts_mem_ret = { 195 .pwrsts_mem_ret = {
195 [0] = PWRSTS_OFF_RET, 196 [0] = PWRSTS_OFF_RET,
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index cb1ae84e0925..61ac2a418bd0 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -4,10 +4,12 @@
4/* 4/*
5 * OMAP2/3 PRCM base and module definitions 5 * OMAP2/3 PRCM base and module definitions
6 * 6 *
7 * Copyright (C) 2007-2008 Texas Instruments, Inc. 7 * Copyright (C) 2007-2009 Texas Instruments, Inc.
8 * Copyright (C) 2007-2008 Nokia Corporation 8 * Copyright (C) 2007-2009 Nokia Corporation
9 * 9 *
10 * Written by Paul Walmsley 10 * Written by Paul Walmsley
11 * OMAP4 defines in this file are automatically generated from the OMAP hardware
12 * databases.
11 * 13 *
12 * This program is free software; you can redistribute it and/or modify 14 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
@@ -49,6 +51,73 @@
49#define OMAP3430_NEON_MOD 0xb00 51#define OMAP3430_NEON_MOD 0xb00
50#define OMAP3430ES2_USBHOST_MOD 0xc00 52#define OMAP3430ES2_USBHOST_MOD 0xc00
51 53
54#define BITS(n_bit) \
55 (((1 << n_bit) - 1) | (1 << n_bit))
56
57#define BITFIELD(l_bit, u_bit) \
58 (BITS(u_bit) & ~((BITS(l_bit)) >> 1))
59
60/* OMAP44XX specific module offsets */
61
62/* CM1 instances */
63
64#define OMAP4430_CM1_OCP_SOCKET_MOD 0x0000
65#define OMAP4430_CM1_CKGEN_MOD 0x0100
66#define OMAP4430_CM1_MPU_MOD 0x0300
67#define OMAP4430_CM1_TESLA_MOD 0x0400
68#define OMAP4430_CM1_ABE_MOD 0x0500
69#define OMAP4430_CM1_RESTORE_MOD 0x0e00
70#define OMAP4430_CM1_INSTR_MOD 0x0f00
71
72/* CM2 instances */
73
74#define OMAP4430_CM2_OCP_SOCKET_MOD 0x0000
75#define OMAP4430_CM2_CKGEN_MOD 0x0100
76#define OMAP4430_CM2_ALWAYS_ON_MOD 0x0600
77#define OMAP4430_CM2_CORE_MOD 0x0700
78#define OMAP4430_CM2_IVAHD_MOD 0x0f00
79#define OMAP4430_CM2_CAM_MOD 0x1000
80#define OMAP4430_CM2_DSS_MOD 0x1100
81#define OMAP4430_CM2_GFX_MOD 0x1200
82#define OMAP4430_CM2_L3INIT_MOD 0x1300
83#define OMAP4430_CM2_L4PER_MOD 0x1400
84#define OMAP4430_CM2_CEFUSE_MOD 0x1600
85#define OMAP4430_CM2_RESTORE_MOD 0x1e00
86#define OMAP4430_CM2_INSTR_MOD 0x1f00
87
88/* PRM instances */
89
90#define OMAP4430_PRM_OCP_SOCKET_MOD 0x0000
91#define OMAP4430_PRM_CKGEN_MOD 0x0100
92#define OMAP4430_PRM_MPU_MOD 0x0300
93#define OMAP4430_PRM_TESLA_MOD 0x0400
94#define OMAP4430_PRM_ABE_MOD 0x0500
95#define OMAP4430_PRM_ALWAYS_ON_MOD 0x0600
96#define OMAP4430_PRM_CORE_MOD 0x0700
97#define OMAP4430_PRM_IVAHD_MOD 0x0f00
98#define OMAP4430_PRM_CAM_MOD 0x1000
99#define OMAP4430_PRM_DSS_MOD 0x1100
100#define OMAP4430_PRM_GFX_MOD 0x1200
101#define OMAP4430_PRM_L3INIT_MOD 0x1300
102#define OMAP4430_PRM_L4PER_MOD 0x1400
103#define OMAP4430_PRM_CEFUSE_MOD 0x1600
104#define OMAP4430_PRM_WKUP_MOD 0x1700
105#define OMAP4430_PRM_WKUP_CM_MOD 0x1800
106#define OMAP4430_PRM_EMU_MOD 0x1900
107#define OMAP4430_PRM_EMU_CM_MOD 0x1a00
108#define OMAP4430_PRM_DEVICE_MOD 0x1b00
109#define OMAP4430_PRM_INSTR_MOD 0x1f00
110
111/* SCRM instances */
112
113#define OMAP4430_SCRM_SCRM_MOD 0x0000
114
115/* CHIRONSS instances */
116
117#define OMAP4430_CHIRONSS_CHIRONSS_OCP_SOCKET_PRCM_MOD 0x0000
118#define OMAP4430_CHIRONSS_CHIRONSS_DEVICE_PRM_MOD 0x0200
119#define OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD 0x0400
120#define OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD 0x0800
52 121
53/* 24XX register bits shared between CM & PRM registers */ 122/* 24XX register bits shared between CM & PRM registers */
54 123
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
index 029d376198d4..3ea8177ffb25 100644
--- a/arch/arm/mach-omap2/prcm.c
+++ b/arch/arm/mach-omap2/prcm.c
@@ -34,6 +34,7 @@
34 34
35static void __iomem *prm_base; 35static void __iomem *prm_base;
36static void __iomem *cm_base; 36static void __iomem *cm_base;
37static void __iomem *cm2_base;
37 38
38#define MAX_MODULE_ENABLE_WAIT 100000 39#define MAX_MODULE_ENABLE_WAIT 100000
39 40
@@ -170,14 +171,12 @@ u32 prm_read_mod_reg(s16 module, u16 idx)
170{ 171{
171 return __omap_prcm_read(prm_base, module, idx); 172 return __omap_prcm_read(prm_base, module, idx);
172} 173}
173EXPORT_SYMBOL(prm_read_mod_reg);
174 174
175/* Write into a register in a PRM module */ 175/* Write into a register in a PRM module */
176void prm_write_mod_reg(u32 val, s16 module, u16 idx) 176void prm_write_mod_reg(u32 val, s16 module, u16 idx)
177{ 177{
178 __omap_prcm_write(val, prm_base, module, idx); 178 __omap_prcm_write(val, prm_base, module, idx);
179} 179}
180EXPORT_SYMBOL(prm_write_mod_reg);
181 180
182/* Read-modify-write a register in a PRM module. Caller must lock */ 181/* Read-modify-write a register in a PRM module. Caller must lock */
183u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) 182u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
@@ -191,21 +190,18 @@ u32 prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
191 190
192 return v; 191 return v;
193} 192}
194EXPORT_SYMBOL(prm_rmw_mod_reg_bits);
195 193
196/* Read a register in a CM module */ 194/* Read a register in a CM module */
197u32 cm_read_mod_reg(s16 module, u16 idx) 195u32 cm_read_mod_reg(s16 module, u16 idx)
198{ 196{
199 return __omap_prcm_read(cm_base, module, idx); 197 return __omap_prcm_read(cm_base, module, idx);
200} 198}
201EXPORT_SYMBOL(cm_read_mod_reg);
202 199
203/* Write into a register in a CM module */ 200/* Write into a register in a CM module */
204void cm_write_mod_reg(u32 val, s16 module, u16 idx) 201void cm_write_mod_reg(u32 val, s16 module, u16 idx)
205{ 202{
206 __omap_prcm_write(val, cm_base, module, idx); 203 __omap_prcm_write(val, cm_base, module, idx);
207} 204}
208EXPORT_SYMBOL(cm_write_mod_reg);
209 205
210/* Read-modify-write a register in a CM module. Caller must lock */ 206/* Read-modify-write a register in a CM module. Caller must lock */
211u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) 207u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
@@ -219,7 +215,6 @@ u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
219 215
220 return v; 216 return v;
221} 217}
222EXPORT_SYMBOL(cm_rmw_mod_reg_bits);
223 218
224/** 219/**
225 * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness 220 * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
@@ -247,9 +242,8 @@ int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, const char *name)
247 BUG(); 242 BUG();
248 243
249 /* Wait for lock */ 244 /* Wait for lock */
250 while (((__raw_readl(reg) & mask) != ena) && 245 omap_test_timeout(((__raw_readl(reg) & mask) == ena),
251 (i++ < MAX_MODULE_ENABLE_WAIT)) 246 MAX_MODULE_ENABLE_WAIT, i);
252 udelay(1);
253 247
254 if (i < MAX_MODULE_ENABLE_WAIT) 248 if (i < MAX_MODULE_ENABLE_WAIT)
255 pr_debug("cm: Module associated with clock %s ready after %d " 249 pr_debug("cm: Module associated with clock %s ready after %d "
@@ -265,6 +259,7 @@ void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
265{ 259{
266 prm_base = omap2_globals->prm; 260 prm_base = omap2_globals->prm;
267 cm_base = omap2_globals->cm; 261 cm_base = omap2_globals->cm;
262 cm2_base = omap2_globals->cm2;
268} 263}
269 264
270#ifdef CONFIG_ARCH_OMAP3 265#ifdef CONFIG_ARCH_OMAP3
diff --git a/arch/arm/mach-omap2/prm-regbits-44xx.h b/arch/arm/mach-omap2/prm-regbits-44xx.h
new file mode 100644
index 000000000000..301c810fb269
--- /dev/null
+++ b/arch/arm/mach-omap2/prm-regbits-44xx.h
@@ -0,0 +1,2205 @@
1/*
2 * OMAP44xx Power Management register bits
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_44XX_H
23#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_44XX_H
24
25#include "prm.h"
26
27
28/*
29 * Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_IVA_SETUP,
30 * PRM_LDO_SRAM_MPU_SETUP
31 */
32#define OMAP4430_ABBOFF_ACT_EXPORT_SHIFT (1 << 1)
33#define OMAP4430_ABBOFF_ACT_EXPORT_MASK BITFIELD(1, 1)
34
35/*
36 * Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_IVA_SETUP,
37 * PRM_LDO_SRAM_MPU_SETUP
38 */
39#define OMAP4430_ABBOFF_SLEEP_EXPORT_SHIFT (1 << 2)
40#define OMAP4430_ABBOFF_SLEEP_EXPORT_MASK BITFIELD(2, 2)
41
42/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
43#define OMAP4430_ABB_IVA_DONE_EN_SHIFT (1 << 31)
44#define OMAP4430_ABB_IVA_DONE_EN_MASK BITFIELD(31, 31)
45
46/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
47#define OMAP4430_ABB_IVA_DONE_ST_SHIFT (1 << 31)
48#define OMAP4430_ABB_IVA_DONE_ST_MASK BITFIELD(31, 31)
49
50/* Used by PRM_IRQENABLE_MPU_2 */
51#define OMAP4430_ABB_MPU_DONE_EN_SHIFT (1 << 7)
52#define OMAP4430_ABB_MPU_DONE_EN_MASK BITFIELD(7, 7)
53
54/* Used by PRM_IRQSTATUS_MPU_2 */
55#define OMAP4430_ABB_MPU_DONE_ST_SHIFT (1 << 7)
56#define OMAP4430_ABB_MPU_DONE_ST_MASK BITFIELD(7, 7)
57
58/* Used by PRM_LDO_ABB_IVA_SETUP, PRM_LDO_ABB_MPU_SETUP */
59#define OMAP4430_ACTIVE_FBB_SEL_SHIFT (1 << 2)
60#define OMAP4430_ACTIVE_FBB_SEL_MASK BITFIELD(2, 2)
61
62/* Used by PRM_LDO_ABB_IVA_SETUP, PRM_LDO_ABB_MPU_SETUP */
63#define OMAP4430_ACTIVE_RBB_SEL_SHIFT (1 << 1)
64#define OMAP4430_ACTIVE_RBB_SEL_MASK BITFIELD(1, 1)
65
66/* Used by PM_ABE_PWRSTCTRL */
67#define OMAP4430_AESSMEM_ONSTATE_SHIFT (1 << 16)
68#define OMAP4430_AESSMEM_ONSTATE_MASK BITFIELD(16, 17)
69
70/* Used by PM_ABE_PWRSTCTRL */
71#define OMAP4430_AESSMEM_RETSTATE_SHIFT (1 << 8)
72#define OMAP4430_AESSMEM_RETSTATE_MASK BITFIELD(8, 8)
73
74/* Used by PM_ABE_PWRSTST */
75#define OMAP4430_AESSMEM_STATEST_SHIFT (1 << 4)
76#define OMAP4430_AESSMEM_STATEST_MASK BITFIELD(4, 5)
77
78/*
79 * Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_IVA_SETUP,
80 * PRM_LDO_SRAM_MPU_SETUP
81 */
82#define OMAP4430_AIPOFF_SHIFT (1 << 8)
83#define OMAP4430_AIPOFF_MASK BITFIELD(8, 8)
84
85/* Used by PRM_VOLTCTRL */
86#define OMAP4430_AUTO_CTRL_VDD_CORE_L_SHIFT (1 << 0)
87#define OMAP4430_AUTO_CTRL_VDD_CORE_L_MASK BITFIELD(0, 1)
88
89/* Used by PRM_VOLTCTRL */
90#define OMAP4430_AUTO_CTRL_VDD_IVA_L_SHIFT (1 << 4)
91#define OMAP4430_AUTO_CTRL_VDD_IVA_L_MASK BITFIELD(4, 5)
92
93/* Used by PRM_VOLTCTRL */
94#define OMAP4430_AUTO_CTRL_VDD_MPU_L_SHIFT (1 << 2)
95#define OMAP4430_AUTO_CTRL_VDD_MPU_L_MASK BITFIELD(2, 3)
96
97/* Used by PM_CAM_PWRSTCTRL */
98#define OMAP4430_CAM_MEM_ONSTATE_SHIFT (1 << 16)
99#define OMAP4430_CAM_MEM_ONSTATE_MASK BITFIELD(16, 17)
100
101/* Used by PM_CAM_PWRSTST */
102#define OMAP4430_CAM_MEM_STATEST_SHIFT (1 << 4)
103#define OMAP4430_CAM_MEM_STATEST_MASK BITFIELD(4, 5)
104
105/* Used by PRM_CLKREQCTRL */
106#define OMAP4430_CLKREQ_COND_SHIFT (1 << 0)
107#define OMAP4430_CLKREQ_COND_MASK BITFIELD(0, 2)
108
109/* Used by PRM_VC_VAL_SMPS_RA_CMD */
110#define OMAP4430_CMDRA_VDD_CORE_L_SHIFT (1 << 0)
111#define OMAP4430_CMDRA_VDD_CORE_L_MASK BITFIELD(0, 7)
112
113/* Used by PRM_VC_VAL_SMPS_RA_CMD */
114#define OMAP4430_CMDRA_VDD_IVA_L_SHIFT (1 << 8)
115#define OMAP4430_CMDRA_VDD_IVA_L_MASK BITFIELD(8, 15)
116
117/* Used by PRM_VC_VAL_SMPS_RA_CMD */
118#define OMAP4430_CMDRA_VDD_MPU_L_SHIFT (1 << 16)
119#define OMAP4430_CMDRA_VDD_MPU_L_MASK BITFIELD(16, 23)
120
121/* Used by PRM_VC_CFG_CHANNEL */
122#define OMAP4430_CMD_VDD_CORE_L_SHIFT (1 << 4)
123#define OMAP4430_CMD_VDD_CORE_L_MASK BITFIELD(4, 4)
124
125/* Used by PRM_VC_CFG_CHANNEL */
126#define OMAP4430_CMD_VDD_IVA_L_SHIFT (1 << 12)
127#define OMAP4430_CMD_VDD_IVA_L_MASK BITFIELD(12, 12)
128
129/* Used by PRM_VC_CFG_CHANNEL */
130#define OMAP4430_CMD_VDD_MPU_L_SHIFT (1 << 17)
131#define OMAP4430_CMD_VDD_MPU_L_MASK BITFIELD(17, 17)
132
133/* Used by PM_CORE_PWRSTCTRL */
134#define OMAP4430_CORE_OCMRAM_ONSTATE_SHIFT (1 << 18)
135#define OMAP4430_CORE_OCMRAM_ONSTATE_MASK BITFIELD(18, 19)
136
137/* Used by PM_CORE_PWRSTCTRL */
138#define OMAP4430_CORE_OCMRAM_RETSTATE_SHIFT (1 << 9)
139#define OMAP4430_CORE_OCMRAM_RETSTATE_MASK BITFIELD(9, 9)
140
141/* Used by PM_CORE_PWRSTST */
142#define OMAP4430_CORE_OCMRAM_STATEST_SHIFT (1 << 6)
143#define OMAP4430_CORE_OCMRAM_STATEST_MASK BITFIELD(6, 7)
144
145/* Used by PM_CORE_PWRSTCTRL */
146#define OMAP4430_CORE_OTHER_BANK_ONSTATE_SHIFT (1 << 16)
147#define OMAP4430_CORE_OTHER_BANK_ONSTATE_MASK BITFIELD(16, 17)
148
149/* Used by PM_CORE_PWRSTCTRL */
150#define OMAP4430_CORE_OTHER_BANK_RETSTATE_SHIFT (1 << 8)
151#define OMAP4430_CORE_OTHER_BANK_RETSTATE_MASK BITFIELD(8, 8)
152
153/* Used by PM_CORE_PWRSTST */
154#define OMAP4430_CORE_OTHER_BANK_STATEST_SHIFT (1 << 4)
155#define OMAP4430_CORE_OTHER_BANK_STATEST_MASK BITFIELD(4, 5)
156
157/* Used by PRM_VC_VAL_BYPASS */
158#define OMAP4430_DATA_SHIFT (1 << 16)
159#define OMAP4430_DATA_MASK BITFIELD(16, 23)
160
161/* Used by PRM_DEVICE_OFF_CTRL */
162#define OMAP4430_DEVICE_OFF_ENABLE_SHIFT (1 << 0)
163#define OMAP4430_DEVICE_OFF_ENABLE_MASK BITFIELD(0, 0)
164
165/* Used by PRM_VC_CFG_I2C_MODE */
166#define OMAP4430_DFILTEREN_SHIFT (1 << 6)
167#define OMAP4430_DFILTEREN_MASK BITFIELD(6, 6)
168
169/* Used by PRM_IRQENABLE_MPU, PRM_IRQENABLE_TESLA */
170#define OMAP4430_DPLL_ABE_RECAL_EN_SHIFT (1 << 4)
171#define OMAP4430_DPLL_ABE_RECAL_EN_MASK BITFIELD(4, 4)
172
173/* Used by PRM_IRQSTATUS_MPU, PRM_IRQSTATUS_TESLA */
174#define OMAP4430_DPLL_ABE_RECAL_ST_SHIFT (1 << 4)
175#define OMAP4430_DPLL_ABE_RECAL_ST_MASK BITFIELD(4, 4)
176
177/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
178#define OMAP4430_DPLL_CORE_RECAL_EN_SHIFT (1 << 0)
179#define OMAP4430_DPLL_CORE_RECAL_EN_MASK BITFIELD(0, 0)
180
181/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
182#define OMAP4430_DPLL_CORE_RECAL_ST_SHIFT (1 << 0)
183#define OMAP4430_DPLL_CORE_RECAL_ST_MASK BITFIELD(0, 0)
184
185/* Used by PRM_IRQENABLE_MPU */
186#define OMAP4430_DPLL_DDRPHY_RECAL_EN_SHIFT (1 << 6)
187#define OMAP4430_DPLL_DDRPHY_RECAL_EN_MASK BITFIELD(6, 6)
188
189/* Used by PRM_IRQSTATUS_MPU */
190#define OMAP4430_DPLL_DDRPHY_RECAL_ST_SHIFT (1 << 6)
191#define OMAP4430_DPLL_DDRPHY_RECAL_ST_MASK BITFIELD(6, 6)
192
193/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU, PRM_IRQENABLE_TESLA */
194#define OMAP4430_DPLL_IVA_RECAL_EN_SHIFT (1 << 2)
195#define OMAP4430_DPLL_IVA_RECAL_EN_MASK BITFIELD(2, 2)
196
197/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU, PRM_IRQSTATUS_TESLA */
198#define OMAP4430_DPLL_IVA_RECAL_ST_SHIFT (1 << 2)
199#define OMAP4430_DPLL_IVA_RECAL_ST_MASK BITFIELD(2, 2)
200
201/* Used by PRM_IRQENABLE_MPU */
202#define OMAP4430_DPLL_MPU_RECAL_EN_SHIFT (1 << 1)
203#define OMAP4430_DPLL_MPU_RECAL_EN_MASK BITFIELD(1, 1)
204
205/* Used by PRM_IRQSTATUS_MPU */
206#define OMAP4430_DPLL_MPU_RECAL_ST_SHIFT (1 << 1)
207#define OMAP4430_DPLL_MPU_RECAL_ST_MASK BITFIELD(1, 1)
208
209/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
210#define OMAP4430_DPLL_PER_RECAL_EN_SHIFT (1 << 3)
211#define OMAP4430_DPLL_PER_RECAL_EN_MASK BITFIELD(3, 3)
212
213/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
214#define OMAP4430_DPLL_PER_RECAL_ST_SHIFT (1 << 3)
215#define OMAP4430_DPLL_PER_RECAL_ST_MASK BITFIELD(3, 3)
216
217/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
218#define OMAP4430_DPLL_UNIPRO_RECAL_EN_SHIFT (1 << 7)
219#define OMAP4430_DPLL_UNIPRO_RECAL_EN_MASK BITFIELD(7, 7)
220
221/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
222#define OMAP4430_DPLL_UNIPRO_RECAL_ST_SHIFT (1 << 7)
223#define OMAP4430_DPLL_UNIPRO_RECAL_ST_MASK BITFIELD(7, 7)
224
225/* Used by PRM_IRQENABLE_MPU */
226#define OMAP4430_DPLL_USB_RECAL_EN_SHIFT (1 << 5)
227#define OMAP4430_DPLL_USB_RECAL_EN_MASK BITFIELD(5, 5)
228
229/* Used by PRM_IRQSTATUS_MPU */
230#define OMAP4430_DPLL_USB_RECAL_ST_SHIFT (1 << 5)
231#define OMAP4430_DPLL_USB_RECAL_ST_MASK BITFIELD(5, 5)
232
233/* Used by PM_DSS_PWRSTCTRL */
234#define OMAP4430_DSS_MEM_ONSTATE_SHIFT (1 << 16)
235#define OMAP4430_DSS_MEM_ONSTATE_MASK BITFIELD(16, 17)
236
237/* Used by PM_DSS_PWRSTCTRL */
238#define OMAP4430_DSS_MEM_RETSTATE_SHIFT (1 << 8)
239#define OMAP4430_DSS_MEM_RETSTATE_MASK BITFIELD(8, 8)
240
241/* Used by PM_DSS_PWRSTST */
242#define OMAP4430_DSS_MEM_STATEST_SHIFT (1 << 4)
243#define OMAP4430_DSS_MEM_STATEST_MASK BITFIELD(4, 5)
244
245/* Used by PM_CORE_PWRSTCTRL */
246#define OMAP4430_DUCATI_L2RAM_ONSTATE_SHIFT (1 << 20)
247#define OMAP4430_DUCATI_L2RAM_ONSTATE_MASK BITFIELD(20, 21)
248
249/* Used by PM_CORE_PWRSTCTRL */
250#define OMAP4430_DUCATI_L2RAM_RETSTATE_SHIFT (1 << 10)
251#define OMAP4430_DUCATI_L2RAM_RETSTATE_MASK BITFIELD(10, 10)
252
253/* Used by PM_CORE_PWRSTST */
254#define OMAP4430_DUCATI_L2RAM_STATEST_SHIFT (1 << 8)
255#define OMAP4430_DUCATI_L2RAM_STATEST_MASK BITFIELD(8, 9)
256
257/* Used by PM_CORE_PWRSTCTRL */
258#define OMAP4430_DUCATI_UNICACHE_ONSTATE_SHIFT (1 << 22)
259#define OMAP4430_DUCATI_UNICACHE_ONSTATE_MASK BITFIELD(22, 23)
260
261/* Used by PM_CORE_PWRSTCTRL */
262#define OMAP4430_DUCATI_UNICACHE_RETSTATE_SHIFT (1 << 11)
263#define OMAP4430_DUCATI_UNICACHE_RETSTATE_MASK BITFIELD(11, 11)
264
265/* Used by PM_CORE_PWRSTST */
266#define OMAP4430_DUCATI_UNICACHE_STATEST_SHIFT (1 << 10)
267#define OMAP4430_DUCATI_UNICACHE_STATEST_MASK BITFIELD(10, 11)
268
269/* Used by RM_MPU_RSTST */
270#define OMAP4430_EMULATION_RST_SHIFT (1 << 0)
271#define OMAP4430_EMULATION_RST_MASK BITFIELD(0, 0)
272
273/* Used by RM_DUCATI_RSTST */
274#define OMAP4430_EMULATION_RST1ST_SHIFT (1 << 3)
275#define OMAP4430_EMULATION_RST1ST_MASK BITFIELD(3, 3)
276
277/* Used by RM_DUCATI_RSTST */
278#define OMAP4430_EMULATION_RST2ST_SHIFT (1 << 4)
279#define OMAP4430_EMULATION_RST2ST_MASK BITFIELD(4, 4)
280
281/* Used by RM_IVAHD_RSTST */
282#define OMAP4430_EMULATION_SEQ1_RST1ST_SHIFT (1 << 3)
283#define OMAP4430_EMULATION_SEQ1_RST1ST_MASK BITFIELD(3, 3)
284
285/* Used by RM_IVAHD_RSTST */
286#define OMAP4430_EMULATION_SEQ2_RST2ST_SHIFT (1 << 4)
287#define OMAP4430_EMULATION_SEQ2_RST2ST_MASK BITFIELD(4, 4)
288
289/* Used by PM_EMU_PWRSTCTRL */
290#define OMAP4430_EMU_BANK_ONSTATE_SHIFT (1 << 16)
291#define OMAP4430_EMU_BANK_ONSTATE_MASK BITFIELD(16, 17)
292
293/* Used by PM_EMU_PWRSTST */
294#define OMAP4430_EMU_BANK_STATEST_SHIFT (1 << 4)
295#define OMAP4430_EMU_BANK_STATEST_MASK BITFIELD(4, 5)
296
297/*
298 * Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_IVA_SETUP,
299 * PRM_LDO_SRAM_MPU_SETUP, PRM_SRAM_WKUP_SETUP
300 */
301#define OMAP4430_ENABLE_RTA_EXPORT_SHIFT (1 << 0)
302#define OMAP4430_ENABLE_RTA_EXPORT_MASK BITFIELD(0, 0)
303
304/*
305 * Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_IVA_SETUP,
306 * PRM_LDO_SRAM_MPU_SETUP
307 */
308#define OMAP4430_ENFUNC1_SHIFT (1 << 3)
309#define OMAP4430_ENFUNC1_MASK BITFIELD(3, 3)
310
311/*
312 * Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_IVA_SETUP,
313 * PRM_LDO_SRAM_MPU_SETUP
314 */
315#define OMAP4430_ENFUNC3_SHIFT (1 << 5)
316#define OMAP4430_ENFUNC3_MASK BITFIELD(5, 5)
317
318/*
319 * Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_IVA_SETUP,
320 * PRM_LDO_SRAM_MPU_SETUP
321 */
322#define OMAP4430_ENFUNC4_SHIFT (1 << 6)
323#define OMAP4430_ENFUNC4_MASK BITFIELD(6, 6)
324
325/*
326 * Used by PRM_LDO_SRAM_CORE_SETUP, PRM_LDO_SRAM_IVA_SETUP,
327 * PRM_LDO_SRAM_MPU_SETUP
328 */
329#define OMAP4430_ENFUNC5_SHIFT (1 << 7)
330#define OMAP4430_ENFUNC5_MASK BITFIELD(7, 7)
331
332/* Used by PRM_VP_CORE_CONFIG, PRM_VP_IVA_CONFIG, PRM_VP_MPU_CONFIG */
333#define OMAP4430_ERRORGAIN_SHIFT (1 << 16)
334#define OMAP4430_ERRORGAIN_MASK BITFIELD(16, 23)
335
336/* Used by PRM_VP_CORE_CONFIG, PRM_VP_IVA_CONFIG, PRM_VP_MPU_CONFIG */
337#define OMAP4430_ERROROFFSET_SHIFT (1 << 24)
338#define OMAP4430_ERROROFFSET_MASK BITFIELD(24, 31)
339
340/* Used by PRM_RSTST */
341#define OMAP4430_EXTERNAL_WARM_RST_SHIFT (1 << 5)
342#define OMAP4430_EXTERNAL_WARM_RST_MASK BITFIELD(5, 5)
343
344/* Used by PRM_VP_CORE_CONFIG, PRM_VP_IVA_CONFIG, PRM_VP_MPU_CONFIG */
345#define OMAP4430_FORCEUPDATE_SHIFT (1 << 1)
346#define OMAP4430_FORCEUPDATE_MASK BITFIELD(1, 1)
347
348/* Used by PRM_VP_CORE_VOLTAGE, PRM_VP_IVA_VOLTAGE, PRM_VP_MPU_VOLTAGE */
349#define OMAP4430_FORCEUPDATEWAIT_SHIFT (1 << 8)
350#define OMAP4430_FORCEUPDATEWAIT_MASK BITFIELD(8, 31)
351
352/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_TESLA */
353#define OMAP4430_FORCEWKUP_EN_SHIFT (1 << 10)
354#define OMAP4430_FORCEWKUP_EN_MASK BITFIELD(10, 10)
355
356/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_TESLA */
357#define OMAP4430_FORCEWKUP_ST_SHIFT (1 << 10)
358#define OMAP4430_FORCEWKUP_ST_MASK BITFIELD(10, 10)
359
360/* Used by PM_GFX_PWRSTCTRL */
361#define OMAP4430_GFX_MEM_ONSTATE_SHIFT (1 << 16)
362#define OMAP4430_GFX_MEM_ONSTATE_MASK BITFIELD(16, 17)
363
364/* Used by PM_GFX_PWRSTST */
365#define OMAP4430_GFX_MEM_STATEST_SHIFT (1 << 4)
366#define OMAP4430_GFX_MEM_STATEST_MASK BITFIELD(4, 5)
367
368/* Used by PRM_RSTST */
369#define OMAP4430_GLOBAL_COLD_RST_SHIFT (1 << 0)
370#define OMAP4430_GLOBAL_COLD_RST_MASK BITFIELD(0, 0)
371
372/* Used by PRM_RSTST */
373#define OMAP4430_GLOBAL_WARM_SW_RST_SHIFT (1 << 1)
374#define OMAP4430_GLOBAL_WARM_SW_RST_MASK BITFIELD(1, 1)
375
376/* Used by PRM_IO_PMCTRL */
377#define OMAP4430_GLOBAL_WUEN_SHIFT (1 << 16)
378#define OMAP4430_GLOBAL_WUEN_MASK BITFIELD(16, 16)
379
380/* Used by PRM_VC_CFG_I2C_MODE */
381#define OMAP4430_HSMCODE_SHIFT (1 << 0)
382#define OMAP4430_HSMCODE_MASK BITFIELD(0, 2)
383
384/* Used by PRM_VC_CFG_I2C_MODE */
385#define OMAP4430_HSMODEEN_SHIFT (1 << 3)
386#define OMAP4430_HSMODEEN_MASK BITFIELD(3, 3)
387
388/* Used by PRM_VC_CFG_I2C_CLK */
389#define OMAP4430_HSSCLH_SHIFT (1 << 16)
390#define OMAP4430_HSSCLH_MASK BITFIELD(16, 23)
391
392/* Used by PRM_VC_CFG_I2C_CLK */
393#define OMAP4430_HSSCLL_SHIFT (1 << 24)
394#define OMAP4430_HSSCLL_MASK BITFIELD(24, 31)
395
396/* Used by PM_IVAHD_PWRSTCTRL */
397#define OMAP4430_HWA_MEM_ONSTATE_SHIFT (1 << 16)
398#define OMAP4430_HWA_MEM_ONSTATE_MASK BITFIELD(16, 17)
399
400/* Used by PM_IVAHD_PWRSTCTRL */
401#define OMAP4430_HWA_MEM_RETSTATE_SHIFT (1 << 8)
402#define OMAP4430_HWA_MEM_RETSTATE_MASK BITFIELD(8, 8)
403
404/* Used by PM_IVAHD_PWRSTST */
405#define OMAP4430_HWA_MEM_STATEST_SHIFT (1 << 4)
406#define OMAP4430_HWA_MEM_STATEST_MASK BITFIELD(4, 5)
407
408/* Used by RM_MPU_RSTST */
409#define OMAP4430_ICECRUSHER_MPU_RST_SHIFT (1 << 1)
410#define OMAP4430_ICECRUSHER_MPU_RST_MASK BITFIELD(1, 1)
411
412/* Used by RM_DUCATI_RSTST */
413#define OMAP4430_ICECRUSHER_RST1ST_SHIFT (1 << 5)
414#define OMAP4430_ICECRUSHER_RST1ST_MASK BITFIELD(5, 5)
415
416/* Used by RM_DUCATI_RSTST */
417#define OMAP4430_ICECRUSHER_RST2ST_SHIFT (1 << 6)
418#define OMAP4430_ICECRUSHER_RST2ST_MASK BITFIELD(6, 6)
419
420/* Used by RM_IVAHD_RSTST */
421#define OMAP4430_ICECRUSHER_SEQ1_RST1ST_SHIFT (1 << 5)
422#define OMAP4430_ICECRUSHER_SEQ1_RST1ST_MASK BITFIELD(5, 5)
423
424/* Used by RM_IVAHD_RSTST */
425#define OMAP4430_ICECRUSHER_SEQ2_RST2ST_SHIFT (1 << 6)
426#define OMAP4430_ICECRUSHER_SEQ2_RST2ST_MASK BITFIELD(6, 6)
427
428/* Used by PRM_RSTST */
429#define OMAP4430_ICEPICK_RST_SHIFT (1 << 9)
430#define OMAP4430_ICEPICK_RST_MASK BITFIELD(9, 9)
431
432/* Used by PRM_VP_CORE_CONFIG, PRM_VP_IVA_CONFIG, PRM_VP_MPU_CONFIG */
433#define OMAP4430_INITVDD_SHIFT (1 << 2)
434#define OMAP4430_INITVDD_MASK BITFIELD(2, 2)
435
436/* Used by PRM_VP_CORE_CONFIG, PRM_VP_IVA_CONFIG, PRM_VP_MPU_CONFIG */
437#define OMAP4430_INITVOLTAGE_SHIFT (1 << 8)
438#define OMAP4430_INITVOLTAGE_MASK BITFIELD(8, 15)
439
440/*
441 * Used by PM_EMU_PWRSTST, PM_CORE_PWRSTST, PM_CAM_PWRSTST, PM_L3INIT_PWRSTST,
442 * PM_ABE_PWRSTST, PM_GFX_PWRSTST, PM_MPU_PWRSTST, PM_CEFUSE_PWRSTST,
443 * PM_DSS_PWRSTST, PM_L4PER_PWRSTST, PM_TESLA_PWRSTST, PM_IVAHD_PWRSTST
444 */
445#define OMAP4430_INTRANSITION_SHIFT (1 << 20)
446#define OMAP4430_INTRANSITION_MASK BITFIELD(20, 20)
447
448/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
449#define OMAP4430_IO_EN_SHIFT (1 << 9)
450#define OMAP4430_IO_EN_MASK BITFIELD(9, 9)
451
452/* Used by PRM_IO_PMCTRL */
453#define OMAP4430_IO_ON_STATUS_SHIFT (1 << 5)
454#define OMAP4430_IO_ON_STATUS_MASK BITFIELD(5, 5)
455
456/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
457#define OMAP4430_IO_ST_SHIFT (1 << 9)
458#define OMAP4430_IO_ST_MASK BITFIELD(9, 9)
459
460/* Used by PRM_IO_PMCTRL */
461#define OMAP4430_ISOCLK_OVERRIDE_SHIFT (1 << 0)
462#define OMAP4430_ISOCLK_OVERRIDE_MASK BITFIELD(0, 0)
463
464/* Used by PRM_IO_PMCTRL */
465#define OMAP4430_ISOCLK_STATUS_SHIFT (1 << 1)
466#define OMAP4430_ISOCLK_STATUS_MASK BITFIELD(1, 1)
467
468/* Used by PRM_IO_PMCTRL */
469#define OMAP4430_ISOOVR_EXTEND_SHIFT (1 << 4)
470#define OMAP4430_ISOOVR_EXTEND_MASK BITFIELD(4, 4)
471
472/* Used by PRM_IO_COUNT */
473#define OMAP4430_ISO_2_ON_TIME_SHIFT (1 << 0)
474#define OMAP4430_ISO_2_ON_TIME_MASK BITFIELD(0, 7)
475
476/* Used by PM_L3INIT_PWRSTCTRL */
477#define OMAP4430_L3INIT_BANK1_ONSTATE_SHIFT (1 << 16)
478#define OMAP4430_L3INIT_BANK1_ONSTATE_MASK BITFIELD(16, 17)
479
480/* Used by PM_L3INIT_PWRSTCTRL */
481#define OMAP4430_L3INIT_BANK1_RETSTATE_SHIFT (1 << 8)
482#define OMAP4430_L3INIT_BANK1_RETSTATE_MASK BITFIELD(8, 8)
483
484/* Used by PM_L3INIT_PWRSTST */
485#define OMAP4430_L3INIT_BANK1_STATEST_SHIFT (1 << 4)
486#define OMAP4430_L3INIT_BANK1_STATEST_MASK BITFIELD(4, 5)
487
488/*
489 * Used by PM_CORE_PWRSTCTRL, PM_L3INIT_PWRSTCTRL, PM_ABE_PWRSTCTRL,
490 * PM_MPU_PWRSTCTRL, PM_DSS_PWRSTCTRL, PM_L4PER_PWRSTCTRL, PM_TESLA_PWRSTCTRL,
491 * PM_IVAHD_PWRSTCTRL
492 */
493#define OMAP4430_LOGICRETSTATE_SHIFT (1 << 2)
494#define OMAP4430_LOGICRETSTATE_MASK BITFIELD(2, 2)
495
496/*
497 * Used by PM_EMU_PWRSTST, PM_CORE_PWRSTST, PM_CAM_PWRSTST, PM_L3INIT_PWRSTST,
498 * PM_ABE_PWRSTST, PM_GFX_PWRSTST, PM_MPU_PWRSTST, PM_CEFUSE_PWRSTST,
499 * PM_DSS_PWRSTST, PM_L4PER_PWRSTST, PM_TESLA_PWRSTST, PM_IVAHD_PWRSTST
500 */
501#define OMAP4430_LOGICSTATEST_SHIFT (1 << 2)
502#define OMAP4430_LOGICSTATEST_MASK BITFIELD(2, 2)
503
504/*
505 * Used by RM_WKUP_GPIO1_CONTEXT, RM_WKUP_KEYBOARD_CONTEXT,
506 * RM_WKUP_L4WKUP_CONTEXT, RM_WKUP_RTC_CONTEXT, RM_WKUP_SARRAM_CONTEXT,
507 * RM_WKUP_SYNCTIMER_CONTEXT, RM_WKUP_TIMER12_CONTEXT, RM_WKUP_TIMER1_CONTEXT,
508 * RM_WKUP_USIM_CONTEXT, RM_WKUP_WDT1_CONTEXT, RM_WKUP_WDT2_CONTEXT,
509 * RM_EMU_DEBUGSS_CONTEXT, RM_D2D_SAD2D_CONTEXT, RM_D2D_SAD2D_FW_CONTEXT,
510 * RM_DUCATI_DUCATI_CONTEXT, RM_L3INSTR_L3_3_CONTEXT,
511 * RM_L3INSTR_L3_INSTR_CONTEXT, RM_L3INSTR_OCP_WP1_CONTEXT,
512 * RM_L3_1_L3_1_CONTEXT, RM_L3_2_L3_2_CONTEXT, RM_L3_2_OCMC_RAM_CONTEXT,
513 * RM_L4CFG_L4_CFG_CONTEXT, RM_L4CFG_SAR_ROM_CONTEXT, RM_MEMIF_DLL_CONTEXT,
514 * RM_MEMIF_DLL_H_CONTEXT, RM_MEMIF_DMM_CONTEXT, RM_MEMIF_EMIF_FW_CONTEXT,
515 * RM_CAM_FDIF_CONTEXT, RM_CAM_ISS_CONTEXT, RM_L3INIT_CCPTX_CONTEXT,
516 * RM_L3INIT_EMAC_CONTEXT, RM_L3INIT_P1500_CONTEXT, RM_L3INIT_PCIESS_CONTEXT,
517 * RM_L3INIT_SATA_CONTEXT, RM_L3INIT_TPPSS_CONTEXT, RM_L3INIT_UNIPRO1_CONTEXT,
518 * RM_L3INIT_USBPHYOCP2SCP_CONTEXT, RM_L3INIT_XHPI_CONTEXT,
519 * RM_ABE_AESS_CONTEXT, RM_ABE_DMIC_CONTEXT, RM_ABE_MCASP_CONTEXT,
520 * RM_ABE_MCBSP1_CONTEXT, RM_ABE_MCBSP2_CONTEXT, RM_ABE_MCBSP3_CONTEXT,
521 * RM_ABE_PDM_CONTEXT, RM_ABE_SLIMBUS_CONTEXT, RM_ABE_TIMER5_CONTEXT,
522 * RM_ABE_TIMER6_CONTEXT, RM_ABE_TIMER7_CONTEXT, RM_ABE_TIMER8_CONTEXT,
523 * RM_ABE_WDT3_CONTEXT, RM_GFX_GFX_CONTEXT, RM_MPU_MPU_CONTEXT,
524 * RM_CEFUSE_CEFUSE_CONTEXT, RM_ALWON_MDMINTC_CONTEXT,
525 * RM_ALWON_SR_CORE_CONTEXT, RM_ALWON_SR_IVA_CONTEXT, RM_ALWON_SR_MPU_CONTEXT,
526 * RM_DSS_DEISS_CONTEXT, RM_DSS_DSS_CONTEXT, RM_L4PER_ADC_CONTEXT,
527 * RM_L4PER_DMTIMER10_CONTEXT, RM_L4PER_DMTIMER11_CONTEXT,
528 * RM_L4PER_DMTIMER2_CONTEXT, RM_L4PER_DMTIMER3_CONTEXT,
529 * RM_L4PER_DMTIMER4_CONTEXT, RM_L4PER_DMTIMER9_CONTEXT, RM_L4PER_ELM_CONTEXT,
530 * RM_L4PER_HDQ1W_CONTEXT, RM_L4PER_HECC1_CONTEXT, RM_L4PER_HECC2_CONTEXT,
531 * RM_L4PER_I2C2_CONTEXT, RM_L4PER_I2C3_CONTEXT, RM_L4PER_I2C4_CONTEXT,
532 * RM_L4PER_I2C5_CONTEXT, RM_L4PER_L4_PER_CONTEXT, RM_L4PER_MCASP2_CONTEXT,
533 * RM_L4PER_MCASP3_CONTEXT, RM_L4PER_MCBSP4_CONTEXT, RM_L4PER_MCSPI1_CONTEXT,
534 * RM_L4PER_MCSPI2_CONTEXT, RM_L4PER_MCSPI3_CONTEXT, RM_L4PER_MCSPI4_CONTEXT,
535 * RM_L4PER_MGATE_CONTEXT, RM_L4PER_MMCSD3_CONTEXT, RM_L4PER_MMCSD4_CONTEXT,
536 * RM_L4PER_MMCSD5_CONTEXT, RM_L4PER_MSPROHG_CONTEXT,
537 * RM_L4PER_SLIMBUS2_CONTEXT, RM_L4SEC_PKAEIP29_CONTEXT,
538 * RM_TESLA_TESLA_CONTEXT, RM_IVAHD_IVAHD_CONTEXT, RM_IVAHD_SL2_CONTEXT
539 */
540#define OMAP4430_LOSTCONTEXT_DFF_SHIFT (1 << 0)
541#define OMAP4430_LOSTCONTEXT_DFF_MASK BITFIELD(0, 0)
542
543/*
544 * Used by RM_D2D_MODEM_ICR_CONTEXT, RM_D2D_SAD2D_CONTEXT,
545 * RM_D2D_SAD2D_FW_CONTEXT, RM_DUCATI_DUCATI_CONTEXT, RM_L3INSTR_L3_3_CONTEXT,
546 * RM_L3INSTR_OCP_WP1_CONTEXT, RM_L3_1_L3_1_CONTEXT, RM_L3_2_GPMC_CONTEXT,
547 * RM_L3_2_L3_2_CONTEXT, RM_L4CFG_HW_SEM_CONTEXT, RM_L4CFG_L4_CFG_CONTEXT,
548 * RM_L4CFG_MAILBOX_CONTEXT, RM_MEMIF_DMM_CONTEXT, RM_MEMIF_EMIF_1_CONTEXT,
549 * RM_MEMIF_EMIF_2_CONTEXT, RM_MEMIF_EMIF_FW_CONTEXT, RM_MEMIF_EMIF_H1_CONTEXT,
550 * RM_MEMIF_EMIF_H2_CONTEXT, RM_SDMA_SDMA_CONTEXT, RM_L3INIT_HSI_CONTEXT,
551 * RM_L3INIT_MMC1_CONTEXT, RM_L3INIT_MMC2_CONTEXT, RM_L3INIT_MMC6_CONTEXT,
552 * RM_L3INIT_USB_HOST_CONTEXT, RM_L3INIT_USB_HOST_FS_CONTEXT,
553 * RM_L3INIT_USB_OTG_CONTEXT, RM_L3INIT_USB_TLL_CONTEXT, RM_DSS_DSS_CONTEXT,
554 * RM_L4PER_GPIO2_CONTEXT, RM_L4PER_GPIO3_CONTEXT, RM_L4PER_GPIO4_CONTEXT,
555 * RM_L4PER_GPIO5_CONTEXT, RM_L4PER_GPIO6_CONTEXT, RM_L4PER_I2C1_CONTEXT,
556 * RM_L4PER_L4_PER_CONTEXT, RM_L4PER_UART1_CONTEXT, RM_L4PER_UART2_CONTEXT,
557 * RM_L4PER_UART3_CONTEXT, RM_L4PER_UART4_CONTEXT, RM_L4SEC_AES1_CONTEXT,
558 * RM_L4SEC_AES2_CONTEXT, RM_L4SEC_CRYPTODMA_CONTEXT, RM_L4SEC_DES3DES_CONTEXT,
559 * RM_L4SEC_RNG_CONTEXT, RM_L4SEC_SHA2MD51_CONTEXT, RM_TESLA_TESLA_CONTEXT
560 */
561#define OMAP4430_LOSTCONTEXT_RFF_SHIFT (1 << 1)
562#define OMAP4430_LOSTCONTEXT_RFF_MASK BITFIELD(1, 1)
563
564/* Used by RM_ABE_AESS_CONTEXT */
565#define OMAP4430_LOSTMEM_AESSMEM_SHIFT (1 << 8)
566#define OMAP4430_LOSTMEM_AESSMEM_MASK BITFIELD(8, 8)
567
568/* Used by RM_CAM_FDIF_CONTEXT, RM_CAM_ISS_CONTEXT */
569#define OMAP4430_LOSTMEM_CAM_MEM_SHIFT (1 << 8)
570#define OMAP4430_LOSTMEM_CAM_MEM_MASK BITFIELD(8, 8)
571
572/* Used by RM_L3INSTR_OCP_WP1_CONTEXT */
573#define OMAP4430_LOSTMEM_CORE_NRET_BANK_SHIFT (1 << 8)
574#define OMAP4430_LOSTMEM_CORE_NRET_BANK_MASK BITFIELD(8, 8)
575
576/* Renamed from LOSTMEM_CORE_NRET_BANK Used by RM_MEMIF_DMM_CONTEXT */
577#define OMAP4430_LOSTMEM_CORE_NRET_BANK_9_9_SHIFT (1 << 9)
578#define OMAP4430_LOSTMEM_CORE_NRET_BANK_9_9_MASK BITFIELD(9, 9)
579
580/* Used by RM_L3_2_OCMC_RAM_CONTEXT */
581#define OMAP4430_LOSTMEM_CORE_OCMRAM_SHIFT (1 << 8)
582#define OMAP4430_LOSTMEM_CORE_OCMRAM_MASK BITFIELD(8, 8)
583
584/*
585 * Used by RM_D2D_MODEM_ICR_CONTEXT, RM_MEMIF_DMM_CONTEXT,
586 * RM_SDMA_SDMA_CONTEXT
587 */
588#define OMAP4430_LOSTMEM_CORE_OTHER_BANK_SHIFT (1 << 8)
589#define OMAP4430_LOSTMEM_CORE_OTHER_BANK_MASK BITFIELD(8, 8)
590
591/* Used by RM_DSS_DEISS_CONTEXT, RM_DSS_DSS_CONTEXT */
592#define OMAP4430_LOSTMEM_DSS_MEM_SHIFT (1 << 8)
593#define OMAP4430_LOSTMEM_DSS_MEM_MASK BITFIELD(8, 8)
594
595/* Used by RM_DUCATI_DUCATI_CONTEXT */
596#define OMAP4430_LOSTMEM_DUCATI_L2RAM_SHIFT (1 << 9)
597#define OMAP4430_LOSTMEM_DUCATI_L2RAM_MASK BITFIELD(9, 9)
598
599/* Used by RM_DUCATI_DUCATI_CONTEXT */
600#define OMAP4430_LOSTMEM_DUCATI_UNICACHE_SHIFT (1 << 8)
601#define OMAP4430_LOSTMEM_DUCATI_UNICACHE_MASK BITFIELD(8, 8)
602
603/* Used by RM_EMU_DEBUGSS_CONTEXT */
604#define OMAP4430_LOSTMEM_EMU_BANK_SHIFT (1 << 8)
605#define OMAP4430_LOSTMEM_EMU_BANK_MASK BITFIELD(8, 8)
606
607/* Used by RM_GFX_GFX_CONTEXT */
608#define OMAP4430_LOSTMEM_GFX_MEM_SHIFT (1 << 8)
609#define OMAP4430_LOSTMEM_GFX_MEM_MASK BITFIELD(8, 8)
610
611/* Used by RM_IVAHD_IVAHD_CONTEXT */
612#define OMAP4430_LOSTMEM_HWA_MEM_SHIFT (1 << 10)
613#define OMAP4430_LOSTMEM_HWA_MEM_MASK BITFIELD(10, 10)
614
615/*
616 * Used by RM_L3INIT_CCPTX_CONTEXT, RM_L3INIT_EMAC_CONTEXT,
617 * RM_L3INIT_HSI_CONTEXT, RM_L3INIT_MMC1_CONTEXT, RM_L3INIT_MMC2_CONTEXT,
618 * RM_L3INIT_MMC6_CONTEXT, RM_L3INIT_PCIESS_CONTEXT, RM_L3INIT_SATA_CONTEXT,
619 * RM_L3INIT_TPPSS_CONTEXT, RM_L3INIT_UNIPRO1_CONTEXT,
620 * RM_L3INIT_USB_OTG_CONTEXT, RM_L3INIT_XHPI_CONTEXT
621 */
622#define OMAP4430_LOSTMEM_L3INIT_BANK1_SHIFT (1 << 8)
623#define OMAP4430_LOSTMEM_L3INIT_BANK1_MASK BITFIELD(8, 8)
624
625/* Used by RM_MPU_MPU_CONTEXT */
626#define OMAP4430_LOSTMEM_MPU_L1_SHIFT (1 << 8)
627#define OMAP4430_LOSTMEM_MPU_L1_MASK BITFIELD(8, 8)
628
629/* Used by RM_MPU_MPU_CONTEXT */
630#define OMAP4430_LOSTMEM_MPU_L2_SHIFT (1 << 9)
631#define OMAP4430_LOSTMEM_MPU_L2_MASK BITFIELD(9, 9)
632
633/* Used by RM_MPU_MPU_CONTEXT */
634#define OMAP4430_LOSTMEM_MPU_RAM_SHIFT (1 << 10)
635#define OMAP4430_LOSTMEM_MPU_RAM_MASK BITFIELD(10, 10)
636
637/*
638 * Used by RM_L4PER_HECC1_CONTEXT, RM_L4PER_HECC2_CONTEXT,
639 * RM_L4PER_MCBSP4_CONTEXT, RM_L4PER_MMCSD3_CONTEXT, RM_L4PER_MMCSD4_CONTEXT,
640 * RM_L4PER_MMCSD5_CONTEXT, RM_L4PER_SLIMBUS2_CONTEXT, RM_L4SEC_PKAEIP29_CONTEXT
641 */
642#define OMAP4430_LOSTMEM_NONRETAINED_BANK_SHIFT (1 << 8)
643#define OMAP4430_LOSTMEM_NONRETAINED_BANK_MASK BITFIELD(8, 8)
644
645/*
646 * Used by RM_ABE_DMIC_CONTEXT, RM_ABE_MCBSP1_CONTEXT, RM_ABE_MCBSP2_CONTEXT,
647 * RM_ABE_MCBSP3_CONTEXT, RM_ABE_PDM_CONTEXT, RM_ABE_SLIMBUS_CONTEXT
648 */
649#define OMAP4430_LOSTMEM_PERIHPMEM_SHIFT (1 << 8)
650#define OMAP4430_LOSTMEM_PERIHPMEM_MASK BITFIELD(8, 8)
651
652/*
653 * Used by RM_L4PER_MSPROHG_CONTEXT, RM_L4PER_UART1_CONTEXT,
654 * RM_L4PER_UART2_CONTEXT, RM_L4PER_UART3_CONTEXT, RM_L4PER_UART4_CONTEXT,
655 * RM_L4SEC_CRYPTODMA_CONTEXT
656 */
657#define OMAP4430_LOSTMEM_RETAINED_BANK_SHIFT (1 << 8)
658#define OMAP4430_LOSTMEM_RETAINED_BANK_MASK BITFIELD(8, 8)
659
660/* Used by RM_IVAHD_SL2_CONTEXT */
661#define OMAP4430_LOSTMEM_SL2_MEM_SHIFT (1 << 8)
662#define OMAP4430_LOSTMEM_SL2_MEM_MASK BITFIELD(8, 8)
663
664/* Used by RM_IVAHD_IVAHD_CONTEXT */
665#define OMAP4430_LOSTMEM_TCM1_MEM_SHIFT (1 << 8)
666#define OMAP4430_LOSTMEM_TCM1_MEM_MASK BITFIELD(8, 8)
667
668/* Used by RM_IVAHD_IVAHD_CONTEXT */
669#define OMAP4430_LOSTMEM_TCM2_MEM_SHIFT (1 << 9)
670#define OMAP4430_LOSTMEM_TCM2_MEM_MASK BITFIELD(9, 9)
671
672/* Used by RM_TESLA_TESLA_CONTEXT */
673#define OMAP4430_LOSTMEM_TESLA_EDMA_SHIFT (1 << 10)
674#define OMAP4430_LOSTMEM_TESLA_EDMA_MASK BITFIELD(10, 10)
675
676/* Used by RM_TESLA_TESLA_CONTEXT */
677#define OMAP4430_LOSTMEM_TESLA_L1_SHIFT (1 << 8)
678#define OMAP4430_LOSTMEM_TESLA_L1_MASK BITFIELD(8, 8)
679
680/* Used by RM_TESLA_TESLA_CONTEXT */
681#define OMAP4430_LOSTMEM_TESLA_L2_SHIFT (1 << 9)
682#define OMAP4430_LOSTMEM_TESLA_L2_MASK BITFIELD(9, 9)
683
684/* Used by RM_WKUP_SARRAM_CONTEXT */
685#define OMAP4430_LOSTMEM_WKUP_BANK_SHIFT (1 << 8)
686#define OMAP4430_LOSTMEM_WKUP_BANK_MASK BITFIELD(8, 8)
687
688/*
689 * Used by PM_CORE_PWRSTCTRL, PM_CAM_PWRSTCTRL, PM_L3INIT_PWRSTCTRL,
690 * PM_ABE_PWRSTCTRL, PM_GFX_PWRSTCTRL, PM_MPU_PWRSTCTRL, PM_CEFUSE_PWRSTCTRL,
691 * PM_DSS_PWRSTCTRL, PM_L4PER_PWRSTCTRL, PM_TESLA_PWRSTCTRL, PM_IVAHD_PWRSTCTRL
692 */
693#define OMAP4430_LOWPOWERSTATECHANGE_SHIFT (1 << 4)
694#define OMAP4430_LOWPOWERSTATECHANGE_MASK BITFIELD(4, 4)
695
696/* Used by PM_CORE_PWRSTCTRL */
697#define OMAP4430_MEMORYCHANGE_SHIFT (1 << 3)
698#define OMAP4430_MEMORYCHANGE_MASK BITFIELD(3, 3)
699
700/* Used by PRM_MODEM_IF_CTRL */
701#define OMAP4430_MODEM_READY_SHIFT (1 << 1)
702#define OMAP4430_MODEM_READY_MASK BITFIELD(1, 1)
703
704/* Used by PRM_MODEM_IF_CTRL */
705#define OMAP4430_MODEM_SHUTDOWN_IRQ_SHIFT (1 << 9)
706#define OMAP4430_MODEM_SHUTDOWN_IRQ_MASK BITFIELD(9, 9)
707
708/* Used by PRM_MODEM_IF_CTRL */
709#define OMAP4430_MODEM_SLEEP_ST_SHIFT (1 << 16)
710#define OMAP4430_MODEM_SLEEP_ST_MASK BITFIELD(16, 16)
711
712/* Used by PRM_MODEM_IF_CTRL */
713#define OMAP4430_MODEM_WAKE_IRQ_SHIFT (1 << 8)
714#define OMAP4430_MODEM_WAKE_IRQ_MASK BITFIELD(8, 8)
715
716/* Used by PM_MPU_PWRSTCTRL */
717#define OMAP4430_MPU_L1_ONSTATE_SHIFT (1 << 16)
718#define OMAP4430_MPU_L1_ONSTATE_MASK BITFIELD(16, 17)
719
720/* Used by PM_MPU_PWRSTCTRL */
721#define OMAP4430_MPU_L1_RETSTATE_SHIFT (1 << 8)
722#define OMAP4430_MPU_L1_RETSTATE_MASK BITFIELD(8, 8)
723
724/* Used by PM_MPU_PWRSTST */
725#define OMAP4430_MPU_L1_STATEST_SHIFT (1 << 4)
726#define OMAP4430_MPU_L1_STATEST_MASK BITFIELD(4, 5)
727
728/* Used by PM_MPU_PWRSTCTRL */
729#define OMAP4430_MPU_L2_ONSTATE_SHIFT (1 << 18)
730#define OMAP4430_MPU_L2_ONSTATE_MASK BITFIELD(18, 19)
731
732/* Used by PM_MPU_PWRSTCTRL */
733#define OMAP4430_MPU_L2_RETSTATE_SHIFT (1 << 9)
734#define OMAP4430_MPU_L2_RETSTATE_MASK BITFIELD(9, 9)
735
736/* Used by PM_MPU_PWRSTST */
737#define OMAP4430_MPU_L2_STATEST_SHIFT (1 << 6)
738#define OMAP4430_MPU_L2_STATEST_MASK BITFIELD(6, 7)
739
740/* Used by PM_MPU_PWRSTCTRL */
741#define OMAP4430_MPU_RAM_ONSTATE_SHIFT (1 << 20)
742#define OMAP4430_MPU_RAM_ONSTATE_MASK BITFIELD(20, 21)
743
744/* Used by PM_MPU_PWRSTCTRL */
745#define OMAP4430_MPU_RAM_RETSTATE_SHIFT (1 << 10)
746#define OMAP4430_MPU_RAM_RETSTATE_MASK BITFIELD(10, 10)
747
748/* Used by PM_MPU_PWRSTST */
749#define OMAP4430_MPU_RAM_STATEST_SHIFT (1 << 8)
750#define OMAP4430_MPU_RAM_STATEST_MASK BITFIELD(8, 9)
751
752/* Used by PRM_RSTST */
753#define OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT (1 << 2)
754#define OMAP4430_MPU_SECURITY_VIOL_RST_MASK BITFIELD(2, 2)
755
756/* Used by PRM_RSTST */
757#define OMAP4430_MPU_WDT_RST_SHIFT (1 << 3)
758#define OMAP4430_MPU_WDT_RST_MASK BITFIELD(3, 3)
759
760/* Used by PM_L4PER_PWRSTCTRL */
761#define OMAP4430_NONRETAINED_BANK_ONSTATE_SHIFT (1 << 18)
762#define OMAP4430_NONRETAINED_BANK_ONSTATE_MASK BITFIELD(18, 19)
763
764/* Used by PM_L4PER_PWRSTCTRL */
765#define OMAP4430_NONRETAINED_BANK_RETSTATE_SHIFT (1 << 9)
766#define OMAP4430_NONRETAINED_BANK_RETSTATE_MASK BITFIELD(9, 9)
767
768/* Used by PM_L4PER_PWRSTST */
769#define OMAP4430_NONRETAINED_BANK_STATEST_SHIFT (1 << 6)
770#define OMAP4430_NONRETAINED_BANK_STATEST_MASK BITFIELD(6, 7)
771
772/* Used by PM_CORE_PWRSTCTRL */
773#define OMAP4430_OCP_NRET_BANK_ONSTATE_SHIFT (1 << 24)
774#define OMAP4430_OCP_NRET_BANK_ONSTATE_MASK BITFIELD(24, 25)
775
776/* Used by PM_CORE_PWRSTCTRL */
777#define OMAP4430_OCP_NRET_BANK_RETSTATE_SHIFT (1 << 12)
778#define OMAP4430_OCP_NRET_BANK_RETSTATE_MASK BITFIELD(12, 12)
779
780/* Used by PM_CORE_PWRSTST */
781#define OMAP4430_OCP_NRET_BANK_STATEST_SHIFT (1 << 12)
782#define OMAP4430_OCP_NRET_BANK_STATEST_MASK BITFIELD(12, 13)
783
784/*
785 * Used by PRM_VC_VAL_CMD_VDD_CORE_L, PRM_VC_VAL_CMD_VDD_IVA_L,
786 * PRM_VC_VAL_CMD_VDD_MPU_L
787 */
788#define OMAP4430_OFF_SHIFT (1 << 0)
789#define OMAP4430_OFF_MASK BITFIELD(0, 7)
790
791/* Used by PRM_LDO_BANDGAP_CTRL */
792#define OMAP4430_OFF_ENABLE_SHIFT (1 << 0)
793#define OMAP4430_OFF_ENABLE_MASK BITFIELD(0, 0)
794
795/*
796 * Used by PRM_VC_VAL_CMD_VDD_CORE_L, PRM_VC_VAL_CMD_VDD_IVA_L,
797 * PRM_VC_VAL_CMD_VDD_MPU_L
798 */
799#define OMAP4430_ON_SHIFT (1 << 24)
800#define OMAP4430_ON_MASK BITFIELD(24, 31)
801
802/*
803 * Used by PRM_VC_VAL_CMD_VDD_CORE_L, PRM_VC_VAL_CMD_VDD_IVA_L,
804 * PRM_VC_VAL_CMD_VDD_MPU_L
805 */
806#define OMAP4430_ONLP_SHIFT (1 << 16)
807#define OMAP4430_ONLP_MASK BITFIELD(16, 23)
808
809/* Used by PRM_LDO_ABB_IVA_CTRL, PRM_LDO_ABB_MPU_CTRL */
810#define OMAP4430_OPP_CHANGE_SHIFT (1 << 2)
811#define OMAP4430_OPP_CHANGE_MASK BITFIELD(2, 2)
812
813/* Used by PRM_LDO_ABB_IVA_CTRL, PRM_LDO_ABB_MPU_CTRL */
814#define OMAP4430_OPP_SEL_SHIFT (1 << 0)
815#define OMAP4430_OPP_SEL_MASK BITFIELD(0, 1)
816
817/* Used by PRM_SRAM_COUNT */
818#define OMAP4430_PCHARGECNT_VALUE_SHIFT (1 << 0)
819#define OMAP4430_PCHARGECNT_VALUE_MASK BITFIELD(0, 5)
820
821/* Used by PRM_PSCON_COUNT */
822#define OMAP4430_PCHARGE_TIME_SHIFT (1 << 0)
823#define OMAP4430_PCHARGE_TIME_MASK BITFIELD(0, 7)
824
825/* Used by PM_ABE_PWRSTCTRL */
826#define OMAP4430_PERIPHMEM_ONSTATE_SHIFT (1 << 20)
827#define OMAP4430_PERIPHMEM_ONSTATE_MASK BITFIELD(20, 21)
828
829/* Used by PM_ABE_PWRSTCTRL */
830#define OMAP4430_PERIPHMEM_RETSTATE_SHIFT (1 << 10)
831#define OMAP4430_PERIPHMEM_RETSTATE_MASK BITFIELD(10, 10)
832
833/* Used by PM_ABE_PWRSTST */
834#define OMAP4430_PERIPHMEM_STATEST_SHIFT (1 << 8)
835#define OMAP4430_PERIPHMEM_STATEST_MASK BITFIELD(8, 9)
836
837/* Used by PRM_PHASE1_CNDP */
838#define OMAP4430_PHASE1_CNDP_SHIFT (1 << 0)
839#define OMAP4430_PHASE1_CNDP_MASK BITFIELD(0, 31)
840
841/* Used by PRM_PHASE2A_CNDP */
842#define OMAP4430_PHASE2A_CNDP_SHIFT (1 << 0)
843#define OMAP4430_PHASE2A_CNDP_MASK BITFIELD(0, 31)
844
845/* Used by PRM_PHASE2B_CNDP */
846#define OMAP4430_PHASE2B_CNDP_SHIFT (1 << 0)
847#define OMAP4430_PHASE2B_CNDP_MASK BITFIELD(0, 31)
848
849/* Used by PRM_PSCON_COUNT */
850#define OMAP4430_PONOUT_2_PGOODIN_TIME_SHIFT (1 << 8)
851#define OMAP4430_PONOUT_2_PGOODIN_TIME_MASK BITFIELD(8, 15)
852
853/*
854 * Used by PM_EMU_PWRSTCTRL, PM_CORE_PWRSTCTRL, PM_CAM_PWRSTCTRL,
855 * PM_L3INIT_PWRSTCTRL, PM_ABE_PWRSTCTRL, PM_GFX_PWRSTCTRL, PM_MPU_PWRSTCTRL,
856 * PM_CEFUSE_PWRSTCTRL, PM_DSS_PWRSTCTRL, PM_L4PER_PWRSTCTRL,
857 * PM_TESLA_PWRSTCTRL, PM_IVAHD_PWRSTCTRL
858 */
859#define OMAP4430_POWERSTATE_SHIFT (1 << 0)
860#define OMAP4430_POWERSTATE_MASK BITFIELD(0, 1)
861
862/*
863 * Used by PM_EMU_PWRSTST, PM_CORE_PWRSTST, PM_CAM_PWRSTST, PM_L3INIT_PWRSTST,
864 * PM_ABE_PWRSTST, PM_GFX_PWRSTST, PM_MPU_PWRSTST, PM_CEFUSE_PWRSTST,
865 * PM_DSS_PWRSTST, PM_L4PER_PWRSTST, PM_TESLA_PWRSTST, PM_IVAHD_PWRSTST
866 */
867#define OMAP4430_POWERSTATEST_SHIFT (1 << 0)
868#define OMAP4430_POWERSTATEST_MASK BITFIELD(0, 1)
869
870/* Used by PRM_PWRREQCTRL */
871#define OMAP4430_PWRREQ_COND_SHIFT (1 << 0)
872#define OMAP4430_PWRREQ_COND_MASK BITFIELD(0, 1)
873
874/* Used by PRM_VC_CFG_CHANNEL */
875#define OMAP4430_RACEN_VDD_CORE_L_SHIFT (1 << 3)
876#define OMAP4430_RACEN_VDD_CORE_L_MASK BITFIELD(3, 3)
877
878/* Used by PRM_VC_CFG_CHANNEL */
879#define OMAP4430_RACEN_VDD_IVA_L_SHIFT (1 << 11)
880#define OMAP4430_RACEN_VDD_IVA_L_MASK BITFIELD(11, 11)
881
882/* Used by PRM_VC_CFG_CHANNEL */
883#define OMAP4430_RACEN_VDD_MPU_L_SHIFT (1 << 20)
884#define OMAP4430_RACEN_VDD_MPU_L_MASK BITFIELD(20, 20)
885
886/* Used by PRM_VC_CFG_CHANNEL */
887#define OMAP4430_RAC_VDD_CORE_L_SHIFT (1 << 2)
888#define OMAP4430_RAC_VDD_CORE_L_MASK BITFIELD(2, 2)
889
890/* Used by PRM_VC_CFG_CHANNEL */
891#define OMAP4430_RAC_VDD_IVA_L_SHIFT (1 << 10)
892#define OMAP4430_RAC_VDD_IVA_L_MASK BITFIELD(10, 10)
893
894/* Used by PRM_VC_CFG_CHANNEL */
895#define OMAP4430_RAC_VDD_MPU_L_SHIFT (1 << 19)
896#define OMAP4430_RAC_VDD_MPU_L_MASK BITFIELD(19, 19)
897
898/*
899 * Used by PRM_VOLTSETUP_CORE_OFF, PRM_VOLTSETUP_CORE_RET_SLEEP,
900 * PRM_VOLTSETUP_IVA_OFF, PRM_VOLTSETUP_IVA_RET_SLEEP, PRM_VOLTSETUP_MPU_OFF,
901 * PRM_VOLTSETUP_MPU_RET_SLEEP
902 */
903#define OMAP4430_RAMP_DOWN_COUNT_SHIFT (1 << 16)
904#define OMAP4430_RAMP_DOWN_COUNT_MASK BITFIELD(16, 21)
905
906/*
907 * Used by PRM_VOLTSETUP_CORE_OFF, PRM_VOLTSETUP_CORE_RET_SLEEP,
908 * PRM_VOLTSETUP_IVA_OFF, PRM_VOLTSETUP_IVA_RET_SLEEP, PRM_VOLTSETUP_MPU_OFF,
909 * PRM_VOLTSETUP_MPU_RET_SLEEP
910 */
911#define OMAP4430_RAMP_DOWN_PRESCAL_SHIFT (1 << 24)
912#define OMAP4430_RAMP_DOWN_PRESCAL_MASK BITFIELD(24, 25)
913
914/*
915 * Used by PRM_VOLTSETUP_CORE_OFF, PRM_VOLTSETUP_CORE_RET_SLEEP,
916 * PRM_VOLTSETUP_IVA_OFF, PRM_VOLTSETUP_IVA_RET_SLEEP, PRM_VOLTSETUP_MPU_OFF,
917 * PRM_VOLTSETUP_MPU_RET_SLEEP
918 */
919#define OMAP4430_RAMP_UP_COUNT_SHIFT (1 << 0)
920#define OMAP4430_RAMP_UP_COUNT_MASK BITFIELD(0, 5)
921
922/*
923 * Used by PRM_VOLTSETUP_CORE_OFF, PRM_VOLTSETUP_CORE_RET_SLEEP,
924 * PRM_VOLTSETUP_IVA_OFF, PRM_VOLTSETUP_IVA_RET_SLEEP, PRM_VOLTSETUP_MPU_OFF,
925 * PRM_VOLTSETUP_MPU_RET_SLEEP
926 */
927#define OMAP4430_RAMP_UP_PRESCAL_SHIFT (1 << 8)
928#define OMAP4430_RAMP_UP_PRESCAL_MASK BITFIELD(8, 9)
929
930/* Used by PRM_VC_CFG_CHANNEL */
931#define OMAP4430_RAV_VDD_CORE_L_SHIFT (1 << 1)
932#define OMAP4430_RAV_VDD_CORE_L_MASK BITFIELD(1, 1)
933
934/* Used by PRM_VC_CFG_CHANNEL */
935#define OMAP4430_RAV_VDD_IVA_L_SHIFT (1 << 9)
936#define OMAP4430_RAV_VDD_IVA_L_MASK BITFIELD(9, 9)
937
938/* Used by PRM_VC_CFG_CHANNEL */
939#define OMAP4430_RAV_VDD_MPU_L_SHIFT (1 << 18)
940#define OMAP4430_RAV_VDD_MPU_L_MASK BITFIELD(18, 18)
941
942/* Used by PRM_VC_VAL_BYPASS */
943#define OMAP4430_REGADDR_SHIFT (1 << 8)
944#define OMAP4430_REGADDR_MASK BITFIELD(8, 15)
945
946/*
947 * Used by PRM_VC_VAL_CMD_VDD_CORE_L, PRM_VC_VAL_CMD_VDD_IVA_L,
948 * PRM_VC_VAL_CMD_VDD_MPU_L
949 */
950#define OMAP4430_RET_SHIFT (1 << 8)
951#define OMAP4430_RET_MASK BITFIELD(8, 15)
952
953/* Used by PM_L4PER_PWRSTCTRL */
954#define OMAP4430_RETAINED_BANK_ONSTATE_SHIFT (1 << 16)
955#define OMAP4430_RETAINED_BANK_ONSTATE_MASK BITFIELD(16, 17)
956
957/* Used by PM_L4PER_PWRSTCTRL */
958#define OMAP4430_RETAINED_BANK_RETSTATE_SHIFT (1 << 8)
959#define OMAP4430_RETAINED_BANK_RETSTATE_MASK BITFIELD(8, 8)
960
961/* Used by PM_L4PER_PWRSTST */
962#define OMAP4430_RETAINED_BANK_STATEST_SHIFT (1 << 4)
963#define OMAP4430_RETAINED_BANK_STATEST_MASK BITFIELD(4, 5)
964
965/*
966 * Used by PRM_LDO_SRAM_CORE_CTRL, PRM_LDO_SRAM_IVA_CTRL,
967 * PRM_LDO_SRAM_MPU_CTRL
968 */
969#define OMAP4430_RETMODE_ENABLE_SHIFT (1 << 0)
970#define OMAP4430_RETMODE_ENABLE_MASK BITFIELD(0, 0)
971
972/* Used by REVISION_PRM */
973#define OMAP4430_REV_SHIFT (1 << 0)
974#define OMAP4430_REV_MASK BITFIELD(0, 7)
975
976/* Used by RM_DUCATI_RSTCTRL, RM_TESLA_RSTCTRL, RM_IVAHD_RSTCTRL */
977#define OMAP4430_RST1_SHIFT (1 << 0)
978#define OMAP4430_RST1_MASK BITFIELD(0, 0)
979
980/* Used by RM_DUCATI_RSTST, RM_TESLA_RSTST, RM_IVAHD_RSTST */
981#define OMAP4430_RST1ST_SHIFT (1 << 0)
982#define OMAP4430_RST1ST_MASK BITFIELD(0, 0)
983
984/* Used by RM_DUCATI_RSTCTRL, RM_TESLA_RSTCTRL, RM_IVAHD_RSTCTRL */
985#define OMAP4430_RST2_SHIFT (1 << 1)
986#define OMAP4430_RST2_MASK BITFIELD(1, 1)
987
988/* Used by RM_DUCATI_RSTST, RM_TESLA_RSTST, RM_IVAHD_RSTST */
989#define OMAP4430_RST2ST_SHIFT (1 << 1)
990#define OMAP4430_RST2ST_MASK BITFIELD(1, 1)
991
992/* Used by RM_DUCATI_RSTCTRL, RM_IVAHD_RSTCTRL */
993#define OMAP4430_RST3_SHIFT (1 << 2)
994#define OMAP4430_RST3_MASK BITFIELD(2, 2)
995
996/* Used by RM_DUCATI_RSTST, RM_IVAHD_RSTST */
997#define OMAP4430_RST3ST_SHIFT (1 << 2)
998#define OMAP4430_RST3ST_MASK BITFIELD(2, 2)
999
1000/* Used by PRM_RSTTIME */
1001#define OMAP4430_RSTTIME1_SHIFT (1 << 0)
1002#define OMAP4430_RSTTIME1_MASK BITFIELD(0, 9)
1003
1004/* Used by PRM_RSTTIME */
1005#define OMAP4430_RSTTIME2_SHIFT (1 << 10)
1006#define OMAP4430_RSTTIME2_MASK BITFIELD(10, 14)
1007
1008/* Used by PRM_RSTCTRL */
1009#define OMAP4430_RST_GLOBAL_COLD_SW_SHIFT (1 << 1)
1010#define OMAP4430_RST_GLOBAL_COLD_SW_MASK BITFIELD(1, 1)
1011
1012/* Used by PRM_RSTCTRL */
1013#define OMAP4430_RST_GLOBAL_WARM_SW_SHIFT (1 << 0)
1014#define OMAP4430_RST_GLOBAL_WARM_SW_MASK BITFIELD(0, 0)
1015
1016/* Used by PRM_VC_CFG_CHANNEL */
1017#define OMAP4430_SA_VDD_CORE_L_SHIFT (1 << 0)
1018#define OMAP4430_SA_VDD_CORE_L_MASK BITFIELD(0, 0)
1019
1020/* Renamed from SA_VDD_CORE_L Used by PRM_VC_SMPS_SA */
1021#define OMAP4430_SA_VDD_CORE_L_0_6_SHIFT (1 << 0)
1022#define OMAP4430_SA_VDD_CORE_L_0_6_MASK BITFIELD(0, 6)
1023
1024/* Used by PRM_VC_CFG_CHANNEL */
1025#define OMAP4430_SA_VDD_IVA_L_SHIFT (1 << 8)
1026#define OMAP4430_SA_VDD_IVA_L_MASK BITFIELD(8, 8)
1027
1028/* Renamed from SA_VDD_IVA_L Used by PRM_VC_SMPS_SA */
1029#define OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_SHIFT (1 << 8)
1030#define OMAP4430_SA_VDD_IVA_L_PRM_VC_SMPS_SA_MASK BITFIELD(8, 14)
1031
1032/* Used by PRM_VC_CFG_CHANNEL */
1033#define OMAP4430_SA_VDD_MPU_L_SHIFT (1 << 16)
1034#define OMAP4430_SA_VDD_MPU_L_MASK BITFIELD(16, 16)
1035
1036/* Renamed from SA_VDD_MPU_L Used by PRM_VC_SMPS_SA */
1037#define OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_SHIFT (1 << 16)
1038#define OMAP4430_SA_VDD_MPU_L_PRM_VC_SMPS_SA_MASK BITFIELD(16, 22)
1039
1040/* Used by PRM_VC_CFG_I2C_CLK */
1041#define OMAP4430_SCLH_SHIFT (1 << 0)
1042#define OMAP4430_SCLH_MASK BITFIELD(0, 7)
1043
1044/* Used by PRM_VC_CFG_I2C_CLK */
1045#define OMAP4430_SCLL_SHIFT (1 << 8)
1046#define OMAP4430_SCLL_MASK BITFIELD(8, 15)
1047
1048/* Used by PRM_RSTST */
1049#define OMAP4430_SECURE_WDT_RST_SHIFT (1 << 4)
1050#define OMAP4430_SECURE_WDT_RST_MASK BITFIELD(4, 4)
1051
1052/* Used by PM_IVAHD_PWRSTCTRL */
1053#define OMAP4430_SL2_MEM_ONSTATE_SHIFT (1 << 18)
1054#define OMAP4430_SL2_MEM_ONSTATE_MASK BITFIELD(18, 19)
1055
1056/* Used by PM_IVAHD_PWRSTCTRL */
1057#define OMAP4430_SL2_MEM_RETSTATE_SHIFT (1 << 9)
1058#define OMAP4430_SL2_MEM_RETSTATE_MASK BITFIELD(9, 9)
1059
1060/* Used by PM_IVAHD_PWRSTST */
1061#define OMAP4430_SL2_MEM_STATEST_SHIFT (1 << 6)
1062#define OMAP4430_SL2_MEM_STATEST_MASK BITFIELD(6, 7)
1063
1064/* Used by PRM_VC_VAL_BYPASS */
1065#define OMAP4430_SLAVEADDR_SHIFT (1 << 0)
1066#define OMAP4430_SLAVEADDR_MASK BITFIELD(0, 6)
1067
1068/* Used by PRM_LDO_ABB_IVA_SETUP, PRM_LDO_ABB_MPU_SETUP */
1069#define OMAP4430_SLEEP_RBB_SEL_SHIFT (1 << 3)
1070#define OMAP4430_SLEEP_RBB_SEL_MASK BITFIELD(3, 3)
1071
1072/* Used by PRM_SRAM_COUNT */
1073#define OMAP4430_SLPCNT_VALUE_SHIFT (1 << 16)
1074#define OMAP4430_SLPCNT_VALUE_MASK BITFIELD(16, 23)
1075
1076/* Used by PRM_VP_CORE_VSTEPMAX, PRM_VP_IVA_VSTEPMAX, PRM_VP_MPU_VSTEPMAX */
1077#define OMAP4430_SMPSWAITTIMEMAX_SHIFT (1 << 8)
1078#define OMAP4430_SMPSWAITTIMEMAX_MASK BITFIELD(8, 23)
1079
1080/* Used by PRM_VP_CORE_VSTEPMIN, PRM_VP_IVA_VSTEPMIN, PRM_VP_MPU_VSTEPMIN */
1081#define OMAP4430_SMPSWAITTIMEMIN_SHIFT (1 << 8)
1082#define OMAP4430_SMPSWAITTIMEMIN_MASK BITFIELD(8, 23)
1083
1084/* Used by PRM_LDO_ABB_IVA_SETUP, PRM_LDO_ABB_MPU_SETUP */
1085#define OMAP4430_SR2EN_SHIFT (1 << 0)
1086#define OMAP4430_SR2EN_MASK BITFIELD(0, 0)
1087
1088/* Used by PRM_LDO_ABB_IVA_CTRL, PRM_LDO_ABB_MPU_CTRL */
1089#define OMAP4430_SR2_IN_TRANSITION_SHIFT (1 << 6)
1090#define OMAP4430_SR2_IN_TRANSITION_MASK BITFIELD(6, 6)
1091
1092/* Used by PRM_LDO_ABB_IVA_CTRL, PRM_LDO_ABB_MPU_CTRL */
1093#define OMAP4430_SR2_STATUS_SHIFT (1 << 3)
1094#define OMAP4430_SR2_STATUS_MASK BITFIELD(3, 4)
1095
1096/* Used by PRM_LDO_ABB_IVA_SETUP, PRM_LDO_ABB_MPU_SETUP */
1097#define OMAP4430_SR2_WTCNT_VALUE_SHIFT (1 << 8)
1098#define OMAP4430_SR2_WTCNT_VALUE_MASK BITFIELD(8, 15)
1099
1100/*
1101 * Used by PRM_LDO_SRAM_CORE_CTRL, PRM_LDO_SRAM_IVA_CTRL,
1102 * PRM_LDO_SRAM_MPU_CTRL
1103 */
1104#define OMAP4430_SRAMLDO_STATUS_SHIFT (1 << 8)
1105#define OMAP4430_SRAMLDO_STATUS_MASK BITFIELD(8, 8)
1106
1107/*
1108 * Used by PRM_LDO_SRAM_CORE_CTRL, PRM_LDO_SRAM_IVA_CTRL,
1109 * PRM_LDO_SRAM_MPU_CTRL
1110 */
1111#define OMAP4430_SRAM_IN_TRANSITION_SHIFT (1 << 9)
1112#define OMAP4430_SRAM_IN_TRANSITION_MASK BITFIELD(9, 9)
1113
1114/* Used by PRM_VC_CFG_I2C_MODE */
1115#define OMAP4430_SRMODEEN_SHIFT (1 << 4)
1116#define OMAP4430_SRMODEEN_MASK BITFIELD(4, 4)
1117
1118/* Used by PRM_VOLTSETUP_WARMRESET */
1119#define OMAP4430_STABLE_COUNT_SHIFT (1 << 0)
1120#define OMAP4430_STABLE_COUNT_MASK BITFIELD(0, 5)
1121
1122/* Used by PRM_VOLTSETUP_WARMRESET */
1123#define OMAP4430_STABLE_PRESCAL_SHIFT (1 << 8)
1124#define OMAP4430_STABLE_PRESCAL_MASK BITFIELD(8, 9)
1125
1126/* Used by PM_IVAHD_PWRSTCTRL */
1127#define OMAP4430_TCM1_MEM_ONSTATE_SHIFT (1 << 20)
1128#define OMAP4430_TCM1_MEM_ONSTATE_MASK BITFIELD(20, 21)
1129
1130/* Used by PM_IVAHD_PWRSTCTRL */
1131#define OMAP4430_TCM1_MEM_RETSTATE_SHIFT (1 << 10)
1132#define OMAP4430_TCM1_MEM_RETSTATE_MASK BITFIELD(10, 10)
1133
1134/* Used by PM_IVAHD_PWRSTST */
1135#define OMAP4430_TCM1_MEM_STATEST_SHIFT (1 << 8)
1136#define OMAP4430_TCM1_MEM_STATEST_MASK BITFIELD(8, 9)
1137
1138/* Used by PM_IVAHD_PWRSTCTRL */
1139#define OMAP4430_TCM2_MEM_ONSTATE_SHIFT (1 << 22)
1140#define OMAP4430_TCM2_MEM_ONSTATE_MASK BITFIELD(22, 23)
1141
1142/* Used by PM_IVAHD_PWRSTCTRL */
1143#define OMAP4430_TCM2_MEM_RETSTATE_SHIFT (1 << 11)
1144#define OMAP4430_TCM2_MEM_RETSTATE_MASK BITFIELD(11, 11)
1145
1146/* Used by PM_IVAHD_PWRSTST */
1147#define OMAP4430_TCM2_MEM_STATEST_SHIFT (1 << 10)
1148#define OMAP4430_TCM2_MEM_STATEST_MASK BITFIELD(10, 11)
1149
1150/* Used by RM_TESLA_RSTST */
1151#define OMAP4430_TESLASS_EMU_RSTST_SHIFT (1 << 2)
1152#define OMAP4430_TESLASS_EMU_RSTST_MASK BITFIELD(2, 2)
1153
1154/* Used by RM_TESLA_RSTST */
1155#define OMAP4430_TESLA_DSP_EMU_REQ_RSTST_SHIFT (1 << 3)
1156#define OMAP4430_TESLA_DSP_EMU_REQ_RSTST_MASK BITFIELD(3, 3)
1157
1158/* Used by PM_TESLA_PWRSTCTRL */
1159#define OMAP4430_TESLA_EDMA_ONSTATE_SHIFT (1 << 20)
1160#define OMAP4430_TESLA_EDMA_ONSTATE_MASK BITFIELD(20, 21)
1161
1162/* Used by PM_TESLA_PWRSTCTRL */
1163#define OMAP4430_TESLA_EDMA_RETSTATE_SHIFT (1 << 10)
1164#define OMAP4430_TESLA_EDMA_RETSTATE_MASK BITFIELD(10, 10)
1165
1166/* Used by PM_TESLA_PWRSTST */
1167#define OMAP4430_TESLA_EDMA_STATEST_SHIFT (1 << 8)
1168#define OMAP4430_TESLA_EDMA_STATEST_MASK BITFIELD(8, 9)
1169
1170/* Used by PM_TESLA_PWRSTCTRL */
1171#define OMAP4430_TESLA_L1_ONSTATE_SHIFT (1 << 16)
1172#define OMAP4430_TESLA_L1_ONSTATE_MASK BITFIELD(16, 17)
1173
1174/* Used by PM_TESLA_PWRSTCTRL */
1175#define OMAP4430_TESLA_L1_RETSTATE_SHIFT (1 << 8)
1176#define OMAP4430_TESLA_L1_RETSTATE_MASK BITFIELD(8, 8)
1177
1178/* Used by PM_TESLA_PWRSTST */
1179#define OMAP4430_TESLA_L1_STATEST_SHIFT (1 << 4)
1180#define OMAP4430_TESLA_L1_STATEST_MASK BITFIELD(4, 5)
1181
1182/* Used by PM_TESLA_PWRSTCTRL */
1183#define OMAP4430_TESLA_L2_ONSTATE_SHIFT (1 << 18)
1184#define OMAP4430_TESLA_L2_ONSTATE_MASK BITFIELD(18, 19)
1185
1186/* Used by PM_TESLA_PWRSTCTRL */
1187#define OMAP4430_TESLA_L2_RETSTATE_SHIFT (1 << 9)
1188#define OMAP4430_TESLA_L2_RETSTATE_MASK BITFIELD(9, 9)
1189
1190/* Used by PM_TESLA_PWRSTST */
1191#define OMAP4430_TESLA_L2_STATEST_SHIFT (1 << 6)
1192#define OMAP4430_TESLA_L2_STATEST_MASK BITFIELD(6, 7)
1193
1194/* Used by PRM_VP_CORE_VLIMITTO, PRM_VP_IVA_VLIMITTO, PRM_VP_MPU_VLIMITTO */
1195#define OMAP4430_TIMEOUT_SHIFT (1 << 0)
1196#define OMAP4430_TIMEOUT_MASK BITFIELD(0, 15)
1197
1198/* Used by PRM_VP_CORE_CONFIG, PRM_VP_IVA_CONFIG, PRM_VP_MPU_CONFIG */
1199#define OMAP4430_TIMEOUTEN_SHIFT (1 << 3)
1200#define OMAP4430_TIMEOUTEN_MASK BITFIELD(3, 3)
1201
1202/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1203#define OMAP4430_TRANSITION_EN_SHIFT (1 << 8)
1204#define OMAP4430_TRANSITION_EN_MASK BITFIELD(8, 8)
1205
1206/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1207#define OMAP4430_TRANSITION_ST_SHIFT (1 << 8)
1208#define OMAP4430_TRANSITION_ST_MASK BITFIELD(8, 8)
1209
1210/* Used by PRM_VC_VAL_BYPASS */
1211#define OMAP4430_VALID_SHIFT (1 << 24)
1212#define OMAP4430_VALID_MASK BITFIELD(24, 24)
1213
1214/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1215#define OMAP4430_VC_BYPASSACK_EN_SHIFT (1 << 14)
1216#define OMAP4430_VC_BYPASSACK_EN_MASK BITFIELD(14, 14)
1217
1218/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1219#define OMAP4430_VC_BYPASSACK_ST_SHIFT (1 << 14)
1220#define OMAP4430_VC_BYPASSACK_ST_MASK BITFIELD(14, 14)
1221
1222/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1223#define OMAP4430_VC_IVA_VPACK_EN_SHIFT (1 << 30)
1224#define OMAP4430_VC_IVA_VPACK_EN_MASK BITFIELD(30, 30)
1225
1226/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1227#define OMAP4430_VC_IVA_VPACK_ST_SHIFT (1 << 30)
1228#define OMAP4430_VC_IVA_VPACK_ST_MASK BITFIELD(30, 30)
1229
1230/* Used by PRM_IRQENABLE_MPU_2 */
1231#define OMAP4430_VC_MPU_VPACK_EN_SHIFT (1 << 6)
1232#define OMAP4430_VC_MPU_VPACK_EN_MASK BITFIELD(6, 6)
1233
1234/* Used by PRM_IRQSTATUS_MPU_2 */
1235#define OMAP4430_VC_MPU_VPACK_ST_SHIFT (1 << 6)
1236#define OMAP4430_VC_MPU_VPACK_ST_MASK BITFIELD(6, 6)
1237
1238/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1239#define OMAP4430_VC_RAERR_EN_SHIFT (1 << 12)
1240#define OMAP4430_VC_RAERR_EN_MASK BITFIELD(12, 12)
1241
1242/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1243#define OMAP4430_VC_RAERR_ST_SHIFT (1 << 12)
1244#define OMAP4430_VC_RAERR_ST_MASK BITFIELD(12, 12)
1245
1246/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1247#define OMAP4430_VC_SAERR_EN_SHIFT (1 << 11)
1248#define OMAP4430_VC_SAERR_EN_MASK BITFIELD(11, 11)
1249
1250/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1251#define OMAP4430_VC_SAERR_ST_SHIFT (1 << 11)
1252#define OMAP4430_VC_SAERR_ST_MASK BITFIELD(11, 11)
1253
1254/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1255#define OMAP4430_VC_TOERR_EN_SHIFT (1 << 13)
1256#define OMAP4430_VC_TOERR_EN_MASK BITFIELD(13, 13)
1257
1258/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1259#define OMAP4430_VC_TOERR_ST_SHIFT (1 << 13)
1260#define OMAP4430_VC_TOERR_ST_MASK BITFIELD(13, 13)
1261
1262/* Used by PRM_VP_CORE_VLIMITTO, PRM_VP_IVA_VLIMITTO, PRM_VP_MPU_VLIMITTO */
1263#define OMAP4430_VDDMAX_SHIFT (1 << 24)
1264#define OMAP4430_VDDMAX_MASK BITFIELD(24, 31)
1265
1266/* Used by PRM_VP_CORE_VLIMITTO, PRM_VP_IVA_VLIMITTO, PRM_VP_MPU_VLIMITTO */
1267#define OMAP4430_VDDMIN_SHIFT (1 << 16)
1268#define OMAP4430_VDDMIN_MASK BITFIELD(16, 23)
1269
1270/* Used by PRM_VOLTCTRL */
1271#define OMAP4430_VDD_CORE_I2C_DISABLE_SHIFT (1 << 12)
1272#define OMAP4430_VDD_CORE_I2C_DISABLE_MASK BITFIELD(12, 12)
1273
1274/* Used by PRM_RSTST */
1275#define OMAP4430_VDD_CORE_VOLT_MGR_RST_SHIFT (1 << 8)
1276#define OMAP4430_VDD_CORE_VOLT_MGR_RST_MASK BITFIELD(8, 8)
1277
1278/* Used by PRM_VOLTCTRL */
1279#define OMAP4430_VDD_IVA_I2C_DISABLE_SHIFT (1 << 14)
1280#define OMAP4430_VDD_IVA_I2C_DISABLE_MASK BITFIELD(14, 14)
1281
1282/* Used by PRM_VOLTCTRL */
1283#define OMAP4430_VDD_IVA_PRESENCE_SHIFT (1 << 9)
1284#define OMAP4430_VDD_IVA_PRESENCE_MASK BITFIELD(9, 9)
1285
1286/* Used by PRM_RSTST */
1287#define OMAP4430_VDD_IVA_VOLT_MGR_RST_SHIFT (1 << 7)
1288#define OMAP4430_VDD_IVA_VOLT_MGR_RST_MASK BITFIELD(7, 7)
1289
1290/* Used by PRM_VOLTCTRL */
1291#define OMAP4430_VDD_MPU_I2C_DISABLE_SHIFT (1 << 13)
1292#define OMAP4430_VDD_MPU_I2C_DISABLE_MASK BITFIELD(13, 13)
1293
1294/* Used by PRM_VOLTCTRL */
1295#define OMAP4430_VDD_MPU_PRESENCE_SHIFT (1 << 8)
1296#define OMAP4430_VDD_MPU_PRESENCE_MASK BITFIELD(8, 8)
1297
1298/* Used by PRM_RSTST */
1299#define OMAP4430_VDD_MPU_VOLT_MGR_RST_SHIFT (1 << 6)
1300#define OMAP4430_VDD_MPU_VOLT_MGR_RST_MASK BITFIELD(6, 6)
1301
1302/* Used by PRM_VC_VAL_SMPS_RA_VOL */
1303#define OMAP4430_VOLRA_VDD_CORE_L_SHIFT (1 << 0)
1304#define OMAP4430_VOLRA_VDD_CORE_L_MASK BITFIELD(0, 7)
1305
1306/* Used by PRM_VC_VAL_SMPS_RA_VOL */
1307#define OMAP4430_VOLRA_VDD_IVA_L_SHIFT (1 << 8)
1308#define OMAP4430_VOLRA_VDD_IVA_L_MASK BITFIELD(8, 15)
1309
1310/* Used by PRM_VC_VAL_SMPS_RA_VOL */
1311#define OMAP4430_VOLRA_VDD_MPU_L_SHIFT (1 << 16)
1312#define OMAP4430_VOLRA_VDD_MPU_L_MASK BITFIELD(16, 23)
1313
1314/* Used by PRM_VP_CORE_CONFIG, PRM_VP_IVA_CONFIG, PRM_VP_MPU_CONFIG */
1315#define OMAP4430_VPENABLE_SHIFT (1 << 0)
1316#define OMAP4430_VPENABLE_MASK BITFIELD(0, 0)
1317
1318/* Used by PRM_VP_CORE_STATUS, PRM_VP_IVA_STATUS, PRM_VP_MPU_STATUS */
1319#define OMAP4430_VPINIDLE_SHIFT (1 << 0)
1320#define OMAP4430_VPINIDLE_MASK BITFIELD(0, 0)
1321
1322/* Used by PRM_VP_CORE_VOLTAGE, PRM_VP_IVA_VOLTAGE, PRM_VP_MPU_VOLTAGE */
1323#define OMAP4430_VPVOLTAGE_SHIFT (1 << 0)
1324#define OMAP4430_VPVOLTAGE_MASK BITFIELD(0, 7)
1325
1326/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1327#define OMAP4430_VP_CORE_EQVALUE_EN_SHIFT (1 << 20)
1328#define OMAP4430_VP_CORE_EQVALUE_EN_MASK BITFIELD(20, 20)
1329
1330/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1331#define OMAP4430_VP_CORE_EQVALUE_ST_SHIFT (1 << 20)
1332#define OMAP4430_VP_CORE_EQVALUE_ST_MASK BITFIELD(20, 20)
1333
1334/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1335#define OMAP4430_VP_CORE_MAXVDD_EN_SHIFT (1 << 18)
1336#define OMAP4430_VP_CORE_MAXVDD_EN_MASK BITFIELD(18, 18)
1337
1338/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1339#define OMAP4430_VP_CORE_MAXVDD_ST_SHIFT (1 << 18)
1340#define OMAP4430_VP_CORE_MAXVDD_ST_MASK BITFIELD(18, 18)
1341
1342/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1343#define OMAP4430_VP_CORE_MINVDD_EN_SHIFT (1 << 17)
1344#define OMAP4430_VP_CORE_MINVDD_EN_MASK BITFIELD(17, 17)
1345
1346/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1347#define OMAP4430_VP_CORE_MINVDD_ST_SHIFT (1 << 17)
1348#define OMAP4430_VP_CORE_MINVDD_ST_MASK BITFIELD(17, 17)
1349
1350/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1351#define OMAP4430_VP_CORE_NOSMPSACK_EN_SHIFT (1 << 19)
1352#define OMAP4430_VP_CORE_NOSMPSACK_EN_MASK BITFIELD(19, 19)
1353
1354/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1355#define OMAP4430_VP_CORE_NOSMPSACK_ST_SHIFT (1 << 19)
1356#define OMAP4430_VP_CORE_NOSMPSACK_ST_MASK BITFIELD(19, 19)
1357
1358/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1359#define OMAP4430_VP_CORE_OPPCHANGEDONE_EN_SHIFT (1 << 16)
1360#define OMAP4430_VP_CORE_OPPCHANGEDONE_EN_MASK BITFIELD(16, 16)
1361
1362/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1363#define OMAP4430_VP_CORE_OPPCHANGEDONE_ST_SHIFT (1 << 16)
1364#define OMAP4430_VP_CORE_OPPCHANGEDONE_ST_MASK BITFIELD(16, 16)
1365
1366/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1367#define OMAP4430_VP_CORE_TRANXDONE_EN_SHIFT (1 << 21)
1368#define OMAP4430_VP_CORE_TRANXDONE_EN_MASK BITFIELD(21, 21)
1369
1370/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1371#define OMAP4430_VP_CORE_TRANXDONE_ST_SHIFT (1 << 21)
1372#define OMAP4430_VP_CORE_TRANXDONE_ST_MASK BITFIELD(21, 21)
1373
1374/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1375#define OMAP4430_VP_IVA_EQVALUE_EN_SHIFT (1 << 28)
1376#define OMAP4430_VP_IVA_EQVALUE_EN_MASK BITFIELD(28, 28)
1377
1378/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1379#define OMAP4430_VP_IVA_EQVALUE_ST_SHIFT (1 << 28)
1380#define OMAP4430_VP_IVA_EQVALUE_ST_MASK BITFIELD(28, 28)
1381
1382/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1383#define OMAP4430_VP_IVA_MAXVDD_EN_SHIFT (1 << 26)
1384#define OMAP4430_VP_IVA_MAXVDD_EN_MASK BITFIELD(26, 26)
1385
1386/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1387#define OMAP4430_VP_IVA_MAXVDD_ST_SHIFT (1 << 26)
1388#define OMAP4430_VP_IVA_MAXVDD_ST_MASK BITFIELD(26, 26)
1389
1390/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1391#define OMAP4430_VP_IVA_MINVDD_EN_SHIFT (1 << 25)
1392#define OMAP4430_VP_IVA_MINVDD_EN_MASK BITFIELD(25, 25)
1393
1394/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1395#define OMAP4430_VP_IVA_MINVDD_ST_SHIFT (1 << 25)
1396#define OMAP4430_VP_IVA_MINVDD_ST_MASK BITFIELD(25, 25)
1397
1398/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1399#define OMAP4430_VP_IVA_NOSMPSACK_EN_SHIFT (1 << 27)
1400#define OMAP4430_VP_IVA_NOSMPSACK_EN_MASK BITFIELD(27, 27)
1401
1402/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1403#define OMAP4430_VP_IVA_NOSMPSACK_ST_SHIFT (1 << 27)
1404#define OMAP4430_VP_IVA_NOSMPSACK_ST_MASK BITFIELD(27, 27)
1405
1406/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1407#define OMAP4430_VP_IVA_OPPCHANGEDONE_EN_SHIFT (1 << 24)
1408#define OMAP4430_VP_IVA_OPPCHANGEDONE_EN_MASK BITFIELD(24, 24)
1409
1410/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1411#define OMAP4430_VP_IVA_OPPCHANGEDONE_ST_SHIFT (1 << 24)
1412#define OMAP4430_VP_IVA_OPPCHANGEDONE_ST_MASK BITFIELD(24, 24)
1413
1414/* Used by PRM_IRQENABLE_DUCATI, PRM_IRQENABLE_MPU */
1415#define OMAP4430_VP_IVA_TRANXDONE_EN_SHIFT (1 << 29)
1416#define OMAP4430_VP_IVA_TRANXDONE_EN_MASK BITFIELD(29, 29)
1417
1418/* Used by PRM_IRQSTATUS_DUCATI, PRM_IRQSTATUS_MPU */
1419#define OMAP4430_VP_IVA_TRANXDONE_ST_SHIFT (1 << 29)
1420#define OMAP4430_VP_IVA_TRANXDONE_ST_MASK BITFIELD(29, 29)
1421
1422/* Used by PRM_IRQENABLE_MPU_2 */
1423#define OMAP4430_VP_MPU_EQVALUE_EN_SHIFT (1 << 4)
1424#define OMAP4430_VP_MPU_EQVALUE_EN_MASK BITFIELD(4, 4)
1425
1426/* Used by PRM_IRQSTATUS_MPU_2 */
1427#define OMAP4430_VP_MPU_EQVALUE_ST_SHIFT (1 << 4)
1428#define OMAP4430_VP_MPU_EQVALUE_ST_MASK BITFIELD(4, 4)
1429
1430/* Used by PRM_IRQENABLE_MPU_2 */
1431#define OMAP4430_VP_MPU_MAXVDD_EN_SHIFT (1 << 2)
1432#define OMAP4430_VP_MPU_MAXVDD_EN_MASK BITFIELD(2, 2)
1433
1434/* Used by PRM_IRQSTATUS_MPU_2 */
1435#define OMAP4430_VP_MPU_MAXVDD_ST_SHIFT (1 << 2)
1436#define OMAP4430_VP_MPU_MAXVDD_ST_MASK BITFIELD(2, 2)
1437
1438/* Used by PRM_IRQENABLE_MPU_2 */
1439#define OMAP4430_VP_MPU_MINVDD_EN_SHIFT (1 << 1)
1440#define OMAP4430_VP_MPU_MINVDD_EN_MASK BITFIELD(1, 1)
1441
1442/* Used by PRM_IRQSTATUS_MPU_2 */
1443#define OMAP4430_VP_MPU_MINVDD_ST_SHIFT (1 << 1)
1444#define OMAP4430_VP_MPU_MINVDD_ST_MASK BITFIELD(1, 1)
1445
1446/* Used by PRM_IRQENABLE_MPU_2 */
1447#define OMAP4430_VP_MPU_NOSMPSACK_EN_SHIFT (1 << 3)
1448#define OMAP4430_VP_MPU_NOSMPSACK_EN_MASK BITFIELD(3, 3)
1449
1450/* Used by PRM_IRQSTATUS_MPU_2 */
1451#define OMAP4430_VP_MPU_NOSMPSACK_ST_SHIFT (1 << 3)
1452#define OMAP4430_VP_MPU_NOSMPSACK_ST_MASK BITFIELD(3, 3)
1453
1454/* Used by PRM_IRQENABLE_MPU_2 */
1455#define OMAP4430_VP_MPU_OPPCHANGEDONE_EN_SHIFT (1 << 0)
1456#define OMAP4430_VP_MPU_OPPCHANGEDONE_EN_MASK BITFIELD(0, 0)
1457
1458/* Used by PRM_IRQSTATUS_MPU_2 */
1459#define OMAP4430_VP_MPU_OPPCHANGEDONE_ST_SHIFT (1 << 0)
1460#define OMAP4430_VP_MPU_OPPCHANGEDONE_ST_MASK BITFIELD(0, 0)
1461
1462/* Used by PRM_IRQENABLE_MPU_2 */
1463#define OMAP4430_VP_MPU_TRANXDONE_EN_SHIFT (1 << 5)
1464#define OMAP4430_VP_MPU_TRANXDONE_EN_MASK BITFIELD(5, 5)
1465
1466/* Used by PRM_IRQSTATUS_MPU_2 */
1467#define OMAP4430_VP_MPU_TRANXDONE_ST_SHIFT (1 << 5)
1468#define OMAP4430_VP_MPU_TRANXDONE_ST_MASK BITFIELD(5, 5)
1469
1470/* Used by PRM_SRAM_COUNT */
1471#define OMAP4430_VSETUPCNT_VALUE_SHIFT (1 << 8)
1472#define OMAP4430_VSETUPCNT_VALUE_MASK BITFIELD(8, 15)
1473
1474/* Used by PRM_VP_CORE_VSTEPMAX, PRM_VP_IVA_VSTEPMAX, PRM_VP_MPU_VSTEPMAX */
1475#define OMAP4430_VSTEPMAX_SHIFT (1 << 0)
1476#define OMAP4430_VSTEPMAX_MASK BITFIELD(0, 7)
1477
1478/* Used by PRM_VP_CORE_VSTEPMIN, PRM_VP_IVA_VSTEPMIN, PRM_VP_MPU_VSTEPMIN */
1479#define OMAP4430_VSTEPMIN_SHIFT (1 << 0)
1480#define OMAP4430_VSTEPMIN_MASK BITFIELD(0, 7)
1481
1482/* Used by PRM_MODEM_IF_CTRL */
1483#define OMAP4430_WAKE_MODEM_SHIFT (1 << 0)
1484#define OMAP4430_WAKE_MODEM_MASK BITFIELD(0, 0)
1485
1486/* Used by PM_DSS_DSS_WKDEP */
1487#define OMAP4430_WKUPDEP_DISPC_DUCATI_SHIFT (1 << 1)
1488#define OMAP4430_WKUPDEP_DISPC_DUCATI_MASK BITFIELD(1, 1)
1489
1490/* Used by PM_DSS_DSS_WKDEP */
1491#define OMAP4430_WKUPDEP_DISPC_MPU_SHIFT (1 << 0)
1492#define OMAP4430_WKUPDEP_DISPC_MPU_MASK BITFIELD(0, 0)
1493
1494/* Used by PM_DSS_DSS_WKDEP */
1495#define OMAP4430_WKUPDEP_DISPC_SDMA_SHIFT (1 << 3)
1496#define OMAP4430_WKUPDEP_DISPC_SDMA_MASK BITFIELD(3, 3)
1497
1498/* Used by PM_DSS_DSS_WKDEP */
1499#define OMAP4430_WKUPDEP_DISPC_TESLA_SHIFT (1 << 2)
1500#define OMAP4430_WKUPDEP_DISPC_TESLA_MASK BITFIELD(2, 2)
1501
1502/* Used by PM_ABE_DMIC_WKDEP */
1503#define OMAP4430_WKUPDEP_DMIC_DMA_SDMA_SHIFT (1 << 7)
1504#define OMAP4430_WKUPDEP_DMIC_DMA_SDMA_MASK BITFIELD(7, 7)
1505
1506/* Used by PM_ABE_DMIC_WKDEP */
1507#define OMAP4430_WKUPDEP_DMIC_DMA_TESLA_SHIFT (1 << 6)
1508#define OMAP4430_WKUPDEP_DMIC_DMA_TESLA_MASK BITFIELD(6, 6)
1509
1510/* Used by PM_ABE_DMIC_WKDEP */
1511#define OMAP4430_WKUPDEP_DMIC_IRQ_MPU_SHIFT (1 << 0)
1512#define OMAP4430_WKUPDEP_DMIC_IRQ_MPU_MASK BITFIELD(0, 0)
1513
1514/* Used by PM_ABE_DMIC_WKDEP */
1515#define OMAP4430_WKUPDEP_DMIC_IRQ_TESLA_SHIFT (1 << 2)
1516#define OMAP4430_WKUPDEP_DMIC_IRQ_TESLA_MASK BITFIELD(2, 2)
1517
1518/* Used by PM_L4PER_DMTIMER10_WKDEP */
1519#define OMAP4430_WKUPDEP_DMTIMER10_MPU_SHIFT (1 << 0)
1520#define OMAP4430_WKUPDEP_DMTIMER10_MPU_MASK BITFIELD(0, 0)
1521
1522/* Used by PM_L4PER_DMTIMER11_WKDEP */
1523#define OMAP4430_WKUPDEP_DMTIMER11_DUCATI_SHIFT (1 << 1)
1524#define OMAP4430_WKUPDEP_DMTIMER11_DUCATI_MASK BITFIELD(1, 1)
1525
1526/* Used by PM_L4PER_DMTIMER11_WKDEP */
1527#define OMAP4430_WKUPDEP_DMTIMER11_MPU_SHIFT (1 << 0)
1528#define OMAP4430_WKUPDEP_DMTIMER11_MPU_MASK BITFIELD(0, 0)
1529
1530/* Used by PM_L4PER_DMTIMER2_WKDEP */
1531#define OMAP4430_WKUPDEP_DMTIMER2_MPU_SHIFT (1 << 0)
1532#define OMAP4430_WKUPDEP_DMTIMER2_MPU_MASK BITFIELD(0, 0)
1533
1534/* Used by PM_L4PER_DMTIMER3_WKDEP */
1535#define OMAP4430_WKUPDEP_DMTIMER3_DUCATI_SHIFT (1 << 1)
1536#define OMAP4430_WKUPDEP_DMTIMER3_DUCATI_MASK BITFIELD(1, 1)
1537
1538/* Used by PM_L4PER_DMTIMER3_WKDEP */
1539#define OMAP4430_WKUPDEP_DMTIMER3_MPU_SHIFT (1 << 0)
1540#define OMAP4430_WKUPDEP_DMTIMER3_MPU_MASK BITFIELD(0, 0)
1541
1542/* Used by PM_L4PER_DMTIMER4_WKDEP */
1543#define OMAP4430_WKUPDEP_DMTIMER4_DUCATI_SHIFT (1 << 1)
1544#define OMAP4430_WKUPDEP_DMTIMER4_DUCATI_MASK BITFIELD(1, 1)
1545
1546/* Used by PM_L4PER_DMTIMER4_WKDEP */
1547#define OMAP4430_WKUPDEP_DMTIMER4_MPU_SHIFT (1 << 0)
1548#define OMAP4430_WKUPDEP_DMTIMER4_MPU_MASK BITFIELD(0, 0)
1549
1550/* Used by PM_L4PER_DMTIMER9_WKDEP */
1551#define OMAP4430_WKUPDEP_DMTIMER9_DUCATI_SHIFT (1 << 1)
1552#define OMAP4430_WKUPDEP_DMTIMER9_DUCATI_MASK BITFIELD(1, 1)
1553
1554/* Used by PM_L4PER_DMTIMER9_WKDEP */
1555#define OMAP4430_WKUPDEP_DMTIMER9_MPU_SHIFT (1 << 0)
1556#define OMAP4430_WKUPDEP_DMTIMER9_MPU_MASK BITFIELD(0, 0)
1557
1558/* Used by PM_DSS_DSS_WKDEP */
1559#define OMAP4430_WKUPDEP_DSI1_DUCATI_SHIFT (1 << 5)
1560#define OMAP4430_WKUPDEP_DSI1_DUCATI_MASK BITFIELD(5, 5)
1561
1562/* Used by PM_DSS_DSS_WKDEP */
1563#define OMAP4430_WKUPDEP_DSI1_MPU_SHIFT (1 << 4)
1564#define OMAP4430_WKUPDEP_DSI1_MPU_MASK BITFIELD(4, 4)
1565
1566/* Used by PM_DSS_DSS_WKDEP */
1567#define OMAP4430_WKUPDEP_DSI1_SDMA_SHIFT (1 << 7)
1568#define OMAP4430_WKUPDEP_DSI1_SDMA_MASK BITFIELD(7, 7)
1569
1570/* Used by PM_DSS_DSS_WKDEP */
1571#define OMAP4430_WKUPDEP_DSI1_TESLA_SHIFT (1 << 6)
1572#define OMAP4430_WKUPDEP_DSI1_TESLA_MASK BITFIELD(6, 6)
1573
1574/* Used by PM_DSS_DSS_WKDEP */
1575#define OMAP4430_WKUPDEP_DSI2_DUCATI_SHIFT (1 << 9)
1576#define OMAP4430_WKUPDEP_DSI2_DUCATI_MASK BITFIELD(9, 9)
1577
1578/* Used by PM_DSS_DSS_WKDEP */
1579#define OMAP4430_WKUPDEP_DSI2_MPU_SHIFT (1 << 8)
1580#define OMAP4430_WKUPDEP_DSI2_MPU_MASK BITFIELD(8, 8)
1581
1582/* Used by PM_DSS_DSS_WKDEP */
1583#define OMAP4430_WKUPDEP_DSI2_SDMA_SHIFT (1 << 11)
1584#define OMAP4430_WKUPDEP_DSI2_SDMA_MASK BITFIELD(11, 11)
1585
1586/* Used by PM_DSS_DSS_WKDEP */
1587#define OMAP4430_WKUPDEP_DSI2_TESLA_SHIFT (1 << 10)
1588#define OMAP4430_WKUPDEP_DSI2_TESLA_MASK BITFIELD(10, 10)
1589
1590/* Used by PM_WKUP_GPIO1_WKDEP */
1591#define OMAP4430_WKUPDEP_GPIO1_IRQ1_DUCATI_SHIFT (1 << 1)
1592#define OMAP4430_WKUPDEP_GPIO1_IRQ1_DUCATI_MASK BITFIELD(1, 1)
1593
1594/* Used by PM_WKUP_GPIO1_WKDEP */
1595#define OMAP4430_WKUPDEP_GPIO1_IRQ1_MPU_SHIFT (1 << 0)
1596#define OMAP4430_WKUPDEP_GPIO1_IRQ1_MPU_MASK BITFIELD(0, 0)
1597
1598/* Used by PM_WKUP_GPIO1_WKDEP */
1599#define OMAP4430_WKUPDEP_GPIO1_IRQ2_TESLA_SHIFT (1 << 6)
1600#define OMAP4430_WKUPDEP_GPIO1_IRQ2_TESLA_MASK BITFIELD(6, 6)
1601
1602/* Used by PM_L4PER_GPIO2_WKDEP */
1603#define OMAP4430_WKUPDEP_GPIO2_IRQ1_DUCATI_SHIFT (1 << 1)
1604#define OMAP4430_WKUPDEP_GPIO2_IRQ1_DUCATI_MASK BITFIELD(1, 1)
1605
1606/* Used by PM_L4PER_GPIO2_WKDEP */
1607#define OMAP4430_WKUPDEP_GPIO2_IRQ1_MPU_SHIFT (1 << 0)
1608#define OMAP4430_WKUPDEP_GPIO2_IRQ1_MPU_MASK BITFIELD(0, 0)
1609
1610/* Used by PM_L4PER_GPIO2_WKDEP */
1611#define OMAP4430_WKUPDEP_GPIO2_IRQ2_TESLA_SHIFT (1 << 6)
1612#define OMAP4430_WKUPDEP_GPIO2_IRQ2_TESLA_MASK BITFIELD(6, 6)
1613
1614/* Used by PM_L4PER_GPIO3_WKDEP */
1615#define OMAP4430_WKUPDEP_GPIO3_IRQ1_MPU_SHIFT (1 << 0)
1616#define OMAP4430_WKUPDEP_GPIO3_IRQ1_MPU_MASK BITFIELD(0, 0)
1617
1618/* Used by PM_L4PER_GPIO3_WKDEP */
1619#define OMAP4430_WKUPDEP_GPIO3_IRQ2_TESLA_SHIFT (1 << 6)
1620#define OMAP4430_WKUPDEP_GPIO3_IRQ2_TESLA_MASK BITFIELD(6, 6)
1621
1622/* Used by PM_L4PER_GPIO4_WKDEP */
1623#define OMAP4430_WKUPDEP_GPIO4_IRQ1_MPU_SHIFT (1 << 0)
1624#define OMAP4430_WKUPDEP_GPIO4_IRQ1_MPU_MASK BITFIELD(0, 0)
1625
1626/* Used by PM_L4PER_GPIO4_WKDEP */
1627#define OMAP4430_WKUPDEP_GPIO4_IRQ2_TESLA_SHIFT (1 << 6)
1628#define OMAP4430_WKUPDEP_GPIO4_IRQ2_TESLA_MASK BITFIELD(6, 6)
1629
1630/* Used by PM_L4PER_GPIO5_WKDEP */
1631#define OMAP4430_WKUPDEP_GPIO5_IRQ1_MPU_SHIFT (1 << 0)
1632#define OMAP4430_WKUPDEP_GPIO5_IRQ1_MPU_MASK BITFIELD(0, 0)
1633
1634/* Used by PM_L4PER_GPIO5_WKDEP */
1635#define OMAP4430_WKUPDEP_GPIO5_IRQ2_TESLA_SHIFT (1 << 6)
1636#define OMAP4430_WKUPDEP_GPIO5_IRQ2_TESLA_MASK BITFIELD(6, 6)
1637
1638/* Used by PM_L4PER_GPIO6_WKDEP */
1639#define OMAP4430_WKUPDEP_GPIO6_IRQ1_MPU_SHIFT (1 << 0)
1640#define OMAP4430_WKUPDEP_GPIO6_IRQ1_MPU_MASK BITFIELD(0, 0)
1641
1642/* Used by PM_L4PER_GPIO6_WKDEP */
1643#define OMAP4430_WKUPDEP_GPIO6_IRQ2_TESLA_SHIFT (1 << 6)
1644#define OMAP4430_WKUPDEP_GPIO6_IRQ2_TESLA_MASK BITFIELD(6, 6)
1645
1646/* Used by PM_DSS_DSS_WKDEP */
1647#define OMAP4430_WKUPDEP_HDMIDMA_SDMA_SHIFT (1 << 19)
1648#define OMAP4430_WKUPDEP_HDMIDMA_SDMA_MASK BITFIELD(19, 19)
1649
1650/* Used by PM_DSS_DSS_WKDEP */
1651#define OMAP4430_WKUPDEP_HDMIIRQ_DUCATI_SHIFT (1 << 13)
1652#define OMAP4430_WKUPDEP_HDMIIRQ_DUCATI_MASK BITFIELD(13, 13)
1653
1654/* Used by PM_DSS_DSS_WKDEP */
1655#define OMAP4430_WKUPDEP_HDMIIRQ_MPU_SHIFT (1 << 12)
1656#define OMAP4430_WKUPDEP_HDMIIRQ_MPU_MASK BITFIELD(12, 12)
1657
1658/* Used by PM_DSS_DSS_WKDEP */
1659#define OMAP4430_WKUPDEP_HDMIIRQ_TESLA_SHIFT (1 << 14)
1660#define OMAP4430_WKUPDEP_HDMIIRQ_TESLA_MASK BITFIELD(14, 14)
1661
1662/* Used by PM_L4PER_HECC1_WKDEP */
1663#define OMAP4430_WKUPDEP_HECC1_MPU_SHIFT (1 << 0)
1664#define OMAP4430_WKUPDEP_HECC1_MPU_MASK BITFIELD(0, 0)
1665
1666/* Used by PM_L4PER_HECC2_WKDEP */
1667#define OMAP4430_WKUPDEP_HECC2_MPU_SHIFT (1 << 0)
1668#define OMAP4430_WKUPDEP_HECC2_MPU_MASK BITFIELD(0, 0)
1669
1670/* Used by PM_L3INIT_HSI_WKDEP */
1671#define OMAP4430_WKUPDEP_HSI_DSP_TESLA_SHIFT (1 << 6)
1672#define OMAP4430_WKUPDEP_HSI_DSP_TESLA_MASK BITFIELD(6, 6)
1673
1674/* Used by PM_L3INIT_HSI_WKDEP */
1675#define OMAP4430_WKUPDEP_HSI_MCU_DUCATI_SHIFT (1 << 1)
1676#define OMAP4430_WKUPDEP_HSI_MCU_DUCATI_MASK BITFIELD(1, 1)
1677
1678/* Used by PM_L3INIT_HSI_WKDEP */
1679#define OMAP4430_WKUPDEP_HSI_MCU_MPU_SHIFT (1 << 0)
1680#define OMAP4430_WKUPDEP_HSI_MCU_MPU_MASK BITFIELD(0, 0)
1681
1682/* Used by PM_L4PER_I2C1_WKDEP */
1683#define OMAP4430_WKUPDEP_I2C1_DMA_SDMA_SHIFT (1 << 7)
1684#define OMAP4430_WKUPDEP_I2C1_DMA_SDMA_MASK BITFIELD(7, 7)
1685
1686/* Used by PM_L4PER_I2C1_WKDEP */
1687#define OMAP4430_WKUPDEP_I2C1_IRQ_DUCATI_SHIFT (1 << 1)
1688#define OMAP4430_WKUPDEP_I2C1_IRQ_DUCATI_MASK BITFIELD(1, 1)
1689
1690/* Used by PM_L4PER_I2C1_WKDEP */
1691#define OMAP4430_WKUPDEP_I2C1_IRQ_MPU_SHIFT (1 << 0)
1692#define OMAP4430_WKUPDEP_I2C1_IRQ_MPU_MASK BITFIELD(0, 0)
1693
1694/* Used by PM_L4PER_I2C2_WKDEP */
1695#define OMAP4430_WKUPDEP_I2C2_DMA_SDMA_SHIFT (1 << 7)
1696#define OMAP4430_WKUPDEP_I2C2_DMA_SDMA_MASK BITFIELD(7, 7)
1697
1698/* Used by PM_L4PER_I2C2_WKDEP */
1699#define OMAP4430_WKUPDEP_I2C2_IRQ_DUCATI_SHIFT (1 << 1)
1700#define OMAP4430_WKUPDEP_I2C2_IRQ_DUCATI_MASK BITFIELD(1, 1)
1701
1702/* Used by PM_L4PER_I2C2_WKDEP */
1703#define OMAP4430_WKUPDEP_I2C2_IRQ_MPU_SHIFT (1 << 0)
1704#define OMAP4430_WKUPDEP_I2C2_IRQ_MPU_MASK BITFIELD(0, 0)
1705
1706/* Used by PM_L4PER_I2C3_WKDEP */
1707#define OMAP4430_WKUPDEP_I2C3_DMA_SDMA_SHIFT (1 << 7)
1708#define OMAP4430_WKUPDEP_I2C3_DMA_SDMA_MASK BITFIELD(7, 7)
1709
1710/* Used by PM_L4PER_I2C3_WKDEP */
1711#define OMAP4430_WKUPDEP_I2C3_IRQ_DUCATI_SHIFT (1 << 1)
1712#define OMAP4430_WKUPDEP_I2C3_IRQ_DUCATI_MASK BITFIELD(1, 1)
1713
1714/* Used by PM_L4PER_I2C3_WKDEP */
1715#define OMAP4430_WKUPDEP_I2C3_IRQ_MPU_SHIFT (1 << 0)
1716#define OMAP4430_WKUPDEP_I2C3_IRQ_MPU_MASK BITFIELD(0, 0)
1717
1718/* Used by PM_L4PER_I2C4_WKDEP */
1719#define OMAP4430_WKUPDEP_I2C4_DMA_SDMA_SHIFT (1 << 7)
1720#define OMAP4430_WKUPDEP_I2C4_DMA_SDMA_MASK BITFIELD(7, 7)
1721
1722/* Used by PM_L4PER_I2C4_WKDEP */
1723#define OMAP4430_WKUPDEP_I2C4_IRQ_DUCATI_SHIFT (1 << 1)
1724#define OMAP4430_WKUPDEP_I2C4_IRQ_DUCATI_MASK BITFIELD(1, 1)
1725
1726/* Used by PM_L4PER_I2C4_WKDEP */
1727#define OMAP4430_WKUPDEP_I2C4_IRQ_MPU_SHIFT (1 << 0)
1728#define OMAP4430_WKUPDEP_I2C4_IRQ_MPU_MASK BITFIELD(0, 0)
1729
1730/* Used by PM_L4PER_I2C5_WKDEP */
1731#define OMAP4430_WKUPDEP_I2C5_DMA_SDMA_SHIFT (1 << 7)
1732#define OMAP4430_WKUPDEP_I2C5_DMA_SDMA_MASK BITFIELD(7, 7)
1733
1734/* Used by PM_L4PER_I2C5_WKDEP */
1735#define OMAP4430_WKUPDEP_I2C5_IRQ_MPU_SHIFT (1 << 0)
1736#define OMAP4430_WKUPDEP_I2C5_IRQ_MPU_MASK BITFIELD(0, 0)
1737
1738/* Used by PM_WKUP_KEYBOARD_WKDEP */
1739#define OMAP4430_WKUPDEP_KEYBOARD_MPU_SHIFT (1 << 0)
1740#define OMAP4430_WKUPDEP_KEYBOARD_MPU_MASK BITFIELD(0, 0)
1741
1742/* Used by PM_ABE_MCASP_WKDEP */
1743#define OMAP4430_WKUPDEP_MCASP1_DMA_SDMA_SHIFT (1 << 7)
1744#define OMAP4430_WKUPDEP_MCASP1_DMA_SDMA_MASK BITFIELD(7, 7)
1745
1746/* Used by PM_ABE_MCASP_WKDEP */
1747#define OMAP4430_WKUPDEP_MCASP1_DMA_TESLA_SHIFT (1 << 6)
1748#define OMAP4430_WKUPDEP_MCASP1_DMA_TESLA_MASK BITFIELD(6, 6)
1749
1750/* Used by PM_ABE_MCASP_WKDEP */
1751#define OMAP4430_WKUPDEP_MCASP1_IRQ_MPU_SHIFT (1 << 0)
1752#define OMAP4430_WKUPDEP_MCASP1_IRQ_MPU_MASK BITFIELD(0, 0)
1753
1754/* Used by PM_ABE_MCASP_WKDEP */
1755#define OMAP4430_WKUPDEP_MCASP1_IRQ_TESLA_SHIFT (1 << 2)
1756#define OMAP4430_WKUPDEP_MCASP1_IRQ_TESLA_MASK BITFIELD(2, 2)
1757
1758/* Used by PM_L4PER_MCASP2_WKDEP */
1759#define OMAP4430_WKUPDEP_MCASP2_DMA_SDMA_SHIFT (1 << 7)
1760#define OMAP4430_WKUPDEP_MCASP2_DMA_SDMA_MASK BITFIELD(7, 7)
1761
1762/* Used by PM_L4PER_MCASP2_WKDEP */
1763#define OMAP4430_WKUPDEP_MCASP2_DMA_TESLA_SHIFT (1 << 6)
1764#define OMAP4430_WKUPDEP_MCASP2_DMA_TESLA_MASK BITFIELD(6, 6)
1765
1766/* Used by PM_L4PER_MCASP2_WKDEP */
1767#define OMAP4430_WKUPDEP_MCASP2_IRQ_MPU_SHIFT (1 << 0)
1768#define OMAP4430_WKUPDEP_MCASP2_IRQ_MPU_MASK BITFIELD(0, 0)
1769
1770/* Used by PM_L4PER_MCASP2_WKDEP */
1771#define OMAP4430_WKUPDEP_MCASP2_IRQ_TESLA_SHIFT (1 << 2)
1772#define OMAP4430_WKUPDEP_MCASP2_IRQ_TESLA_MASK BITFIELD(2, 2)
1773
1774/* Used by PM_L4PER_MCASP3_WKDEP */
1775#define OMAP4430_WKUPDEP_MCASP3_DMA_SDMA_SHIFT (1 << 7)
1776#define OMAP4430_WKUPDEP_MCASP3_DMA_SDMA_MASK BITFIELD(7, 7)
1777
1778/* Used by PM_L4PER_MCASP3_WKDEP */
1779#define OMAP4430_WKUPDEP_MCASP3_DMA_TESLA_SHIFT (1 << 6)
1780#define OMAP4430_WKUPDEP_MCASP3_DMA_TESLA_MASK BITFIELD(6, 6)
1781
1782/* Used by PM_L4PER_MCASP3_WKDEP */
1783#define OMAP4430_WKUPDEP_MCASP3_IRQ_MPU_SHIFT (1 << 0)
1784#define OMAP4430_WKUPDEP_MCASP3_IRQ_MPU_MASK BITFIELD(0, 0)
1785
1786/* Used by PM_L4PER_MCASP3_WKDEP */
1787#define OMAP4430_WKUPDEP_MCASP3_IRQ_TESLA_SHIFT (1 << 2)
1788#define OMAP4430_WKUPDEP_MCASP3_IRQ_TESLA_MASK BITFIELD(2, 2)
1789
1790/* Used by PM_ABE_MCBSP1_WKDEP */
1791#define OMAP4430_WKUPDEP_MCBSP1_MPU_SHIFT (1 << 0)
1792#define OMAP4430_WKUPDEP_MCBSP1_MPU_MASK BITFIELD(0, 0)
1793
1794/* Used by PM_ABE_MCBSP1_WKDEP */
1795#define OMAP4430_WKUPDEP_MCBSP1_SDMA_SHIFT (1 << 3)
1796#define OMAP4430_WKUPDEP_MCBSP1_SDMA_MASK BITFIELD(3, 3)
1797
1798/* Used by PM_ABE_MCBSP1_WKDEP */
1799#define OMAP4430_WKUPDEP_MCBSP1_TESLA_SHIFT (1 << 2)
1800#define OMAP4430_WKUPDEP_MCBSP1_TESLA_MASK BITFIELD(2, 2)
1801
1802/* Used by PM_ABE_MCBSP2_WKDEP */
1803#define OMAP4430_WKUPDEP_MCBSP2_MPU_SHIFT (1 << 0)
1804#define OMAP4430_WKUPDEP_MCBSP2_MPU_MASK BITFIELD(0, 0)
1805
1806/* Used by PM_ABE_MCBSP2_WKDEP */
1807#define OMAP4430_WKUPDEP_MCBSP2_SDMA_SHIFT (1 << 3)
1808#define OMAP4430_WKUPDEP_MCBSP2_SDMA_MASK BITFIELD(3, 3)
1809
1810/* Used by PM_ABE_MCBSP2_WKDEP */
1811#define OMAP4430_WKUPDEP_MCBSP2_TESLA_SHIFT (1 << 2)
1812#define OMAP4430_WKUPDEP_MCBSP2_TESLA_MASK BITFIELD(2, 2)
1813
1814/* Used by PM_ABE_MCBSP3_WKDEP */
1815#define OMAP4430_WKUPDEP_MCBSP3_MPU_SHIFT (1 << 0)
1816#define OMAP4430_WKUPDEP_MCBSP3_MPU_MASK BITFIELD(0, 0)
1817
1818/* Used by PM_ABE_MCBSP3_WKDEP */
1819#define OMAP4430_WKUPDEP_MCBSP3_SDMA_SHIFT (1 << 3)
1820#define OMAP4430_WKUPDEP_MCBSP3_SDMA_MASK BITFIELD(3, 3)
1821
1822/* Used by PM_ABE_MCBSP3_WKDEP */
1823#define OMAP4430_WKUPDEP_MCBSP3_TESLA_SHIFT (1 << 2)
1824#define OMAP4430_WKUPDEP_MCBSP3_TESLA_MASK BITFIELD(2, 2)
1825
1826/* Used by PM_L4PER_MCBSP4_WKDEP */
1827#define OMAP4430_WKUPDEP_MCBSP4_MPU_SHIFT (1 << 0)
1828#define OMAP4430_WKUPDEP_MCBSP4_MPU_MASK BITFIELD(0, 0)
1829
1830/* Used by PM_L4PER_MCBSP4_WKDEP */
1831#define OMAP4430_WKUPDEP_MCBSP4_SDMA_SHIFT (1 << 3)
1832#define OMAP4430_WKUPDEP_MCBSP4_SDMA_MASK BITFIELD(3, 3)
1833
1834/* Used by PM_L4PER_MCBSP4_WKDEP */
1835#define OMAP4430_WKUPDEP_MCBSP4_TESLA_SHIFT (1 << 2)
1836#define OMAP4430_WKUPDEP_MCBSP4_TESLA_MASK BITFIELD(2, 2)
1837
1838/* Used by PM_L4PER_MCSPI1_WKDEP */
1839#define OMAP4430_WKUPDEP_MCSPI1_DUCATI_SHIFT (1 << 1)
1840#define OMAP4430_WKUPDEP_MCSPI1_DUCATI_MASK BITFIELD(1, 1)
1841
1842/* Used by PM_L4PER_MCSPI1_WKDEP */
1843#define OMAP4430_WKUPDEP_MCSPI1_MPU_SHIFT (1 << 0)
1844#define OMAP4430_WKUPDEP_MCSPI1_MPU_MASK BITFIELD(0, 0)
1845
1846/* Used by PM_L4PER_MCSPI1_WKDEP */
1847#define OMAP4430_WKUPDEP_MCSPI1_SDMA_SHIFT (1 << 3)
1848#define OMAP4430_WKUPDEP_MCSPI1_SDMA_MASK BITFIELD(3, 3)
1849
1850/* Used by PM_L4PER_MCSPI1_WKDEP */
1851#define OMAP4430_WKUPDEP_MCSPI1_TESLA_SHIFT (1 << 2)
1852#define OMAP4430_WKUPDEP_MCSPI1_TESLA_MASK BITFIELD(2, 2)
1853
1854/* Used by PM_L4PER_MCSPI2_WKDEP */
1855#define OMAP4430_WKUPDEP_MCSPI2_DUCATI_SHIFT (1 << 1)
1856#define OMAP4430_WKUPDEP_MCSPI2_DUCATI_MASK BITFIELD(1, 1)
1857
1858/* Used by PM_L4PER_MCSPI2_WKDEP */
1859#define OMAP4430_WKUPDEP_MCSPI2_MPU_SHIFT (1 << 0)
1860#define OMAP4430_WKUPDEP_MCSPI2_MPU_MASK BITFIELD(0, 0)
1861
1862/* Used by PM_L4PER_MCSPI2_WKDEP */
1863#define OMAP4430_WKUPDEP_MCSPI2_SDMA_SHIFT (1 << 3)
1864#define OMAP4430_WKUPDEP_MCSPI2_SDMA_MASK BITFIELD(3, 3)
1865
1866/* Used by PM_L4PER_MCSPI3_WKDEP */
1867#define OMAP4430_WKUPDEP_MCSPI3_MPU_SHIFT (1 << 0)
1868#define OMAP4430_WKUPDEP_MCSPI3_MPU_MASK BITFIELD(0, 0)
1869
1870/* Used by PM_L4PER_MCSPI3_WKDEP */
1871#define OMAP4430_WKUPDEP_MCSPI3_SDMA_SHIFT (1 << 3)
1872#define OMAP4430_WKUPDEP_MCSPI3_SDMA_MASK BITFIELD(3, 3)
1873
1874/* Used by PM_L4PER_MCSPI4_WKDEP */
1875#define OMAP4430_WKUPDEP_MCSPI4_MPU_SHIFT (1 << 0)
1876#define OMAP4430_WKUPDEP_MCSPI4_MPU_MASK BITFIELD(0, 0)
1877
1878/* Used by PM_L4PER_MCSPI4_WKDEP */
1879#define OMAP4430_WKUPDEP_MCSPI4_SDMA_SHIFT (1 << 3)
1880#define OMAP4430_WKUPDEP_MCSPI4_SDMA_MASK BITFIELD(3, 3)
1881
1882/* Used by PM_L3INIT_MMC1_WKDEP */
1883#define OMAP4430_WKUPDEP_MMC1_DUCATI_SHIFT (1 << 1)
1884#define OMAP4430_WKUPDEP_MMC1_DUCATI_MASK BITFIELD(1, 1)
1885
1886/* Used by PM_L3INIT_MMC1_WKDEP */
1887#define OMAP4430_WKUPDEP_MMC1_MPU_SHIFT (1 << 0)
1888#define OMAP4430_WKUPDEP_MMC1_MPU_MASK BITFIELD(0, 0)
1889
1890/* Used by PM_L3INIT_MMC1_WKDEP */
1891#define OMAP4430_WKUPDEP_MMC1_SDMA_SHIFT (1 << 3)
1892#define OMAP4430_WKUPDEP_MMC1_SDMA_MASK BITFIELD(3, 3)
1893
1894/* Used by PM_L3INIT_MMC1_WKDEP */
1895#define OMAP4430_WKUPDEP_MMC1_TESLA_SHIFT (1 << 2)
1896#define OMAP4430_WKUPDEP_MMC1_TESLA_MASK BITFIELD(2, 2)
1897
1898/* Used by PM_L3INIT_MMC2_WKDEP */
1899#define OMAP4430_WKUPDEP_MMC2_DUCATI_SHIFT (1 << 1)
1900#define OMAP4430_WKUPDEP_MMC2_DUCATI_MASK BITFIELD(1, 1)
1901
1902/* Used by PM_L3INIT_MMC2_WKDEP */
1903#define OMAP4430_WKUPDEP_MMC2_MPU_SHIFT (1 << 0)
1904#define OMAP4430_WKUPDEP_MMC2_MPU_MASK BITFIELD(0, 0)
1905
1906/* Used by PM_L3INIT_MMC2_WKDEP */
1907#define OMAP4430_WKUPDEP_MMC2_SDMA_SHIFT (1 << 3)
1908#define OMAP4430_WKUPDEP_MMC2_SDMA_MASK BITFIELD(3, 3)
1909
1910/* Used by PM_L3INIT_MMC2_WKDEP */
1911#define OMAP4430_WKUPDEP_MMC2_TESLA_SHIFT (1 << 2)
1912#define OMAP4430_WKUPDEP_MMC2_TESLA_MASK BITFIELD(2, 2)
1913
1914/* Used by PM_L3INIT_MMC6_WKDEP */
1915#define OMAP4430_WKUPDEP_MMC6_DUCATI_SHIFT (1 << 1)
1916#define OMAP4430_WKUPDEP_MMC6_DUCATI_MASK BITFIELD(1, 1)
1917
1918/* Used by PM_L3INIT_MMC6_WKDEP */
1919#define OMAP4430_WKUPDEP_MMC6_MPU_SHIFT (1 << 0)
1920#define OMAP4430_WKUPDEP_MMC6_MPU_MASK BITFIELD(0, 0)
1921
1922/* Used by PM_L3INIT_MMC6_WKDEP */
1923#define OMAP4430_WKUPDEP_MMC6_TESLA_SHIFT (1 << 2)
1924#define OMAP4430_WKUPDEP_MMC6_TESLA_MASK BITFIELD(2, 2)
1925
1926/* Used by PM_L4PER_MMCSD3_WKDEP */
1927#define OMAP4430_WKUPDEP_MMCSD3_DUCATI_SHIFT (1 << 1)
1928#define OMAP4430_WKUPDEP_MMCSD3_DUCATI_MASK BITFIELD(1, 1)
1929
1930/* Used by PM_L4PER_MMCSD3_WKDEP */
1931#define OMAP4430_WKUPDEP_MMCSD3_MPU_SHIFT (1 << 0)
1932#define OMAP4430_WKUPDEP_MMCSD3_MPU_MASK BITFIELD(0, 0)
1933
1934/* Used by PM_L4PER_MMCSD3_WKDEP */
1935#define OMAP4430_WKUPDEP_MMCSD3_SDMA_SHIFT (1 << 3)
1936#define OMAP4430_WKUPDEP_MMCSD3_SDMA_MASK BITFIELD(3, 3)
1937
1938/* Used by PM_L4PER_MMCSD4_WKDEP */
1939#define OMAP4430_WKUPDEP_MMCSD4_DUCATI_SHIFT (1 << 1)
1940#define OMAP4430_WKUPDEP_MMCSD4_DUCATI_MASK BITFIELD(1, 1)
1941
1942/* Used by PM_L4PER_MMCSD4_WKDEP */
1943#define OMAP4430_WKUPDEP_MMCSD4_MPU_SHIFT (1 << 0)
1944#define OMAP4430_WKUPDEP_MMCSD4_MPU_MASK BITFIELD(0, 0)
1945
1946/* Used by PM_L4PER_MMCSD4_WKDEP */
1947#define OMAP4430_WKUPDEP_MMCSD4_SDMA_SHIFT (1 << 3)
1948#define OMAP4430_WKUPDEP_MMCSD4_SDMA_MASK BITFIELD(3, 3)
1949
1950/* Used by PM_L4PER_MMCSD5_WKDEP */
1951#define OMAP4430_WKUPDEP_MMCSD5_DUCATI_SHIFT (1 << 1)
1952#define OMAP4430_WKUPDEP_MMCSD5_DUCATI_MASK BITFIELD(1, 1)
1953
1954/* Used by PM_L4PER_MMCSD5_WKDEP */
1955#define OMAP4430_WKUPDEP_MMCSD5_MPU_SHIFT (1 << 0)
1956#define OMAP4430_WKUPDEP_MMCSD5_MPU_MASK BITFIELD(0, 0)
1957
1958/* Used by PM_L4PER_MMCSD5_WKDEP */
1959#define OMAP4430_WKUPDEP_MMCSD5_SDMA_SHIFT (1 << 3)
1960#define OMAP4430_WKUPDEP_MMCSD5_SDMA_MASK BITFIELD(3, 3)
1961
1962/* Used by PM_L3INIT_PCIESS_WKDEP */
1963#define OMAP4430_WKUPDEP_PCIESS_MPU_SHIFT (1 << 0)
1964#define OMAP4430_WKUPDEP_PCIESS_MPU_MASK BITFIELD(0, 0)
1965
1966/* Used by PM_L3INIT_PCIESS_WKDEP */
1967#define OMAP4430_WKUPDEP_PCIESS_TESLA_SHIFT (1 << 2)
1968#define OMAP4430_WKUPDEP_PCIESS_TESLA_MASK BITFIELD(2, 2)
1969
1970/* Used by PM_ABE_PDM_WKDEP */
1971#define OMAP4430_WKUPDEP_PDM_DMA_SDMA_SHIFT (1 << 7)
1972#define OMAP4430_WKUPDEP_PDM_DMA_SDMA_MASK BITFIELD(7, 7)
1973
1974/* Used by PM_ABE_PDM_WKDEP */
1975#define OMAP4430_WKUPDEP_PDM_DMA_TESLA_SHIFT (1 << 6)
1976#define OMAP4430_WKUPDEP_PDM_DMA_TESLA_MASK BITFIELD(6, 6)
1977
1978/* Used by PM_ABE_PDM_WKDEP */
1979#define OMAP4430_WKUPDEP_PDM_IRQ_MPU_SHIFT (1 << 0)
1980#define OMAP4430_WKUPDEP_PDM_IRQ_MPU_MASK BITFIELD(0, 0)
1981
1982/* Used by PM_ABE_PDM_WKDEP */
1983#define OMAP4430_WKUPDEP_PDM_IRQ_TESLA_SHIFT (1 << 2)
1984#define OMAP4430_WKUPDEP_PDM_IRQ_TESLA_MASK BITFIELD(2, 2)
1985
1986/* Used by PM_WKUP_RTC_WKDEP */
1987#define OMAP4430_WKUPDEP_RTC_MPU_SHIFT (1 << 0)
1988#define OMAP4430_WKUPDEP_RTC_MPU_MASK BITFIELD(0, 0)
1989
1990/* Used by PM_L3INIT_SATA_WKDEP */
1991#define OMAP4430_WKUPDEP_SATA_MPU_SHIFT (1 << 0)
1992#define OMAP4430_WKUPDEP_SATA_MPU_MASK BITFIELD(0, 0)
1993
1994/* Used by PM_L3INIT_SATA_WKDEP */
1995#define OMAP4430_WKUPDEP_SATA_TESLA_SHIFT (1 << 2)
1996#define OMAP4430_WKUPDEP_SATA_TESLA_MASK BITFIELD(2, 2)
1997
1998/* Used by PM_ABE_SLIMBUS_WKDEP */
1999#define OMAP4430_WKUPDEP_SLIMBUS1_DMA_SDMA_SHIFT (1 << 7)
2000#define OMAP4430_WKUPDEP_SLIMBUS1_DMA_SDMA_MASK BITFIELD(7, 7)
2001
2002/* Used by PM_ABE_SLIMBUS_WKDEP */
2003#define OMAP4430_WKUPDEP_SLIMBUS1_DMA_TESLA_SHIFT (1 << 6)
2004#define OMAP4430_WKUPDEP_SLIMBUS1_DMA_TESLA_MASK BITFIELD(6, 6)
2005
2006/* Used by PM_ABE_SLIMBUS_WKDEP */
2007#define OMAP4430_WKUPDEP_SLIMBUS1_IRQ_MPU_SHIFT (1 << 0)
2008#define OMAP4430_WKUPDEP_SLIMBUS1_IRQ_MPU_MASK BITFIELD(0, 0)
2009
2010/* Used by PM_ABE_SLIMBUS_WKDEP */
2011#define OMAP4430_WKUPDEP_SLIMBUS1_IRQ_TESLA_SHIFT (1 << 2)
2012#define OMAP4430_WKUPDEP_SLIMBUS1_IRQ_TESLA_MASK BITFIELD(2, 2)
2013
2014/* Used by PM_L4PER_SLIMBUS2_WKDEP */
2015#define OMAP4430_WKUPDEP_SLIMBUS2_DMA_SDMA_SHIFT (1 << 7)
2016#define OMAP4430_WKUPDEP_SLIMBUS2_DMA_SDMA_MASK BITFIELD(7, 7)
2017
2018/* Used by PM_L4PER_SLIMBUS2_WKDEP */
2019#define OMAP4430_WKUPDEP_SLIMBUS2_DMA_TESLA_SHIFT (1 << 6)
2020#define OMAP4430_WKUPDEP_SLIMBUS2_DMA_TESLA_MASK BITFIELD(6, 6)
2021
2022/* Used by PM_L4PER_SLIMBUS2_WKDEP */
2023#define OMAP4430_WKUPDEP_SLIMBUS2_IRQ_MPU_SHIFT (1 << 0)
2024#define OMAP4430_WKUPDEP_SLIMBUS2_IRQ_MPU_MASK BITFIELD(0, 0)
2025
2026/* Used by PM_L4PER_SLIMBUS2_WKDEP */
2027#define OMAP4430_WKUPDEP_SLIMBUS2_IRQ_TESLA_SHIFT (1 << 2)
2028#define OMAP4430_WKUPDEP_SLIMBUS2_IRQ_TESLA_MASK BITFIELD(2, 2)
2029
2030/* Used by PM_ALWON_SR_CORE_WKDEP */
2031#define OMAP4430_WKUPDEP_SR_CORE_DUCATI_SHIFT (1 << 1)
2032#define OMAP4430_WKUPDEP_SR_CORE_DUCATI_MASK BITFIELD(1, 1)
2033
2034/* Used by PM_ALWON_SR_CORE_WKDEP */
2035#define OMAP4430_WKUPDEP_SR_CORE_MPU_SHIFT (1 << 0)
2036#define OMAP4430_WKUPDEP_SR_CORE_MPU_MASK BITFIELD(0, 0)
2037
2038/* Used by PM_ALWON_SR_IVA_WKDEP */
2039#define OMAP4430_WKUPDEP_SR_IVA_DUCATI_SHIFT (1 << 1)
2040#define OMAP4430_WKUPDEP_SR_IVA_DUCATI_MASK BITFIELD(1, 1)
2041
2042/* Used by PM_ALWON_SR_IVA_WKDEP */
2043#define OMAP4430_WKUPDEP_SR_IVA_MPU_SHIFT (1 << 0)
2044#define OMAP4430_WKUPDEP_SR_IVA_MPU_MASK BITFIELD(0, 0)
2045
2046/* Used by PM_ALWON_SR_MPU_WKDEP */
2047#define OMAP4430_WKUPDEP_SR_MPU_MPU_SHIFT (1 << 0)
2048#define OMAP4430_WKUPDEP_SR_MPU_MPU_MASK BITFIELD(0, 0)
2049
2050/* Used by PM_WKUP_TIMER12_WKDEP */
2051#define OMAP4430_WKUPDEP_TIMER12_MPU_SHIFT (1 << 0)
2052#define OMAP4430_WKUPDEP_TIMER12_MPU_MASK BITFIELD(0, 0)
2053
2054/* Used by PM_WKUP_TIMER1_WKDEP */
2055#define OMAP4430_WKUPDEP_TIMER1_MPU_SHIFT (1 << 0)
2056#define OMAP4430_WKUPDEP_TIMER1_MPU_MASK BITFIELD(0, 0)
2057
2058/* Used by PM_ABE_TIMER5_WKDEP */
2059#define OMAP4430_WKUPDEP_TIMER5_MPU_SHIFT (1 << 0)
2060#define OMAP4430_WKUPDEP_TIMER5_MPU_MASK BITFIELD(0, 0)
2061
2062/* Used by PM_ABE_TIMER5_WKDEP */
2063#define OMAP4430_WKUPDEP_TIMER5_TESLA_SHIFT (1 << 2)
2064#define OMAP4430_WKUPDEP_TIMER5_TESLA_MASK BITFIELD(2, 2)
2065
2066/* Used by PM_ABE_TIMER6_WKDEP */
2067#define OMAP4430_WKUPDEP_TIMER6_MPU_SHIFT (1 << 0)
2068#define OMAP4430_WKUPDEP_TIMER6_MPU_MASK BITFIELD(0, 0)
2069
2070/* Used by PM_ABE_TIMER6_WKDEP */
2071#define OMAP4430_WKUPDEP_TIMER6_TESLA_SHIFT (1 << 2)
2072#define OMAP4430_WKUPDEP_TIMER6_TESLA_MASK BITFIELD(2, 2)
2073
2074/* Used by PM_ABE_TIMER7_WKDEP */
2075#define OMAP4430_WKUPDEP_TIMER7_MPU_SHIFT (1 << 0)
2076#define OMAP4430_WKUPDEP_TIMER7_MPU_MASK BITFIELD(0, 0)
2077
2078/* Used by PM_ABE_TIMER7_WKDEP */
2079#define OMAP4430_WKUPDEP_TIMER7_TESLA_SHIFT (1 << 2)
2080#define OMAP4430_WKUPDEP_TIMER7_TESLA_MASK BITFIELD(2, 2)
2081
2082/* Used by PM_ABE_TIMER8_WKDEP */
2083#define OMAP4430_WKUPDEP_TIMER8_MPU_SHIFT (1 << 0)
2084#define OMAP4430_WKUPDEP_TIMER8_MPU_MASK BITFIELD(0, 0)
2085
2086/* Used by PM_ABE_TIMER8_WKDEP */
2087#define OMAP4430_WKUPDEP_TIMER8_TESLA_SHIFT (1 << 2)
2088#define OMAP4430_WKUPDEP_TIMER8_TESLA_MASK BITFIELD(2, 2)
2089
2090/* Used by PM_L4PER_UART1_WKDEP */
2091#define OMAP4430_WKUPDEP_UART1_MPU_SHIFT (1 << 0)
2092#define OMAP4430_WKUPDEP_UART1_MPU_MASK BITFIELD(0, 0)
2093
2094/* Used by PM_L4PER_UART1_WKDEP */
2095#define OMAP4430_WKUPDEP_UART1_SDMA_SHIFT (1 << 3)
2096#define OMAP4430_WKUPDEP_UART1_SDMA_MASK BITFIELD(3, 3)
2097
2098/* Used by PM_L4PER_UART2_WKDEP */
2099#define OMAP4430_WKUPDEP_UART2_MPU_SHIFT (1 << 0)
2100#define OMAP4430_WKUPDEP_UART2_MPU_MASK BITFIELD(0, 0)
2101
2102/* Used by PM_L4PER_UART2_WKDEP */
2103#define OMAP4430_WKUPDEP_UART2_SDMA_SHIFT (1 << 3)
2104#define OMAP4430_WKUPDEP_UART2_SDMA_MASK BITFIELD(3, 3)
2105
2106/* Used by PM_L4PER_UART3_WKDEP */
2107#define OMAP4430_WKUPDEP_UART3_DUCATI_SHIFT (1 << 1)
2108#define OMAP4430_WKUPDEP_UART3_DUCATI_MASK BITFIELD(1, 1)
2109
2110/* Used by PM_L4PER_UART3_WKDEP */
2111#define OMAP4430_WKUPDEP_UART3_MPU_SHIFT (1 << 0)
2112#define OMAP4430_WKUPDEP_UART3_MPU_MASK BITFIELD(0, 0)
2113
2114/* Used by PM_L4PER_UART3_WKDEP */
2115#define OMAP4430_WKUPDEP_UART3_SDMA_SHIFT (1 << 3)
2116#define OMAP4430_WKUPDEP_UART3_SDMA_MASK BITFIELD(3, 3)
2117
2118/* Used by PM_L4PER_UART3_WKDEP */
2119#define OMAP4430_WKUPDEP_UART3_TESLA_SHIFT (1 << 2)
2120#define OMAP4430_WKUPDEP_UART3_TESLA_MASK BITFIELD(2, 2)
2121
2122/* Used by PM_L4PER_UART4_WKDEP */
2123#define OMAP4430_WKUPDEP_UART4_MPU_SHIFT (1 << 0)
2124#define OMAP4430_WKUPDEP_UART4_MPU_MASK BITFIELD(0, 0)
2125
2126/* Used by PM_L4PER_UART4_WKDEP */
2127#define OMAP4430_WKUPDEP_UART4_SDMA_SHIFT (1 << 3)
2128#define OMAP4430_WKUPDEP_UART4_SDMA_MASK BITFIELD(3, 3)
2129
2130/* Used by PM_L3INIT_UNIPRO1_WKDEP */
2131#define OMAP4430_WKUPDEP_UNIPRO1_DUCATI_SHIFT (1 << 1)
2132#define OMAP4430_WKUPDEP_UNIPRO1_DUCATI_MASK BITFIELD(1, 1)
2133
2134/* Used by PM_L3INIT_UNIPRO1_WKDEP */
2135#define OMAP4430_WKUPDEP_UNIPRO1_MPU_SHIFT (1 << 0)
2136#define OMAP4430_WKUPDEP_UNIPRO1_MPU_MASK BITFIELD(0, 0)
2137
2138/* Used by PM_L3INIT_USB_HOST_WKDEP */
2139#define OMAP4430_WKUPDEP_USB_HOST_DUCATI_SHIFT (1 << 1)
2140#define OMAP4430_WKUPDEP_USB_HOST_DUCATI_MASK BITFIELD(1, 1)
2141
2142/* Used by PM_L3INIT_USB_HOST_FS_WKDEP */
2143#define OMAP4430_WKUPDEP_USB_HOST_FS_DUCATI_SHIFT (1 << 1)
2144#define OMAP4430_WKUPDEP_USB_HOST_FS_DUCATI_MASK BITFIELD(1, 1)
2145
2146/* Used by PM_L3INIT_USB_HOST_FS_WKDEP */
2147#define OMAP4430_WKUPDEP_USB_HOST_FS_MPU_SHIFT (1 << 0)
2148#define OMAP4430_WKUPDEP_USB_HOST_FS_MPU_MASK BITFIELD(0, 0)
2149
2150/* Used by PM_L3INIT_USB_HOST_WKDEP */
2151#define OMAP4430_WKUPDEP_USB_HOST_MPU_SHIFT (1 << 0)
2152#define OMAP4430_WKUPDEP_USB_HOST_MPU_MASK BITFIELD(0, 0)
2153
2154/* Used by PM_L3INIT_USB_OTG_WKDEP */
2155#define OMAP4430_WKUPDEP_USB_OTG_DUCATI_SHIFT (1 << 1)
2156#define OMAP4430_WKUPDEP_USB_OTG_DUCATI_MASK BITFIELD(1, 1)
2157
2158/* Used by PM_L3INIT_USB_OTG_WKDEP */
2159#define OMAP4430_WKUPDEP_USB_OTG_MPU_SHIFT (1 << 0)
2160#define OMAP4430_WKUPDEP_USB_OTG_MPU_MASK BITFIELD(0, 0)
2161
2162/* Used by PM_L3INIT_USB_TLL_WKDEP */
2163#define OMAP4430_WKUPDEP_USB_TLL_DUCATI_SHIFT (1 << 1)
2164#define OMAP4430_WKUPDEP_USB_TLL_DUCATI_MASK BITFIELD(1, 1)
2165
2166/* Used by PM_L3INIT_USB_TLL_WKDEP */
2167#define OMAP4430_WKUPDEP_USB_TLL_MPU_SHIFT (1 << 0)
2168#define OMAP4430_WKUPDEP_USB_TLL_MPU_MASK BITFIELD(0, 0)
2169
2170/* Used by PM_WKUP_USIM_WKDEP */
2171#define OMAP4430_WKUPDEP_USIM_MPU_SHIFT (1 << 0)
2172#define OMAP4430_WKUPDEP_USIM_MPU_MASK BITFIELD(0, 0)
2173
2174/* Used by PM_WKUP_USIM_WKDEP */
2175#define OMAP4430_WKUPDEP_USIM_SDMA_SHIFT (1 << 3)
2176#define OMAP4430_WKUPDEP_USIM_SDMA_MASK BITFIELD(3, 3)
2177
2178/* Used by PM_WKUP_WDT2_WKDEP */
2179#define OMAP4430_WKUPDEP_WDT2_DUCATI_SHIFT (1 << 1)
2180#define OMAP4430_WKUPDEP_WDT2_DUCATI_MASK BITFIELD(1, 1)
2181
2182/* Used by PM_WKUP_WDT2_WKDEP */
2183#define OMAP4430_WKUPDEP_WDT2_MPU_SHIFT (1 << 0)
2184#define OMAP4430_WKUPDEP_WDT2_MPU_MASK BITFIELD(0, 0)
2185
2186/* Used by PM_ABE_WDT3_WKDEP */
2187#define OMAP4430_WKUPDEP_WDT3_MPU_SHIFT (1 << 0)
2188#define OMAP4430_WKUPDEP_WDT3_MPU_MASK BITFIELD(0, 0)
2189
2190/* Used by PM_L3INIT_HSI_WKDEP */
2191#define OMAP4430_WKUPDEP_WGM_HSI_WAKE_MPU_SHIFT (1 << 8)
2192#define OMAP4430_WKUPDEP_WGM_HSI_WAKE_MPU_MASK BITFIELD(8, 8)
2193
2194/* Used by PM_L3INIT_XHPI_WKDEP */
2195#define OMAP4430_WKUPDEP_XHPI_DUCATI_SHIFT (1 << 1)
2196#define OMAP4430_WKUPDEP_XHPI_DUCATI_MASK BITFIELD(1, 1)
2197
2198/* Used by PRM_IO_PMCTRL */
2199#define OMAP4430_WUCLK_CTRL_SHIFT (1 << 8)
2200#define OMAP4430_WUCLK_CTRL_MASK BITFIELD(8, 8)
2201
2202/* Used by PRM_IO_PMCTRL */
2203#define OMAP4430_WUCLK_STATUS_SHIFT (1 << 9)
2204#define OMAP4430_WUCLK_STATUS_MASK BITFIELD(9, 9)
2205#endif
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index a117f853ea39..ea050ce188a7 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -4,8 +4,8 @@
4/* 4/*
5 * OMAP2/3 Power/Reset Management (PRM) register definitions 5 * OMAP2/3 Power/Reset Management (PRM) register definitions
6 * 6 *
7 * Copyright (C) 2007 Texas Instruments, Inc. 7 * Copyright (C) 2007-2009 Texas Instruments, Inc.
8 * Copyright (C) 2007 Nokia Corporation 8 * Copyright (C) 2009 Nokia Corporation
9 * 9 *
10 * Written by Paul Walmsley 10 * Written by Paul Walmsley
11 * 11 *
@@ -22,6 +22,10 @@
22 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg)) 22 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
23#define OMAP34XX_PRM_REGADDR(module, reg) \ 23#define OMAP34XX_PRM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg)) 24 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
25#define OMAP44XX_PRM_REGADDR(module, reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE + (module) + (reg))
27
28#include "prm44xx.h"
25 29
26/* 30/*
27 * Architecture-specific global PRM registers 31 * Architecture-specific global PRM registers
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
new file mode 100644
index 000000000000..89be97f0589d
--- /dev/null
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -0,0 +1,411 @@
1/*
2 * OMAP44xx PRM instance offset macros
3 *
4 * Copyright (C) 2009 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#ifndef __ARCH_ARM_MACH_OMAP2_PRM44XX_H
23#define __ARCH_ARM_MACH_OMAP2_PRM44XX_H
24
25
26/* PRM */
27
28
29/* PRM.OCP_SOCKET_PRM register offsets */
30#define OMAP4430_REVISION_PRM OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0000)
31#define OMAP4430_PRM_IRQSTATUS_MPU OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0010)
32#define OMAP4430_PRM_IRQSTATUS_MPU_2 OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0014)
33#define OMAP4430_PRM_IRQENABLE_MPU OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0018)
34#define OMAP4430_PRM_IRQENABLE_MPU_2 OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x001c)
35#define OMAP4430_PRM_IRQSTATUS_DUCATI OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0020)
36#define OMAP4430_PRM_IRQENABLE_DUCATI OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0028)
37#define OMAP4430_PRM_IRQSTATUS_TESLA OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0030)
38#define OMAP4430_PRM_IRQENABLE_TESLA OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0038)
39#define OMAP4430_PRM_PRM_PROFILING_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_OCP_SOCKET_MOD, 0x0040)
40
41/* PRM.CKGEN_PRM register offsets */
42#define OMAP4430_CM_ABE_DSS_SYS_CLKSEL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CKGEN_MOD, 0x0000)
43#define OMAP4430_CM_DPLL_SYS_REF_CLKSEL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CKGEN_MOD, 0x0004)
44#define OMAP4430_CM_L4_WKUP_CLKSEL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CKGEN_MOD, 0x0008)
45#define OMAP4430_CM_ABE_PLL_REF_CLKSEL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CKGEN_MOD, 0x000c)
46#define OMAP4430_CM_SYS_CLKSEL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CKGEN_MOD, 0x0010)
47
48/* PRM.MPU_PRM register offsets */
49#define OMAP4430_PM_MPU_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_MPU_MOD, 0x0000)
50#define OMAP4430_PM_MPU_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_MPU_MOD, 0x0004)
51#define OMAP4430_RM_MPU_RSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_MPU_MOD, 0x0014)
52#define OMAP4430_RM_MPU_MPU_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_MPU_MOD, 0x0024)
53
54/* PRM.TESLA_PRM register offsets */
55#define OMAP4430_PM_TESLA_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_TESLA_MOD, 0x0000)
56#define OMAP4430_PM_TESLA_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_TESLA_MOD, 0x0004)
57#define OMAP4430_RM_TESLA_RSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_TESLA_MOD, 0x0010)
58#define OMAP4430_RM_TESLA_RSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_TESLA_MOD, 0x0014)
59#define OMAP4430_RM_TESLA_TESLA_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_TESLA_MOD, 0x0024)
60
61/* PRM.ABE_PRM register offsets */
62#define OMAP4430_PM_ABE_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0000)
63#define OMAP4430_PM_ABE_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0004)
64#define OMAP4430_RM_ABE_AESS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x002c)
65#define OMAP4430_PM_ABE_PDM_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0030)
66#define OMAP4430_RM_ABE_PDM_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0034)
67#define OMAP4430_PM_ABE_DMIC_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0038)
68#define OMAP4430_RM_ABE_DMIC_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x003c)
69#define OMAP4430_PM_ABE_MCASP_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0040)
70#define OMAP4430_RM_ABE_MCASP_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0044)
71#define OMAP4430_PM_ABE_MCBSP1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0048)
72#define OMAP4430_RM_ABE_MCBSP1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x004c)
73#define OMAP4430_PM_ABE_MCBSP2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0050)
74#define OMAP4430_RM_ABE_MCBSP2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0054)
75#define OMAP4430_PM_ABE_MCBSP3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0058)
76#define OMAP4430_RM_ABE_MCBSP3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x005c)
77#define OMAP4430_PM_ABE_SLIMBUS_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0060)
78#define OMAP4430_RM_ABE_SLIMBUS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0064)
79#define OMAP4430_PM_ABE_TIMER5_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0068)
80#define OMAP4430_RM_ABE_TIMER5_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x006c)
81#define OMAP4430_PM_ABE_TIMER6_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0070)
82#define OMAP4430_RM_ABE_TIMER6_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0074)
83#define OMAP4430_PM_ABE_TIMER7_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0078)
84#define OMAP4430_RM_ABE_TIMER7_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x007c)
85#define OMAP4430_PM_ABE_TIMER8_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0080)
86#define OMAP4430_RM_ABE_TIMER8_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0084)
87#define OMAP4430_PM_ABE_WDT3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x0088)
88#define OMAP4430_RM_ABE_WDT3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ABE_MOD, 0x008c)
89
90/* PRM.ALWAYS_ON_PRM register offsets */
91#define OMAP4430_RM_ALWON_MDMINTC_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ALWAYS_ON_MOD, 0x0024)
92#define OMAP4430_PM_ALWON_SR_MPU_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ALWAYS_ON_MOD, 0x0028)
93#define OMAP4430_RM_ALWON_SR_MPU_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ALWAYS_ON_MOD, 0x002c)
94#define OMAP4430_PM_ALWON_SR_IVA_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ALWAYS_ON_MOD, 0x0030)
95#define OMAP4430_RM_ALWON_SR_IVA_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ALWAYS_ON_MOD, 0x0034)
96#define OMAP4430_PM_ALWON_SR_CORE_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ALWAYS_ON_MOD, 0x0038)
97#define OMAP4430_RM_ALWON_SR_CORE_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_ALWAYS_ON_MOD, 0x003c)
98
99/* PRM.CORE_PRM register offsets */
100#define OMAP4430_PM_CORE_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0000)
101#define OMAP4430_PM_CORE_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0004)
102#define OMAP4430_RM_L3_1_L3_1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0024)
103#define OMAP4430_RM_L3_2_L3_2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0124)
104#define OMAP4430_RM_L3_2_GPMC_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x012c)
105#define OMAP4430_RM_L3_2_OCMC_RAM_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0134)
106#define OMAP4430_RM_DUCATI_RSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0210)
107#define OMAP4430_RM_DUCATI_RSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0214)
108#define OMAP4430_RM_DUCATI_DUCATI_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0224)
109#define OMAP4430_RM_SDMA_SDMA_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0324)
110#define OMAP4430_RM_MEMIF_DMM_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0424)
111#define OMAP4430_RM_MEMIF_EMIF_FW_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x042c)
112#define OMAP4430_RM_MEMIF_EMIF_1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0434)
113#define OMAP4430_RM_MEMIF_EMIF_2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x043c)
114#define OMAP4430_RM_MEMIF_DLL_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0444)
115#define OMAP4430_RM_MEMIF_EMIF_H1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0454)
116#define OMAP4430_RM_MEMIF_EMIF_H2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x045c)
117#define OMAP4430_RM_MEMIF_DLL_H_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0464)
118#define OMAP4430_RM_D2D_SAD2D_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0524)
119#define OMAP4430_RM_D2D_MODEM_ICR_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x052c)
120#define OMAP4430_RM_D2D_SAD2D_FW_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0534)
121#define OMAP4430_RM_L4CFG_L4_CFG_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0624)
122#define OMAP4430_RM_L4CFG_HW_SEM_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x062c)
123#define OMAP4430_RM_L4CFG_MAILBOX_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0634)
124#define OMAP4430_RM_L4CFG_SAR_ROM_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x063c)
125#define OMAP4430_RM_L3INSTR_L3_3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0724)
126#define OMAP4430_RM_L3INSTR_L3_INSTR_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x072c)
127#define OMAP4430_RM_L3INSTR_OCP_WP1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CORE_MOD, 0x0744)
128
129/* PRM.IVAHD_PRM register offsets */
130#define OMAP4430_PM_IVAHD_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_IVAHD_MOD, 0x0000)
131#define OMAP4430_PM_IVAHD_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_IVAHD_MOD, 0x0004)
132#define OMAP4430_RM_IVAHD_RSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_IVAHD_MOD, 0x0010)
133#define OMAP4430_RM_IVAHD_RSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_IVAHD_MOD, 0x0014)
134#define OMAP4430_RM_IVAHD_IVAHD_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_IVAHD_MOD, 0x0024)
135#define OMAP4430_RM_IVAHD_SL2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_IVAHD_MOD, 0x002c)
136
137/* PRM.CAM_PRM register offsets */
138#define OMAP4430_PM_CAM_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CAM_MOD, 0x0000)
139#define OMAP4430_PM_CAM_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CAM_MOD, 0x0004)
140#define OMAP4430_RM_CAM_ISS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CAM_MOD, 0x0024)
141#define OMAP4430_RM_CAM_FDIF_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CAM_MOD, 0x002c)
142
143/* PRM.DSS_PRM register offsets */
144#define OMAP4430_PM_DSS_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DSS_MOD, 0x0000)
145#define OMAP4430_PM_DSS_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DSS_MOD, 0x0004)
146#define OMAP4430_PM_DSS_DSS_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DSS_MOD, 0x0020)
147#define OMAP4430_RM_DSS_DSS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DSS_MOD, 0x0024)
148#define OMAP4430_RM_DSS_DEISS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DSS_MOD, 0x002c)
149
150/* PRM.GFX_PRM register offsets */
151#define OMAP4430_PM_GFX_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_GFX_MOD, 0x0000)
152#define OMAP4430_PM_GFX_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_GFX_MOD, 0x0004)
153#define OMAP4430_RM_GFX_GFX_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_GFX_MOD, 0x0024)
154
155/* PRM.L3INIT_PRM register offsets */
156#define OMAP4430_PM_L3INIT_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0000)
157#define OMAP4430_PM_L3INIT_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0004)
158#define OMAP4430_PM_L3INIT_MMC1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0028)
159#define OMAP4430_RM_L3INIT_MMC1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x002c)
160#define OMAP4430_PM_L3INIT_MMC2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0030)
161#define OMAP4430_RM_L3INIT_MMC2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0034)
162#define OMAP4430_PM_L3INIT_HSI_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0038)
163#define OMAP4430_RM_L3INIT_HSI_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x003c)
164#define OMAP4430_PM_L3INIT_UNIPRO1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0040)
165#define OMAP4430_RM_L3INIT_UNIPRO1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0044)
166#define OMAP4430_PM_L3INIT_USB_HOST_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0058)
167#define OMAP4430_RM_L3INIT_USB_HOST_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x005c)
168#define OMAP4430_PM_L3INIT_USB_OTG_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0060)
169#define OMAP4430_RM_L3INIT_USB_OTG_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0064)
170#define OMAP4430_PM_L3INIT_USB_TLL_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0068)
171#define OMAP4430_RM_L3INIT_USB_TLL_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x006c)
172#define OMAP4430_RM_L3INIT_P1500_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x007c)
173#define OMAP4430_RM_L3INIT_EMAC_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0084)
174#define OMAP4430_PM_L3INIT_SATA_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0088)
175#define OMAP4430_RM_L3INIT_SATA_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x008c)
176#define OMAP4430_RM_L3INIT_TPPSS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0094)
177#define OMAP4430_PM_L3INIT_PCIESS_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x0098)
178#define OMAP4430_RM_L3INIT_PCIESS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x009c)
179#define OMAP4430_RM_L3INIT_CCPTX_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x00ac)
180#define OMAP4430_PM_L3INIT_XHPI_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x00c0)
181#define OMAP4430_RM_L3INIT_XHPI_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x00c4)
182#define OMAP4430_PM_L3INIT_MMC6_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x00c8)
183#define OMAP4430_RM_L3INIT_MMC6_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x00cc)
184#define OMAP4430_PM_L3INIT_USB_HOST_FS_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x00d0)
185#define OMAP4430_RM_L3INIT_USB_HOST_FS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x00d4)
186#define OMAP4430_RM_L3INIT_USBPHYOCP2SCP_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L3INIT_MOD, 0x00e4)
187
188/* PRM.L4PER_PRM register offsets */
189#define OMAP4430_PM_L4PER_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0000)
190#define OMAP4430_PM_L4PER_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0004)
191#define OMAP4430_RM_L4PER_ADC_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0024)
192#define OMAP4430_PM_L4PER_DMTIMER10_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0028)
193#define OMAP4430_RM_L4PER_DMTIMER10_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x002c)
194#define OMAP4430_PM_L4PER_DMTIMER11_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0030)
195#define OMAP4430_RM_L4PER_DMTIMER11_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0034)
196#define OMAP4430_PM_L4PER_DMTIMER2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0038)
197#define OMAP4430_RM_L4PER_DMTIMER2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x003c)
198#define OMAP4430_PM_L4PER_DMTIMER3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0040)
199#define OMAP4430_RM_L4PER_DMTIMER3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0044)
200#define OMAP4430_PM_L4PER_DMTIMER4_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0048)
201#define OMAP4430_RM_L4PER_DMTIMER4_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x004c)
202#define OMAP4430_PM_L4PER_DMTIMER9_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0050)
203#define OMAP4430_RM_L4PER_DMTIMER9_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0054)
204#define OMAP4430_RM_L4PER_ELM_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x005c)
205#define OMAP4430_PM_L4PER_GPIO2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0060)
206#define OMAP4430_RM_L4PER_GPIO2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0064)
207#define OMAP4430_PM_L4PER_GPIO3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0068)
208#define OMAP4430_RM_L4PER_GPIO3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x006c)
209#define OMAP4430_PM_L4PER_GPIO4_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0070)
210#define OMAP4430_RM_L4PER_GPIO4_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0074)
211#define OMAP4430_PM_L4PER_GPIO5_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0078)
212#define OMAP4430_RM_L4PER_GPIO5_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x007c)
213#define OMAP4430_PM_L4PER_GPIO6_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0080)
214#define OMAP4430_RM_L4PER_GPIO6_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0084)
215#define OMAP4430_RM_L4PER_HDQ1W_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x008c)
216#define OMAP4430_PM_L4PER_HECC1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0090)
217#define OMAP4430_RM_L4PER_HECC1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0094)
218#define OMAP4430_PM_L4PER_HECC2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0098)
219#define OMAP4430_RM_L4PER_HECC2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x009c)
220#define OMAP4430_PM_L4PER_I2C1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00a0)
221#define OMAP4430_RM_L4PER_I2C1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00a4)
222#define OMAP4430_PM_L4PER_I2C2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00a8)
223#define OMAP4430_RM_L4PER_I2C2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00ac)
224#define OMAP4430_PM_L4PER_I2C3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00b0)
225#define OMAP4430_RM_L4PER_I2C3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00b4)
226#define OMAP4430_PM_L4PER_I2C4_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00b8)
227#define OMAP4430_RM_L4PER_I2C4_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00bc)
228#define OMAP4430_RM_L4PER_L4_PER_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00c0)
229#define OMAP4430_PM_L4PER_MCASP2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00d0)
230#define OMAP4430_RM_L4PER_MCASP2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00d4)
231#define OMAP4430_PM_L4PER_MCASP3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00d8)
232#define OMAP4430_RM_L4PER_MCASP3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00dc)
233#define OMAP4430_PM_L4PER_MCBSP4_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00e0)
234#define OMAP4430_RM_L4PER_MCBSP4_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00e4)
235#define OMAP4430_RM_L4PER_MGATE_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00ec)
236#define OMAP4430_PM_L4PER_MCSPI1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00f0)
237#define OMAP4430_RM_L4PER_MCSPI1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00f4)
238#define OMAP4430_PM_L4PER_MCSPI2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00f8)
239#define OMAP4430_RM_L4PER_MCSPI2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x00fc)
240#define OMAP4430_PM_L4PER_MCSPI3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0100)
241#define OMAP4430_RM_L4PER_MCSPI3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0104)
242#define OMAP4430_PM_L4PER_MCSPI4_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0108)
243#define OMAP4430_RM_L4PER_MCSPI4_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x010c)
244#define OMAP4430_PM_L4PER_MMCSD3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0120)
245#define OMAP4430_RM_L4PER_MMCSD3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0124)
246#define OMAP4430_PM_L4PER_MMCSD4_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0128)
247#define OMAP4430_RM_L4PER_MMCSD4_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x012c)
248#define OMAP4430_RM_L4PER_MSPROHG_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0134)
249#define OMAP4430_PM_L4PER_SLIMBUS2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0138)
250#define OMAP4430_RM_L4PER_SLIMBUS2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x013c)
251#define OMAP4430_PM_L4PER_UART1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0140)
252#define OMAP4430_RM_L4PER_UART1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0144)
253#define OMAP4430_PM_L4PER_UART2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0148)
254#define OMAP4430_RM_L4PER_UART2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x014c)
255#define OMAP4430_PM_L4PER_UART3_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0150)
256#define OMAP4430_RM_L4PER_UART3_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0154)
257#define OMAP4430_PM_L4PER_UART4_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0158)
258#define OMAP4430_RM_L4PER_UART4_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x015c)
259#define OMAP4430_PM_L4PER_MMCSD5_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0160)
260#define OMAP4430_RM_L4PER_MMCSD5_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0164)
261#define OMAP4430_PM_L4PER_I2C5_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x0168)
262#define OMAP4430_RM_L4PER_I2C5_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x016c)
263#define OMAP4430_RM_L4SEC_AES1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x01a4)
264#define OMAP4430_RM_L4SEC_AES2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x01ac)
265#define OMAP4430_RM_L4SEC_DES3DES_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x01b4)
266#define OMAP4430_RM_L4SEC_PKAEIP29_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x01bc)
267#define OMAP4430_RM_L4SEC_RNG_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x01c4)
268#define OMAP4430_RM_L4SEC_SHA2MD51_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x01cc)
269#define OMAP4430_RM_L4SEC_CRYPTODMA_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_L4PER_MOD, 0x01dc)
270
271/* PRM.CEFUSE_PRM register offsets */
272#define OMAP4430_PM_CEFUSE_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CEFUSE_MOD, 0x0000)
273#define OMAP4430_PM_CEFUSE_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CEFUSE_MOD, 0x0004)
274#define OMAP4430_RM_CEFUSE_CEFUSE_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_CEFUSE_MOD, 0x0024)
275
276/* PRM.WKUP_PRM register offsets */
277#define OMAP4430_RM_WKUP_L4WKUP_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0024)
278#define OMAP4430_RM_WKUP_WDT1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x002c)
279#define OMAP4430_PM_WKUP_WDT2_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0030)
280#define OMAP4430_RM_WKUP_WDT2_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0034)
281#define OMAP4430_PM_WKUP_GPIO1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0038)
282#define OMAP4430_RM_WKUP_GPIO1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x003c)
283#define OMAP4430_PM_WKUP_TIMER1_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0040)
284#define OMAP4430_RM_WKUP_TIMER1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0044)
285#define OMAP4430_PM_WKUP_TIMER12_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0048)
286#define OMAP4430_RM_WKUP_TIMER12_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x004c)
287#define OMAP4430_RM_WKUP_SYNCTIMER_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0054)
288#define OMAP4430_PM_WKUP_USIM_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0058)
289#define OMAP4430_RM_WKUP_USIM_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x005c)
290#define OMAP4430_RM_WKUP_SARRAM_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0064)
291#define OMAP4430_PM_WKUP_KEYBOARD_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0078)
292#define OMAP4430_RM_WKUP_KEYBOARD_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x007c)
293#define OMAP4430_PM_WKUP_RTC_WKDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0080)
294#define OMAP4430_RM_WKUP_RTC_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_MOD, 0x0084)
295
296/* PRM.WKUP_CM register offsets */
297#define OMAP4430_CM_WKUP_CLKSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0000)
298#define OMAP4430_CM_WKUP_L4WKUP_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0020)
299#define OMAP4430_CM_WKUP_WDT1_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0028)
300#define OMAP4430_CM_WKUP_WDT2_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0030)
301#define OMAP4430_CM_WKUP_GPIO1_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0038)
302#define OMAP4430_CM_WKUP_TIMER1_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0040)
303#define OMAP4430_CM_WKUP_TIMER12_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0048)
304#define OMAP4430_CM_WKUP_SYNCTIMER_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0050)
305#define OMAP4430_CM_WKUP_USIM_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0058)
306#define OMAP4430_CM_WKUP_SARRAM_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0060)
307#define OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0078)
308#define OMAP4430_CM_WKUP_RTC_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0080)
309#define OMAP4430_CM_WKUP_BANDGAP_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_WKUP_CM_MOD, 0x0088)
310
311/* PRM.EMU_PRM register offsets */
312#define OMAP4430_PM_EMU_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_EMU_MOD, 0x0000)
313#define OMAP4430_PM_EMU_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_EMU_MOD, 0x0004)
314#define OMAP4430_RM_EMU_DEBUGSS_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_EMU_MOD, 0x0024)
315
316/* PRM.EMU_CM register offsets */
317#define OMAP4430_CM_EMU_CLKSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_EMU_CM_MOD, 0x0000)
318#define OMAP4430_CM_EMU_DYNAMICDEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_EMU_CM_MOD, 0x0008)
319#define OMAP4430_CM_EMU_DEBUGSS_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_EMU_CM_MOD, 0x0020)
320
321/* PRM.DEVICE_PRM register offsets */
322#define OMAP4430_PRM_RSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0000)
323#define OMAP4430_PRM_RSTST OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0004)
324#define OMAP4430_PRM_RSTTIME OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0008)
325#define OMAP4430_PRM_CLKREQCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x000c)
326#define OMAP4430_PRM_VOLTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0010)
327#define OMAP4430_PRM_PWRREQCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0014)
328#define OMAP4430_PRM_PSCON_COUNT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0018)
329#define OMAP4430_PRM_IO_COUNT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x001c)
330#define OMAP4430_PRM_IO_PMCTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0020)
331#define OMAP4430_PRM_VOLTSETUP_WARMRESET OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0024)
332#define OMAP4430_PRM_VOLTSETUP_CORE_OFF OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0028)
333#define OMAP4430_PRM_VOLTSETUP_MPU_OFF OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x002c)
334#define OMAP4430_PRM_VOLTSETUP_IVA_OFF OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0030)
335#define OMAP4430_PRM_VOLTSETUP_CORE_RET_SLEEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0034)
336#define OMAP4430_PRM_VOLTSETUP_MPU_RET_SLEEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0038)
337#define OMAP4430_PRM_VOLTSETUP_IVA_RET_SLEEP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x003c)
338#define OMAP4430_PRM_VP_CORE_CONFIG OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0040)
339#define OMAP4430_PRM_VP_CORE_STATUS OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0044)
340#define OMAP4430_PRM_VP_CORE_VLIMITTO OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0048)
341#define OMAP4430_PRM_VP_CORE_VOLTAGE OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x004c)
342#define OMAP4430_PRM_VP_CORE_VSTEPMAX OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0050)
343#define OMAP4430_PRM_VP_CORE_VSTEPMIN OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0054)
344#define OMAP4430_PRM_VP_MPU_CONFIG OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0058)
345#define OMAP4430_PRM_VP_MPU_STATUS OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x005c)
346#define OMAP4430_PRM_VP_MPU_VLIMITTO OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0060)
347#define OMAP4430_PRM_VP_MPU_VOLTAGE OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0064)
348#define OMAP4430_PRM_VP_MPU_VSTEPMAX OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0068)
349#define OMAP4430_PRM_VP_MPU_VSTEPMIN OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x006c)
350#define OMAP4430_PRM_VP_IVA_CONFIG OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0070)
351#define OMAP4430_PRM_VP_IVA_STATUS OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0074)
352#define OMAP4430_PRM_VP_IVA_VLIMITTO OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0078)
353#define OMAP4430_PRM_VP_IVA_VOLTAGE OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x007c)
354#define OMAP4430_PRM_VP_IVA_VSTEPMAX OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0080)
355#define OMAP4430_PRM_VP_IVA_VSTEPMIN OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0084)
356#define OMAP4430_PRM_VC_SMPS_SA OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0088)
357#define OMAP4430_PRM_VC_VAL_SMPS_RA_VOL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x008c)
358#define OMAP4430_PRM_VC_VAL_SMPS_RA_CMD OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0090)
359#define OMAP4430_PRM_VC_VAL_CMD_VDD_CORE_L OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0094)
360#define OMAP4430_PRM_VC_VAL_CMD_VDD_MPU_L OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x0098)
361#define OMAP4430_PRM_VC_VAL_CMD_VDD_IVA_L OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x009c)
362#define OMAP4430_PRM_VC_VAL_BYPASS OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00a0)
363#define OMAP4430_PRM_VC_CFG_CHANNEL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00a4)
364#define OMAP4430_PRM_VC_CFG_I2C_MODE OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00a8)
365#define OMAP4430_PRM_VC_CFG_I2C_CLK OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00ac)
366#define OMAP4430_PRM_SRAM_COUNT OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00b0)
367#define OMAP4430_PRM_SRAM_WKUP_SETUP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00b4)
368#define OMAP4430_PRM_LDO_SRAM_CORE_SETUP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00b8)
369#define OMAP4430_PRM_LDO_SRAM_CORE_CTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00bc)
370#define OMAP4430_PRM_LDO_SRAM_MPU_SETUP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00c0)
371#define OMAP4430_PRM_LDO_SRAM_MPU_CTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00c4)
372#define OMAP4430_PRM_LDO_SRAM_IVA_SETUP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00c8)
373#define OMAP4430_PRM_LDO_SRAM_IVA_CTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00cc)
374#define OMAP4430_PRM_LDO_ABB_MPU_SETUP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00d0)
375#define OMAP4430_PRM_LDO_ABB_MPU_CTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00d4)
376#define OMAP4430_PRM_LDO_ABB_IVA_SETUP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00d8)
377#define OMAP4430_PRM_LDO_ABB_IVA_CTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00dc)
378#define OMAP4430_PRM_LDO_BANDGAP_CTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00e0)
379#define OMAP4430_PRM_DEVICE_OFF_CTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00e4)
380#define OMAP4430_PRM_PHASE1_CNDP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00e8)
381#define OMAP4430_PRM_PHASE2A_CNDP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00ec)
382#define OMAP4430_PRM_PHASE2B_CNDP OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00f0)
383#define OMAP4430_PRM_MODEM_IF_CTRL OMAP44XX_PRM_REGADDR(OMAP4430_PRM_DEVICE_MOD, 0x00f4)
384
385/* CHIRON_PRCM */
386
387
388/* CHIRON_PRCM.CHIRONSS_OCP_SOCKET_PRCM register offsets */
389#define OMAP4430_REVISION_PRCM OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_OCP_SOCKET_PRCM_MOD, 0x0000)
390
391/* CHIRON_PRCM.CHIRONSS_DEVICE_PRM register offsets */
392#define OMAP4430_CHIRON_PRCM_PRM_RSTST OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_DEVICE_PRM_MOD, 0x0000)
393
394/* CHIRON_PRCM.CHIRONSS_CPU0 register offsets */
395#define OMAP4430_PM_PDA_CPU0_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0000)
396#define OMAP4430_PM_PDA_CPU0_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0004)
397#define OMAP4430_RM_PDA_CPU0_CPU0_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0008)
398#define OMAP4430_RM_PDA_CPU0_CPU0_RSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x000c)
399#define OMAP4430_RM_PDA_CPU0_CPU0_RSTST OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0010)
400#define OMAP4430_CM_PDA_CPU0_CPU0_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0014)
401#define OMAP4430_CM_PDA_CPU0_CLKSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU0_MOD, 0x0018)
402
403/* CHIRON_PRCM.CHIRONSS_CPU1 register offsets */
404#define OMAP4430_PM_PDA_CPU1_PWRSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0000)
405#define OMAP4430_PM_PDA_CPU1_PWRSTST OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0004)
406#define OMAP4430_RM_PDA_CPU1_CPU1_CONTEXT OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0008)
407#define OMAP4430_RM_PDA_CPU1_CPU1_RSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x000c)
408#define OMAP4430_RM_PDA_CPU1_CPU1_RSTST OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0010)
409#define OMAP4430_CM_PDA_CPU1_CPU1_CLKCTRL OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0014)
410#define OMAP4430_CM_PDA_CPU1_CLKSTCTRL OMAP44XX_PRM_REGADDR(OMAP4430_CHIRONSS_CHIRONSS_CPU1_MOD, 0x0018)
411#endif
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index 9a592199321c..cbfbd142e946 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -160,3 +160,19 @@ void __init omap2_sdrc_init(struct omap_sdrc_params *sdrc_cs0,
160 sdrc_write_reg(l, SDRC_POWER); 160 sdrc_write_reg(l, SDRC_POWER);
161 omap2_sms_save_context(); 161 omap2_sms_save_context();
162} 162}
163
164void omap2_sms_write_rot_control(u32 val, unsigned ctx)
165{
166 sms_write_reg(val, SMS_ROT_CONTROL(ctx));
167}
168
169void omap2_sms_write_rot_size(u32 val, unsigned ctx)
170{
171 sms_write_reg(val, SMS_ROT_SIZE(ctx));
172}
173
174void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx)
175{
176 sms_write_reg(val, SMS_ROT_PHYSICAL_BA(ctx));
177}
178
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index 48207b018989..68f57bb67fc5 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -18,6 +18,9 @@
18#include <plat/sdrc.h> 18#include <plat/sdrc.h>
19 19
20#ifndef __ASSEMBLER__ 20#ifndef __ASSEMBLER__
21
22#include <linux/io.h>
23
21extern void __iomem *omap2_sdrc_base; 24extern void __iomem *omap2_sdrc_base;
22extern void __iomem *omap2_sms_base; 25extern void __iomem *omap2_sms_base;
23 26
@@ -56,4 +59,20 @@ static inline u32 sms_read_reg(u16 reg)
56 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg)) 59 OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
57#endif /* __ASSEMBLER__ */ 60#endif /* __ASSEMBLER__ */
58 61
62/* Minimum frequency that the SDRC DLL can lock at */
63#define MIN_SDRC_DLL_LOCK_FREQ 83000000
64
65/* Scale factor for fixed-point arith in omap3_core_dpll_m2_set_rate() */
66#define SDRC_MPURATE_SCALE 8
67
68/* 2^SDRC_MPURATE_BASE_SHIFT: MPU MHz that SDRC_MPURATE_LOOPS is defined for */
69#define SDRC_MPURATE_BASE_SHIFT 9
70
71/*
72 * SDRC_MPURATE_LOOPS: Number of MPU loops to execute at
73 * 2^MPURATE_BASE_SHIFT MHz for SDRC to stabilize
74 */
75#define SDRC_MPURATE_LOOPS 96
76
77
59#endif 78#endif
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index 2e17b57f5b23..39b797bc14d6 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -33,6 +33,7 @@
33#include "pm.h" 33#include "pm.h"
34#include "prm-regbits-34xx.h" 34#include "prm-regbits-34xx.h"
35 35
36#define UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV 0x52
36#define UART_OMAP_WER 0x17 /* Wake-up enable register */ 37#define UART_OMAP_WER 0x17 /* Wake-up enable register */
37 38
38#define DEFAULT_TIMEOUT (5 * HZ) 39#define DEFAULT_TIMEOUT (5 * HZ)
@@ -572,6 +573,23 @@ static struct omap_uart_state omap_uart[] = {
572#endif 573#endif
573}; 574};
574 575
576/*
577 * Override the default 8250 read handler: mem_serial_in()
578 * Empty RX fifo read causes an abort on omap3630 and omap4
579 * This function makes sure that an empty rx fifo is not read on these silicons
580 * (OMAP1/2/3430 are not affected)
581 */
582static unsigned int serial_in_override(struct uart_port *up, int offset)
583{
584 if (UART_RX == offset) {
585 unsigned int lsr;
586 lsr = serial_read_reg(omap_uart[up->line].p, UART_LSR);
587 if (!(lsr & UART_LSR_DR))
588 return -EPERM;
589 }
590 return serial_read_reg(omap_uart[up->line].p, offset);
591}
592
575void __init omap_serial_early_init(void) 593void __init omap_serial_early_init(void)
576{ 594{
577 int i; 595 int i;
@@ -631,24 +649,64 @@ void __init omap_serial_early_init(void)
631 } 649 }
632} 650}
633 651
634void __init omap_serial_init(void) 652/**
653 * omap_serial_init_port() - initialize single serial port
654 * @port: serial port number (0-3)
655 *
656 * This function initialies serial driver for given @port only.
657 * Platforms can call this function instead of omap_serial_init()
658 * if they don't plan to use all available UARTs as serial ports.
659 *
660 * Don't mix calls to omap_serial_init_port() and omap_serial_init(),
661 * use only one of the two.
662 */
663void __init omap_serial_init_port(int port)
635{ 664{
636 int i; 665 struct omap_uart_state *uart;
666 struct platform_device *pdev;
667 struct device *dev;
637 668
638 for (i = 0; i < ARRAY_SIZE(omap_uart); i++) { 669 BUG_ON(port < 0);
639 struct omap_uart_state *uart = &omap_uart[i]; 670 BUG_ON(port >= ARRAY_SIZE(omap_uart));
640 struct platform_device *pdev = &uart->pdev;
641 struct device *dev = &pdev->dev;
642 671
643 omap_uart_reset(uart); 672 uart = &omap_uart[port];
644 omap_uart_idle_init(uart); 673 pdev = &uart->pdev;
674 dev = &pdev->dev;
645 675
646 if (WARN_ON(platform_device_register(pdev))) 676 omap_uart_reset(uart);
647 continue; 677 omap_uart_idle_init(uart);
648 if ((cpu_is_omap34xx() && uart->padconf) || 678
649 (uart->wk_en && uart->wk_mask)) { 679 if (WARN_ON(platform_device_register(pdev)))
650 device_init_wakeup(dev, true); 680 return;
651 DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout); 681
652 } 682 if ((cpu_is_omap34xx() && uart->padconf) ||
683 (uart->wk_en && uart->wk_mask)) {
684 device_init_wakeup(dev, true);
685 DEV_CREATE_FILE(dev, &dev_attr_sleep_timeout);
653 } 686 }
687
688 /* omap44xx: Never read empty UART fifo
689 * omap3xxx: Never read empty UART fifo on UARTs
690 * with IP rev >=0x52
691 */
692 if (cpu_is_omap44xx())
693 uart->p->serial_in = serial_in_override;
694 else if ((serial_read_reg(uart->p, UART_OMAP_MVER) & 0xFF)
695 >= UART_OMAP_NO_EMPTY_FIFO_READ_IP_REV)
696 uart->p->serial_in = serial_in_override;
697}
698
699/**
700 * omap_serial_init() - intialize all supported serial ports
701 *
702 * Initializes all available UARTs as serial ports. Platforms
703 * can call this function when they want to have default behaviour
704 * for serial ports (e.g initialize them all as serial ports).
705 */
706void __init omap_serial_init(void)
707{
708 int i;
709
710 for (i = 0; i < ARRAY_SIZE(omap_uart); i++)
711 omap_serial_init_port(i);
654} 712}
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S
index 82aa4a3d160c..de99ba2a57ab 100644
--- a/arch/arm/mach-omap2/sram34xx.S
+++ b/arch/arm/mach-omap2/sram34xx.S
@@ -91,8 +91,19 @@
91 * new SDRC_ACTIM_CTRL_B_1 register contents 91 * new SDRC_ACTIM_CTRL_B_1 register contents
92 * new SDRC_MR_1 register value 92 * new SDRC_MR_1 register value
93 * 93 *
94 * If the param SDRC_RFR_CTRL_1 is 0, the parameters 94 * If the param SDRC_RFR_CTRL_1 is 0, the parameters are not programmed into
95 * are not programmed into the SDRC CS1 registers 95 * the SDRC CS1 registers
96 *
97 * NOTE: This code no longer attempts to program the SDRC AC timing and MR
98 * registers. This is because the code currently cannot ensure that all
99 * L3 initiators (e.g., sDMA, IVA, DSS DISPC, etc.) are not accessing the
100 * SDRAM when the registers are written. If the registers are changed while
101 * an initiator is accessing SDRAM, memory can be corrupted and/or the SDRC
102 * may enter an unpredictable state. In the future, the intent is to
103 * re-enable this code in cases where we can ensure that no initiators are
104 * touching the SDRAM. Until that time, users who know that their use case
105 * can satisfy the above requirement can enable the CONFIG_OMAP3_SDRC_AC_TIMING
106 * option.
96 */ 107 */
97ENTRY(omap3_sram_configure_core_dpll) 108ENTRY(omap3_sram_configure_core_dpll)
98 stmfd sp!, {r1-r12, lr} @ store regs to stack 109 stmfd sp!, {r1-r12, lr} @ store regs to stack
@@ -219,6 +230,7 @@ configure_sdrc:
219 ldr r12, omap_sdrc_rfr_ctrl_0_val @ fetch value from SRAM 230 ldr r12, omap_sdrc_rfr_ctrl_0_val @ fetch value from SRAM
220 ldr r11, omap3_sdrc_rfr_ctrl_0 @ fetch addr from SRAM 231 ldr r11, omap3_sdrc_rfr_ctrl_0 @ fetch addr from SRAM
221 str r12, [r11] @ store 232 str r12, [r11] @ store
233#ifdef CONFIG_OMAP3_SDRC_AC_TIMING
222 ldr r12, omap_sdrc_actim_ctrl_a_0_val 234 ldr r12, omap_sdrc_actim_ctrl_a_0_val
223 ldr r11, omap3_sdrc_actim_ctrl_a_0 235 ldr r11, omap3_sdrc_actim_ctrl_a_0
224 str r12, [r11] 236 str r12, [r11]
@@ -228,11 +240,13 @@ configure_sdrc:
228 ldr r12, omap_sdrc_mr_0_val 240 ldr r12, omap_sdrc_mr_0_val
229 ldr r11, omap3_sdrc_mr_0 241 ldr r11, omap3_sdrc_mr_0
230 str r12, [r11] 242 str r12, [r11]
243#endif
231 ldr r12, omap_sdrc_rfr_ctrl_1_val 244 ldr r12, omap_sdrc_rfr_ctrl_1_val
232 cmp r12, #0 @ if SDRC_RFR_CTRL_1 is 0, 245 cmp r12, #0 @ if SDRC_RFR_CTRL_1 is 0,
233 beq skip_cs1_prog @ do not program cs1 params 246 beq skip_cs1_prog @ do not program cs1 params
234 ldr r11, omap3_sdrc_rfr_ctrl_1 247 ldr r11, omap3_sdrc_rfr_ctrl_1
235 str r12, [r11] 248 str r12, [r11]
249#ifdef CONFIG_OMAP3_SDRC_AC_TIMING
236 ldr r12, omap_sdrc_actim_ctrl_a_1_val 250 ldr r12, omap_sdrc_actim_ctrl_a_1_val
237 ldr r11, omap3_sdrc_actim_ctrl_a_1 251 ldr r11, omap3_sdrc_actim_ctrl_a_1
238 str r12, [r11] 252 str r12, [r11]
@@ -242,6 +256,7 @@ configure_sdrc:
242 ldr r12, omap_sdrc_mr_1_val 256 ldr r12, omap_sdrc_mr_1_val
243 ldr r11, omap3_sdrc_mr_1 257 ldr r11, omap3_sdrc_mr_1
244 str r12, [r11] 258 str r12, [r11]
259#endif
245skip_cs1_prog: 260skip_cs1_prog:
246 ldr r12, [r11] @ posted-write barrier for SDRC 261 ldr r12, [r11] @ posted-write barrier for SDRC
247 bx lr 262 bx lr
diff --git a/arch/arm/mach-omap2/usb-ehci.c b/arch/arm/mach-omap2/usb-ehci.c
index e448abd5ec5d..f1df873d59db 100644
--- a/arch/arm/mach-omap2/usb-ehci.c
+++ b/arch/arm/mach-omap2/usb-ehci.c
@@ -27,6 +27,8 @@
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28#include <plat/usb.h> 28#include <plat/usb.h>
29 29
30#include "mux.h"
31
30#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE) 32#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)
31 33
32static struct resource ehci_resources[] = { 34static struct resource ehci_resources[] = {
@@ -72,32 +74,44 @@ static void setup_ehci_io_mux(enum ehci_hcd_omap_mode *port_mode)
72{ 74{
73 switch (port_mode[0]) { 75 switch (port_mode[0]) {
74 case EHCI_HCD_OMAP_MODE_PHY: 76 case EHCI_HCD_OMAP_MODE_PHY:
75 omap_cfg_reg(Y9_3430_USB1HS_PHY_STP); 77 omap_mux_init_signal("hsusb1_stp", OMAP_PIN_OUTPUT);
76 omap_cfg_reg(Y8_3430_USB1HS_PHY_CLK); 78 omap_mux_init_signal("hsusb1_clk", OMAP_PIN_OUTPUT);
77 omap_cfg_reg(AA14_3430_USB1HS_PHY_DIR); 79 omap_mux_init_signal("hsusb1_dir", OMAP_PIN_INPUT_PULLDOWN);
78 omap_cfg_reg(AA11_3430_USB1HS_PHY_NXT); 80 omap_mux_init_signal("hsusb1_nxt", OMAP_PIN_INPUT_PULLDOWN);
79 omap_cfg_reg(W13_3430_USB1HS_PHY_DATA0); 81 omap_mux_init_signal("hsusb1_data0", OMAP_PIN_INPUT_PULLDOWN);
80 omap_cfg_reg(W12_3430_USB1HS_PHY_DATA1); 82 omap_mux_init_signal("hsusb1_data1", OMAP_PIN_INPUT_PULLDOWN);
81 omap_cfg_reg(W11_3430_USB1HS_PHY_DATA2); 83 omap_mux_init_signal("hsusb1_data2", OMAP_PIN_INPUT_PULLDOWN);
82 omap_cfg_reg(Y11_3430_USB1HS_PHY_DATA3); 84 omap_mux_init_signal("hsusb1_data3", OMAP_PIN_INPUT_PULLDOWN);
83 omap_cfg_reg(W9_3430_USB1HS_PHY_DATA4); 85 omap_mux_init_signal("hsusb1_data4", OMAP_PIN_INPUT_PULLDOWN);
84 omap_cfg_reg(Y12_3430_USB1HS_PHY_DATA5); 86 omap_mux_init_signal("hsusb1_data5", OMAP_PIN_INPUT_PULLDOWN);
85 omap_cfg_reg(W8_3430_USB1HS_PHY_DATA6); 87 omap_mux_init_signal("hsusb1_data6", OMAP_PIN_INPUT_PULLDOWN);
86 omap_cfg_reg(Y13_3430_USB1HS_PHY_DATA7); 88 omap_mux_init_signal("hsusb1_data7", OMAP_PIN_INPUT_PULLDOWN);
87 break; 89 break;
88 case EHCI_HCD_OMAP_MODE_TLL: 90 case EHCI_HCD_OMAP_MODE_TLL:
89 omap_cfg_reg(Y9_3430_USB1HS_TLL_STP); 91 omap_mux_init_signal("hsusb1_tll_stp",
90 omap_cfg_reg(Y8_3430_USB1HS_TLL_CLK); 92 OMAP_PIN_INPUT_PULLUP);
91 omap_cfg_reg(AA14_3430_USB1HS_TLL_DIR); 93 omap_mux_init_signal("hsusb1_tll_clk",
92 omap_cfg_reg(AA11_3430_USB1HS_TLL_NXT); 94 OMAP_PIN_INPUT_PULLDOWN);
93 omap_cfg_reg(W13_3430_USB1HS_TLL_DATA0); 95 omap_mux_init_signal("hsusb1_tll_dir",
94 omap_cfg_reg(W12_3430_USB1HS_TLL_DATA1); 96 OMAP_PIN_INPUT_PULLDOWN);
95 omap_cfg_reg(W11_3430_USB1HS_TLL_DATA2); 97 omap_mux_init_signal("hsusb1_tll_nxt",
96 omap_cfg_reg(Y11_3430_USB1HS_TLL_DATA3); 98 OMAP_PIN_INPUT_PULLDOWN);
97 omap_cfg_reg(W9_3430_USB1HS_TLL_DATA4); 99 omap_mux_init_signal("hsusb1_tll_data0",
98 omap_cfg_reg(Y12_3430_USB1HS_TLL_DATA5); 100 OMAP_PIN_INPUT_PULLDOWN);
99 omap_cfg_reg(W8_3430_USB1HS_TLL_DATA6); 101 omap_mux_init_signal("hsusb1_tll_data1",
100 omap_cfg_reg(Y13_3430_USB1HS_TLL_DATA7); 102 OMAP_PIN_INPUT_PULLDOWN);
103 omap_mux_init_signal("hsusb1_tll_data2",
104 OMAP_PIN_INPUT_PULLDOWN);
105 omap_mux_init_signal("hsusb1_tll_data3",
106 OMAP_PIN_INPUT_PULLDOWN);
107 omap_mux_init_signal("hsusb1_tll_data4",
108 OMAP_PIN_INPUT_PULLDOWN);
109 omap_mux_init_signal("hsusb1_tll_data5",
110 OMAP_PIN_INPUT_PULLDOWN);
111 omap_mux_init_signal("hsusb1_tll_data6",
112 OMAP_PIN_INPUT_PULLDOWN);
113 omap_mux_init_signal("hsusb1_tll_data7",
114 OMAP_PIN_INPUT_PULLDOWN);
101 break; 115 break;
102 case EHCI_HCD_OMAP_MODE_UNKNOWN: 116 case EHCI_HCD_OMAP_MODE_UNKNOWN:
103 /* FALLTHROUGH */ 117 /* FALLTHROUGH */
@@ -107,32 +121,52 @@ static void setup_ehci_io_mux(enum ehci_hcd_omap_mode *port_mode)
107 121
108 switch (port_mode[1]) { 122 switch (port_mode[1]) {
109 case EHCI_HCD_OMAP_MODE_PHY: 123 case EHCI_HCD_OMAP_MODE_PHY:
110 omap_cfg_reg(AA10_3430_USB2HS_PHY_STP); 124 omap_mux_init_signal("hsusb2_stp", OMAP_PIN_OUTPUT);
111 omap_cfg_reg(AA8_3430_USB2HS_PHY_CLK); 125 omap_mux_init_signal("hsusb2_clk", OMAP_PIN_OUTPUT);
112 omap_cfg_reg(AA9_3430_USB2HS_PHY_DIR); 126 omap_mux_init_signal("hsusb2_dir", OMAP_PIN_INPUT_PULLDOWN);
113 omap_cfg_reg(AB11_3430_USB2HS_PHY_NXT); 127 omap_mux_init_signal("hsusb2_nxt", OMAP_PIN_INPUT_PULLDOWN);
114 omap_cfg_reg(AB10_3430_USB2HS_PHY_DATA0); 128 omap_mux_init_signal("hsusb2_data0",
115 omap_cfg_reg(AB9_3430_USB2HS_PHY_DATA1); 129 OMAP_PIN_INPUT_PULLDOWN);
116 omap_cfg_reg(W3_3430_USB2HS_PHY_DATA2); 130 omap_mux_init_signal("hsusb2_data1",
117 omap_cfg_reg(T4_3430_USB2HS_PHY_DATA3); 131 OMAP_PIN_INPUT_PULLDOWN);
118 omap_cfg_reg(T3_3430_USB2HS_PHY_DATA4); 132 omap_mux_init_signal("hsusb2_data2",
119 omap_cfg_reg(R3_3430_USB2HS_PHY_DATA5); 133 OMAP_PIN_INPUT_PULLDOWN);
120 omap_cfg_reg(R4_3430_USB2HS_PHY_DATA6); 134 omap_mux_init_signal("hsusb2_data3",
121 omap_cfg_reg(T2_3430_USB2HS_PHY_DATA7); 135 OMAP_PIN_INPUT_PULLDOWN);
136 omap_mux_init_signal("hsusb2_data4",
137 OMAP_PIN_INPUT_PULLDOWN);
138 omap_mux_init_signal("hsusb2_data5",
139 OMAP_PIN_INPUT_PULLDOWN);
140 omap_mux_init_signal("hsusb2_data6",
141 OMAP_PIN_INPUT_PULLDOWN);
142 omap_mux_init_signal("hsusb2_data7",
143 OMAP_PIN_INPUT_PULLDOWN);
122 break; 144 break;
123 case EHCI_HCD_OMAP_MODE_TLL: 145 case EHCI_HCD_OMAP_MODE_TLL:
124 omap_cfg_reg(AA10_3430_USB2HS_TLL_STP); 146 omap_mux_init_signal("hsusb2_tll_stp",
125 omap_cfg_reg(AA8_3430_USB2HS_TLL_CLK); 147 OMAP_PIN_INPUT_PULLUP);
126 omap_cfg_reg(AA9_3430_USB2HS_TLL_DIR); 148 omap_mux_init_signal("hsusb2_tll_clk",
127 omap_cfg_reg(AB11_3430_USB2HS_TLL_NXT); 149 OMAP_PIN_INPUT_PULLDOWN);
128 omap_cfg_reg(AB10_3430_USB2HS_TLL_DATA0); 150 omap_mux_init_signal("hsusb2_tll_dir",
129 omap_cfg_reg(AB9_3430_USB2HS_TLL_DATA1); 151 OMAP_PIN_INPUT_PULLDOWN);
130 omap_cfg_reg(W3_3430_USB2HS_TLL_DATA2); 152 omap_mux_init_signal("hsusb2_tll_nxt",
131 omap_cfg_reg(T4_3430_USB2HS_TLL_DATA3); 153 OMAP_PIN_INPUT_PULLDOWN);
132 omap_cfg_reg(T3_3430_USB2HS_TLL_DATA4); 154 omap_mux_init_signal("hsusb2_tll_data0",
133 omap_cfg_reg(R3_3430_USB2HS_TLL_DATA5); 155 OMAP_PIN_INPUT_PULLDOWN);
134 omap_cfg_reg(R4_3430_USB2HS_TLL_DATA6); 156 omap_mux_init_signal("hsusb2_tll_data1",
135 omap_cfg_reg(T2_3430_USB2HS_TLL_DATA7); 157 OMAP_PIN_INPUT_PULLDOWN);
158 omap_mux_init_signal("hsusb2_tll_data2",
159 OMAP_PIN_INPUT_PULLDOWN);
160 omap_mux_init_signal("hsusb2_tll_data3",
161 OMAP_PIN_INPUT_PULLDOWN);
162 omap_mux_init_signal("hsusb2_tll_data4",
163 OMAP_PIN_INPUT_PULLDOWN);
164 omap_mux_init_signal("hsusb2_tll_data5",
165 OMAP_PIN_INPUT_PULLDOWN);
166 omap_mux_init_signal("hsusb2_tll_data6",
167 OMAP_PIN_INPUT_PULLDOWN);
168 omap_mux_init_signal("hsusb2_tll_data7",
169 OMAP_PIN_INPUT_PULLDOWN);
136 break; 170 break;
137 case EHCI_HCD_OMAP_MODE_UNKNOWN: 171 case EHCI_HCD_OMAP_MODE_UNKNOWN:
138 /* FALLTHROUGH */ 172 /* FALLTHROUGH */
@@ -145,18 +179,30 @@ static void setup_ehci_io_mux(enum ehci_hcd_omap_mode *port_mode)
145 printk(KERN_WARNING "Port3 can't be used in PHY mode\n"); 179 printk(KERN_WARNING "Port3 can't be used in PHY mode\n");
146 break; 180 break;
147 case EHCI_HCD_OMAP_MODE_TLL: 181 case EHCI_HCD_OMAP_MODE_TLL:
148 omap_cfg_reg(AB3_3430_USB3HS_TLL_STP); 182 omap_mux_init_signal("hsusb3_tll_stp",
149 omap_cfg_reg(AA6_3430_USB3HS_TLL_CLK); 183 OMAP_PIN_INPUT_PULLUP);
150 omap_cfg_reg(AA3_3430_USB3HS_TLL_DIR); 184 omap_mux_init_signal("hsusb3_tll_clk",
151 omap_cfg_reg(Y3_3430_USB3HS_TLL_NXT); 185 OMAP_PIN_INPUT_PULLDOWN);
152 omap_cfg_reg(AA5_3430_USB3HS_TLL_DATA0); 186 omap_mux_init_signal("hsusb3_tll_dir",
153 omap_cfg_reg(Y4_3430_USB3HS_TLL_DATA1); 187 OMAP_PIN_INPUT_PULLDOWN);
154 omap_cfg_reg(Y5_3430_USB3HS_TLL_DATA2); 188 omap_mux_init_signal("hsusb3_tll_nxt",
155 omap_cfg_reg(W5_3430_USB3HS_TLL_DATA3); 189 OMAP_PIN_INPUT_PULLDOWN);
156 omap_cfg_reg(AB12_3430_USB3HS_TLL_DATA4); 190 omap_mux_init_signal("hsusb3_tll_data0",
157 omap_cfg_reg(AB13_3430_USB3HS_TLL_DATA5); 191 OMAP_PIN_INPUT_PULLDOWN);
158 omap_cfg_reg(AA13_3430_USB3HS_TLL_DATA6); 192 omap_mux_init_signal("hsusb3_tll_data1",
159 omap_cfg_reg(AA12_3430_USB3HS_TLL_DATA7); 193 OMAP_PIN_INPUT_PULLDOWN);
194 omap_mux_init_signal("hsusb3_tll_data2",
195 OMAP_PIN_INPUT_PULLDOWN);
196 omap_mux_init_signal("hsusb3_tll_data3",
197 OMAP_PIN_INPUT_PULLDOWN);
198 omap_mux_init_signal("hsusb3_tll_data4",
199 OMAP_PIN_INPUT_PULLDOWN);
200 omap_mux_init_signal("hsusb3_tll_data5",
201 OMAP_PIN_INPUT_PULLDOWN);
202 omap_mux_init_signal("hsusb3_tll_data6",
203 OMAP_PIN_INPUT_PULLDOWN);
204 omap_mux_init_signal("hsusb3_tll_data7",
205 OMAP_PIN_INPUT_PULLDOWN);
160 break; 206 break;
161 case EHCI_HCD_OMAP_MODE_UNKNOWN: 207 case EHCI_HCD_OMAP_MODE_UNKNOWN:
162 /* FALLTHROUGH */ 208 /* FALLTHROUGH */
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index d89c6adbe8bc..e6d8e10ae5d1 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -63,6 +63,15 @@ config ARCH_VIPER
63 select HAVE_PWM 63 select HAVE_PWM
64 select PXA_HAVE_BOARD_IRQS 64 select PXA_HAVE_BOARD_IRQS
65 select PXA_HAVE_ISA_IRQS 65 select PXA_HAVE_ISA_IRQS
66 select ARCOM_PCMCIA
67
68config MACH_ARCOM_ZEUS
69 bool "Arcom/Eurotech ZEUS SBC"
70 select PXA27x
71 select ISA
72 select PXA_HAVE_BOARD_IRQS
73 select PXA_HAVE_ISA_IRQS
74 select ARCOM_PCMCIA
66 75
67config MACH_BALLOON3 76config MACH_BALLOON3
68 bool "Balloon 3 board" 77 bool "Balloon 3 board"
@@ -179,6 +188,11 @@ config MACH_TRIZEPS_ANY
179 188
180endchoice 189endchoice
181 190
191config ARCOM_PCMCIA
192 bool
193 help
194 Generic option for Arcom Viper/Zeus PCMCIA
195
182config TRIZEPS_PCMCIA 196config TRIZEPS_PCMCIA
183 bool 197 bool
184 help 198 help
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index b5d29e60a341..f64afda7e6f6 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -38,6 +38,7 @@ obj-$(CONFIG_MACH_SAAR) += saar.o
38# 3rd Party Dev Platforms 38# 3rd Party Dev Platforms
39obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 39obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
40obj-$(CONFIG_ARCH_VIPER) += viper.o 40obj-$(CONFIG_ARCH_VIPER) += viper.o
41obj-$(CONFIG_MACH_ARCOM_ZEUS) += zeus.o
41obj-$(CONFIG_MACH_BALLOON3) += balloon3.o 42obj-$(CONFIG_MACH_BALLOON3) += balloon3.o
42obj-$(CONFIG_MACH_CSB726) += csb726.o 43obj-$(CONFIG_MACH_CSB726) += csb726.o
43obj-$(CONFIG_CSB726_CSB701) += csb701.o 44obj-$(CONFIG_CSB726_CSB701) += csb701.o
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index 1c0de808b54d..c8a01bc85fde 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -497,16 +497,15 @@ static int em_x270_usb_hub_init(void)
497 goto err_free_vbus_gpio; 497 goto err_free_vbus_gpio;
498 498
499 /* USB Hub power-on and reset */ 499 /* USB Hub power-on and reset */
500 gpio_direction_output(usb_hub_reset, 0); 500 gpio_direction_output(usb_hub_reset, 1);
501 gpio_direction_output(GPIO9_USB_VBUS_EN, 0);
501 regulator_enable(em_x270_usb_ldo); 502 regulator_enable(em_x270_usb_ldo);
502 gpio_set_value(usb_hub_reset, 1);
503 gpio_set_value(usb_hub_reset, 0); 503 gpio_set_value(usb_hub_reset, 0);
504 gpio_set_value(usb_hub_reset, 1);
504 regulator_disable(em_x270_usb_ldo); 505 regulator_disable(em_x270_usb_ldo);
505 regulator_enable(em_x270_usb_ldo); 506 regulator_enable(em_x270_usb_ldo);
506 gpio_set_value(usb_hub_reset, 1); 507 gpio_set_value(usb_hub_reset, 0);
507 508 gpio_set_value(GPIO9_USB_VBUS_EN, 1);
508 /* enable VBUS */
509 gpio_direction_output(GPIO9_USB_VBUS_EN, 1);
510 509
511 return 0; 510 return 0;
512 511
diff --git a/arch/arm/mach-pxa/include/mach/arcom-pcmcia.h b/arch/arm/mach-pxa/include/mach/arcom-pcmcia.h
new file mode 100644
index 000000000000..d428be4db44c
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/arcom-pcmcia.h
@@ -0,0 +1,11 @@
1#ifndef __ARCOM_PCMCIA_H
2#define __ARCOM_PCMCIA_H
3
4struct arcom_pcmcia_pdata {
5 int cd_gpio;
6 int rdy_gpio;
7 int pwr_gpio;
8 void (*reset)(int state);
9};
10
11#endif
diff --git a/arch/arm/mach-pxa/include/mach/viper.h b/arch/arm/mach-pxa/include/mach/viper.h
index 10988c270ca3..5f5fbf1f6489 100644
--- a/arch/arm/mach-pxa/include/mach/viper.h
+++ b/arch/arm/mach-pxa/include/mach/viper.h
@@ -85,8 +85,6 @@
85/* Interrupt and Configuration Register (VIPER_ICR) */ 85/* Interrupt and Configuration Register (VIPER_ICR) */
86/* This is a write only register. Only CF_RST is used under Linux */ 86/* This is a write only register. Only CF_RST is used under Linux */
87 87
88extern void viper_cf_rst(int state);
89
90#define VIPER_ICR_RETRIG (1 << 0) 88#define VIPER_ICR_RETRIG (1 << 0)
91#define VIPER_ICR_AUTO_CLR (1 << 1) 89#define VIPER_ICR_AUTO_CLR (1 << 1)
92#define VIPER_ICR_R_DIS (1 << 2) 90#define VIPER_ICR_R_DIS (1 << 2)
diff --git a/arch/arm/mach-pxa/include/mach/zeus.h b/arch/arm/mach-pxa/include/mach/zeus.h
new file mode 100644
index 000000000000..c387046d2f28
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/zeus.h
@@ -0,0 +1,82 @@
1/*
2 * arch/arm/mach-pxa/include/mach/zeus.h
3 *
4 * Author: David Vrabel
5 * Created: Sept 28, 2005
6 * Copyright: Arcom Control Systems Ltd.
7 *
8 * Maintained by: Marc Zyngier <maz@misterjones.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#ifndef _MACH_ZEUS_H
16#define _MACH_ZEUS_H
17
18/* Physical addresses */
19#define ZEUS_FLASH_PHYS PXA_CS0_PHYS
20#define ZEUS_ETH0_PHYS PXA_CS1_PHYS
21#define ZEUS_ETH1_PHYS PXA_CS2_PHYS
22#define ZEUS_CPLD_PHYS (PXA_CS4_PHYS+0x2000000)
23#define ZEUS_SRAM_PHYS PXA_CS5_PHYS
24#define ZEUS_PC104IO_PHYS (0x30000000)
25
26#define ZEUS_CPLD_VERSION_PHYS (ZEUS_CPLD_PHYS + 0x00000000)
27#define ZEUS_CPLD_ISA_IRQ_PHYS (ZEUS_CPLD_PHYS + 0x00800000)
28#define ZEUS_CPLD_CONTROL_PHYS (ZEUS_CPLD_PHYS + 0x01000000)
29#define ZEUS_CPLD_EXTWDOG_PHYS (ZEUS_CPLD_PHYS + 0x01800000)
30
31/* GPIOs */
32#define ZEUS_AC97_GPIO 0
33#define ZEUS_WAKEUP_GPIO 1
34#define ZEUS_UARTA_GPIO 9
35#define ZEUS_UARTB_GPIO 10
36#define ZEUS_UARTC_GPIO 12
37#define ZEUS_UARTD_GPIO 11
38#define ZEUS_ETH0_GPIO 14
39#define ZEUS_ISA_GPIO 17
40#define ZEUS_BKLEN_GPIO 19
41#define ZEUS_USB2_PWREN_GPIO 22
42#define ZEUS_PTT_GPIO 27
43#define ZEUS_CF_CD_GPIO 35
44#define ZEUS_MMC_WP_GPIO 52
45#define ZEUS_MMC_CD_GPIO 53
46#define ZEUS_EXTGPIO_GPIO 91
47#define ZEUS_CF_PWEN_GPIO 97
48#define ZEUS_CF_RDY_GPIO 99
49#define ZEUS_LCD_EN_GPIO 101
50#define ZEUS_ETH1_GPIO 113
51#define ZEUS_CAN_GPIO 116
52
53#define ZEUS_EXT0_GPIO_BASE 128
54#define ZEUS_EXT1_GPIO_BASE 160
55#define ZEUS_USER_GPIO_BASE 192
56
57#define ZEUS_EXT0_GPIO(x) (ZEUS_EXT0_GPIO_BASE + (x))
58#define ZEUS_EXT1_GPIO(x) (ZEUS_EXT1_GPIO_BASE + (x))
59#define ZEUS_USER_GPIO(x) (ZEUS_USER_GPIO_BASE + (x))
60
61/*
62 * CPLD registers:
63 * Only 4 registers, but spreaded over a 32MB address space.
64 * Be gentle, and remap that over 32kB...
65 */
66
67#define ZEUS_CPLD (0xf0000000)
68#define ZEUS_CPLD_VERSION (ZEUS_CPLD + 0x0000)
69#define ZEUS_CPLD_ISA_IRQ (ZEUS_CPLD + 0x1000)
70#define ZEUS_CPLD_CONTROL (ZEUS_CPLD + 0x2000)
71#define ZEUS_CPLD_EXTWDOG (ZEUS_CPLD + 0x3000)
72
73/* CPLD register bits */
74#define ZEUS_CPLD_CONTROL_CF_RST 0x01
75
76#define ZEUS_PC104IO (0xf1000000)
77
78#define ZEUS_SRAM_SIZE (256 * 1024)
79
80#endif
81
82
diff --git a/arch/arm/mach-pxa/viper.c b/arch/arm/mach-pxa/viper.c
index cf0d71b7797e..5352b4e5a7dd 100644
--- a/arch/arm/mach-pxa/viper.c
+++ b/arch/arm/mach-pxa/viper.c
@@ -47,6 +47,7 @@
47#include <mach/pxafb.h> 47#include <mach/pxafb.h>
48#include <plat/i2c.h> 48#include <plat/i2c.h>
49#include <mach/regs-uart.h> 49#include <mach/regs-uart.h>
50#include <mach/arcom-pcmcia.h>
50#include <mach/viper.h> 51#include <mach/viper.h>
51 52
52#include <asm/setup.h> 53#include <asm/setup.h>
@@ -76,14 +77,28 @@ static void viper_icr_clear_bit(unsigned int bit)
76} 77}
77 78
78/* This function is used from the pcmcia module to reset the CF */ 79/* This function is used from the pcmcia module to reset the CF */
79void viper_cf_rst(int state) 80static void viper_cf_reset(int state)
80{ 81{
81 if (state) 82 if (state)
82 viper_icr_set_bit(VIPER_ICR_CF_RST); 83 viper_icr_set_bit(VIPER_ICR_CF_RST);
83 else 84 else
84 viper_icr_clear_bit(VIPER_ICR_CF_RST); 85 viper_icr_clear_bit(VIPER_ICR_CF_RST);
85} 86}
86EXPORT_SYMBOL(viper_cf_rst); 87
88static struct arcom_pcmcia_pdata viper_pcmcia_info = {
89 .cd_gpio = VIPER_CF_CD_GPIO,
90 .rdy_gpio = VIPER_CF_RDY_GPIO,
91 .pwr_gpio = VIPER_CF_POWER_GPIO,
92 .reset = viper_cf_reset,
93};
94
95static struct platform_device viper_pcmcia_device = {
96 .name = "viper-pcmcia",
97 .id = -1,
98 .dev = {
99 .platform_data = &viper_pcmcia_info,
100 },
101};
87 102
88/* 103/*
89 * The CPLD version register was not present on VIPER boards prior to 104 * The CPLD version register was not present on VIPER boards prior to
@@ -685,6 +700,7 @@ static struct platform_device *viper_devs[] __initdata = {
685 &viper_mtd_devices[0], 700 &viper_mtd_devices[0],
686 &viper_mtd_devices[1], 701 &viper_mtd_devices[1],
687 &viper_backlight_device, 702 &viper_backlight_device,
703 &viper_pcmcia_device,
688}; 704};
689 705
690static mfp_cfg_t viper_pin_config[] __initdata = { 706static mfp_cfg_t viper_pin_config[] __initdata = {
diff --git a/arch/arm/mach-pxa/zeus.c b/arch/arm/mach-pxa/zeus.c
new file mode 100644
index 000000000000..5b986a8bd9e6
--- /dev/null
+++ b/arch/arm/mach-pxa/zeus.c
@@ -0,0 +1,820 @@
1/*
2 * Support for the Arcom ZEUS.
3 *
4 * Copyright (C) 2006 Arcom Control Systems Ltd.
5 *
6 * Loosely based on Arcom's 2.6.16.28.
7 * Maintained by Marc Zyngier <maz@misterjones.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/cpufreq.h>
15#include <linux/interrupt.h>
16#include <linux/irq.h>
17#include <linux/pm.h>
18#include <linux/gpio.h>
19#include <linux/serial_8250.h>
20#include <linux/dm9000.h>
21#include <linux/mmc/host.h>
22#include <linux/spi/spi.h>
23#include <linux/mtd/mtd.h>
24#include <linux/mtd/partitions.h>
25#include <linux/mtd/physmap.h>
26#include <linux/i2c.h>
27#include <linux/i2c/pca953x.h>
28
29#include <asm/mach-types.h>
30#include <asm/mach/arch.h>
31#include <asm/mach/map.h>
32
33#include <plat/i2c.h>
34
35#include <mach/pxa2xx-regs.h>
36#include <mach/regs-uart.h>
37#include <mach/ohci.h>
38#include <mach/mmc.h>
39#include <mach/pxa27x-udc.h>
40#include <mach/udc.h>
41#include <mach/pxafb.h>
42#include <mach/pxa2xx_spi.h>
43#include <mach/mfp-pxa27x.h>
44#include <mach/pm.h>
45#include <mach/audio.h>
46#include <mach/arcom-pcmcia.h>
47#include <mach/zeus.h>
48
49#include "generic.h"
50
51/*
52 * Interrupt handling
53 */
54
55static unsigned long zeus_irq_enabled_mask;
56static const int zeus_isa_irqs[] = { 3, 4, 5, 6, 7, 10, 11, 12, };
57static const int zeus_isa_irq_map[] = {
58 0, /* ISA irq #0, invalid */
59 0, /* ISA irq #1, invalid */
60 0, /* ISA irq #2, invalid */
61 1 << 0, /* ISA irq #3 */
62 1 << 1, /* ISA irq #4 */
63 1 << 2, /* ISA irq #5 */
64 1 << 3, /* ISA irq #6 */
65 1 << 4, /* ISA irq #7 */
66 0, /* ISA irq #8, invalid */
67 0, /* ISA irq #9, invalid */
68 1 << 5, /* ISA irq #10 */
69 1 << 6, /* ISA irq #11 */
70 1 << 7, /* ISA irq #12 */
71};
72
73static inline int zeus_irq_to_bitmask(unsigned int irq)
74{
75 return zeus_isa_irq_map[irq - PXA_ISA_IRQ(0)];
76}
77
78static inline int zeus_bit_to_irq(int bit)
79{
80 return zeus_isa_irqs[bit] + PXA_ISA_IRQ(0);
81}
82
83static void zeus_ack_irq(unsigned int irq)
84{
85 __raw_writew(zeus_irq_to_bitmask(irq), ZEUS_CPLD_ISA_IRQ);
86}
87
88static void zeus_mask_irq(unsigned int irq)
89{
90 zeus_irq_enabled_mask &= ~(zeus_irq_to_bitmask(irq));
91}
92
93static void zeus_unmask_irq(unsigned int irq)
94{
95 zeus_irq_enabled_mask |= zeus_irq_to_bitmask(irq);
96}
97
98static inline unsigned long zeus_irq_pending(void)
99{
100 return __raw_readw(ZEUS_CPLD_ISA_IRQ) & zeus_irq_enabled_mask;
101}
102
103static void zeus_irq_handler(unsigned int irq, struct irq_desc *desc)
104{
105 unsigned long pending;
106
107 pending = zeus_irq_pending();
108 do {
109 /* we're in a chained irq handler,
110 * so ack the interrupt by hand */
111 desc->chip->ack(gpio_to_irq(ZEUS_ISA_GPIO));
112
113 if (likely(pending)) {
114 irq = zeus_bit_to_irq(__ffs(pending));
115 generic_handle_irq(irq);
116 }
117 pending = zeus_irq_pending();
118 } while (pending);
119}
120
121static struct irq_chip zeus_irq_chip = {
122 .name = "ISA",
123 .ack = zeus_ack_irq,
124 .mask = zeus_mask_irq,
125 .unmask = zeus_unmask_irq,
126};
127
128static void __init zeus_init_irq(void)
129{
130 int level;
131 int isa_irq;
132
133 pxa27x_init_irq();
134
135 /* Peripheral IRQs. It would be nice to move those inside driver
136 configuration, but it is not supported at the moment. */
137 set_irq_type(gpio_to_irq(ZEUS_AC97_GPIO), IRQ_TYPE_EDGE_RISING);
138 set_irq_type(gpio_to_irq(ZEUS_WAKEUP_GPIO), IRQ_TYPE_EDGE_RISING);
139 set_irq_type(gpio_to_irq(ZEUS_PTT_GPIO), IRQ_TYPE_EDGE_RISING);
140 set_irq_type(gpio_to_irq(ZEUS_EXTGPIO_GPIO), IRQ_TYPE_EDGE_FALLING);
141 set_irq_type(gpio_to_irq(ZEUS_CAN_GPIO), IRQ_TYPE_EDGE_FALLING);
142
143 /* Setup ISA IRQs */
144 for (level = 0; level < ARRAY_SIZE(zeus_isa_irqs); level++) {
145 isa_irq = zeus_bit_to_irq(level);
146 set_irq_chip(isa_irq, &zeus_irq_chip);
147 set_irq_handler(isa_irq, handle_edge_irq);
148 set_irq_flags(isa_irq, IRQF_VALID | IRQF_PROBE);
149 }
150
151 set_irq_type(gpio_to_irq(ZEUS_ISA_GPIO), IRQ_TYPE_EDGE_RISING);
152 set_irq_chained_handler(gpio_to_irq(ZEUS_ISA_GPIO), zeus_irq_handler);
153}
154
155
156/*
157 * Platform devices
158 */
159
160/* Flash */
161static struct resource zeus_mtd_resources[] = {
162 [0] = { /* NOR Flash (up to 64MB) */
163 .start = ZEUS_FLASH_PHYS,
164 .end = ZEUS_FLASH_PHYS + SZ_64M - 1,
165 .flags = IORESOURCE_MEM,
166 },
167 [1] = { /* SRAM */
168 .start = ZEUS_SRAM_PHYS,
169 .end = ZEUS_SRAM_PHYS + SZ_512K - 1,
170 .flags = IORESOURCE_MEM,
171 },
172};
173
174static struct physmap_flash_data zeus_flash_data[] = {
175 [0] = {
176 .width = 2,
177 .parts = NULL,
178 .nr_parts = 0,
179 },
180};
181
182static struct platform_device zeus_mtd_devices[] = {
183 [0] = {
184 .name = "physmap-flash",
185 .id = 0,
186 .dev = {
187 .platform_data = &zeus_flash_data[0],
188 },
189 .resource = &zeus_mtd_resources[0],
190 .num_resources = 1,
191 },
192};
193
194/* Serial */
195static struct resource zeus_serial_resources[] = {
196 {
197 .start = 0x10000000,
198 .end = 0x1000000f,
199 .flags = IORESOURCE_MEM,
200 },
201 {
202 .start = 0x10800000,
203 .end = 0x1080000f,
204 .flags = IORESOURCE_MEM,
205 },
206 {
207 .start = 0x11000000,
208 .end = 0x1100000f,
209 .flags = IORESOURCE_MEM,
210 },
211 {
212 .start = 0x40100000,
213 .end = 0x4010001f,
214 .flags = IORESOURCE_MEM,
215 },
216 {
217 .start = 0x40200000,
218 .end = 0x4020001f,
219 .flags = IORESOURCE_MEM,
220 },
221 {
222 .start = 0x40700000,
223 .end = 0x4070001f,
224 .flags = IORESOURCE_MEM,
225 },
226};
227
228static struct plat_serial8250_port serial_platform_data[] = {
229 /* External UARTs */
230 /* FIXME: Shared IRQs on COM1-COM4 will not work properly on v1i1 hardware. */
231 { /* COM1 */
232 .mapbase = 0x10000000,
233 .irq = gpio_to_irq(ZEUS_UARTA_GPIO),
234 .irqflags = IRQF_TRIGGER_RISING,
235 .uartclk = 14745600,
236 .regshift = 1,
237 .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
238 .iotype = UPIO_MEM,
239 },
240 { /* COM2 */
241 .mapbase = 0x10800000,
242 .irq = gpio_to_irq(ZEUS_UARTB_GPIO),
243 .irqflags = IRQF_TRIGGER_RISING,
244 .uartclk = 14745600,
245 .regshift = 1,
246 .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
247 .iotype = UPIO_MEM,
248 },
249 { /* COM3 */
250 .mapbase = 0x11000000,
251 .irq = gpio_to_irq(ZEUS_UARTC_GPIO),
252 .irqflags = IRQF_TRIGGER_RISING,
253 .uartclk = 14745600,
254 .regshift = 1,
255 .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
256 .iotype = UPIO_MEM,
257 },
258 { /* COM4 */
259 .mapbase = 0x11800000,
260 .irq = gpio_to_irq(ZEUS_UARTD_GPIO),
261 .irqflags = IRQF_TRIGGER_RISING,
262 .uartclk = 14745600,
263 .regshift = 1,
264 .flags = UPF_IOREMAP | UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
265 .iotype = UPIO_MEM,
266 },
267 /* Internal UARTs */
268 { /* FFUART */
269 .membase = (void *)&FFUART,
270 .mapbase = __PREG(FFUART),
271 .irq = IRQ_FFUART,
272 .uartclk = 921600 * 16,
273 .regshift = 2,
274 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
275 .iotype = UPIO_MEM,
276 },
277 { /* BTUART */
278 .membase = (void *)&BTUART,
279 .mapbase = __PREG(BTUART),
280 .irq = IRQ_BTUART,
281 .uartclk = 921600 * 16,
282 .regshift = 2,
283 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
284 .iotype = UPIO_MEM,
285 },
286 { /* STUART */
287 .membase = (void *)&STUART,
288 .mapbase = __PREG(STUART),
289 .irq = IRQ_STUART,
290 .uartclk = 921600 * 16,
291 .regshift = 2,
292 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
293 .iotype = UPIO_MEM,
294 },
295 { },
296};
297
298static struct platform_device zeus_serial_device = {
299 .name = "serial8250",
300 .id = PLAT8250_DEV_PLATFORM,
301 .dev = {
302 .platform_data = serial_platform_data,
303 },
304 .num_resources = ARRAY_SIZE(zeus_serial_resources),
305 .resource = zeus_serial_resources,
306};
307
308/* Ethernet */
309static struct resource zeus_dm9k0_resource[] = {
310 [0] = {
311 .start = ZEUS_ETH0_PHYS,
312 .end = ZEUS_ETH0_PHYS + 1,
313 .flags = IORESOURCE_MEM
314 },
315 [1] = {
316 .start = ZEUS_ETH0_PHYS + 2,
317 .end = ZEUS_ETH0_PHYS + 3,
318 .flags = IORESOURCE_MEM
319 },
320 [2] = {
321 .start = gpio_to_irq(ZEUS_ETH0_GPIO),
322 .end = gpio_to_irq(ZEUS_ETH0_GPIO),
323 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
324 },
325};
326
327static struct resource zeus_dm9k1_resource[] = {
328 [0] = {
329 .start = ZEUS_ETH1_PHYS,
330 .end = ZEUS_ETH1_PHYS + 1,
331 .flags = IORESOURCE_MEM
332 },
333 [1] = {
334 .start = ZEUS_ETH1_PHYS + 2,
335 .end = ZEUS_ETH1_PHYS + 3,
336 .flags = IORESOURCE_MEM,
337 },
338 [2] = {
339 .start = gpio_to_irq(ZEUS_ETH1_GPIO),
340 .end = gpio_to_irq(ZEUS_ETH1_GPIO),
341 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
342 },
343};
344
345static struct dm9000_plat_data zeus_dm9k_platdata = {
346 .flags = DM9000_PLATF_16BITONLY,
347};
348
349static struct platform_device zeus_dm9k0_device = {
350 .name = "dm9000",
351 .id = 0,
352 .num_resources = ARRAY_SIZE(zeus_dm9k0_resource),
353 .resource = zeus_dm9k0_resource,
354 .dev = {
355 .platform_data = &zeus_dm9k_platdata,
356 }
357};
358
359static struct platform_device zeus_dm9k1_device = {
360 .name = "dm9000",
361 .id = 1,
362 .num_resources = ARRAY_SIZE(zeus_dm9k1_resource),
363 .resource = zeus_dm9k1_resource,
364 .dev = {
365 .platform_data = &zeus_dm9k_platdata,
366 }
367};
368
369/* External SRAM */
370static struct resource zeus_sram_resource = {
371 .start = ZEUS_SRAM_PHYS,
372 .end = ZEUS_SRAM_PHYS + ZEUS_SRAM_SIZE * 2 - 1,
373 .flags = IORESOURCE_MEM,
374};
375
376static struct platform_device zeus_sram_device = {
377 .name = "pxa2xx-8bit-sram",
378 .id = 0,
379 .num_resources = 1,
380 .resource = &zeus_sram_resource,
381};
382
383/* SPI interface on SSP3 */
384static struct pxa2xx_spi_master pxa2xx_spi_ssp3_master_info = {
385 .num_chipselect = 1,
386 .enable_dma = 1,
387};
388
389static struct platform_device pxa2xx_spi_ssp3_device = {
390 .name = "pxa2xx-spi",
391 .id = 3,
392 .dev = {
393 .platform_data = &pxa2xx_spi_ssp3_master_info,
394 },
395};
396
397/* Leds */
398static struct gpio_led zeus_leds[] = {
399 [0] = {
400 .name = "zeus:yellow:1",
401 .default_trigger = "heartbeat",
402 .gpio = ZEUS_EXT0_GPIO(3),
403 .active_low = 1,
404 },
405 [1] = {
406 .name = "zeus:yellow:2",
407 .default_trigger = "default-on",
408 .gpio = ZEUS_EXT0_GPIO(4),
409 .active_low = 1,
410 },
411 [2] = {
412 .name = "zeus:yellow:3",
413 .default_trigger = "default-on",
414 .gpio = ZEUS_EXT0_GPIO(5),
415 .active_low = 1,
416 },
417};
418
419static struct gpio_led_platform_data zeus_leds_info = {
420 .leds = zeus_leds,
421 .num_leds = ARRAY_SIZE(zeus_leds),
422};
423
424static struct platform_device zeus_leds_device = {
425 .name = "leds-gpio",
426 .id = -1,
427 .dev = {
428 .platform_data = &zeus_leds_info,
429 },
430};
431
432static void zeus_cf_reset(int state)
433{
434 u16 cpld_state = __raw_readw(ZEUS_CPLD_CONTROL);
435
436 if (state)
437 cpld_state |= ZEUS_CPLD_CONTROL_CF_RST;
438 else
439 cpld_state &= ~ZEUS_CPLD_CONTROL_CF_RST;
440
441 __raw_writew(cpld_state, ZEUS_CPLD_CONTROL);
442}
443
444static struct arcom_pcmcia_pdata zeus_pcmcia_info = {
445 .cd_gpio = ZEUS_CF_CD_GPIO,
446 .rdy_gpio = ZEUS_CF_RDY_GPIO,
447 .pwr_gpio = ZEUS_CF_PWEN_GPIO,
448 .reset = zeus_cf_reset,
449};
450
451static struct platform_device zeus_pcmcia_device = {
452 .name = "zeus-pcmcia",
453 .id = -1,
454 .dev = {
455 .platform_data = &zeus_pcmcia_info,
456 },
457};
458
459static struct platform_device *zeus_devices[] __initdata = {
460 &zeus_serial_device,
461 &zeus_mtd_devices[0],
462 &zeus_dm9k0_device,
463 &zeus_dm9k1_device,
464 &zeus_sram_device,
465 &pxa2xx_spi_ssp3_device,
466 &zeus_leds_device,
467 &zeus_pcmcia_device,
468};
469
470/* AC'97 */
471static pxa2xx_audio_ops_t zeus_ac97_info = {
472 .reset_gpio = 95,
473};
474
475
476/*
477 * USB host
478 */
479
480static int zeus_ohci_init(struct device *dev)
481{
482 int err;
483
484 /* Switch on port 2. */
485 if ((err = gpio_request(ZEUS_USB2_PWREN_GPIO, "USB2_PWREN"))) {
486 dev_err(dev, "Can't request USB2_PWREN\n");
487 return err;
488 }
489
490 if ((err = gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 1))) {
491 gpio_free(ZEUS_USB2_PWREN_GPIO);
492 dev_err(dev, "Can't enable USB2_PWREN\n");
493 return err;
494 }
495
496 /* Port 2 is shared between host and client interface. */
497 UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
498
499 return 0;
500}
501
502static void zeus_ohci_exit(struct device *dev)
503{
504 /* Power-off port 2 */
505 gpio_direction_output(ZEUS_USB2_PWREN_GPIO, 0);
506 gpio_free(ZEUS_USB2_PWREN_GPIO);
507}
508
509static struct pxaohci_platform_data zeus_ohci_platform_data = {
510 .port_mode = PMM_NPS_MODE,
511 .flags = ENABLE_PORT_ALL | POWER_CONTROL_LOW | POWER_SENSE_LOW,
512 .init = zeus_ohci_init,
513 .exit = zeus_ohci_exit,
514};
515
516/*
517 * Flat Panel
518 */
519
520static void zeus_lcd_power(int on, struct fb_var_screeninfo *si)
521{
522 gpio_set_value(ZEUS_LCD_EN_GPIO, on);
523}
524
525static void zeus_backlight_power(int on)
526{
527 gpio_set_value(ZEUS_BKLEN_GPIO, on);
528}
529
530static int zeus_setup_fb_gpios(void)
531{
532 int err;
533
534 if ((err = gpio_request(ZEUS_LCD_EN_GPIO, "LCD_EN")))
535 goto out_err;
536
537 if ((err = gpio_direction_output(ZEUS_LCD_EN_GPIO, 0)))
538 goto out_err_lcd;
539
540 if ((err = gpio_request(ZEUS_BKLEN_GPIO, "BKLEN")))
541 goto out_err_lcd;
542
543 if ((err = gpio_direction_output(ZEUS_BKLEN_GPIO, 0)))
544 goto out_err_bkl;
545
546 return 0;
547
548out_err_bkl:
549 gpio_free(ZEUS_BKLEN_GPIO);
550out_err_lcd:
551 gpio_free(ZEUS_LCD_EN_GPIO);
552out_err:
553 return err;
554}
555
556static struct pxafb_mode_info zeus_fb_mode_info[] = {
557 {
558 .pixclock = 39722,
559
560 .xres = 640,
561 .yres = 480,
562
563 .bpp = 16,
564
565 .hsync_len = 63,
566 .left_margin = 16,
567 .right_margin = 81,
568
569 .vsync_len = 2,
570 .upper_margin = 12,
571 .lower_margin = 31,
572
573 .sync = 0,
574 },
575};
576
577static struct pxafb_mach_info zeus_fb_info = {
578 .modes = zeus_fb_mode_info,
579 .num_modes = 1,
580 .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
581 .pxafb_lcd_power = zeus_lcd_power,
582 .pxafb_backlight_power = zeus_backlight_power,
583};
584
585/*
586 * MMC/SD Device
587 *
588 * The card detect interrupt isn't debounced so we delay it by 250ms
589 * to give the card a chance to fully insert/eject.
590 */
591
592static struct pxamci_platform_data zeus_mci_platform_data = {
593 .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
594 .detect_delay = HZ/4,
595 .gpio_card_detect = ZEUS_MMC_CD_GPIO,
596 .gpio_card_ro = ZEUS_MMC_WP_GPIO,
597 .gpio_card_ro_invert = 1,
598 .gpio_power = -1
599};
600
601/*
602 * USB Device Controller
603 */
604static void zeus_udc_command(int cmd)
605{
606 switch (cmd) {
607 case PXA2XX_UDC_CMD_DISCONNECT:
608 pr_info("zeus: disconnecting USB client\n");
609 UP2OCR = UP2OCR_HXOE | UP2OCR_HXS | UP2OCR_DMPDE | UP2OCR_DPPDE;
610 break;
611
612 case PXA2XX_UDC_CMD_CONNECT:
613 pr_info("zeus: connecting USB client\n");
614 UP2OCR = UP2OCR_HXOE | UP2OCR_DPPUE;
615 break;
616 }
617}
618
619static struct pxa2xx_udc_mach_info zeus_udc_info = {
620 .udc_command = zeus_udc_command,
621};
622
623static void zeus_power_off(void)
624{
625 local_irq_disable();
626 pxa27x_cpu_suspend(PWRMODE_DEEPSLEEP);
627}
628
629int zeus_get_pcb_info(struct i2c_client *client, unsigned gpio,
630 unsigned ngpio, void *context)
631{
632 int i;
633 u8 pcb_info = 0;
634
635 for (i = 0; i < 8; i++) {
636 int pcb_bit = gpio + i + 8;
637
638 if (gpio_request(pcb_bit, "pcb info")) {
639 dev_err(&client->dev, "Can't request pcb info %d\n", i);
640 continue;
641 }
642
643 if (gpio_direction_input(pcb_bit)) {
644 dev_err(&client->dev, "Can't read pcb info %d\n", i);
645 gpio_free(pcb_bit);
646 continue;
647 }
648
649 pcb_info |= !!gpio_get_value(pcb_bit) << i;
650
651 gpio_free(pcb_bit);
652 }
653
654 dev_info(&client->dev, "Zeus PCB version %d issue %d\n",
655 pcb_info >> 4, pcb_info & 0xf);
656
657 return 0;
658}
659
660static struct pca953x_platform_data zeus_pca953x_pdata[] = {
661 [0] = { .gpio_base = ZEUS_EXT0_GPIO_BASE, },
662 [1] = {
663 .gpio_base = ZEUS_EXT1_GPIO_BASE,
664 .setup = zeus_get_pcb_info,
665 },
666 [2] = { .gpio_base = ZEUS_USER_GPIO_BASE, },
667};
668
669static struct i2c_board_info __initdata zeus_i2c_devices[] = {
670 {
671 I2C_BOARD_INFO("pca9535", 0x21),
672 .platform_data = &zeus_pca953x_pdata[0],
673 },
674 {
675 I2C_BOARD_INFO("pca9535", 0x22),
676 .platform_data = &zeus_pca953x_pdata[1],
677 },
678 {
679 I2C_BOARD_INFO("pca9535", 0x20),
680 .platform_data = &zeus_pca953x_pdata[2],
681 .irq = gpio_to_irq(ZEUS_EXTGPIO_GPIO),
682 },
683 { I2C_BOARD_INFO("lm75a", 0x48) },
684 { I2C_BOARD_INFO("24c01", 0x50) },
685 { I2C_BOARD_INFO("isl1208", 0x6f) },
686};
687
688static mfp_cfg_t zeus_pin_config[] __initdata = {
689 GPIO15_nCS_1,
690 GPIO78_nCS_2,
691 GPIO80_nCS_4,
692 GPIO33_nCS_5,
693
694 GPIO22_GPIO,
695 GPIO32_MMC_CLK,
696 GPIO92_MMC_DAT_0,
697 GPIO109_MMC_DAT_1,
698 GPIO110_MMC_DAT_2,
699 GPIO111_MMC_DAT_3,
700 GPIO112_MMC_CMD,
701
702 GPIO88_USBH1_PWR,
703 GPIO89_USBH1_PEN,
704 GPIO119_USBH2_PWR,
705 GPIO120_USBH2_PEN,
706
707 GPIO86_LCD_LDD_16,
708 GPIO87_LCD_LDD_17,
709
710 GPIO102_GPIO,
711 GPIO104_CIF_DD_2,
712 GPIO105_CIF_DD_1,
713
714 GPIO48_nPOE,
715 GPIO49_nPWE,
716 GPIO50_nPIOR,
717 GPIO51_nPIOW,
718 GPIO85_nPCE_1,
719 GPIO54_nPCE_2,
720 GPIO79_PSKTSEL,
721 GPIO55_nPREG,
722 GPIO56_nPWAIT,
723 GPIO57_nIOIS16,
724 GPIO36_GPIO, /* CF CD */
725 GPIO97_GPIO, /* CF PWREN */
726 GPIO99_GPIO, /* CF RDY */
727};
728
729static void __init zeus_init(void)
730{
731 u16 dm9000_msc = 0xe279;
732
733 system_rev = __raw_readw(ZEUS_CPLD_VERSION);
734 pr_info("Zeus CPLD V%dI%d\n", (system_rev & 0xf0) >> 4, (system_rev & 0x0f));
735
736 /* Fix timings for dm9000s (CS1/CS2)*/
737 MSC0 = (MSC0 & 0xffff) | (dm9000_msc << 16);
738 MSC1 = (MSC1 & 0xffff0000) | dm9000_msc;
739
740 pm_power_off = zeus_power_off;
741
742 pxa2xx_mfp_config(ARRAY_AND_SIZE(zeus_pin_config));
743
744 platform_add_devices(zeus_devices, ARRAY_SIZE(zeus_devices));
745
746 pxa_set_ohci_info(&zeus_ohci_platform_data);
747
748 if (zeus_setup_fb_gpios())
749 pr_err("Failed to setup fb gpios\n");
750 else
751 set_pxa_fb_info(&zeus_fb_info);
752
753 pxa_set_mci_info(&zeus_mci_platform_data);
754 pxa_set_udc_info(&zeus_udc_info);
755 pxa_set_ac97_info(&zeus_ac97_info);
756 pxa_set_i2c_info(NULL);
757 i2c_register_board_info(0, ARRAY_AND_SIZE(zeus_i2c_devices));
758}
759
760static struct map_desc zeus_io_desc[] __initdata = {
761 {
762 .virtual = ZEUS_CPLD_VERSION,
763 .pfn = __phys_to_pfn(ZEUS_CPLD_VERSION_PHYS),
764 .length = 0x1000,
765 .type = MT_DEVICE,
766 },
767 {
768 .virtual = ZEUS_CPLD_ISA_IRQ,
769 .pfn = __phys_to_pfn(ZEUS_CPLD_ISA_IRQ_PHYS),
770 .length = 0x1000,
771 .type = MT_DEVICE,
772 },
773 {
774 .virtual = ZEUS_CPLD_CONTROL,
775 .pfn = __phys_to_pfn(ZEUS_CPLD_CONTROL_PHYS),
776 .length = 0x1000,
777 .type = MT_DEVICE,
778 },
779 {
780 .virtual = ZEUS_CPLD_EXTWDOG,
781 .pfn = __phys_to_pfn(ZEUS_CPLD_EXTWDOG_PHYS),
782 .length = 0x1000,
783 .type = MT_DEVICE,
784 },
785 {
786 .virtual = ZEUS_PC104IO,
787 .pfn = __phys_to_pfn(ZEUS_PC104IO_PHYS),
788 .length = 0x00800000,
789 .type = MT_DEVICE,
790 },
791};
792
793static void __init zeus_map_io(void)
794{
795 pxa_map_io();
796
797 iotable_init(zeus_io_desc, ARRAY_SIZE(zeus_io_desc));
798
799 /* Clear PSPR to ensure a full restart on wake-up. */
800 PMCR = PSPR = 0;
801
802 /* enable internal 32.768Khz oscillator (ignore OSCC_OOK) */
803 OSCC |= OSCC_OON;
804
805 /* Some clock cycles later (from OSCC_ON), programme PCFR (OPDE...).
806 * float chip selects and PCMCIA */
807 PCFR = PCFR_OPDE | PCFR_DC_EN | PCFR_FS | PCFR_FP;
808}
809
810MACHINE_START(ARCOM_ZEUS, "Arcom ZEUS")
811 /* Maintainer: Marc Zyngier <maz@misterjones.org> */
812 .phys_io = 0x40000000,
813 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc),
814 .boot_params = 0xa0000100,
815 .map_io = zeus_map_io,
816 .init_irq = zeus_init_irq,
817 .timer = &pxa_timer,
818 .init_machine = zeus_init,
819MACHINE_END
820
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index c48e1f2c3349..ee5e392430e8 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -70,7 +70,7 @@ config MACH_REALVIEW_PBX
70 bool "Support RealView/PBX platform" 70 bool "Support RealView/PBX platform"
71 select ARM_GIC 71 select ARM_GIC
72 select HAVE_PATA_PLATFORM 72 select HAVE_PATA_PLATFORM
73 select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !HIGH_PHYS_OFFSET 73 select ARCH_SPARSEMEM_ENABLE if CPU_V7 && !REALVIEW_HIGH_PHYS_OFFSET
74 select ZONE_DMA if SPARSEMEM 74 select ZONE_DMA if SPARSEMEM
75 help 75 help
76 Include support for the ARM(R) RealView PBX platform. 76 Include support for the ARM(R) RealView PBX platform.
diff --git a/arch/arm/mach-s3c24a0/include/mach/memory.h b/arch/arm/mach-s3c24a0/include/mach/memory.h
index 585211ca0187..7d74fd5c8d66 100644
--- a/arch/arm/mach-s3c24a0/include/mach/memory.h
+++ b/arch/arm/mach-s3c24a0/include/mach/memory.h
@@ -15,5 +15,7 @@
15 15
16#define __virt_to_bus(x) __virt_to_phys(x) 16#define __virt_to_bus(x) __virt_to_phys(x)
17#define __bus_to_virt(x) __phys_to_virt(x) 17#define __bus_to_virt(x) __phys_to_virt(x)
18#define __pfn_to_bus(x) __pfn_to_phys(x)
19#define __bus_to_pfn(x) __phys_to_pfn(x)
18 20
19#endif 21#endif
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index 03a7f3857c5e..b17d52f7cc48 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -4,6 +4,7 @@ menu "SA11x0 Implementations"
4 4
5config SA1100_ASSABET 5config SA1100_ASSABET
6 bool "Assabet" 6 bool "Assabet"
7 select CPU_FREQ_SA1110
7 help 8 help
8 Say Y here if you are using the Intel(R) StrongARM(R) SA-1110 9 Say Y here if you are using the Intel(R) StrongARM(R) SA-1110
9 Microprocessor Development Board (also known as the Assabet). 10 Microprocessor Development Board (also known as the Assabet).
@@ -19,6 +20,7 @@ config ASSABET_NEPONSET
19 20
20config SA1100_CERF 21config SA1100_CERF
21 bool "CerfBoard" 22 bool "CerfBoard"
23 select CPU_FREQ_SA1110
22 help 24 help
23 The Intrinsyc CerfBoard is based on the StrongARM 1110 (Discontinued). 25 The Intrinsyc CerfBoard is based on the StrongARM 1110 (Discontinued).
24 More information is available at: 26 More information is available at:
@@ -45,6 +47,7 @@ endchoice
45 47
46config SA1100_COLLIE 48config SA1100_COLLIE
47 bool "Sharp Zaurus SL5500" 49 bool "Sharp Zaurus SL5500"
50 # FIXME: select CPU_FREQ_SA11x0
48 select SHARP_LOCOMO 51 select SHARP_LOCOMO
49 select SHARP_SCOOP 52 select SHARP_SCOOP
50 select SHARP_PARAM 53 select SHARP_PARAM
@@ -54,6 +57,7 @@ config SA1100_COLLIE
54config SA1100_H3100 57config SA1100_H3100
55 bool "Compaq iPAQ H3100" 58 bool "Compaq iPAQ H3100"
56 select HTC_EGPIO 59 select HTC_EGPIO
60 select CPU_FREQ_SA1100
57 help 61 help
58 Say Y here if you intend to run this kernel on the Compaq iPAQ 62 Say Y here if you intend to run this kernel on the Compaq iPAQ
59 H3100 handheld computer. Information about this machine and the 63 H3100 handheld computer. Information about this machine and the
@@ -64,6 +68,7 @@ config SA1100_H3100
64config SA1100_H3600 68config SA1100_H3600
65 bool "Compaq iPAQ H3600/H3700" 69 bool "Compaq iPAQ H3600/H3700"
66 select HTC_EGPIO 70 select HTC_EGPIO
71 select CPU_FREQ_SA1100
67 help 72 help
68 Say Y here if you intend to run this kernel on the Compaq iPAQ 73 Say Y here if you intend to run this kernel on the Compaq iPAQ
69 H3600 handheld computer. Information about this machine and the 74 H3600 handheld computer. Information about this machine and the
@@ -74,6 +79,7 @@ config SA1100_H3600
74config SA1100_BADGE4 79config SA1100_BADGE4
75 bool "HP Labs BadgePAD 4" 80 bool "HP Labs BadgePAD 4"
76 select SA1111 81 select SA1111
82 select CPU_FREQ_SA1100
77 help 83 help
78 Say Y here if you want to build a kernel for the HP Laboratories 84 Say Y here if you want to build a kernel for the HP Laboratories
79 BadgePAD 4. 85 BadgePAD 4.
@@ -81,6 +87,7 @@ config SA1100_BADGE4
81config SA1100_JORNADA720 87config SA1100_JORNADA720
82 bool "HP Jornada 720" 88 bool "HP Jornada 720"
83 select SA1111 89 select SA1111
90 # FIXME: select CPU_FREQ_SA11x0
84 help 91 help
85 Say Y here if you want to build a kernel for the HP Jornada 720 92 Say Y here if you want to build a kernel for the HP Jornada 720
86 handheld computer. See <http://www.hp.com/jornada/products/720> 93 handheld computer. See <http://www.hp.com/jornada/products/720>
@@ -98,12 +105,14 @@ config SA1100_JORNADA720_SSP
98 105
99config SA1100_HACKKIT 106config SA1100_HACKKIT
100 bool "HackKit Core CPU Board" 107 bool "HackKit Core CPU Board"
108 select CPU_FREQ_SA1100
101 help 109 help
102 Say Y here to support the HackKit Core CPU Board 110 Say Y here to support the HackKit Core CPU Board
103 <http://hackkit.eletztrick.de>; 111 <http://hackkit.eletztrick.de>;
104 112
105config SA1100_LART 113config SA1100_LART
106 bool "LART" 114 bool "LART"
115 select CPU_FREQ_SA1100
107 help 116 help
108 Say Y here if you are using the Linux Advanced Radio Terminal 117 Say Y here if you are using the Linux Advanced Radio Terminal
109 (also known as the LART). See <http://www.lartmaker.nl/> for 118 (also known as the LART). See <http://www.lartmaker.nl/> for
@@ -111,6 +120,7 @@ config SA1100_LART
111 120
112config SA1100_PLEB 121config SA1100_PLEB
113 bool "PLEB" 122 bool "PLEB"
123 select CPU_FREQ_SA1100
114 help 124 help
115 Say Y here if you are using version 1 of the Portable Linux 125 Say Y here if you are using version 1 of the Portable Linux
116 Embedded Board (also known as PLEB). 126 Embedded Board (also known as PLEB).
@@ -119,6 +129,7 @@ config SA1100_PLEB
119 129
120config SA1100_SHANNON 130config SA1100_SHANNON
121 bool "Shannon" 131 bool "Shannon"
132 select CPU_FREQ_SA1100
122 help 133 help
123 The Shannon (also known as a Tuxscreen, and also as a IS2630) was a 134 The Shannon (also known as a Tuxscreen, and also as a IS2630) was a
124 limited edition webphone produced by Philips. The Shannon is a SA1100 135 limited edition webphone produced by Philips. The Shannon is a SA1100
@@ -127,6 +138,7 @@ config SA1100_SHANNON
127 138
128config SA1100_SIMPAD 139config SA1100_SIMPAD
129 bool "Simpad" 140 bool "Simpad"
141 select CPU_FREQ_SA1110
130 help 142 help
131 The SIEMENS webpad SIMpad is based on the StrongARM 1110. There 143 The SIEMENS webpad SIMpad is based on the StrongARM 1110. There
132 are two different versions CL4 and SL4. CL4 has 32MB RAM and 16MB 144 are two different versions CL4 and SL4. CL4 has 32MB RAM and 16MB
@@ -145,3 +157,4 @@ config SA1100_SSP
145endmenu 157endmenu
146 158
147endif 159endif
160
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 9faea1511c1f..3c1fcd696714 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -58,7 +58,6 @@ static const unsigned short cclk_frequency_100khz[NR_FREQS] = {
58 2802 /* 280.2 MHz */ 58 2802 /* 280.2 MHz */
59}; 59};
60 60
61#if defined(CONFIG_CPU_FREQ_SA1100) || defined(CONFIG_CPU_FREQ_SA1110)
62/* rounds up(!) */ 61/* rounds up(!) */
63unsigned int sa11x0_freq_to_ppcr(unsigned int khz) 62unsigned int sa11x0_freq_to_ppcr(unsigned int khz)
64{ 63{
@@ -110,17 +109,6 @@ unsigned int sa11x0_getspeed(unsigned int cpu)
110 return cclk_frequency_100khz[PPCR & 0xf] * 100; 109 return cclk_frequency_100khz[PPCR & 0xf] * 100;
111} 110}
112 111
113#else
114/*
115 * We still need to provide this so building without cpufreq works.
116 */
117unsigned int cpufreq_get(unsigned int cpu)
118{
119 return cclk_frequency_100khz[PPCR & 0xf] * 100;
120}
121EXPORT_SYMBOL(cpufreq_get);
122#endif
123
124/* 112/*
125 * This is the SA11x0 sched_clock implementation. This has 113 * This is the SA11x0 sched_clock implementation. This has
126 * a resolution of 271ns, and a maximum value of 32025597s (370 days). 114 * a resolution of 271ns, and a maximum value of 32025597s (370 days).
diff --git a/arch/arm/mach-w90x900/include/mach/nuc900_spi.h b/arch/arm/mach-w90x900/include/mach/nuc900_spi.h
new file mode 100644
index 000000000000..bd94819e314f
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/nuc900_spi.h
@@ -0,0 +1,35 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/nuc900_spi.h
3 *
4 * Copyright (c) 2009 Nuvoton technology corporation.
5 *
6 * Wan ZongShun <mcuos.com@gmail.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation;version 2 of the License.
11 *
12 */
13
14#ifndef __ASM_ARCH_SPI_H
15#define __ASM_ARCH_SPI_H
16
17extern void mfp_set_groupg(struct device *dev);
18
19struct nuc900_spi_info {
20 unsigned int num_cs;
21 unsigned int lsb;
22 unsigned int txneg;
23 unsigned int rxneg;
24 unsigned int divider;
25 unsigned int sleep;
26 unsigned int txnum;
27 unsigned int txbitlen;
28 int bus_num;
29};
30
31struct nuc900_spi_chip {
32 unsigned char bits_per_word;
33};
34
35#endif /* __ASM_ARCH_SPI_H */
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index 2b7996401b0f..f5abc51c5a07 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -54,7 +54,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
54 * We enforce the MAP_FIXED case. 54 * We enforce the MAP_FIXED case.
55 */ 55 */
56 if (flags & MAP_FIXED) { 56 if (flags & MAP_FIXED) {
57 if (aliasing && flags & MAP_SHARED && addr & (SHMLBA - 1)) 57 if (aliasing && flags & MAP_SHARED &&
58 (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1))
58 return -EINVAL; 59 return -EINVAL;
59 return addr; 60 return addr;
60 } 61 }
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 4cbca9da1505..996cbac6932c 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_ARCH_MX1) += iomux-mx1-mx2.o dma-mx1-mx2.o
9obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o 9obj-$(CONFIG_ARCH_MX2) += iomux-mx1-mx2.o dma-mx1-mx2.o
10obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o 10obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
11obj-$(CONFIG_MXC_PWM) += pwm.o 11obj-$(CONFIG_MXC_PWM) += pwm.o
12obj-$(CONFIG_USB_EHCI_MXC) += ehci.o
12obj-$(CONFIG_MXC_ULPI) += ulpi.o 13obj-$(CONFIG_MXC_ULPI) += ulpi.o
13obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o 14obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o
14obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o 15obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o
diff --git a/arch/arm/plat-mxc/ehci.c b/arch/arm/plat-mxc/ehci.c
new file mode 100644
index 000000000000..41599be882e8
--- /dev/null
+++ b/arch/arm/plat-mxc/ehci.c
@@ -0,0 +1,92 @@
1/*
2 * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#include <linux/platform_device.h>
20#include <linux/io.h>
21
22#include <mach/hardware.h>
23#include <mach/mxc_ehci.h>
24
25#define USBCTRL_OTGBASE_OFFSET 0x600
26
27#define MX31_OTG_SIC_SHIFT 29
28#define MX31_OTG_SIC_MASK (0xf << MX31_OTG_SIC_SHIFT)
29#define MX31_OTG_PM_BIT (1 << 24)
30
31#define MX31_H2_SIC_SHIFT 21
32#define MX31_H2_SIC_MASK (0xf << MX31_H2_SIC_SHIFT)
33#define MX31_H2_PM_BIT (1 << 16)
34#define MX31_H2_DT_BIT (1 << 5)
35
36#define MX31_H1_SIC_SHIFT 13
37#define MX31_H1_SIC_MASK (0xf << MX31_H1_SIC_SHIFT)
38#define MX31_H1_PM_BIT (1 << 8)
39#define MX31_H1_DT_BIT (1 << 4)
40
41int mxc_set_usbcontrol(int port, unsigned int flags)
42{
43 unsigned int v;
44
45 if (cpu_is_mx31()) {
46 v = readl(IO_ADDRESS(MX31_OTG_BASE_ADDR +
47 USBCTRL_OTGBASE_OFFSET));
48
49 switch (port) {
50 case 0: /* OTG port */
51 v &= ~(MX31_OTG_SIC_MASK | MX31_OTG_PM_BIT);
52 v |= (flags & MXC_EHCI_INTERFACE_MASK)
53 << MX31_OTG_SIC_SHIFT;
54 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
55 v |= MX31_OTG_PM_BIT;
56
57 break;
58 case 1: /* H1 port */
59 v &= ~(MX31_H1_SIC_MASK | MX31_H1_PM_BIT);
60 v |= (flags & MXC_EHCI_INTERFACE_MASK)
61 << MX31_H1_SIC_SHIFT;
62 if (flags & MXC_EHCI_POWER_PINS_ENABLED)
63 v |= MX31_H1_PM_BIT;
64
65 if (!(flags & MXC_EHCI_TTL_ENABLED))
66 v |= MX31_H1_DT_BIT;
67
68 break;
69 case 2: /* H2 port */
70 v &= ~(MX31_H2_SIC_MASK | MX31_H2_PM_BIT);
71 v |= (flags & MXC_EHCI_INTERFACE_MASK)
72 << MX31_H2_SIC_SHIFT;
73 if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
74 v |= MX31_H2_PM_BIT;
75
76 if (!(flags & MXC_EHCI_TTL_ENABLED))
77 v |= MX31_H2_DT_BIT;
78
79 break;
80 }
81
82 writel(v, IO_ADDRESS(MX31_OTG_BASE_ADDR +
83 USBCTRL_OTGBASE_OFFSET));
84 return 0;
85 }
86
87 printk(KERN_WARNING
88 "%s() unable to setup USBCONTROL for this CPU\n", __func__);
89 return -EINVAL;
90}
91EXPORT_SYMBOL(mxc_set_usbcontrol);
92
diff --git a/arch/arm/plat-mxc/include/mach/mxc_ehci.h b/arch/arm/plat-mxc/include/mach/mxc_ehci.h
new file mode 100644
index 000000000000..8f796239393e
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mxc_ehci.h
@@ -0,0 +1,37 @@
1#ifndef __INCLUDE_ASM_ARCH_MXC_EHCI_H
2#define __INCLUDE_ASM_ARCH_MXC_EHCI_H
3
4/* values for portsc field */
5#define MXC_EHCI_PHY_LOW_POWER_SUSPEND (1 << 23)
6#define MXC_EHCI_FORCE_FS (1 << 24)
7#define MXC_EHCI_UTMI_8BIT (0 << 28)
8#define MXC_EHCI_UTMI_16BIT (1 << 28)
9#define MXC_EHCI_SERIAL (1 << 29)
10#define MXC_EHCI_MODE_UTMI (0 << 30)
11#define MXC_EHCI_MODE_PHILIPS (1 << 30)
12#define MXC_EHCI_MODE_ULPI (2 << 30)
13#define MXC_EHCI_MODE_SERIAL (3 << 30)
14
15/* values for flags field */
16#define MXC_EHCI_INTERFACE_DIFF_UNI (0 << 0)
17#define MXC_EHCI_INTERFACE_DIFF_BI (1 << 0)
18#define MXC_EHCI_INTERFACE_SINGLE_UNI (2 << 0)
19#define MXC_EHCI_INTERFACE_SINGLE_BI (3 << 0)
20#define MXC_EHCI_INTERFACE_MASK (0xf)
21
22#define MXC_EHCI_POWER_PINS_ENABLED (1 << 5)
23#define MXC_EHCI_TTL_ENABLED (1 << 6)
24
25struct mxc_usbh_platform_data {
26 int (*init)(struct platform_device *pdev);
27 int (*exit)(struct platform_device *pdev);
28
29 unsigned int portsc;
30 unsigned int flags;
31 struct otg_transceiver *otg;
32};
33
34int mxc_set_usbcontrol(int port, unsigned int flags);
35
36#endif /* __INCLUDE_ASM_ARCH_MXC_EHCI_H */
37
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index f348ddfb0492..e2ea04a4c8a1 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -27,6 +27,7 @@ config ARCH_OMAP4
27 bool "TI OMAP4" 27 bool "TI OMAP4"
28 select CPU_V7 28 select CPU_V7
29 select ARM_GIC 29 select ARM_GIC
30 select COMMON_CLKDEV
30 31
31endchoice 32endchoice
32 33
@@ -42,28 +43,6 @@ config OMAP_DEBUG_LEDS
42 depends on OMAP_DEBUG_DEVICES 43 depends on OMAP_DEBUG_DEVICES
43 default y if LEDS || LEDS_OMAP_DEBUG 44 default y if LEDS || LEDS_OMAP_DEBUG
44 45
45config OMAP_DEBUG_POWERDOMAIN
46 bool "Emit debug messages from powerdomain layer"
47 depends on ARCH_OMAP2 || ARCH_OMAP3
48 help
49 Say Y here if you want to compile in powerdomain layer
50 debugging messages for OMAP2/3. These messages can
51 provide more detail as to why some powerdomain calls
52 may be failing, and will also emit a descriptive message
53 for every powerdomain register write. However, the
54 extra detail costs some memory.
55
56config OMAP_DEBUG_CLOCKDOMAIN
57 bool "Emit debug messages from clockdomain layer"
58 depends on ARCH_OMAP2 || ARCH_OMAP3
59 help
60 Say Y here if you want to compile in clockdomain layer
61 debugging messages for OMAP2/3. These messages can
62 provide more detail as to why some clockdomain calls
63 may be failing, and will also emit a descriptive message
64 for every clockdomain register write. However, the
65 extra detail costs some memory.
66
67config OMAP_RESET_CLOCKS 46config OMAP_RESET_CLOCKS
68 bool "Reset unused clocks during boot" 47 bool "Reset unused clocks during boot"
69 depends on ARCH_OMAP 48 depends on ARCH_OMAP
@@ -78,28 +57,28 @@ config OMAP_RESET_CLOCKS
78 57
79config OMAP_MUX 58config OMAP_MUX
80 bool "OMAP multiplexing support" 59 bool "OMAP multiplexing support"
81 depends on ARCH_OMAP 60 depends on ARCH_OMAP
82 default y 61 default y
83 help 62 help
84 Pin multiplexing support for OMAP boards. If your bootloader 63 Pin multiplexing support for OMAP boards. If your bootloader
85 sets the multiplexing correctly, say N. Otherwise, or if unsure, 64 sets the multiplexing correctly, say N. Otherwise, or if unsure,
86 say Y. 65 say Y.
87 66
88config OMAP_MUX_DEBUG 67config OMAP_MUX_DEBUG
89 bool "Multiplexing debug output" 68 bool "Multiplexing debug output"
90 depends on OMAP_MUX 69 depends on OMAP_MUX
91 help 70 help
92 Makes the multiplexing functions print out a lot of debug info. 71 Makes the multiplexing functions print out a lot of debug info.
93 This is useful if you want to find out the correct values of the 72 This is useful if you want to find out the correct values of the
94 multiplexing registers. 73 multiplexing registers.
95 74
96config OMAP_MUX_WARNINGS 75config OMAP_MUX_WARNINGS
97 bool "Warn about pins the bootloader didn't set up" 76 bool "Warn about pins the bootloader didn't set up"
98 depends on OMAP_MUX 77 depends on OMAP_MUX
99 default y 78 default y
100 help 79 help
101 Choose Y here to warn whenever driver initialization logic needs 80 Choose Y here to warn whenever driver initialization logic needs
102 to change the pin multiplexing setup. When there are no warnings 81 to change the pin multiplexing setup. When there are no warnings
103 printed, it's safe to deselect OMAP_MUX for your product. 82 printed, it's safe to deselect OMAP_MUX for your product.
104 83
105config OMAP_MCBSP 84config OMAP_MCBSP
@@ -125,7 +104,7 @@ config OMAP_IOMMU_DEBUG
125 tristate 104 tristate
126 105
127choice 106choice
128 prompt "System timer" 107 prompt "System timer"
129 default OMAP_MPU_TIMER 108 default OMAP_MPU_TIMER
130 109
131config OMAP_MPU_TIMER 110config OMAP_MPU_TIMER
@@ -148,11 +127,11 @@ config OMAP_32K_TIMER
148endchoice 127endchoice
149 128
150config OMAP_32K_TIMER_HZ 129config OMAP_32K_TIMER_HZ
151 int "Kernel internal timer frequency for 32KHz timer" 130 int "Kernel internal timer frequency for 32KHz timer"
152 range 32 1024 131 range 32 1024
153 depends on OMAP_32K_TIMER 132 depends on OMAP_32K_TIMER
154 default "128" 133 default "128"
155 help 134 help
156 Kernel internal timer frequency should be a divisor of 32768, 135 Kernel internal timer frequency should be a divisor of 32768,
157 such as 64 or 128. 136 such as 64 or 128.
158 137
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 681bfc37ebb2..89cafc937249 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -40,36 +40,10 @@ static struct clk_functions *arch_clock;
40 * clock framework is not up , it is defined here to avoid rework in 40 * clock framework is not up , it is defined here to avoid rework in
41 * every driver. Also dummy prcm reset function is added */ 41 * every driver. Also dummy prcm reset function is added */
42 42
43/* Dummy hooks only for OMAP4.For rest OMAPs, common clkdev is used */
44#if defined(CONFIG_ARCH_OMAP4)
45struct clk *clk_get(struct device *dev, const char *id)
46{
47 return NULL;
48}
49EXPORT_SYMBOL(clk_get);
50
51void clk_put(struct clk *clk)
52{
53}
54EXPORT_SYMBOL(clk_put);
55
56void omap2_clk_prepare_for_reboot(void)
57{
58}
59EXPORT_SYMBOL(omap2_clk_prepare_for_reboot);
60
61void omap_prcm_arch_reset(char mode)
62{
63}
64EXPORT_SYMBOL(omap_prcm_arch_reset);
65#endif
66int clk_enable(struct clk *clk) 43int clk_enable(struct clk *clk)
67{ 44{
68 unsigned long flags; 45 unsigned long flags;
69 int ret = 0; 46 int ret = 0;
70 if (cpu_is_omap44xx())
71 /* OMAP4 clk framework not supported yet */
72 return 0;
73 47
74 if (clk == NULL || IS_ERR(clk)) 48 if (clk == NULL || IS_ERR(clk))
75 return -EINVAL; 49 return -EINVAL;
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index cc050b3313bd..bf1eaf3a27d4 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -280,16 +280,18 @@ void __init omap2_set_globals_343x(void)
280#if defined(CONFIG_ARCH_OMAP4) 280#if defined(CONFIG_ARCH_OMAP4)
281static struct omap_globals omap4_globals = { 281static struct omap_globals omap4_globals = {
282 .class = OMAP443X_CLASS, 282 .class = OMAP443X_CLASS,
283 .tap = OMAP2_L4_IO_ADDRESS(0x4830a000), 283 .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
284 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE), 284 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
285 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE), 285 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
286 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE), 286 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
287 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
287}; 288};
288 289
289void __init omap2_set_globals_443x(void) 290void __init omap2_set_globals_443x(void)
290{ 291{
291 omap2_set_globals_tap(&omap4_globals); 292 omap2_set_globals_tap(&omap4_globals);
292 omap2_set_globals_control(&omap4_globals); 293 omap2_set_globals_control(&omap4_globals);
294 omap2_set_globals_prcm(&omap4_globals);
293} 295}
294#endif 296#endif
295 297
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
index 09c1107637f6..923c9621096b 100644
--- a/arch/arm/plat-omap/debug-devices.c
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/smc91x.h>
16 17
17#include <mach/hardware.h> 18#include <mach/hardware.h>
18 19
@@ -24,6 +25,12 @@
24 * platforms include H2, H3, H4, and Perseus2. 25 * platforms include H2, H3, H4, and Perseus2.
25 */ 26 */
26 27
28static struct smc91x_platdata smc91x_info = {
29 .flags = SMC91X_USE_16BIT | SMC91X_NOWAIT,
30 .leda = RPC_LED_100_10,
31 .ledb = RPC_LED_TX_RX,
32};
33
27static struct resource smc91x_resources[] = { 34static struct resource smc91x_resources[] = {
28 [0] = { 35 [0] = {
29 .flags = IORESOURCE_MEM, 36 .flags = IORESOURCE_MEM,
@@ -36,6 +43,9 @@ static struct resource smc91x_resources[] = {
36static struct platform_device smc91x_device = { 43static struct platform_device smc91x_device = {
37 .name = "smc91x", 44 .name = "smc91x",
38 .id = -1, 45 .id = -1,
46 .dev = {
47 .platform_data = &smc91x_info,
48 },
39 .num_resources = ARRAY_SIZE(smc91x_resources), 49 .num_resources = ARRAY_SIZE(smc91x_resources),
40 .resource = smc91x_resources, 50 .resource = smc91x_resources,
41}; 51};
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index f86617869b38..30b5db73017a 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -242,6 +242,39 @@ fail:
242 242
243/*-------------------------------------------------------------------------*/ 243/*-------------------------------------------------------------------------*/
244 244
245#if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE)
246
247#ifdef CONFIG_ARCH_OMAP24XX
248#define OMAP_RNG_BASE 0x480A0000
249#else
250#define OMAP_RNG_BASE 0xfffe5000
251#endif
252
253static struct resource rng_resources[] = {
254 {
255 .start = OMAP_RNG_BASE,
256 .end = OMAP_RNG_BASE + 0x4f,
257 .flags = IORESOURCE_MEM,
258 },
259};
260
261static struct platform_device omap_rng_device = {
262 .name = "omap_rng",
263 .id = -1,
264 .num_resources = ARRAY_SIZE(rng_resources),
265 .resource = rng_resources,
266};
267
268static void omap_init_rng(void)
269{
270 (void) platform_device_register(&omap_rng_device);
271}
272#else
273static inline void omap_init_rng(void) {}
274#endif
275
276/*-------------------------------------------------------------------------*/
277
245/* Numbering for the SPI-capable controllers when used for SPI: 278/* Numbering for the SPI-capable controllers when used for SPI:
246 * spi = 1 279 * spi = 1
247 * uwire = 2 280 * uwire = 2
@@ -324,39 +357,6 @@ static void omap_init_wdt(void)
324static inline void omap_init_wdt(void) {} 357static inline void omap_init_wdt(void) {}
325#endif 358#endif
326 359
327/*-------------------------------------------------------------------------*/
328
329#if defined(CONFIG_HW_RANDOM_OMAP) || defined(CONFIG_HW_RANDOM_OMAP_MODULE)
330
331#ifdef CONFIG_ARCH_OMAP24XX
332#define OMAP_RNG_BASE 0x480A0000
333#else
334#define OMAP_RNG_BASE 0xfffe5000
335#endif
336
337static struct resource rng_resources[] = {
338 {
339 .start = OMAP_RNG_BASE,
340 .end = OMAP_RNG_BASE + 0x4f,
341 .flags = IORESOURCE_MEM,
342 },
343};
344
345static struct platform_device omap_rng_device = {
346 .name = "omap_rng",
347 .id = -1,
348 .num_resources = ARRAY_SIZE(rng_resources),
349 .resource = rng_resources,
350};
351
352static void omap_init_rng(void)
353{
354 (void) platform_device_register(&omap_rng_device);
355}
356#else
357static inline void omap_init_rng(void) {}
358#endif
359
360/* 360/*
361 * This gets called after board-specific INIT_MACHINE, and initializes most 361 * This gets called after board-specific INIT_MACHINE, and initializes most
362 * on-chip peripherals accessible on this board (except for few like USB): 362 * on-chip peripherals accessible on this board (except for few like USB):
@@ -384,9 +384,9 @@ static int __init omap_init_devices(void)
384 */ 384 */
385 omap_init_dsp(); 385 omap_init_dsp();
386 omap_init_kp(); 386 omap_init_kp();
387 omap_init_rng();
387 omap_init_uwire(); 388 omap_init_uwire();
388 omap_init_wdt(); 389 omap_init_wdt();
389 omap_init_rng();
390 return 0; 390 return 0;
391} 391}
392arch_initcall(omap_init_devices); 392arch_initcall(omap_init_devices);
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index d17375e06a1e..09d82b3c66ce 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -47,7 +47,6 @@ enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED };
47#endif 47#endif
48 48
49#define OMAP_DMA_ACTIVE 0x01 49#define OMAP_DMA_ACTIVE 0x01
50#define OMAP_DMA_CCR_EN (1 << 7)
51#define OMAP2_DMA_CSR_CLEAR_MASK 0xffe 50#define OMAP2_DMA_CSR_CLEAR_MASK 0xffe
52 51
53#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec) 52#define OMAP_FUNC_MUX_ARM_BASE (0xfffe1000 + 0xec)
@@ -1120,17 +1119,8 @@ int omap_dma_running(void)
1120{ 1119{
1121 int lch; 1120 int lch;
1122 1121
1123 /* 1122 if (cpu_class_is_omap1())
1124 * On OMAP1510, internal LCD controller will start the transfer 1123 if (omap_lcd_dma_running())
1125 * when it gets enabled, so assume DMA running if LCD enabled.
1126 */
1127 if (cpu_is_omap1510())
1128 if (omap_readw(0xfffec000 + 0x00) & (1 << 0))
1129 return 1;
1130
1131 /* Check if LCD DMA is running */
1132 if (cpu_is_omap16xx())
1133 if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
1134 return 1; 1124 return 1;
1135 1125
1136 for (lch = 0; lch < dma_chan_count; lch++) 1126 for (lch = 0; lch < dma_chan_count; lch++)
@@ -1990,377 +1980,6 @@ static struct irqaction omap24xx_dma_irq;
1990 1980
1991/*----------------------------------------------------------------------------*/ 1981/*----------------------------------------------------------------------------*/
1992 1982
1993static struct lcd_dma_info {
1994 spinlock_t lock;
1995 int reserved;
1996 void (*callback)(u16 status, void *data);
1997 void *cb_data;
1998
1999 int active;
2000 unsigned long addr, size;
2001 int rotate, data_type, xres, yres;
2002 int vxres;
2003 int mirror;
2004 int xscale, yscale;
2005 int ext_ctrl;
2006 int src_port;
2007 int single_transfer;
2008} lcd_dma;
2009
2010void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
2011 int data_type)
2012{
2013 lcd_dma.addr = addr;
2014 lcd_dma.data_type = data_type;
2015 lcd_dma.xres = fb_xres;
2016 lcd_dma.yres = fb_yres;
2017}
2018EXPORT_SYMBOL(omap_set_lcd_dma_b1);
2019
2020void omap_set_lcd_dma_src_port(int port)
2021{
2022 lcd_dma.src_port = port;
2023}
2024
2025void omap_set_lcd_dma_ext_controller(int external)
2026{
2027 lcd_dma.ext_ctrl = external;
2028}
2029EXPORT_SYMBOL(omap_set_lcd_dma_ext_controller);
2030
2031void omap_set_lcd_dma_single_transfer(int single)
2032{
2033 lcd_dma.single_transfer = single;
2034}
2035EXPORT_SYMBOL(omap_set_lcd_dma_single_transfer);
2036
2037void omap_set_lcd_dma_b1_rotation(int rotate)
2038{
2039 if (omap_dma_in_1510_mode()) {
2040 printk(KERN_ERR "DMA rotation is not supported in 1510 mode\n");
2041 BUG();
2042 return;
2043 }
2044 lcd_dma.rotate = rotate;
2045}
2046EXPORT_SYMBOL(omap_set_lcd_dma_b1_rotation);
2047
2048void omap_set_lcd_dma_b1_mirror(int mirror)
2049{
2050 if (omap_dma_in_1510_mode()) {
2051 printk(KERN_ERR "DMA mirror is not supported in 1510 mode\n");
2052 BUG();
2053 }
2054 lcd_dma.mirror = mirror;
2055}
2056EXPORT_SYMBOL(omap_set_lcd_dma_b1_mirror);
2057
2058void omap_set_lcd_dma_b1_vxres(unsigned long vxres)
2059{
2060 if (omap_dma_in_1510_mode()) {
2061 printk(KERN_ERR "DMA virtual resulotion is not supported "
2062 "in 1510 mode\n");
2063 BUG();
2064 }
2065 lcd_dma.vxres = vxres;
2066}
2067EXPORT_SYMBOL(omap_set_lcd_dma_b1_vxres);
2068
2069void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale)
2070{
2071 if (omap_dma_in_1510_mode()) {
2072 printk(KERN_ERR "DMA scale is not supported in 1510 mode\n");
2073 BUG();
2074 }
2075 lcd_dma.xscale = xscale;
2076 lcd_dma.yscale = yscale;
2077}
2078EXPORT_SYMBOL(omap_set_lcd_dma_b1_scale);
2079
2080static void set_b1_regs(void)
2081{
2082 unsigned long top, bottom;
2083 int es;
2084 u16 w;
2085 unsigned long en, fn;
2086 long ei, fi;
2087 unsigned long vxres;
2088 unsigned int xscale, yscale;
2089
2090 switch (lcd_dma.data_type) {
2091 case OMAP_DMA_DATA_TYPE_S8:
2092 es = 1;
2093 break;
2094 case OMAP_DMA_DATA_TYPE_S16:
2095 es = 2;
2096 break;
2097 case OMAP_DMA_DATA_TYPE_S32:
2098 es = 4;
2099 break;
2100 default:
2101 BUG();
2102 return;
2103 }
2104
2105 vxres = lcd_dma.vxres ? lcd_dma.vxres : lcd_dma.xres;
2106 xscale = lcd_dma.xscale ? lcd_dma.xscale : 1;
2107 yscale = lcd_dma.yscale ? lcd_dma.yscale : 1;
2108 BUG_ON(vxres < lcd_dma.xres);
2109
2110#define PIXADDR(x, y) (lcd_dma.addr + \
2111 ((y) * vxres * yscale + (x) * xscale) * es)
2112#define PIXSTEP(sx, sy, dx, dy) (PIXADDR(dx, dy) - PIXADDR(sx, sy) - es + 1)
2113
2114 switch (lcd_dma.rotate) {
2115 case 0:
2116 if (!lcd_dma.mirror) {
2117 top = PIXADDR(0, 0);
2118 bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
2119 /* 1510 DMA requires the bottom address to be 2 more
2120 * than the actual last memory access location. */
2121 if (omap_dma_in_1510_mode() &&
2122 lcd_dma.data_type == OMAP_DMA_DATA_TYPE_S32)
2123 bottom += 2;
2124 ei = PIXSTEP(0, 0, 1, 0);
2125 fi = PIXSTEP(lcd_dma.xres - 1, 0, 0, 1);
2126 } else {
2127 top = PIXADDR(lcd_dma.xres - 1, 0);
2128 bottom = PIXADDR(0, lcd_dma.yres - 1);
2129 ei = PIXSTEP(1, 0, 0, 0);
2130 fi = PIXSTEP(0, 0, lcd_dma.xres - 1, 1);
2131 }
2132 en = lcd_dma.xres;
2133 fn = lcd_dma.yres;
2134 break;
2135 case 90:
2136 if (!lcd_dma.mirror) {
2137 top = PIXADDR(0, lcd_dma.yres - 1);
2138 bottom = PIXADDR(lcd_dma.xres - 1, 0);
2139 ei = PIXSTEP(0, 1, 0, 0);
2140 fi = PIXSTEP(0, 0, 1, lcd_dma.yres - 1);
2141 } else {
2142 top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
2143 bottom = PIXADDR(0, 0);
2144 ei = PIXSTEP(0, 1, 0, 0);
2145 fi = PIXSTEP(1, 0, 0, lcd_dma.yres - 1);
2146 }
2147 en = lcd_dma.yres;
2148 fn = lcd_dma.xres;
2149 break;
2150 case 180:
2151 if (!lcd_dma.mirror) {
2152 top = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
2153 bottom = PIXADDR(0, 0);
2154 ei = PIXSTEP(1, 0, 0, 0);
2155 fi = PIXSTEP(0, 1, lcd_dma.xres - 1, 0);
2156 } else {
2157 top = PIXADDR(0, lcd_dma.yres - 1);
2158 bottom = PIXADDR(lcd_dma.xres - 1, 0);
2159 ei = PIXSTEP(0, 0, 1, 0);
2160 fi = PIXSTEP(lcd_dma.xres - 1, 1, 0, 0);
2161 }
2162 en = lcd_dma.xres;
2163 fn = lcd_dma.yres;
2164 break;
2165 case 270:
2166 if (!lcd_dma.mirror) {
2167 top = PIXADDR(lcd_dma.xres - 1, 0);
2168 bottom = PIXADDR(0, lcd_dma.yres - 1);
2169 ei = PIXSTEP(0, 0, 0, 1);
2170 fi = PIXSTEP(1, lcd_dma.yres - 1, 0, 0);
2171 } else {
2172 top = PIXADDR(0, 0);
2173 bottom = PIXADDR(lcd_dma.xres - 1, lcd_dma.yres - 1);
2174 ei = PIXSTEP(0, 0, 0, 1);
2175 fi = PIXSTEP(0, lcd_dma.yres - 1, 1, 0);
2176 }
2177 en = lcd_dma.yres;
2178 fn = lcd_dma.xres;
2179 break;
2180 default:
2181 BUG();
2182 return; /* Suppress warning about uninitialized vars */
2183 }
2184
2185 if (omap_dma_in_1510_mode()) {
2186 omap_writew(top >> 16, OMAP1510_DMA_LCD_TOP_F1_U);
2187 omap_writew(top, OMAP1510_DMA_LCD_TOP_F1_L);
2188 omap_writew(bottom >> 16, OMAP1510_DMA_LCD_BOT_F1_U);
2189 omap_writew(bottom, OMAP1510_DMA_LCD_BOT_F1_L);
2190
2191 return;
2192 }
2193
2194 /* 1610 regs */
2195 omap_writew(top >> 16, OMAP1610_DMA_LCD_TOP_B1_U);
2196 omap_writew(top, OMAP1610_DMA_LCD_TOP_B1_L);
2197 omap_writew(bottom >> 16, OMAP1610_DMA_LCD_BOT_B1_U);
2198 omap_writew(bottom, OMAP1610_DMA_LCD_BOT_B1_L);
2199
2200 omap_writew(en, OMAP1610_DMA_LCD_SRC_EN_B1);
2201 omap_writew(fn, OMAP1610_DMA_LCD_SRC_FN_B1);
2202
2203 w = omap_readw(OMAP1610_DMA_LCD_CSDP);
2204 w &= ~0x03;
2205 w |= lcd_dma.data_type;
2206 omap_writew(w, OMAP1610_DMA_LCD_CSDP);
2207
2208 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
2209 /* Always set the source port as SDRAM for now*/
2210 w &= ~(0x03 << 6);
2211 if (lcd_dma.callback != NULL)
2212 w |= 1 << 1; /* Block interrupt enable */
2213 else
2214 w &= ~(1 << 1);
2215 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2216
2217 if (!(lcd_dma.rotate || lcd_dma.mirror ||
2218 lcd_dma.vxres || lcd_dma.xscale || lcd_dma.yscale))
2219 return;
2220
2221 w = omap_readw(OMAP1610_DMA_LCD_CCR);
2222 /* Set the double-indexed addressing mode */
2223 w |= (0x03 << 12);
2224 omap_writew(w, OMAP1610_DMA_LCD_CCR);
2225
2226 omap_writew(ei, OMAP1610_DMA_LCD_SRC_EI_B1);
2227 omap_writew(fi >> 16, OMAP1610_DMA_LCD_SRC_FI_B1_U);
2228 omap_writew(fi, OMAP1610_DMA_LCD_SRC_FI_B1_L);
2229}
2230
2231static irqreturn_t lcd_dma_irq_handler(int irq, void *dev_id)
2232{
2233 u16 w;
2234
2235 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
2236 if (unlikely(!(w & (1 << 3)))) {
2237 printk(KERN_WARNING "Spurious LCD DMA IRQ\n");
2238 return IRQ_NONE;
2239 }
2240 /* Ack the IRQ */
2241 w |= (1 << 3);
2242 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2243 lcd_dma.active = 0;
2244 if (lcd_dma.callback != NULL)
2245 lcd_dma.callback(w, lcd_dma.cb_data);
2246
2247 return IRQ_HANDLED;
2248}
2249
2250int omap_request_lcd_dma(void (*callback)(u16 status, void *data),
2251 void *data)
2252{
2253 spin_lock_irq(&lcd_dma.lock);
2254 if (lcd_dma.reserved) {
2255 spin_unlock_irq(&lcd_dma.lock);
2256 printk(KERN_ERR "LCD DMA channel already reserved\n");
2257 BUG();
2258 return -EBUSY;
2259 }
2260 lcd_dma.reserved = 1;
2261 spin_unlock_irq(&lcd_dma.lock);
2262 lcd_dma.callback = callback;
2263 lcd_dma.cb_data = data;
2264 lcd_dma.active = 0;
2265 lcd_dma.single_transfer = 0;
2266 lcd_dma.rotate = 0;
2267 lcd_dma.vxres = 0;
2268 lcd_dma.mirror = 0;
2269 lcd_dma.xscale = 0;
2270 lcd_dma.yscale = 0;
2271 lcd_dma.ext_ctrl = 0;
2272 lcd_dma.src_port = 0;
2273
2274 return 0;
2275}
2276EXPORT_SYMBOL(omap_request_lcd_dma);
2277
2278void omap_free_lcd_dma(void)
2279{
2280 spin_lock(&lcd_dma.lock);
2281 if (!lcd_dma.reserved) {
2282 spin_unlock(&lcd_dma.lock);
2283 printk(KERN_ERR "LCD DMA is not reserved\n");
2284 BUG();
2285 return;
2286 }
2287 if (!enable_1510_mode)
2288 omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~1,
2289 OMAP1610_DMA_LCD_CCR);
2290 lcd_dma.reserved = 0;
2291 spin_unlock(&lcd_dma.lock);
2292}
2293EXPORT_SYMBOL(omap_free_lcd_dma);
2294
2295void omap_enable_lcd_dma(void)
2296{
2297 u16 w;
2298
2299 /*
2300 * Set the Enable bit only if an external controller is
2301 * connected. Otherwise the OMAP internal controller will
2302 * start the transfer when it gets enabled.
2303 */
2304 if (enable_1510_mode || !lcd_dma.ext_ctrl)
2305 return;
2306
2307 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
2308 w |= 1 << 8;
2309 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2310
2311 lcd_dma.active = 1;
2312
2313 w = omap_readw(OMAP1610_DMA_LCD_CCR);
2314 w |= 1 << 7;
2315 omap_writew(w, OMAP1610_DMA_LCD_CCR);
2316}
2317EXPORT_SYMBOL(omap_enable_lcd_dma);
2318
2319void omap_setup_lcd_dma(void)
2320{
2321 BUG_ON(lcd_dma.active);
2322 if (!enable_1510_mode) {
2323 /* Set some reasonable defaults */
2324 omap_writew(0x5440, OMAP1610_DMA_LCD_CCR);
2325 omap_writew(0x9102, OMAP1610_DMA_LCD_CSDP);
2326 omap_writew(0x0004, OMAP1610_DMA_LCD_LCH_CTRL);
2327 }
2328 set_b1_regs();
2329 if (!enable_1510_mode) {
2330 u16 w;
2331
2332 w = omap_readw(OMAP1610_DMA_LCD_CCR);
2333 /*
2334 * If DMA was already active set the end_prog bit to have
2335 * the programmed register set loaded into the active
2336 * register set.
2337 */
2338 w |= 1 << 11; /* End_prog */
2339 if (!lcd_dma.single_transfer)
2340 w |= (3 << 8); /* Auto_init, repeat */
2341 omap_writew(w, OMAP1610_DMA_LCD_CCR);
2342 }
2343}
2344EXPORT_SYMBOL(omap_setup_lcd_dma);
2345
2346void omap_stop_lcd_dma(void)
2347{
2348 u16 w;
2349
2350 lcd_dma.active = 0;
2351 if (enable_1510_mode || !lcd_dma.ext_ctrl)
2352 return;
2353
2354 w = omap_readw(OMAP1610_DMA_LCD_CCR);
2355 w &= ~(1 << 7);
2356 omap_writew(w, OMAP1610_DMA_LCD_CCR);
2357
2358 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
2359 w &= ~(1 << 8);
2360 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2361}
2362EXPORT_SYMBOL(omap_stop_lcd_dma);
2363
2364void omap_dma_global_context_save(void) 1983void omap_dma_global_context_save(void)
2365{ 1984{
2366 omap_dma_global_context.dma_irqenable_l0 = 1985 omap_dma_global_context.dma_irqenable_l0 =
@@ -2465,14 +2084,6 @@ static int __init omap_init_dma(void)
2465 dma_chan_count = 16; 2084 dma_chan_count = 16;
2466 } else 2085 } else
2467 dma_chan_count = 9; 2086 dma_chan_count = 9;
2468 if (cpu_is_omap16xx()) {
2469 u16 w;
2470
2471 /* this would prevent OMAP sleep */
2472 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
2473 w &= ~(1 << 8);
2474 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
2475 }
2476 } else if (cpu_class_is_omap2()) { 2087 } else if (cpu_class_is_omap2()) {
2477 u8 revision = dma_read(REVISION) & 0xff; 2088 u8 revision = dma_read(REVISION) & 0xff;
2478 printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n", 2089 printk(KERN_INFO "OMAP DMA hardware revision %d.%d\n",
@@ -2483,7 +2094,6 @@ static int __init omap_init_dma(void)
2483 return 0; 2094 return 0;
2484 } 2095 }
2485 2096
2486 spin_lock_init(&lcd_dma.lock);
2487 spin_lock_init(&dma_chan_lock); 2097 spin_lock_init(&dma_chan_lock);
2488 2098
2489 for (ch = 0; ch < dma_chan_count; ch++) { 2099 for (ch = 0; ch < dma_chan_count; ch++) {
@@ -2548,22 +2158,6 @@ static int __init omap_init_dma(void)
2548 } 2158 }
2549 } 2159 }
2550 2160
2551
2552 /* FIXME: Update LCD DMA to work on 24xx */
2553 if (cpu_class_is_omap1()) {
2554 r = request_irq(INT_DMA_LCD, lcd_dma_irq_handler, 0,
2555 "LCD DMA", NULL);
2556 if (r != 0) {
2557 int i;
2558
2559 printk(KERN_ERR "unable to request IRQ for LCD DMA "
2560 "(error %d)\n", r);
2561 for (i = 0; i < dma_chan_count; i++)
2562 free_irq(omap1_dma_irq[i], (void *) (i + 1));
2563 goto out_free;
2564 }
2565 }
2566
2567 return 0; 2161 return 0;
2568 2162
2569out_free: 2163out_free:
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index 78a4ce538dbd..d3eea4f47533 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -28,13 +28,13 @@
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/bootmem.h> 29#include <linux/bootmem.h>
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/omapfb.h>
31 32
32#include <mach/hardware.h> 33#include <mach/hardware.h>
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
34 35
35#include <plat/board.h> 36#include <plat/board.h>
36#include <plat/sram.h> 37#include <plat/sram.h>
37#include <plat/omapfb.h>
38 38
39#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE) 39#if defined(CONFIG_FB_OMAP) || defined(CONFIG_FB_OMAP_MODULE)
40 40
@@ -55,6 +55,10 @@ static struct platform_device omap_fb_device = {
55 .num_resources = 0, 55 .num_resources = 0,
56}; 56};
57 57
58void omapfb_set_platform_data(struct omapfb_platform_data *data)
59{
60}
61
58static inline int ranges_overlap(unsigned long start1, unsigned long size1, 62static inline int ranges_overlap(unsigned long start1, unsigned long size1,
59 unsigned long start2, unsigned long size2) 63 unsigned long start2, unsigned long size2)
60{ 64{
@@ -327,7 +331,33 @@ static inline int omap_init_fb(void)
327 331
328arch_initcall(omap_init_fb); 332arch_initcall(omap_init_fb);
329 333
330#else 334#elif defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
335
336static u64 omap_fb_dma_mask = ~(u32)0;
337static struct omapfb_platform_data omapfb_config;
338
339static struct platform_device omap_fb_device = {
340 .name = "omapfb",
341 .id = -1,
342 .dev = {
343 .dma_mask = &omap_fb_dma_mask,
344 .coherent_dma_mask = ~(u32)0,
345 .platform_data = &omapfb_config,
346 },
347 .num_resources = 0,
348};
349
350void omapfb_set_platform_data(struct omapfb_platform_data *data)
351{
352 omapfb_config = *data;
353}
354
355static inline int omap_init_fb(void)
356{
357 return platform_device_register(&omap_fb_device);
358}
359
360arch_initcall(omap_init_fb);
331 361
332void omapfb_reserve_sdram(void) {} 362void omapfb_reserve_sdram(void) {}
333unsigned long omapfb_reserve_sram(unsigned long sram_pstart, 363unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
@@ -339,5 +369,20 @@ unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
339 return 0; 369 return 0;
340} 370}
341 371
372#else
373
374void omapfb_set_platform_data(struct omapfb_platform_data *data)
375{
376}
377
378void omapfb_reserve_sdram(void) {}
379unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
380 unsigned long sram_vstart,
381 unsigned long sram_size,
382 unsigned long start_avail,
383 unsigned long size_avail)
384{
385 return 0;
386}
342 387
343#endif 388#endif
diff --git a/arch/arm/plat-omap/i2c.c b/arch/arm/plat-omap/i2c.c
index c08362dbb8ed..33fff4ef382d 100644
--- a/arch/arm/plat-omap/i2c.c
+++ b/arch/arm/plat-omap/i2c.c
@@ -80,47 +80,8 @@ static struct platform_device omap_i2c_devices[] = {
80#endif 80#endif
81}; 81};
82 82
83#if defined(CONFIG_ARCH_OMAP24XX)
84static const int omap24xx_pins[][2] = {
85 { M19_24XX_I2C1_SCL, L15_24XX_I2C1_SDA },
86 { J15_24XX_I2C2_SCL, H19_24XX_I2C2_SDA },
87};
88#else
89static const int omap24xx_pins[][2] = {};
90#endif
91#if defined(CONFIG_ARCH_OMAP34XX)
92static const int omap34xx_pins[][2] = {
93 { K21_34XX_I2C1_SCL, J21_34XX_I2C1_SDA},
94 { AF15_34XX_I2C2_SCL, AE15_34XX_I2C2_SDA},
95 { AF14_34XX_I2C3_SCL, AG14_34XX_I2C3_SDA},
96};
97#else
98static const int omap34xx_pins[][2] = {};
99#endif
100
101#define OMAP_I2C_CMDLINE_SETUP (BIT(31)) 83#define OMAP_I2C_CMDLINE_SETUP (BIT(31))
102 84
103static void __init omap_i2c_mux_pins(int bus)
104{
105 int scl, sda;
106
107 if (cpu_class_is_omap1()) {
108 scl = I2C_SCL;
109 sda = I2C_SDA;
110 } else if (cpu_is_omap24xx()) {
111 scl = omap24xx_pins[bus][0];
112 sda = omap24xx_pins[bus][1];
113 } else if (cpu_is_omap34xx()) {
114 scl = omap34xx_pins[bus][0];
115 sda = omap34xx_pins[bus][1];
116 } else {
117 return;
118 }
119
120 omap_cfg_reg(sda);
121 omap_cfg_reg(scl);
122}
123
124static int __init omap_i2c_nr_ports(void) 85static int __init omap_i2c_nr_ports(void)
125{ 86{
126 int ports = 0; 87 int ports = 0;
@@ -156,7 +117,6 @@ static int __init omap_i2c_add_bus(int bus_id)
156 res[1].start = irq; 117 res[1].start = irq;
157 } 118 }
158 119
159 omap_i2c_mux_pins(bus_id - 1);
160 return platform_device_register(pdev); 120 return platform_device_register(pdev);
161} 121}
162 122
@@ -209,7 +169,7 @@ out:
209subsys_initcall(omap_register_i2c_bus_cmdline); 169subsys_initcall(omap_register_i2c_bus_cmdline);
210 170
211/** 171/**
212 * omap_register_i2c_bus - register I2C bus with device descriptors 172 * omap_plat_register_i2c_bus - register I2C bus with device descriptors
213 * @bus_id: bus id counting from number 1 173 * @bus_id: bus id counting from number 1
214 * @clkrate: clock rate of the bus in kHz 174 * @clkrate: clock rate of the bus in kHz
215 * @info: pointer into I2C device descriptor table or NULL 175 * @info: pointer into I2C device descriptor table or NULL
@@ -217,7 +177,7 @@ subsys_initcall(omap_register_i2c_bus_cmdline);
217 * 177 *
218 * Returns 0 on success or an error code. 178 * Returns 0 on success or an error code.
219 */ 179 */
220int __init omap_register_i2c_bus(int bus_id, u32 clkrate, 180int __init omap_plat_register_i2c_bus(int bus_id, u32 clkrate,
221 struct i2c_board_info const *info, 181 struct i2c_board_info const *info,
222 unsigned len) 182 unsigned len)
223{ 183{
diff --git a/arch/arm/plat-omap/include/plat/board.h b/arch/arm/plat-omap/include/plat/board.h
index abb17b604f82..376ce18216ff 100644
--- a/arch/arm/plat-omap/include/plat/board.h
+++ b/arch/arm/plat-omap/include/plat/board.h
@@ -114,15 +114,6 @@ struct omap_pwm_led_platform_data {
114 void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off); 114 void (*set_power)(struct omap_pwm_led_platform_data *self, int on_off);
115}; 115};
116 116
117/* See arch/arm/plat-omap/include/mach/gpio-switch.h for definitions */
118struct omap_gpio_switch_config {
119 char name[12];
120 u16 gpio;
121 int flags:4;
122 int type:4;
123 int key_code:24; /* Linux key code */
124};
125
126struct omap_uart_config { 117struct omap_uart_config {
127 /* Bit field of UARTs present; bit 0 --> UART1 */ 118 /* Bit field of UARTs present; bit 0 --> UART1 */
128 unsigned int enabled_uarts; 119 unsigned int enabled_uarts;
diff --git a/arch/arm/plat-omap/include/plat/clkdev_omap.h b/arch/arm/plat-omap/include/plat/clkdev_omap.h
new file mode 100644
index 000000000000..35b36caf5f91
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/clkdev_omap.h
@@ -0,0 +1,41 @@
1/*
2 * clkdev <-> OMAP integration
3 *
4 * Russell King <linux@arm.linux.org.uk>
5 *
6 */
7
8#ifndef __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
9#define __ARCH_ARM_PLAT_OMAP_INCLUDE_PLAT_CLKDEV_OMAP_H
10
11#include <asm/clkdev.h>
12
13struct omap_clk {
14 u16 cpu;
15 struct clk_lookup lk;
16};
17
18#define CLK(dev, con, ck, cp) \
19 { \
20 .cpu = cp, \
21 .lk = { \
22 .dev_id = dev, \
23 .con_id = con, \
24 .clk = ck, \
25 }, \
26 }
27
28
29#define CK_310 (1 << 0)
30#define CK_7XX (1 << 1)
31#define CK_1510 (1 << 2)
32#define CK_16XX (1 << 3)
33#define CK_243X (1 << 4)
34#define CK_242X (1 << 5)
35#define CK_343X (1 << 6)
36#define CK_3430ES1 (1 << 7)
37#define CK_3430ES2 (1 << 8)
38#define CK_443X (1 << 9)
39
40#endif
41
diff --git a/arch/arm/plat-omap/include/plat/clock.h b/arch/arm/plat-omap/include/plat/clock.h
index 4b8b0d65cbf2..309b6d1dccdb 100644
--- a/arch/arm/plat-omap/include/plat/clock.h
+++ b/arch/arm/plat-omap/include/plat/clock.h
@@ -13,6 +13,8 @@
13#ifndef __ARCH_ARM_OMAP_CLOCK_H 13#ifndef __ARCH_ARM_OMAP_CLOCK_H
14#define __ARCH_ARM_OMAP_CLOCK_H 14#define __ARCH_ARM_OMAP_CLOCK_H
15 15
16#include <linux/list.h>
17
16struct module; 18struct module;
17struct clk; 19struct clk;
18struct clockdomain; 20struct clockdomain;
@@ -148,6 +150,8 @@ extern const struct clkops clkops_null;
148#define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */ 150#define CONFIG_PARTICIPANT (1 << 10) /* Fundamental clock */
149#define ENABLE_ON_INIT (1 << 11) /* Enable upon framework init */ 151#define ENABLE_ON_INIT (1 << 11) /* Enable upon framework init */
150#define INVERT_ENABLE (1 << 12) /* 0 enables, 1 disables */ 152#define INVERT_ENABLE (1 << 12) /* 0 enables, 1 disables */
153#define CLOCK_IN_OMAP4430 (1 << 13)
154#define ALWAYS_ENABLED (1 << 14)
151/* bits 13-31 are currently free */ 155/* bits 13-31 are currently free */
152 156
153/* Clksel_rate flags */ 157/* Clksel_rate flags */
@@ -156,6 +160,7 @@ extern const struct clkops clkops_null;
156#define RATE_IN_243X (1 << 2) 160#define RATE_IN_243X (1 << 2)
157#define RATE_IN_343X (1 << 3) /* rates common to all 343X */ 161#define RATE_IN_343X (1 << 3) /* rates common to all 343X */
158#define RATE_IN_3430ES2 (1 << 4) /* 3430ES2 rates only */ 162#define RATE_IN_3430ES2 (1 << 4) /* 3430ES2 rates only */
163#define RATE_IN_4430 (1 << 5)
159 164
160#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X) 165#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
161 166
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index 064f1730f43b..32c22272425d 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -27,7 +27,7 @@
27#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H 27#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
28#define __ARCH_ARM_MACH_OMAP_COMMON_H 28#define __ARCH_ARM_MACH_OMAP_COMMON_H
29 29
30#include <linux/i2c.h> 30#include <plat/i2c.h>
31 31
32struct sys_timer; 32struct sys_timer;
33 33
@@ -36,18 +36,6 @@ extern void __iomem *gic_cpu_base_addr;
36 36
37extern void omap_map_common_io(void); 37extern void omap_map_common_io(void);
38extern struct sys_timer omap_timer; 38extern struct sys_timer omap_timer;
39#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
40extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
41 struct i2c_board_info const *info,
42 unsigned len);
43#else
44static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
45 struct i2c_board_info const *info,
46 unsigned len)
47{
48 return 0;
49}
50#endif
51 39
52/* IO bases for various OMAP processors */ 40/* IO bases for various OMAP processors */
53struct omap_globals { 41struct omap_globals {
@@ -58,6 +46,7 @@ struct omap_globals {
58 void __iomem *ctrl; /* System Control Module */ 46 void __iomem *ctrl; /* System Control Module */
59 void __iomem *prm; /* Power and Reset Management */ 47 void __iomem *prm; /* Power and Reset Management */
60 void __iomem *cm; /* Clock Management */ 48 void __iomem *cm; /* Clock Management */
49 void __iomem *cm2;
61}; 50};
62 51
63void omap2_set_globals_242x(void); 52void omap2_set_globals_242x(void);
@@ -71,4 +60,24 @@ void omap2_set_globals_sdrc(struct omap_globals *);
71void omap2_set_globals_control(struct omap_globals *); 60void omap2_set_globals_control(struct omap_globals *);
72void omap2_set_globals_prcm(struct omap_globals *); 61void omap2_set_globals_prcm(struct omap_globals *);
73 62
63/**
64 * omap_test_timeout - busy-loop, testing a condition
65 * @cond: condition to test until it evaluates to true
66 * @timeout: maximum number of microseconds in the timeout
67 * @index: loop index (integer)
68 *
69 * Loop waiting for @cond to become true or until at least @timeout
70 * microseconds have passed. To use, define some integer @index in the
71 * calling code. After running, if @index == @timeout, then the loop has
72 * timed out.
73 */
74#define omap_test_timeout(cond, timeout, index) \
75({ \
76 for (index = 0; index < timeout; index++) { \
77 if (cond) \
78 break; \
79 udelay(1); \
80 } \
81})
82
74#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */ 83#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 2e1789001dfe..9a028bdebb06 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -176,11 +176,13 @@ IS_OMAP_CLASS(15xx, 0x15)
176IS_OMAP_CLASS(16xx, 0x16) 176IS_OMAP_CLASS(16xx, 0x16)
177IS_OMAP_CLASS(24xx, 0x24) 177IS_OMAP_CLASS(24xx, 0x24)
178IS_OMAP_CLASS(34xx, 0x34) 178IS_OMAP_CLASS(34xx, 0x34)
179IS_OMAP_CLASS(44xx, 0x44)
179 180
180IS_OMAP_SUBCLASS(242x, 0x242) 181IS_OMAP_SUBCLASS(242x, 0x242)
181IS_OMAP_SUBCLASS(243x, 0x243) 182IS_OMAP_SUBCLASS(243x, 0x243)
182IS_OMAP_SUBCLASS(343x, 0x343) 183IS_OMAP_SUBCLASS(343x, 0x343)
183IS_OMAP_SUBCLASS(363x, 0x363) 184IS_OMAP_SUBCLASS(363x, 0x363)
185IS_OMAP_SUBCLASS(443x, 0x443)
184 186
185#define cpu_is_omap7xx() 0 187#define cpu_is_omap7xx() 0
186#define cpu_is_omap15xx() 0 188#define cpu_is_omap15xx() 0
@@ -393,11 +395,11 @@ IS_OMAP_TYPE(3517, 0x3517)
393 (!omap3_has_iva()) && \ 395 (!omap3_has_iva()) && \
394 (!omap3_has_sgx())) 396 (!omap3_has_sgx()))
395# define cpu_is_omap3515() (cpu_is_omap3430() && \ 397# define cpu_is_omap3515() (cpu_is_omap3430() && \
396 (omap3_has_iva()) && \ 398 (!omap3_has_iva()) && \
397 (!omap3_has_sgx())) 399 (omap3_has_sgx()))
398# define cpu_is_omap3525() (cpu_is_omap3430() && \ 400# define cpu_is_omap3525() (cpu_is_omap3430() && \
399 (omap3_has_sgx()) && \ 401 (!omap3_has_sgx()) && \
400 (!omap3_has_iva())) 402 (omap3_has_iva()))
401# define cpu_is_omap3530() (cpu_is_omap3430()) 403# define cpu_is_omap3530() (cpu_is_omap3430())
402# define cpu_is_omap3505() is_omap3505() 404# define cpu_is_omap3505() is_omap3505()
403# define cpu_is_omap3517() is_omap3517() 405# define cpu_is_omap3517() is_omap3517()
@@ -408,8 +410,8 @@ IS_OMAP_TYPE(3517, 0x3517)
408# if defined(CONFIG_ARCH_OMAP4) 410# if defined(CONFIG_ARCH_OMAP4)
409# undef cpu_is_omap44xx 411# undef cpu_is_omap44xx
410# undef cpu_is_omap443x 412# undef cpu_is_omap443x
411# define cpu_is_omap44xx() 1 413# define cpu_is_omap44xx() is_omap44xx()
412# define cpu_is_omap443x() 1 414# define cpu_is_omap443x() is_omap443x()
413# endif 415# endif
414 416
415/* Macros to detect if we have OMAP1 or OMAP2 */ 417/* Macros to detect if we have OMAP1 or OMAP2 */
@@ -436,14 +438,15 @@ IS_OMAP_TYPE(3517, 0x3517)
436#define OMAP3630_REV_ES1_0 0x36300034 438#define OMAP3630_REV_ES1_0 0x36300034
437 439
438#define OMAP35XX_CLASS 0x35000034 440#define OMAP35XX_CLASS 0x35000034
439#define OMAP3503_REV(v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 12)) 441#define OMAP3503_REV(v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 8))
440#define OMAP3515_REV(v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 12)) 442#define OMAP3515_REV(v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 8))
441#define OMAP3525_REV(v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 12)) 443#define OMAP3525_REV(v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 8))
442#define OMAP3530_REV(v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 12)) 444#define OMAP3530_REV(v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 8))
443#define OMAP3505_REV(v) (OMAP35XX_CLASS | (0x3505 << 16) | (v << 12)) 445#define OMAP3505_REV(v) (OMAP35XX_CLASS | (0x3505 << 16) | (v << 8))
444#define OMAP3517_REV(v) (OMAP35XX_CLASS | (0x3517 << 16) | (v << 12)) 446#define OMAP3517_REV(v) (OMAP35XX_CLASS | (0x3517 << 16) | (v << 8))
445 447
446#define OMAP443X_CLASS 0x44300034 448#define OMAP443X_CLASS 0x44300044
449#define OMAP4430_REV_ES1_0 0x44300044
447 450
448/* 451/*
449 * omap_chip bits 452 * omap_chip bits
diff --git a/arch/arm/plat-omap/include/plat/display.h b/arch/arm/plat-omap/include/plat/display.h
new file mode 100644
index 000000000000..c66e464732df
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/display.h
@@ -0,0 +1,575 @@
1/*
2 * linux/include/asm-arm/arch-omap/display.h
3 *
4 * Copyright (C) 2008 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
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 version 2 as published by
9 * the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef __ASM_ARCH_OMAP_DISPLAY_H
21#define __ASM_ARCH_OMAP_DISPLAY_H
22
23#include <linux/list.h>
24#include <linux/kobject.h>
25#include <linux/device.h>
26#include <asm/atomic.h>
27
28#define DISPC_IRQ_FRAMEDONE (1 << 0)
29#define DISPC_IRQ_VSYNC (1 << 1)
30#define DISPC_IRQ_EVSYNC_EVEN (1 << 2)
31#define DISPC_IRQ_EVSYNC_ODD (1 << 3)
32#define DISPC_IRQ_ACBIAS_COUNT_STAT (1 << 4)
33#define DISPC_IRQ_PROG_LINE_NUM (1 << 5)
34#define DISPC_IRQ_GFX_FIFO_UNDERFLOW (1 << 6)
35#define DISPC_IRQ_GFX_END_WIN (1 << 7)
36#define DISPC_IRQ_PAL_GAMMA_MASK (1 << 8)
37#define DISPC_IRQ_OCP_ERR (1 << 9)
38#define DISPC_IRQ_VID1_FIFO_UNDERFLOW (1 << 10)
39#define DISPC_IRQ_VID1_END_WIN (1 << 11)
40#define DISPC_IRQ_VID2_FIFO_UNDERFLOW (1 << 12)
41#define DISPC_IRQ_VID2_END_WIN (1 << 13)
42#define DISPC_IRQ_SYNC_LOST (1 << 14)
43#define DISPC_IRQ_SYNC_LOST_DIGIT (1 << 15)
44#define DISPC_IRQ_WAKEUP (1 << 16)
45
46struct omap_dss_device;
47struct omap_overlay_manager;
48
49enum omap_display_type {
50 OMAP_DISPLAY_TYPE_NONE = 0,
51 OMAP_DISPLAY_TYPE_DPI = 1 << 0,
52 OMAP_DISPLAY_TYPE_DBI = 1 << 1,
53 OMAP_DISPLAY_TYPE_SDI = 1 << 2,
54 OMAP_DISPLAY_TYPE_DSI = 1 << 3,
55 OMAP_DISPLAY_TYPE_VENC = 1 << 4,
56};
57
58enum omap_plane {
59 OMAP_DSS_GFX = 0,
60 OMAP_DSS_VIDEO1 = 1,
61 OMAP_DSS_VIDEO2 = 2
62};
63
64enum omap_channel {
65 OMAP_DSS_CHANNEL_LCD = 0,
66 OMAP_DSS_CHANNEL_DIGIT = 1,
67};
68
69enum omap_color_mode {
70 OMAP_DSS_COLOR_CLUT1 = 1 << 0, /* BITMAP 1 */
71 OMAP_DSS_COLOR_CLUT2 = 1 << 1, /* BITMAP 2 */
72 OMAP_DSS_COLOR_CLUT4 = 1 << 2, /* BITMAP 4 */
73 OMAP_DSS_COLOR_CLUT8 = 1 << 3, /* BITMAP 8 */
74 OMAP_DSS_COLOR_RGB12U = 1 << 4, /* RGB12, 16-bit container */
75 OMAP_DSS_COLOR_ARGB16 = 1 << 5, /* ARGB16 */
76 OMAP_DSS_COLOR_RGB16 = 1 << 6, /* RGB16 */
77 OMAP_DSS_COLOR_RGB24U = 1 << 7, /* RGB24, 32-bit container */
78 OMAP_DSS_COLOR_RGB24P = 1 << 8, /* RGB24, 24-bit container */
79 OMAP_DSS_COLOR_YUV2 = 1 << 9, /* YUV2 4:2:2 co-sited */
80 OMAP_DSS_COLOR_UYVY = 1 << 10, /* UYVY 4:2:2 co-sited */
81 OMAP_DSS_COLOR_ARGB32 = 1 << 11, /* ARGB32 */
82 OMAP_DSS_COLOR_RGBA32 = 1 << 12, /* RGBA32 */
83 OMAP_DSS_COLOR_RGBX32 = 1 << 13, /* RGBx32 */
84
85 OMAP_DSS_COLOR_GFX_OMAP2 =
86 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
87 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
88 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
89 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P,
90
91 OMAP_DSS_COLOR_VID_OMAP2 =
92 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
93 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
94 OMAP_DSS_COLOR_UYVY,
95
96 OMAP_DSS_COLOR_GFX_OMAP3 =
97 OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 |
98 OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 |
99 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
100 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
101 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 |
102 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
103
104 OMAP_DSS_COLOR_VID1_OMAP3 =
105 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 |
106 OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P |
107 OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY,
108
109 OMAP_DSS_COLOR_VID2_OMAP3 =
110 OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 |
111 OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U |
112 OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 |
113 OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 |
114 OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32,
115};
116
117enum omap_lcd_display_type {
118 OMAP_DSS_LCD_DISPLAY_STN,
119 OMAP_DSS_LCD_DISPLAY_TFT,
120};
121
122enum omap_dss_load_mode {
123 OMAP_DSS_LOAD_CLUT_AND_FRAME = 0,
124 OMAP_DSS_LOAD_CLUT_ONLY = 1,
125 OMAP_DSS_LOAD_FRAME_ONLY = 2,
126 OMAP_DSS_LOAD_CLUT_ONCE_FRAME = 3,
127};
128
129enum omap_dss_trans_key_type {
130 OMAP_DSS_COLOR_KEY_GFX_DST = 0,
131 OMAP_DSS_COLOR_KEY_VID_SRC = 1,
132};
133
134enum omap_rfbi_te_mode {
135 OMAP_DSS_RFBI_TE_MODE_1 = 1,
136 OMAP_DSS_RFBI_TE_MODE_2 = 2,
137};
138
139enum omap_panel_config {
140 OMAP_DSS_LCD_IVS = 1<<0,
141 OMAP_DSS_LCD_IHS = 1<<1,
142 OMAP_DSS_LCD_IPC = 1<<2,
143 OMAP_DSS_LCD_IEO = 1<<3,
144 OMAP_DSS_LCD_RF = 1<<4,
145 OMAP_DSS_LCD_ONOFF = 1<<5,
146
147 OMAP_DSS_LCD_TFT = 1<<20,
148};
149
150enum omap_dss_venc_type {
151 OMAP_DSS_VENC_TYPE_COMPOSITE,
152 OMAP_DSS_VENC_TYPE_SVIDEO,
153};
154
155enum omap_display_caps {
156 OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE = 1 << 0,
157 OMAP_DSS_DISPLAY_CAP_TEAR_ELIM = 1 << 1,
158};
159
160enum omap_dss_update_mode {
161 OMAP_DSS_UPDATE_DISABLED = 0,
162 OMAP_DSS_UPDATE_AUTO,
163 OMAP_DSS_UPDATE_MANUAL,
164};
165
166enum omap_dss_display_state {
167 OMAP_DSS_DISPLAY_DISABLED = 0,
168 OMAP_DSS_DISPLAY_ACTIVE,
169 OMAP_DSS_DISPLAY_SUSPENDED,
170};
171
172/* XXX perhaps this should be removed */
173enum omap_dss_overlay_managers {
174 OMAP_DSS_OVL_MGR_LCD,
175 OMAP_DSS_OVL_MGR_TV,
176};
177
178enum omap_dss_rotation_type {
179 OMAP_DSS_ROT_DMA = 0,
180 OMAP_DSS_ROT_VRFB = 1,
181};
182
183/* clockwise rotation angle */
184enum omap_dss_rotation_angle {
185 OMAP_DSS_ROT_0 = 0,
186 OMAP_DSS_ROT_90 = 1,
187 OMAP_DSS_ROT_180 = 2,
188 OMAP_DSS_ROT_270 = 3,
189};
190
191enum omap_overlay_caps {
192 OMAP_DSS_OVL_CAP_SCALE = 1 << 0,
193 OMAP_DSS_OVL_CAP_DISPC = 1 << 1,
194};
195
196enum omap_overlay_manager_caps {
197 OMAP_DSS_OVL_MGR_CAP_DISPC = 1 << 0,
198};
199
200/* RFBI */
201
202struct rfbi_timings {
203 int cs_on_time;
204 int cs_off_time;
205 int we_on_time;
206 int we_off_time;
207 int re_on_time;
208 int re_off_time;
209 int we_cycle_time;
210 int re_cycle_time;
211 int cs_pulse_width;
212 int access_time;
213
214 int clk_div;
215
216 u32 tim[5]; /* set by rfbi_convert_timings() */
217
218 int converted;
219};
220
221void omap_rfbi_write_command(const void *buf, u32 len);
222void omap_rfbi_read_data(void *buf, u32 len);
223void omap_rfbi_write_data(const void *buf, u32 len);
224void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
225 u16 x, u16 y,
226 u16 w, u16 h);
227int omap_rfbi_enable_te(bool enable, unsigned line);
228int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
229 unsigned hs_pulse_time, unsigned vs_pulse_time,
230 int hs_pol_inv, int vs_pol_inv, int extif_div);
231
232/* DSI */
233void dsi_bus_lock(void);
234void dsi_bus_unlock(void);
235int dsi_vc_dcs_write(int channel, u8 *data, int len);
236int dsi_vc_dcs_write_nosync(int channel, u8 *data, int len);
237int dsi_vc_dcs_read(int channel, u8 dcs_cmd, u8 *buf, int buflen);
238int dsi_vc_set_max_rx_packet_size(int channel, u16 len);
239int dsi_vc_send_null(int channel);
240int dsi_vc_send_bta_sync(int channel);
241
242/* Board specific data */
243struct omap_dss_board_info {
244 int (*get_last_off_on_transaction_id)(struct device *dev);
245 int num_devices;
246 struct omap_dss_device **devices;
247 struct omap_dss_device *default_device;
248};
249
250struct omap_video_timings {
251 /* Unit: pixels */
252 u16 x_res;
253 /* Unit: pixels */
254 u16 y_res;
255 /* Unit: KHz */
256 u32 pixel_clock;
257 /* Unit: pixel clocks */
258 u16 hsw; /* Horizontal synchronization pulse width */
259 /* Unit: pixel clocks */
260 u16 hfp; /* Horizontal front porch */
261 /* Unit: pixel clocks */
262 u16 hbp; /* Horizontal back porch */
263 /* Unit: line clocks */
264 u16 vsw; /* Vertical synchronization pulse width */
265 /* Unit: line clocks */
266 u16 vfp; /* Vertical front porch */
267 /* Unit: line clocks */
268 u16 vbp; /* Vertical back porch */
269};
270
271#ifdef CONFIG_OMAP2_DSS_VENC
272/* Hardcoded timings for tv modes. Venc only uses these to
273 * identify the mode, and does not actually use the configs
274 * itself. However, the configs should be something that
275 * a normal monitor can also show */
276const extern struct omap_video_timings omap_dss_pal_timings;
277const extern struct omap_video_timings omap_dss_ntsc_timings;
278#endif
279
280struct omap_overlay_info {
281 bool enabled;
282
283 u32 paddr;
284 void __iomem *vaddr;
285 u16 screen_width;
286 u16 width;
287 u16 height;
288 enum omap_color_mode color_mode;
289 u8 rotation;
290 enum omap_dss_rotation_type rotation_type;
291 bool mirror;
292
293 u16 pos_x;
294 u16 pos_y;
295 u16 out_width; /* if 0, out_width == width */
296 u16 out_height; /* if 0, out_height == height */
297 u8 global_alpha;
298};
299
300struct omap_overlay {
301 struct kobject kobj;
302 struct list_head list;
303
304 /* static fields */
305 const char *name;
306 int id;
307 enum omap_color_mode supported_modes;
308 enum omap_overlay_caps caps;
309
310 /* dynamic fields */
311 struct omap_overlay_manager *manager;
312 struct omap_overlay_info info;
313
314 /* if true, info has been changed, but not applied() yet */
315 bool info_dirty;
316
317 int (*set_manager)(struct omap_overlay *ovl,
318 struct omap_overlay_manager *mgr);
319 int (*unset_manager)(struct omap_overlay *ovl);
320
321 int (*set_overlay_info)(struct omap_overlay *ovl,
322 struct omap_overlay_info *info);
323 void (*get_overlay_info)(struct omap_overlay *ovl,
324 struct omap_overlay_info *info);
325
326 int (*wait_for_go)(struct omap_overlay *ovl);
327};
328
329struct omap_overlay_manager_info {
330 u32 default_color;
331
332 enum omap_dss_trans_key_type trans_key_type;
333 u32 trans_key;
334 bool trans_enabled;
335
336 bool alpha_enabled;
337};
338
339struct omap_overlay_manager {
340 struct kobject kobj;
341 struct list_head list;
342
343 /* static fields */
344 const char *name;
345 int id;
346 enum omap_overlay_manager_caps caps;
347 int num_overlays;
348 struct omap_overlay **overlays;
349 enum omap_display_type supported_displays;
350
351 /* dynamic fields */
352 struct omap_dss_device *device;
353 struct omap_overlay_manager_info info;
354
355 bool device_changed;
356 /* if true, info has been changed but not applied() yet */
357 bool info_dirty;
358
359 int (*set_device)(struct omap_overlay_manager *mgr,
360 struct omap_dss_device *dssdev);
361 int (*unset_device)(struct omap_overlay_manager *mgr);
362
363 int (*set_manager_info)(struct omap_overlay_manager *mgr,
364 struct omap_overlay_manager_info *info);
365 void (*get_manager_info)(struct omap_overlay_manager *mgr,
366 struct omap_overlay_manager_info *info);
367
368 int (*apply)(struct omap_overlay_manager *mgr);
369 int (*wait_for_go)(struct omap_overlay_manager *mgr);
370};
371
372struct omap_dss_device {
373 struct device dev;
374
375 enum omap_display_type type;
376
377 union {
378 struct {
379 u8 data_lines;
380 } dpi;
381
382 struct {
383 u8 channel;
384 u8 data_lines;
385 } rfbi;
386
387 struct {
388 u8 datapairs;
389 } sdi;
390
391 struct {
392 u8 clk_lane;
393 u8 clk_pol;
394 u8 data1_lane;
395 u8 data1_pol;
396 u8 data2_lane;
397 u8 data2_pol;
398
399 struct {
400 u16 regn;
401 u16 regm;
402 u16 regm3;
403 u16 regm4;
404
405 u16 lp_clk_div;
406
407 u16 lck_div;
408 u16 pck_div;
409 } div;
410
411 bool ext_te;
412 u8 ext_te_gpio;
413 } dsi;
414
415 struct {
416 enum omap_dss_venc_type type;
417 bool invert_polarity;
418 } venc;
419 } phy;
420
421 struct {
422 struct omap_video_timings timings;
423
424 int acbi; /* ac-bias pin transitions per interrupt */
425 /* Unit: line clocks */
426 int acb; /* ac-bias pin frequency */
427
428 enum omap_panel_config config;
429
430 u8 recommended_bpp;
431
432 struct omap_dss_device *ctrl;
433 } panel;
434
435 struct {
436 u8 pixel_size;
437 struct rfbi_timings rfbi_timings;
438 struct omap_dss_device *panel;
439 } ctrl;
440
441 int reset_gpio;
442
443 int max_backlight_level;
444
445 const char *name;
446
447 /* used to match device to driver */
448 const char *driver_name;
449
450 void *data;
451
452 struct omap_dss_driver *driver;
453
454 /* helper variable for driver suspend/resume */
455 bool activate_after_resume;
456
457 enum omap_display_caps caps;
458
459 struct omap_overlay_manager *manager;
460
461 enum omap_dss_display_state state;
462
463 int (*enable)(struct omap_dss_device *dssdev);
464 void (*disable)(struct omap_dss_device *dssdev);
465
466 int (*suspend)(struct omap_dss_device *dssdev);
467 int (*resume)(struct omap_dss_device *dssdev);
468
469 void (*get_resolution)(struct omap_dss_device *dssdev,
470 u16 *xres, u16 *yres);
471 int (*get_recommended_bpp)(struct omap_dss_device *dssdev);
472
473 int (*check_timings)(struct omap_dss_device *dssdev,
474 struct omap_video_timings *timings);
475 void (*set_timings)(struct omap_dss_device *dssdev,
476 struct omap_video_timings *timings);
477 void (*get_timings)(struct omap_dss_device *dssdev,
478 struct omap_video_timings *timings);
479 int (*update)(struct omap_dss_device *dssdev,
480 u16 x, u16 y, u16 w, u16 h);
481 int (*sync)(struct omap_dss_device *dssdev);
482 int (*wait_vsync)(struct omap_dss_device *dssdev);
483
484 int (*set_update_mode)(struct omap_dss_device *dssdev,
485 enum omap_dss_update_mode);
486 enum omap_dss_update_mode (*get_update_mode)
487 (struct omap_dss_device *dssdev);
488
489 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
490 int (*get_te)(struct omap_dss_device *dssdev);
491
492 u8 (*get_rotate)(struct omap_dss_device *dssdev);
493 int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
494
495 bool (*get_mirror)(struct omap_dss_device *dssdev);
496 int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
497
498 int (*run_test)(struct omap_dss_device *dssdev, int test);
499 int (*memory_read)(struct omap_dss_device *dssdev,
500 void *buf, size_t size,
501 u16 x, u16 y, u16 w, u16 h);
502
503 int (*set_wss)(struct omap_dss_device *dssdev, u32 wss);
504 u32 (*get_wss)(struct omap_dss_device *dssdev);
505
506 /* platform specific */
507 int (*platform_enable)(struct omap_dss_device *dssdev);
508 void (*platform_disable)(struct omap_dss_device *dssdev);
509 int (*set_backlight)(struct omap_dss_device *dssdev, int level);
510 int (*get_backlight)(struct omap_dss_device *dssdev);
511};
512
513struct omap_dss_driver {
514 struct device_driver driver;
515
516 int (*probe)(struct omap_dss_device *);
517 void (*remove)(struct omap_dss_device *);
518
519 int (*enable)(struct omap_dss_device *display);
520 void (*disable)(struct omap_dss_device *display);
521 int (*suspend)(struct omap_dss_device *display);
522 int (*resume)(struct omap_dss_device *display);
523 int (*run_test)(struct omap_dss_device *display, int test);
524
525 void (*setup_update)(struct omap_dss_device *dssdev,
526 u16 x, u16 y, u16 w, u16 h);
527
528 int (*enable_te)(struct omap_dss_device *dssdev, bool enable);
529 int (*wait_for_te)(struct omap_dss_device *dssdev);
530
531 u8 (*get_rotate)(struct omap_dss_device *dssdev);
532 int (*set_rotate)(struct omap_dss_device *dssdev, u8 rotate);
533
534 bool (*get_mirror)(struct omap_dss_device *dssdev);
535 int (*set_mirror)(struct omap_dss_device *dssdev, bool enable);
536
537 int (*memory_read)(struct omap_dss_device *dssdev,
538 void *buf, size_t size,
539 u16 x, u16 y, u16 w, u16 h);
540};
541
542int omap_dss_register_driver(struct omap_dss_driver *);
543void omap_dss_unregister_driver(struct omap_dss_driver *);
544
545int omap_dss_register_device(struct omap_dss_device *);
546void omap_dss_unregister_device(struct omap_dss_device *);
547
548void omap_dss_get_device(struct omap_dss_device *dssdev);
549void omap_dss_put_device(struct omap_dss_device *dssdev);
550#define for_each_dss_dev(d) while ((d = omap_dss_get_next_device(d)) != NULL)
551struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
552struct omap_dss_device *omap_dss_find_device(void *data,
553 int (*match)(struct omap_dss_device *dssdev, void *data));
554
555int omap_dss_start_device(struct omap_dss_device *dssdev);
556void omap_dss_stop_device(struct omap_dss_device *dssdev);
557
558int omap_dss_get_num_overlay_managers(void);
559struct omap_overlay_manager *omap_dss_get_overlay_manager(int num);
560
561int omap_dss_get_num_overlays(void);
562struct omap_overlay *omap_dss_get_overlay(int num);
563
564typedef void (*omap_dispc_isr_t) (void *arg, u32 mask);
565int omap_dispc_register_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
566int omap_dispc_unregister_isr(omap_dispc_isr_t isr, void *arg, u32 mask);
567
568int omap_dispc_wait_for_irq_timeout(u32 irqmask, unsigned long timeout);
569int omap_dispc_wait_for_irq_interruptible_timeout(u32 irqmask,
570 unsigned long timeout);
571
572#define to_dss_driver(x) container_of((x), struct omap_dss_driver, driver)
573#define to_dss_device(x) container_of((x), struct omap_dss_device, dev)
574
575#endif
diff --git a/arch/arm/plat-omap/include/plat/dma.h b/arch/arm/plat-omap/include/plat/dma.h
index 1c017b29b7e9..4ede9e17a0be 100644
--- a/arch/arm/plat-omap/include/plat/dma.h
+++ b/arch/arm/plat-omap/include/plat/dma.h
@@ -401,33 +401,6 @@
401 401
402/*----------------------------------------------------------------------------*/ 402/*----------------------------------------------------------------------------*/
403 403
404/* Hardware registers for LCD DMA */
405#define OMAP1510_DMA_LCD_BASE (0xfffedb00)
406#define OMAP1510_DMA_LCD_CTRL (OMAP1510_DMA_LCD_BASE + 0x00)
407#define OMAP1510_DMA_LCD_TOP_F1_L (OMAP1510_DMA_LCD_BASE + 0x02)
408#define OMAP1510_DMA_LCD_TOP_F1_U (OMAP1510_DMA_LCD_BASE + 0x04)
409#define OMAP1510_DMA_LCD_BOT_F1_L (OMAP1510_DMA_LCD_BASE + 0x06)
410#define OMAP1510_DMA_LCD_BOT_F1_U (OMAP1510_DMA_LCD_BASE + 0x08)
411
412#define OMAP1610_DMA_LCD_BASE (0xfffee300)
413#define OMAP1610_DMA_LCD_CSDP (OMAP1610_DMA_LCD_BASE + 0xc0)
414#define OMAP1610_DMA_LCD_CCR (OMAP1610_DMA_LCD_BASE + 0xc2)
415#define OMAP1610_DMA_LCD_CTRL (OMAP1610_DMA_LCD_BASE + 0xc4)
416#define OMAP1610_DMA_LCD_TOP_B1_L (OMAP1610_DMA_LCD_BASE + 0xc8)
417#define OMAP1610_DMA_LCD_TOP_B1_U (OMAP1610_DMA_LCD_BASE + 0xca)
418#define OMAP1610_DMA_LCD_BOT_B1_L (OMAP1610_DMA_LCD_BASE + 0xcc)
419#define OMAP1610_DMA_LCD_BOT_B1_U (OMAP1610_DMA_LCD_BASE + 0xce)
420#define OMAP1610_DMA_LCD_TOP_B2_L (OMAP1610_DMA_LCD_BASE + 0xd0)
421#define OMAP1610_DMA_LCD_TOP_B2_U (OMAP1610_DMA_LCD_BASE + 0xd2)
422#define OMAP1610_DMA_LCD_BOT_B2_L (OMAP1610_DMA_LCD_BASE + 0xd4)
423#define OMAP1610_DMA_LCD_BOT_B2_U (OMAP1610_DMA_LCD_BASE + 0xd6)
424#define OMAP1610_DMA_LCD_SRC_EI_B1 (OMAP1610_DMA_LCD_BASE + 0xd8)
425#define OMAP1610_DMA_LCD_SRC_FI_B1_L (OMAP1610_DMA_LCD_BASE + 0xda)
426#define OMAP1610_DMA_LCD_SRC_EN_B1 (OMAP1610_DMA_LCD_BASE + 0xe0)
427#define OMAP1610_DMA_LCD_SRC_FN_B1 (OMAP1610_DMA_LCD_BASE + 0xe4)
428#define OMAP1610_DMA_LCD_LCH_CTRL (OMAP1610_DMA_LCD_BASE + 0xea)
429#define OMAP1610_DMA_LCD_SRC_FI_B1_U (OMAP1610_DMA_LCD_BASE + 0xf4)
430
431#define OMAP1_DMA_TOUT_IRQ (1 << 0) 404#define OMAP1_DMA_TOUT_IRQ (1 << 0)
432#define OMAP_DMA_DROP_IRQ (1 << 1) 405#define OMAP_DMA_DROP_IRQ (1 << 1)
433#define OMAP_DMA_HALF_IRQ (1 << 2) 406#define OMAP_DMA_HALF_IRQ (1 << 2)
@@ -441,6 +414,8 @@
441#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10) 414#define OMAP2_DMA_SUPERVISOR_ERR_IRQ (1 << 10)
442#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11) 415#define OMAP2_DMA_MISALIGNED_ERR_IRQ (1 << 11)
443 416
417#define OMAP_DMA_CCR_EN (1 << 7)
418
444#define OMAP_DMA_DATA_TYPE_S8 0x00 419#define OMAP_DMA_DATA_TYPE_S8 0x00
445#define OMAP_DMA_DATA_TYPE_S16 0x01 420#define OMAP_DMA_DATA_TYPE_S16 0x01
446#define OMAP_DMA_DATA_TYPE_S32 0x02 421#define OMAP_DMA_DATA_TYPE_S32 0x02
@@ -503,14 +478,6 @@
503#define DMA_CH_PRIO_HIGH 0x1 478#define DMA_CH_PRIO_HIGH 0x1
504#define DMA_CH_PRIO_LOW 0x0 /* Def */ 479#define DMA_CH_PRIO_LOW 0x0 /* Def */
505 480
506/* LCD DMA block numbers */
507enum {
508 OMAP_LCD_DMA_B1_TOP,
509 OMAP_LCD_DMA_B1_BOTTOM,
510 OMAP_LCD_DMA_B2_TOP,
511 OMAP_LCD_DMA_B2_BOTTOM
512};
513
514enum omap_dma_burst_mode { 481enum omap_dma_burst_mode {
515 OMAP_DMA_DATA_BURST_DIS = 0, 482 OMAP_DMA_DATA_BURST_DIS = 0,
516 OMAP_DMA_DATA_BURST_4, 483 OMAP_DMA_DATA_BURST_4,
@@ -661,20 +628,13 @@ extern int omap_modify_dma_chain_params(int chain_id,
661extern int omap_dma_chain_status(int chain_id); 628extern int omap_dma_chain_status(int chain_id);
662#endif 629#endif
663 630
664/* LCD DMA functions */ 631#if defined(CONFIG_ARCH_OMAP1) && defined(CONFIG_FB_OMAP)
665extern int omap_request_lcd_dma(void (*callback)(u16 status, void *data), 632#include <mach/lcd_dma.h>
666 void *data); 633#else
667extern void omap_free_lcd_dma(void); 634static inline int omap_lcd_dma_running(void)
668extern void omap_setup_lcd_dma(void); 635{
669extern void omap_enable_lcd_dma(void); 636 return 0;
670extern void omap_stop_lcd_dma(void); 637}
671extern void omap_set_lcd_dma_ext_controller(int external); 638#endif
672extern void omap_set_lcd_dma_single_transfer(int single);
673extern void omap_set_lcd_dma_b1(unsigned long addr, u16 fb_xres, u16 fb_yres,
674 int data_type);
675extern void omap_set_lcd_dma_b1_rotation(int rotate);
676extern void omap_set_lcd_dma_b1_vxres(unsigned long vxres);
677extern void omap_set_lcd_dma_b1_mirror(int mirror);
678extern void omap_set_lcd_dma_b1_scale(unsigned int xscale, unsigned int yscale);
679 639
680#endif /* __ASM_ARCH_DMA_H */ 640#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/plat-omap/include/plat/gpmc.h b/arch/arm/plat-omap/include/plat/gpmc.h
index 696e0ca051b7..e081338e0b23 100644
--- a/arch/arm/plat-omap/include/plat/gpmc.h
+++ b/arch/arm/plat-omap/include/plat/gpmc.h
@@ -45,7 +45,7 @@
45#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1) 45#define GPMC_CONFIG1_DEVICESIZE_16 GPMC_CONFIG1_DEVICESIZE(1)
46#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10) 46#define GPMC_CONFIG1_DEVICETYPE(val) ((val & 3) << 10)
47#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0) 47#define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
48#define GPMC_CONFIG1_DEVICETYPE_NAND GPMC_CONFIG1_DEVICETYPE(1) 48#define GPMC_CONFIG1_DEVICETYPE_NAND GPMC_CONFIG1_DEVICETYPE(2)
49#define GPMC_CONFIG1_MUXADDDATA (1 << 9) 49#define GPMC_CONFIG1_MUXADDDATA (1 << 9)
50#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4) 50#define GPMC_CONFIG1_TIME_PARA_GRAN (1 << 4)
51#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3) 51#define GPMC_CONFIG1_FCLK_DIV(val) (val & 3)
diff --git a/arch/arm/plat-omap/include/plat/i2c.h b/arch/arm/plat-omap/include/plat/i2c.h
new file mode 100644
index 000000000000..585d9ca68b97
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/i2c.h
@@ -0,0 +1,39 @@
1/*
2 * Helper module for board specific I2C bus registration
3 *
4 * Copyright (C) 2009 Nokia Corporation.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * version 2 as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18 * 02110-1301 USA
19 *
20 */
21
22#include <linux/i2c.h>
23
24#if defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
25extern int omap_register_i2c_bus(int bus_id, u32 clkrate,
26 struct i2c_board_info const *info,
27 unsigned len);
28#else
29static inline int omap_register_i2c_bus(int bus_id, u32 clkrate,
30 struct i2c_board_info const *info,
31 unsigned len)
32{
33 return 0;
34}
35#endif
36
37int omap_plat_register_i2c_bus(int bus_id, u32 clkrate,
38 struct i2c_board_info const *info,
39 unsigned len);
diff --git a/arch/arm/plat-omap/include/plat/irqs.h b/arch/arm/plat-omap/include/plat/irqs.h
index ce5dd2d1dc21..97d6c50c3dcb 100644
--- a/arch/arm/plat-omap/include/plat/irqs.h
+++ b/arch/arm/plat-omap/include/plat/irqs.h
@@ -472,8 +472,22 @@
472#endif 472#endif
473#define TWL4030_GPIO_IRQ_END (TWL4030_GPIO_IRQ_BASE + TWL4030_GPIO_NR_IRQS) 473#define TWL4030_GPIO_IRQ_END (TWL4030_GPIO_IRQ_BASE + TWL4030_GPIO_NR_IRQS)
474 474
475#define TWL6030_IRQ_BASE (OMAP_FPGA_IRQ_END)
476#ifdef CONFIG_TWL4030_CORE
477#define TWL6030_BASE_NR_IRQS 20
478#else
479#define TWL6030_BASE_NR_IRQS 0
480#endif
481#define TWL6030_IRQ_END (TWL6030_IRQ_BASE + TWL6030_BASE_NR_IRQS)
482
475/* Total number of interrupts depends on the enabled blocks above */ 483/* Total number of interrupts depends on the enabled blocks above */
476#define NR_IRQS TWL4030_GPIO_IRQ_END 484#if (TWL4030_GPIO_IRQ_END > TWL6030_IRQ_END)
485#define TWL_IRQ_END TWL4030_GPIO_IRQ_END
486#else
487#define TWL_IRQ_END TWL6030_IRQ_END
488#endif
489
490#define NR_IRQS TWL_IRQ_END
477 491
478#define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32)) 492#define OMAP_IRQ_BIT(irq) (1 << ((irq) % 32))
479 493
diff --git a/arch/arm/plat-omap/include/plat/mux.h b/arch/arm/plat-omap/include/plat/mux.h
index ba77de601501..8f069cc80350 100644
--- a/arch/arm/plat-omap/include/plat/mux.h
+++ b/arch/arm/plat-omap/include/plat/mux.h
@@ -130,58 +130,11 @@
130#define OMAP2_PULL_UP (1 << 4) 130#define OMAP2_PULL_UP (1 << 4)
131#define OMAP2_ALTELECTRICALSEL (1 << 5) 131#define OMAP2_ALTELECTRICALSEL (1 << 5)
132 132
133/* 34xx specific mux bit defines */
134#define OMAP3_INPUT_EN (1 << 8)
135#define OMAP3_OFF_EN (1 << 9)
136#define OMAP3_OFFOUT_EN (1 << 10)
137#define OMAP3_OFFOUT_VAL (1 << 11)
138#define OMAP3_OFF_PULL_EN (1 << 12)
139#define OMAP3_OFF_PULL_UP (1 << 13)
140#define OMAP3_WAKEUP_EN (1 << 14)
141
142/* 34xx mux mode options for each pin. See TRM for options */
143#define OMAP34XX_MUX_MODE0 0
144#define OMAP34XX_MUX_MODE1 1
145#define OMAP34XX_MUX_MODE2 2
146#define OMAP34XX_MUX_MODE3 3
147#define OMAP34XX_MUX_MODE4 4
148#define OMAP34XX_MUX_MODE5 5
149#define OMAP34XX_MUX_MODE6 6
150#define OMAP34XX_MUX_MODE7 7
151
152/* 34xx active pin states */
153#define OMAP34XX_PIN_OUTPUT 0
154#define OMAP34XX_PIN_INPUT OMAP3_INPUT_EN
155#define OMAP34XX_PIN_INPUT_PULLUP (OMAP2_PULL_ENA | OMAP3_INPUT_EN \
156 | OMAP2_PULL_UP)
157#define OMAP34XX_PIN_INPUT_PULLDOWN (OMAP2_PULL_ENA | OMAP3_INPUT_EN)
158
159/* 34xx off mode states */
160#define OMAP34XX_PIN_OFF_NONE 0
161#define OMAP34XX_PIN_OFF_OUTPUT_HIGH (OMAP3_OFF_EN | OMAP3_OFFOUT_EN \
162 | OMAP3_OFFOUT_VAL)
163#define OMAP34XX_PIN_OFF_OUTPUT_LOW (OMAP3_OFF_EN | OMAP3_OFFOUT_EN)
164#define OMAP34XX_PIN_OFF_INPUT_PULLUP (OMAP3_OFF_EN | OMAP3_OFF_PULL_EN \
165 | OMAP3_OFF_PULL_UP)
166#define OMAP34XX_PIN_OFF_INPUT_PULLDOWN (OMAP3_OFF_EN | OMAP3_OFF_PULL_EN)
167#define OMAP34XX_PIN_OFF_WAKEUPENABLE OMAP3_WAKEUP_EN
168
169#define MUX_CFG_34XX(desc, reg_offset, mux_value) { \
170 .name = desc, \
171 .debug = 0, \
172 .mux_reg = reg_offset, \
173 .mux_val = mux_value \
174},
175
176struct pin_config { 133struct pin_config {
177 char *name; 134 char *name;
178 const unsigned int mux_reg; 135 const unsigned int mux_reg;
179 unsigned char debug; 136 unsigned char debug;
180 137
181#if defined(CONFIG_ARCH_OMAP34XX)
182 u16 mux_val; /* Wake-up, off mode, pull, mux mode */
183#endif
184
185#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP24XX) 138#if defined(CONFIG_ARCH_OMAP1) || defined(CONFIG_ARCH_OMAP24XX)
186 const unsigned char mask_offset; 139 const unsigned char mask_offset;
187 const unsigned char mask; 140 const unsigned char mask;
@@ -219,11 +172,17 @@ enum omap7xx_index {
219 AA17_7XX_USB_DM, 172 AA17_7XX_USB_DM,
220 W16_7XX_USB_PU_EN, 173 W16_7XX_USB_PU_EN,
221 W17_7XX_USB_VBUSI, 174 W17_7XX_USB_VBUSI,
175 W18_7XX_USB_DMCK_OUT,
176 W19_7XX_USB_DCRST,
222 177
223 /* MMC */ 178 /* MMC */
224 MMC_7XX_CMD, 179 MMC_7XX_CMD,
225 MMC_7XX_CLK, 180 MMC_7XX_CLK,
226 MMC_7XX_DAT0, 181 MMC_7XX_DAT0,
182
183 /* I2C */
184 I2C_7XX_SCL,
185 I2C_7XX_SDA,
227}; 186};
228 187
229enum omap1xxx_index { 188enum omap1xxx_index {
@@ -681,181 +640,6 @@ enum omap24xx_index {
681 640
682}; 641};
683 642
684enum omap34xx_index {
685 /* 34xx I2C */
686 K21_34XX_I2C1_SCL,
687 J21_34XX_I2C1_SDA,
688 AF15_34XX_I2C2_SCL,
689 AE15_34XX_I2C2_SDA,
690 AF14_34XX_I2C3_SCL,
691 AG14_34XX_I2C3_SDA,
692 AD26_34XX_I2C4_SCL,
693 AE26_34XX_I2C4_SDA,
694
695 /* PHY - HSUSB: 12-pin ULPI PHY: Port 1*/
696 Y8_3430_USB1HS_PHY_CLK,
697 Y9_3430_USB1HS_PHY_STP,
698 AA14_3430_USB1HS_PHY_DIR,
699 AA11_3430_USB1HS_PHY_NXT,
700 W13_3430_USB1HS_PHY_DATA0,
701 W12_3430_USB1HS_PHY_DATA1,
702 W11_3430_USB1HS_PHY_DATA2,
703 Y11_3430_USB1HS_PHY_DATA3,
704 W9_3430_USB1HS_PHY_DATA4,
705 Y12_3430_USB1HS_PHY_DATA5,
706 W8_3430_USB1HS_PHY_DATA6,
707 Y13_3430_USB1HS_PHY_DATA7,
708
709 /* PHY - HSUSB: 12-pin ULPI PHY: Port 2*/
710 AA8_3430_USB2HS_PHY_CLK,
711 AA10_3430_USB2HS_PHY_STP,
712 AA9_3430_USB2HS_PHY_DIR,
713 AB11_3430_USB2HS_PHY_NXT,
714 AB10_3430_USB2HS_PHY_DATA0,
715 AB9_3430_USB2HS_PHY_DATA1,
716 W3_3430_USB2HS_PHY_DATA2,
717 T4_3430_USB2HS_PHY_DATA3,
718 T3_3430_USB2HS_PHY_DATA4,
719 R3_3430_USB2HS_PHY_DATA5,
720 R4_3430_USB2HS_PHY_DATA6,
721 T2_3430_USB2HS_PHY_DATA7,
722
723
724 /* TLL - HSUSB: 12-pin TLL Port 1*/
725 Y8_3430_USB1HS_TLL_CLK,
726 Y9_3430_USB1HS_TLL_STP,
727 AA14_3430_USB1HS_TLL_DIR,
728 AA11_3430_USB1HS_TLL_NXT,
729 W13_3430_USB1HS_TLL_DATA0,
730 W12_3430_USB1HS_TLL_DATA1,
731 W11_3430_USB1HS_TLL_DATA2,
732 Y11_3430_USB1HS_TLL_DATA3,
733 W9_3430_USB1HS_TLL_DATA4,
734 Y12_3430_USB1HS_TLL_DATA5,
735 W8_3430_USB1HS_TLL_DATA6,
736 Y13_3430_USB1HS_TLL_DATA7,
737
738 /* TLL - HSUSB: 12-pin TLL Port 2*/
739 AA8_3430_USB2HS_TLL_CLK,
740 AA10_3430_USB2HS_TLL_STP,
741 AA9_3430_USB2HS_TLL_DIR,
742 AB11_3430_USB2HS_TLL_NXT,
743 AB10_3430_USB2HS_TLL_DATA0,
744 AB9_3430_USB2HS_TLL_DATA1,
745 W3_3430_USB2HS_TLL_DATA2,
746 T4_3430_USB2HS_TLL_DATA3,
747 T3_3430_USB2HS_TLL_DATA4,
748 R3_3430_USB2HS_TLL_DATA5,
749 R4_3430_USB2HS_TLL_DATA6,
750 T2_3430_USB2HS_TLL_DATA7,
751
752 /* TLL - HSUSB: 12-pin TLL Port 3*/
753 AA6_3430_USB3HS_TLL_CLK,
754 AB3_3430_USB3HS_TLL_STP,
755 AA3_3430_USB3HS_TLL_DIR,
756 Y3_3430_USB3HS_TLL_NXT,
757 AA5_3430_USB3HS_TLL_DATA0,
758 Y4_3430_USB3HS_TLL_DATA1,
759 Y5_3430_USB3HS_TLL_DATA2,
760 W5_3430_USB3HS_TLL_DATA3,
761 AB12_3430_USB3HS_TLL_DATA4,
762 AB13_3430_USB3HS_TLL_DATA5,
763 AA13_3430_USB3HS_TLL_DATA6,
764 AA12_3430_USB3HS_TLL_DATA7,
765
766 /* PHY FSUSB: FS Serial for Port 1 (multiple PHY modes supported) */
767 AF10_3430_USB1FS_PHY_MM1_RXDP,
768 AG9_3430_USB1FS_PHY_MM1_RXDM,
769 W13_3430_USB1FS_PHY_MM1_RXRCV,
770 W12_3430_USB1FS_PHY_MM1_TXSE0,
771 W11_3430_USB1FS_PHY_MM1_TXDAT,
772 Y11_3430_USB1FS_PHY_MM1_TXEN_N,
773
774 /* PHY FSUSB: FS Serial for Port 2 (multiple PHY modes supported) */
775 AF7_3430_USB2FS_PHY_MM2_RXDP,
776 AH7_3430_USB2FS_PHY_MM2_RXDM,
777 AB10_3430_USB2FS_PHY_MM2_RXRCV,
778 AB9_3430_USB2FS_PHY_MM2_TXSE0,
779 W3_3430_USB2FS_PHY_MM2_TXDAT,
780 T4_3430_USB2FS_PHY_MM2_TXEN_N,
781
782 /* PHY FSUSB: FS Serial for Port 3 (multiple PHY modes supported) */
783 AH3_3430_USB3FS_PHY_MM3_RXDP,
784 AE3_3430_USB3FS_PHY_MM3_RXDM,
785 AD1_3430_USB3FS_PHY_MM3_RXRCV,
786 AE1_3430_USB3FS_PHY_MM3_TXSE0,
787 AD2_3430_USB3FS_PHY_MM3_TXDAT,
788 AC1_3430_USB3FS_PHY_MM3_TXEN_N,
789
790 /* 34xx GPIO
791 * - normally these are bidirectional, no internal pullup/pulldown
792 * - "_UP" suffix (GPIO3_UP) if internal pullup is configured
793 * - "_DOWN" suffix (GPIO3_DOWN) with internal pulldown
794 * - "_OUT" suffix (GPIO3_OUT) for output-only pins (unlike 24xx)
795 */
796 AF26_34XX_GPIO0,
797 AF22_34XX_GPIO9,
798 AG9_34XX_GPIO23,
799 AH8_34XX_GPIO29,
800 U8_34XX_GPIO54_OUT,
801 U8_34XX_GPIO54_DOWN,
802 L8_34XX_GPIO63,
803 G25_34XX_GPIO86_OUT,
804 AG4_34XX_GPIO134_OUT,
805 AF4_34XX_GPIO135_OUT,
806 AE4_34XX_GPIO136_OUT,
807 AF6_34XX_GPIO140_UP,
808 AE6_34XX_GPIO141,
809 AF5_34XX_GPIO142,
810 AE5_34XX_GPIO143,
811 H19_34XX_GPIO164_OUT,
812 J25_34XX_GPIO170,
813
814 /* OMAP3 SDRC CKE signals to SDR/DDR ram chips */
815 H16_34XX_SDRC_CKE0,
816 H17_34XX_SDRC_CKE1,
817
818 /* MMC1 */
819 N28_3430_MMC1_CLK,
820 M27_3430_MMC1_CMD,
821 N27_3430_MMC1_DAT0,
822 N26_3430_MMC1_DAT1,
823 N25_3430_MMC1_DAT2,
824 P28_3430_MMC1_DAT3,
825 P27_3430_MMC1_DAT4,
826 P26_3430_MMC1_DAT5,
827 R27_3430_MMC1_DAT6,
828 R25_3430_MMC1_DAT7,
829
830 /* MMC2 */
831 AE2_3430_MMC2_CLK,
832 AG5_3430_MMC2_CMD,
833 AH5_3430_MMC2_DAT0,
834 AH4_3430_MMC2_DAT1,
835 AG4_3430_MMC2_DAT2,
836 AF4_3430_MMC2_DAT3,
837 AE4_3430_MMC2_DAT4,
838 AH3_3430_MMC2_DAT5,
839 AF3_3430_MMC2_DAT6,
840 AE3_3430_MMC2_DAT7,
841
842 /* MMC3 */
843 AF10_3430_MMC3_CLK,
844 AC3_3430_MMC3_CMD,
845 AE11_3430_MMC3_DAT0,
846 AH9_3430_MMC3_DAT1,
847 AF13_3430_MMC3_DAT2,
848 AF13_3430_MMC3_DAT3,
849
850 /* SYS_NIRQ T2 INT1 */
851 AF26_34XX_SYS_NIRQ,
852
853 /* EHCI GPIO's for OMAP3EVM (Rev >= E) */
854 AH14_34XX_GPIO21,
855 AF9_34XX_GPIO22,
856 U3_34XX_GPIO61,
857};
858
859struct omap_mux_cfg { 643struct omap_mux_cfg {
860 struct pin_config *pins; 644 struct pin_config *pins;
861 unsigned long size; 645 unsigned long size;
@@ -865,14 +649,14 @@ struct omap_mux_cfg {
865#ifdef CONFIG_OMAP_MUX 649#ifdef CONFIG_OMAP_MUX
866/* setup pin muxing in Linux */ 650/* setup pin muxing in Linux */
867extern int omap1_mux_init(void); 651extern int omap1_mux_init(void);
868extern int omap2_mux_init(void);
869extern int omap_mux_register(struct omap_mux_cfg *); 652extern int omap_mux_register(struct omap_mux_cfg *);
870extern int omap_cfg_reg(unsigned long reg_cfg); 653extern int omap_cfg_reg(unsigned long reg_cfg);
871#else 654#else
872/* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */ 655/* boot loader does it all (no warnings from CONFIG_OMAP_MUX_WARNINGS) */
873static inline int omap1_mux_init(void) { return 0; } 656static inline int omap1_mux_init(void) { return 0; }
874static inline int omap2_mux_init(void) { return 0; }
875static inline int omap_cfg_reg(unsigned long reg_cfg) { return 0; } 657static inline int omap_cfg_reg(unsigned long reg_cfg) { return 0; }
876#endif 658#endif
877 659
660extern int omap2_mux_init(void);
661
878#endif 662#endif
diff --git a/arch/arm/plat-omap/include/plat/omap44xx.h b/arch/arm/plat-omap/include/plat/omap44xx.h
index e52902a15c1a..ef870de43c29 100644
--- a/arch/arm/plat-omap/include/plat/omap44xx.h
+++ b/arch/arm/plat-omap/include/plat/omap44xx.h
@@ -26,8 +26,10 @@
26#define OMAP44XX_EMIF2_BASE 0x4d000000 26#define OMAP44XX_EMIF2_BASE 0x4d000000
27#define OMAP44XX_DMM_BASE 0x4e000000 27#define OMAP44XX_DMM_BASE 0x4e000000
28#define OMAP4430_32KSYNCT_BASE 0x4a304000 28#define OMAP4430_32KSYNCT_BASE 0x4a304000
29#define OMAP4430_CM_BASE 0x4a004000 29#define OMAP4430_CM1_BASE 0x4a004000
30#define OMAP4430_PRM_BASE 0x48306000 30#define OMAP4430_CM_BASE OMAP4430_CM1_BASE
31#define OMAP4430_CM2_BASE 0x4a008000
32#define OMAP4430_PRM_BASE 0x4a306000
31#define OMAP44XX_GPMC_BASE 0x50000000 33#define OMAP44XX_GPMC_BASE 0x50000000
32#define OMAP443X_SCM_BASE 0x4a002000 34#define OMAP443X_SCM_BASE 0x4a002000
33#define OMAP443X_CTRL_BASE OMAP443X_SCM_BASE 35#define OMAP443X_CTRL_BASE OMAP443X_SCM_BASE
diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h
index 11a9773a4e7f..dc1fac1d805c 100644
--- a/arch/arm/plat-omap/include/plat/omap_device.h
+++ b/arch/arm/plat-omap/include/plat/omap_device.h
@@ -50,8 +50,8 @@
50 * @pm_lats: ptr to an omap_device_pm_latency table 50 * @pm_lats: ptr to an omap_device_pm_latency table
51 * @pm_lats_cnt: ARRAY_SIZE() of what is passed to @pm_lats 51 * @pm_lats_cnt: ARRAY_SIZE() of what is passed to @pm_lats
52 * @pm_lat_level: array index of the last odpl entry executed - -1 if never 52 * @pm_lat_level: array index of the last odpl entry executed - -1 if never
53 * @dev_wakeup_lat: dev wakeup latency in microseconds 53 * @dev_wakeup_lat: dev wakeup latency in nanoseconds
54 * @_dev_wakeup_lat_limit: dev wakeup latency limit in usec - set by OMAP PM 54 * @_dev_wakeup_lat_limit: dev wakeup latency limit in nsec - set by OMAP PM
55 * @_state: one of OMAP_DEVICE_STATE_* (see above) 55 * @_state: one of OMAP_DEVICE_STATE_* (see above)
56 * @flags: device flags 56 * @flags: device flags
57 * 57 *
@@ -137,5 +137,7 @@ struct omap_device_pm_latency {
137}; 137};
138 138
139 139
140#endif 140/* Get omap_device pointer from platform_device pointer */
141#define to_omap_device(x) container_of((x), struct omap_device, pdev)
141 142
143#endif
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index dbdd123eca16..007935a921ea 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -50,6 +50,8 @@ struct omap_device;
50#define SYSC_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT) 50#define SYSC_ENAWAKEUP_MASK (1 << SYSC_ENAWAKEUP_SHIFT)
51#define SYSC_SOFTRESET_SHIFT 1 51#define SYSC_SOFTRESET_SHIFT 1
52#define SYSC_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT) 52#define SYSC_SOFTRESET_MASK (1 << SYSC_SOFTRESET_SHIFT)
53#define SYSC_AUTOIDLE_SHIFT 0
54#define SYSC_AUTOIDLE_MASK (1 << SYSC_AUTOIDLE_SHIFT)
53 55
54/* OCP SYSSTATUS bit shifts/masks */ 56/* OCP SYSSTATUS bit shifts/masks */
55#define SYSS_RESETDONE_SHIFT 0 57#define SYSS_RESETDONE_SHIFT 0
@@ -62,7 +64,21 @@ struct omap_device;
62 64
63 65
64/** 66/**
65 * struct omap_hwmod_dma_info - MPU address space handled by the hwmod 67 * struct omap_hwmod_irq_info - MPU IRQs used by the hwmod
68 * @name: name of the IRQ channel (module local name)
69 * @irq_ch: IRQ channel ID
70 *
71 * @name should be something short, e.g., "tx" or "rx". It is for use
72 * by platform_get_resource_byname(). It is defined locally to the
73 * hwmod.
74 */
75struct omap_hwmod_irq_info {
76 const char *name;
77 u16 irq;
78};
79
80/**
81 * struct omap_hwmod_dma_info - DMA channels used by the hwmod
66 * @name: name of the DMA channel (module local name) 82 * @name: name of the DMA channel (module local name)
67 * @dma_ch: DMA channel ID 83 * @dma_ch: DMA channel ID
68 * 84 *
@@ -294,13 +310,17 @@ struct omap_hwmod_omap4_prcm {
294 * SDRAM controller, etc. 310 * SDRAM controller, etc.
295 * HWMOD_INIT_NO_IDLE: don't idle this module at boot - important for SDRAM 311 * HWMOD_INIT_NO_IDLE: don't idle this module at boot - important for SDRAM
296 * controller, etc. 312 * controller, etc.
313 * HWMOD_NO_AUTOIDLE: disable module autoidle (OCP_SYSCONFIG.AUTOIDLE)
314 * when module is enabled, rather than the default, which is to
315 * enable autoidle
297 * HWMOD_SET_DEFAULT_CLOCKACT: program CLOCKACTIVITY bits at startup 316 * HWMOD_SET_DEFAULT_CLOCKACT: program CLOCKACTIVITY bits at startup
298 */ 317 */
299#define HWMOD_SWSUP_SIDLE (1 << 0) 318#define HWMOD_SWSUP_SIDLE (1 << 0)
300#define HWMOD_SWSUP_MSTANDBY (1 << 1) 319#define HWMOD_SWSUP_MSTANDBY (1 << 1)
301#define HWMOD_INIT_NO_RESET (1 << 2) 320#define HWMOD_INIT_NO_RESET (1 << 2)
302#define HWMOD_INIT_NO_IDLE (1 << 3) 321#define HWMOD_INIT_NO_IDLE (1 << 3)
303#define HWMOD_SET_DEFAULT_CLOCKACT (1 << 4) 322#define HWMOD_NO_OCP_AUTOIDLE (1 << 4)
323#define HWMOD_SET_DEFAULT_CLOCKACT (1 << 5)
304 324
305/* 325/*
306 * omap_hwmod._int_flags definitions 326 * omap_hwmod._int_flags definitions
@@ -373,7 +393,7 @@ struct omap_hwmod_omap4_prcm {
373struct omap_hwmod { 393struct omap_hwmod {
374 const char *name; 394 const char *name;
375 struct omap_device *od; 395 struct omap_device *od;
376 u8 *mpu_irqs; 396 struct omap_hwmod_irq_info *mpu_irqs;
377 struct omap_hwmod_dma_info *sdma_chs; 397 struct omap_hwmod_dma_info *sdma_chs;
378 union { 398 union {
379 struct omap_hwmod_omap2_prcm omap2; 399 struct omap_hwmod_omap2_prcm omap2;
diff --git a/arch/arm/plat-omap/include/plat/omapfb.h b/arch/arm/plat-omap/include/plat/omapfb.h
deleted file mode 100644
index bfef7ab95f17..000000000000
--- a/arch/arm/plat-omap/include/plat/omapfb.h
+++ /dev/null
@@ -1,398 +0,0 @@
1/*
2 * File: arch/arm/plat-omap/include/mach/omapfb.h
3 *
4 * Framebuffer driver for TI OMAP boards
5 *
6 * Copyright (C) 2004 Nokia Corporation
7 * Author: Imre Deak <imre.deak@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */
23
24#ifndef __OMAPFB_H
25#define __OMAPFB_H
26
27#include <asm/ioctl.h>
28#include <asm/types.h>
29
30/* IOCTL commands. */
31
32#define OMAP_IOW(num, dtype) _IOW('O', num, dtype)
33#define OMAP_IOR(num, dtype) _IOR('O', num, dtype)
34#define OMAP_IOWR(num, dtype) _IOWR('O', num, dtype)
35#define OMAP_IO(num) _IO('O', num)
36
37#define OMAPFB_MIRROR OMAP_IOW(31, int)
38#define OMAPFB_SYNC_GFX OMAP_IO(37)
39#define OMAPFB_VSYNC OMAP_IO(38)
40#define OMAPFB_SET_UPDATE_MODE OMAP_IOW(40, int)
41#define OMAPFB_GET_CAPS OMAP_IOR(42, struct omapfb_caps)
42#define OMAPFB_GET_UPDATE_MODE OMAP_IOW(43, int)
43#define OMAPFB_LCD_TEST OMAP_IOW(45, int)
44#define OMAPFB_CTRL_TEST OMAP_IOW(46, int)
45#define OMAPFB_UPDATE_WINDOW_OLD OMAP_IOW(47, struct omapfb_update_window_old)
46#define OMAPFB_SET_COLOR_KEY OMAP_IOW(50, struct omapfb_color_key)
47#define OMAPFB_GET_COLOR_KEY OMAP_IOW(51, struct omapfb_color_key)
48#define OMAPFB_SETUP_PLANE OMAP_IOW(52, struct omapfb_plane_info)
49#define OMAPFB_QUERY_PLANE OMAP_IOW(53, struct omapfb_plane_info)
50#define OMAPFB_UPDATE_WINDOW OMAP_IOW(54, struct omapfb_update_window)
51#define OMAPFB_SETUP_MEM OMAP_IOW(55, struct omapfb_mem_info)
52#define OMAPFB_QUERY_MEM OMAP_IOW(56, struct omapfb_mem_info)
53
54#define OMAPFB_CAPS_GENERIC_MASK 0x00000fff
55#define OMAPFB_CAPS_LCDC_MASK 0x00fff000
56#define OMAPFB_CAPS_PANEL_MASK 0xff000000
57
58#define OMAPFB_CAPS_MANUAL_UPDATE 0x00001000
59#define OMAPFB_CAPS_TEARSYNC 0x00002000
60#define OMAPFB_CAPS_PLANE_RELOCATE_MEM 0x00004000
61#define OMAPFB_CAPS_PLANE_SCALE 0x00008000
62#define OMAPFB_CAPS_WINDOW_PIXEL_DOUBLE 0x00010000
63#define OMAPFB_CAPS_WINDOW_SCALE 0x00020000
64#define OMAPFB_CAPS_WINDOW_OVERLAY 0x00040000
65#define OMAPFB_CAPS_WINDOW_ROTATE 0x00080000
66#define OMAPFB_CAPS_SET_BACKLIGHT 0x01000000
67
68/* Values from DSP must map to lower 16-bits */
69#define OMAPFB_FORMAT_MASK 0x00ff
70#define OMAPFB_FORMAT_FLAG_DOUBLE 0x0100
71#define OMAPFB_FORMAT_FLAG_TEARSYNC 0x0200
72#define OMAPFB_FORMAT_FLAG_FORCE_VSYNC 0x0400
73#define OMAPFB_FORMAT_FLAG_ENABLE_OVERLAY 0x0800
74#define OMAPFB_FORMAT_FLAG_DISABLE_OVERLAY 0x1000
75
76#define OMAPFB_EVENT_READY 1
77#define OMAPFB_EVENT_DISABLED 2
78
79#define OMAPFB_MEMTYPE_SDRAM 0
80#define OMAPFB_MEMTYPE_SRAM 1
81#define OMAPFB_MEMTYPE_MAX 1
82
83enum omapfb_color_format {
84 OMAPFB_COLOR_RGB565 = 0,
85 OMAPFB_COLOR_YUV422,
86 OMAPFB_COLOR_YUV420,
87 OMAPFB_COLOR_CLUT_8BPP,
88 OMAPFB_COLOR_CLUT_4BPP,
89 OMAPFB_COLOR_CLUT_2BPP,
90 OMAPFB_COLOR_CLUT_1BPP,
91 OMAPFB_COLOR_RGB444,
92 OMAPFB_COLOR_YUY422,
93};
94
95struct omapfb_update_window {
96 __u32 x, y;
97 __u32 width, height;
98 __u32 format;
99 __u32 out_x, out_y;
100 __u32 out_width, out_height;
101 __u32 reserved[8];
102};
103
104struct omapfb_update_window_old {
105 __u32 x, y;
106 __u32 width, height;
107 __u32 format;
108};
109
110enum omapfb_plane {
111 OMAPFB_PLANE_GFX = 0,
112 OMAPFB_PLANE_VID1,
113 OMAPFB_PLANE_VID2,
114};
115
116enum omapfb_channel_out {
117 OMAPFB_CHANNEL_OUT_LCD = 0,
118 OMAPFB_CHANNEL_OUT_DIGIT,
119};
120
121struct omapfb_plane_info {
122 __u32 pos_x;
123 __u32 pos_y;
124 __u8 enabled;
125 __u8 channel_out;
126 __u8 mirror;
127 __u8 reserved1;
128 __u32 out_width;
129 __u32 out_height;
130 __u32 reserved2[12];
131};
132
133struct omapfb_mem_info {
134 __u32 size;
135 __u8 type;
136 __u8 reserved[3];
137};
138
139struct omapfb_caps {
140 __u32 ctrl;
141 __u32 plane_color;
142 __u32 wnd_color;
143};
144
145enum omapfb_color_key_type {
146 OMAPFB_COLOR_KEY_DISABLED = 0,
147 OMAPFB_COLOR_KEY_GFX_DST,
148 OMAPFB_COLOR_KEY_VID_SRC,
149};
150
151struct omapfb_color_key {
152 __u8 channel_out;
153 __u32 background;
154 __u32 trans_key;
155 __u8 key_type;
156};
157
158enum omapfb_update_mode {
159 OMAPFB_UPDATE_DISABLED = 0,
160 OMAPFB_AUTO_UPDATE,
161 OMAPFB_MANUAL_UPDATE
162};
163
164#ifdef __KERNEL__
165
166#include <linux/completion.h>
167#include <linux/interrupt.h>
168#include <linux/fb.h>
169#include <linux/mutex.h>
170
171#include <plat/board.h>
172
173#define OMAP_LCDC_INV_VSYNC 0x0001
174#define OMAP_LCDC_INV_HSYNC 0x0002
175#define OMAP_LCDC_INV_PIX_CLOCK 0x0004
176#define OMAP_LCDC_INV_OUTPUT_EN 0x0008
177#define OMAP_LCDC_HSVS_RISING_EDGE 0x0010
178#define OMAP_LCDC_HSVS_OPPOSITE 0x0020
179
180#define OMAP_LCDC_SIGNAL_MASK 0x003f
181
182#define OMAP_LCDC_PANEL_TFT 0x0100
183
184#define OMAPFB_PLANE_XRES_MIN 8
185#define OMAPFB_PLANE_YRES_MIN 8
186
187#ifdef CONFIG_ARCH_OMAP1
188#define OMAPFB_PLANE_NUM 1
189#else
190#define OMAPFB_PLANE_NUM 3
191#endif
192
193struct omapfb_device;
194
195struct lcd_panel {
196 const char *name;
197 int config; /* TFT/STN, signal inversion */
198 int bpp; /* Pixel format in fb mem */
199 int data_lines; /* Lines on LCD HW interface */
200
201 int x_res, y_res;
202 int pixel_clock; /* In kHz */
203 int hsw; /* Horizontal synchronization
204 pulse width */
205 int hfp; /* Horizontal front porch */
206 int hbp; /* Horizontal back porch */
207 int vsw; /* Vertical synchronization
208 pulse width */
209 int vfp; /* Vertical front porch */
210 int vbp; /* Vertical back porch */
211 int acb; /* ac-bias pin frequency */
212 int pcd; /* pixel clock divider.
213 Obsolete use pixel_clock instead */
214
215 int (*init) (struct lcd_panel *panel,
216 struct omapfb_device *fbdev);
217 void (*cleanup) (struct lcd_panel *panel);
218 int (*enable) (struct lcd_panel *panel);
219 void (*disable) (struct lcd_panel *panel);
220 unsigned long (*get_caps) (struct lcd_panel *panel);
221 int (*set_bklight_level)(struct lcd_panel *panel,
222 unsigned int level);
223 unsigned int (*get_bklight_level)(struct lcd_panel *panel);
224 unsigned int (*get_bklight_max) (struct lcd_panel *panel);
225 int (*run_test) (struct lcd_panel *panel, int test_num);
226};
227
228struct extif_timings {
229 int cs_on_time;
230 int cs_off_time;
231 int we_on_time;
232 int we_off_time;
233 int re_on_time;
234 int re_off_time;
235 int we_cycle_time;
236 int re_cycle_time;
237 int cs_pulse_width;
238 int access_time;
239
240 int clk_div;
241
242 u32 tim[5]; /* set by extif->convert_timings */
243
244 int converted;
245};
246
247struct lcd_ctrl_extif {
248 int (*init) (struct omapfb_device *fbdev);
249 void (*cleanup) (void);
250 void (*get_clk_info) (u32 *clk_period, u32 *max_clk_div);
251 unsigned long (*get_max_tx_rate)(void);
252 int (*convert_timings) (struct extif_timings *timings);
253 void (*set_timings) (const struct extif_timings *timings);
254 void (*set_bits_per_cycle)(int bpc);
255 void (*write_command) (const void *buf, unsigned int len);
256 void (*read_data) (void *buf, unsigned int len);
257 void (*write_data) (const void *buf, unsigned int len);
258 void (*transfer_area) (int width, int height,
259 void (callback)(void * data), void *data);
260 int (*setup_tearsync) (unsigned pin_cnt,
261 unsigned hs_pulse_time, unsigned vs_pulse_time,
262 int hs_pol_inv, int vs_pol_inv, int div);
263 int (*enable_tearsync) (int enable, unsigned line);
264
265 unsigned long max_transmit_size;
266};
267
268struct omapfb_notifier_block {
269 struct notifier_block nb;
270 void *data;
271 int plane_idx;
272};
273
274typedef int (*omapfb_notifier_callback_t)(struct notifier_block *,
275 unsigned long event,
276 void *fbi);
277
278struct omapfb_mem_region {
279 u32 paddr;
280 void __iomem *vaddr;
281 unsigned long size;
282 u8 type; /* OMAPFB_PLANE_MEM_* */
283 unsigned alloc:1; /* allocated by the driver */
284 unsigned map:1; /* kernel mapped by the driver */
285};
286
287struct omapfb_mem_desc {
288 int region_cnt;
289 struct omapfb_mem_region region[OMAPFB_PLANE_NUM];
290};
291
292struct lcd_ctrl {
293 const char *name;
294 void *data;
295
296 int (*init) (struct omapfb_device *fbdev,
297 int ext_mode,
298 struct omapfb_mem_desc *req_md);
299 void (*cleanup) (void);
300 void (*bind_client) (struct omapfb_notifier_block *nb);
301 void (*get_caps) (int plane, struct omapfb_caps *caps);
302 int (*set_update_mode)(enum omapfb_update_mode mode);
303 enum omapfb_update_mode (*get_update_mode)(void);
304 int (*setup_plane) (int plane, int channel_out,
305 unsigned long offset,
306 int screen_width,
307 int pos_x, int pos_y, int width,
308 int height, int color_mode);
309 int (*set_rotate) (int angle);
310 int (*setup_mem) (int plane, size_t size,
311 int mem_type, unsigned long *paddr);
312 int (*mmap) (struct fb_info *info,
313 struct vm_area_struct *vma);
314 int (*set_scale) (int plane,
315 int orig_width, int orig_height,
316 int out_width, int out_height);
317 int (*enable_plane) (int plane, int enable);
318 int (*update_window) (struct fb_info *fbi,
319 struct omapfb_update_window *win,
320 void (*callback)(void *),
321 void *callback_data);
322 void (*sync) (void);
323 void (*suspend) (void);
324 void (*resume) (void);
325 int (*run_test) (int test_num);
326 int (*setcolreg) (u_int regno, u16 red, u16 green,
327 u16 blue, u16 transp,
328 int update_hw_mem);
329 int (*set_color_key) (struct omapfb_color_key *ck);
330 int (*get_color_key) (struct omapfb_color_key *ck);
331};
332
333enum omapfb_state {
334 OMAPFB_DISABLED = 0,
335 OMAPFB_SUSPENDED= 99,
336 OMAPFB_ACTIVE = 100
337};
338
339struct omapfb_plane_struct {
340 int idx;
341 struct omapfb_plane_info info;
342 enum omapfb_color_format color_mode;
343 struct omapfb_device *fbdev;
344};
345
346struct omapfb_device {
347 int state;
348 int ext_lcdc; /* Using external
349 LCD controller */
350 struct mutex rqueue_mutex;
351
352 int palette_size;
353 u32 pseudo_palette[17];
354
355 struct lcd_panel *panel; /* LCD panel */
356 const struct lcd_ctrl *ctrl; /* LCD controller */
357 const struct lcd_ctrl *int_ctrl; /* internal LCD ctrl */
358 struct lcd_ctrl_extif *ext_if; /* LCD ctrl external
359 interface */
360 struct device *dev;
361 struct fb_var_screeninfo new_var; /* for mode changes */
362
363 struct omapfb_mem_desc mem_desc;
364 struct fb_info *fb_info[OMAPFB_PLANE_NUM];
365};
366
367struct omapfb_platform_data {
368 struct omap_lcd_config lcd;
369 struct omapfb_mem_desc mem_desc;
370 void *ctrl_platform_data;
371};
372
373#ifdef CONFIG_ARCH_OMAP1
374extern struct lcd_ctrl omap1_lcd_ctrl;
375#else
376extern struct lcd_ctrl omap2_disp_ctrl;
377#endif
378
379extern void omapfb_reserve_sdram(void);
380extern void omapfb_register_panel(struct lcd_panel *panel);
381extern void omapfb_write_first_pixel(struct omapfb_device *fbdev, u16 pixval);
382extern void omapfb_notify_clients(struct omapfb_device *fbdev,
383 unsigned long event);
384extern int omapfb_register_client(struct omapfb_notifier_block *nb,
385 omapfb_notifier_callback_t callback,
386 void *callback_data);
387extern int omapfb_unregister_client(struct omapfb_notifier_block *nb);
388extern int omapfb_update_window_async(struct fb_info *fbi,
389 struct omapfb_update_window *win,
390 void (*callback)(void *),
391 void *callback_data);
392
393/* in arch/arm/plat-omap/fb.c */
394extern void omapfb_set_ctrl_platform_data(void *pdata);
395
396#endif /* __KERNEL__ */
397
398#endif /* __OMAPFB_H */
diff --git a/arch/arm/plat-omap/include/plat/powerdomain.h b/arch/arm/plat-omap/include/plat/powerdomain.h
index 3d45ee1d3cf4..0b960051eaed 100644
--- a/arch/arm/plat-omap/include/plat/powerdomain.h
+++ b/arch/arm/plat-omap/include/plat/powerdomain.h
@@ -28,6 +28,8 @@
28#define PWRDM_POWER_INACTIVE 0x2 28#define PWRDM_POWER_INACTIVE 0x2
29#define PWRDM_POWER_ON 0x3 29#define PWRDM_POWER_ON 0x3
30 30
31#define PWRDM_MAX_PWRSTS 4
32
31/* Powerdomain allowable state bitfields */ 33/* Powerdomain allowable state bitfields */
32#define PWRSTS_OFF_ON ((1 << PWRDM_POWER_OFF) | \ 34#define PWRSTS_OFF_ON ((1 << PWRDM_POWER_OFF) | \
33 (1 << PWRDM_POWER_ON)) 35 (1 << PWRDM_POWER_ON))
@@ -40,7 +42,10 @@
40 42
41/* Powerdomain flags */ 43/* Powerdomain flags */
42#define PWRDM_HAS_HDWR_SAR (1 << 0) /* hardware save-and-restore support */ 44#define PWRDM_HAS_HDWR_SAR (1 << 0) /* hardware save-and-restore support */
43 45#define PWRDM_HAS_MPU_QUIRK (1 << 1) /* MPU pwr domain has MEM bank 0 bits
46 * in MEM bank 1 position. This is
47 * true for OMAP3430
48 */
44 49
45/* 50/*
46 * Number of memory banks that are power-controllable. On OMAP3430, the 51 * Number of memory banks that are power-controllable. On OMAP3430, the
@@ -85,15 +90,15 @@ struct powerdomain {
85 /* Used to represent the OMAP chip types containing this pwrdm */ 90 /* Used to represent the OMAP chip types containing this pwrdm */
86 const struct omap_chip_id omap_chip; 91 const struct omap_chip_id omap_chip;
87 92
88 /* Bit shift of this powerdomain's PM_WKDEP/CM_SLEEPDEP bit */
89 const u8 dep_bit;
90
91 /* Powerdomains that can be told to wake this powerdomain up */ 93 /* Powerdomains that can be told to wake this powerdomain up */
92 struct pwrdm_dep *wkdep_srcs; 94 struct pwrdm_dep *wkdep_srcs;
93 95
94 /* Powerdomains that can be told to keep this pwrdm from inactivity */ 96 /* Powerdomains that can be told to keep this pwrdm from inactivity */
95 struct pwrdm_dep *sleepdep_srcs; 97 struct pwrdm_dep *sleepdep_srcs;
96 98
99 /* Bit shift of this powerdomain's PM_WKDEP/CM_SLEEPDEP bit */
100 const u8 dep_bit;
101
97 /* Possible powerdomain power states */ 102 /* Possible powerdomain power states */
98 const u8 pwrsts; 103 const u8 pwrsts;
99 104
@@ -118,11 +123,11 @@ struct powerdomain {
118 struct list_head node; 123 struct list_head node;
119 124
120 int state; 125 int state;
121 unsigned state_counter[4]; 126 unsigned state_counter[PWRDM_MAX_PWRSTS];
122 127
123#ifdef CONFIG_PM_DEBUG 128#ifdef CONFIG_PM_DEBUG
124 s64 timer; 129 s64 timer;
125 s64 state_timer[4]; 130 s64 state_timer[PWRDM_MAX_PWRSTS];
126#endif 131#endif
127}; 132};
128 133
diff --git a/arch/arm/plat-omap/include/plat/sdrc.h b/arch/arm/plat-omap/include/plat/sdrc.h
index f704030d2a70..7b76f50564ba 100644
--- a/arch/arm/plat-omap/include/plat/sdrc.h
+++ b/arch/arm/plat-omap/include/plat/sdrc.h
@@ -94,7 +94,10 @@
94 94
95/* SMS register offsets - read/write with sms_{read,write}_reg() */ 95/* SMS register offsets - read/write with sms_{read,write}_reg() */
96 96
97#define SMS_SYSCONFIG 0x010 97#define SMS_SYSCONFIG 0x010
98#define SMS_ROT_CONTROL(context) (0x180 + 0x10 * context)
99#define SMS_ROT_SIZE(context) (0x184 + 0x10 * context)
100#define SMS_ROT_PHYSICAL_BA(context) (0x188 + 0x10 * context)
98/* REVISIT: fill in other SMS registers here */ 101/* REVISIT: fill in other SMS registers here */
99 102
100 103
@@ -129,6 +132,10 @@ int omap2_sdrc_get_params(unsigned long r,
129void omap2_sms_save_context(void); 132void omap2_sms_save_context(void);
130void omap2_sms_restore_context(void); 133void omap2_sms_restore_context(void);
131 134
135void omap2_sms_write_rot_control(u32 val, unsigned ctx);
136void omap2_sms_write_rot_size(u32 val, unsigned ctx);
137void omap2_sms_write_rot_physical_ba(u32 val, unsigned ctx);
138
132#ifdef CONFIG_ARCH_OMAP2 139#ifdef CONFIG_ARCH_OMAP2
133 140
134struct memory_timings { 141struct memory_timings {
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index 9951345a25d6..f5a4a92393ef 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -53,6 +53,7 @@
53#ifndef __ASSEMBLER__ 53#ifndef __ASSEMBLER__
54extern void __init omap_serial_early_init(void); 54extern void __init omap_serial_early_init(void);
55extern void omap_serial_init(void); 55extern void omap_serial_init(void);
56extern void omap_serial_init_port(int port);
56extern int omap_uart_can_sleep(void); 57extern int omap_uart_can_sleep(void);
57extern void omap_uart_check_wakeup(void); 58extern void omap_uart_check_wakeup(void);
58extern void omap_uart_prepare_suspend(void); 59extern void omap_uart_prepare_suspend(void);
diff --git a/arch/arm/plat-omap/include/plat/smp.h b/arch/arm/plat-omap/include/plat/smp.h
index dcaa8fde7063..8983d54c4fd2 100644
--- a/arch/arm/plat-omap/include/plat/smp.h
+++ b/arch/arm/plat-omap/include/plat/smp.h
@@ -28,6 +28,8 @@
28 28
29/* Needed for secondary core boot */ 29/* Needed for secondary core boot */
30extern void omap_secondary_startup(void); 30extern void omap_secondary_startup(void);
31extern u32 omap_modify_auxcoreboot0(u32 set_mask, u32 clear_mask);
32extern void omap_auxcoreboot_addr(u32 cpu_addr);
31 33
32/* 34/*
33 * We use Soft IRQ1 as the IPI 35 * We use Soft IRQ1 as the IPI
diff --git a/arch/arm/plat-omap/include/plat/vram.h b/arch/arm/plat-omap/include/plat/vram.h
new file mode 100644
index 000000000000..edd4987758a6
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/vram.h
@@ -0,0 +1,62 @@
1/*
2 * VRAM manager for OMAP
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21#ifndef __OMAP_VRAM_H__
22#define __OMAP_VRAM_H__
23
24#include <linux/types.h>
25
26#define OMAP_VRAM_MEMTYPE_SDRAM 0
27#define OMAP_VRAM_MEMTYPE_SRAM 1
28#define OMAP_VRAM_MEMTYPE_MAX 1
29
30extern int omap_vram_add_region(unsigned long paddr, size_t size);
31extern int omap_vram_free(unsigned long paddr, size_t size);
32extern int omap_vram_alloc(int mtype, size_t size, unsigned long *paddr);
33extern int omap_vram_reserve(unsigned long paddr, size_t size);
34extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram,
35 unsigned long *largest_free_block);
36
37#ifdef CONFIG_OMAP2_VRAM
38extern void omap_vram_set_sdram_vram(u32 size, u32 start);
39extern void omap_vram_set_sram_vram(u32 size, u32 start);
40
41extern void omap_vram_reserve_sdram(void);
42extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
43 unsigned long sram_vstart,
44 unsigned long sram_size,
45 unsigned long pstart_avail,
46 unsigned long size_avail);
47#else
48static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { }
49static inline void omap_vram_set_sram_vram(u32 size, u32 start) { }
50
51static inline void omap_vram_reserve_sdram(void) { }
52static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
53 unsigned long sram_vstart,
54 unsigned long sram_size,
55 unsigned long pstart_avail,
56 unsigned long size_avail)
57{
58 return 0;
59}
60#endif
61
62#endif
diff --git a/arch/arm/plat-omap/include/plat/vrfb.h b/arch/arm/plat-omap/include/plat/vrfb.h
new file mode 100644
index 000000000000..d8a03ced3b10
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/vrfb.h
@@ -0,0 +1,50 @@
1/*
2 * VRFB Rotation Engine
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 */
20
21#ifndef __OMAP_VRFB_H__
22#define __OMAP_VRFB_H__
23
24#define OMAP_VRFB_LINE_LEN 2048
25
26struct vrfb {
27 u8 context;
28 void __iomem *vaddr[4];
29 unsigned long paddr[4];
30 u16 xres;
31 u16 yres;
32 u16 xoffset;
33 u16 yoffset;
34 u8 bytespp;
35 bool yuv_mode;
36};
37
38extern int omap_vrfb_request_ctx(struct vrfb *vrfb);
39extern void omap_vrfb_release_ctx(struct vrfb *vrfb);
40extern void omap_vrfb_adjust_size(u16 *width, u16 *height,
41 u8 bytespp);
42extern u32 omap_vrfb_min_phys_size(u16 width, u16 height, u8 bytespp);
43extern u16 omap_vrfb_max_height(u32 phys_size, u16 width, u8 bytespp);
44extern void omap_vrfb_setup(struct vrfb *vrfb, unsigned long paddr,
45 u16 width, u16 height,
46 unsigned bytespp, bool yuv_mode);
47extern int omap_vrfb_map_angle(struct vrfb *vrfb, u16 height, u8 rot);
48extern void omap_vrfb_restore_context(void);
49
50#endif /* __VRFB_H */
diff --git a/arch/arm/plat-omap/mux.c b/arch/arm/plat-omap/mux.c
index 05aebcad215b..06703635ace1 100644
--- a/arch/arm/plat-omap/mux.c
+++ b/arch/arm/plat-omap/mux.c
@@ -54,8 +54,12 @@ int __init_or_module omap_cfg_reg(const unsigned long index)
54{ 54{
55 struct pin_config *reg; 55 struct pin_config *reg;
56 56
57 if (cpu_is_omap44xx()) 57 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
58 return 0; 58 printk(KERN_ERR "mux: Broken omap_cfg_reg(%lu) entry\n",
59 index);
60 WARN_ON(1);
61 return -EINVAL;
62 }
59 63
60 if (mux_cfg == NULL) { 64 if (mux_cfg == NULL) {
61 printk(KERN_ERR "Pin mux table not initialized\n"); 65 printk(KERN_ERR "Pin mux table not initialized\n");
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index bb16e624a557..1e5648d3e3d8 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -134,18 +134,18 @@ static int _omap_device_activate(struct omap_device *od, u8 ignore_lat)
134 (od->dev_wakeup_lat <= od->_dev_wakeup_lat_limit)) 134 (od->dev_wakeup_lat <= od->_dev_wakeup_lat_limit))
135 break; 135 break;
136 136
137 getnstimeofday(&a); 137 read_persistent_clock(&a);
138 138
139 /* XXX check return code */ 139 /* XXX check return code */
140 odpl->activate_func(od); 140 odpl->activate_func(od);
141 141
142 getnstimeofday(&b); 142 read_persistent_clock(&b);
143 143
144 c = timespec_sub(b, a); 144 c = timespec_sub(b, a);
145 act_lat = timespec_to_ns(&c) * NSEC_PER_USEC; 145 act_lat = timespec_to_ns(&c);
146 146
147 pr_debug("omap_device: %s: pm_lat %d: activate: elapsed time " 147 pr_debug("omap_device: %s: pm_lat %d: activate: elapsed time "
148 "%llu usec\n", od->pdev.name, od->pm_lat_level, 148 "%llu nsec\n", od->pdev.name, od->pm_lat_level,
149 act_lat); 149 act_lat);
150 150
151 WARN(act_lat > odpl->activate_lat, "omap_device: %s.%d: " 151 WARN(act_lat > odpl->activate_lat, "omap_device: %s.%d: "
@@ -190,18 +190,18 @@ static int _omap_device_deactivate(struct omap_device *od, u8 ignore_lat)
190 od->_dev_wakeup_lat_limit)) 190 od->_dev_wakeup_lat_limit))
191 break; 191 break;
192 192
193 getnstimeofday(&a); 193 read_persistent_clock(&a);
194 194
195 /* XXX check return code */ 195 /* XXX check return code */
196 odpl->deactivate_func(od); 196 odpl->deactivate_func(od);
197 197
198 getnstimeofday(&b); 198 read_persistent_clock(&b);
199 199
200 c = timespec_sub(b, a); 200 c = timespec_sub(b, a);
201 deact_lat = timespec_to_ns(&c) * NSEC_PER_USEC; 201 deact_lat = timespec_to_ns(&c);
202 202
203 pr_debug("omap_device: %s: pm_lat %d: deactivate: elapsed time " 203 pr_debug("omap_device: %s: pm_lat %d: deactivate: elapsed time "
204 "%llu usec\n", od->pdev.name, od->pm_lat_level, 204 "%llu nsec\n", od->pdev.name, od->pm_lat_level,
205 deact_lat); 205 deact_lat);
206 206
207 WARN(deact_lat > odpl->deactivate_lat, "omap_device: %s.%d: " 207 WARN(deact_lat > odpl->deactivate_lat, "omap_device: %s.%d: "
@@ -459,7 +459,7 @@ int omap_device_enable(struct platform_device *pdev)
459 ret = _omap_device_activate(od, IGNORE_WAKEUP_LAT); 459 ret = _omap_device_activate(od, IGNORE_WAKEUP_LAT);
460 460
461 od->dev_wakeup_lat = 0; 461 od->dev_wakeup_lat = 0;
462 od->_dev_wakeup_lat_limit = INT_MAX; 462 od->_dev_wakeup_lat_limit = UINT_MAX;
463 od->_state = OMAP_DEVICE_STATE_ENABLED; 463 od->_state = OMAP_DEVICE_STATE_ENABLED;
464 464
465 return ret; 465 return ret;
diff --git a/arch/arm/plat-omap/sram.c b/arch/arm/plat-omap/sram.c
index 3e923668778d..d8d5094b37ed 100644
--- a/arch/arm/plat-omap/sram.c
+++ b/arch/arm/plat-omap/sram.c
@@ -28,6 +28,7 @@
28#include <plat/sram.h> 28#include <plat/sram.h>
29#include <plat/board.h> 29#include <plat/board.h>
30#include <plat/cpu.h> 30#include <plat/cpu.h>
31#include <plat/vram.h>
31 32
32#include <plat/control.h> 33#include <plat/control.h>
33 34
@@ -47,8 +48,10 @@
47#define OMAP3_SRAM_VA 0xfe400000 48#define OMAP3_SRAM_VA 0xfe400000
48#define OMAP3_SRAM_PUB_PA 0x40208000 49#define OMAP3_SRAM_PUB_PA 0x40208000
49#define OMAP3_SRAM_PUB_VA (OMAP3_SRAM_VA + 0x8000) 50#define OMAP3_SRAM_PUB_VA (OMAP3_SRAM_VA + 0x8000)
50#define OMAP4_SRAM_PA 0x40200000 /*0x402f0000*/ 51#define OMAP4_SRAM_PA 0x40300000
51#define OMAP4_SRAM_VA 0xfe400000 /*0xfe4f0000*/ 52#define OMAP4_SRAM_VA 0xfe400000
53#define OMAP4_SRAM_PUB_PA (OMAP4_SRAM_PA + 0x4000)
54#define OMAP4_SRAM_PUB_VA (OMAP4_SRAM_VA + 0x4000)
52 55
53#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX) 56#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
54#define SRAM_BOOTLOADER_SZ 0x00 57#define SRAM_BOOTLOADER_SZ 0x00
@@ -139,6 +142,10 @@ void __init omap_detect_sram(void)
139 } else { 142 } else {
140 omap_sram_size = 0x8000; /* 32K */ 143 omap_sram_size = 0x8000; /* 32K */
141 } 144 }
145 } else if (cpu_is_omap44xx()) {
146 omap_sram_base = OMAP4_SRAM_PUB_VA;
147 omap_sram_start = OMAP4_SRAM_PUB_PA;
148 omap_sram_size = 0xa000; /* 40K */
142 } else { 149 } else {
143 omap_sram_base = OMAP2_SRAM_PUB_VA; 150 omap_sram_base = OMAP2_SRAM_PUB_VA;
144 omap_sram_start = OMAP2_SRAM_PUB_PA; 151 omap_sram_start = OMAP2_SRAM_PUB_PA;
@@ -152,7 +159,7 @@ void __init omap_detect_sram(void)
152 } else if (cpu_is_omap44xx()) { 159 } else if (cpu_is_omap44xx()) {
153 omap_sram_base = OMAP4_SRAM_VA; 160 omap_sram_base = OMAP4_SRAM_VA;
154 omap_sram_start = OMAP4_SRAM_PA; 161 omap_sram_start = OMAP4_SRAM_PA;
155 omap_sram_size = 0x8000; /* 32K */ 162 omap_sram_size = 0xe000; /* 56K */
156 } else { 163 } else {
157 omap_sram_base = OMAP2_SRAM_VA; 164 omap_sram_base = OMAP2_SRAM_VA;
158 omap_sram_start = OMAP2_SRAM_PA; 165 omap_sram_start = OMAP2_SRAM_PA;
@@ -185,6 +192,13 @@ void __init omap_detect_sram(void)
185 omap_sram_start + SRAM_BOOTLOADER_SZ, 192 omap_sram_start + SRAM_BOOTLOADER_SZ,
186 omap_sram_size - SRAM_BOOTLOADER_SZ); 193 omap_sram_size - SRAM_BOOTLOADER_SZ);
187 omap_sram_size -= reserved; 194 omap_sram_size -= reserved;
195
196 reserved = omap_vram_reserve_sram(omap_sram_start, omap_sram_base,
197 omap_sram_size,
198 omap_sram_start + SRAM_BOOTLOADER_SZ,
199 omap_sram_size - SRAM_BOOTLOADER_SZ);
200 omap_sram_size -= reserved;
201
188 omap_sram_ceil = omap_sram_base + omap_sram_size; 202 omap_sram_ceil = omap_sram_base + omap_sram_size;
189} 203}
190 204
diff --git a/arch/arm/plat-omap/usb.c b/arch/arm/plat-omap/usb.c
index 51033a4503c3..d3bf17cd36f3 100644
--- a/arch/arm/plat-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -137,7 +137,13 @@ static u32 __init omap_usb0_init(unsigned nwires, unsigned is_device)
137 if (is_device) { 137 if (is_device) {
138 if (cpu_is_omap24xx()) 138 if (cpu_is_omap24xx())
139 omap_cfg_reg(J20_24XX_USB0_PUEN); 139 omap_cfg_reg(J20_24XX_USB0_PUEN);
140 else 140 else if (cpu_is_omap7xx()) {
141 omap_cfg_reg(AA17_7XX_USB_DM);
142 omap_cfg_reg(W16_7XX_USB_PU_EN);
143 omap_cfg_reg(W17_7XX_USB_VBUSI);
144 omap_cfg_reg(W18_7XX_USB_DMCK_OUT);
145 omap_cfg_reg(W19_7XX_USB_DCRST);
146 } else
141 omap_cfg_reg(W4_USB_PUEN); 147 omap_cfg_reg(W4_USB_PUEN);
142 } 148 }
143 149
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 2d7423af1197..aed05bc3c2ea 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -38,16 +38,72 @@ union vfp_state *last_VFP_context[NR_CPUS];
38 */ 38 */
39unsigned int VFP_arch; 39unsigned int VFP_arch;
40 40
41/*
42 * Per-thread VFP initialization.
43 */
44static void vfp_thread_flush(struct thread_info *thread)
45{
46 union vfp_state *vfp = &thread->vfpstate;
47 unsigned int cpu;
48
49 memset(vfp, 0, sizeof(union vfp_state));
50
51 vfp->hard.fpexc = FPEXC_EN;
52 vfp->hard.fpscr = FPSCR_ROUND_NEAREST;
53
54 /*
55 * Disable VFP to ensure we initialize it first. We must ensure
56 * that the modification of last_VFP_context[] and hardware disable
57 * are done for the same CPU and without preemption.
58 */
59 cpu = get_cpu();
60 if (last_VFP_context[cpu] == vfp)
61 last_VFP_context[cpu] = NULL;
62 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
63 put_cpu();
64}
65
66static void vfp_thread_release(struct thread_info *thread)
67{
68 /* release case: Per-thread VFP cleanup. */
69 union vfp_state *vfp = &thread->vfpstate;
70 unsigned int cpu = thread->cpu;
71
72 if (last_VFP_context[cpu] == vfp)
73 last_VFP_context[cpu] = NULL;
74}
75
76/*
77 * When this function is called with the following 'cmd's, the following
78 * is true while this function is being run:
79 * THREAD_NOFTIFY_SWTICH:
80 * - the previously running thread will not be scheduled onto another CPU.
81 * - the next thread to be run (v) will not be running on another CPU.
82 * - thread->cpu is the local CPU number
83 * - not preemptible as we're called in the middle of a thread switch
84 * THREAD_NOTIFY_FLUSH:
85 * - the thread (v) will be running on the local CPU, so
86 * v === current_thread_info()
87 * - thread->cpu is the local CPU number at the time it is accessed,
88 * but may change at any time.
89 * - we could be preempted if tree preempt rcu is enabled, so
90 * it is unsafe to use thread->cpu.
91 * THREAD_NOTIFY_RELEASE:
92 * - the thread (v) will not be running on any CPU; it is a dead thread.
93 * - thread->cpu will be the last CPU the thread ran on, which may not
94 * be the current CPU.
95 * - we could be preempted if tree preempt rcu is enabled.
96 */
41static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v) 97static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
42{ 98{
43 struct thread_info *thread = v; 99 struct thread_info *thread = v;
44 union vfp_state *vfp;
45 __u32 cpu = thread->cpu;
46 100
47 if (likely(cmd == THREAD_NOTIFY_SWITCH)) { 101 if (likely(cmd == THREAD_NOTIFY_SWITCH)) {
48 u32 fpexc = fmrx(FPEXC); 102 u32 fpexc = fmrx(FPEXC);
49 103
50#ifdef CONFIG_SMP 104#ifdef CONFIG_SMP
105 unsigned int cpu = thread->cpu;
106
51 /* 107 /*
52 * On SMP, if VFP is enabled, save the old state in 108 * On SMP, if VFP is enabled, save the old state in
53 * case the thread migrates to a different CPU. The 109 * case the thread migrates to a different CPU. The
@@ -74,25 +130,10 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
74 return NOTIFY_DONE; 130 return NOTIFY_DONE;
75 } 131 }
76 132
77 vfp = &thread->vfpstate; 133 if (cmd == THREAD_NOTIFY_FLUSH)
78 if (cmd == THREAD_NOTIFY_FLUSH) { 134 vfp_thread_flush(thread);
79 /* 135 else
80 * Per-thread VFP initialisation. 136 vfp_thread_release(thread);
81 */
82 memset(vfp, 0, sizeof(union vfp_state));
83
84 vfp->hard.fpexc = FPEXC_EN;
85 vfp->hard.fpscr = FPSCR_ROUND_NEAREST;
86
87 /*
88 * Disable VFP to ensure we initialise it first.
89 */
90 fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
91 }
92
93 /* flush and release case: Per-thread VFP cleanup. */
94 if (last_VFP_context[cpu] == vfp)
95 last_VFP_context[cpu] = NULL;
96 137
97 return NOTIFY_DONE; 138 return NOTIFY_DONE;
98} 139}
diff --git a/arch/avr32/include/asm/syscalls.h b/arch/avr32/include/asm/syscalls.h
index 483d666c27c0..66a197266637 100644
--- a/arch/avr32/include/asm/syscalls.h
+++ b/arch/avr32/include/asm/syscalls.h
@@ -29,10 +29,6 @@ asmlinkage int sys_sigaltstack(const stack_t __user *, stack_t __user *,
29 struct pt_regs *); 29 struct pt_regs *);
30asmlinkage int sys_rt_sigreturn(struct pt_regs *); 30asmlinkage int sys_rt_sigreturn(struct pt_regs *);
31 31
32/* kernel/sys_avr32.c */
33asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long,
34 unsigned long, unsigned long, off_t);
35
36/* mm/cache.c */ 32/* mm/cache.c */
37asmlinkage int sys_cacheflush(int, void __user *, size_t); 33asmlinkage int sys_cacheflush(int, void __user *, size_t);
38 34
diff --git a/arch/avr32/kernel/sys_avr32.c b/arch/avr32/kernel/sys_avr32.c
index 5d2daeaf356f..459349b5ed5a 100644
--- a/arch/avr32/kernel/sys_avr32.c
+++ b/arch/avr32/kernel/sys_avr32.c
@@ -5,39 +5,8 @@
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8#include <linux/errno.h>
9#include <linux/fs.h>
10#include <linux/file.h>
11#include <linux/mm.h>
12#include <linux/unistd.h> 8#include <linux/unistd.h>
13 9
14#include <asm/mman.h>
15#include <asm/uaccess.h>
16#include <asm/syscalls.h>
17
18asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
19 unsigned long prot, unsigned long flags,
20 unsigned long fd, off_t offset)
21{
22 int error = -EBADF;
23 struct file *file = NULL;
24
25 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
26 if (!(flags & MAP_ANONYMOUS)) {
27 file = fget(fd);
28 if (!file)
29 return error;
30 }
31
32 down_write(&current->mm->mmap_sem);
33 error = do_mmap_pgoff(file, addr, len, prot, flags, offset);
34 up_write(&current->mm->mmap_sem);
35
36 if (file)
37 fput(file);
38 return error;
39}
40
41int kernel_execve(const char *file, char **argv, char **envp) 10int kernel_execve(const char *file, char **argv, char **envp)
42{ 11{
43 register long scno asm("r8") = __NR_execve; 12 register long scno asm("r8") = __NR_execve;
diff --git a/arch/avr32/kernel/syscall-stubs.S b/arch/avr32/kernel/syscall-stubs.S
index f7244cd02fbb..0447a3e2ba64 100644
--- a/arch/avr32/kernel/syscall-stubs.S
+++ b/arch/avr32/kernel/syscall-stubs.S
@@ -61,7 +61,7 @@ __sys_execve:
61__sys_mmap2: 61__sys_mmap2:
62 pushm lr 62 pushm lr
63 st.w --sp, ARG6 63 st.w --sp, ARG6
64 call sys_mmap2 64 call sys_mmap_pgoff
65 sub sp, -4 65 sub sp, -4
66 popm pc 66 popm pc
67 67
diff --git a/arch/blackfin/include/asm/fcntl.h b/arch/blackfin/include/asm/fcntl.h
index 8727b2b382f1..251c911d59c1 100644
--- a/arch/blackfin/include/asm/fcntl.h
+++ b/arch/blackfin/include/asm/fcntl.h
@@ -7,8 +7,6 @@
7#ifndef _BFIN_FCNTL_H 7#ifndef _BFIN_FCNTL_H
8#define _BFIN_FCNTL_H 8#define _BFIN_FCNTL_H
9 9
10/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
11 located on an ext2 file system */
12#define O_DIRECTORY 040000 /* must be a directory */ 10#define O_DIRECTORY 040000 /* must be a directory */
13#define O_NOFOLLOW 0100000 /* don't follow links */ 11#define O_NOFOLLOW 0100000 /* don't follow links */
14#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */ 12#define O_DIRECT 0200000 /* direct disk access hint - currently ignored */
diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c
index afcef129d4e8..2e7f8e10bf87 100644
--- a/arch/blackfin/kernel/sys_bfin.c
+++ b/arch/blackfin/kernel/sys_bfin.c
@@ -22,39 +22,6 @@
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23#include <asm/dma.h> 23#include <asm/dma.h>
24 24
25/* common code for old and new mmaps */
26static inline long
27do_mmap2(unsigned long addr, unsigned long len,
28 unsigned long prot, unsigned long flags,
29 unsigned long fd, unsigned long pgoff)
30{
31 int error = -EBADF;
32 struct file *file = NULL;
33
34 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
35 if (!(flags & MAP_ANONYMOUS)) {
36 file = fget(fd);
37 if (!file)
38 goto out;
39 }
40
41 down_write(&current->mm->mmap_sem);
42 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
43 up_write(&current->mm->mmap_sem);
44
45 if (file)
46 fput(file);
47 out:
48 return error;
49}
50
51asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
52 unsigned long prot, unsigned long flags,
53 unsigned long fd, unsigned long pgoff)
54{
55 return do_mmap2(addr, len, prot, flags, fd, pgoff);
56}
57
58asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags) 25asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
59{ 26{
60 return sram_alloc_with_lsl(size, flags); 27 return sram_alloc_with_lsl(size, flags);
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
index a50637a8b9bd..f3f8bb46b517 100644
--- a/arch/blackfin/mach-common/entry.S
+++ b/arch/blackfin/mach-common/entry.S
@@ -1422,7 +1422,7 @@ ENTRY(_sys_call_table)
1422 .long _sys_ni_syscall /* streams2 */ 1422 .long _sys_ni_syscall /* streams2 */
1423 .long _sys_vfork /* 190 */ 1423 .long _sys_vfork /* 190 */
1424 .long _sys_getrlimit 1424 .long _sys_getrlimit
1425 .long _sys_mmap2 1425 .long _sys_mmap_pgoff
1426 .long _sys_truncate64 1426 .long _sys_truncate64
1427 .long _sys_ftruncate64 1427 .long _sys_ftruncate64
1428 .long _sys_stat64 /* 195 */ 1428 .long _sys_stat64 /* 195 */
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
index 2ad962c7e88e..c2bbb1ac98a9 100644
--- a/arch/cris/kernel/sys_cris.c
+++ b/arch/cris/kernel/sys_cris.c
@@ -26,31 +26,6 @@
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/segment.h> 27#include <asm/segment.h>
28 28
29/* common code for old and new mmaps */
30static inline long
31do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
32 unsigned long flags, unsigned long fd, unsigned long pgoff)
33{
34 int error = -EBADF;
35 struct file * file = NULL;
36
37 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
38 if (!(flags & MAP_ANONYMOUS)) {
39 file = fget(fd);
40 if (!file)
41 goto out;
42 }
43
44 down_write(&current->mm->mmap_sem);
45 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
46 up_write(&current->mm->mmap_sem);
47
48 if (file)
49 fput(file);
50out:
51 return error;
52}
53
54asmlinkage unsigned long old_mmap(unsigned long __user *args) 29asmlinkage unsigned long old_mmap(unsigned long __user *args)
55{ 30{
56 unsigned long buffer[6]; 31 unsigned long buffer[6];
@@ -63,7 +38,7 @@ asmlinkage unsigned long old_mmap(unsigned long __user *args)
63 if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */ 38 if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */
64 goto out; 39 goto out;
65 40
66 err = do_mmap2(buffer[0], buffer[1], buffer[2], buffer[3], 41 err = sys_mmap_pgoff(buffer[0], buffer[1], buffer[2], buffer[3],
67 buffer[4], buffer[5] >> PAGE_SHIFT); 42 buffer[4], buffer[5] >> PAGE_SHIFT);
68out: 43out:
69 return err; 44 return err;
@@ -73,7 +48,8 @@ asmlinkage long
73sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 48sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
74 unsigned long flags, unsigned long fd, unsigned long pgoff) 49 unsigned long flags, unsigned long fd, unsigned long pgoff)
75{ 50{
76 return do_mmap2(addr, len, prot, flags, fd, pgoff); 51 /* bug(?): 8Kb pages here */
52 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
77} 53}
78 54
79/* 55/*
diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
index 2b6b5289cdcc..1d3d4c9e2521 100644
--- a/arch/frv/kernel/sys_frv.c
+++ b/arch/frv/kernel/sys_frv.c
@@ -31,9 +31,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
31 unsigned long prot, unsigned long flags, 31 unsigned long prot, unsigned long flags,
32 unsigned long fd, unsigned long pgoff) 32 unsigned long fd, unsigned long pgoff)
33{ 33{
34 int error = -EBADF;
35 struct file * file = NULL;
36
37 /* As with sparc32, make sure the shift for mmap2 is constant 34 /* As with sparc32, make sure the shift for mmap2 is constant
38 (12), no matter what PAGE_SIZE we have.... */ 35 (12), no matter what PAGE_SIZE we have.... */
39 36
@@ -41,69 +38,10 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
41 trying to map something we can't */ 38 trying to map something we can't */
42 if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1)) 39 if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1))
43 return -EINVAL; 40 return -EINVAL;
44 pgoff >>= PAGE_SHIFT - 12;
45
46 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
47 if (!(flags & MAP_ANONYMOUS)) {
48 file = fget(fd);
49 if (!file)
50 goto out;
51 }
52
53 down_write(&current->mm->mmap_sem);
54 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
55 up_write(&current->mm->mmap_sem);
56
57 if (file)
58 fput(file);
59out:
60 return error;
61}
62
63#if 0 /* DAVIDM - do we want this */
64struct mmap_arg_struct64 {
65 __u32 addr;
66 __u32 len;
67 __u32 prot;
68 __u32 flags;
69 __u64 offset; /* 64 bits */
70 __u32 fd;
71};
72
73asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
74{
75 int error = -EFAULT;
76 struct file * file = NULL;
77 struct mmap_arg_struct64 a;
78 unsigned long pgoff;
79
80 if (copy_from_user(&a, arg, sizeof(a)))
81 return -EFAULT;
82
83 if ((long)a.offset & ~PAGE_MASK)
84 return -EINVAL;
85
86 pgoff = a.offset >> PAGE_SHIFT;
87 if ((a.offset >> PAGE_SHIFT) != pgoff)
88 return -EINVAL;
89
90 if (!(a.flags & MAP_ANONYMOUS)) {
91 error = -EBADF;
92 file = fget(a.fd);
93 if (!file)
94 goto out;
95 }
96 a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
97 41
98 down_write(&current->mm->mmap_sem); 42 return sys_mmap_pgoff(addr, len, prot, flags, fd,
99 error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff); 43 pgoff >> (PAGE_SHIFT - 12));
100 up_write(&current->mm->mmap_sem);
101 if (file)
102 fput(file);
103out:
104 return error;
105} 44}
106#endif
107 45
108/* 46/*
109 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 47 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
index 8cb5d73a0e35..b5969db0ca10 100644
--- a/arch/h8300/kernel/sys_h8300.c
+++ b/arch/h8300/kernel/sys_h8300.c
@@ -26,39 +26,6 @@
26#include <asm/traps.h> 26#include <asm/traps.h>
27#include <asm/unistd.h> 27#include <asm/unistd.h>
28 28
29/* common code for old and new mmaps */
30static inline long do_mmap2(
31 unsigned long addr, unsigned long len,
32 unsigned long prot, unsigned long flags,
33 unsigned long fd, unsigned long pgoff)
34{
35 int error = -EBADF;
36 struct file * file = NULL;
37
38 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
39 if (!(flags & MAP_ANONYMOUS)) {
40 file = fget(fd);
41 if (!file)
42 goto out;
43 }
44
45 down_write(&current->mm->mmap_sem);
46 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
47 up_write(&current->mm->mmap_sem);
48
49 if (file)
50 fput(file);
51out:
52 return error;
53}
54
55asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
56 unsigned long prot, unsigned long flags,
57 unsigned long fd, unsigned long pgoff)
58{
59 return do_mmap2(addr, len, prot, flags, fd, pgoff);
60}
61
62/* 29/*
63 * Perform the select(nd, in, out, ex, tv) and mmap() system 30 * Perform the select(nd, in, out, ex, tv) and mmap() system
64 * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to 31 * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
@@ -87,57 +54,11 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
87 if (a.offset & ~PAGE_MASK) 54 if (a.offset & ~PAGE_MASK)
88 goto out; 55 goto out;
89 56
90 a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); 57 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
91 58 a.offset >> PAGE_SHIFT);
92 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
93out:
94 return error;
95}
96
97#if 0 /* DAVIDM - do we want this */
98struct mmap_arg_struct64 {
99 __u32 addr;
100 __u32 len;
101 __u32 prot;
102 __u32 flags;
103 __u64 offset; /* 64 bits */
104 __u32 fd;
105};
106
107asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
108{
109 int error = -EFAULT;
110 struct file * file = NULL;
111 struct mmap_arg_struct64 a;
112 unsigned long pgoff;
113
114 if (copy_from_user(&a, arg, sizeof(a)))
115 return -EFAULT;
116
117 if ((long)a.offset & ~PAGE_MASK)
118 return -EINVAL;
119
120 pgoff = a.offset >> PAGE_SHIFT;
121 if ((a.offset >> PAGE_SHIFT) != pgoff)
122 return -EINVAL;
123
124 if (!(a.flags & MAP_ANONYMOUS)) {
125 error = -EBADF;
126 file = fget(a.fd);
127 if (!file)
128 goto out;
129 }
130 a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
131
132 down_write(&current->mm->mmap_sem);
133 error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);
134 up_write(&current->mm->mmap_sem);
135 if (file)
136 fput(file);
137out: 59out:
138 return error; 60 return error;
139} 61}
140#endif
141 62
142struct sel_arg_struct { 63struct sel_arg_struct {
143 unsigned long n; 64 unsigned long n;
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
index 4eb67faac633..2d69881eda6a 100644
--- a/arch/h8300/kernel/syscalls.S
+++ b/arch/h8300/kernel/syscalls.S
@@ -206,7 +206,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
206 .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */ 206 .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */
207 .long SYMBOL_NAME(sys_vfork) /* 190 */ 207 .long SYMBOL_NAME(sys_vfork) /* 190 */
208 .long SYMBOL_NAME(sys_getrlimit) 208 .long SYMBOL_NAME(sys_getrlimit)
209 .long SYMBOL_NAME(sys_mmap2) 209 .long SYMBOL_NAME(sys_mmap_pgoff)
210 .long SYMBOL_NAME(sys_truncate64) 210 .long SYMBOL_NAME(sys_truncate64)
211 .long SYMBOL_NAME(sys_ftruncate64) 211 .long SYMBOL_NAME(sys_ftruncate64)
212 .long SYMBOL_NAME(sys_stat64) /* 195 */ 212 .long SYMBOL_NAME(sys_stat64) /* 195 */
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 1ee596cd942f..2d7f56a98e0f 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -87,9 +87,6 @@ config GENERIC_TIME_VSYSCALL
87 bool 87 bool
88 default y 88 default y
89 89
90config HAVE_LEGACY_PER_CPU_AREA
91 def_bool y
92
93config HAVE_SETUP_PER_CPU_AREA 90config HAVE_SETUP_PER_CPU_AREA
94 def_bool y 91 def_bool y
95 92
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index 429ec968c9ee..045b746b9808 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -858,6 +858,9 @@ ia32_do_mmap (struct file *file, unsigned long addr, unsigned long len, int prot
858 858
859 prot = get_prot32(prot); 859 prot = get_prot32(prot);
860 860
861 if (flags & MAP_HUGETLB)
862 return -ENOMEM;
863
861#if PAGE_SHIFT > IA32_PAGE_SHIFT 864#if PAGE_SHIFT > IA32_PAGE_SHIFT
862 mutex_lock(&ia32_mmap_mutex); 865 mutex_lock(&ia32_mmap_mutex);
863 { 866 {
diff --git a/arch/ia64/include/asm/meminit.h b/arch/ia64/include/asm/meminit.h
index 688a812c017d..61c7b1750b16 100644
--- a/arch/ia64/include/asm/meminit.h
+++ b/arch/ia64/include/asm/meminit.h
@@ -61,7 +61,7 @@ extern int register_active_ranges(u64 start, u64 len, int nid);
61 61
62#ifdef CONFIG_VIRTUAL_MEM_MAP 62#ifdef CONFIG_VIRTUAL_MEM_MAP
63# define LARGE_GAP 0x40000000 /* Use virtual mem map if hole is > than this */ 63# define LARGE_GAP 0x40000000 /* Use virtual mem map if hole is > than this */
64 extern unsigned long vmalloc_end; 64 extern unsigned long VMALLOC_END;
65 extern struct page *vmem_map; 65 extern struct page *vmem_map;
66 extern int find_largest_hole(u64 start, u64 end, void *arg); 66 extern int find_largest_hole(u64 start, u64 end, void *arg);
67 extern int create_mem_map_page_table(u64 start, u64 end, void *arg); 67 extern int create_mem_map_page_table(u64 start, u64 end, void *arg);
diff --git a/arch/ia64/include/asm/pgtable.h b/arch/ia64/include/asm/pgtable.h
index 8840a690d1e7..69bf13857a9f 100644
--- a/arch/ia64/include/asm/pgtable.h
+++ b/arch/ia64/include/asm/pgtable.h
@@ -228,8 +228,7 @@ ia64_phys_addr_valid (unsigned long addr)
228#define VMALLOC_START (RGN_BASE(RGN_GATE) + 0x200000000UL) 228#define VMALLOC_START (RGN_BASE(RGN_GATE) + 0x200000000UL)
229#ifdef CONFIG_VIRTUAL_MEM_MAP 229#ifdef CONFIG_VIRTUAL_MEM_MAP
230# define VMALLOC_END_INIT (RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9))) 230# define VMALLOC_END_INIT (RGN_BASE(RGN_GATE) + (1UL << (4*PAGE_SHIFT - 9)))
231# define VMALLOC_END vmalloc_end 231extern unsigned long VMALLOC_END;
232 extern unsigned long vmalloc_end;
233#else 232#else
234#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_SPARSEMEM_VMEMMAP) 233#if defined(CONFIG_SPARSEMEM) && defined(CONFIG_SPARSEMEM_VMEMMAP)
235/* SPARSEMEM_VMEMMAP uses half of vmalloc... */ 234/* SPARSEMEM_VMEMMAP uses half of vmalloc... */
diff --git a/arch/ia64/include/asm/processor.h b/arch/ia64/include/asm/processor.h
index 3eaeedf1aef2..7fa90f73f6be 100644
--- a/arch/ia64/include/asm/processor.h
+++ b/arch/ia64/include/asm/processor.h
@@ -229,7 +229,7 @@ struct cpuinfo_ia64 {
229#endif 229#endif
230}; 230};
231 231
232DECLARE_PER_CPU(struct cpuinfo_ia64, cpu_info); 232DECLARE_PER_CPU(struct cpuinfo_ia64, ia64_cpu_info);
233 233
234/* 234/*
235 * The "local" data variable. It refers to the per-CPU data of the currently executing 235 * The "local" data variable. It refers to the per-CPU data of the currently executing
@@ -237,8 +237,8 @@ DECLARE_PER_CPU(struct cpuinfo_ia64, cpu_info);
237 * Do not use the address of local_cpu_data, since it will be different from 237 * Do not use the address of local_cpu_data, since it will be different from
238 * cpu_data(smp_processor_id())! 238 * cpu_data(smp_processor_id())!
239 */ 239 */
240#define local_cpu_data (&__ia64_per_cpu_var(cpu_info)) 240#define local_cpu_data (&__ia64_per_cpu_var(ia64_cpu_info))
241#define cpu_data(cpu) (&per_cpu(cpu_info, cpu)) 241#define cpu_data(cpu) (&per_cpu(ia64_cpu_info, cpu))
242 242
243extern void print_cpu_info (struct cpuinfo_ia64 *); 243extern void print_cpu_info (struct cpuinfo_ia64 *);
244 244
diff --git a/arch/ia64/include/asm/xen/hypervisor.h b/arch/ia64/include/asm/xen/hypervisor.h
index 88afb54501e4..67455c2ed2b1 100644
--- a/arch/ia64/include/asm/xen/hypervisor.h
+++ b/arch/ia64/include/asm/xen/hypervisor.h
@@ -37,35 +37,9 @@
37#include <xen/interface/xen.h> 37#include <xen/interface/xen.h>
38#include <xen/interface/version.h> /* to compile feature.c */ 38#include <xen/interface/version.h> /* to compile feature.c */
39#include <xen/features.h> /* to comiple xen-netfront.c */ 39#include <xen/features.h> /* to comiple xen-netfront.c */
40#include <xen/xen.h>
40#include <asm/xen/hypercall.h> 41#include <asm/xen/hypercall.h>
41 42
42/* xen_domain_type is set before executing any C code by early_xen_setup */
43enum xen_domain_type {
44 XEN_NATIVE, /* running on bare hardware */
45 XEN_PV_DOMAIN, /* running in a PV domain */
46 XEN_HVM_DOMAIN, /* running in a Xen hvm domain*/
47};
48
49#ifdef CONFIG_XEN
50extern enum xen_domain_type xen_domain_type;
51#else
52#define xen_domain_type XEN_NATIVE
53#endif
54
55#define xen_domain() (xen_domain_type != XEN_NATIVE)
56#define xen_pv_domain() (xen_domain() && \
57 xen_domain_type == XEN_PV_DOMAIN)
58#define xen_hvm_domain() (xen_domain() && \
59 xen_domain_type == XEN_HVM_DOMAIN)
60
61#ifdef CONFIG_XEN_DOM0
62#define xen_initial_domain() (xen_pv_domain() && \
63 (xen_start_info->flags & SIF_INITDOMAIN))
64#else
65#define xen_initial_domain() (0)
66#endif
67
68
69#ifdef CONFIG_XEN 43#ifdef CONFIG_XEN
70extern struct shared_info *HYPERVISOR_shared_info; 44extern struct shared_info *HYPERVISOR_shared_info;
71extern struct start_info *xen_start_info; 45extern struct start_info *xen_start_info;
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index baec6f00f7f3..40574ae11401 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -702,11 +702,23 @@ int __init early_acpi_boot_init(void)
702 printk(KERN_ERR PREFIX 702 printk(KERN_ERR PREFIX
703 "Error parsing MADT - no LAPIC entries\n"); 703 "Error parsing MADT - no LAPIC entries\n");
704 704
705#ifdef CONFIG_SMP
706 if (available_cpus == 0) {
707 printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
708 printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
709 smp_boot_data.cpu_phys_id[available_cpus] =
710 hard_smp_processor_id();
711 available_cpus = 1; /* We've got at least one of these, no? */
712 }
713 smp_boot_data.cpu_count = available_cpus;
714#endif
715 /* Make boot-up look pretty */
716 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
717 total_cpus);
718
705 return 0; 719 return 0;
706} 720}
707 721
708
709
710int __init acpi_boot_init(void) 722int __init acpi_boot_init(void)
711{ 723{
712 724
@@ -769,18 +781,8 @@ int __init acpi_boot_init(void)
769 if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt)) 781 if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt))
770 printk(KERN_ERR PREFIX "Can't find FADT\n"); 782 printk(KERN_ERR PREFIX "Can't find FADT\n");
771 783
784#ifdef CONFIG_ACPI_NUMA
772#ifdef CONFIG_SMP 785#ifdef CONFIG_SMP
773 if (available_cpus == 0) {
774 printk(KERN_INFO "ACPI: Found 0 CPUS; assuming 1\n");
775 printk(KERN_INFO "CPU 0 (0x%04x)", hard_smp_processor_id());
776 smp_boot_data.cpu_phys_id[available_cpus] =
777 hard_smp_processor_id();
778 available_cpus = 1; /* We've got at least one of these, no? */
779 }
780 smp_boot_data.cpu_count = available_cpus;
781
782 smp_build_cpu_map();
783# ifdef CONFIG_ACPI_NUMA
784 if (srat_num_cpus == 0) { 786 if (srat_num_cpus == 0) {
785 int cpu, i = 1; 787 int cpu, i = 1;
786 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++) 788 for (cpu = 0; cpu < smp_boot_data.cpu_count; cpu++)
@@ -789,14 +791,9 @@ int __init acpi_boot_init(void)
789 node_cpuid[i++].phys_id = 791 node_cpuid[i++].phys_id =
790 smp_boot_data.cpu_phys_id[cpu]; 792 smp_boot_data.cpu_phys_id[cpu];
791 } 793 }
792# endif
793#endif 794#endif
794#ifdef CONFIG_ACPI_NUMA
795 build_cpu_to_node_map(); 795 build_cpu_to_node_map();
796#endif 796#endif
797 /* Make boot-up look pretty */
798 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus,
799 total_cpus);
800 return 0; 797 return 0;
801} 798}
802 799
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index 696eff28a0c4..17a9fba38930 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1051,7 +1051,7 @@ END(ia64_delay_loop)
1051 * intermediate precision so that we can produce a full 64-bit result. 1051 * intermediate precision so that we can produce a full 64-bit result.
1052 */ 1052 */
1053GLOBAL_ENTRY(ia64_native_sched_clock) 1053GLOBAL_ENTRY(ia64_native_sched_clock)
1054 addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 1054 addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
1055 mov.m r9=ar.itc // fetch cycle-counter (35 cyc) 1055 mov.m r9=ar.itc // fetch cycle-counter (35 cyc)
1056 ;; 1056 ;;
1057 ldf8 f8=[r8] 1057 ldf8 f8=[r8]
@@ -1077,7 +1077,7 @@ sched_clock = ia64_native_sched_clock
1077#ifdef CONFIG_VIRT_CPU_ACCOUNTING 1077#ifdef CONFIG_VIRT_CPU_ACCOUNTING
1078GLOBAL_ENTRY(cycle_to_cputime) 1078GLOBAL_ENTRY(cycle_to_cputime)
1079 alloc r16=ar.pfs,1,0,0,0 1079 alloc r16=ar.pfs,1,0,0,0
1080 addl r8=THIS_CPU(cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0 1080 addl r8=THIS_CPU(ia64_cpu_info) + IA64_CPUINFO_NSEC_PER_CYC_OFFSET,r0
1081 ;; 1081 ;;
1082 ldf8 f8=[r8] 1082 ldf8 f8=[r8]
1083 ;; 1083 ;;
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
index 14d39e300627..461b99902bf6 100644
--- a/arch/ia64/kernel/ia64_ksyms.c
+++ b/arch/ia64/kernel/ia64_ksyms.c
@@ -30,7 +30,7 @@ EXPORT_SYMBOL(max_low_pfn); /* defined by bootmem.c, but not exported by generic
30#endif 30#endif
31 31
32#include <asm/processor.h> 32#include <asm/processor.h>
33EXPORT_SYMBOL(per_cpu__cpu_info); 33EXPORT_SYMBOL(per_cpu__ia64_cpu_info);
34#ifdef CONFIG_SMP 34#ifdef CONFIG_SMP
35EXPORT_SYMBOL(per_cpu__local_per_cpu_offset); 35EXPORT_SYMBOL(per_cpu__local_per_cpu_offset);
36#endif 36#endif
diff --git a/arch/ia64/kernel/mca_asm.S b/arch/ia64/kernel/mca_asm.S
index 7461d2573d41..d5bdf9de36b6 100644
--- a/arch/ia64/kernel/mca_asm.S
+++ b/arch/ia64/kernel/mca_asm.S
@@ -59,7 +59,7 @@
59ia64_do_tlb_purge: 59ia64_do_tlb_purge:
60#define O(member) IA64_CPUINFO_##member##_OFFSET 60#define O(member) IA64_CPUINFO_##member##_OFFSET
61 61
62 GET_THIS_PADDR(r2, cpu_info) // load phys addr of cpu_info into r2 62 GET_THIS_PADDR(r2, ia64_cpu_info) // load phys addr of cpu_info into r2
63 ;; 63 ;;
64 addl r17=O(PTCE_STRIDE),r2 64 addl r17=O(PTCE_STRIDE),r2
65 addl r2=O(PTCE_BASE),r2 65 addl r2=O(PTCE_BASE),r2
diff --git a/arch/ia64/kernel/relocate_kernel.S b/arch/ia64/kernel/relocate_kernel.S
index 32f6fc131fbe..c370e02f0061 100644
--- a/arch/ia64/kernel/relocate_kernel.S
+++ b/arch/ia64/kernel/relocate_kernel.S
@@ -61,7 +61,7 @@ GLOBAL_ENTRY(relocate_new_kernel)
61 61
62 // purge all TC entries 62 // purge all TC entries
63#define O(member) IA64_CPUINFO_##member##_OFFSET 63#define O(member) IA64_CPUINFO_##member##_OFFSET
64 GET_THIS_PADDR(r2, cpu_info) // load phys addr of cpu_info into r2 64 GET_THIS_PADDR(r2, ia64_cpu_info) // load phys addr of cpu_info into r2
65 ;; 65 ;;
66 addl r17=O(PTCE_STRIDE),r2 66 addl r17=O(PTCE_STRIDE),r2
67 addl r2=O(PTCE_BASE),r2 67 addl r2=O(PTCE_BASE),r2
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 1de86c96801d..a1ea87919777 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -74,7 +74,7 @@ unsigned long __per_cpu_offset[NR_CPUS];
74EXPORT_SYMBOL(__per_cpu_offset); 74EXPORT_SYMBOL(__per_cpu_offset);
75#endif 75#endif
76 76
77DEFINE_PER_CPU(struct cpuinfo_ia64, cpu_info); 77DEFINE_PER_CPU(struct cpuinfo_ia64, ia64_cpu_info);
78DEFINE_PER_CPU(unsigned long, local_per_cpu_offset); 78DEFINE_PER_CPU(unsigned long, local_per_cpu_offset);
79unsigned long ia64_cycles_per_usec; 79unsigned long ia64_cycles_per_usec;
80struct ia64_boot_param *ia64_boot_param; 80struct ia64_boot_param *ia64_boot_param;
@@ -566,19 +566,18 @@ setup_arch (char **cmdline_p)
566 early_acpi_boot_init(); 566 early_acpi_boot_init();
567# ifdef CONFIG_ACPI_NUMA 567# ifdef CONFIG_ACPI_NUMA
568 acpi_numa_init(); 568 acpi_numa_init();
569#ifdef CONFIG_ACPI_HOTPLUG_CPU 569# ifdef CONFIG_ACPI_HOTPLUG_CPU
570 prefill_possible_map(); 570 prefill_possible_map();
571#endif 571# endif
572 per_cpu_scan_finalize((cpus_weight(early_cpu_possible_map) == 0 ? 572 per_cpu_scan_finalize((cpus_weight(early_cpu_possible_map) == 0 ?
573 32 : cpus_weight(early_cpu_possible_map)), 573 32 : cpus_weight(early_cpu_possible_map)),
574 additional_cpus > 0 ? additional_cpus : 0); 574 additional_cpus > 0 ? additional_cpus : 0);
575# endif 575# endif
576#else
577# ifdef CONFIG_SMP
578 smp_build_cpu_map(); /* happens, e.g., with the Ski simulator */
579# endif
580#endif /* CONFIG_APCI_BOOT */ 576#endif /* CONFIG_APCI_BOOT */
581 577
578#ifdef CONFIG_SMP
579 smp_build_cpu_map();
580#endif
582 find_memory(); 581 find_memory();
583 582
584 /* process SAL system table: */ 583 /* process SAL system table: */
@@ -856,18 +855,6 @@ identify_cpu (struct cpuinfo_ia64 *c)
856} 855}
857 856
858/* 857/*
859 * In UP configuration, setup_per_cpu_areas() is defined in
860 * include/linux/percpu.h
861 */
862#ifdef CONFIG_SMP
863void __init
864setup_per_cpu_areas (void)
865{
866 /* start_kernel() requires this... */
867}
868#endif
869
870/*
871 * Do the following calculations: 858 * Do the following calculations:
872 * 859 *
873 * 1. the max. cache line size. 860 * 1. the max. cache line size.
@@ -980,7 +967,7 @@ cpu_init (void)
980 * depends on the data returned by identify_cpu(). We break the dependency by 967 * depends on the data returned by identify_cpu(). We break the dependency by
981 * accessing cpu_data() through the canonical per-CPU address. 968 * accessing cpu_data() through the canonical per-CPU address.
982 */ 969 */
983 cpu_info = cpu_data + ((char *) &__ia64_per_cpu_var(cpu_info) - __per_cpu_start); 970 cpu_info = cpu_data + ((char *) &__ia64_per_cpu_var(ia64_cpu_info) - __per_cpu_start);
984 identify_cpu(cpu_info); 971 identify_cpu(cpu_info);
985 972
986#ifdef CONFIG_MCKINLEY 973#ifdef CONFIG_MCKINLEY
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index 92ed83f34036..609d50056a6c 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -100,51 +100,7 @@ sys_getpagesize (void)
100asmlinkage unsigned long 100asmlinkage unsigned long
101ia64_brk (unsigned long brk) 101ia64_brk (unsigned long brk)
102{ 102{
103 unsigned long rlim, retval, newbrk, oldbrk; 103 unsigned long retval = sys_brk(brk);
104 struct mm_struct *mm = current->mm;
105
106 /*
107 * Most of this replicates the code in sys_brk() except for an additional safety
108 * check and the clearing of r8. However, we can't call sys_brk() because we need
109 * to acquire the mmap_sem before we can do the test...
110 */
111 down_write(&mm->mmap_sem);
112
113 if (brk < mm->end_code)
114 goto out;
115 newbrk = PAGE_ALIGN(brk);
116 oldbrk = PAGE_ALIGN(mm->brk);
117 if (oldbrk == newbrk)
118 goto set_brk;
119
120 /* Always allow shrinking brk. */
121 if (brk <= mm->brk) {
122 if (!do_munmap(mm, newbrk, oldbrk-newbrk))
123 goto set_brk;
124 goto out;
125 }
126
127 /* Check against unimplemented/unmapped addresses: */
128 if ((newbrk - oldbrk) > RGN_MAP_LIMIT || REGION_OFFSET(newbrk) > RGN_MAP_LIMIT)
129 goto out;
130
131 /* Check against rlimit.. */
132 rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
133 if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim)
134 goto out;
135
136 /* Check against existing mmap mappings. */
137 if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE))
138 goto out;
139
140 /* Ok, looks good - let it rip. */
141 if (do_brk(oldbrk, newbrk-oldbrk) != oldbrk)
142 goto out;
143set_brk:
144 mm->brk = brk;
145out:
146 retval = mm->brk;
147 up_write(&mm->mmap_sem);
148 force_successful_syscall_return(); 104 force_successful_syscall_return();
149 return retval; 105 return retval;
150} 106}
@@ -185,39 +141,6 @@ int ia64_mmap_check(unsigned long addr, unsigned long len,
185 return 0; 141 return 0;
186} 142}
187 143
188static inline unsigned long
189do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff)
190{
191 struct file *file = NULL;
192
193 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
194 if (!(flags & MAP_ANONYMOUS)) {
195 file = fget(fd);
196 if (!file)
197 return -EBADF;
198
199 if (!file->f_op || !file->f_op->mmap) {
200 addr = -ENODEV;
201 goto out;
202 }
203 }
204
205 /* Careful about overflows.. */
206 len = PAGE_ALIGN(len);
207 if (!len || len > TASK_SIZE) {
208 addr = -EINVAL;
209 goto out;
210 }
211
212 down_write(&current->mm->mmap_sem);
213 addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
214 up_write(&current->mm->mmap_sem);
215
216out: if (file)
217 fput(file);
218 return addr;
219}
220
221/* 144/*
222 * mmap2() is like mmap() except that the offset is expressed in units 145 * mmap2() is like mmap() except that the offset is expressed in units
223 * of PAGE_SIZE (instead of bytes). This allows to mmap2() (pieces 146 * of PAGE_SIZE (instead of bytes). This allows to mmap2() (pieces
@@ -226,7 +149,7 @@ out: if (file)
226asmlinkage unsigned long 149asmlinkage unsigned long
227sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff) 150sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff)
228{ 151{
229 addr = do_mmap2(addr, len, prot, flags, fd, pgoff); 152 addr = sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
230 if (!IS_ERR((void *) addr)) 153 if (!IS_ERR((void *) addr))
231 force_successful_syscall_return(); 154 force_successful_syscall_return();
232 return addr; 155 return addr;
@@ -238,7 +161,7 @@ sys_mmap (unsigned long addr, unsigned long len, int prot, int flags, int fd, lo
238 if (offset_in_page(off) != 0) 161 if (offset_in_page(off) != 0)
239 return -EINVAL; 162 return -EINVAL;
240 163
241 addr = do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 164 addr = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
242 if (!IS_ERR((void *) addr)) 165 if (!IS_ERR((void *) addr))
243 force_successful_syscall_return(); 166 force_successful_syscall_return();
244 return addr; 167 return addr;
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 0a0c77b2c988..1295ba327f6f 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -166,6 +166,12 @@ SECTIONS
166 } 166 }
167#endif 167#endif
168 168
169#ifdef CONFIG_SMP
170 . = ALIGN(PERCPU_PAGE_SIZE);
171 __cpu0_per_cpu = .;
172 . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */
173#endif
174
169 . = ALIGN(PAGE_SIZE); 175 . = ALIGN(PAGE_SIZE);
170 __init_end = .; 176 __init_end = .;
171 177
@@ -198,11 +204,6 @@ SECTIONS
198 data : { } :data 204 data : { } :data
199 .data : AT(ADDR(.data) - LOAD_OFFSET) 205 .data : AT(ADDR(.data) - LOAD_OFFSET)
200 { 206 {
201#ifdef CONFIG_SMP
202 . = ALIGN(PERCPU_PAGE_SIZE);
203 __cpu0_per_cpu = .;
204 . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */
205#endif
206 INIT_TASK_DATA(PAGE_SIZE) 207 INIT_TASK_DATA(PAGE_SIZE)
207 CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES) 208 CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)
208 READ_MOSTLY_DATA(SMP_CACHE_BYTES) 209 READ_MOSTLY_DATA(SMP_CACHE_BYTES)
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 2f724d2bf299..54bf54059811 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -154,38 +154,99 @@ static void *cpu_data;
154void * __cpuinit 154void * __cpuinit
155per_cpu_init (void) 155per_cpu_init (void)
156{ 156{
157 int cpu; 157 static bool first_time = true;
158 static int first_time=1; 158 void *cpu0_data = __cpu0_per_cpu;
159 unsigned int cpu;
160
161 if (!first_time)
162 goto skip;
163 first_time = false;
159 164
160 /* 165 /*
161 * get_free_pages() cannot be used before cpu_init() done. BSP 166 * get_free_pages() cannot be used before cpu_init() done.
162 * allocates "NR_CPUS" pages for all CPUs to avoid that AP calls 167 * BSP allocates PERCPU_PAGE_SIZE bytes for all possible CPUs
163 * get_zeroed_page(). 168 * to avoid that AP calls get_zeroed_page().
164 */ 169 */
165 if (first_time) { 170 for_each_possible_cpu(cpu) {
166 void *cpu0_data = __cpu0_per_cpu; 171 void *src = cpu == 0 ? cpu0_data : __phys_per_cpu_start;
167 172
168 first_time=0; 173 memcpy(cpu_data, src, __per_cpu_end - __per_cpu_start);
174 __per_cpu_offset[cpu] = (char *)cpu_data - __per_cpu_start;
175 per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
169 176
170 __per_cpu_offset[0] = (char *) cpu0_data - __per_cpu_start; 177 /*
171 per_cpu(local_per_cpu_offset, 0) = __per_cpu_offset[0]; 178 * percpu area for cpu0 is moved from the __init area
179 * which is setup by head.S and used till this point.
180 * Update ar.k3. This move is ensures that percpu
181 * area for cpu0 is on the correct node and its
182 * virtual address isn't insanely far from other
183 * percpu areas which is important for congruent
184 * percpu allocator.
185 */
186 if (cpu == 0)
187 ia64_set_kr(IA64_KR_PER_CPU_DATA, __pa(cpu_data) -
188 (unsigned long)__per_cpu_start);
172 189
173 for (cpu = 1; cpu < NR_CPUS; cpu++) { 190 cpu_data += PERCPU_PAGE_SIZE;
174 memcpy(cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start);
175 __per_cpu_offset[cpu] = (char *) cpu_data - __per_cpu_start;
176 cpu_data += PERCPU_PAGE_SIZE;
177 per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
178 }
179 } 191 }
192skip:
180 return __per_cpu_start + __per_cpu_offset[smp_processor_id()]; 193 return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
181} 194}
182 195
183static inline void 196static inline void
184alloc_per_cpu_data(void) 197alloc_per_cpu_data(void)
185{ 198{
186 cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * NR_CPUS-1, 199 cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * num_possible_cpus(),
187 PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS)); 200 PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
188} 201}
202
203/**
204 * setup_per_cpu_areas - setup percpu areas
205 *
206 * Arch code has already allocated and initialized percpu areas. All
207 * this function has to do is to teach the determined layout to the
208 * dynamic percpu allocator, which happens to be more complex than
209 * creating whole new ones using helpers.
210 */
211void __init
212setup_per_cpu_areas(void)
213{
214 struct pcpu_alloc_info *ai;
215 struct pcpu_group_info *gi;
216 unsigned int cpu;
217 ssize_t static_size, reserved_size, dyn_size;
218 int rc;
219
220 ai = pcpu_alloc_alloc_info(1, num_possible_cpus());
221 if (!ai)
222 panic("failed to allocate pcpu_alloc_info");
223 gi = &ai->groups[0];
224
225 /* units are assigned consecutively to possible cpus */
226 for_each_possible_cpu(cpu)
227 gi->cpu_map[gi->nr_units++] = cpu;
228
229 /* set parameters */
230 static_size = __per_cpu_end - __per_cpu_start;
231 reserved_size = PERCPU_MODULE_RESERVE;
232 dyn_size = PERCPU_PAGE_SIZE - static_size - reserved_size;
233 if (dyn_size < 0)
234 panic("percpu area overflow static=%zd reserved=%zd\n",
235 static_size, reserved_size);
236
237 ai->static_size = static_size;
238 ai->reserved_size = reserved_size;
239 ai->dyn_size = dyn_size;
240 ai->unit_size = PERCPU_PAGE_SIZE;
241 ai->atom_size = PAGE_SIZE;
242 ai->alloc_size = PERCPU_PAGE_SIZE;
243
244 rc = pcpu_setup_first_chunk(ai, __per_cpu_start + __per_cpu_offset[0]);
245 if (rc)
246 panic("failed to setup percpu area (err=%d)", rc);
247
248 pcpu_free_alloc_info(ai);
249}
189#else 250#else
190#define alloc_per_cpu_data() do { } while (0) 251#define alloc_per_cpu_data() do { } while (0)
191#endif /* CONFIG_SMP */ 252#endif /* CONFIG_SMP */
@@ -270,8 +331,8 @@ paging_init (void)
270 331
271 map_size = PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) * 332 map_size = PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) *
272 sizeof(struct page)); 333 sizeof(struct page));
273 vmalloc_end -= map_size; 334 VMALLOC_END -= map_size;
274 vmem_map = (struct page *) vmalloc_end; 335 vmem_map = (struct page *) VMALLOC_END;
275 efi_memmap_walk(create_mem_map_page_table, NULL); 336 efi_memmap_walk(create_mem_map_page_table, NULL);
276 337
277 /* 338 /*
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index d85ba98d9008..19c4b2195dce 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -143,22 +143,120 @@ static void *per_cpu_node_setup(void *cpu_data, int node)
143 int cpu; 143 int cpu;
144 144
145 for_each_possible_early_cpu(cpu) { 145 for_each_possible_early_cpu(cpu) {
146 if (cpu == 0) { 146 void *src = cpu == 0 ? __cpu0_per_cpu : __phys_per_cpu_start;
147 void *cpu0_data = __cpu0_per_cpu; 147
148 __per_cpu_offset[cpu] = (char*)cpu0_data - 148 if (node != node_cpuid[cpu].nid)
149 __per_cpu_start; 149 continue;
150 } else if (node == node_cpuid[cpu].nid) { 150
151 memcpy(__va(cpu_data), __phys_per_cpu_start, 151 memcpy(__va(cpu_data), src, __per_cpu_end - __per_cpu_start);
152 __per_cpu_end - __per_cpu_start); 152 __per_cpu_offset[cpu] = (char *)__va(cpu_data) -
153 __per_cpu_offset[cpu] = (char*)__va(cpu_data) - 153 __per_cpu_start;
154 __per_cpu_start; 154
155 cpu_data += PERCPU_PAGE_SIZE; 155 /*
156 } 156 * percpu area for cpu0 is moved from the __init area
157 * which is setup by head.S and used till this point.
158 * Update ar.k3. This move is ensures that percpu
159 * area for cpu0 is on the correct node and its
160 * virtual address isn't insanely far from other
161 * percpu areas which is important for congruent
162 * percpu allocator.
163 */
164 if (cpu == 0)
165 ia64_set_kr(IA64_KR_PER_CPU_DATA,
166 (unsigned long)cpu_data -
167 (unsigned long)__per_cpu_start);
168
169 cpu_data += PERCPU_PAGE_SIZE;
157 } 170 }
158#endif 171#endif
159 return cpu_data; 172 return cpu_data;
160} 173}
161 174
175#ifdef CONFIG_SMP
176/**
177 * setup_per_cpu_areas - setup percpu areas
178 *
179 * Arch code has already allocated and initialized percpu areas. All
180 * this function has to do is to teach the determined layout to the
181 * dynamic percpu allocator, which happens to be more complex than
182 * creating whole new ones using helpers.
183 */
184void __init setup_per_cpu_areas(void)
185{
186 struct pcpu_alloc_info *ai;
187 struct pcpu_group_info *uninitialized_var(gi);
188 unsigned int *cpu_map;
189 void *base;
190 unsigned long base_offset;
191 unsigned int cpu;
192 ssize_t static_size, reserved_size, dyn_size;
193 int node, prev_node, unit, nr_units, rc;
194
195 ai = pcpu_alloc_alloc_info(MAX_NUMNODES, nr_cpu_ids);
196 if (!ai)
197 panic("failed to allocate pcpu_alloc_info");
198 cpu_map = ai->groups[0].cpu_map;
199
200 /* determine base */
201 base = (void *)ULONG_MAX;
202 for_each_possible_cpu(cpu)
203 base = min(base,
204 (void *)(__per_cpu_offset[cpu] + __per_cpu_start));
205 base_offset = (void *)__per_cpu_start - base;
206
207 /* build cpu_map, units are grouped by node */
208 unit = 0;
209 for_each_node(node)
210 for_each_possible_cpu(cpu)
211 if (node == node_cpuid[cpu].nid)
212 cpu_map[unit++] = cpu;
213 nr_units = unit;
214
215 /* set basic parameters */
216 static_size = __per_cpu_end - __per_cpu_start;
217 reserved_size = PERCPU_MODULE_RESERVE;
218 dyn_size = PERCPU_PAGE_SIZE - static_size - reserved_size;
219 if (dyn_size < 0)
220 panic("percpu area overflow static=%zd reserved=%zd\n",
221 static_size, reserved_size);
222
223 ai->static_size = static_size;
224 ai->reserved_size = reserved_size;
225 ai->dyn_size = dyn_size;
226 ai->unit_size = PERCPU_PAGE_SIZE;
227 ai->atom_size = PAGE_SIZE;
228 ai->alloc_size = PERCPU_PAGE_SIZE;
229
230 /*
231 * CPUs are put into groups according to node. Walk cpu_map
232 * and create new groups at node boundaries.
233 */
234 prev_node = -1;
235 ai->nr_groups = 0;
236 for (unit = 0; unit < nr_units; unit++) {
237 cpu = cpu_map[unit];
238 node = node_cpuid[cpu].nid;
239
240 if (node == prev_node) {
241 gi->nr_units++;
242 continue;
243 }
244 prev_node = node;
245
246 gi = &ai->groups[ai->nr_groups++];
247 gi->nr_units = 1;
248 gi->base_offset = __per_cpu_offset[cpu] + base_offset;
249 gi->cpu_map = &cpu_map[unit];
250 }
251
252 rc = pcpu_setup_first_chunk(ai, base);
253 if (rc)
254 panic("failed to setup percpu area (err=%d)", rc);
255
256 pcpu_free_alloc_info(ai);
257}
258#endif
259
162/** 260/**
163 * fill_pernode - initialize pernode data. 261 * fill_pernode - initialize pernode data.
164 * @node: the node id. 262 * @node: the node id.
@@ -352,7 +450,8 @@ static void __init initialize_pernode_data(void)
352 /* Set the node_data pointer for each per-cpu struct */ 450 /* Set the node_data pointer for each per-cpu struct */
353 for_each_possible_early_cpu(cpu) { 451 for_each_possible_early_cpu(cpu) {
354 node = node_cpuid[cpu].nid; 452 node = node_cpuid[cpu].nid;
355 per_cpu(cpu_info, cpu).node_data = mem_data[node].node_data; 453 per_cpu(ia64_cpu_info, cpu).node_data =
454 mem_data[node].node_data;
356 } 455 }
357#else 456#else
358 { 457 {
@@ -360,7 +459,7 @@ static void __init initialize_pernode_data(void)
360 cpu = 0; 459 cpu = 0;
361 node = node_cpuid[cpu].nid; 460 node = node_cpuid[cpu].nid;
362 cpu0_cpu_info = (struct cpuinfo_ia64 *)(__phys_per_cpu_start + 461 cpu0_cpu_info = (struct cpuinfo_ia64 *)(__phys_per_cpu_start +
363 ((char *)&per_cpu__cpu_info - __per_cpu_start)); 462 ((char *)&per_cpu__ia64_cpu_info - __per_cpu_start));
364 cpu0_cpu_info->node_data = mem_data[node].node_data; 463 cpu0_cpu_info->node_data = mem_data[node].node_data;
365 } 464 }
366#endif /* CONFIG_SMP */ 465#endif /* CONFIG_SMP */
@@ -666,9 +765,9 @@ void __init paging_init(void)
666 sparse_init(); 765 sparse_init();
667 766
668#ifdef CONFIG_VIRTUAL_MEM_MAP 767#ifdef CONFIG_VIRTUAL_MEM_MAP
669 vmalloc_end -= PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) * 768 VMALLOC_END -= PAGE_ALIGN(ALIGN(max_low_pfn, MAX_ORDER_NR_PAGES) *
670 sizeof(struct page)); 769 sizeof(struct page));
671 vmem_map = (struct page *) vmalloc_end; 770 vmem_map = (struct page *) VMALLOC_END;
672 efi_memmap_walk(create_mem_map_page_table, NULL); 771 efi_memmap_walk(create_mem_map_page_table, NULL);
673 printk("Virtual mem_map starts at 0x%p\n", vmem_map); 772 printk("Virtual mem_map starts at 0x%p\n", vmem_map);
674#endif 773#endif
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 1857766a63c1..b9609c69343a 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -44,8 +44,8 @@ extern void ia64_tlb_init (void);
44unsigned long MAX_DMA_ADDRESS = PAGE_OFFSET + 0x100000000UL; 44unsigned long MAX_DMA_ADDRESS = PAGE_OFFSET + 0x100000000UL;
45 45
46#ifdef CONFIG_VIRTUAL_MEM_MAP 46#ifdef CONFIG_VIRTUAL_MEM_MAP
47unsigned long vmalloc_end = VMALLOC_END_INIT; 47unsigned long VMALLOC_END = VMALLOC_END_INIT;
48EXPORT_SYMBOL(vmalloc_end); 48EXPORT_SYMBOL(VMALLOC_END);
49struct page *vmem_map; 49struct page *vmem_map;
50EXPORT_SYMBOL(vmem_map); 50EXPORT_SYMBOL(vmem_map);
51#endif 51#endif
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index c0fca2c1c858..df639db779f9 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -131,6 +131,7 @@ alloc_pci_controller (int seg)
131} 131}
132 132
133struct pci_root_info { 133struct pci_root_info {
134 struct acpi_device *bridge;
134 struct pci_controller *controller; 135 struct pci_controller *controller;
135 char *name; 136 char *name;
136}; 137};
@@ -297,9 +298,20 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
297 window->offset = offset; 298 window->offset = offset;
298 299
299 if (insert_resource(root, &window->resource)) { 300 if (insert_resource(root, &window->resource)) {
300 printk(KERN_ERR "alloc 0x%llx-0x%llx from %s for %s failed\n", 301 dev_err(&info->bridge->dev,
301 window->resource.start, window->resource.end, 302 "can't allocate host bridge window %pR\n",
302 root->name, info->name); 303 &window->resource);
304 } else {
305 if (offset)
306 dev_info(&info->bridge->dev, "host bridge window %pR "
307 "(PCI address [%#llx-%#llx])\n",
308 &window->resource,
309 window->resource.start - offset,
310 window->resource.end - offset);
311 else
312 dev_info(&info->bridge->dev,
313 "host bridge window %pR\n",
314 &window->resource);
303 } 315 }
304 316
305 return AE_OK; 317 return AE_OK;
@@ -319,8 +331,9 @@ pcibios_setup_root_windows(struct pci_bus *bus, struct pci_controller *ctrl)
319 (res->end - res->start < 16)) 331 (res->end - res->start < 16))
320 continue; 332 continue;
321 if (j >= PCI_BUS_NUM_RESOURCES) { 333 if (j >= PCI_BUS_NUM_RESOURCES) {
322 printk("Ignoring range [%#llx-%#llx] (%lx)\n", 334 dev_warn(&bus->dev,
323 res->start, res->end, res->flags); 335 "ignoring host bridge window %pR (no space)\n",
336 res);
324 continue; 337 continue;
325 } 338 }
326 bus->resource[j++] = res; 339 bus->resource[j++] = res;
@@ -364,6 +377,7 @@ pci_acpi_scan_root(struct acpi_device *device, int domain, int bus)
364 goto out3; 377 goto out3;
365 378
366 sprintf(name, "PCI Bus %04x:%02x", domain, bus); 379 sprintf(name, "PCI Bus %04x:%02x", domain, bus);
380 info.bridge = device;
367 info.controller = controller; 381 info.controller = controller;
368 info.name = name; 382 info.name = name;
369 acpi_walk_resources(device->handle, METHOD_NAME__CRS, 383 acpi_walk_resources(device->handle, METHOD_NAME__CRS,
@@ -720,9 +734,6 @@ int ia64_pci_legacy_write(struct pci_bus *bus, u16 port, u32 val, u8 size)
720 return ret; 734 return ret;
721} 735}
722 736
723/* It's defined in drivers/pci/pci.c */
724extern u8 pci_cache_line_size;
725
726/** 737/**
727 * set_pci_cacheline_size - determine cacheline size for PCI devices 738 * set_pci_cacheline_size - determine cacheline size for PCI devices
728 * 739 *
@@ -731,7 +742,7 @@ extern u8 pci_cache_line_size;
731 * 742 *
732 * Code mostly taken from arch/ia64/kernel/palinfo.c:cache_info(). 743 * Code mostly taken from arch/ia64/kernel/palinfo.c:cache_info().
733 */ 744 */
734static void __init set_pci_cacheline_size(void) 745static void __init set_pci_dfl_cacheline_size(void)
735{ 746{
736 unsigned long levels, unique_caches; 747 unsigned long levels, unique_caches;
737 long status; 748 long status;
@@ -751,7 +762,7 @@ static void __init set_pci_cacheline_size(void)
751 "(status=%ld)\n", __func__, status); 762 "(status=%ld)\n", __func__, status);
752 return; 763 return;
753 } 764 }
754 pci_cache_line_size = (1 << cci.pcci_line_size) / 4; 765 pci_dfl_cache_line_size = (1 << cci.pcci_line_size) / 4;
755} 766}
756 767
757u64 ia64_dma_get_required_mask(struct device *dev) 768u64 ia64_dma_get_required_mask(struct device *dev)
@@ -782,7 +793,7 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
782 793
783static int __init pcibios_init(void) 794static int __init pcibios_init(void)
784{ 795{
785 set_pci_cacheline_size(); 796 set_pci_dfl_cacheline_size();
786 return 0; 797 return 0;
787} 798}
788 799
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index 1176506b2bae..e884ba4e031d 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -496,13 +496,13 @@ static int sn2_ptc_seq_show(struct seq_file *file, void *data)
496 seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l, 496 seq_printf(file, "cpu %d %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld %ld\n", cpu, stat->ptc_l,
497 stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed, 497 stat->change_rid, stat->shub_ptc_flushes, stat->nodes_flushed,
498 stat->deadlocks, 498 stat->deadlocks,
499 1000 * stat->lock_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, 499 1000 * stat->lock_itc_clocks / per_cpu(ia64_cpu_info, cpu).cyc_per_usec,
500 1000 * stat->shub_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec, 500 1000 * stat->shub_itc_clocks / per_cpu(ia64_cpu_info, cpu).cyc_per_usec,
501 1000 * stat->shub_itc_clocks_max / per_cpu(cpu_info, cpu).cyc_per_usec, 501 1000 * stat->shub_itc_clocks_max / per_cpu(ia64_cpu_info, cpu).cyc_per_usec,
502 stat->shub_ptc_flushes_not_my_mm, 502 stat->shub_ptc_flushes_not_my_mm,
503 stat->deadlocks2, 503 stat->deadlocks2,
504 stat->shub_ipi_flushes, 504 stat->shub_ipi_flushes,
505 1000 * stat->shub_ipi_flushes_itc_clocks / per_cpu(cpu_info, cpu).cyc_per_usec); 505 1000 * stat->shub_ipi_flushes_itc_clocks / per_cpu(ia64_cpu_info, cpu).cyc_per_usec);
506 } 506 }
507 return 0; 507 return 0;
508} 508}
diff --git a/arch/ia64/xen/irq_xen.c b/arch/ia64/xen/irq_xen.c
index f042e192d2fe..a3fb7cf9ae1d 100644
--- a/arch/ia64/xen/irq_xen.c
+++ b/arch/ia64/xen/irq_xen.c
@@ -63,19 +63,19 @@ xen_free_irq_vector(int vector)
63} 63}
64 64
65 65
66static DEFINE_PER_CPU(int, timer_irq) = -1; 66static DEFINE_PER_CPU(int, xen_timer_irq) = -1;
67static DEFINE_PER_CPU(int, ipi_irq) = -1; 67static DEFINE_PER_CPU(int, xen_ipi_irq) = -1;
68static DEFINE_PER_CPU(int, resched_irq) = -1; 68static DEFINE_PER_CPU(int, xen_resched_irq) = -1;
69static DEFINE_PER_CPU(int, cmc_irq) = -1; 69static DEFINE_PER_CPU(int, xen_cmc_irq) = -1;
70static DEFINE_PER_CPU(int, cmcp_irq) = -1; 70static DEFINE_PER_CPU(int, xen_cmcp_irq) = -1;
71static DEFINE_PER_CPU(int, cpep_irq) = -1; 71static DEFINE_PER_CPU(int, xen_cpep_irq) = -1;
72#define NAME_SIZE 15 72#define NAME_SIZE 15
73static DEFINE_PER_CPU(char[NAME_SIZE], timer_name); 73static DEFINE_PER_CPU(char[NAME_SIZE], xen_timer_name);
74static DEFINE_PER_CPU(char[NAME_SIZE], ipi_name); 74static DEFINE_PER_CPU(char[NAME_SIZE], xen_ipi_name);
75static DEFINE_PER_CPU(char[NAME_SIZE], resched_name); 75static DEFINE_PER_CPU(char[NAME_SIZE], xen_resched_name);
76static DEFINE_PER_CPU(char[NAME_SIZE], cmc_name); 76static DEFINE_PER_CPU(char[NAME_SIZE], xen_cmc_name);
77static DEFINE_PER_CPU(char[NAME_SIZE], cmcp_name); 77static DEFINE_PER_CPU(char[NAME_SIZE], xen_cmcp_name);
78static DEFINE_PER_CPU(char[NAME_SIZE], cpep_name); 78static DEFINE_PER_CPU(char[NAME_SIZE], xen_cpep_name);
79#undef NAME_SIZE 79#undef NAME_SIZE
80 80
81struct saved_irq { 81struct saved_irq {
@@ -144,64 +144,64 @@ __xen_register_percpu_irq(unsigned int cpu, unsigned int vec,
144 if (xen_slab_ready) { 144 if (xen_slab_ready) {
145 switch (vec) { 145 switch (vec) {
146 case IA64_TIMER_VECTOR: 146 case IA64_TIMER_VECTOR:
147 snprintf(per_cpu(timer_name, cpu), 147 snprintf(per_cpu(xen_timer_name, cpu),
148 sizeof(per_cpu(timer_name, cpu)), 148 sizeof(per_cpu(xen_timer_name, cpu)),
149 "%s%d", action->name, cpu); 149 "%s%d", action->name, cpu);
150 irq = bind_virq_to_irqhandler(VIRQ_ITC, cpu, 150 irq = bind_virq_to_irqhandler(VIRQ_ITC, cpu,
151 action->handler, action->flags, 151 action->handler, action->flags,
152 per_cpu(timer_name, cpu), action->dev_id); 152 per_cpu(xen_timer_name, cpu), action->dev_id);
153 per_cpu(timer_irq, cpu) = irq; 153 per_cpu(xen_timer_irq, cpu) = irq;
154 break; 154 break;
155 case IA64_IPI_RESCHEDULE: 155 case IA64_IPI_RESCHEDULE:
156 snprintf(per_cpu(resched_name, cpu), 156 snprintf(per_cpu(xen_resched_name, cpu),
157 sizeof(per_cpu(resched_name, cpu)), 157 sizeof(per_cpu(xen_resched_name, cpu)),
158 "%s%d", action->name, cpu); 158 "%s%d", action->name, cpu);
159 irq = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, cpu, 159 irq = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR, cpu,
160 action->handler, action->flags, 160 action->handler, action->flags,
161 per_cpu(resched_name, cpu), action->dev_id); 161 per_cpu(xen_resched_name, cpu), action->dev_id);
162 per_cpu(resched_irq, cpu) = irq; 162 per_cpu(xen_resched_irq, cpu) = irq;
163 break; 163 break;
164 case IA64_IPI_VECTOR: 164 case IA64_IPI_VECTOR:
165 snprintf(per_cpu(ipi_name, cpu), 165 snprintf(per_cpu(xen_ipi_name, cpu),
166 sizeof(per_cpu(ipi_name, cpu)), 166 sizeof(per_cpu(xen_ipi_name, cpu)),
167 "%s%d", action->name, cpu); 167 "%s%d", action->name, cpu);
168 irq = bind_ipi_to_irqhandler(XEN_IPI_VECTOR, cpu, 168 irq = bind_ipi_to_irqhandler(XEN_IPI_VECTOR, cpu,
169 action->handler, action->flags, 169 action->handler, action->flags,
170 per_cpu(ipi_name, cpu), action->dev_id); 170 per_cpu(xen_ipi_name, cpu), action->dev_id);
171 per_cpu(ipi_irq, cpu) = irq; 171 per_cpu(xen_ipi_irq, cpu) = irq;
172 break; 172 break;
173 case IA64_CMC_VECTOR: 173 case IA64_CMC_VECTOR:
174 snprintf(per_cpu(cmc_name, cpu), 174 snprintf(per_cpu(xen_cmc_name, cpu),
175 sizeof(per_cpu(cmc_name, cpu)), 175 sizeof(per_cpu(xen_cmc_name, cpu)),
176 "%s%d", action->name, cpu); 176 "%s%d", action->name, cpu);
177 irq = bind_virq_to_irqhandler(VIRQ_MCA_CMC, cpu, 177 irq = bind_virq_to_irqhandler(VIRQ_MCA_CMC, cpu,
178 action->handler, 178 action->handler,
179 action->flags, 179 action->flags,
180 per_cpu(cmc_name, cpu), 180 per_cpu(xen_cmc_name, cpu),
181 action->dev_id); 181 action->dev_id);
182 per_cpu(cmc_irq, cpu) = irq; 182 per_cpu(xen_cmc_irq, cpu) = irq;
183 break; 183 break;
184 case IA64_CMCP_VECTOR: 184 case IA64_CMCP_VECTOR:
185 snprintf(per_cpu(cmcp_name, cpu), 185 snprintf(per_cpu(xen_cmcp_name, cpu),
186 sizeof(per_cpu(cmcp_name, cpu)), 186 sizeof(per_cpu(xen_cmcp_name, cpu)),
187 "%s%d", action->name, cpu); 187 "%s%d", action->name, cpu);
188 irq = bind_ipi_to_irqhandler(XEN_CMCP_VECTOR, cpu, 188 irq = bind_ipi_to_irqhandler(XEN_CMCP_VECTOR, cpu,
189 action->handler, 189 action->handler,
190 action->flags, 190 action->flags,
191 per_cpu(cmcp_name, cpu), 191 per_cpu(xen_cmcp_name, cpu),
192 action->dev_id); 192 action->dev_id);
193 per_cpu(cmcp_irq, cpu) = irq; 193 per_cpu(xen_cmcp_irq, cpu) = irq;
194 break; 194 break;
195 case IA64_CPEP_VECTOR: 195 case IA64_CPEP_VECTOR:
196 snprintf(per_cpu(cpep_name, cpu), 196 snprintf(per_cpu(xen_cpep_name, cpu),
197 sizeof(per_cpu(cpep_name, cpu)), 197 sizeof(per_cpu(xen_cpep_name, cpu)),
198 "%s%d", action->name, cpu); 198 "%s%d", action->name, cpu);
199 irq = bind_ipi_to_irqhandler(XEN_CPEP_VECTOR, cpu, 199 irq = bind_ipi_to_irqhandler(XEN_CPEP_VECTOR, cpu,
200 action->handler, 200 action->handler,
201 action->flags, 201 action->flags,
202 per_cpu(cpep_name, cpu), 202 per_cpu(xen_cpep_name, cpu),
203 action->dev_id); 203 action->dev_id);
204 per_cpu(cpep_irq, cpu) = irq; 204 per_cpu(xen_cpep_irq, cpu) = irq;
205 break; 205 break;
206 case IA64_CPE_VECTOR: 206 case IA64_CPE_VECTOR:
207 case IA64_MCA_RENDEZ_VECTOR: 207 case IA64_MCA_RENDEZ_VECTOR:
@@ -275,30 +275,33 @@ unbind_evtchn_callback(struct notifier_block *nfb,
275 275
276 if (action == CPU_DEAD) { 276 if (action == CPU_DEAD) {
277 /* Unregister evtchn. */ 277 /* Unregister evtchn. */
278 if (per_cpu(cpep_irq, cpu) >= 0) { 278 if (per_cpu(xen_cpep_irq, cpu) >= 0) {
279 unbind_from_irqhandler(per_cpu(cpep_irq, cpu), NULL); 279 unbind_from_irqhandler(per_cpu(xen_cpep_irq, cpu),
280 per_cpu(cpep_irq, cpu) = -1; 280 NULL);
281 per_cpu(xen_cpep_irq, cpu) = -1;
281 } 282 }
282 if (per_cpu(cmcp_irq, cpu) >= 0) { 283 if (per_cpu(xen_cmcp_irq, cpu) >= 0) {
283 unbind_from_irqhandler(per_cpu(cmcp_irq, cpu), NULL); 284 unbind_from_irqhandler(per_cpu(xen_cmcp_irq, cpu),
284 per_cpu(cmcp_irq, cpu) = -1; 285 NULL);
286 per_cpu(xen_cmcp_irq, cpu) = -1;
285 } 287 }
286 if (per_cpu(cmc_irq, cpu) >= 0) { 288 if (per_cpu(xen_cmc_irq, cpu) >= 0) {
287 unbind_from_irqhandler(per_cpu(cmc_irq, cpu), NULL); 289 unbind_from_irqhandler(per_cpu(xen_cmc_irq, cpu), NULL);
288 per_cpu(cmc_irq, cpu) = -1; 290 per_cpu(xen_cmc_irq, cpu) = -1;
289 } 291 }
290 if (per_cpu(ipi_irq, cpu) >= 0) { 292 if (per_cpu(xen_ipi_irq, cpu) >= 0) {
291 unbind_from_irqhandler(per_cpu(ipi_irq, cpu), NULL); 293 unbind_from_irqhandler(per_cpu(xen_ipi_irq, cpu), NULL);
292 per_cpu(ipi_irq, cpu) = -1; 294 per_cpu(xen_ipi_irq, cpu) = -1;
293 } 295 }
294 if (per_cpu(resched_irq, cpu) >= 0) { 296 if (per_cpu(xen_resched_irq, cpu) >= 0) {
295 unbind_from_irqhandler(per_cpu(resched_irq, cpu), 297 unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu),
296 NULL); 298 NULL);
297 per_cpu(resched_irq, cpu) = -1; 299 per_cpu(xen_resched_irq, cpu) = -1;
298 } 300 }
299 if (per_cpu(timer_irq, cpu) >= 0) { 301 if (per_cpu(xen_timer_irq, cpu) >= 0) {
300 unbind_from_irqhandler(per_cpu(timer_irq, cpu), NULL); 302 unbind_from_irqhandler(per_cpu(xen_timer_irq, cpu),
301 per_cpu(timer_irq, cpu) = -1; 303 NULL);
304 per_cpu(xen_timer_irq, cpu) = -1;
302 } 305 }
303 } 306 }
304 return NOTIFY_OK; 307 return NOTIFY_OK;
diff --git a/arch/ia64/xen/time.c b/arch/ia64/xen/time.c
index dbeadb9c8e20..c1c544513e8d 100644
--- a/arch/ia64/xen/time.c
+++ b/arch/ia64/xen/time.c
@@ -34,15 +34,15 @@
34 34
35#include "../kernel/fsyscall_gtod_data.h" 35#include "../kernel/fsyscall_gtod_data.h"
36 36
37DEFINE_PER_CPU(struct vcpu_runstate_info, runstate); 37static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
38DEFINE_PER_CPU(unsigned long, processed_stolen_time); 38static DEFINE_PER_CPU(unsigned long, xen_stolen_time);
39DEFINE_PER_CPU(unsigned long, processed_blocked_time); 39static DEFINE_PER_CPU(unsigned long, xen_blocked_time);
40 40
41/* taken from i386/kernel/time-xen.c */ 41/* taken from i386/kernel/time-xen.c */
42static void xen_init_missing_ticks_accounting(int cpu) 42static void xen_init_missing_ticks_accounting(int cpu)
43{ 43{
44 struct vcpu_register_runstate_memory_area area; 44 struct vcpu_register_runstate_memory_area area;
45 struct vcpu_runstate_info *runstate = &per_cpu(runstate, cpu); 45 struct vcpu_runstate_info *runstate = &per_cpu(xen_runstate, cpu);
46 int rc; 46 int rc;
47 47
48 memset(runstate, 0, sizeof(*runstate)); 48 memset(runstate, 0, sizeof(*runstate));
@@ -52,8 +52,8 @@ static void xen_init_missing_ticks_accounting(int cpu)
52 &area); 52 &area);
53 WARN_ON(rc && rc != -ENOSYS); 53 WARN_ON(rc && rc != -ENOSYS);
54 54
55 per_cpu(processed_blocked_time, cpu) = runstate->time[RUNSTATE_blocked]; 55 per_cpu(xen_blocked_time, cpu) = runstate->time[RUNSTATE_blocked];
56 per_cpu(processed_stolen_time, cpu) = runstate->time[RUNSTATE_runnable] 56 per_cpu(xen_stolen_time, cpu) = runstate->time[RUNSTATE_runnable]
57 + runstate->time[RUNSTATE_offline]; 57 + runstate->time[RUNSTATE_offline];
58} 58}
59 59
@@ -68,7 +68,7 @@ static void get_runstate_snapshot(struct vcpu_runstate_info *res)
68 68
69 BUG_ON(preemptible()); 69 BUG_ON(preemptible());
70 70
71 state = &__get_cpu_var(runstate); 71 state = &__get_cpu_var(xen_runstate);
72 72
73 /* 73 /*
74 * The runstate info is always updated by the hypervisor on 74 * The runstate info is always updated by the hypervisor on
@@ -103,12 +103,12 @@ consider_steal_time(unsigned long new_itm)
103 * This function just checks and reject this effect. 103 * This function just checks and reject this effect.
104 */ 104 */
105 if (!time_after_eq(runstate.time[RUNSTATE_blocked], 105 if (!time_after_eq(runstate.time[RUNSTATE_blocked],
106 per_cpu(processed_blocked_time, cpu))) 106 per_cpu(xen_blocked_time, cpu)))
107 blocked = 0; 107 blocked = 0;
108 108
109 if (!time_after_eq(runstate.time[RUNSTATE_runnable] + 109 if (!time_after_eq(runstate.time[RUNSTATE_runnable] +
110 runstate.time[RUNSTATE_offline], 110 runstate.time[RUNSTATE_offline],
111 per_cpu(processed_stolen_time, cpu))) 111 per_cpu(xen_stolen_time, cpu)))
112 stolen = 0; 112 stolen = 0;
113 113
114 if (!time_after(delta_itm + new_itm, ia64_get_itc())) 114 if (!time_after(delta_itm + new_itm, ia64_get_itc()))
@@ -147,8 +147,8 @@ consider_steal_time(unsigned long new_itm)
147 } else { 147 } else {
148 local_cpu_data->itm_next = delta_itm + new_itm; 148 local_cpu_data->itm_next = delta_itm + new_itm;
149 } 149 }
150 per_cpu(processed_stolen_time, cpu) += NS_PER_TICK * stolen; 150 per_cpu(xen_stolen_time, cpu) += NS_PER_TICK * stolen;
151 per_cpu(processed_blocked_time, cpu) += NS_PER_TICK * blocked; 151 per_cpu(xen_blocked_time, cpu) += NS_PER_TICK * blocked;
152 } 152 }
153 return delta_itm; 153 return delta_itm;
154} 154}
diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
index 305ac852bbed..d3c865c5a6ba 100644
--- a/arch/m32r/kernel/sys_m32r.c
+++ b/arch/m32r/kernel/sys_m32r.c
@@ -76,30 +76,6 @@ asmlinkage int sys_tas(int __user *addr)
76 return oldval; 76 return oldval;
77} 77}
78 78
79asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
80 unsigned long prot, unsigned long flags,
81 unsigned long fd, unsigned long pgoff)
82{
83 int error = -EBADF;
84 struct file *file = NULL;
85
86 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
87 if (!(flags & MAP_ANONYMOUS)) {
88 file = fget(fd);
89 if (!file)
90 goto out;
91 }
92
93 down_write(&current->mm->mmap_sem);
94 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
95 up_write(&current->mm->mmap_sem);
96
97 if (file)
98 fput(file);
99out:
100 return error;
101}
102
103/* 79/*
104 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 80 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
105 * 81 *
diff --git a/arch/m32r/kernel/syscall_table.S b/arch/m32r/kernel/syscall_table.S
index aa3bf4cfab37..60536e271233 100644
--- a/arch/m32r/kernel/syscall_table.S
+++ b/arch/m32r/kernel/syscall_table.S
@@ -191,7 +191,7 @@ ENTRY(sys_call_table)
191 .long sys_ni_syscall /* streams2 */ 191 .long sys_ni_syscall /* streams2 */
192 .long sys_vfork /* 190 */ 192 .long sys_vfork /* 190 */
193 .long sys_getrlimit 193 .long sys_getrlimit
194 .long sys_mmap2 194 .long sys_mmap_pgoff
195 .long sys_truncate64 195 .long sys_truncate64
196 .long sys_ftruncate64 196 .long sys_ftruncate64
197 .long sys_stat64 /* 195 */ 197 .long sys_stat64 /* 195 */
diff --git a/arch/m68k/include/asm/pgtable_mm.h b/arch/m68k/include/asm/pgtable_mm.h
index fe60e1abaee8..aca0e28581c7 100644
--- a/arch/m68k/include/asm/pgtable_mm.h
+++ b/arch/m68k/include/asm/pgtable_mm.h
@@ -83,9 +83,9 @@
83#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) 83#define VMALLOC_START (((unsigned long) high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
84#define VMALLOC_END KMAP_START 84#define VMALLOC_END KMAP_START
85#else 85#else
86extern unsigned long vmalloc_end; 86extern unsigned long m68k_vmalloc_end;
87#define VMALLOC_START 0x0f800000 87#define VMALLOC_START 0x0f800000
88#define VMALLOC_END vmalloc_end 88#define VMALLOC_END m68k_vmalloc_end
89#endif /* CONFIG_SUN3 */ 89#endif /* CONFIG_SUN3 */
90 90
91/* zero page used for uninitialized stuff */ 91/* zero page used for uninitialized stuff */
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 7deb402bfc75..218f441de667 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -29,37 +29,16 @@
29#include <asm/page.h> 29#include <asm/page.h>
30#include <asm/unistd.h> 30#include <asm/unistd.h>
31 31
32/* common code for old and new mmaps */
33static inline long do_mmap2(
34 unsigned long addr, unsigned long len,
35 unsigned long prot, unsigned long flags,
36 unsigned long fd, unsigned long pgoff)
37{
38 int error = -EBADF;
39 struct file * file = NULL;
40
41 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
42 if (!(flags & MAP_ANONYMOUS)) {
43 file = fget(fd);
44 if (!file)
45 goto out;
46 }
47
48 down_write(&current->mm->mmap_sem);
49 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
50 up_write(&current->mm->mmap_sem);
51
52 if (file)
53 fput(file);
54out:
55 return error;
56}
57
58asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 32asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
59 unsigned long prot, unsigned long flags, 33 unsigned long prot, unsigned long flags,
60 unsigned long fd, unsigned long pgoff) 34 unsigned long fd, unsigned long pgoff)
61{ 35{
62 return do_mmap2(addr, len, prot, flags, fd, pgoff); 36 /*
37 * This is wrong for sun3 - there PAGE_SIZE is 8Kb,
38 * so we need to shift the argument down by 1; m68k mmap64(3)
39 * (in libc) expects the last argument of mmap2 in 4Kb units.
40 */
41 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
63} 42}
64 43
65/* 44/*
@@ -90,57 +69,11 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
90 if (a.offset & ~PAGE_MASK) 69 if (a.offset & ~PAGE_MASK)
91 goto out; 70 goto out;
92 71
93 a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); 72 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
94 73 a.offset >> PAGE_SHIFT);
95 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
96out:
97 return error;
98}
99
100#if 0
101struct mmap_arg_struct64 {
102 __u32 addr;
103 __u32 len;
104 __u32 prot;
105 __u32 flags;
106 __u64 offset; /* 64 bits */
107 __u32 fd;
108};
109
110asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
111{
112 int error = -EFAULT;
113 struct file * file = NULL;
114 struct mmap_arg_struct64 a;
115 unsigned long pgoff;
116
117 if (copy_from_user(&a, arg, sizeof(a)))
118 return -EFAULT;
119
120 if ((long)a.offset & ~PAGE_MASK)
121 return -EINVAL;
122
123 pgoff = a.offset >> PAGE_SHIFT;
124 if ((a.offset >> PAGE_SHIFT) != pgoff)
125 return -EINVAL;
126
127 if (!(a.flags & MAP_ANONYMOUS)) {
128 error = -EBADF;
129 file = fget(a.fd);
130 if (!file)
131 goto out;
132 }
133 a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
134
135 down_write(&current->mm->mmap_sem);
136 error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);
137 up_write(&current->mm->mmap_sem);
138 if (file)
139 fput(file);
140out: 74out:
141 return error; 75 return error;
142} 76}
143#endif
144 77
145struct sel_arg_struct { 78struct sel_arg_struct {
146 unsigned long n; 79 unsigned long n;
diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
index 3cd19390aae5..94f81ecfe3f8 100644
--- a/arch/m68k/sun3/mmu_emu.c
+++ b/arch/m68k/sun3/mmu_emu.c
@@ -45,8 +45,8 @@
45** Globals 45** Globals
46*/ 46*/
47 47
48unsigned long vmalloc_end; 48unsigned long m68k_vmalloc_end;
49EXPORT_SYMBOL(vmalloc_end); 49EXPORT_SYMBOL(m68k_vmalloc_end);
50 50
51unsigned long pmeg_vaddr[PMEGS_NUM]; 51unsigned long pmeg_vaddr[PMEGS_NUM];
52unsigned char pmeg_alloc[PMEGS_NUM]; 52unsigned char pmeg_alloc[PMEGS_NUM];
@@ -172,8 +172,8 @@ void mmu_emu_init(unsigned long bootmem_end)
172#endif 172#endif
173 // the lowest mapping here is the end of our 173 // the lowest mapping here is the end of our
174 // vmalloc region 174 // vmalloc region
175 if(!vmalloc_end) 175 if (!m68k_vmalloc_end)
176 vmalloc_end = seg; 176 m68k_vmalloc_end = seg;
177 177
178 // mark the segmap alloc'd, and reserve any 178 // mark the segmap alloc'd, and reserve any
179 // of the first 0xbff pages the hardware is 179 // of the first 0xbff pages the hardware is
diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
index efdd090778a3..b67cbc735a9b 100644
--- a/arch/m68knommu/kernel/sys_m68k.c
+++ b/arch/m68knommu/kernel/sys_m68k.c
@@ -27,39 +27,6 @@
27#include <asm/cacheflush.h> 27#include <asm/cacheflush.h>
28#include <asm/unistd.h> 28#include <asm/unistd.h>
29 29
30/* common code for old and new mmaps */
31static inline long do_mmap2(
32 unsigned long addr, unsigned long len,
33 unsigned long prot, unsigned long flags,
34 unsigned long fd, unsigned long pgoff)
35{
36 int error = -EBADF;
37 struct file * file = NULL;
38
39 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
40 if (!(flags & MAP_ANONYMOUS)) {
41 file = fget(fd);
42 if (!file)
43 goto out;
44 }
45
46 down_write(&current->mm->mmap_sem);
47 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
48 up_write(&current->mm->mmap_sem);
49
50 if (file)
51 fput(file);
52out:
53 return error;
54}
55
56asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
57 unsigned long prot, unsigned long flags,
58 unsigned long fd, unsigned long pgoff)
59{
60 return do_mmap2(addr, len, prot, flags, fd, pgoff);
61}
62
63/* 30/*
64 * Perform the select(nd, in, out, ex, tv) and mmap() system 31 * Perform the select(nd, in, out, ex, tv) and mmap() system
65 * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to 32 * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
@@ -88,9 +55,8 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
88 if (a.offset & ~PAGE_MASK) 55 if (a.offset & ~PAGE_MASK)
89 goto out; 56 goto out;
90 57
91 a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); 58 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
92 59 a.offset >> PAGE_SHIFT);
93 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
94out: 60out:
95 return error; 61 return error;
96} 62}
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S
index 23535cc415ae..486837efa3d7 100644
--- a/arch/m68knommu/kernel/syscalltable.S
+++ b/arch/m68knommu/kernel/syscalltable.S
@@ -210,7 +210,7 @@ ENTRY(sys_call_table)
210 .long sys_ni_syscall /* streams2 */ 210 .long sys_ni_syscall /* streams2 */
211 .long sys_vfork /* 190 */ 211 .long sys_vfork /* 190 */
212 .long sys_getrlimit 212 .long sys_getrlimit
213 .long sys_mmap2 213 .long sys_mmap_pgoff
214 .long sys_truncate64 214 .long sys_truncate64
215 .long sys_ftruncate64 215 .long sys_ftruncate64
216 .long sys_stat64 /* 195 */ 216 .long sys_stat64 /* 195 */
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index bbd8327f1890..fd53e500be67 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -6,8 +6,15 @@ mainmenu "Linux/Microblaze Kernel Configuration"
6config MICROBLAZE 6config MICROBLAZE
7 def_bool y 7 def_bool y
8 select HAVE_LMB 8 select HAVE_LMB
9 select HAVE_FUNCTION_TRACER
10 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
11 select HAVE_FUNCTION_GRAPH_TRACER
12 select HAVE_DYNAMIC_FTRACE
13 select HAVE_FTRACE_MCOUNT_RECORD
9 select USB_ARCH_HAS_EHCI 14 select USB_ARCH_HAS_EHCI
10 select ARCH_WANT_OPTIONAL_GPIOLIB 15 select ARCH_WANT_OPTIONAL_GPIOLIB
16 select HAVE_OPROFILE
17 select TRACING_SUPPORT
11 18
12config SWAP 19config SWAP
13 def_bool n 20 def_bool n
@@ -57,12 +64,24 @@ config GENERIC_GPIO
57config GENERIC_CSUM 64config GENERIC_CSUM
58 def_bool y 65 def_bool y
59 66
67config STACKTRACE_SUPPORT
68 def_bool y
69
70config LOCKDEP_SUPPORT
71 def_bool y
72
73config HAVE_LATENCYTOP_SUPPORT
74 def_bool y
75
60config PCI 76config PCI
61 def_bool n 77 def_bool n
62 78
63config NO_DMA 79config NO_DMA
64 def_bool y 80 def_bool y
65 81
82config DTC
83 def_bool y
84
66source "init/Kconfig" 85source "init/Kconfig"
67 86
68source "kernel/Kconfig.freezer" 87source "kernel/Kconfig.freezer"
diff --git a/arch/microblaze/Kconfig.debug b/arch/microblaze/Kconfig.debug
index 242cd35bdb4b..9dc708a7f700 100644
--- a/arch/microblaze/Kconfig.debug
+++ b/arch/microblaze/Kconfig.debug
@@ -3,6 +3,9 @@
3 3
4menu "Kernel hacking" 4menu "Kernel hacking"
5 5
6config TRACE_IRQFLAGS_SUPPORT
7 def_bool y
8
6source "lib/Kconfig.debug" 9source "lib/Kconfig.debug"
7 10
8config EARLY_PRINTK 11config EARLY_PRINTK
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 34187354304a..d2d6cfcb1a30 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -51,6 +51,8 @@ core-y += arch/microblaze/kernel/
51core-y += arch/microblaze/mm/ 51core-y += arch/microblaze/mm/
52core-y += arch/microblaze/platform/ 52core-y += arch/microblaze/platform/
53 53
54drivers-$(CONFIG_OPROFILE) += arch/microblaze/oprofile/
55
54boot := arch/microblaze/boot 56boot := arch/microblaze/boot
55 57
56# Are we making a simpleImage.<boardname> target? If so, crack out the boardname 58# Are we making a simpleImage.<boardname> target? If so, crack out the boardname
diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
index 21f13322a4ca..902cf9846c3c 100644
--- a/arch/microblaze/boot/Makefile
+++ b/arch/microblaze/boot/Makefile
@@ -2,11 +2,13 @@
2# arch/microblaze/boot/Makefile 2# arch/microblaze/boot/Makefile
3# 3#
4 4
5MKIMAGE := $(srctree)/scripts/mkuboot.sh
6
5obj-y += linked_dtb.o 7obj-y += linked_dtb.o
6 8
7targets := linux.bin linux.bin.gz simpleImage.% 9targets := linux.bin linux.bin.gz simpleImage.%
8 10
9OBJCOPYFLAGS_linux.bin := -O binary 11OBJCOPYFLAGS := -O binary
10 12
11# Where the DTS files live 13# Where the DTS files live
12dtstree := $(srctree)/$(src)/dts 14dtstree := $(srctree)/$(src)/dts
@@ -24,6 +26,7 @@ $(obj)/linux.bin: vmlinux FORCE
24 [ -n $(CONFIG_INITRAMFS_SOURCE) ] && [ ! -e $(CONFIG_INITRAMFS_SOURCE) ] && \ 26 [ -n $(CONFIG_INITRAMFS_SOURCE) ] && [ ! -e $(CONFIG_INITRAMFS_SOURCE) ] && \
25 touch $(CONFIG_INITRAMFS_SOURCE) || echo "No CPIO image" 27 touch $(CONFIG_INITRAMFS_SOURCE) || echo "No CPIO image"
26 $(call if_changed,objcopy) 28 $(call if_changed,objcopy)
29 $(call if_changed,uimage)
27 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' 30 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
28 31
29$(obj)/linux.bin.gz: $(obj)/linux.bin FORCE 32$(obj)/linux.bin.gz: $(obj)/linux.bin FORCE
@@ -36,8 +39,16 @@ quiet_cmd_cp = CP $< $@$2
36quiet_cmd_strip = STRIP $@ 39quiet_cmd_strip = STRIP $@
37 cmd_strip = $(STRIP) -K _start -K _end -K __log_buf -K _fdt_start vmlinux -o $@ 40 cmd_strip = $(STRIP) -K _start -K _end -K __log_buf -K _fdt_start vmlinux -o $@
38 41
42quiet_cmd_uimage = UIMAGE $@.ub
43 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
44 -C none -n 'Linux-$(KERNELRELEASE)' \
45 -a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
46 -d $@ $@.ub
47
39$(obj)/simpleImage.%: vmlinux FORCE 48$(obj)/simpleImage.%: vmlinux FORCE
40 $(call if_changed,cp,.unstrip) 49 $(call if_changed,cp,.unstrip)
50 $(call if_changed,objcopy)
51 $(call if_changed,uimage)
41 $(call if_changed,strip) 52 $(call if_changed,strip)
42 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' 53 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
43 54
@@ -53,4 +64,4 @@ $(obj)/%.dtb: $(dtstree)/%.dts FORCE
53 64
54clean-kernel += linux.bin linux.bin.gz simpleImage.* 65clean-kernel += linux.bin linux.bin.gz simpleImage.*
55 66
56clean-files += *.dtb 67clean-files += *.dtb simpleImage.*.unstrip
diff --git a/arch/microblaze/include/asm/cache.h b/arch/microblaze/include/asm/cache.h
index c209c47509d5..e52210891d78 100644
--- a/arch/microblaze/include/asm/cache.h
+++ b/arch/microblaze/include/asm/cache.h
@@ -21,20 +21,4 @@
21 21
22#define SMP_CACHE_BYTES L1_CACHE_BYTES 22#define SMP_CACHE_BYTES L1_CACHE_BYTES
23 23
24void _enable_icache(void);
25void _disable_icache(void);
26void _invalidate_icache(unsigned int addr);
27
28#define __enable_icache() _enable_icache()
29#define __disable_icache() _disable_icache()
30#define __invalidate_icache(addr) _invalidate_icache(addr)
31
32void _enable_dcache(void);
33void _disable_dcache(void);
34void _invalidate_dcache(unsigned int addr);
35
36#define __enable_dcache() _enable_dcache()
37#define __disable_dcache() _disable_dcache()
38#define __invalidate_dcache(addr) _invalidate_dcache(addr)
39
40#endif /* _ASM_MICROBLAZE_CACHE_H */ 24#endif /* _ASM_MICROBLAZE_CACHE_H */
diff --git a/arch/microblaze/include/asm/cacheflush.h b/arch/microblaze/include/asm/cacheflush.h
index 088076e657b3..a6edd356cd08 100644
--- a/arch/microblaze/include/asm/cacheflush.h
+++ b/arch/microblaze/include/asm/cacheflush.h
@@ -18,6 +18,8 @@
18/* Somebody depends on this; sigh... */ 18/* Somebody depends on this; sigh... */
19#include <linux/mm.h> 19#include <linux/mm.h>
20 20
21/* Look at Documentation/cachetlb.txt */
22
21/* 23/*
22 * Cache handling functions. 24 * Cache handling functions.
23 * Microblaze has a write-through data cache, meaning that the data cache 25 * Microblaze has a write-through data cache, meaning that the data cache
@@ -27,78 +29,81 @@
27 * instruction cache to make sure we don't fetch old, bad code. 29 * instruction cache to make sure we don't fetch old, bad code.
28 */ 30 */
29 31
32/* struct cache, d=dcache, i=icache, fl = flush, iv = invalidate,
33 * suffix r = range */
34struct scache {
35 /* icache */
36 void (*ie)(void); /* enable */
37 void (*id)(void); /* disable */
38 void (*ifl)(void); /* flush */
39 void (*iflr)(unsigned long a, unsigned long b);
40 void (*iin)(void); /* invalidate */
41 void (*iinr)(unsigned long a, unsigned long b);
42 /* dcache */
43 void (*de)(void); /* enable */
44 void (*dd)(void); /* disable */
45 void (*dfl)(void); /* flush */
46 void (*dflr)(unsigned long a, unsigned long b);
47 void (*din)(void); /* invalidate */
48 void (*dinr)(unsigned long a, unsigned long b);
49};
50
51/* microblaze cache */
52extern struct scache *mbc;
53
54void microblaze_cache_init(void);
55
56#define enable_icache() mbc->ie();
57#define disable_icache() mbc->id();
58#define flush_icache() mbc->ifl();
59#define flush_icache_range(start, end) mbc->iflr(start, end);
60#define invalidate_icache() mbc->iin();
61#define invalidate_icache_range(start, end) mbc->iinr(start, end);
62
63
64#define flush_icache_user_range(vma, pg, adr, len) flush_icache();
65#define flush_icache_page(vma, pg) do { } while (0)
66
67#define enable_dcache() mbc->de();
68#define disable_dcache() mbc->dd();
30/* FIXME for LL-temac driver */ 69/* FIXME for LL-temac driver */
31#define invalidate_dcache_range(start, end) \ 70#define invalidate_dcache() mbc->din();
32 __invalidate_dcache_range(start, end) 71#define invalidate_dcache_range(start, end) mbc->dinr(start, end);
33 72#define flush_dcache() mbc->dfl();
34#define flush_cache_all() __invalidate_cache_all() 73#define flush_dcache_range(start, end) mbc->dflr(start, end);
35#define flush_cache_mm(mm) do { } while (0)
36#define flush_cache_range(vma, start, end) __invalidate_cache_all()
37#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
38 74
39#define flush_dcache_range(start, end) __invalidate_dcache_range(start, end)
40#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 75#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
76/* D-cache aliasing problem can't happen - cache is between MMU and ram */
41#define flush_dcache_page(page) do { } while (0) 77#define flush_dcache_page(page) do { } while (0)
42#define flush_dcache_mmap_lock(mapping) do { } while (0) 78#define flush_dcache_mmap_lock(mapping) do { } while (0)
43#define flush_dcache_mmap_unlock(mapping) do { } while (0) 79#define flush_dcache_mmap_unlock(mapping) do { } while (0)
44 80
45#define flush_icache_range(start, len) __invalidate_icache_range(start, len)
46#define flush_icache_page(vma, pg) do { } while (0)
47
48#ifndef CONFIG_MMU
49# define flush_icache_user_range(start, len) do { } while (0)
50#else
51# define flush_icache_user_range(vma, pg, adr, len) __invalidate_icache_all()
52
53# define flush_page_to_ram(page) do { } while (0)
54 81
55# define flush_icache() __invalidate_icache_all() 82#define flush_cache_dup_mm(mm) do { } while (0)
56# define flush_cache_sigtramp(vaddr) \ 83#define flush_cache_vmap(start, end) do { } while (0)
57 __invalidate_icache_range(vaddr, vaddr + 8) 84#define flush_cache_vunmap(start, end) do { } while (0)
58 85#define flush_cache_mm(mm) do { } while (0)
59# define flush_dcache_mmap_lock(mapping) do { } while (0) 86#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
60# define flush_dcache_mmap_unlock(mapping) do { } while (0)
61 87
62# define flush_cache_dup_mm(mm) do { } while (0) 88/* MS: kgdb code use this macro, wrong len with FLASH */
89#if 0
90#define flush_cache_range(vma, start, len) { \
91 flush_icache_range((unsigned) (start), (unsigned) (start) + (len)); \
92 flush_dcache_range((unsigned) (start), (unsigned) (start) + (len)); \
93}
63#endif 94#endif
64 95
65#define flush_cache_vmap(start, end) do { } while (0) 96#define flush_cache_range(vma, start, len) do { } while (0)
66#define flush_cache_vunmap(start, end) do { } while (0)
67
68struct page;
69struct mm_struct;
70struct vm_area_struct;
71
72/* see arch/microblaze/kernel/cache.c */
73extern void __invalidate_icache_all(void);
74extern void __invalidate_icache_range(unsigned long start, unsigned long end);
75extern void __invalidate_icache_page(struct vm_area_struct *vma,
76 struct page *page);
77extern void __invalidate_icache_user_range(struct vm_area_struct *vma,
78 struct page *page,
79 unsigned long adr, int len);
80extern void __invalidate_cache_sigtramp(unsigned long addr);
81
82extern void __invalidate_dcache_all(void);
83extern void __invalidate_dcache_range(unsigned long start, unsigned long end);
84extern void __invalidate_dcache_page(struct vm_area_struct *vma,
85 struct page *page);
86extern void __invalidate_dcache_user_range(struct vm_area_struct *vma,
87 struct page *page,
88 unsigned long adr, int len);
89
90extern inline void __invalidate_cache_all(void)
91{
92 __invalidate_icache_all();
93 __invalidate_dcache_all();
94}
95 97
96#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 98#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
97do { memcpy((dst), (src), (len)); \ 99do { \
98 flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \ 100 memcpy((dst), (src), (len)); \
101 flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \
99} while (0) 102} while (0)
100 103
101#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 104#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
102 memcpy((dst), (src), (len)) 105do { \
106 memcpy((dst), (src), (len)); \
107} while (0)
103 108
104#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */ 109#endif /* _ASM_MICROBLAZE_CACHEFLUSH_H */
diff --git a/arch/microblaze/include/asm/cpuinfo.h b/arch/microblaze/include/asm/cpuinfo.h
index 52f28f6dc4eb..b4f5ca33aebf 100644
--- a/arch/microblaze/include/asm/cpuinfo.h
+++ b/arch/microblaze/include/asm/cpuinfo.h
@@ -43,7 +43,7 @@ struct cpuinfo {
43 u32 use_icache; 43 u32 use_icache;
44 u32 icache_tagbits; 44 u32 icache_tagbits;
45 u32 icache_write; 45 u32 icache_write;
46 u32 icache_line; 46 u32 icache_line_length;
47 u32 icache_size; 47 u32 icache_size;
48 unsigned long icache_base; 48 unsigned long icache_base;
49 unsigned long icache_high; 49 unsigned long icache_high;
@@ -51,8 +51,9 @@ struct cpuinfo {
51 u32 use_dcache; 51 u32 use_dcache;
52 u32 dcache_tagbits; 52 u32 dcache_tagbits;
53 u32 dcache_write; 53 u32 dcache_write;
54 u32 dcache_line; 54 u32 dcache_line_length;
55 u32 dcache_size; 55 u32 dcache_size;
56 u32 dcache_wb;
56 unsigned long dcache_base; 57 unsigned long dcache_base;
57 unsigned long dcache_high; 58 unsigned long dcache_high;
58 59
diff --git a/arch/microblaze/include/asm/device.h b/arch/microblaze/include/asm/device.h
index 30286db27c1c..78a038452c0f 100644
--- a/arch/microblaze/include/asm/device.h
+++ b/arch/microblaze/include/asm/device.h
@@ -19,6 +19,18 @@ struct dev_archdata {
19struct pdev_archdata { 19struct pdev_archdata {
20}; 20};
21 21
22static inline void dev_archdata_set_node(struct dev_archdata *ad,
23 struct device_node *np)
24{
25 ad->of_node = np;
26}
27
28static inline struct device_node *
29dev_archdata_get_node(const struct dev_archdata *ad)
30{
31 return ad->of_node;
32}
33
22#endif /* _ASM_MICROBLAZE_DEVICE_H */ 34#endif /* _ASM_MICROBLAZE_DEVICE_H */
23 35
24 36
diff --git a/arch/microblaze/include/asm/ftrace.h b/arch/microblaze/include/asm/ftrace.h
index 8b137891791f..fd2fa2eca62f 100644
--- a/arch/microblaze/include/asm/ftrace.h
+++ b/arch/microblaze/include/asm/ftrace.h
@@ -1 +1,26 @@
1#ifndef _ASM_MICROBLAZE_FTRACE
2#define _ASM_MICROBLAZE_FTRACE
1 3
4#ifdef CONFIG_FUNCTION_TRACER
5
6#define MCOUNT_ADDR ((long)(_mcount))
7#define MCOUNT_INSN_SIZE 8 /* sizeof mcount call */
8
9#ifndef __ASSEMBLY__
10extern void _mcount(void);
11extern void ftrace_call_graph(void);
12#endif
13
14#ifdef CONFIG_DYNAMIC_FTRACE
15/* reloction of mcount call site is the same as the address */
16static inline unsigned long ftrace_call_adjust(unsigned long addr)
17{
18 return addr;
19}
20
21struct dyn_arch_ftrace {
22};
23#endif /* CONFIG_DYNAMIC_FTRACE */
24
25#endif /* CONFIG_FUNCTION_TRACER */
26#endif /* _ASM_MICROBLAZE_FTRACE */
diff --git a/arch/microblaze/include/asm/futex.h b/arch/microblaze/include/asm/futex.h
index 0b745828f42b..8dbb6e7a03a2 100644
--- a/arch/microblaze/include/asm/futex.h
+++ b/arch/microblaze/include/asm/futex.h
@@ -1 +1,126 @@
1#include <asm-generic/futex.h> 1#ifndef _ASM_MICROBLAZE_FUTEX_H
2#define _ASM_MICROBLAZE_FUTEX_H
3
4#ifdef __KERNEL__
5
6#include <linux/futex.h>
7#include <linux/uaccess.h>
8#include <asm/errno.h>
9
10#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \
11({ \
12 __asm__ __volatile__ ( \
13 "1: lwx %0, %2, r0; " \
14 insn \
15 "2: swx %1, %2, r0; \
16 addic %1, r0, 0; \
17 bnei %1, 1b; \
18 3: \
19 .section .fixup,\"ax\"; \
20 4: brid 3b; \
21 addik %1, r0, %3; \
22 .previous; \
23 .section __ex_table,\"a\"; \
24 .word 1b,4b,2b,4b; \
25 .previous;" \
26 : "=&r" (oldval), "=&r" (ret) \
27 : "b" (uaddr), "i" (-EFAULT), "r" (oparg) \
28 ); \
29})
30
31static inline int
32futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
33{
34 int op = (encoded_op >> 28) & 7;
35 int cmp = (encoded_op >> 24) & 15;
36 int oparg = (encoded_op << 8) >> 20;
37 int cmparg = (encoded_op << 20) >> 20;
38 int oldval = 0, ret;
39 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
40 oparg = 1 << oparg;
41
42 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
43 return -EFAULT;
44
45 pagefault_disable();
46
47 switch (op) {
48 case FUTEX_OP_SET:
49 __futex_atomic_op("or %1,%4,%4;", ret, oldval, uaddr, oparg);
50 break;
51 case FUTEX_OP_ADD:
52 __futex_atomic_op("add %1,%0,%4;", ret, oldval, uaddr, oparg);
53 break;
54 case FUTEX_OP_OR:
55 __futex_atomic_op("or %1,%0,%4;", ret, oldval, uaddr, oparg);
56 break;
57 case FUTEX_OP_ANDN:
58 __futex_atomic_op("and %1,%0,%4;", ret, oldval, uaddr, oparg);
59 break;
60 case FUTEX_OP_XOR:
61 __futex_atomic_op("xor %1,%0,%4;", ret, oldval, uaddr, oparg);
62 break;
63 default:
64 ret = -ENOSYS;
65 }
66
67 pagefault_enable();
68
69 if (!ret) {
70 switch (cmp) {
71 case FUTEX_OP_CMP_EQ:
72 ret = (oldval == cmparg);
73 break;
74 case FUTEX_OP_CMP_NE:
75 ret = (oldval != cmparg);
76 break;
77 case FUTEX_OP_CMP_LT:
78 ret = (oldval < cmparg);
79 break;
80 case FUTEX_OP_CMP_GE:
81 ret = (oldval >= cmparg);
82 break;
83 case FUTEX_OP_CMP_LE:
84 ret = (oldval <= cmparg);
85 break;
86 case FUTEX_OP_CMP_GT:
87 ret = (oldval > cmparg);
88 break;
89 default:
90 ret = -ENOSYS;
91 }
92 }
93 return ret;
94}
95
96static inline int
97futex_atomic_cmpxchg_inatomic(int __user *uaddr, int oldval, int newval)
98{
99 int prev, cmp;
100
101 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
102 return -EFAULT;
103
104 __asm__ __volatile__ ("1: lwx %0, %2, r0; \
105 cmp %1, %0, %3; \
106 beqi %1, 3f; \
107 2: swx %4, %2, r0; \
108 addic %1, r0, 0; \
109 bnei %1, 1b; \
110 3: \
111 .section .fixup,\"ax\"; \
112 4: brid 3b; \
113 addik %0, r0, %5; \
114 .previous; \
115 .section __ex_table,\"a\"; \
116 .word 1b,4b,2b,4b; \
117 .previous;" \
118 : "=&r" (prev), "=&r"(cmp) \
119 : "r" (uaddr), "r" (oldval), "r" (newval), "i" (-EFAULT));
120
121 return prev;
122}
123
124#endif /* __KERNEL__ */
125
126#endif
diff --git a/arch/microblaze/include/asm/irqflags.h b/arch/microblaze/include/asm/irqflags.h
index dea65645a4f8..2c38c6d80176 100644
--- a/arch/microblaze/include/asm/irqflags.h
+++ b/arch/microblaze/include/asm/irqflags.h
@@ -10,78 +10,73 @@
10#define _ASM_MICROBLAZE_IRQFLAGS_H 10#define _ASM_MICROBLAZE_IRQFLAGS_H
11 11
12#include <linux/irqflags.h> 12#include <linux/irqflags.h>
13#include <asm/registers.h>
13 14
14# if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 15# if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
15 16
16# define local_irq_save(flags) \ 17# define raw_local_irq_save(flags) \
17 do { \ 18 do { \
18 asm volatile ("# local_irq_save \n\t" \ 19 asm volatile (" msrclr %0, %1; \
19 "msrclr %0, %1 \n\t" \ 20 nop;" \
20 "nop \n\t" \
21 : "=r"(flags) \ 21 : "=r"(flags) \
22 : "i"(MSR_IE) \ 22 : "i"(MSR_IE) \
23 : "memory"); \ 23 : "memory"); \
24 } while (0) 24 } while (0)
25 25
26# define local_irq_disable() \ 26# define raw_local_irq_disable() \
27 do { \ 27 do { \
28 asm volatile ("# local_irq_disable \n\t" \ 28 asm volatile (" msrclr r0, %0; \
29 "msrclr r0, %0 \n\t" \ 29 nop;" \
30 "nop \n\t" \ 30 : \
31 : \ 31 : "i"(MSR_IE) \
32 : "i"(MSR_IE) \ 32 : "memory"); \
33 : "memory"); \
34 } while (0) 33 } while (0)
35 34
36# define local_irq_enable() \ 35# define raw_local_irq_enable() \
37 do { \ 36 do { \
38 asm volatile ("# local_irq_enable \n\t" \ 37 asm volatile (" msrset r0, %0; \
39 "msrset r0, %0 \n\t" \ 38 nop;" \
40 "nop \n\t" \ 39 : \
41 : \ 40 : "i"(MSR_IE) \
42 : "i"(MSR_IE) \ 41 : "memory"); \
43 : "memory"); \
44 } while (0) 42 } while (0)
45 43
46# else /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR == 0 */ 44# else /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR == 0 */
47 45
48# define local_irq_save(flags) \ 46# define raw_local_irq_save(flags) \
49 do { \ 47 do { \
50 register unsigned tmp; \ 48 register unsigned tmp; \
51 asm volatile ("# local_irq_save \n\t" \ 49 asm volatile (" mfs %0, rmsr; \
52 "mfs %0, rmsr \n\t" \ 50 nop; \
53 "nop \n\t" \ 51 andi %1, %0, %2; \
54 "andi %1, %0, %2 \n\t" \ 52 mts rmsr, %1; \
55 "mts rmsr, %1 \n\t" \ 53 nop;" \
56 "nop \n\t" \
57 : "=r"(flags), "=r" (tmp) \ 54 : "=r"(flags), "=r" (tmp) \
58 : "i"(~MSR_IE) \ 55 : "i"(~MSR_IE) \
59 : "memory"); \ 56 : "memory"); \
60 } while (0) 57 } while (0)
61 58
62# define local_irq_disable() \ 59# define raw_local_irq_disable() \
63 do { \ 60 do { \
64 register unsigned tmp; \ 61 register unsigned tmp; \
65 asm volatile ("# local_irq_disable \n\t" \ 62 asm volatile (" mfs %0, rmsr; \
66 "mfs %0, rmsr \n\t" \ 63 nop; \
67 "nop \n\t" \ 64 andi %0, %0, %1; \
68 "andi %0, %0, %1 \n\t" \ 65 mts rmsr, %0; \
69 "mts rmsr, %0 \n\t" \ 66 nop;" \
70 "nop \n\t" \
71 : "=r"(tmp) \ 67 : "=r"(tmp) \
72 : "i"(~MSR_IE) \ 68 : "i"(~MSR_IE) \
73 : "memory"); \ 69 : "memory"); \
74 } while (0) 70 } while (0)
75 71
76# define local_irq_enable() \ 72# define raw_local_irq_enable() \
77 do { \ 73 do { \
78 register unsigned tmp; \ 74 register unsigned tmp; \
79 asm volatile ("# local_irq_enable \n\t" \ 75 asm volatile (" mfs %0, rmsr; \
80 "mfs %0, rmsr \n\t" \ 76 nop; \
81 "nop \n\t" \ 77 ori %0, %0, %1; \
82 "ori %0, %0, %1 \n\t" \ 78 mts rmsr, %0; \
83 "mts rmsr, %0 \n\t" \ 79 nop;" \
84 "nop \n\t" \
85 : "=r"(tmp) \ 80 : "=r"(tmp) \
86 : "i"(MSR_IE) \ 81 : "i"(MSR_IE) \
87 : "memory"); \ 82 : "memory"); \
@@ -89,35 +84,28 @@
89 84
90# endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */ 85# endif /* CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR */
91 86
92#define local_save_flags(flags) \ 87#define raw_local_irq_restore(flags) \
93 do { \ 88 do { \
94 asm volatile ("# local_save_flags \n\t" \ 89 asm volatile (" mts rmsr, %0; \
95 "mfs %0, rmsr \n\t" \ 90 nop;" \
96 "nop \n\t" \
97 : "=r"(flags) \
98 : \ 91 : \
92 : "r"(flags) \
99 : "memory"); \ 93 : "memory"); \
100 } while (0) 94 } while (0)
101 95
102#define local_irq_restore(flags) \ 96static inline unsigned long get_msr(void)
103 do { \
104 asm volatile ("# local_irq_restore \n\t"\
105 "mts rmsr, %0 \n\t" \
106 "nop \n\t" \
107 : \
108 : "r"(flags) \
109 : "memory"); \
110 } while (0)
111
112static inline int irqs_disabled(void)
113{ 97{
114 unsigned long flags; 98 unsigned long flags;
115 99 asm volatile (" mfs %0, rmsr; \
116 local_save_flags(flags); 100 nop;" \
117 return ((flags & MSR_IE) == 0); 101 : "=r"(flags) \
102 : \
103 : "memory"); \
104 return flags;
118} 105}
119 106
120#define raw_irqs_disabled irqs_disabled 107#define raw_local_save_flags(flags) ((flags) = get_msr())
121#define raw_irqs_disabled_flags(flags) ((flags) == 0) 108#define raw_irqs_disabled() ((get_msr() & MSR_IE) == 0)
109#define raw_irqs_disabled_flags(flags) ((flags & MSR_IE) == 0)
122 110
123#endif /* _ASM_MICROBLAZE_IRQFLAGS_H */ 111#endif /* _ASM_MICROBLAZE_IRQFLAGS_H */
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index 880c988c2237..9b66c0fa9a32 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -164,7 +164,8 @@ extern int page_is_ram(unsigned long pfn);
164# endif /* CONFIG_MMU */ 164# endif /* CONFIG_MMU */
165 165
166# ifndef CONFIG_MMU 166# ifndef CONFIG_MMU
167# define pfn_valid(pfn) ((pfn) >= min_low_pfn && (pfn) <= max_mapnr) 167# define pfn_valid(pfn) (((pfn) >= min_low_pfn) && \
168 ((pfn) <= (min_low_pfn + max_mapnr)))
168# define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT) 169# define ARCH_PFN_OFFSET (PAGE_OFFSET >> PAGE_SHIFT)
169# else /* CONFIG_MMU */ 170# else /* CONFIG_MMU */
170# define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT) 171# define ARCH_PFN_OFFSET (memory_start >> PAGE_SHIFT)
diff --git a/arch/microblaze/include/asm/pgalloc.h b/arch/microblaze/include/asm/pgalloc.h
index b0131da1387b..7547f5064560 100644
--- a/arch/microblaze/include/asm/pgalloc.h
+++ b/arch/microblaze/include/asm/pgalloc.h
@@ -106,9 +106,6 @@ extern inline void free_pgd_slow(pgd_t *pgd)
106 */ 106 */
107#define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); }) 107#define pmd_alloc_one_fast(mm, address) ({ BUG(); ((pmd_t *)1); })
108#define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); }) 108#define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); })
109/* FIXME two definition - look below */
110#define pmd_free(mm, x) do { } while (0)
111#define pgd_populate(mm, pmd, pte) BUG()
112 109
113static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 110static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
114 unsigned long address) 111 unsigned long address)
@@ -192,14 +189,14 @@ extern inline void pte_free(struct mm_struct *mm, struct page *ptepage)
192 * the pgd will always be present.. 189 * the pgd will always be present..
193 */ 190 */
194#define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); }) 191#define pmd_alloc_one(mm, address) ({ BUG(); ((pmd_t *)2); })
195/*#define pmd_free(mm, x) do { } while (0)*/ 192#define pmd_free(mm, x) do { } while (0)
196#define __pmd_free_tlb(tlb, x, addr) do { } while (0) 193#define __pmd_free_tlb(tlb, x, addr) pmd_free((tlb)->mm, x)
197#define pgd_populate(mm, pmd, pte) BUG() 194#define pgd_populate(mm, pmd, pte) BUG()
198 195
199extern int do_check_pgt_cache(int, int); 196extern int do_check_pgt_cache(int, int);
200 197
201#endif /* CONFIG_MMU */ 198#endif /* CONFIG_MMU */
202 199
203#define check_pgt_cache() do {} while (0) 200#define check_pgt_cache() do { } while (0)
204 201
205#endif /* _ASM_MICROBLAZE_PGALLOC_H */ 202#endif /* _ASM_MICROBLAZE_PGALLOC_H */
diff --git a/arch/microblaze/include/asm/pvr.h b/arch/microblaze/include/asm/pvr.h
index 66f1b30dd097..e38abc7714b6 100644
--- a/arch/microblaze/include/asm/pvr.h
+++ b/arch/microblaze/include/asm/pvr.h
@@ -76,20 +76,23 @@ struct pvr_s {
76#define PVR3_FSL_LINKS_MASK 0x00000380 76#define PVR3_FSL_LINKS_MASK 0x00000380
77 77
78/* ICache config PVR masks */ 78/* ICache config PVR masks */
79#define PVR4_USE_ICACHE_MASK 0x80000000 79#define PVR4_USE_ICACHE_MASK 0x80000000 /* ICU */
80#define PVR4_ICACHE_ADDR_TAG_BITS_MASK 0x7C000000 80#define PVR4_ICACHE_ADDR_TAG_BITS_MASK 0x7C000000 /* ICTS */
81#define PVR4_ICACHE_USE_FSL_MASK 0x02000000 81#define PVR4_ICACHE_ALLOW_WR_MASK 0x01000000 /* ICW */
82#define PVR4_ICACHE_ALLOW_WR_MASK 0x01000000 82#define PVR4_ICACHE_LINE_LEN_MASK 0x00E00000 /* ICLL */
83#define PVR4_ICACHE_LINE_LEN_MASK 0x00E00000 83#define PVR4_ICACHE_BYTE_SIZE_MASK 0x001F0000 /* ICBS */
84#define PVR4_ICACHE_BYTE_SIZE_MASK 0x001F0000 84#define PVR4_ICACHE_ALWAYS_USED 0x00008000 /* IAU */
85#define PVR4_ICACHE_INTERFACE 0x00002000 /* ICI */
85 86
86/* DCache config PVR masks */ 87/* DCache config PVR masks */
87#define PVR5_USE_DCACHE_MASK 0x80000000 88#define PVR5_USE_DCACHE_MASK 0x80000000 /* DCU */
88#define PVR5_DCACHE_ADDR_TAG_BITS_MASK 0x7C000000 89#define PVR5_DCACHE_ADDR_TAG_BITS_MASK 0x7C000000 /* DCTS */
89#define PVR5_DCACHE_USE_FSL_MASK 0x02000000 90#define PVR5_DCACHE_ALLOW_WR_MASK 0x01000000 /* DCW */
90#define PVR5_DCACHE_ALLOW_WR_MASK 0x01000000 91#define PVR5_DCACHE_LINE_LEN_MASK 0x00E00000 /* DCLL */
91#define PVR5_DCACHE_LINE_LEN_MASK 0x00E00000 92#define PVR5_DCACHE_BYTE_SIZE_MASK 0x001F0000 /* DCBS */
92#define PVR5_DCACHE_BYTE_SIZE_MASK 0x001F0000 93#define PVR5_DCACHE_ALWAYS_USED 0x00008000 /* DAU */
94#define PVR5_DCACHE_USE_WRITEBACK 0x00004000 /* DWB */
95#define PVR5_DCACHE_INTERFACE 0x00002000 /* DCI */
93 96
94/* ICache base address PVR mask */ 97/* ICache base address PVR mask */
95#define PVR6_ICACHE_BASEADDR_MASK 0xFFFFFFFF 98#define PVR6_ICACHE_BASEADDR_MASK 0xFFFFFFFF
@@ -178,11 +181,14 @@ struct pvr_s {
178 ((pvr.pvr[5] & PVR5_DCACHE_ADDR_TAG_BITS_MASK) >> 26) 181 ((pvr.pvr[5] & PVR5_DCACHE_ADDR_TAG_BITS_MASK) >> 26)
179#define PVR_DCACHE_USE_FSL(pvr) (pvr.pvr[5] & PVR5_DCACHE_USE_FSL_MASK) 182#define PVR_DCACHE_USE_FSL(pvr) (pvr.pvr[5] & PVR5_DCACHE_USE_FSL_MASK)
180#define PVR_DCACHE_ALLOW_WR(pvr) (pvr.pvr[5] & PVR5_DCACHE_ALLOW_WR_MASK) 183#define PVR_DCACHE_ALLOW_WR(pvr) (pvr.pvr[5] & PVR5_DCACHE_ALLOW_WR_MASK)
184/* FIXME two shifts on one line needs any comment */
181#define PVR_DCACHE_LINE_LEN(pvr) \ 185#define PVR_DCACHE_LINE_LEN(pvr) \
182 (1 << ((pvr.pvr[5] & PVR5_DCACHE_LINE_LEN_MASK) >> 21)) 186 (1 << ((pvr.pvr[5] & PVR5_DCACHE_LINE_LEN_MASK) >> 21))
183#define PVR_DCACHE_BYTE_SIZE(pvr) \ 187#define PVR_DCACHE_BYTE_SIZE(pvr) \
184 (1 << ((pvr.pvr[5] & PVR5_DCACHE_BYTE_SIZE_MASK) >> 16)) 188 (1 << ((pvr.pvr[5] & PVR5_DCACHE_BYTE_SIZE_MASK) >> 16))
185 189
190#define PVR_DCACHE_USE_WRITEBACK(pvr) \
191 ((pvr.pvr[5] & PVR5_DCACHE_USE_WRITEBACK) >> 14)
186 192
187#define PVR_ICACHE_BASEADDR(pvr) (pvr.pvr[6] & PVR6_ICACHE_BASEADDR_MASK) 193#define PVR_ICACHE_BASEADDR(pvr) (pvr.pvr[6] & PVR6_ICACHE_BASEADDR_MASK)
188#define PVR_ICACHE_HIGHADDR(pvr) (pvr.pvr[7] & PVR7_ICACHE_HIGHADDR_MASK) 194#define PVR_ICACHE_HIGHADDR(pvr) (pvr.pvr[7] & PVR7_ICACHE_HIGHADDR_MASK)
diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h
index ed67c9ed15b8..7f31394985e0 100644
--- a/arch/microblaze/include/asm/setup.h
+++ b/arch/microblaze/include/asm/setup.h
@@ -35,6 +35,8 @@ extern void mmu_reset(void);
35extern void early_console_reg_tlb_alloc(unsigned int addr); 35extern void early_console_reg_tlb_alloc(unsigned int addr);
36# endif /* CONFIG_MMU */ 36# endif /* CONFIG_MMU */
37 37
38extern void of_platform_reset_gpio_probe(void);
39
38void time_init(void); 40void time_init(void);
39void init_IRQ(void); 41void init_IRQ(void);
40void machine_early_init(const char *cmdline, unsigned int ram, 42void machine_early_init(const char *cmdline, unsigned int ram,
diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h
index b1ed61590660..157970688b2a 100644
--- a/arch/microblaze/include/asm/system.h
+++ b/arch/microblaze/include/asm/system.h
@@ -16,6 +16,8 @@
16#include <asm-generic/cmpxchg.h> 16#include <asm-generic/cmpxchg.h>
17#include <asm-generic/cmpxchg-local.h> 17#include <asm-generic/cmpxchg-local.h>
18 18
19#define __ARCH_WANT_INTERRUPTS_ON_CTXSW
20
19struct task_struct; 21struct task_struct;
20struct thread_info; 22struct thread_info;
21 23
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 5431b4631a7a..371bd6e56d9a 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -272,8 +272,9 @@ static inline int clear_user(char *to, int size)
272 return size; 272 return size;
273} 273}
274 274
275extern unsigned long __copy_tofrom_user(void __user *to, 275#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n))
276 const void __user *from, unsigned long size); 276#define __copy_from_user_inatomic(to, from, n) \
277 copy_from_user((to), (from), (n))
277 278
278#define copy_to_user(to, from, n) \ 279#define copy_to_user(to, from, n) \
279 (access_ok(VERIFY_WRITE, (to), (n)) ? \ 280 (access_ok(VERIFY_WRITE, (to), (n)) ? \
@@ -290,10 +291,6 @@ extern unsigned long __copy_tofrom_user(void __user *to,
290 (void __user *)(from), (n)) \ 291 (void __user *)(from), (n)) \
291 : -EFAULT) 292 : -EFAULT)
292 293
293#define __copy_from_user(to, from, n) copy_from_user((to), (from), (n))
294#define __copy_from_user_inatomic(to, from, n) \
295 copy_from_user((to), (from), (n))
296
297extern int __strncpy_user(char *to, const char __user *from, int len); 294extern int __strncpy_user(char *to, const char __user *from, int len);
298extern int __strnlen_user(const char __user *sstr, int len); 295extern int __strnlen_user(const char __user *sstr, int len);
299 296
@@ -305,6 +302,9 @@ extern int __strnlen_user(const char __user *sstr, int len);
305 302
306#endif /* CONFIG_MMU */ 303#endif /* CONFIG_MMU */
307 304
305extern unsigned long __copy_tofrom_user(void __user *to,
306 const void __user *from, unsigned long size);
307
308/* 308/*
309 * The exception table consists of pairs of addresses: the first is the 309 * The exception table consists of pairs of addresses: the first is the
310 * address of an instruction that is allowed to fault, and the second is 310 * address of an instruction that is allowed to fault, and the second is
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
index d487729683de..b07594eccf9b 100644
--- a/arch/microblaze/kernel/Makefile
+++ b/arch/microblaze/kernel/Makefile
@@ -2,12 +2,22 @@
2# Makefile 2# Makefile
3# 3#
4 4
5ifdef CONFIG_FUNCTION_TRACER
6# Do not trace early boot code and low level code
7CFLAGS_REMOVE_timer.o = -pg
8CFLAGS_REMOVE_intc.o = -pg
9CFLAGS_REMOVE_early_printk.o = -pg
10CFLAGS_REMOVE_selfmod.o = -pg
11CFLAGS_REMOVE_heartbeat.o = -pg
12CFLAGS_REMOVE_ftrace.o = -pg
13endif
14
5extra-y := head.o vmlinux.lds 15extra-y := head.o vmlinux.lds
6 16
7obj-y += exceptions.o \ 17obj-y += exceptions.o \
8 hw_exception_handler.o init_task.o intc.o irq.o of_device.o \ 18 hw_exception_handler.o init_task.o intc.o irq.o of_device.o \
9 of_platform.o process.o prom.o prom_parse.o ptrace.o \ 19 of_platform.o process.o prom.o prom_parse.o ptrace.o \
10 setup.o signal.o sys_microblaze.o timer.o traps.o 20 setup.o signal.o sys_microblaze.o timer.o traps.o reset.o
11 21
12obj-y += cpu/ 22obj-y += cpu/
13 23
@@ -16,5 +26,7 @@ obj-$(CONFIG_SELFMOD) += selfmod.o
16obj-$(CONFIG_HEART_BEAT) += heartbeat.o 26obj-$(CONFIG_HEART_BEAT) += heartbeat.o
17obj-$(CONFIG_MODULES) += microblaze_ksyms.o module.o 27obj-$(CONFIG_MODULES) += microblaze_ksyms.o module.o
18obj-$(CONFIG_MMU) += misc.o 28obj-$(CONFIG_MMU) += misc.o
29obj-$(CONFIG_STACKTRACE) += stacktrace.o
30obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o mcount.o
19 31
20obj-y += entry$(MMU).o 32obj-y += entry$(MMU).o
diff --git a/arch/microblaze/kernel/cpu/Makefile b/arch/microblaze/kernel/cpu/Makefile
index 20646e549271..59cc7bceaf8c 100644
--- a/arch/microblaze/kernel/cpu/Makefile
+++ b/arch/microblaze/kernel/cpu/Makefile
@@ -2,6 +2,10 @@
2# Build the appropriate CPU version support 2# Build the appropriate CPU version support
3# 3#
4 4
5ifdef CONFIG_FUNCTION_TRACER
6CFLAGS_REMOVE_cache.o = -pg
7endif
8
5EXTRA_CFLAGS += -DCPU_MAJOR=$(CPU_MAJOR) -DCPU_MINOR=$(CPU_MINOR) \ 9EXTRA_CFLAGS += -DCPU_MAJOR=$(CPU_MAJOR) -DCPU_MINOR=$(CPU_MINOR) \
6 -DCPU_REV=$(CPU_REV) 10 -DCPU_REV=$(CPU_REV)
7 11
diff --git a/arch/microblaze/kernel/cpu/cache.c b/arch/microblaze/kernel/cpu/cache.c
index af866a450125..d9d63831cc2f 100644
--- a/arch/microblaze/kernel/cpu/cache.c
+++ b/arch/microblaze/kernel/cpu/cache.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu> 4 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2007-2009 PetaLogix 5 * Copyright (C) 2007-2009 PetaLogix
6 * Copyright (C) 2007 John Williams <john.williams@petalogix.com> 6 * Copyright (C) 2007-2009 John Williams <john.williams@petalogix.com>
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General 8 * This file is subject to the terms and conditions of the GNU General
9 * Public License. See the file COPYING in the main directory of this 9 * Public License. See the file COPYING in the main directory of this
@@ -13,243 +13,534 @@
13#include <asm/cacheflush.h> 13#include <asm/cacheflush.h>
14#include <linux/cache.h> 14#include <linux/cache.h>
15#include <asm/cpuinfo.h> 15#include <asm/cpuinfo.h>
16#include <asm/pvr.h>
16 17
17/* Exported functions */ 18static inline void __invalidate_flush_icache(unsigned int addr)
19{
20 __asm__ __volatile__ ("wic %0, r0;" \
21 : : "r" (addr));
22}
23
24static inline void __flush_dcache(unsigned int addr)
25{
26 __asm__ __volatile__ ("wdc.flush %0, r0;" \
27 : : "r" (addr));
28}
29
30static inline void __invalidate_dcache(unsigned int baseaddr,
31 unsigned int offset)
32{
33 __asm__ __volatile__ ("wdc.clear %0, %1;" \
34 : : "r" (baseaddr), "r" (offset));
35}
18 36
19void _enable_icache(void) 37static inline void __enable_icache_msr(void)
20{ 38{
21 if (cpuinfo.use_icache) { 39 __asm__ __volatile__ (" msrset r0, %0; \
22#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 40 nop; " \
23 __asm__ __volatile__ (" \ 41 : : "i" (MSR_ICE) : "memory");
24 msrset r0, %0; \ 42}
25 nop; " \ 43
26 : \ 44static inline void __disable_icache_msr(void)
27 : "i" (MSR_ICE) \ 45{
46 __asm__ __volatile__ (" msrclr r0, %0; \
47 nop; " \
48 : : "i" (MSR_ICE) : "memory");
49}
50
51static inline void __enable_dcache_msr(void)
52{
53 __asm__ __volatile__ (" msrset r0, %0; \
54 nop; " \
55 : \
56 : "i" (MSR_DCE) \
28 : "memory"); 57 : "memory");
29#else
30 __asm__ __volatile__ (" \
31 mfs r12, rmsr; \
32 nop; \
33 ori r12, r12, %0; \
34 mts rmsr, r12; \
35 nop; " \
36 : \
37 : "i" (MSR_ICE) \
38 : "memory", "r12");
39#endif
40 }
41} 58}
42 59
43void _disable_icache(void) 60static inline void __disable_dcache_msr(void)
44{ 61{
45 if (cpuinfo.use_icache) { 62 __asm__ __volatile__ (" msrclr r0, %0; \
46#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 63 nop; " \
47 __asm__ __volatile__ (" \ 64 : \
48 msrclr r0, %0; \ 65 : "i" (MSR_DCE) \
49 nop; " \
50 : \
51 : "i" (MSR_ICE) \
52 : "memory"); 66 : "memory");
53#else 67}
54 __asm__ __volatile__ (" \ 68
55 mfs r12, rmsr; \ 69static inline void __enable_icache_nomsr(void)
56 nop; \ 70{
57 andi r12, r12, ~%0; \ 71 __asm__ __volatile__ (" mfs r12, rmsr; \
58 mts rmsr, r12; \ 72 nop; \
59 nop; " \ 73 ori r12, r12, %0; \
60 : \ 74 mts rmsr, r12; \
61 : "i" (MSR_ICE) \ 75 nop; " \
76 : \
77 : "i" (MSR_ICE) \
62 : "memory", "r12"); 78 : "memory", "r12");
63#endif
64 }
65} 79}
66 80
67void _invalidate_icache(unsigned int addr) 81static inline void __disable_icache_nomsr(void)
68{ 82{
69 if (cpuinfo.use_icache) { 83 __asm__ __volatile__ (" mfs r12, rmsr; \
70 __asm__ __volatile__ (" \ 84 nop; \
71 wic %0, r0" \ 85 andi r12, r12, ~%0; \
72 : \ 86 mts rmsr, r12; \
73 : "r" (addr)); 87 nop; " \
74 } 88 : \
89 : "i" (MSR_ICE) \
90 : "memory", "r12");
75} 91}
76 92
77void _enable_dcache(void) 93static inline void __enable_dcache_nomsr(void)
78{ 94{
79 if (cpuinfo.use_dcache) { 95 __asm__ __volatile__ (" mfs r12, rmsr; \
80#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 96 nop; \
81 __asm__ __volatile__ (" \ 97 ori r12, r12, %0; \
82 msrset r0, %0; \ 98 mts rmsr, r12; \
83 nop; " \ 99 nop; " \
84 : \ 100 : \
85 : "i" (MSR_DCE) \ 101 : "i" (MSR_DCE) \
86 : "memory");
87#else
88 __asm__ __volatile__ (" \
89 mfs r12, rmsr; \
90 nop; \
91 ori r12, r12, %0; \
92 mts rmsr, r12; \
93 nop; " \
94 : \
95 : "i" (MSR_DCE) \
96 : "memory", "r12"); 102 : "memory", "r12");
97#endif
98 }
99} 103}
100 104
101void _disable_dcache(void) 105static inline void __disable_dcache_nomsr(void)
102{ 106{
103#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 107 __asm__ __volatile__ (" mfs r12, rmsr; \
104 __asm__ __volatile__ (" \ 108 nop; \
105 msrclr r0, %0; \ 109 andi r12, r12, ~%0; \
106 nop; " \ 110 mts rmsr, r12; \
107 : \ 111 nop; " \
108 : "i" (MSR_DCE) \ 112 : \
109 : "memory"); 113 : "i" (MSR_DCE) \
110#else
111 __asm__ __volatile__ (" \
112 mfs r12, rmsr; \
113 nop; \
114 andi r12, r12, ~%0; \
115 mts rmsr, r12; \
116 nop; " \
117 : \
118 : "i" (MSR_DCE) \
119 : "memory", "r12"); 114 : "memory", "r12");
120#endif
121} 115}
122 116
123void _invalidate_dcache(unsigned int addr) 117
118/* Helper macro for computing the limits of cache range loops */
119#define CACHE_LOOP_LIMITS(start, end, cache_line_length, cache_size) \
120do { \
121 int align = ~(cache_line_length - 1); \
122 end = min(start + cache_size, end); \
123 start &= align; \
124 end = ((end & align) + cache_line_length); \
125} while (0);
126
127/*
128 * Helper macro to loop over the specified cache_size/line_length and
129 * execute 'op' on that cacheline
130 */
131#define CACHE_ALL_LOOP(cache_size, line_length, op) \
132do { \
133 unsigned int len = cache_size; \
134 int step = -line_length; \
135 BUG_ON(step >= 0); \
136 \
137 __asm__ __volatile__ (" 1: " #op " %0, r0; \
138 bgtid %0, 1b; \
139 addk %0, %0, %1; \
140 " : : "r" (len), "r" (step) \
141 : "memory"); \
142} while (0);
143
144
145#define CACHE_ALL_LOOP2(cache_size, line_length, op) \
146do { \
147 unsigned int len = cache_size; \
148 int step = -line_length; \
149 BUG_ON(step >= 0); \
150 \
151 __asm__ __volatile__ (" 1: " #op " r0, %0; \
152 bgtid %0, 1b; \
153 addk %0, %0, %1; \
154 " : : "r" (len), "r" (step) \
155 : "memory"); \
156} while (0);
157
158/* for wdc.flush/clear */
159#define CACHE_RANGE_LOOP_2(start, end, line_length, op) \
160do { \
161 int step = -line_length; \
162 int count = end - start; \
163 BUG_ON(count <= 0); \
164 \
165 __asm__ __volatile__ (" 1: " #op " %0, %1; \
166 bgtid %1, 1b; \
167 addk %1, %1, %2; \
168 " : : "r" (start), "r" (count), \
169 "r" (step) : "memory"); \
170} while (0);
171
172/* It is used only first parameter for OP - for wic, wdc */
173#define CACHE_RANGE_LOOP_1(start, end, line_length, op) \
174do { \
175 int step = -line_length; \
176 int count = end - start; \
177 BUG_ON(count <= 0); \
178 \
179 __asm__ __volatile__ (" 1: addk %0, %0, %1; \
180 " #op " %0, r0; \
181 bgtid %1, 1b; \
182 addk %1, %1, %2; \
183 " : : "r" (start), "r" (count), \
184 "r" (step) : "memory"); \
185} while (0);
186
187static void __flush_icache_range_msr_irq(unsigned long start, unsigned long end)
124{ 188{
125 __asm__ __volatile__ (" \ 189 unsigned long flags;
126 wdc %0, r0" \ 190
127 : \ 191 pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
128 : "r" (addr)); 192 (unsigned int)start, (unsigned int) end);
193
194 CACHE_LOOP_LIMITS(start, end,
195 cpuinfo.icache_line_length, cpuinfo.icache_size);
196
197 local_irq_save(flags);
198 __disable_icache_msr();
199
200 CACHE_RANGE_LOOP_1(start, end, cpuinfo.icache_line_length, wic);
201
202 __enable_icache_msr();
203 local_irq_restore(flags);
129} 204}
130 205
131void __invalidate_icache_all(void) 206static void __flush_icache_range_nomsr_irq(unsigned long start,
207 unsigned long end)
132{ 208{
133 unsigned int i; 209 unsigned long flags;
134 unsigned flags;
135 210
136 if (cpuinfo.use_icache) { 211 pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
137 local_irq_save(flags); 212 (unsigned int)start, (unsigned int) end);
138 __disable_icache();
139 213
140 /* Just loop through cache size and invalidate, no need to add 214 CACHE_LOOP_LIMITS(start, end,
141 CACHE_BASE address */ 215 cpuinfo.icache_line_length, cpuinfo.icache_size);
142 for (i = 0; i < cpuinfo.icache_size;
143 i += cpuinfo.icache_line)
144 __invalidate_icache(i);
145 216
146 __enable_icache(); 217 local_irq_save(flags);
147 local_irq_restore(flags); 218 __disable_icache_nomsr();
148 } 219
220 CACHE_RANGE_LOOP_1(start, end, cpuinfo.icache_line_length, wic);
221
222 __enable_icache_nomsr();
223 local_irq_restore(flags);
149} 224}
150 225
151void __invalidate_icache_range(unsigned long start, unsigned long end) 226static void __flush_icache_range_noirq(unsigned long start,
227 unsigned long end)
152{ 228{
153 unsigned int i; 229 pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
154 unsigned flags; 230 (unsigned int)start, (unsigned int) end);
155 unsigned int align; 231
156 232 CACHE_LOOP_LIMITS(start, end,
157 if (cpuinfo.use_icache) { 233 cpuinfo.icache_line_length, cpuinfo.icache_size);
158 /* 234 CACHE_RANGE_LOOP_1(start, end, cpuinfo.icache_line_length, wic);
159 * No need to cover entire cache range, 235}
160 * just cover cache footprint 236
161 */ 237static void __flush_icache_all_msr_irq(void)
162 end = min(start + cpuinfo.icache_size, end); 238{
163 align = ~(cpuinfo.icache_line - 1); 239 unsigned long flags;
164 start &= align; /* Make sure we are aligned */ 240
165 /* Push end up to the next cache line */ 241 pr_debug("%s\n", __func__);
166 end = ((end & align) + cpuinfo.icache_line); 242
167 243 local_irq_save(flags);
168 local_irq_save(flags); 244 __disable_icache_msr();
169 __disable_icache(); 245
170 246 CACHE_ALL_LOOP(cpuinfo.icache_size, cpuinfo.icache_line_length, wic);
171 for (i = start; i < end; i += cpuinfo.icache_line) 247
172 __invalidate_icache(i); 248 __enable_icache_msr();
173 249 local_irq_restore(flags);
174 __enable_icache(); 250}
175 local_irq_restore(flags); 251
176 } 252static void __flush_icache_all_nomsr_irq(void)
253{
254 unsigned long flags;
255
256 pr_debug("%s\n", __func__);
257
258 local_irq_save(flags);
259 __disable_icache_nomsr();
260
261 CACHE_ALL_LOOP(cpuinfo.icache_size, cpuinfo.icache_line_length, wic);
262
263 __enable_icache_nomsr();
264 local_irq_restore(flags);
177} 265}
178 266
179void __invalidate_icache_page(struct vm_area_struct *vma, struct page *page) 267static void __flush_icache_all_noirq(void)
180{ 268{
181 __invalidate_icache_all(); 269 pr_debug("%s\n", __func__);
270 CACHE_ALL_LOOP(cpuinfo.icache_size, cpuinfo.icache_line_length, wic);
182} 271}
183 272
184void __invalidate_icache_user_range(struct vm_area_struct *vma, 273static void __invalidate_dcache_all_msr_irq(void)
185 struct page *page, unsigned long adr,
186 int len)
187{ 274{
188 __invalidate_icache_all(); 275 unsigned long flags;
276
277 pr_debug("%s\n", __func__);
278
279 local_irq_save(flags);
280 __disable_dcache_msr();
281
282 CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length, wdc);
283
284 __enable_dcache_msr();
285 local_irq_restore(flags);
189} 286}
190 287
191void __invalidate_cache_sigtramp(unsigned long addr) 288static void __invalidate_dcache_all_nomsr_irq(void)
192{ 289{
193 __invalidate_icache_range(addr, addr + 8); 290 unsigned long flags;
291
292 pr_debug("%s\n", __func__);
293
294 local_irq_save(flags);
295 __disable_dcache_nomsr();
296
297 CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length, wdc);
298
299 __enable_dcache_nomsr();
300 local_irq_restore(flags);
194} 301}
195 302
196void __invalidate_dcache_all(void) 303static void __invalidate_dcache_all_noirq_wt(void)
197{ 304{
198 unsigned int i; 305 pr_debug("%s\n", __func__);
199 unsigned flags; 306 CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length, wdc)
200
201 if (cpuinfo.use_dcache) {
202 local_irq_save(flags);
203 __disable_dcache();
204
205 /*
206 * Just loop through cache size and invalidate,
207 * no need to add CACHE_BASE address
208 */
209 for (i = 0; i < cpuinfo.dcache_size;
210 i += cpuinfo.dcache_line)
211 __invalidate_dcache(i);
212
213 __enable_dcache();
214 local_irq_restore(flags);
215 }
216} 307}
217 308
218void __invalidate_dcache_range(unsigned long start, unsigned long end) 309/* FIXME this is weird - should be only wdc but not work
310 * MS: I am getting bus errors and other weird things */
311static void __invalidate_dcache_all_wb(void)
219{ 312{
313 pr_debug("%s\n", __func__);
314 CACHE_ALL_LOOP2(cpuinfo.dcache_size, cpuinfo.dcache_line_length,
315 wdc.clear)
316
317#if 0
220 unsigned int i; 318 unsigned int i;
221 unsigned flags; 319
222 unsigned int align; 320 pr_debug("%s\n", __func__);
223 321
224 if (cpuinfo.use_dcache) { 322 /* Just loop through cache size and invalidate it */
225 /* 323 for (i = 0; i < cpuinfo.dcache_size; i += cpuinfo.dcache_line_length)
226 * No need to cover entire cache range, 324 __invalidate_dcache(0, i);
227 * just cover cache footprint 325#endif
228 */ 326}
229 end = min(start + cpuinfo.dcache_size, end); 327
230 align = ~(cpuinfo.dcache_line - 1); 328static void __invalidate_dcache_range_wb(unsigned long start,
231 start &= align; /* Make sure we are aligned */ 329 unsigned long end)
232 /* Push end up to the next cache line */ 330{
233 end = ((end & align) + cpuinfo.dcache_line); 331 pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
234 local_irq_save(flags); 332 (unsigned int)start, (unsigned int) end);
235 __disable_dcache(); 333
236 334 CACHE_LOOP_LIMITS(start, end,
237 for (i = start; i < end; i += cpuinfo.dcache_line) 335 cpuinfo.dcache_line_length, cpuinfo.dcache_size);
238 __invalidate_dcache(i); 336 CACHE_RANGE_LOOP_2(start, end, cpuinfo.dcache_line_length, wdc.clear);
239 337}
240 __enable_dcache(); 338
241 local_irq_restore(flags); 339static void __invalidate_dcache_range_nomsr_wt(unsigned long start,
242 } 340 unsigned long end)
341{
342 pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
343 (unsigned int)start, (unsigned int) end);
344 CACHE_LOOP_LIMITS(start, end,
345 cpuinfo.dcache_line_length, cpuinfo.dcache_size);
346
347 CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc);
243} 348}
244 349
245void __invalidate_dcache_page(struct vm_area_struct *vma, struct page *page) 350static void __invalidate_dcache_range_msr_irq_wt(unsigned long start,
351 unsigned long end)
246{ 352{
247 __invalidate_dcache_all(); 353 unsigned long flags;
354
355 pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
356 (unsigned int)start, (unsigned int) end);
357 CACHE_LOOP_LIMITS(start, end,
358 cpuinfo.dcache_line_length, cpuinfo.dcache_size);
359
360 local_irq_save(flags);
361 __disable_dcache_msr();
362
363 CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc);
364
365 __enable_dcache_msr();
366 local_irq_restore(flags);
367}
368
369static void __invalidate_dcache_range_nomsr_irq(unsigned long start,
370 unsigned long end)
371{
372 unsigned long flags;
373
374 pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
375 (unsigned int)start, (unsigned int) end);
376
377 CACHE_LOOP_LIMITS(start, end,
378 cpuinfo.dcache_line_length, cpuinfo.dcache_size);
379
380 local_irq_save(flags);
381 __disable_dcache_nomsr();
382
383 CACHE_RANGE_LOOP_1(start, end, cpuinfo.dcache_line_length, wdc);
384
385 __enable_dcache_nomsr();
386 local_irq_restore(flags);
387}
388
389static void __flush_dcache_all_wb(void)
390{
391 pr_debug("%s\n", __func__);
392 CACHE_ALL_LOOP(cpuinfo.dcache_size, cpuinfo.dcache_line_length,
393 wdc.flush);
248} 394}
249 395
250void __invalidate_dcache_user_range(struct vm_area_struct *vma, 396static void __flush_dcache_range_wb(unsigned long start, unsigned long end)
251 struct page *page, unsigned long adr,
252 int len)
253{ 397{
254 __invalidate_dcache_all(); 398 pr_debug("%s: start 0x%x, end 0x%x\n", __func__,
399 (unsigned int)start, (unsigned int) end);
400
401 CACHE_LOOP_LIMITS(start, end,
402 cpuinfo.dcache_line_length, cpuinfo.dcache_size);
403 CACHE_RANGE_LOOP_2(start, end, cpuinfo.dcache_line_length, wdc.flush);
404}
405
406/* struct for wb caches and for wt caches */
407struct scache *mbc;
408
409/* new wb cache model */
410const struct scache wb_msr = {
411 .ie = __enable_icache_msr,
412 .id = __disable_icache_msr,
413 .ifl = __flush_icache_all_noirq,
414 .iflr = __flush_icache_range_noirq,
415 .iin = __flush_icache_all_noirq,
416 .iinr = __flush_icache_range_noirq,
417 .de = __enable_dcache_msr,
418 .dd = __disable_dcache_msr,
419 .dfl = __flush_dcache_all_wb,
420 .dflr = __flush_dcache_range_wb,
421 .din = __invalidate_dcache_all_wb,
422 .dinr = __invalidate_dcache_range_wb,
423};
424
425/* There is only difference in ie, id, de, dd functions */
426const struct scache wb_nomsr = {
427 .ie = __enable_icache_nomsr,
428 .id = __disable_icache_nomsr,
429 .ifl = __flush_icache_all_noirq,
430 .iflr = __flush_icache_range_noirq,
431 .iin = __flush_icache_all_noirq,
432 .iinr = __flush_icache_range_noirq,
433 .de = __enable_dcache_nomsr,
434 .dd = __disable_dcache_nomsr,
435 .dfl = __flush_dcache_all_wb,
436 .dflr = __flush_dcache_range_wb,
437 .din = __invalidate_dcache_all_wb,
438 .dinr = __invalidate_dcache_range_wb,
439};
440
441/* Old wt cache model with disabling irq and turn off cache */
442const struct scache wt_msr = {
443 .ie = __enable_icache_msr,
444 .id = __disable_icache_msr,
445 .ifl = __flush_icache_all_msr_irq,
446 .iflr = __flush_icache_range_msr_irq,
447 .iin = __flush_icache_all_msr_irq,
448 .iinr = __flush_icache_range_msr_irq,
449 .de = __enable_dcache_msr,
450 .dd = __disable_dcache_msr,
451 .dfl = __invalidate_dcache_all_msr_irq,
452 .dflr = __invalidate_dcache_range_msr_irq_wt,
453 .din = __invalidate_dcache_all_msr_irq,
454 .dinr = __invalidate_dcache_range_msr_irq_wt,
455};
456
457const struct scache wt_nomsr = {
458 .ie = __enable_icache_nomsr,
459 .id = __disable_icache_nomsr,
460 .ifl = __flush_icache_all_nomsr_irq,
461 .iflr = __flush_icache_range_nomsr_irq,
462 .iin = __flush_icache_all_nomsr_irq,
463 .iinr = __flush_icache_range_nomsr_irq,
464 .de = __enable_dcache_nomsr,
465 .dd = __disable_dcache_nomsr,
466 .dfl = __invalidate_dcache_all_nomsr_irq,
467 .dflr = __invalidate_dcache_range_nomsr_irq,
468 .din = __invalidate_dcache_all_nomsr_irq,
469 .dinr = __invalidate_dcache_range_nomsr_irq,
470};
471
472/* New wt cache model for newer Microblaze versions */
473const struct scache wt_msr_noirq = {
474 .ie = __enable_icache_msr,
475 .id = __disable_icache_msr,
476 .ifl = __flush_icache_all_noirq,
477 .iflr = __flush_icache_range_noirq,
478 .iin = __flush_icache_all_noirq,
479 .iinr = __flush_icache_range_noirq,
480 .de = __enable_dcache_msr,
481 .dd = __disable_dcache_msr,
482 .dfl = __invalidate_dcache_all_noirq_wt,
483 .dflr = __invalidate_dcache_range_nomsr_wt,
484 .din = __invalidate_dcache_all_noirq_wt,
485 .dinr = __invalidate_dcache_range_nomsr_wt,
486};
487
488const struct scache wt_nomsr_noirq = {
489 .ie = __enable_icache_nomsr,
490 .id = __disable_icache_nomsr,
491 .ifl = __flush_icache_all_noirq,
492 .iflr = __flush_icache_range_noirq,
493 .iin = __flush_icache_all_noirq,
494 .iinr = __flush_icache_range_noirq,
495 .de = __enable_dcache_nomsr,
496 .dd = __disable_dcache_nomsr,
497 .dfl = __invalidate_dcache_all_noirq_wt,
498 .dflr = __invalidate_dcache_range_nomsr_wt,
499 .din = __invalidate_dcache_all_noirq_wt,
500 .dinr = __invalidate_dcache_range_nomsr_wt,
501};
502
503/* CPU version code for 7.20.c - see arch/microblaze/kernel/cpu/cpuinfo.c */
504#define CPUVER_7_20_A 0x0c
505#define CPUVER_7_20_D 0x0f
506
507#define INFO(s) printk(KERN_INFO "cache: " s " \n");
508
509void microblaze_cache_init(void)
510{
511 if (cpuinfo.use_instr & PVR2_USE_MSR_INSTR) {
512 if (cpuinfo.dcache_wb) {
513 INFO("wb_msr");
514 mbc = (struct scache *)&wb_msr;
515 if (cpuinfo.ver_code < CPUVER_7_20_D) {
516 /* MS: problem with signal handling - hw bug */
517 INFO("WB won't work properly");
518 }
519 } else {
520 if (cpuinfo.ver_code >= CPUVER_7_20_A) {
521 INFO("wt_msr_noirq");
522 mbc = (struct scache *)&wt_msr_noirq;
523 } else {
524 INFO("wt_msr");
525 mbc = (struct scache *)&wt_msr;
526 }
527 }
528 } else {
529 if (cpuinfo.dcache_wb) {
530 INFO("wb_nomsr");
531 mbc = (struct scache *)&wb_nomsr;
532 if (cpuinfo.ver_code < CPUVER_7_20_D) {
533 /* MS: problem with signal handling - hw bug */
534 INFO("WB won't work properly");
535 }
536 } else {
537 if (cpuinfo.ver_code >= CPUVER_7_20_A) {
538 INFO("wt_nomsr_noirq");
539 mbc = (struct scache *)&wt_nomsr_noirq;
540 } else {
541 INFO("wt_nomsr");
542 mbc = (struct scache *)&wt_nomsr;
543 }
544 }
545 }
255} 546}
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
index c259786e7faa..f72dbd66c844 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-pvr-full.c
@@ -21,8 +21,14 @@
21 */ 21 */
22 22
23#define CI(c, p) { ci->c = PVR_##p(pvr); } 23#define CI(c, p) { ci->c = PVR_##p(pvr); }
24
25#if defined(CONFIG_EARLY_PRINTK) && defined(CONFIG_SERIAL_UARTLITE_CONSOLE)
24#define err_printk(x) \ 26#define err_printk(x) \
25 early_printk("ERROR: Microblaze " x "-different for PVR and DTS\n"); 27 early_printk("ERROR: Microblaze " x "-different for PVR and DTS\n");
28#else
29#define err_printk(x) \
30 printk(KERN_INFO "ERROR: Microblaze " x "-different for PVR and DTS\n");
31#endif
26 32
27void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu) 33void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
28{ 34{
@@ -70,7 +76,7 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
70 CI(use_icache, USE_ICACHE); 76 CI(use_icache, USE_ICACHE);
71 CI(icache_tagbits, ICACHE_ADDR_TAG_BITS); 77 CI(icache_tagbits, ICACHE_ADDR_TAG_BITS);
72 CI(icache_write, ICACHE_ALLOW_WR); 78 CI(icache_write, ICACHE_ALLOW_WR);
73 CI(icache_line, ICACHE_LINE_LEN); 79 ci->icache_line_length = PVR_ICACHE_LINE_LEN(pvr) << 2;
74 CI(icache_size, ICACHE_BYTE_SIZE); 80 CI(icache_size, ICACHE_BYTE_SIZE);
75 CI(icache_base, ICACHE_BASEADDR); 81 CI(icache_base, ICACHE_BASEADDR);
76 CI(icache_high, ICACHE_HIGHADDR); 82 CI(icache_high, ICACHE_HIGHADDR);
@@ -78,11 +84,16 @@ void set_cpuinfo_pvr_full(struct cpuinfo *ci, struct device_node *cpu)
78 CI(use_dcache, USE_DCACHE); 84 CI(use_dcache, USE_DCACHE);
79 CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS); 85 CI(dcache_tagbits, DCACHE_ADDR_TAG_BITS);
80 CI(dcache_write, DCACHE_ALLOW_WR); 86 CI(dcache_write, DCACHE_ALLOW_WR);
81 CI(dcache_line, DCACHE_LINE_LEN); 87 ci->dcache_line_length = PVR_DCACHE_LINE_LEN(pvr) << 2;
82 CI(dcache_size, DCACHE_BYTE_SIZE); 88 CI(dcache_size, DCACHE_BYTE_SIZE);
83 CI(dcache_base, DCACHE_BASEADDR); 89 CI(dcache_base, DCACHE_BASEADDR);
84 CI(dcache_high, DCACHE_HIGHADDR); 90 CI(dcache_high, DCACHE_HIGHADDR);
85 91
92 temp = PVR_DCACHE_USE_WRITEBACK(pvr);
93 if (ci->dcache_wb != temp)
94 err_printk("DCACHE WB");
95 ci->dcache_wb = temp;
96
86 CI(use_dopb, D_OPB); 97 CI(use_dopb, D_OPB);
87 CI(use_iopb, I_OPB); 98 CI(use_iopb, I_OPB);
88 CI(use_dlmb, D_LMB); 99 CI(use_dlmb, D_LMB);
diff --git a/arch/microblaze/kernel/cpu/cpuinfo-static.c b/arch/microblaze/kernel/cpu/cpuinfo-static.c
index adb448f93d5f..6095aa6b5c88 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo-static.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo-static.c
@@ -72,12 +72,12 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
72 ci->use_icache = fcpu(cpu, "xlnx,use-icache"); 72 ci->use_icache = fcpu(cpu, "xlnx,use-icache");
73 ci->icache_tagbits = fcpu(cpu, "xlnx,addr-tag-bits"); 73 ci->icache_tagbits = fcpu(cpu, "xlnx,addr-tag-bits");
74 ci->icache_write = fcpu(cpu, "xlnx,allow-icache-wr"); 74 ci->icache_write = fcpu(cpu, "xlnx,allow-icache-wr");
75 ci->icache_line = fcpu(cpu, "xlnx,icache-line-len") << 2; 75 ci->icache_line_length = fcpu(cpu, "xlnx,icache-line-len") << 2;
76 if (!ci->icache_line) { 76 if (!ci->icache_line_length) {
77 if (fcpu(cpu, "xlnx,icache-use-fsl")) 77 if (fcpu(cpu, "xlnx,icache-use-fsl"))
78 ci->icache_line = 4 << 2; 78 ci->icache_line_length = 4 << 2;
79 else 79 else
80 ci->icache_line = 1 << 2; 80 ci->icache_line_length = 1 << 2;
81 } 81 }
82 ci->icache_size = fcpu(cpu, "i-cache-size"); 82 ci->icache_size = fcpu(cpu, "i-cache-size");
83 ci->icache_base = fcpu(cpu, "i-cache-baseaddr"); 83 ci->icache_base = fcpu(cpu, "i-cache-baseaddr");
@@ -86,16 +86,17 @@ void __init set_cpuinfo_static(struct cpuinfo *ci, struct device_node *cpu)
86 ci->use_dcache = fcpu(cpu, "xlnx,use-dcache"); 86 ci->use_dcache = fcpu(cpu, "xlnx,use-dcache");
87 ci->dcache_tagbits = fcpu(cpu, "xlnx,dcache-addr-tag"); 87 ci->dcache_tagbits = fcpu(cpu, "xlnx,dcache-addr-tag");
88 ci->dcache_write = fcpu(cpu, "xlnx,allow-dcache-wr"); 88 ci->dcache_write = fcpu(cpu, "xlnx,allow-dcache-wr");
89 ci->dcache_line = fcpu(cpu, "xlnx,dcache-line-len") << 2; 89 ci->dcache_line_length = fcpu(cpu, "xlnx,dcache-line-len") << 2;
90 if (!ci->dcache_line) { 90 if (!ci->dcache_line_length) {
91 if (fcpu(cpu, "xlnx,dcache-use-fsl")) 91 if (fcpu(cpu, "xlnx,dcache-use-fsl"))
92 ci->dcache_line = 4 << 2; 92 ci->dcache_line_length = 4 << 2;
93 else 93 else
94 ci->dcache_line = 1 << 2; 94 ci->dcache_line_length = 1 << 2;
95 } 95 }
96 ci->dcache_size = fcpu(cpu, "d-cache-size"); 96 ci->dcache_size = fcpu(cpu, "d-cache-size");
97 ci->dcache_base = fcpu(cpu, "d-cache-baseaddr"); 97 ci->dcache_base = fcpu(cpu, "d-cache-baseaddr");
98 ci->dcache_high = fcpu(cpu, "d-cache-highaddr"); 98 ci->dcache_high = fcpu(cpu, "d-cache-highaddr");
99 ci->dcache_wb = fcpu(cpu, "xlnx,dcache-use-writeback");
99 100
100 ci->use_dopb = fcpu(cpu, "xlnx,d-opb"); 101 ci->use_dopb = fcpu(cpu, "xlnx,d-opb");
101 ci->use_iopb = fcpu(cpu, "xlnx,i-opb"); 102 ci->use_iopb = fcpu(cpu, "xlnx,i-opb");
diff --git a/arch/microblaze/kernel/cpu/cpuinfo.c b/arch/microblaze/kernel/cpu/cpuinfo.c
index 3539babc1c18..991d71311b0e 100644
--- a/arch/microblaze/kernel/cpu/cpuinfo.c
+++ b/arch/microblaze/kernel/cpu/cpuinfo.c
@@ -29,11 +29,8 @@ const struct cpu_ver_key cpu_ver_lookup[] = {
29 {"7.20.a", 0x0c}, 29 {"7.20.a", 0x0c},
30 {"7.20.b", 0x0d}, 30 {"7.20.b", 0x0d},
31 {"7.20.c", 0x0e}, 31 {"7.20.c", 0x0e},
32 /* FIXME There is no keycode defined in MBV for these versions */ 32 {"7.20.d", 0x0f},
33 {"2.10.a", 0x10}, 33 {"7.30.a", 0x10},
34 {"3.00.a", 0x20},
35 {"4.00.a", 0x30},
36 {"4.00.b", 0x40},
37 {NULL, 0}, 34 {NULL, 0},
38}; 35};
39 36
diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
index 4dcfccdbc364..0c912b2a8e03 100644
--- a/arch/microblaze/kernel/cpu/mb.c
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -103,11 +103,15 @@ static int show_cpuinfo(struct seq_file *m, void *v)
103 else 103 else
104 count += seq_printf(m, "Icache:\t\tno\n"); 104 count += seq_printf(m, "Icache:\t\tno\n");
105 105
106 if (cpuinfo.use_dcache) 106 if (cpuinfo.use_dcache) {
107 count += seq_printf(m, 107 count += seq_printf(m,
108 "Dcache:\t\t%ukB\n", 108 "Dcache:\t\t%ukB\n",
109 cpuinfo.dcache_size >> 10); 109 cpuinfo.dcache_size >> 10);
110 else 110 if (cpuinfo.dcache_wb)
111 count += seq_printf(m, "\t\twrite-back\n");
112 else
113 count += seq_printf(m, "\t\twrite-through\n");
114 } else
111 count += seq_printf(m, "Dcache:\t\tno\n"); 115 count += seq_printf(m, "Dcache:\t\tno\n");
112 116
113 count += seq_printf(m, 117 count += seq_printf(m,
diff --git a/arch/microblaze/kernel/cpu/pvr.c b/arch/microblaze/kernel/cpu/pvr.c
index c9a4340ddd53..9bee9382bf74 100644
--- a/arch/microblaze/kernel/cpu/pvr.c
+++ b/arch/microblaze/kernel/cpu/pvr.c
@@ -45,7 +45,7 @@
45 45
46int cpu_has_pvr(void) 46int cpu_has_pvr(void)
47{ 47{
48 unsigned flags; 48 unsigned long flags;
49 unsigned pvr0; 49 unsigned pvr0;
50 50
51 local_save_flags(flags); 51 local_save_flags(flags);
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S
index 9083d85376a4..95b0855802df 100644
--- a/arch/microblaze/kernel/entry-nommu.S
+++ b/arch/microblaze/kernel/entry-nommu.S
@@ -208,8 +208,6 @@ ENTRY(_user_exception)
208 lwi r1, r1, TS_THREAD_INFO /* get the thread info */ 208 lwi r1, r1, TS_THREAD_INFO /* get the thread info */
209 /* calculate kernel stack pointer */ 209 /* calculate kernel stack pointer */
210 addik r1, r1, THREAD_SIZE - PT_SIZE 210 addik r1, r1, THREAD_SIZE - PT_SIZE
211 swi r11, r0, PER_CPU(R11_SAVE) /* temporarily save r11 */
212 lwi r11, r0, PER_CPU(KM) /* load mode indicator */
2132: 2112:
214 swi r11, r1, PT_MODE /* store the mode */ 212 swi r11, r1, PT_MODE /* store the mode */
215 lwi r11, r0, PER_CPU(R11_SAVE) /* reload r11 */ 213 lwi r11, r0, PER_CPU(R11_SAVE) /* reload r11 */
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index e3ecb36dd554..3bad4ff49471 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -31,6 +31,8 @@
31#include <linux/errno.h> 31#include <linux/errno.h>
32#include <asm/signal.h> 32#include <asm/signal.h>
33 33
34#undef DEBUG
35
34/* The size of a state save frame. */ 36/* The size of a state save frame. */
35#define STATE_SAVE_SIZE (PT_SIZE + STATE_SAVE_ARG_SPACE) 37#define STATE_SAVE_SIZE (PT_SIZE + STATE_SAVE_ARG_SPACE)
36 38
@@ -352,10 +354,12 @@ C_ENTRY(_user_exception):
352 add r12, r12, r12; /* convert num -> ptr */ 354 add r12, r12, r12; /* convert num -> ptr */
353 add r12, r12, r12; 355 add r12, r12, r12;
354 356
357#ifdef DEBUG
355 /* Trac syscalls and stored them to r0_ram */ 358 /* Trac syscalls and stored them to r0_ram */
356 lwi r3, r12, 0x400 + r0_ram 359 lwi r3, r12, 0x400 + r0_ram
357 addi r3, r3, 1 360 addi r3, r3, 1
358 swi r3, r12, 0x400 + r0_ram 361 swi r3, r12, 0x400 + r0_ram
362#endif
359 363
360 # Find and jump into the syscall handler. 364 # Find and jump into the syscall handler.
361 lwi r12, r12, sys_call_table 365 lwi r12, r12, sys_call_table
@@ -496,17 +500,6 @@ C_ENTRY(sys_execve):
496 brid microblaze_execve; /* Do real work (tail-call).*/ 500 brid microblaze_execve; /* Do real work (tail-call).*/
497 nop; 501 nop;
498 502
499C_ENTRY(sys_rt_sigsuspend_wrapper):
500 swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
501 swi r4, r1, PTO+PT_R4;
502 la r7, r1, PTO; /* add user context as 3rd arg */
503 brlid r15, sys_rt_sigsuspend; /* Do real work.*/
504 nop;
505 lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
506 lwi r4, r1, PTO+PT_R4;
507 bri ret_from_trap /* fall through will not work here due to align */
508 nop;
509
510C_ENTRY(sys_rt_sigreturn_wrapper): 503C_ENTRY(sys_rt_sigreturn_wrapper):
511 swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ 504 swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
512 swi r4, r1, PTO+PT_R4; 505 swi r4, r1, PTO+PT_R4;
@@ -711,15 +704,11 @@ C_ENTRY(ret_from_exc):
711 * (in a possibly modified form) after do_signal returns. 704 * (in a possibly modified form) after do_signal returns.
712 * store return registers separately because this macros is use 705 * store return registers separately because this macros is use
713 * for others exceptions */ 706 * for others exceptions */
714 swi r3, r1, PTO + PT_R3;
715 swi r4, r1, PTO + PT_R4;
716 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ 707 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
717 add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 708 add r6, r0, r0; /* Arg 2: sigset_t *oldset */
718 addi r7, r0, 0; /* Arg 3: int in_syscall */ 709 addi r7, r0, 0; /* Arg 3: int in_syscall */
719 bralid r15, do_signal; /* Handle any signals */ 710 bralid r15, do_signal; /* Handle any signals */
720 nop; 711 nop;
721 lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
722 lwi r4, r1, PTO+PT_R4;
723 712
724/* Finally, return to user state. */ 713/* Finally, return to user state. */
7251: swi r0, r0, PER_CPU(KM); /* Now officially in user state. */ 7141: swi r0, r0, PER_CPU(KM); /* Now officially in user state. */
diff --git a/arch/microblaze/kernel/ftrace.c b/arch/microblaze/kernel/ftrace.c
new file mode 100644
index 000000000000..388b31ca65a1
--- /dev/null
+++ b/arch/microblaze/kernel/ftrace.c
@@ -0,0 +1,237 @@
1/*
2 * Ftrace support for Microblaze.
3 *
4 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2009 PetaLogix
6 *
7 * Based on MIPS and PowerPC ftrace code
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive
11 * for more details.
12 */
13
14#include <asm/cacheflush.h>
15#include <linux/ftrace.h>
16
17#ifdef CONFIG_FUNCTION_GRAPH_TRACER
18/*
19 * Hook the return address and push it in the stack of return addrs
20 * in current thread info.
21 */
22void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
23{
24 unsigned long old;
25 int faulted, err;
26 struct ftrace_graph_ent trace;
27 unsigned long return_hooker = (unsigned long)
28 &return_to_handler;
29
30 if (unlikely(atomic_read(&current->tracing_graph_pause)))
31 return;
32
33 /*
34 * Protect against fault, even if it shouldn't
35 * happen. This tool is too much intrusive to
36 * ignore such a protection.
37 */
38 asm volatile(" 1: lwi %0, %2, 0; \
39 2: swi %3, %2, 0; \
40 addik %1, r0, 0; \
41 3: \
42 .section .fixup, \"ax\"; \
43 4: brid 3b; \
44 addik %1, r0, 1; \
45 .previous; \
46 .section __ex_table,\"a\"; \
47 .word 1b,4b; \
48 .word 2b,4b; \
49 .previous;" \
50 : "=&r" (old), "=r" (faulted)
51 : "r" (parent), "r" (return_hooker)
52 );
53
54 if (unlikely(faulted)) {
55 ftrace_graph_stop();
56 WARN_ON(1);
57 return;
58 }
59
60 err = ftrace_push_return_trace(old, self_addr, &trace.depth, 0);
61 if (err == -EBUSY) {
62 *parent = old;
63 return;
64 }
65
66 trace.func = self_addr;
67 /* Only trace if the calling function expects to */
68 if (!ftrace_graph_entry(&trace)) {
69 current->curr_ret_stack--;
70 *parent = old;
71 }
72}
73#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
74
75#ifdef CONFIG_DYNAMIC_FTRACE
76/* save value to addr - it is save to do it in asm */
77static int ftrace_modify_code(unsigned long addr, unsigned int value)
78{
79 int faulted = 0;
80
81 __asm__ __volatile__(" 1: swi %2, %1, 0; \
82 addik %0, r0, 0; \
83 2: \
84 .section .fixup, \"ax\"; \
85 3: brid 2b; \
86 addik %0, r0, 1; \
87 .previous; \
88 .section __ex_table,\"a\"; \
89 .word 1b,3b; \
90 .previous;" \
91 : "=r" (faulted)
92 : "r" (addr), "r" (value)
93 );
94
95 if (unlikely(faulted))
96 return -EFAULT;
97
98 return 0;
99}
100
101#define MICROBLAZE_NOP 0x80000000
102#define MICROBLAZE_BRI 0xb800000C
103
104static unsigned int recorded; /* if save was or not */
105static unsigned int imm; /* saving whole imm instruction */
106
107/* There are two approaches howto solve ftrace_make nop function - look below */
108#undef USE_FTRACE_NOP
109
110#ifdef USE_FTRACE_NOP
111static unsigned int bralid; /* saving whole bralid instruction */
112#endif
113
114int ftrace_make_nop(struct module *mod,
115 struct dyn_ftrace *rec, unsigned long addr)
116{
117 /* we have this part of code which we are working with
118 * b000c000 imm -16384
119 * b9fc8e30 bralid r15, -29136 // c0008e30 <_mcount>
120 * 80000000 or r0, r0, r0
121 *
122 * The first solution (!USE_FTRACE_NOP-could be called branch solution)
123 * b000c000 bri 12 (0xC - jump to any other instruction)
124 * b9fc8e30 bralid r15, -29136 // c0008e30 <_mcount>
125 * 80000000 or r0, r0, r0
126 * any other instruction
127 *
128 * The second solution (USE_FTRACE_NOP) - no jump just nops
129 * 80000000 or r0, r0, r0
130 * 80000000 or r0, r0, r0
131 * 80000000 or r0, r0, r0
132 */
133 int ret = 0;
134
135 if (recorded == 0) {
136 recorded = 1;
137 imm = *(unsigned int *)rec->ip;
138 pr_debug("%s: imm:0x%x\n", __func__, imm);
139#ifdef USE_FTRACE_NOP
140 bralid = *(unsigned int *)(rec->ip + 4);
141 pr_debug("%s: bralid 0x%x\n", __func__, bralid);
142#endif /* USE_FTRACE_NOP */
143 }
144
145#ifdef USE_FTRACE_NOP
146 ret = ftrace_modify_code(rec->ip, MICROBLAZE_NOP);
147 ret += ftrace_modify_code(rec->ip + 4, MICROBLAZE_NOP);
148#else /* USE_FTRACE_NOP */
149 ret = ftrace_modify_code(rec->ip, MICROBLAZE_BRI);
150#endif /* USE_FTRACE_NOP */
151 return ret;
152}
153
154static int ret_addr; /* initialized as 0 by default */
155
156/* I believe that first is called ftrace_make_nop before this function */
157int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
158{
159 int ret;
160 ret_addr = addr; /* saving where the barrier jump is */
161 pr_debug("%s: addr:0x%x, rec->ip: 0x%x, imm:0x%x\n",
162 __func__, (unsigned int)addr, (unsigned int)rec->ip, imm);
163 ret = ftrace_modify_code(rec->ip, imm);
164#ifdef USE_FTRACE_NOP
165 pr_debug("%s: bralid:0x%x\n", __func__, bralid);
166 ret += ftrace_modify_code(rec->ip + 4, bralid);
167#endif /* USE_FTRACE_NOP */
168 return ret;
169}
170
171int __init ftrace_dyn_arch_init(void *data)
172{
173 /* The return code is retured via data */
174 *(unsigned long *)data = 0;
175
176 return 0;
177}
178
179int ftrace_update_ftrace_func(ftrace_func_t func)
180{
181 unsigned long ip = (unsigned long)(&ftrace_call);
182 unsigned int upper = (unsigned int)func;
183 unsigned int lower = (unsigned int)func;
184 int ret = 0;
185
186 /* create proper saving to ftrace_call poll */
187 upper = 0xb0000000 + (upper >> 16); /* imm func_upper */
188 lower = 0x32800000 + (lower & 0xFFFF); /* addik r20, r0, func_lower */
189
190 pr_debug("%s: func=0x%x, ip=0x%x, upper=0x%x, lower=0x%x\n",
191 __func__, (unsigned int)func, (unsigned int)ip, upper, lower);
192
193 /* save upper and lower code */
194 ret = ftrace_modify_code(ip, upper);
195 ret += ftrace_modify_code(ip + 4, lower);
196
197 /* We just need to remove the rtsd r15, 8 by NOP */
198 BUG_ON(!ret_addr);
199 if (ret_addr)
200 ret += ftrace_modify_code(ret_addr, MICROBLAZE_NOP);
201 else
202 ret = 1; /* fault */
203
204 /* All changes are done - lets do caches consistent */
205 flush_icache();
206 return ret;
207}
208
209#ifdef CONFIG_FUNCTION_GRAPH_TRACER
210unsigned int old_jump; /* saving place for jump instruction */
211
212int ftrace_enable_ftrace_graph_caller(void)
213{
214 unsigned int ret;
215 unsigned long ip = (unsigned long)(&ftrace_call_graph);
216
217 old_jump = *(unsigned int *)ip; /* save jump over instruction */
218 ret = ftrace_modify_code(ip, MICROBLAZE_NOP);
219 flush_icache();
220
221 pr_debug("%s: Replace instruction: 0x%x\n", __func__, old_jump);
222 return ret;
223}
224
225int ftrace_disable_ftrace_graph_caller(void)
226{
227 unsigned int ret;
228 unsigned long ip = (unsigned long)(&ftrace_call_graph);
229
230 ret = ftrace_modify_code(ip, old_jump);
231 flush_icache();
232
233 pr_debug("%s\n", __func__);
234 return ret;
235}
236#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
237#endif /* CONFIG_DYNAMIC_FTRACE */
diff --git a/arch/microblaze/kernel/heartbeat.c b/arch/microblaze/kernel/heartbeat.c
index 1bdf20222b92..522751737cfa 100644
--- a/arch/microblaze/kernel/heartbeat.c
+++ b/arch/microblaze/kernel/heartbeat.c
@@ -45,6 +45,7 @@ void heartbeat(void)
45void setup_heartbeat(void) 45void setup_heartbeat(void)
46{ 46{
47 struct device_node *gpio = NULL; 47 struct device_node *gpio = NULL;
48 int *prop;
48 int j; 49 int j;
49 char *gpio_list[] = { 50 char *gpio_list[] = {
50 "xlnx,xps-gpio-1.00.a", 51 "xlnx,xps-gpio-1.00.a",
@@ -58,10 +59,14 @@ void setup_heartbeat(void)
58 break; 59 break;
59 } 60 }
60 61
61 base_addr = *(int *) of_get_property(gpio, "reg", NULL); 62 if (gpio) {
62 base_addr = (unsigned long) ioremap(base_addr, PAGE_SIZE); 63 base_addr = *(int *) of_get_property(gpio, "reg", NULL);
63 printk(KERN_NOTICE "Heartbeat GPIO at 0x%x\n", base_addr); 64 base_addr = (unsigned long) ioremap(base_addr, PAGE_SIZE);
65 printk(KERN_NOTICE "Heartbeat GPIO at 0x%x\n", base_addr);
64 66
65 if (*(int *) of_get_property(gpio, "xlnx,is-bidir", NULL)) 67 /* GPIO is configured as output */
66 out_be32(base_addr + 4, 0); /* GPIO is configured as output */ 68 prop = (int *) of_get_property(gpio, "xlnx,is-bidir", NULL);
69 if (prop)
70 out_be32(base_addr + 4, 0);
71 }
67} 72}
diff --git a/arch/microblaze/kernel/intc.c b/arch/microblaze/kernel/intc.c
index 6eea6f92b84e..03172c1da770 100644
--- a/arch/microblaze/kernel/intc.c
+++ b/arch/microblaze/kernel/intc.c
@@ -42,8 +42,16 @@ unsigned int nr_irq;
42 42
43static void intc_enable_or_unmask(unsigned int irq) 43static void intc_enable_or_unmask(unsigned int irq)
44{ 44{
45 unsigned long mask = 1 << irq;
45 pr_debug("enable_or_unmask: %d\n", irq); 46 pr_debug("enable_or_unmask: %d\n", irq);
46 out_be32(INTC_BASE + SIE, 1 << irq); 47 out_be32(INTC_BASE + SIE, mask);
48
49 /* ack level irqs because they can't be acked during
50 * ack function since the handle_level_irq function
51 * acks the irq before calling the interrupt handler
52 */
53 if (irq_desc[irq].status & IRQ_LEVEL)
54 out_be32(INTC_BASE + IAR, mask);
47} 55}
48 56
49static void intc_disable_or_mask(unsigned int irq) 57static void intc_disable_or_mask(unsigned int irq)
diff --git a/arch/microblaze/kernel/mcount.S b/arch/microblaze/kernel/mcount.S
new file mode 100644
index 000000000000..e7eaa7a8cbd3
--- /dev/null
+++ b/arch/microblaze/kernel/mcount.S
@@ -0,0 +1,170 @@
1/*
2 * Low-level ftrace handling
3 *
4 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2009 PetaLogix
6 *
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
10 */
11
12#include <linux/linkage.h>
13
14#define NOALIGN_ENTRY(name) .globl name; name:
15
16/* FIXME MS: I think that I don't need to save all regs */
17#define SAVE_REGS \
18 addik r1, r1, -120; \
19 swi r2, r1, 4; \
20 swi r3, r1, 8; \
21 swi r4, r1, 12; \
22 swi r5, r1, 116; \
23 swi r6, r1, 16; \
24 swi r7, r1, 20; \
25 swi r8, r1, 24; \
26 swi r9, r1, 28; \
27 swi r10, r1, 32; \
28 swi r11, r1, 36; \
29 swi r12, r1, 40; \
30 swi r13, r1, 44; \
31 swi r14, r1, 48; \
32 swi r16, r1, 52; \
33 swi r17, r1, 56; \
34 swi r18, r1, 60; \
35 swi r19, r1, 64; \
36 swi r20, r1, 68; \
37 swi r21, r1, 72; \
38 swi r22, r1, 76; \
39 swi r23, r1, 80; \
40 swi r24, r1, 84; \
41 swi r25, r1, 88; \
42 swi r26, r1, 92; \
43 swi r27, r1, 96; \
44 swi r28, r1, 100; \
45 swi r29, r1, 104; \
46 swi r30, r1, 108; \
47 swi r31, r1, 112;
48
49#define RESTORE_REGS \
50 lwi r2, r1, 4; \
51 lwi r3, r1, 8; \
52 lwi r4, r1, 12; \
53 lwi r5, r1, 116; \
54 lwi r6, r1, 16; \
55 lwi r7, r1, 20; \
56 lwi r8, r1, 24; \
57 lwi r9, r1, 28; \
58 lwi r10, r1, 32; \
59 lwi r11, r1, 36; \
60 lwi r12, r1, 40; \
61 lwi r13, r1, 44; \
62 lwi r14, r1, 48; \
63 lwi r16, r1, 52; \
64 lwi r17, r1, 56; \
65 lwi r18, r1, 60; \
66 lwi r19, r1, 64; \
67 lwi r20, r1, 68; \
68 lwi r21, r1, 72; \
69 lwi r22, r1, 76; \
70 lwi r23, r1, 80; \
71 lwi r24, r1, 84; \
72 lwi r25, r1, 88; \
73 lwi r26, r1, 92; \
74 lwi r27, r1, 96; \
75 lwi r28, r1, 100; \
76 lwi r29, r1, 104; \
77 lwi r30, r1, 108; \
78 lwi r31, r1, 112; \
79 addik r1, r1, 120;
80
81ENTRY(ftrace_stub)
82 rtsd r15, 8;
83 nop;
84
85ENTRY(_mcount)
86#ifdef CONFIG_DYNAMIC_FTRACE
87ENTRY(ftrace_caller)
88 /* MS: It is just barrier which is removed from C code */
89 rtsd r15, 8
90 nop
91#endif /* CONFIG_DYNAMIC_FTRACE */
92 SAVE_REGS
93 swi r15, r1, 0;
94 /* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST begin of checking */
95 lwi r5, r0, function_trace_stop;
96 bneid r5, end;
97 nop;
98 /* MS: HAVE_FUNCTION_TRACE_MCOUNT_TEST end of checking */
99#ifdef CONFIG_FUNCTION_GRAPH_TRACER
100#ifndef CONFIG_DYNAMIC_FTRACE
101 lwi r5, r0, ftrace_graph_return;
102 addik r6, r0, ftrace_stub; /* asm implementation */
103 cmpu r5, r5, r6; /* ftrace_graph_return != ftrace_stub */
104 beqid r5, end_graph_tracer;
105 nop;
106
107 lwi r6, r0, ftrace_graph_entry;
108 addik r5, r0, ftrace_graph_entry_stub; /* implemented in C */
109 cmpu r5, r5, r6; /* ftrace_graph_entry != ftrace_graph_entry_stub */
110 beqid r5, end_graph_tracer;
111 nop;
112#else /* CONFIG_DYNAMIC_FTRACE */
113NOALIGN_ENTRY(ftrace_call_graph)
114 /* MS: jump over graph function - replaced from C code */
115 bri end_graph_tracer
116#endif /* CONFIG_DYNAMIC_FTRACE */
117 addik r5, r1, 120; /* MS: load parent addr */
118 addik r6, r15, 0; /* MS: load current function addr */
119 bralid r15, prepare_ftrace_return;
120 nop;
121 /* MS: graph was taken that's why - can jump over function trace */
122 brid end;
123 nop;
124end_graph_tracer:
125#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
126#ifndef CONFIG_DYNAMIC_FTRACE
127 /* MS: test function trace if is taken or not */
128 lwi r20, r0, ftrace_trace_function;
129 addik r6, r0, ftrace_stub;
130 cmpu r5, r20, r6; /* ftrace_trace_function != ftrace_stub */
131 beqid r5, end; /* MS: not taken -> jump over */
132 nop;
133#else /* CONFIG_DYNAMIC_FTRACE */
134NOALIGN_ENTRY(ftrace_call)
135/* instruction for setup imm FUNC_part1, addik r20, r0, FUNC_part2 */
136 nop
137 nop
138#endif /* CONFIG_DYNAMIC_FTRACE */
139/* static normal trace */
140 lwi r6, r1, 120; /* MS: load parent addr */
141 addik r5, r15, 0; /* MS: load current function addr */
142 /* MS: here is dependency on previous code */
143 brald r15, r20; /* MS: jump to ftrace handler */
144 nop;
145end:
146 lwi r15, r1, 0;
147 RESTORE_REGS
148
149 rtsd r15, 8; /* MS: jump back */
150 nop;
151
152#ifdef CONFIG_FUNCTION_GRAPH_TRACER
153ENTRY(return_to_handler)
154 nop; /* MS: just barrier for rtsd r15, 8 */
155 nop;
156 SAVE_REGS
157 swi r15, r1, 0;
158
159 /* MS: find out returning address */
160 bralid r15, ftrace_return_to_handler;
161 nop;
162
163 /* MS: return value from ftrace_return_to_handler is my returning addr
164 * must be before restore regs because I have to restore r3 content */
165 addik r15, r3, 0;
166 RESTORE_REGS
167
168 rtsd r15, 8; /* MS: jump back */
169 nop;
170#endif /* CONFIG_FUNCTION_TRACER */
diff --git a/arch/microblaze/kernel/microblaze_ksyms.c b/arch/microblaze/kernel/microblaze_ksyms.c
index 59ff20e33e0c..bc4dcb7d3861 100644
--- a/arch/microblaze/kernel/microblaze_ksyms.c
+++ b/arch/microblaze/kernel/microblaze_ksyms.c
@@ -18,6 +18,7 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <asm/page.h> 19#include <asm/page.h>
20#include <asm/system.h> 20#include <asm/system.h>
21#include <linux/ftrace.h>
21#include <linux/uaccess.h> 22#include <linux/uaccess.h>
22 23
23/* 24/*
@@ -47,3 +48,7 @@ extern void __umodsi3(void);
47EXPORT_SYMBOL(__umodsi3); 48EXPORT_SYMBOL(__umodsi3);
48extern char *_ebss; 49extern char *_ebss;
49EXPORT_SYMBOL_GPL(_ebss); 50EXPORT_SYMBOL_GPL(_ebss);
51#ifdef CONFIG_FUNCTION_TRACER
52extern void _mcount(void);
53EXPORT_SYMBOL(_mcount);
54#endif
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index c592d475b3d8..812f1bf06c9e 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -15,6 +15,7 @@
15#include <linux/bitops.h> 15#include <linux/bitops.h>
16#include <asm/system.h> 16#include <asm/system.h>
17#include <asm/pgalloc.h> 17#include <asm/pgalloc.h>
18#include <asm/cacheflush.h>
18 19
19void show_regs(struct pt_regs *regs) 20void show_regs(struct pt_regs *regs)
20{ 21{
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
new file mode 100644
index 000000000000..a1721a33042e
--- /dev/null
+++ b/arch/microblaze/kernel/reset.c
@@ -0,0 +1,140 @@
1/*
2 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
3 * Copyright (C) 2009 PetaLogix
4 *
5 * This file is subject to the terms and conditions of the GNU General Public
6 * License. See the file "COPYING" in the main directory of this archive
7 * for more details.
8 */
9
10#include <linux/init.h>
11#include <linux/of_platform.h>
12#include <asm/prom.h>
13
14/* Trigger specific functions */
15#ifdef CONFIG_GPIOLIB
16
17#include <linux/of_gpio.h>
18
19static int handle; /* reset pin handle */
20static unsigned int reset_val;
21
22static int of_reset_gpio_handle(void)
23{
24 int ret; /* variable which stored handle reset gpio pin */
25 struct device_node *root; /* root node */
26 struct device_node *gpio; /* gpio node */
27 struct of_gpio_chip *of_gc = NULL;
28 enum of_gpio_flags flags ;
29 const void *gpio_spec;
30
31 /* find out root node */
32 root = of_find_node_by_path("/");
33
34 /* give me handle for gpio node to be possible allocate pin */
35 ret = of_parse_phandles_with_args(root, "hard-reset-gpios",
36 "#gpio-cells", 0, &gpio, &gpio_spec);
37 if (ret) {
38 pr_debug("%s: can't parse gpios property\n", __func__);
39 goto err0;
40 }
41
42 of_gc = gpio->data;
43 if (!of_gc) {
44 pr_debug("%s: gpio controller %s isn't registered\n",
45 root->full_name, gpio->full_name);
46 ret = -ENODEV;
47 goto err1;
48 }
49
50 ret = of_gc->xlate(of_gc, root, gpio_spec, &flags);
51 if (ret < 0)
52 goto err1;
53
54 ret += of_gc->gc.base;
55err1:
56 of_node_put(gpio);
57err0:
58 pr_debug("%s exited with status %d\n", __func__, ret);
59 return ret;
60}
61
62void of_platform_reset_gpio_probe(void)
63{
64 int ret;
65 handle = of_reset_gpio_handle();
66
67 if (!gpio_is_valid(handle)) {
68 printk(KERN_INFO "Skipping unavailable RESET gpio %d (%s)\n",
69 handle, "reset");
70 }
71
72 ret = gpio_request(handle, "reset");
73 if (ret < 0) {
74 printk(KERN_INFO "GPIO pin is already allocated\n");
75 return;
76 }
77
78 /* get current setup value */
79 reset_val = gpio_get_value(handle);
80 /* FIXME maybe worth to perform any action */
81 pr_debug("Reset: Gpio output state: 0x%x\n", reset_val);
82
83 /* Setup GPIO as output */
84 ret = gpio_direction_output(handle, 0);
85 if (ret < 0)
86 goto err;
87
88 /* Setup output direction */
89 gpio_set_value(handle, 0);
90
91 printk(KERN_INFO "RESET: Registered gpio device: %d, current val: %d\n",
92 handle, reset_val);
93 return;
94err:
95 gpio_free(handle);
96 return;
97}
98
99
100static void gpio_system_reset(void)
101{
102 gpio_set_value(handle, 1 - reset_val);
103}
104#else
105#define gpio_system_reset() do {} while (0)
106void of_platform_reset_gpio_probe(void)
107{
108 return;
109}
110#endif
111
112void machine_restart(char *cmd)
113{
114 printk(KERN_NOTICE "Machine restart...\n");
115 gpio_system_reset();
116 dump_stack();
117 while (1)
118 ;
119}
120
121void machine_shutdown(void)
122{
123 printk(KERN_NOTICE "Machine shutdown...\n");
124 while (1)
125 ;
126}
127
128void machine_halt(void)
129{
130 printk(KERN_NOTICE "Machine halt...\n");
131 while (1)
132 ;
133}
134
135void machine_power_off(void)
136{
137 printk(KERN_NOTICE "Machine power off...\n");
138 while (1)
139 ;
140}
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 8c1e0f4dcf18..5372b24ad049 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -52,13 +52,12 @@ void __init setup_arch(char **cmdline_p)
52 /* irq_early_init(); */ 52 /* irq_early_init(); */
53 setup_cpuinfo(); 53 setup_cpuinfo();
54 54
55 __invalidate_icache_all(); 55 microblaze_cache_init();
56 __enable_icache();
57 56
58 __invalidate_dcache_all(); 57 enable_dcache();
59 __enable_dcache();
60 58
61 panic_timeout = 120; 59 invalidate_icache();
60 enable_icache();
62 61
63 setup_memory(); 62 setup_memory();
64 63
@@ -131,6 +130,8 @@ void __init machine_early_init(const char *cmdline, unsigned int ram,
131 strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE); 130 strlcpy(cmd_line, cmdline, COMMAND_LINE_SIZE);
132#endif 131#endif
133 132
133 lockdep_init();
134
134/* initialize device tree for usage in early_printk */ 135/* initialize device tree for usage in early_printk */
135 early_init_devtree((void *)_fdt_start); 136 early_init_devtree((void *)_fdt_start);
136 137
@@ -186,32 +187,3 @@ static int microblaze_debugfs_init(void)
186} 187}
187arch_initcall(microblaze_debugfs_init); 188arch_initcall(microblaze_debugfs_init);
188#endif 189#endif
189
190void machine_restart(char *cmd)
191{
192 printk(KERN_NOTICE "Machine restart...\n");
193 dump_stack();
194 while (1)
195 ;
196}
197
198void machine_shutdown(void)
199{
200 printk(KERN_NOTICE "Machine shutdown...\n");
201 while (1)
202 ;
203}
204
205void machine_halt(void)
206{
207 printk(KERN_NOTICE "Machine halt...\n");
208 while (1)
209 ;
210}
211
212void machine_power_off(void)
213{
214 printk(KERN_NOTICE "Machine power off...\n");
215 while (1)
216 ;
217}
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c
index 1c80e4fc40ce..d8d3bb396cd6 100644
--- a/arch/microblaze/kernel/signal.c
+++ b/arch/microblaze/kernel/signal.c
@@ -44,7 +44,6 @@
44 44
45asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall); 45asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall);
46 46
47
48asmlinkage long 47asmlinkage long
49sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, 48sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
50 struct pt_regs *regs) 49 struct pt_regs *regs)
@@ -176,6 +175,11 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
176 struct rt_sigframe __user *frame; 175 struct rt_sigframe __user *frame;
177 int err = 0; 176 int err = 0;
178 int signal; 177 int signal;
178 unsigned long address = 0;
179#ifdef CONFIG_MMU
180 pmd_t *pmdp;
181 pte_t *ptep;
182#endif
179 183
180 frame = get_sigframe(ka, regs, sizeof(*frame)); 184 frame = get_sigframe(ka, regs, sizeof(*frame));
181 185
@@ -216,8 +220,29 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
216 Negative 8 offset because return is rtsd r15, 8 */ 220 Negative 8 offset because return is rtsd r15, 8 */
217 regs->r15 = ((unsigned long)frame->tramp)-8; 221 regs->r15 = ((unsigned long)frame->tramp)-8;
218 222
219 __invalidate_cache_sigtramp((unsigned long)frame->tramp); 223 address = ((unsigned long)frame->tramp);
220 224#ifdef CONFIG_MMU
225 pmdp = pmd_offset(pud_offset(
226 pgd_offset(current->mm, address),
227 address), address);
228
229 preempt_disable();
230 ptep = pte_offset_map(pmdp, address);
231 if (pte_present(*ptep)) {
232 address = (unsigned long) page_address(pte_page(*ptep));
233 /* MS: I need add offset in page */
234 address += ((unsigned long)frame->tramp) & ~PAGE_MASK;
235 /* MS address is virtual */
236 address = virt_to_phys(address);
237 invalidate_icache_range(address, address + 8);
238 flush_dcache_range(address, address + 8);
239 }
240 pte_unmap(ptep);
241 preempt_enable();
242#else
243 flush_icache_range(address, address + 8);
244 flush_dcache_range(address, address + 8);
245#endif
221 if (err) 246 if (err)
222 goto give_sigsegv; 247 goto give_sigsegv;
223 248
@@ -233,6 +258,10 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
233 258
234 set_fs(USER_DS); 259 set_fs(USER_DS);
235 260
261 /* the tracer may want to single-step inside the handler */
262 if (test_thread_flag(TIF_SINGLESTEP))
263 ptrace_notify(SIGTRAP);
264
236#ifdef DEBUG_SIG 265#ifdef DEBUG_SIG
237 printk(KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n", 266 printk(KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n",
238 current->comm, current->pid, frame, regs->pc); 267 current->comm, current->pid, frame, regs->pc);
diff --git a/arch/microblaze/kernel/stacktrace.c b/arch/microblaze/kernel/stacktrace.c
new file mode 100644
index 000000000000..123692f22647
--- /dev/null
+++ b/arch/microblaze/kernel/stacktrace.c
@@ -0,0 +1,65 @@
1/*
2 * Stack trace support for Microblaze.
3 *
4 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2009 PetaLogix
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/sched.h>
13#include <linux/stacktrace.h>
14#include <linux/thread_info.h>
15#include <linux/ptrace.h>
16#include <linux/module.h>
17
18/* FIXME initial support */
19void save_stack_trace(struct stack_trace *trace)
20{
21 unsigned long *sp;
22 unsigned long addr;
23 asm("addik %0, r1, 0" : "=r" (sp));
24
25 while (!kstack_end(sp)) {
26 addr = *sp++;
27 if (__kernel_text_address(addr)) {
28 if (trace->skip > 0)
29 trace->skip--;
30 else
31 trace->entries[trace->nr_entries++] = addr;
32
33 if (trace->nr_entries >= trace->max_entries)
34 break;
35 }
36 }
37}
38EXPORT_SYMBOL_GPL(save_stack_trace);
39
40void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
41{
42 unsigned int *sp;
43 unsigned long addr;
44
45 struct thread_info *ti = task_thread_info(tsk);
46
47 if (tsk == current)
48 asm("addik %0, r1, 0" : "=r" (sp));
49 else
50 sp = (unsigned int *)ti->cpu_context.r1;
51
52 while (!kstack_end(sp)) {
53 addr = *sp++;
54 if (__kernel_text_address(addr)) {
55 if (trace->skip > 0)
56 trace->skip--;
57 else
58 trace->entries[trace->nr_entries++] = addr;
59
60 if (trace->nr_entries >= trace->max_entries)
61 break;
62 }
63 }
64}
65EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
index 07cabed4b947..9f3c205fb75b 100644
--- a/arch/microblaze/kernel/sys_microblaze.c
+++ b/arch/microblaze/kernel/sys_microblaze.c
@@ -62,46 +62,14 @@ out:
62 return error; 62 return error;
63} 63}
64 64
65asmlinkage long
66sys_mmap2(unsigned long addr, unsigned long len,
67 unsigned long prot, unsigned long flags,
68 unsigned long fd, unsigned long pgoff)
69{
70 struct file *file = NULL;
71 int ret = -EBADF;
72
73 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
74 if (!(flags & MAP_ANONYMOUS)) {
75 file = fget(fd);
76 if (!file) {
77 printk(KERN_INFO "no fd in mmap\r\n");
78 goto out;
79 }
80 }
81
82 down_write(&current->mm->mmap_sem);
83 ret = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
84 up_write(&current->mm->mmap_sem);
85 if (file)
86 fput(file);
87out:
88 return ret;
89}
90
91asmlinkage long sys_mmap(unsigned long addr, unsigned long len, 65asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
92 unsigned long prot, unsigned long flags, 66 unsigned long prot, unsigned long flags,
93 unsigned long fd, off_t pgoff) 67 unsigned long fd, off_t pgoff)
94{ 68{
95 int err = -EINVAL; 69 if (pgoff & ~PAGE_MASK)
96 70 return -EINVAL;
97 if (pgoff & ~PAGE_MASK) {
98 printk(KERN_INFO "no pagemask in mmap\r\n");
99 goto out;
100 }
101 71
102 err = sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); 72 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
103out:
104 return err;
105} 73}
106 74
107/* 75/*
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
index c1ab1dc10898..4088be7d4e29 100644
--- a/arch/microblaze/kernel/syscall_table.S
+++ b/arch/microblaze/kernel/syscall_table.S
@@ -183,7 +183,7 @@ ENTRY(sys_call_table)
183 .long sys_rt_sigpending 183 .long sys_rt_sigpending
184 .long sys_rt_sigtimedwait 184 .long sys_rt_sigtimedwait
185 .long sys_rt_sigqueueinfo 185 .long sys_rt_sigqueueinfo
186 .long sys_rt_sigsuspend_wrapper 186 .long sys_rt_sigsuspend
187 .long sys_pread64 /* 180 */ 187 .long sys_pread64 /* 180 */
188 .long sys_pwrite64 188 .long sys_pwrite64
189 .long sys_chown 189 .long sys_chown
@@ -196,7 +196,7 @@ ENTRY(sys_call_table)
196 .long sys_ni_syscall /* reserved for streams2 */ 196 .long sys_ni_syscall /* reserved for streams2 */
197 .long sys_vfork /* 190 */ 197 .long sys_vfork /* 190 */
198 .long sys_getrlimit 198 .long sys_getrlimit
199 .long sys_mmap2 /* mmap2 */ 199 .long sys_mmap_pgoff /* mmap2 */
200 .long sys_truncate64 200 .long sys_truncate64
201 .long sys_ftruncate64 201 .long sys_ftruncate64
202 .long sys_stat64 /* 195 */ 202 .long sys_stat64 /* 195 */
@@ -303,7 +303,7 @@ ENTRY(sys_call_table)
303 .long sys_mkdirat 303 .long sys_mkdirat
304 .long sys_mknodat 304 .long sys_mknodat
305 .long sys_fchownat 305 .long sys_fchownat
306 .long sys_ni_syscall 306 .long sys_futimesat
307 .long sys_fstatat64 /* 300 */ 307 .long sys_fstatat64 /* 300 */
308 .long sys_unlinkat 308 .long sys_unlinkat
309 .long sys_renameat 309 .long sys_renameat
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index 5499deae7fa6..ed61b2f17719 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -183,6 +183,31 @@ static cycle_t microblaze_read(struct clocksource *cs)
183 return (cycle_t) (in_be32(TIMER_BASE + TCR1)); 183 return (cycle_t) (in_be32(TIMER_BASE + TCR1));
184} 184}
185 185
186static struct timecounter microblaze_tc = {
187 .cc = NULL,
188};
189
190static cycle_t microblaze_cc_read(const struct cyclecounter *cc)
191{
192 return microblaze_read(NULL);
193}
194
195static struct cyclecounter microblaze_cc = {
196 .read = microblaze_cc_read,
197 .mask = CLOCKSOURCE_MASK(32),
198 .shift = 24,
199};
200
201int __init init_microblaze_timecounter(void)
202{
203 microblaze_cc.mult = div_sc(cpuinfo.cpu_clock_freq, NSEC_PER_SEC,
204 microblaze_cc.shift);
205
206 timecounter_init(&microblaze_tc, &microblaze_cc, sched_clock());
207
208 return 0;
209}
210
186static struct clocksource clocksource_microblaze = { 211static struct clocksource clocksource_microblaze = {
187 .name = "microblaze_clocksource", 212 .name = "microblaze_clocksource",
188 .rating = 300, 213 .rating = 300,
@@ -204,6 +229,9 @@ static int __init microblaze_clocksource_init(void)
204 out_be32(TIMER_BASE + TCSR1, in_be32(TIMER_BASE + TCSR1) & ~TCSR_ENT); 229 out_be32(TIMER_BASE + TCSR1, in_be32(TIMER_BASE + TCSR1) & ~TCSR_ENT);
205 /* start timer1 - up counting without interrupt */ 230 /* start timer1 - up counting without interrupt */
206 out_be32(TIMER_BASE + TCSR1, TCSR_TINT|TCSR_ENT|TCSR_ARHT); 231 out_be32(TIMER_BASE + TCSR1, TCSR_TINT|TCSR_ENT|TCSR_ARHT);
232
233 /* register timecounter - for ftrace support */
234 init_microblaze_timecounter();
207 return 0; 235 return 0;
208} 236}
209 237
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
index e704188d7855..5ef619aad634 100644
--- a/arch/microblaze/kernel/vmlinux.lds.S
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -26,11 +26,12 @@ SECTIONS {
26 _stext = . ; 26 _stext = . ;
27 *(.text .text.*) 27 *(.text .text.*)
28 *(.fixup) 28 *(.fixup)
29 EXIT_TEXT 29 EXIT_TEXT
30 EXIT_CALL 30 EXIT_CALL
31 SCHED_TEXT 31 SCHED_TEXT
32 LOCK_TEXT 32 LOCK_TEXT
33 KPROBES_TEXT 33 KPROBES_TEXT
34 IRQENTRY_TEXT
34 . = ALIGN (4) ; 35 . = ALIGN (4) ;
35 _etext = . ; 36 _etext = . ;
36 } 37 }
@@ -86,6 +87,7 @@ SECTIONS {
86 _KERNEL_SDA_BASE_ = _ssro + (_ssro_size / 2) ; 87 _KERNEL_SDA_BASE_ = _ssro + (_ssro_size / 2) ;
87 } 88 }
88 89
90 . = ALIGN(PAGE_SIZE);
89 __init_begin = .; 91 __init_begin = .;
90 92
91 INIT_TEXT_SECTION(PAGE_SIZE) 93 INIT_TEXT_SECTION(PAGE_SIZE)
diff --git a/arch/microblaze/lib/uaccess.c b/arch/microblaze/lib/uaccess.c
index 8eb9df5a26c9..a853fe089c44 100644
--- a/arch/microblaze/lib/uaccess.c
+++ b/arch/microblaze/lib/uaccess.c
@@ -39,3 +39,10 @@ long strncpy_from_user(char *dst, const char __user *src, long count)
39 __do_strncpy_from_user(dst, src, count, res); 39 __do_strncpy_from_user(dst, src, count, res);
40 return res; 40 return res;
41} 41}
42
43unsigned long __copy_tofrom_user(void __user *to,
44 const void __user *from, unsigned long size)
45{
46 memcpy(to, from, size);
47 return 0;
48}
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index a44892e7cd5b..a57cedf36715 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -41,6 +41,7 @@ char *klimit = _end;
41 * have available. 41 * have available.
42 */ 42 */
43unsigned long memory_start; 43unsigned long memory_start;
44EXPORT_SYMBOL(memory_start);
44unsigned long memory_end; /* due to mm/nommu.c */ 45unsigned long memory_end; /* due to mm/nommu.c */
45unsigned long memory_size; 46unsigned long memory_size;
46 47
diff --git a/arch/microblaze/mm/pgtable.c b/arch/microblaze/mm/pgtable.c
index 46c4ca5d15c5..2820081b21ab 100644
--- a/arch/microblaze/mm/pgtable.c
+++ b/arch/microblaze/mm/pgtable.c
@@ -144,7 +144,6 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
144 pmd_t *pd; 144 pmd_t *pd;
145 pte_t *pg; 145 pte_t *pg;
146 int err = -ENOMEM; 146 int err = -ENOMEM;
147 /* spin_lock(&init_mm.page_table_lock); */
148 /* Use upper 10 bits of VA to index the first level map */ 147 /* Use upper 10 bits of VA to index the first level map */
149 pd = pmd_offset(pgd_offset_k(va), va); 148 pd = pmd_offset(pgd_offset_k(va), va);
150 /* Use middle 10 bits of VA to index the second-level map */ 149 /* Use middle 10 bits of VA to index the second-level map */
@@ -158,9 +157,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags)
158 if (mem_init_done) 157 if (mem_init_done)
159 flush_HPTE(0, va, pmd_val(*pd)); 158 flush_HPTE(0, va, pmd_val(*pd));
160 /* flush_HPTE(0, va, pg); */ 159 /* flush_HPTE(0, va, pg); */
161
162 } 160 }
163 /* spin_unlock(&init_mm.page_table_lock); */
164 return err; 161 return err;
165} 162}
166 163
@@ -182,12 +179,6 @@ void __init adjust_total_lowmem(void)
182#endif 179#endif
183} 180}
184 181
185static void show_tmem(unsigned long tmem)
186{
187 volatile unsigned long a;
188 a = a + tmem;
189}
190
191/* 182/*
192 * Map in all of physical memory starting at CONFIG_KERNEL_START. 183 * Map in all of physical memory starting at CONFIG_KERNEL_START.
193 */ 184 */
@@ -197,7 +188,6 @@ void __init mapin_ram(void)
197 188
198 v = CONFIG_KERNEL_START; 189 v = CONFIG_KERNEL_START;
199 p = memory_start; 190 p = memory_start;
200 show_tmem(memory_size);
201 for (s = 0; s < memory_size; s += PAGE_SIZE) { 191 for (s = 0; s < memory_size; s += PAGE_SIZE) {
202 f = _PAGE_PRESENT | _PAGE_ACCESSED | 192 f = _PAGE_PRESENT | _PAGE_ACCESSED |
203 _PAGE_SHARED | _PAGE_HWEXEC; 193 _PAGE_SHARED | _PAGE_HWEXEC;
diff --git a/arch/microblaze/oprofile/Makefile b/arch/microblaze/oprofile/Makefile
new file mode 100644
index 000000000000..0d0348c8af97
--- /dev/null
+++ b/arch/microblaze/oprofile/Makefile
@@ -0,0 +1,13 @@
1#
2# arch/microblaze/oprofile/Makefile
3#
4
5obj-$(CONFIG_OPROFILE) += oprofile.o
6
7DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \
8 oprof.o cpu_buffer.o buffer_sync.o \
9 event_buffer.o oprofile_files.o \
10 oprofilefs.o oprofile_stats.o \
11 timer_int.o )
12
13oprofile-y := $(DRIVER_OBJS) microblaze_oprofile.o
diff --git a/arch/microblaze/oprofile/microblaze_oprofile.c b/arch/microblaze/oprofile/microblaze_oprofile.c
new file mode 100644
index 000000000000..def17e59888e
--- /dev/null
+++ b/arch/microblaze/oprofile/microblaze_oprofile.c
@@ -0,0 +1,22 @@
1/*
2 * Microblaze oprofile code
3 *
4 * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
5 * Copyright (C) 2009 PetaLogix
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11
12#include <linux/oprofile.h>
13#include <linux/init.h>
14
15int __init oprofile_arch_init(struct oprofile_operations *ops)
16{
17 return -1;
18}
19
20void oprofile_arch_exit(void)
21{
22}
diff --git a/arch/microblaze/platform/Kconfig.platform b/arch/microblaze/platform/Kconfig.platform
index 8e9b4752d3ff..669c7eec293e 100644
--- a/arch/microblaze/platform/Kconfig.platform
+++ b/arch/microblaze/platform/Kconfig.platform
@@ -53,31 +53,12 @@ config OPT_LIB_FUNCTION
53 53
54config OPT_LIB_ASM 54config OPT_LIB_ASM
55 bool "Optimalized lib function ASM" 55 bool "Optimalized lib function ASM"
56 depends on OPT_LIB_FUNCTION 56 depends on OPT_LIB_FUNCTION && (XILINX_MICROBLAZE0_USE_BARREL = 1)
57 default n 57 default n
58 help 58 help
59 Allows turn on optimalized library function (memcpy and memmove). 59 Allows turn on optimalized library function (memcpy and memmove).
60 Function are written in asm code. 60 Function are written in asm code.
61 61
62# This is still a bit broken - disabling for now JW 20070504
63config ALLOW_EDIT_AUTO
64 bool "Permit Display/edit of Kconfig.auto platform settings"
65 default n
66 help
67 Allows the editing of auto-generated platform settings from
68 the Kconfig.auto file. Obviously this does not change the
69 underlying hardware, so be very careful if you go editing
70 these settings.
71
72 Also, if you enable this, and edit various Kconfig.auto
73 settings, YOUR CHANGES WILL BE LOST if you then disable it
74 again. You have been warned!
75
76 If unsure, say no.
77
78comment "Automatic platform settings from Kconfig.auto"
79 depends on ALLOW_EDIT_AUTO
80
81if PLATFORM_GENERIC=y 62if PLATFORM_GENERIC=y
82 source "arch/microblaze/platform/generic/Kconfig.auto" 63 source "arch/microblaze/platform/generic/Kconfig.auto"
83endif 64endif
diff --git a/arch/microblaze/platform/generic/Kconfig.auto b/arch/microblaze/platform/generic/Kconfig.auto
index fbca22d9c8b9..5d86fc19029d 100644
--- a/arch/microblaze/platform/generic/Kconfig.auto
+++ b/arch/microblaze/platform/generic/Kconfig.auto
@@ -21,7 +21,6 @@
21 21
22# Definitions for MICROBLAZE0 22# Definitions for MICROBLAZE0
23comment "Definitions for MICROBLAZE0" 23comment "Definitions for MICROBLAZE0"
24 depends on ALLOW_EDIT_AUTO
25 24
26config KERNEL_BASE_ADDR 25config KERNEL_BASE_ADDR
27 hex "Physical address where Linux Kernel is" 26 hex "Physical address where Linux Kernel is"
@@ -30,33 +29,33 @@ config KERNEL_BASE_ADDR
30 BASE Address for kernel 29 BASE Address for kernel
31 30
32config XILINX_MICROBLAZE0_FAMILY 31config XILINX_MICROBLAZE0_FAMILY
33 string "Targetted FPGA family" if ALLOW_EDIT_AUTO 32 string "Targetted FPGA family"
34 default "virtex5" 33 default "virtex5"
35 34
36config XILINX_MICROBLAZE0_USE_MSR_INSTR 35config XILINX_MICROBLAZE0_USE_MSR_INSTR
37 int "USE_MSR_INSTR range (0:1)" if ALLOW_EDIT_AUTO 36 int "USE_MSR_INSTR range (0:1)"
38 default 1 37 default 0
39 38
40config XILINX_MICROBLAZE0_USE_PCMP_INSTR 39config XILINX_MICROBLAZE0_USE_PCMP_INSTR
41 int "USE_PCMP_INSTR range (0:1)" if ALLOW_EDIT_AUTO 40 int "USE_PCMP_INSTR range (0:1)"
42 default 1 41 default 0
43 42
44config XILINX_MICROBLAZE0_USE_BARREL 43config XILINX_MICROBLAZE0_USE_BARREL
45 int "USE_BARREL range (0:1)" if ALLOW_EDIT_AUTO 44 int "USE_BARREL range (0:1)"
46 default 1 45 default 0
47 46
48config XILINX_MICROBLAZE0_USE_DIV 47config XILINX_MICROBLAZE0_USE_DIV
49 int "USE_DIV range (0:1)" if ALLOW_EDIT_AUTO 48 int "USE_DIV range (0:1)"
50 default 1 49 default 0
51 50
52config XILINX_MICROBLAZE0_USE_HW_MUL 51config XILINX_MICROBLAZE0_USE_HW_MUL
53 int "USE_HW_MUL values (0=NONE, 1=MUL32, 2=MUL64)" if ALLOW_EDIT_AUTO 52 int "USE_HW_MUL values (0=NONE, 1=MUL32, 2=MUL64)"
54 default 2 53 default 0
55 54
56config XILINX_MICROBLAZE0_USE_FPU 55config XILINX_MICROBLAZE0_USE_FPU
57 int "USE_FPU values (0=NONE, 1=BASIC, 2=EXTENDED)" if ALLOW_EDIT_AUTO 56 int "USE_FPU values (0=NONE, 1=BASIC, 2=EXTENDED)"
58 default 2 57 default 0
59 58
60config XILINX_MICROBLAZE0_HW_VER 59config XILINX_MICROBLAZE0_HW_VER
61 string "Core version number" if ALLOW_EDIT_AUTO 60 string "Core version number"
62 default 7.10.d 61 default 7.10.d
diff --git a/arch/microblaze/platform/generic/system.dts b/arch/microblaze/platform/generic/system.dts
index 29993f62b30a..2d5c41767cd0 100644
--- a/arch/microblaze/platform/generic/system.dts
+++ b/arch/microblaze/platform/generic/system.dts
@@ -32,11 +32,16 @@
32 #address-cells = <1>; 32 #address-cells = <1>;
33 #size-cells = <1>; 33 #size-cells = <1>;
34 compatible = "xlnx,microblaze"; 34 compatible = "xlnx,microblaze";
35 hard-reset-gpios = <&LEDs_8Bit 2 1>;
35 model = "testing"; 36 model = "testing";
36 DDR2_SDRAM: memory@90000000 { 37 DDR2_SDRAM: memory@90000000 {
37 device_type = "memory"; 38 device_type = "memory";
38 reg = < 0x90000000 0x10000000 >; 39 reg = < 0x90000000 0x10000000 >;
39 } ; 40 } ;
41 aliases {
42 ethernet0 = &Hard_Ethernet_MAC;
43 serial0 = &RS232_Uart_1;
44 } ;
40 chosen { 45 chosen {
41 bootargs = "console=ttyUL0,115200 highres=on"; 46 bootargs = "console=ttyUL0,115200 highres=on";
42 linux,stdout-path = "/plb@0/serial@84000000"; 47 linux,stdout-path = "/plb@0/serial@84000000";
@@ -127,7 +132,7 @@
127 mb_plb: plb@0 { 132 mb_plb: plb@0 {
128 #address-cells = <1>; 133 #address-cells = <1>;
129 #size-cells = <1>; 134 #size-cells = <1>;
130 compatible = "xlnx,plb-v46-1.03.a", "simple-bus"; 135 compatible = "xlnx,plb-v46-1.03.a", "xlnx,plb-v46-1.00.a", "simple-bus";
131 ranges ; 136 ranges ;
132 FLASH: flash@a0000000 { 137 FLASH: flash@a0000000 {
133 bank-width = <2>; 138 bank-width = <2>;
@@ -214,12 +219,12 @@
214 #size-cells = <1>; 219 #size-cells = <1>;
215 compatible = "xlnx,compound"; 220 compatible = "xlnx,compound";
216 ethernet@81c00000 { 221 ethernet@81c00000 {
217 compatible = "xlnx,xps-ll-temac-1.01.b"; 222 compatible = "xlnx,xps-ll-temac-1.01.b", "xlnx,xps-ll-temac-1.00.a";
218 device_type = "network"; 223 device_type = "network";
219 interrupt-parent = <&xps_intc_0>; 224 interrupt-parent = <&xps_intc_0>;
220 interrupts = < 5 2 >; 225 interrupts = < 5 2 >;
221 llink-connected = <&PIM3>; 226 llink-connected = <&PIM3>;
222 local-mac-address = [ 02 00 00 00 00 00 ]; 227 local-mac-address = [ 00 0a 35 00 00 00 ];
223 reg = < 0x81c00000 0x40 >; 228 reg = < 0x81c00000 0x40 >;
224 xlnx,bus2core-clk-ratio = <0x1>; 229 xlnx,bus2core-clk-ratio = <0x1>;
225 xlnx,phy-type = <0x1>; 230 xlnx,phy-type = <0x1>;
@@ -261,6 +266,33 @@
261 xlnx,is-dual = <0x0>; 266 xlnx,is-dual = <0x0>;
262 xlnx,tri-default = <0xffffffff>; 267 xlnx,tri-default = <0xffffffff>;
263 xlnx,tri-default-2 = <0xffffffff>; 268 xlnx,tri-default-2 = <0xffffffff>;
269 #gpio-cells = <2>;
270 gpio-controller;
271 } ;
272
273 gpio-leds {
274 compatible = "gpio-leds";
275
276 heartbeat {
277 label = "Heartbeat";
278 gpios = <&LEDs_8Bit 4 1>;
279 linux,default-trigger = "heartbeat";
280 };
281
282 yellow {
283 label = "Yellow";
284 gpios = <&LEDs_8Bit 5 1>;
285 };
286
287 red {
288 label = "Red";
289 gpios = <&LEDs_8Bit 6 1>;
290 };
291
292 green {
293 label = "Green";
294 gpios = <&LEDs_8Bit 7 1>;
295 };
264 } ; 296 } ;
265 RS232_Uart_1: serial@84000000 { 297 RS232_Uart_1: serial@84000000 {
266 clock-frequency = <125000000>; 298 clock-frequency = <125000000>;
diff --git a/arch/microblaze/platform/platform.c b/arch/microblaze/platform/platform.c
index 56e0234fa34b..5b89b58c5aed 100644
--- a/arch/microblaze/platform/platform.c
+++ b/arch/microblaze/platform/platform.c
@@ -13,6 +13,7 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/of_platform.h> 14#include <linux/of_platform.h>
15#include <asm/prom.h> 15#include <asm/prom.h>
16#include <asm/setup.h>
16 17
17static struct of_device_id xilinx_of_bus_ids[] __initdata = { 18static struct of_device_id xilinx_of_bus_ids[] __initdata = {
18 { .compatible = "simple-bus", }, 19 { .compatible = "simple-bus", },
@@ -26,6 +27,7 @@ static struct of_device_id xilinx_of_bus_ids[] __initdata = {
26static int __init microblaze_device_probe(void) 27static int __init microblaze_device_probe(void)
27{ 28{
28 of_platform_bus_probe(NULL, xilinx_of_bus_ids, NULL); 29 of_platform_bus_probe(NULL, xilinx_of_bus_ids, NULL);
30 of_platform_reset_gpio_probe();
29 return 0; 31 return 0;
30} 32}
31device_initcall(microblaze_device_probe); 33device_initcall(microblaze_device_probe);
diff --git a/arch/mips/include/asm/fcntl.h b/arch/mips/include/asm/fcntl.h
index 2a52333a062d..7c6681aa2ab8 100644
--- a/arch/mips/include/asm/fcntl.h
+++ b/arch/mips/include/asm/fcntl.h
@@ -10,7 +10,7 @@
10 10
11 11
12#define O_APPEND 0x0008 12#define O_APPEND 0x0008
13#define O_SYNC 0x0010 13#define O_DSYNC 0x0010 /* used to be O_SYNC, see below */
14#define O_NONBLOCK 0x0080 14#define O_NONBLOCK 0x0080
15#define O_CREAT 0x0100 /* not fcntl */ 15#define O_CREAT 0x0100 /* not fcntl */
16#define O_TRUNC 0x0200 /* not fcntl */ 16#define O_TRUNC 0x0200 /* not fcntl */
@@ -18,6 +18,21 @@
18#define O_NOCTTY 0x0800 /* not fcntl */ 18#define O_NOCTTY 0x0800 /* not fcntl */
19#define FASYNC 0x1000 /* fcntl, for BSD compatibility */ 19#define FASYNC 0x1000 /* fcntl, for BSD compatibility */
20#define O_LARGEFILE 0x2000 /* allow large file opens */ 20#define O_LARGEFILE 0x2000 /* allow large file opens */
21/*
22 * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using
23 * the O_SYNC flag. We continue to use the existing numerical value
24 * for O_DSYNC semantics now, but using the correct symbolic name for it.
25 * This new value is used to request true Posix O_SYNC semantics. It is
26 * defined in this strange way to make sure applications compiled against
27 * new headers get at least O_DSYNC semantics on older kernels.
28 *
29 * This has the nice side-effect that we can simply test for O_DSYNC
30 * wherever we do not care if O_DSYNC or O_SYNC is used.
31 *
32 * Note: __O_SYNC must never be used directly.
33 */
34#define __O_SYNC 0x4000
35#define O_SYNC (__O_SYNC|O_DSYNC)
21#define O_DIRECT 0x8000 /* direct disk access hint */ 36#define O_DIRECT 0x8000 /* direct disk access hint */
22 37
23#define F_GETLK 14 38#define F_GETLK 14
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index ad4e017ed2f3..80e2ba694bab 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -82,6 +82,7 @@ static int sp_stopping;
82#define MTSP_O_SHLOCK 0x0010 82#define MTSP_O_SHLOCK 0x0010
83#define MTSP_O_EXLOCK 0x0020 83#define MTSP_O_EXLOCK 0x0020
84#define MTSP_O_ASYNC 0x0040 84#define MTSP_O_ASYNC 0x0040
85/* XXX: check which of these is actually O_SYNC vs O_DSYNC */
85#define MTSP_O_FSYNC O_SYNC 86#define MTSP_O_FSYNC O_SYNC
86#define MTSP_O_NOFOLLOW 0x0100 87#define MTSP_O_NOFOLLOW 0x0100
87#define MTSP_O_SYNC 0x0080 88#define MTSP_O_SYNC 0x0080
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 1a2793efdc4e..f042563c924f 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -67,28 +67,13 @@ SYSCALL_DEFINE6(32_mmap2, unsigned long, addr, unsigned long, len,
67 unsigned long, prot, unsigned long, flags, unsigned long, fd, 67 unsigned long, prot, unsigned long, flags, unsigned long, fd,
68 unsigned long, pgoff) 68 unsigned long, pgoff)
69{ 69{
70 struct file * file = NULL;
71 unsigned long error; 70 unsigned long error;
72 71
73 error = -EINVAL; 72 error = -EINVAL;
74 if (pgoff & (~PAGE_MASK >> 12)) 73 if (pgoff & (~PAGE_MASK >> 12))
75 goto out; 74 goto out;
76 pgoff >>= PAGE_SHIFT-12; 75 error = sys_mmap_pgoff(addr, len, prot, flags, fd,
77 76 pgoff >> (PAGE_SHIFT-12));
78 if (!(flags & MAP_ANONYMOUS)) {
79 error = -EBADF;
80 file = fget(fd);
81 if (!file)
82 goto out;
83 }
84 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
85
86 down_write(&current->mm->mmap_sem);
87 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
88 up_write(&current->mm->mmap_sem);
89 if (file)
90 fput(file);
91
92out: 77out:
93 return error; 78 return error;
94} 79}
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index fe0d79805603..3f7f466190b4 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -93,7 +93,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
93 * We do not accept a shared mapping if it would violate 93 * We do not accept a shared mapping if it would violate
94 * cache aliasing constraints. 94 * cache aliasing constraints.
95 */ 95 */
96 if ((flags & MAP_SHARED) && (addr & shm_align_mask)) 96 if ((flags & MAP_SHARED) &&
97 ((addr - (pgoff << PAGE_SHIFT)) & shm_align_mask))
97 return -EINVAL; 98 return -EINVAL;
98 return addr; 99 return addr;
99 } 100 }
@@ -129,31 +130,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
129 } 130 }
130} 131}
131 132
132/* common code for old and new mmaps */
133static inline unsigned long
134do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
135 unsigned long flags, unsigned long fd, unsigned long pgoff)
136{
137 unsigned long error = -EBADF;
138 struct file * file = NULL;
139
140 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
141 if (!(flags & MAP_ANONYMOUS)) {
142 file = fget(fd);
143 if (!file)
144 goto out;
145 }
146
147 down_write(&current->mm->mmap_sem);
148 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
149 up_write(&current->mm->mmap_sem);
150
151 if (file)
152 fput(file);
153out:
154 return error;
155}
156
157SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len, 133SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
158 unsigned long, prot, unsigned long, flags, unsigned long, 134 unsigned long, prot, unsigned long, flags, unsigned long,
159 fd, off_t, offset) 135 fd, off_t, offset)
@@ -164,7 +140,7 @@ SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
164 if (offset & ~PAGE_MASK) 140 if (offset & ~PAGE_MASK)
165 goto out; 141 goto out;
166 142
167 result = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 143 result = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
168 144
169out: 145out:
170 return result; 146 return result;
@@ -177,7 +153,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
177 if (pgoff & (~PAGE_MASK >> 12)) 153 if (pgoff & (~PAGE_MASK >> 12))
178 return -EINVAL; 154 return -EINVAL;
179 155
180 return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12)); 156 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12));
181} 157}
182 158
183save_static_function(sys_fork); 159save_static_function(sys_fork);
diff --git a/arch/mips/loongson/common/mem.c b/arch/mips/loongson/common/mem.c
index 7c92f79b6480..e94ef158f980 100644
--- a/arch/mips/loongson/common/mem.c
+++ b/arch/mips/loongson/common/mem.c
@@ -26,7 +26,7 @@ void __init prom_init_memory(void)
26/* override of arch/mips/mm/cache.c: __uncached_access */ 26/* override of arch/mips/mm/cache.c: __uncached_access */
27int __uncached_access(struct file *file, unsigned long addr) 27int __uncached_access(struct file *file, unsigned long addr)
28{ 28{
29 if (file->f_flags & O_SYNC) 29 if (file->f_flags & O_DSYNC)
30 return 1; 30 return 1;
31 31
32 return addr >= __pa(high_memory) || 32 return addr >= __pa(high_memory) ||
diff --git a/arch/mips/mm/cache.c b/arch/mips/mm/cache.c
index 694d51f523d1..102b2dfa542a 100644
--- a/arch/mips/mm/cache.c
+++ b/arch/mips/mm/cache.c
@@ -194,7 +194,7 @@ void __devinit cpu_cache_init(void)
194 194
195int __weak __uncached_access(struct file *file, unsigned long addr) 195int __weak __uncached_access(struct file *file, unsigned long addr)
196{ 196{
197 if (file->f_flags & O_SYNC) 197 if (file->f_flags & O_DSYNC)
198 return 1; 198 return 1;
199 199
200 return addr >= __pa(high_memory); 200 return addr >= __pa(high_memory);
diff --git a/arch/mn10300/include/asm/mman.h b/arch/mn10300/include/asm/mman.h
index 8eebf89f5ab1..db5c53da73ce 100644
--- a/arch/mn10300/include/asm/mman.h
+++ b/arch/mn10300/include/asm/mman.h
@@ -1 +1,6 @@
1#include <asm-generic/mman.h> 1#include <asm-generic/mman.h>
2
3#define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */
4
5#define arch_mmap_check(addr, len, flags) \
6 (((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index a94e7ea3faa6..c9ee6c009d79 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -578,7 +578,7 @@ ENTRY(sys_call_table)
578 .long sys_ni_syscall /* reserved for streams2 */ 578 .long sys_ni_syscall /* reserved for streams2 */
579 .long sys_vfork /* 190 */ 579 .long sys_vfork /* 190 */
580 .long sys_getrlimit 580 .long sys_getrlimit
581 .long sys_mmap2 581 .long sys_mmap_pgoff
582 .long sys_truncate64 582 .long sys_truncate64
583 .long sys_ftruncate64 583 .long sys_ftruncate64
584 .long sys_stat64 /* 195 */ 584 .long sys_stat64 /* 195 */
diff --git a/arch/mn10300/kernel/kprobes.c b/arch/mn10300/kernel/kprobes.c
index dacafab00eb2..67e6389d625a 100644
--- a/arch/mn10300/kernel/kprobes.c
+++ b/arch/mn10300/kernel/kprobes.c
@@ -31,13 +31,13 @@ const int kretprobe_blacklist_size = ARRAY_SIZE(kretprobe_blacklist);
31#define KPROBE_HIT_ACTIVE 0x00000001 31#define KPROBE_HIT_ACTIVE 0x00000001
32#define KPROBE_HIT_SS 0x00000002 32#define KPROBE_HIT_SS 0x00000002
33 33
34static struct kprobe *current_kprobe; 34static struct kprobe *cur_kprobe;
35static unsigned long current_kprobe_orig_pc; 35static unsigned long cur_kprobe_orig_pc;
36static unsigned long current_kprobe_next_pc; 36static unsigned long cur_kprobe_next_pc;
37static int current_kprobe_ss_flags; 37static int cur_kprobe_ss_flags;
38static unsigned long kprobe_status; 38static unsigned long kprobe_status;
39static kprobe_opcode_t current_kprobe_ss_buf[MAX_INSN_SIZE + 2]; 39static kprobe_opcode_t cur_kprobe_ss_buf[MAX_INSN_SIZE + 2];
40static unsigned long current_kprobe_bp_addr; 40static unsigned long cur_kprobe_bp_addr;
41 41
42DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 42DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
43 43
@@ -399,26 +399,25 @@ void __kprobes prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
399{ 399{
400 unsigned long nextpc; 400 unsigned long nextpc;
401 401
402 current_kprobe_orig_pc = regs->pc; 402 cur_kprobe_orig_pc = regs->pc;
403 memcpy(current_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE); 403 memcpy(cur_kprobe_ss_buf, &p->ainsn.insn[0], MAX_INSN_SIZE);
404 regs->pc = (unsigned long) current_kprobe_ss_buf; 404 regs->pc = (unsigned long) cur_kprobe_ss_buf;
405 405
406 nextpc = find_nextpc(regs, &current_kprobe_ss_flags); 406 nextpc = find_nextpc(regs, &cur_kprobe_ss_flags);
407 if (current_kprobe_ss_flags & SINGLESTEP_PCREL) 407 if (cur_kprobe_ss_flags & SINGLESTEP_PCREL)
408 current_kprobe_next_pc = 408 cur_kprobe_next_pc = cur_kprobe_orig_pc + (nextpc - regs->pc);
409 current_kprobe_orig_pc + (nextpc - regs->pc);
410 else 409 else
411 current_kprobe_next_pc = nextpc; 410 cur_kprobe_next_pc = nextpc;
412 411
413 /* branching instructions need special handling */ 412 /* branching instructions need special handling */
414 if (current_kprobe_ss_flags & SINGLESTEP_BRANCH) 413 if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH)
415 nextpc = singlestep_branch_setup(regs); 414 nextpc = singlestep_branch_setup(regs);
416 415
417 current_kprobe_bp_addr = nextpc; 416 cur_kprobe_bp_addr = nextpc;
418 417
419 *(u8 *) nextpc = BREAKPOINT_INSTRUCTION; 418 *(u8 *) nextpc = BREAKPOINT_INSTRUCTION;
420 mn10300_dcache_flush_range2((unsigned) current_kprobe_ss_buf, 419 mn10300_dcache_flush_range2((unsigned) cur_kprobe_ss_buf,
421 sizeof(current_kprobe_ss_buf)); 420 sizeof(cur_kprobe_ss_buf));
422 mn10300_icache_inv(); 421 mn10300_icache_inv();
423} 422}
424 423
@@ -440,7 +439,7 @@ static inline int __kprobes kprobe_handler(struct pt_regs *regs)
440 disarm_kprobe(p, regs); 439 disarm_kprobe(p, regs);
441 ret = 1; 440 ret = 1;
442 } else { 441 } else {
443 p = current_kprobe; 442 p = cur_kprobe;
444 if (p->break_handler && p->break_handler(p, regs)) 443 if (p->break_handler && p->break_handler(p, regs))
445 goto ss_probe; 444 goto ss_probe;
446 } 445 }
@@ -464,7 +463,7 @@ static inline int __kprobes kprobe_handler(struct pt_regs *regs)
464 } 463 }
465 464
466 kprobe_status = KPROBE_HIT_ACTIVE; 465 kprobe_status = KPROBE_HIT_ACTIVE;
467 current_kprobe = p; 466 cur_kprobe = p;
468 if (p->pre_handler(p, regs)) { 467 if (p->pre_handler(p, regs)) {
469 /* handler has already set things up, so skip ss setup */ 468 /* handler has already set things up, so skip ss setup */
470 return 1; 469 return 1;
@@ -491,8 +490,8 @@ no_kprobe:
491static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs) 490static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
492{ 491{
493 /* we may need to fixup regs/stack after singlestepping a call insn */ 492 /* we may need to fixup regs/stack after singlestepping a call insn */
494 if (current_kprobe_ss_flags & SINGLESTEP_BRANCH) { 493 if (cur_kprobe_ss_flags & SINGLESTEP_BRANCH) {
495 regs->pc = current_kprobe_orig_pc; 494 regs->pc = cur_kprobe_orig_pc;
496 switch (p->ainsn.insn[0]) { 495 switch (p->ainsn.insn[0]) {
497 case 0xcd: /* CALL (d16,PC) */ 496 case 0xcd: /* CALL (d16,PC) */
498 *(unsigned *) regs->sp = regs->mdr = regs->pc + 5; 497 *(unsigned *) regs->sp = regs->mdr = regs->pc + 5;
@@ -523,8 +522,8 @@ static void __kprobes resume_execution(struct kprobe *p, struct pt_regs *regs)
523 } 522 }
524 } 523 }
525 524
526 regs->pc = current_kprobe_next_pc; 525 regs->pc = cur_kprobe_next_pc;
527 current_kprobe_bp_addr = 0; 526 cur_kprobe_bp_addr = 0;
528} 527}
529 528
530static inline int __kprobes post_kprobe_handler(struct pt_regs *regs) 529static inline int __kprobes post_kprobe_handler(struct pt_regs *regs)
@@ -532,10 +531,10 @@ static inline int __kprobes post_kprobe_handler(struct pt_regs *regs)
532 if (!kprobe_running()) 531 if (!kprobe_running())
533 return 0; 532 return 0;
534 533
535 if (current_kprobe->post_handler) 534 if (cur_kprobe->post_handler)
536 current_kprobe->post_handler(current_kprobe, regs, 0); 535 cur_kprobe->post_handler(cur_kprobe, regs, 0);
537 536
538 resume_execution(current_kprobe, regs); 537 resume_execution(cur_kprobe, regs);
539 reset_current_kprobe(); 538 reset_current_kprobe();
540 preempt_enable_no_resched(); 539 preempt_enable_no_resched();
541 return 1; 540 return 1;
@@ -545,12 +544,12 @@ static inline int __kprobes post_kprobe_handler(struct pt_regs *regs)
545static inline 544static inline
546int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr) 545int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
547{ 546{
548 if (current_kprobe->fault_handler && 547 if (cur_kprobe->fault_handler &&
549 current_kprobe->fault_handler(current_kprobe, regs, trapnr)) 548 cur_kprobe->fault_handler(cur_kprobe, regs, trapnr))
550 return 1; 549 return 1;
551 550
552 if (kprobe_status & KPROBE_HIT_SS) { 551 if (kprobe_status & KPROBE_HIT_SS) {
553 resume_execution(current_kprobe, regs); 552 resume_execution(cur_kprobe, regs);
554 reset_current_kprobe(); 553 reset_current_kprobe();
555 preempt_enable_no_resched(); 554 preempt_enable_no_resched();
556 } 555 }
@@ -567,7 +566,7 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
567 566
568 switch (val) { 567 switch (val) {
569 case DIE_BREAKPOINT: 568 case DIE_BREAKPOINT:
570 if (current_kprobe_bp_addr != args->regs->pc) { 569 if (cur_kprobe_bp_addr != args->regs->pc) {
571 if (kprobe_handler(args->regs)) 570 if (kprobe_handler(args->regs))
572 return NOTIFY_STOP; 571 return NOTIFY_STOP;
573 } else { 572 } else {
diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c
index 8ca5af00334c..17cc6ce04e84 100644
--- a/arch/mn10300/kernel/sys_mn10300.c
+++ b/arch/mn10300/kernel/sys_mn10300.c
@@ -23,47 +23,13 @@
23 23
24#include <asm/uaccess.h> 24#include <asm/uaccess.h>
25 25
26#define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */
27
28/*
29 * memory mapping syscall
30 */
31asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
32 unsigned long prot, unsigned long flags,
33 unsigned long fd, unsigned long pgoff)
34{
35 struct file *file = NULL;
36 long error = -EINVAL;
37
38 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
39
40 if (flags & MAP_FIXED && addr < MIN_MAP_ADDR)
41 goto out;
42
43 error = -EBADF;
44 if (!(flags & MAP_ANONYMOUS)) {
45 file = fget(fd);
46 if (!file)
47 goto out;
48 }
49
50 down_write(&current->mm->mmap_sem);
51 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
52 up_write(&current->mm->mmap_sem);
53
54 if (file)
55 fput(file);
56out:
57 return error;
58}
59
60asmlinkage long old_mmap(unsigned long addr, unsigned long len, 26asmlinkage long old_mmap(unsigned long addr, unsigned long len,
61 unsigned long prot, unsigned long flags, 27 unsigned long prot, unsigned long flags,
62 unsigned long fd, unsigned long offset) 28 unsigned long fd, unsigned long offset)
63{ 29{
64 if (offset & ~PAGE_MASK) 30 if (offset & ~PAGE_MASK)
65 return -EINVAL; 31 return -EINVAL;
66 return sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 32 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
67} 33}
68 34
69struct sel_arg_struct { 35struct sel_arg_struct {
diff --git a/arch/parisc/include/asm/fcntl.h b/arch/parisc/include/asm/fcntl.h
index 1e1c824764ee..f357fc693c89 100644
--- a/arch/parisc/include/asm/fcntl.h
+++ b/arch/parisc/include/asm/fcntl.h
@@ -1,14 +1,13 @@
1#ifndef _PARISC_FCNTL_H 1#ifndef _PARISC_FCNTL_H
2#define _PARISC_FCNTL_H 2#define _PARISC_FCNTL_H
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_APPEND 000000010 4#define O_APPEND 000000010
7#define O_BLKSEEK 000000100 /* HPUX only */ 5#define O_BLKSEEK 000000100 /* HPUX only */
8#define O_CREAT 000000400 /* not fcntl */ 6#define O_CREAT 000000400 /* not fcntl */
9#define O_EXCL 000002000 /* not fcntl */ 7#define O_EXCL 000002000 /* not fcntl */
10#define O_LARGEFILE 000004000 8#define O_LARGEFILE 000004000
11#define O_SYNC 000100000 9#define __O_SYNC 000100000
10#define O_SYNC (__O_SYNC|O_DSYNC)
12#define O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */ 11#define O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */
13#define O_NOCTTY 000400000 /* not fcntl */ 12#define O_NOCTTY 000400000 /* not fcntl */
14#define O_DSYNC 001000000 /* HPUX only */ 13#define O_DSYNC 001000000 /* HPUX only */
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 71b31957c8f1..9147391afb03 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -110,37 +110,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
110 return addr; 110 return addr;
111} 111}
112 112
113static unsigned long do_mmap2(unsigned long addr, unsigned long len,
114 unsigned long prot, unsigned long flags, unsigned long fd,
115 unsigned long pgoff)
116{
117 struct file * file = NULL;
118 unsigned long error = -EBADF;
119 if (!(flags & MAP_ANONYMOUS)) {
120 file = fget(fd);
121 if (!file)
122 goto out;
123 }
124
125 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
126
127 down_write(&current->mm->mmap_sem);
128 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
129 up_write(&current->mm->mmap_sem);
130
131 if (file != NULL)
132 fput(file);
133out:
134 return error;
135}
136
137asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 113asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
138 unsigned long prot, unsigned long flags, unsigned long fd, 114 unsigned long prot, unsigned long flags, unsigned long fd,
139 unsigned long pgoff) 115 unsigned long pgoff)
140{ 116{
141 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE 117 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
142 we have. */ 118 we have. */
143 return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12)); 119 return sys_mmap_pgoff(addr, len, prot, flags, fd,
120 pgoff >> (PAGE_SHIFT - 12));
144} 121}
145 122
146asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 123asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
@@ -148,7 +125,8 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
148 unsigned long offset) 125 unsigned long offset)
149{ 126{
150 if (!(offset & ~PAGE_MASK)) { 127 if (!(offset & ~PAGE_MASK)) {
151 return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 128 return sys_mmap_pgoff(addr, len, prot, flags, fd,
129 offset >> PAGE_SHIFT);
152 } else { 130 } else {
153 return -EINVAL; 131 return -EINVAL;
154 } 132 }
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2ba14e77296c..0df57466e783 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -56,6 +56,16 @@ config IRQ_PER_CPU
56 bool 56 bool
57 default y 57 default y
58 58
59config NR_IRQS
60 int "Number of virtual interrupt numbers"
61 range 32 512
62 default "512"
63 help
64 This defines the number of virtual interrupt numbers the kernel
65 can manage. Virtual interrupt numbers are what you see in
66 /proc/interrupts. If you configure your system to have too few,
67 drivers will fail to load or worse - handle with care.
68
59config STACKTRACE_SUPPORT 69config STACKTRACE_SUPPORT
60 bool 70 bool
61 default y 71 default y
@@ -199,24 +209,14 @@ config DEFAULT_UIMAGE
199config REDBOOT 209config REDBOOT
200 bool 210 bool
201 211
202config HIBERNATE_32
203 bool
204 depends on (PPC_PMAC && !SMP) || BROKEN
205 default y
206
207config HIBERNATE_64
208 bool
209 depends on BROKEN || (PPC_PMAC64 && EXPERIMENTAL)
210 default y
211
212config ARCH_HIBERNATION_POSSIBLE 212config ARCH_HIBERNATION_POSSIBLE
213 bool 213 bool
214 depends on (PPC64 && HIBERNATE_64) || (PPC32 && HIBERNATE_32)
215 default y 214 default y
216 215
217config ARCH_SUSPEND_POSSIBLE 216config ARCH_SUSPEND_POSSIBLE
218 def_bool y 217 def_bool y
219 depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx 218 depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \
219 PPC_85xx || PPC_86xx
220 220
221config PPC_DCR_NATIVE 221config PPC_DCR_NATIVE
222 bool 222 bool
@@ -320,6 +320,10 @@ config HOTPLUG_CPU
320 320
321 Say N if you are unsure. 321 Say N if you are unsure.
322 322
323config ARCH_CPU_PROBE_RELEASE
324 def_bool y
325 depends on HOTPLUG_CPU
326
323config ARCH_ENABLE_MEMORY_HOTPLUG 327config ARCH_ENABLE_MEMORY_HOTPLUG
324 def_bool y 328 def_bool y
325 329
@@ -378,6 +382,19 @@ config IRQ_ALL_CPUS
378 CPU. Generally saying Y is safe, although some problems have been 382 CPU. Generally saying Y is safe, although some problems have been
379 reported with SMP Power Macintoshes with this option enabled. 383 reported with SMP Power Macintoshes with this option enabled.
380 384
385config SPARSE_IRQ
386 bool "Support sparse irq numbering"
387 default y
388 help
389 This enables support for sparse irqs. This is useful for distro
390 kernels that want to define a high CONFIG_NR_CPUS value but still
391 want to have low kernel memory footprint on smaller machines.
392
393 ( Sparse IRQs can also be beneficial on NUMA boxes, as they spread
394 out the irq_desc[] array in a more NUMA-friendly way. )
395
396 If you don't know what to do here, say Y.
397
381config NUMA 398config NUMA
382 bool "NUMA support" 399 bool "NUMA support"
383 depends on PPC64 400 depends on PPC64
@@ -652,6 +669,14 @@ config FSL_PCI
652 select PPC_INDIRECT_PCI 669 select PPC_INDIRECT_PCI
653 select PCI_QUIRKS 670 select PCI_QUIRKS
654 671
672config FSL_PMC
673 bool
674 default y
675 depends on SUSPEND && (PPC_85xx || PPC_86xx)
676 help
677 Freescale MPC85xx/MPC86xx power management controller support
678 (suspend/resume). For MPC83xx see platforms/83xx/suspend.c
679
655config 4xx_SOC 680config 4xx_SOC
656 bool 681 bool
657 682
diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
index c920170b7dfe..cd56bb5b347b 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -352,6 +352,7 @@
352 max-frame-size = <9000>; 352 max-frame-size = <9000>;
353 rx-fifo-size = <4096>; 353 rx-fifo-size = <4096>;
354 tx-fifo-size = <2048>; 354 tx-fifo-size = <2048>;
355 rx-fifo-size-gige = <16384>;
355 phy-mode = "rgmii"; 356 phy-mode = "rgmii";
356 phy-map = <0x00000000>; 357 phy-map = <0x00000000>;
357 rgmii-device = <&RGMII0>; 358 rgmii-device = <&RGMII0>;
@@ -381,6 +382,7 @@
381 max-frame-size = <9000>; 382 max-frame-size = <9000>;
382 rx-fifo-size = <4096>; 383 rx-fifo-size = <4096>;
383 tx-fifo-size = <2048>; 384 tx-fifo-size = <2048>;
385 rx-fifo-size-gige = <16384>;
384 phy-mode = "rgmii"; 386 phy-mode = "rgmii";
385 phy-map = <0x00000000>; 387 phy-map = <0x00000000>;
386 rgmii-device = <&RGMII0>; 388 rgmii-device = <&RGMII0>;
diff --git a/arch/powerpc/boot/dts/eiger.dts b/arch/powerpc/boot/dts/eiger.dts
index c4a934f2e886..48bcf7187924 100644
--- a/arch/powerpc/boot/dts/eiger.dts
+++ b/arch/powerpc/boot/dts/eiger.dts
@@ -316,6 +316,7 @@
316 max-frame-size = <9000>; 316 max-frame-size = <9000>;
317 rx-fifo-size = <4096>; 317 rx-fifo-size = <4096>;
318 tx-fifo-size = <2048>; 318 tx-fifo-size = <2048>;
319 rx-fifo-size-gige = <16384>;
319 phy-mode = "rgmii"; 320 phy-mode = "rgmii";
320 phy-map = <0x00000000>; 321 phy-map = <0x00000000>;
321 rgmii-device = <&RGMII0>; 322 rgmii-device = <&RGMII0>;
@@ -345,6 +346,7 @@
345 max-frame-size = <9000>; 346 max-frame-size = <9000>;
346 rx-fifo-size = <4096>; 347 rx-fifo-size = <4096>;
347 tx-fifo-size = <2048>; 348 tx-fifo-size = <2048>;
349 rx-fifo-size-gige = <16384>;
348 phy-mode = "rgmii"; 350 phy-mode = "rgmii";
349 phy-map = <0x00000000>; 351 phy-map = <0x00000000>;
350 rgmii-device = <&RGMII0>; 352 rgmii-device = <&RGMII0>;
@@ -375,6 +377,8 @@
375 max-frame-size = <9000>; 377 max-frame-size = <9000>;
376 rx-fifo-size = <4096>; 378 rx-fifo-size = <4096>;
377 tx-fifo-size = <2048>; 379 tx-fifo-size = <2048>;
380 rx-fifo-size-gige = <16384>;
381 tx-fifo-size-gige = <16384>; /* emac2&3 only */
378 phy-mode = "rgmii"; 382 phy-mode = "rgmii";
379 phy-map = <0x00000000>; 383 phy-map = <0x00000000>;
380 rgmii-device = <&RGMII1>; 384 rgmii-device = <&RGMII1>;
@@ -403,6 +407,8 @@
403 max-frame-size = <9000>; 407 max-frame-size = <9000>;
404 rx-fifo-size = <4096>; 408 rx-fifo-size = <4096>;
405 tx-fifo-size = <2048>; 409 tx-fifo-size = <2048>;
410 rx-fifo-size-gige = <16384>;
411 tx-fifo-size-gige = <16384>; /* emac2&3 only */
406 phy-mode = "rgmii"; 412 phy-mode = "rgmii";
407 phy-map = <0x00000000>; 413 phy-map = <0x00000000>;
408 rgmii-device = <&RGMII1>; 414 rgmii-device = <&RGMII1>;
diff --git a/arch/powerpc/boot/dts/gef_ppc9a.dts b/arch/powerpc/boot/dts/gef_ppc9a.dts
index 910944edd886..c86114e93f1e 100644
--- a/arch/powerpc/boot/dts/gef_ppc9a.dts
+++ b/arch/powerpc/boot/dts/gef_ppc9a.dts
@@ -118,6 +118,12 @@
118 }; 118 };
119 }; 119 };
120 120
121 nvram@3,0 {
122 device_type = "nvram";
123 compatible = "simtek,stk14ca8";
124 reg = <0x3 0x0 0x20000>;
125 };
126
121 fpga@4,0 { 127 fpga@4,0 {
122 compatible = "gef,ppc9a-fpga-regs"; 128 compatible = "gef,ppc9a-fpga-regs";
123 reg = <0x4 0x0 0x40>; 129 reg = <0x4 0x0 0x40>;
diff --git a/arch/powerpc/boot/dts/gef_sbc310.dts b/arch/powerpc/boot/dts/gef_sbc310.dts
index 2107d3c7cfe1..820c2b355ab1 100644
--- a/arch/powerpc/boot/dts/gef_sbc310.dts
+++ b/arch/powerpc/boot/dts/gef_sbc310.dts
@@ -115,6 +115,12 @@
115 }; 115 };
116 }; 116 };
117 117
118 nvram@3,0 {
119 device_type = "nvram";
120 compatible = "simtek,stk14ca8";
121 reg = <0x3 0x0 0x20000>;
122 };
123
118 fpga@4,0 { 124 fpga@4,0 {
119 compatible = "gef,fpga-regs"; 125 compatible = "gef,fpga-regs";
120 reg = <0x4 0x0 0x40>; 126 reg = <0x4 0x0 0x40>;
diff --git a/arch/powerpc/boot/dts/gef_sbc610.dts b/arch/powerpc/boot/dts/gef_sbc610.dts
index 35a63183eecc..30911adefc8e 100644
--- a/arch/powerpc/boot/dts/gef_sbc610.dts
+++ b/arch/powerpc/boot/dts/gef_sbc610.dts
@@ -84,6 +84,12 @@
84 6 0 0xfd000000 0x00800000 // IO FPGA (8-bit) 84 6 0 0xfd000000 0x00800000 // IO FPGA (8-bit)
85 7 0 0xfd800000 0x00800000>; // IO FPGA (32-bit) 85 7 0 0xfd800000 0x00800000>; // IO FPGA (32-bit)
86 86
87 nvram@3,0 {
88 device_type = "nvram";
89 compatible = "simtek,stk14ca8";
90 reg = <0x3 0x0 0x20000>;
91 };
92
87 fpga@4,0 { 93 fpga@4,0 {
88 compatible = "gef,fpga-regs"; 94 compatible = "gef,fpga-regs";
89 reg = <0x4 0x0 0x40>; 95 reg = <0x4 0x0 0x40>;
diff --git a/arch/powerpc/boot/dts/glacier.dts b/arch/powerpc/boot/dts/glacier.dts
index f3787a27f634..f6f618939293 100644
--- a/arch/powerpc/boot/dts/glacier.dts
+++ b/arch/powerpc/boot/dts/glacier.dts
@@ -292,6 +292,7 @@
292 max-frame-size = <9000>; 292 max-frame-size = <9000>;
293 rx-fifo-size = <4096>; 293 rx-fifo-size = <4096>;
294 tx-fifo-size = <2048>; 294 tx-fifo-size = <2048>;
295 rx-fifo-size-gige = <16384>;
295 phy-mode = "rgmii"; 296 phy-mode = "rgmii";
296 phy-map = <0x00000000>; 297 phy-map = <0x00000000>;
297 rgmii-device = <&RGMII0>; 298 rgmii-device = <&RGMII0>;
@@ -321,6 +322,7 @@
321 max-frame-size = <9000>; 322 max-frame-size = <9000>;
322 rx-fifo-size = <4096>; 323 rx-fifo-size = <4096>;
323 tx-fifo-size = <2048>; 324 tx-fifo-size = <2048>;
325 rx-fifo-size-gige = <16384>;
324 phy-mode = "rgmii"; 326 phy-mode = "rgmii";
325 phy-map = <0x00000000>; 327 phy-map = <0x00000000>;
326 rgmii-device = <&RGMII0>; 328 rgmii-device = <&RGMII0>;
@@ -351,6 +353,8 @@
351 max-frame-size = <9000>; 353 max-frame-size = <9000>;
352 rx-fifo-size = <4096>; 354 rx-fifo-size = <4096>;
353 tx-fifo-size = <2048>; 355 tx-fifo-size = <2048>;
356 rx-fifo-size-gige = <16384>;
357 tx-fifo-size-gige = <16384>; /* emac2&3 only */
354 phy-mode = "rgmii"; 358 phy-mode = "rgmii";
355 phy-map = <0x00000000>; 359 phy-map = <0x00000000>;
356 rgmii-device = <&RGMII1>; 360 rgmii-device = <&RGMII1>;
@@ -379,6 +383,8 @@
379 max-frame-size = <9000>; 383 max-frame-size = <9000>;
380 rx-fifo-size = <4096>; 384 rx-fifo-size = <4096>;
381 tx-fifo-size = <2048>; 385 tx-fifo-size = <2048>;
386 rx-fifo-size-gige = <16384>;
387 tx-fifo-size-gige = <16384>; /* emac2&3 only */
382 phy-mode = "rgmii"; 388 phy-mode = "rgmii";
383 phy-map = <0x00000000>; 389 phy-map = <0x00000000>;
384 rgmii-device = <&RGMII1>; 390 rgmii-device = <&RGMII1>;
diff --git a/arch/powerpc/boot/dts/haleakala.dts b/arch/powerpc/boot/dts/haleakala.dts
index 5b2a4947bf82..2b256694eca6 100644
--- a/arch/powerpc/boot/dts/haleakala.dts
+++ b/arch/powerpc/boot/dts/haleakala.dts
@@ -226,6 +226,8 @@
226 max-frame-size = <9000>; 226 max-frame-size = <9000>;
227 rx-fifo-size = <4096>; 227 rx-fifo-size = <4096>;
228 tx-fifo-size = <2048>; 228 tx-fifo-size = <2048>;
229 rx-fifo-size-gige = <16384>;
230 tx-fifo-size-gige = <16384>;
229 phy-mode = "rgmii"; 231 phy-mode = "rgmii";
230 phy-map = <0x00000000>; 232 phy-map = <0x00000000>;
231 rgmii-device = <&RGMII0>; 233 rgmii-device = <&RGMII0>;
diff --git a/arch/powerpc/boot/dts/katmai.dts b/arch/powerpc/boot/dts/katmai.dts
index 077819bc3cbd..51eb6ed5da2d 100644
--- a/arch/powerpc/boot/dts/katmai.dts
+++ b/arch/powerpc/boot/dts/katmai.dts
@@ -16,7 +16,7 @@
16 16
17/ { 17/ {
18 #address-cells = <2>; 18 #address-cells = <2>;
19 #size-cells = <1>; 19 #size-cells = <2>;
20 model = "amcc,katmai"; 20 model = "amcc,katmai";
21 compatible = "amcc,katmai"; 21 compatible = "amcc,katmai";
22 dcr-parent = <&{/cpus/cpu@0}>; 22 dcr-parent = <&{/cpus/cpu@0}>;
@@ -49,7 +49,7 @@
49 49
50 memory { 50 memory {
51 device_type = "memory"; 51 device_type = "memory";
52 reg = <0x00000000 0x00000000 0x00000000>; /* Filled in by zImage */ 52 reg = <0x0 0x00000000 0x0 0x00000000>; /* Filled in by U-Boot */
53 }; 53 };
54 54
55 UIC0: interrupt-controller0 { 55 UIC0: interrupt-controller0 {
@@ -112,7 +112,15 @@
112 compatible = "ibm,plb-440spe", "ibm,plb-440gp", "ibm,plb4"; 112 compatible = "ibm,plb-440spe", "ibm,plb-440gp", "ibm,plb4";
113 #address-cells = <2>; 113 #address-cells = <2>;
114 #size-cells = <1>; 114 #size-cells = <1>;
115 ranges; 115 /* addr-child addr-parent size */
116 ranges = <0x4 0xe0000000 0x4 0xe0000000 0x20000000
117 0xc 0x00000000 0xc 0x00000000 0x20000000
118 0xd 0x00000000 0xd 0x00000000 0x80000000
119 0xd 0x80000000 0xd 0x80000000 0x80000000
120 0xe 0x00000000 0xe 0x00000000 0x80000000
121 0xe 0x80000000 0xe 0x80000000 0x80000000
122 0xf 0x00000000 0xf 0x00000000 0x80000000
123 0xf 0x80000000 0xf 0x80000000 0x80000000>;
116 clock-frequency = <0>; /* Filled in by zImage */ 124 clock-frequency = <0>; /* Filled in by zImage */
117 125
118 SDRAM0: sdram { 126 SDRAM0: sdram {
@@ -245,8 +253,8 @@
245 ranges = <0x02000000 0x00000000 0x80000000 0x0000000d 0x80000000 0x00000000 0x80000000 253 ranges = <0x02000000 0x00000000 0x80000000 0x0000000d 0x80000000 0x00000000 0x80000000
246 0x01000000 0x00000000 0x00000000 0x0000000c 0x08000000 0x00000000 0x00010000>; 254 0x01000000 0x00000000 0x00000000 0x0000000c 0x08000000 0x00000000 0x00010000>;
247 255
248 /* Inbound 2GB range starting at 0 */ 256 /* Inbound 4GB range starting at 0 */
249 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x80000000>; 257 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x1 0x00000000>;
250 258
251 /* This drives busses 0 to 0xf */ 259 /* This drives busses 0 to 0xf */
252 bus-range = <0x0 0xf>; 260 bus-range = <0x0 0xf>;
@@ -289,10 +297,10 @@
289 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x00000000 0x00000000 0x80000000 297 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x00000000 0x00000000 0x80000000
290 0x01000000 0x00000000 0x00000000 0x0000000f 0x80000000 0x00000000 0x00010000>; 298 0x01000000 0x00000000 0x00000000 0x0000000f 0x80000000 0x00000000 0x00010000>;
291 299
292 /* Inbound 2GB range starting at 0 */ 300 /* Inbound 4GB range starting at 0 */
293 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x80000000>; 301 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x1 0x00000000>;
294 302
295 /* This drives busses 10 to 0x1f */ 303 /* This drives busses 0x10 to 0x1f */
296 bus-range = <0x10 0x1f>; 304 bus-range = <0x10 0x1f>;
297 305
298 /* Legacy interrupts (note the weird polarity, the bridge seems 306 /* Legacy interrupts (note the weird polarity, the bridge seems
@@ -330,10 +338,10 @@
330 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x80000000 0x00000000 0x80000000 338 ranges = <0x02000000 0x00000000 0x80000000 0x0000000e 0x80000000 0x00000000 0x80000000
331 0x01000000 0x00000000 0x00000000 0x0000000f 0x80010000 0x00000000 0x00010000>; 339 0x01000000 0x00000000 0x00000000 0x0000000f 0x80010000 0x00000000 0x00010000>;
332 340
333 /* Inbound 2GB range starting at 0 */ 341 /* Inbound 4GB range starting at 0 */
334 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x80000000>; 342 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x1 0x00000000>;
335 343
336 /* This drives busses 10 to 0x1f */ 344 /* This drives busses 0x20 to 0x2f */
337 bus-range = <0x20 0x2f>; 345 bus-range = <0x20 0x2f>;
338 346
339 /* Legacy interrupts (note the weird polarity, the bridge seems 347 /* Legacy interrupts (note the weird polarity, the bridge seems
@@ -371,10 +379,10 @@
371 ranges = <0x02000000 0x00000000 0x80000000 0x0000000f 0x00000000 0x00000000 0x80000000 379 ranges = <0x02000000 0x00000000 0x80000000 0x0000000f 0x00000000 0x00000000 0x80000000
372 0x01000000 0x00000000 0x00000000 0x0000000f 0x80020000 0x00000000 0x00010000>; 380 0x01000000 0x00000000 0x00000000 0x0000000f 0x80020000 0x00000000 0x00010000>;
373 381
374 /* Inbound 2GB range starting at 0 */ 382 /* Inbound 4GB range starting at 0 */
375 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x80000000>; 383 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x1 0x00000000>;
376 384
377 /* This drives busses 10 to 0x1f */ 385 /* This drives busses 0x30 to 0x3f */
378 bus-range = <0x30 0x3f>; 386 bus-range = <0x30 0x3f>;
379 387
380 /* Legacy interrupts (note the weird polarity, the bridge seems 388 /* Legacy interrupts (note the weird polarity, the bridge seems
diff --git a/arch/powerpc/boot/dts/kilauea.dts b/arch/powerpc/boot/dts/kilauea.dts
index c46561456ede..083e68eeaca4 100644
--- a/arch/powerpc/boot/dts/kilauea.dts
+++ b/arch/powerpc/boot/dts/kilauea.dts
@@ -272,6 +272,8 @@
272 max-frame-size = <9000>; 272 max-frame-size = <9000>;
273 rx-fifo-size = <4096>; 273 rx-fifo-size = <4096>;
274 tx-fifo-size = <2048>; 274 tx-fifo-size = <2048>;
275 rx-fifo-size-gige = <16384>;
276 tx-fifo-size-gige = <16384>;
275 phy-mode = "rgmii"; 277 phy-mode = "rgmii";
276 phy-map = <0x00000000>; 278 phy-map = <0x00000000>;
277 rgmii-device = <&RGMII0>; 279 rgmii-device = <&RGMII0>;
@@ -300,6 +302,8 @@
300 max-frame-size = <9000>; 302 max-frame-size = <9000>;
301 rx-fifo-size = <4096>; 303 rx-fifo-size = <4096>;
302 tx-fifo-size = <2048>; 304 tx-fifo-size = <2048>;
305 rx-fifo-size-gige = <16384>;
306 tx-fifo-size-gige = <16384>;
303 phy-mode = "rgmii"; 307 phy-mode = "rgmii";
304 phy-map = <0x00000000>; 308 phy-map = <0x00000000>;
305 rgmii-device = <&RGMII0>; 309 rgmii-device = <&RGMII0>;
diff --git a/arch/powerpc/boot/dts/kmeter1.dts b/arch/powerpc/boot/dts/kmeter1.dts
index 167044f7de1d..65b8b4f27efe 100644
--- a/arch/powerpc/boot/dts/kmeter1.dts
+++ b/arch/powerpc/boot/dts/kmeter1.dts
@@ -59,6 +59,13 @@
59 reg = <0xe0000000 0x00000200>; 59 reg = <0xe0000000 0x00000200>;
60 bus-frequency = <0>; /* Filled in by U-Boot */ 60 bus-frequency = <0>; /* Filled in by U-Boot */
61 61
62 pmc: power@b00 {
63 compatible = "fsl,mpc8360-pmc", "fsl,mpc8349-pmc";
64 reg = <0xb00 0x100 0xa00 0x100>;
65 interrupts = <80 0x8>;
66 interrupt-parent = <&ipic>;
67 };
68
62 i2c@3000 { 69 i2c@3000 {
63 #address-cells = <1>; 70 #address-cells = <1>;
64 #size-cells = <0>; 71 #size-cells = <0>;
diff --git a/arch/powerpc/boot/dts/makalu.dts b/arch/powerpc/boot/dts/makalu.dts
index ffc246e72670..63d48b632c84 100644
--- a/arch/powerpc/boot/dts/makalu.dts
+++ b/arch/powerpc/boot/dts/makalu.dts
@@ -227,6 +227,8 @@
227 max-frame-size = <9000>; 227 max-frame-size = <9000>;
228 rx-fifo-size = <4096>; 228 rx-fifo-size = <4096>;
229 tx-fifo-size = <2048>; 229 tx-fifo-size = <2048>;
230 rx-fifo-size-gige = <16384>;
231 tx-fifo-size-gige = <16384>;
230 phy-mode = "rgmii"; 232 phy-mode = "rgmii";
231 phy-map = <0x0000003f>; /* Start at 6 */ 233 phy-map = <0x0000003f>; /* Start at 6 */
232 rgmii-device = <&RGMII0>; 234 rgmii-device = <&RGMII0>;
@@ -255,6 +257,8 @@
255 max-frame-size = <9000>; 257 max-frame-size = <9000>;
256 rx-fifo-size = <4096>; 258 rx-fifo-size = <4096>;
257 tx-fifo-size = <2048>; 259 tx-fifo-size = <2048>;
260 rx-fifo-size-gige = <16384>;
261 tx-fifo-size-gige = <16384>;
258 phy-mode = "rgmii"; 262 phy-mode = "rgmii";
259 phy-map = <0x00000000>; 263 phy-map = <0x00000000>;
260 rgmii-device = <&RGMII0>; 264 rgmii-device = <&RGMII0>;
diff --git a/arch/powerpc/boot/dts/mpc832x_mds.dts b/arch/powerpc/boot/dts/mpc832x_mds.dts
index 436c9c671dd9..05ad8c98e527 100644
--- a/arch/powerpc/boot/dts/mpc832x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc832x_mds.dts
@@ -79,6 +79,13 @@
79 reg = <0x200 0x100>; 79 reg = <0x200 0x100>;
80 }; 80 };
81 81
82 pmc: power@b00 {
83 compatible = "fsl,mpc8323-pmc", "fsl,mpc8349-pmc";
84 reg = <0xb00 0x100 0xa00 0x100>;
85 interrupts = <80 0x8>;
86 interrupt-parent = <&ipic>;
87 };
88
82 i2c@3000 { 89 i2c@3000 {
83 #address-cells = <1>; 90 #address-cells = <1>;
84 #size-cells = <0>; 91 #size-cells = <0>;
@@ -163,6 +170,7 @@
163 fsl,channel-fifo-len = <24>; 170 fsl,channel-fifo-len = <24>;
164 fsl,exec-units-mask = <0x4c>; 171 fsl,exec-units-mask = <0x4c>;
165 fsl,descriptor-types-mask = <0x0122003f>; 172 fsl,descriptor-types-mask = <0x0122003f>;
173 sleep = <&pmc 0x03000000>;
166 }; 174 };
167 175
168 ipic: pic@700 { 176 ipic: pic@700 {
@@ -428,5 +436,6 @@
428 0xe0008300 0x8>; /* config space access registers */ 436 0xe0008300 0x8>; /* config space access registers */
429 compatible = "fsl,mpc8349-pci"; 437 compatible = "fsl,mpc8349-pci";
430 device_type = "pci"; 438 device_type = "pci";
439 sleep = <&pmc 0x00010000>;
431 }; 440 };
432}; 441};
diff --git a/arch/powerpc/boot/dts/mpc832x_rdb.dts b/arch/powerpc/boot/dts/mpc832x_rdb.dts
index 9a0952f74b81..f4fadb23ad6f 100644
--- a/arch/powerpc/boot/dts/mpc832x_rdb.dts
+++ b/arch/powerpc/boot/dts/mpc832x_rdb.dts
@@ -62,6 +62,13 @@
62 reg = <0x200 0x100>; 62 reg = <0x200 0x100>;
63 }; 63 };
64 64
65 pmc: power@b00 {
66 compatible = "fsl,mpc8323-pmc", "fsl,mpc8349-pmc";
67 reg = <0xb00 0x100 0xa00 0x100>;
68 interrupts = <80 0x8>;
69 interrupt-parent = <&ipic>;
70 };
71
65 i2c@3000 { 72 i2c@3000 {
66 #address-cells = <1>; 73 #address-cells = <1>;
67 #size-cells = <0>; 74 #size-cells = <0>;
@@ -141,6 +148,7 @@
141 fsl,channel-fifo-len = <24>; 148 fsl,channel-fifo-len = <24>;
142 fsl,exec-units-mask = <0x4c>; 149 fsl,exec-units-mask = <0x4c>;
143 fsl,descriptor-types-mask = <0x0122003f>; 150 fsl,descriptor-types-mask = <0x0122003f>;
151 sleep = <&pmc 0x03000000>;
144 }; 152 };
145 153
146 ipic:pic@700 { 154 ipic:pic@700 {
@@ -360,5 +368,6 @@
360 0xe0008300 0x8>; /* config space access registers */ 368 0xe0008300 0x8>; /* config space access registers */
361 compatible = "fsl,mpc8349-pci"; 369 compatible = "fsl,mpc8349-pci";
362 device_type = "pci"; 370 device_type = "pci";
371 sleep = <&pmc 0x00010000>;
363 }; 372 };
364}; 373};
diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index 39ff4c829caf..45cfa1c50a2a 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -99,6 +99,13 @@
99 reg = <0x200 0x100>; 99 reg = <0x200 0x100>;
100 }; 100 };
101 101
102 pmc: power@b00 {
103 compatible = "fsl,mpc8360-pmc", "fsl,mpc8349-pmc";
104 reg = <0xb00 0x100 0xa00 0x100>;
105 interrupts = <80 0x8>;
106 interrupt-parent = <&ipic>;
107 };
108
102 i2c@3000 { 109 i2c@3000 {
103 #address-cells = <1>; 110 #address-cells = <1>;
104 #size-cells = <0>; 111 #size-cells = <0>;
@@ -194,6 +201,7 @@
194 fsl,channel-fifo-len = <24>; 201 fsl,channel-fifo-len = <24>;
195 fsl,exec-units-mask = <0x7e>; 202 fsl,exec-units-mask = <0x7e>;
196 fsl,descriptor-types-mask = <0x01010ebf>; 203 fsl,descriptor-types-mask = <0x01010ebf>;
204 sleep = <&pmc 0x03000000>;
197 }; 205 };
198 206
199 ipic: pic@700 { 207 ipic: pic@700 {
@@ -470,5 +478,6 @@
470 0xe0008300 0x8>; /* config space access registers */ 478 0xe0008300 0x8>; /* config space access registers */
471 compatible = "fsl,mpc8349-pci"; 479 compatible = "fsl,mpc8349-pci";
472 device_type = "pci"; 480 device_type = "pci";
481 sleep = <&pmc 0x00010000>;
473 }; 482 };
474}; 483};
diff --git a/arch/powerpc/boot/dts/mpc836x_rdk.dts b/arch/powerpc/boot/dts/mpc836x_rdk.dts
index 6315d6fcc58a..bdf4459677b1 100644
--- a/arch/powerpc/boot/dts/mpc836x_rdk.dts
+++ b/arch/powerpc/boot/dts/mpc836x_rdk.dts
@@ -71,6 +71,13 @@
71 reg = <0x200 0x100>; 71 reg = <0x200 0x100>;
72 }; 72 };
73 73
74 pmc: power@b00 {
75 compatible = "fsl,mpc8360-pmc", "fsl,mpc8349-pmc";
76 reg = <0xb00 0x100 0xa00 0x100>;
77 interrupts = <80 0x8>;
78 interrupt-parent = <&ipic>;
79 };
80
74 i2c@3000 { 81 i2c@3000 {
75 #address-cells = <1>; 82 #address-cells = <1>;
76 #size-cells = <0>; 83 #size-cells = <0>;
@@ -161,6 +168,7 @@
161 fsl,channel-fifo-len = <24>; 168 fsl,channel-fifo-len = <24>;
162 fsl,exec-units-mask = <0x7e>; 169 fsl,exec-units-mask = <0x7e>;
163 fsl,descriptor-types-mask = <0x01010ebf>; 170 fsl,descriptor-types-mask = <0x01010ebf>;
171 sleep = <&pmc 0x03000000>;
164 }; 172 };
165 173
166 ipic: interrupt-controller@700 { 174 ipic: interrupt-controller@700 {
@@ -455,6 +463,7 @@
455 0xa800 0 0 2 &ipic 20 8 463 0xa800 0 0 2 &ipic 20 8
456 0xa800 0 0 3 &ipic 21 8 464 0xa800 0 0 3 &ipic 21 8
457 0xa800 0 0 4 &ipic 18 8>; 465 0xa800 0 0 4 &ipic 18 8>;
466 sleep = <&pmc 0x00010000>;
458 /* filled by u-boot */ 467 /* filled by u-boot */
459 bus-range = <0 0>; 468 bus-range = <0 0>;
460 clock-frequency = <0>; 469 clock-frequency = <0>;
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 00c2bbda7013..6d892ba74e55 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -40,6 +40,8 @@
40 i-cache-line-size = <32>; // 32 bytes 40 i-cache-line-size = <32>; // 32 bytes
41 d-cache-size = <0x8000>; // L1, 32K 41 d-cache-size = <0x8000>; // L1, 32K
42 i-cache-size = <0x8000>; // L1, 32K 42 i-cache-size = <0x8000>; // L1, 32K
43 sleep = <&pmc 0x00008000 // core
44 &pmc 0x00004000>; // timebase
43 timebase-frequency = <0>; 45 timebase-frequency = <0>;
44 bus-frequency = <0>; 46 bus-frequency = <0>;
45 clock-frequency = <0>; 47 clock-frequency = <0>;
@@ -94,31 +96,41 @@
94 interrupts = <16 2>; 96 interrupts = <16 2>;
95 }; 97 };
96 98
97 i2c@3000 { 99 i2c-sleep-nexus {
98 #address-cells = <1>; 100 #address-cells = <1>;
99 #size-cells = <0>; 101 #size-cells = <1>;
100 cell-index = <0>; 102 compatible = "simple-bus";
101 compatible = "fsl-i2c"; 103 sleep = <&pmc 0x00000004>;
102 reg = <0x3000 0x100>; 104 ranges;
103 interrupts = <43 2>;
104 interrupt-parent = <&mpic>;
105 dfsrr;
106 105
107 rtc@68 { 106 i2c@3000 {
108 compatible = "dallas,ds1374"; 107 #address-cells = <1>;
109 reg = <0x68>; 108 #size-cells = <0>;
109 cell-index = <0>;
110 compatible = "fsl-i2c";
111 reg = <0x3000 0x100>;
112 interrupts = <43 2>;
113 interrupt-parent = <&mpic>;
114 dfsrr;
115
116 rtc@68 {
117 compatible = "dallas,ds1374";
118 reg = <0x68>;
119 interrupts = <3 1>;
120 interrupt-parent = <&mpic>;
121 };
110 }; 122 };
111 };
112 123
113 i2c@3100 { 124 i2c@3100 {
114 #address-cells = <1>; 125 #address-cells = <1>;
115 #size-cells = <0>; 126 #size-cells = <0>;
116 cell-index = <1>; 127 cell-index = <1>;
117 compatible = "fsl-i2c"; 128 compatible = "fsl-i2c";
118 reg = <0x3100 0x100>; 129 reg = <0x3100 0x100>;
119 interrupts = <43 2>; 130 interrupts = <43 2>;
120 interrupt-parent = <&mpic>; 131 interrupt-parent = <&mpic>;
121 dfsrr; 132 dfsrr;
133 };
122 }; 134 };
123 135
124 dma@21300 { 136 dma@21300 {
@@ -128,6 +140,8 @@
128 reg = <0x21300 0x4>; 140 reg = <0x21300 0x4>;
129 ranges = <0x0 0x21100 0x200>; 141 ranges = <0x0 0x21100 0x200>;
130 cell-index = <0>; 142 cell-index = <0>;
143 sleep = <&pmc 0x00000400>;
144
131 dma-channel@0 { 145 dma-channel@0 {
132 compatible = "fsl,mpc8568-dma-channel", 146 compatible = "fsl,mpc8568-dma-channel",
133 "fsl,eloplus-dma-channel"; 147 "fsl,eloplus-dma-channel";
@@ -176,6 +190,7 @@
176 interrupt-parent = <&mpic>; 190 interrupt-parent = <&mpic>;
177 tbi-handle = <&tbi0>; 191 tbi-handle = <&tbi0>;
178 phy-handle = <&phy2>; 192 phy-handle = <&phy2>;
193 sleep = <&pmc 0x00000080>;
179 194
180 mdio@520 { 195 mdio@520 {
181 #address-cells = <1>; 196 #address-cells = <1>;
@@ -228,6 +243,7 @@
228 interrupt-parent = <&mpic>; 243 interrupt-parent = <&mpic>;
229 tbi-handle = <&tbi1>; 244 tbi-handle = <&tbi1>;
230 phy-handle = <&phy3>; 245 phy-handle = <&phy3>;
246 sleep = <&pmc 0x00000040>;
231 247
232 mdio@520 { 248 mdio@520 {
233 #address-cells = <1>; 249 #address-cells = <1>;
@@ -242,30 +258,47 @@
242 }; 258 };
243 }; 259 };
244 260
245 serial0: serial@4500 { 261 duart-sleep-nexus {
246 cell-index = <0>; 262 #address-cells = <1>;
247 device_type = "serial"; 263 #size-cells = <1>;
248 compatible = "ns16550"; 264 compatible = "simple-bus";
249 reg = <0x4500 0x100>; 265 sleep = <&pmc 0x00000002>;
250 clock-frequency = <0>; 266 ranges;
251 interrupts = <42 2>; 267
252 interrupt-parent = <&mpic>; 268 serial0: serial@4500 {
269 cell-index = <0>;
270 device_type = "serial";
271 compatible = "ns16550";
272 reg = <0x4500 0x100>;
273 clock-frequency = <0>;
274 interrupts = <42 2>;
275 interrupt-parent = <&mpic>;
276 };
277
278 serial1: serial@4600 {
279 cell-index = <1>;
280 device_type = "serial";
281 compatible = "ns16550";
282 reg = <0x4600 0x100>;
283 clock-frequency = <0>;
284 interrupts = <42 2>;
285 interrupt-parent = <&mpic>;
286 };
253 }; 287 };
254 288
255 global-utilities@e0000 { //global utilities block 289 global-utilities@e0000 {
256 compatible = "fsl,mpc8548-guts"; 290 #address-cells = <1>;
291 #size-cells = <1>;
292 compatible = "fsl,mpc8568-guts", "fsl,mpc8548-guts";
257 reg = <0xe0000 0x1000>; 293 reg = <0xe0000 0x1000>;
294 ranges = <0 0xe0000 0x1000>;
258 fsl,has-rstcr; 295 fsl,has-rstcr;
259 };
260 296
261 serial1: serial@4600 { 297 pmc: power@70 {
262 cell-index = <1>; 298 compatible = "fsl,mpc8568-pmc",
263 device_type = "serial"; 299 "fsl,mpc8548-pmc";
264 compatible = "ns16550"; 300 reg = <0x70 0x20>;
265 reg = <0x4600 0x100>; 301 };
266 clock-frequency = <0>;
267 interrupts = <42 2>;
268 interrupt-parent = <&mpic>;
269 }; 302 };
270 303
271 crypto@30000 { 304 crypto@30000 {
@@ -277,6 +310,7 @@
277 fsl,channel-fifo-len = <24>; 310 fsl,channel-fifo-len = <24>;
278 fsl,exec-units-mask = <0xfe>; 311 fsl,exec-units-mask = <0xfe>;
279 fsl,descriptor-types-mask = <0x12b0ebf>; 312 fsl,descriptor-types-mask = <0x12b0ebf>;
313 sleep = <&pmc 0x01000000>;
280 }; 314 };
281 315
282 mpic: pic@40000 { 316 mpic: pic@40000 {
@@ -376,6 +410,7 @@
376 compatible = "fsl,qe"; 410 compatible = "fsl,qe";
377 ranges = <0x0 0xe0080000 0x40000>; 411 ranges = <0x0 0xe0080000 0x40000>;
378 reg = <0xe0080000 0x480>; 412 reg = <0xe0080000 0x480>;
413 sleep = <&pmc 0x00000800>;
379 brg-frequency = <0>; 414 brg-frequency = <0>;
380 bus-frequency = <396000000>; 415 bus-frequency = <396000000>;
381 fsl,qe-num-riscs = <2>; 416 fsl,qe-num-riscs = <2>;
@@ -509,6 +544,7 @@
509 bus-range = <0 255>; 544 bus-range = <0 255>;
510 ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000 545 ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000
511 0x1000000 0x0 0x0 0xe2000000 0x0 0x800000>; 546 0x1000000 0x0 0x0 0xe2000000 0x0 0x800000>;
547 sleep = <&pmc 0x80000000>;
512 clock-frequency = <66666666>; 548 clock-frequency = <66666666>;
513 #interrupt-cells = <1>; 549 #interrupt-cells = <1>;
514 #size-cells = <2>; 550 #size-cells = <2>;
@@ -534,6 +570,7 @@
534 bus-range = <0 255>; 570 bus-range = <0 255>;
535 ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000 571 ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000
536 0x1000000 0x0 0x0 0xe2800000 0x0 0x800000>; 572 0x1000000 0x0 0x0 0xe2800000 0x0 0x800000>;
573 sleep = <&pmc 0x20000000>;
537 clock-frequency = <33333333>; 574 clock-frequency = <33333333>;
538 #interrupt-cells = <1>; 575 #interrupt-cells = <1>;
539 #size-cells = <2>; 576 #size-cells = <2>;
@@ -570,5 +607,7 @@
570 55 2 /* msg2_tx */ 607 55 2 /* msg2_tx */
571 56 2 /* msg2_rx */>; 608 56 2 /* msg2_rx */>;
572 interrupt-parent = <&mpic>; 609 interrupt-parent = <&mpic>;
610 sleep = <&pmc 0x00080000 /* controller */
611 &pmc 0x00040000>; /* message unit */
573 }; 612 };
574}; 613};
diff --git a/arch/powerpc/boot/dts/mpc8569mds.dts b/arch/powerpc/boot/dts/mpc8569mds.dts
index 1e3ec8f059bf..795eb362fcf9 100644
--- a/arch/powerpc/boot/dts/mpc8569mds.dts
+++ b/arch/powerpc/boot/dts/mpc8569mds.dts
@@ -41,6 +41,8 @@
41 i-cache-line-size = <32>; // 32 bytes 41 i-cache-line-size = <32>; // 32 bytes
42 d-cache-size = <0x8000>; // L1, 32K 42 d-cache-size = <0x8000>; // L1, 32K
43 i-cache-size = <0x8000>; // L1, 32K 43 i-cache-size = <0x8000>; // L1, 32K
44 sleep = <&pmc 0x00008000 // core
45 &pmc 0x00004000>; // timebase
44 timebase-frequency = <0>; 46 timebase-frequency = <0>;
45 bus-frequency = <0>; 47 bus-frequency = <0>;
46 clock-frequency = <0>; 48 clock-frequency = <0>;
@@ -59,6 +61,7 @@
59 reg = <0xe0005000 0x1000>; 61 reg = <0xe0005000 0x1000>;
60 interrupts = <19 2>; 62 interrupts = <19 2>;
61 interrupt-parent = <&mpic>; 63 interrupt-parent = <&mpic>;
64 sleep = <&pmc 0x08000000>;
62 65
63 ranges = <0x0 0x0 0xfe000000 0x02000000 66 ranges = <0x0 0x0 0xfe000000 0x02000000
64 0x1 0x0 0xf8000000 0x00008000 67 0x1 0x0 0xf8000000 0x00008000
@@ -158,51 +161,69 @@
158 interrupts = <18 2>; 161 interrupts = <18 2>;
159 }; 162 };
160 163
161 i2c@3000 { 164 i2c-sleep-nexus {
162 #address-cells = <1>; 165 #address-cells = <1>;
163 #size-cells = <0>; 166 #size-cells = <1>;
164 cell-index = <0>; 167 compatible = "simple-bus";
165 compatible = "fsl-i2c"; 168 sleep = <&pmc 0x00000004>;
166 reg = <0x3000 0x100>; 169 ranges;
167 interrupts = <43 2>; 170
168 interrupt-parent = <&mpic>; 171 i2c@3000 {
169 dfsrr; 172 #address-cells = <1>;
173 #size-cells = <0>;
174 cell-index = <0>;
175 compatible = "fsl-i2c";
176 reg = <0x3000 0x100>;
177 interrupts = <43 2>;
178 interrupt-parent = <&mpic>;
179 dfsrr;
180
181 rtc@68 {
182 compatible = "dallas,ds1374";
183 reg = <0x68>;
184 interrupts = <3 1>;
185 interrupt-parent = <&mpic>;
186 };
187 };
170 188
171 rtc@68 { 189 i2c@3100 {
172 compatible = "dallas,ds1374"; 190 #address-cells = <1>;
173 reg = <0x68>; 191 #size-cells = <0>;
192 cell-index = <1>;
193 compatible = "fsl-i2c";
194 reg = <0x3100 0x100>;
195 interrupts = <43 2>;
196 interrupt-parent = <&mpic>;
197 dfsrr;
174 }; 198 };
175 }; 199 };
176 200
177 i2c@3100 { 201 duart-sleep-nexus {
178 #address-cells = <1>; 202 #address-cells = <1>;
179 #size-cells = <0>; 203 #size-cells = <1>;
180 cell-index = <1>; 204 compatible = "simple-bus";
181 compatible = "fsl-i2c"; 205 sleep = <&pmc 0x00000002>;
182 reg = <0x3100 0x100>; 206 ranges;
183 interrupts = <43 2>;
184 interrupt-parent = <&mpic>;
185 dfsrr;
186 };
187 207
188 serial0: serial@4500 { 208 serial0: serial@4500 {
189 cell-index = <0>; 209 cell-index = <0>;
190 device_type = "serial"; 210 device_type = "serial";
191 compatible = "ns16550"; 211 compatible = "ns16550";
192 reg = <0x4500 0x100>; 212 reg = <0x4500 0x100>;
193 clock-frequency = <0>; 213 clock-frequency = <0>;
194 interrupts = <42 2>; 214 interrupts = <42 2>;
195 interrupt-parent = <&mpic>; 215 interrupt-parent = <&mpic>;
196 }; 216 };
197 217
198 serial1: serial@4600 { 218 serial1: serial@4600 {
199 cell-index = <1>; 219 cell-index = <1>;
200 device_type = "serial"; 220 device_type = "serial";
201 compatible = "ns16550"; 221 compatible = "ns16550";
202 reg = <0x4600 0x100>; 222 reg = <0x4600 0x100>;
203 clock-frequency = <0>; 223 clock-frequency = <0>;
204 interrupts = <42 2>; 224 interrupts = <42 2>;
205 interrupt-parent = <&mpic>; 225 interrupt-parent = <&mpic>;
226 };
206 }; 227 };
207 228
208 L2: l2-cache-controller@20000 { 229 L2: l2-cache-controller@20000 {
@@ -260,6 +281,7 @@
260 reg = <0x2e000 0x1000>; 281 reg = <0x2e000 0x1000>;
261 interrupts = <72 0x8>; 282 interrupts = <72 0x8>;
262 interrupt-parent = <&mpic>; 283 interrupt-parent = <&mpic>;
284 sleep = <&pmc 0x00200000>;
263 /* Filled in by U-Boot */ 285 /* Filled in by U-Boot */
264 clock-frequency = <0>; 286 clock-frequency = <0>;
265 status = "disabled"; 287 status = "disabled";
@@ -276,6 +298,7 @@
276 fsl,channel-fifo-len = <24>; 298 fsl,channel-fifo-len = <24>;
277 fsl,exec-units-mask = <0xbfe>; 299 fsl,exec-units-mask = <0xbfe>;
278 fsl,descriptor-types-mask = <0x3ab0ebf>; 300 fsl,descriptor-types-mask = <0x3ab0ebf>;
301 sleep = <&pmc 0x01000000>;
279 }; 302 };
280 303
281 mpic: pic@40000 { 304 mpic: pic@40000 {
@@ -304,9 +327,18 @@
304 }; 327 };
305 328
306 global-utilities@e0000 { 329 global-utilities@e0000 {
307 compatible = "fsl,mpc8569-guts"; 330 #address-cells = <1>;
331 #size-cells = <1>;
332 compatible = "fsl,mpc8569-guts", "fsl,mpc8548-guts";
308 reg = <0xe0000 0x1000>; 333 reg = <0xe0000 0x1000>;
334 ranges = <0 0xe0000 0x1000>;
309 fsl,has-rstcr; 335 fsl,has-rstcr;
336
337 pmc: power@70 {
338 compatible = "fsl,mpc8569-pmc",
339 "fsl,mpc8548-pmc";
340 reg = <0x70 0x20>;
341 };
310 }; 342 };
311 343
312 par_io@e0100 { 344 par_io@e0100 {
@@ -422,6 +454,7 @@
422 compatible = "fsl,qe"; 454 compatible = "fsl,qe";
423 ranges = <0x0 0xe0080000 0x40000>; 455 ranges = <0x0 0xe0080000 0x40000>;
424 reg = <0xe0080000 0x480>; 456 reg = <0xe0080000 0x480>;
457 sleep = <&pmc 0x00000800>;
425 brg-frequency = <0>; 458 brg-frequency = <0>;
426 bus-frequency = <0>; 459 bus-frequency = <0>;
427 fsl,qe-num-riscs = <4>; 460 fsl,qe-num-riscs = <4>;
@@ -684,6 +717,7 @@
684 bus-range = <0 255>; 717 bus-range = <0 255>;
685 ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000 718 ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000
686 0x1000000 0x0 0x00000000 0xe2800000 0x0 0x00800000>; 719 0x1000000 0x0 0x00000000 0xe2800000 0x0 0x00800000>;
720 sleep = <&pmc 0x20000000>;
687 clock-frequency = <33333333>; 721 clock-frequency = <33333333>;
688 pcie@0 { 722 pcie@0 {
689 reg = <0x0 0x0 0x0 0x0 0x0>; 723 reg = <0x0 0x0 0x0 0x0 0x0>;
@@ -714,5 +748,6 @@
714 55 2 /* msg2_tx */ 748 55 2 /* msg2_tx */
715 56 2 /* msg2_rx */>; 749 56 2 /* msg2_rx */>;
716 interrupt-parent = <&mpic>; 750 interrupt-parent = <&mpic>;
751 sleep = <&pmc 0x00080000>;
717 }; 752 };
718}; 753};
diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index f468d215f716..9535ce68caae 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -35,6 +35,8 @@
35 i-cache-line-size = <32>; 35 i-cache-line-size = <32>;
36 d-cache-size = <32768>; // L1 36 d-cache-size = <32768>; // L1
37 i-cache-size = <32768>; // L1 37 i-cache-size = <32768>; // L1
38 sleep = <&pmc 0x00008000 0 // core
39 &pmc 0x00004000 0>; // timebase
38 timebase-frequency = <0>; // From uboot 40 timebase-frequency = <0>; // From uboot
39 bus-frequency = <0>; // From uboot 41 bus-frequency = <0>; // From uboot
40 clock-frequency = <0>; // From uboot 42 clock-frequency = <0>; // From uboot
@@ -60,6 +62,7 @@
60 5 0 0xe8480000 0x00008000 62 5 0 0xe8480000 0x00008000
61 6 0 0xe84c0000 0x00008000 63 6 0 0xe84c0000 0x00008000
62 3 0 0xe8000000 0x00000020>; 64 3 0 0xe8000000 0x00000020>;
65 sleep = <&pmc 0x08000000 0>;
63 66
64 flash@0,0 { 67 flash@0,0 {
65 compatible = "cfi-flash"; 68 compatible = "cfi-flash";
@@ -105,6 +108,8 @@
105 compatible = "fsl,fpga-pixis"; 108 compatible = "fsl,fpga-pixis";
106 reg = <3 0 0x20>; 109 reg = <3 0 0x20>;
107 ranges = <0 3 0 0x20>; 110 ranges = <0 3 0 0x20>;
111 interrupt-parent = <&mpic>;
112 interrupts = <8 8>;
108 113
109 sdcsr_pio: gpio-controller@a { 114 sdcsr_pio: gpio-controller@a {
110 #gpio-cells = <2>; 115 #gpio-cells = <2>;
@@ -163,6 +168,7 @@
163 reg = <0x3100 0x100>; 168 reg = <0x3100 0x100>;
164 interrupts = <43 2>; 169 interrupts = <43 2>;
165 interrupt-parent = <&mpic>; 170 interrupt-parent = <&mpic>;
171 sleep = <&pmc 0x00000004 0>;
166 dfsrr; 172 dfsrr;
167 }; 173 };
168 174
@@ -174,6 +180,7 @@
174 clock-frequency = <0>; 180 clock-frequency = <0>;
175 interrupts = <42 2>; 181 interrupts = <42 2>;
176 interrupt-parent = <&mpic>; 182 interrupt-parent = <&mpic>;
183 sleep = <&pmc 0x00000002 0>;
177 }; 184 };
178 185
179 serial1: serial@4600 { 186 serial1: serial@4600 {
@@ -184,6 +191,7 @@
184 clock-frequency = <0>; 191 clock-frequency = <0>;
185 interrupts = <42 2>; 192 interrupts = <42 2>;
186 interrupt-parent = <&mpic>; 193 interrupt-parent = <&mpic>;
194 sleep = <&pmc 0x00000008 0>;
187 }; 195 };
188 196
189 spi@7000 { 197 spi@7000 {
@@ -196,6 +204,7 @@
196 interrupt-parent = <&mpic>; 204 interrupt-parent = <&mpic>;
197 mode = "cpu"; 205 mode = "cpu";
198 gpios = <&sdcsr_pio 7 0>; 206 gpios = <&sdcsr_pio 7 0>;
207 sleep = <&pmc 0x00000800 0>;
199 208
200 mmc-slot@0 { 209 mmc-slot@0 {
201 compatible = "fsl,mpc8610hpcd-mmc-slot", 210 compatible = "fsl,mpc8610hpcd-mmc-slot",
@@ -213,6 +222,7 @@
213 reg = <0x2c000 100>; 222 reg = <0x2c000 100>;
214 interrupts = <72 2>; 223 interrupts = <72 2>;
215 interrupt-parent = <&mpic>; 224 interrupt-parent = <&mpic>;
225 sleep = <&pmc 0x04000000 0>;
216 }; 226 };
217 227
218 mpic: interrupt-controller@40000 { 228 mpic: interrupt-controller@40000 {
@@ -241,9 +251,18 @@
241 }; 251 };
242 252
243 global-utilities@e0000 { 253 global-utilities@e0000 {
254 #address-cells = <1>;
255 #size-cells = <1>;
244 compatible = "fsl,mpc8610-guts"; 256 compatible = "fsl,mpc8610-guts";
245 reg = <0xe0000 0x1000>; 257 reg = <0xe0000 0x1000>;
258 ranges = <0 0xe0000 0x1000>;
246 fsl,has-rstcr; 259 fsl,has-rstcr;
260
261 pmc: power@70 {
262 compatible = "fsl,mpc8610-pmc",
263 "fsl,mpc8641d-pmc";
264 reg = <0x70 0x20>;
265 };
247 }; 266 };
248 267
249 wdt@e4000 { 268 wdt@e4000 {
@@ -262,6 +281,7 @@
262 fsl,playback-dma = <&dma00>; 281 fsl,playback-dma = <&dma00>;
263 fsl,capture-dma = <&dma01>; 282 fsl,capture-dma = <&dma01>;
264 fsl,fifo-depth = <8>; 283 fsl,fifo-depth = <8>;
284 sleep = <&pmc 0 0x08000000>;
265 }; 285 };
266 286
267 ssi@16100 { 287 ssi@16100 {
@@ -271,6 +291,7 @@
271 interrupt-parent = <&mpic>; 291 interrupt-parent = <&mpic>;
272 interrupts = <63 2>; 292 interrupts = <63 2>;
273 fsl,fifo-depth = <8>; 293 fsl,fifo-depth = <8>;
294 sleep = <&pmc 0 0x04000000>;
274 }; 295 };
275 296
276 dma@21300 { 297 dma@21300 {
@@ -280,6 +301,7 @@
280 cell-index = <0>; 301 cell-index = <0>;
281 reg = <0x21300 0x4>; /* DMA general status register */ 302 reg = <0x21300 0x4>; /* DMA general status register */
282 ranges = <0x0 0x21100 0x200>; 303 ranges = <0x0 0x21100 0x200>;
304 sleep = <&pmc 0x00000400 0>;
283 305
284 dma00: dma-channel@0 { 306 dma00: dma-channel@0 {
285 compatible = "fsl,mpc8610-dma-channel", 307 compatible = "fsl,mpc8610-dma-channel",
@@ -322,6 +344,7 @@
322 cell-index = <1>; 344 cell-index = <1>;
323 reg = <0xc300 0x4>; /* DMA general status register */ 345 reg = <0xc300 0x4>; /* DMA general status register */
324 ranges = <0x0 0xc100 0x200>; 346 ranges = <0x0 0xc100 0x200>;
347 sleep = <&pmc 0x00000200 0>;
325 348
326 dma-channel@0 { 349 dma-channel@0 {
327 compatible = "fsl,mpc8610-dma-channel", 350 compatible = "fsl,mpc8610-dma-channel",
@@ -369,6 +392,7 @@
369 bus-range = <0 0>; 392 bus-range = <0 0>;
370 ranges = <0x02000000 0x0 0x80000000 0x80000000 0x0 0x10000000 393 ranges = <0x02000000 0x0 0x80000000 0x80000000 0x0 0x10000000
371 0x01000000 0x0 0x00000000 0xe1000000 0x0 0x00100000>; 394 0x01000000 0x0 0x00000000 0xe1000000 0x0 0x00100000>;
395 sleep = <&pmc 0x80000000 0>;
372 clock-frequency = <33333333>; 396 clock-frequency = <33333333>;
373 interrupt-parent = <&mpic>; 397 interrupt-parent = <&mpic>;
374 interrupts = <24 2>; 398 interrupts = <24 2>;
@@ -398,6 +422,7 @@
398 bus-range = <1 3>; 422 bus-range = <1 3>;
399 ranges = <0x02000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000 423 ranges = <0x02000000 0x0 0xa0000000 0xa0000000 0x0 0x10000000
400 0x01000000 0x0 0x00000000 0xe3000000 0x0 0x00100000>; 424 0x01000000 0x0 0x00000000 0xe3000000 0x0 0x00100000>;
425 sleep = <&pmc 0x40000000 0>;
401 clock-frequency = <33333333>; 426 clock-frequency = <33333333>;
402 interrupt-parent = <&mpic>; 427 interrupt-parent = <&mpic>;
403 interrupts = <26 2>; 428 interrupts = <26 2>;
@@ -474,6 +499,7 @@
474 0x0000 0 0 4 &mpic 7 1>; 499 0x0000 0 0 4 &mpic 7 1>;
475 interrupt-parent = <&mpic>; 500 interrupt-parent = <&mpic>;
476 interrupts = <25 2>; 501 interrupts = <25 2>;
502 sleep = <&pmc 0x20000000 0>;
477 clock-frequency = <33333333>; 503 clock-frequency = <33333333>;
478 }; 504 };
479}; 505};
diff --git a/arch/powerpc/boot/dts/p1020rdb.dts b/arch/powerpc/boot/dts/p1020rdb.dts
new file mode 100644
index 000000000000..df5269093af8
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1020rdb.dts
@@ -0,0 +1,477 @@
1/*
2 * P1020 RDB Device Tree Source
3 *
4 * Copyright 2009 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/dts-v1/;
13/ {
14 model = "fsl,P1020";
15 compatible = "fsl,P1020RDB";
16 #address-cells = <2>;
17 #size-cells = <2>;
18
19 aliases {
20 serial0 = &serial0;
21 serial1 = &serial1;
22 pci0 = &pci0;
23 pci1 = &pci1;
24 };
25
26 cpus {
27 #address-cells = <1>;
28 #size-cells = <0>;
29
30 PowerPC,P1020@0 {
31 device_type = "cpu";
32 reg = <0x0>;
33 next-level-cache = <&L2>;
34 };
35
36 PowerPC,P1020@1 {
37 device_type = "cpu";
38 reg = <0x1>;
39 next-level-cache = <&L2>;
40 };
41 };
42
43 memory {
44 device_type = "memory";
45 };
46
47 localbus@ffe05000 {
48 #address-cells = <2>;
49 #size-cells = <1>;
50 compatible = "fsl,p1020-elbc", "fsl,elbc", "simple-bus";
51 reg = <0 0xffe05000 0 0x1000>;
52 interrupts = <19 2>;
53 interrupt-parent = <&mpic>;
54
55 /* NOR, NAND Flashes and Vitesse 5 port L2 switch */
56 ranges = <0x0 0x0 0x0 0xef000000 0x01000000
57 0x1 0x0 0x0 0xffa00000 0x00040000
58 0x2 0x0 0x0 0xffb00000 0x00020000>;
59
60 nor@0,0 {
61 #address-cells = <1>;
62 #size-cells = <1>;
63 compatible = "cfi-flash";
64 reg = <0x0 0x0 0x1000000>;
65 bank-width = <2>;
66 device-width = <1>;
67
68 partition@0 {
69 /* This location must not be altered */
70 /* 256KB for Vitesse 7385 Switch firmware */
71 reg = <0x0 0x00040000>;
72 label = "NOR (RO) Vitesse-7385 Firmware";
73 read-only;
74 };
75
76 partition@40000 {
77 /* 256KB for DTB Image */
78 reg = <0x00040000 0x00040000>;
79 label = "NOR (RO) DTB Image";
80 read-only;
81 };
82
83 partition@80000 {
84 /* 3.5 MB for Linux Kernel Image */
85 reg = <0x00080000 0x00380000>;
86 label = "NOR (RO) Linux Kernel Image";
87 read-only;
88 };
89
90 partition@400000 {
91 /* 11MB for JFFS2 based Root file System */
92 reg = <0x00400000 0x00b00000>;
93 label = "NOR (RW) JFFS2 Root File System";
94 };
95
96 partition@f00000 {
97 /* This location must not be altered */
98 /* 512KB for u-boot Bootloader Image */
99 /* 512KB for u-boot Environment Variables */
100 reg = <0x00f00000 0x00100000>;
101 label = "NOR (RO) U-Boot Image";
102 read-only;
103 };
104 };
105
106 nand@1,0 {
107 #address-cells = <1>;
108 #size-cells = <1>;
109 compatible = "fsl,p1020-fcm-nand",
110 "fsl,elbc-fcm-nand";
111 reg = <0x1 0x0 0x40000>;
112
113 partition@0 {
114 /* This location must not be altered */
115 /* 1MB for u-boot Bootloader Image */
116 reg = <0x0 0x00100000>;
117 label = "NAND (RO) U-Boot Image";
118 read-only;
119 };
120
121 partition@100000 {
122 /* 1MB for DTB Image */
123 reg = <0x00100000 0x00100000>;
124 label = "NAND (RO) DTB Image";
125 read-only;
126 };
127
128 partition@200000 {
129 /* 4MB for Linux Kernel Image */
130 reg = <0x00200000 0x00400000>;
131 label = "NAND (RO) Linux Kernel Image";
132 read-only;
133 };
134
135 partition@600000 {
136 /* 4MB for Compressed Root file System Image */
137 reg = <0x00600000 0x00400000>;
138 label = "NAND (RO) Compressed RFS Image";
139 read-only;
140 };
141
142 partition@a00000 {
143 /* 7MB for JFFS2 based Root file System */
144 reg = <0x00a00000 0x00700000>;
145 label = "NAND (RW) JFFS2 Root File System";
146 };
147
148 partition@1100000 {
149 /* 15MB for JFFS2 based Root file System */
150 reg = <0x01100000 0x00f00000>;
151 label = "NAND (RW) Writable User area";
152 };
153 };
154
155 L2switch@2,0 {
156 #address-cells = <1>;
157 #size-cells = <1>;
158 compatible = "vitesse-7385";
159 reg = <0x2 0x0 0x20000>;
160 };
161
162 };
163
164 soc@ffe00000 {
165 #address-cells = <1>;
166 #size-cells = <1>;
167 device_type = "soc";
168 compatible = "fsl,p1020-immr", "simple-bus";
169 ranges = <0x0 0x0 0xffe00000 0x100000>;
170 bus-frequency = <0>; // Filled out by uboot.
171
172 ecm-law@0 {
173 compatible = "fsl,ecm-law";
174 reg = <0x0 0x1000>;
175 fsl,num-laws = <12>;
176 };
177
178 ecm@1000 {
179 compatible = "fsl,p1020-ecm", "fsl,ecm";
180 reg = <0x1000 0x1000>;
181 interrupts = <16 2>;
182 interrupt-parent = <&mpic>;
183 };
184
185 memory-controller@2000 {
186 compatible = "fsl,p1020-memory-controller";
187 reg = <0x2000 0x1000>;
188 interrupt-parent = <&mpic>;
189 interrupts = <16 2>;
190 };
191
192 i2c@3000 {
193 #address-cells = <1>;
194 #size-cells = <0>;
195 cell-index = <0>;
196 compatible = "fsl-i2c";
197 reg = <0x3000 0x100>;
198 interrupts = <43 2>;
199 interrupt-parent = <&mpic>;
200 dfsrr;
201 rtc@68 {
202 compatible = "dallas,ds1339";
203 reg = <0x68>;
204 };
205 };
206
207 i2c@3100 {
208 #address-cells = <1>;
209 #size-cells = <0>;
210 cell-index = <1>;
211 compatible = "fsl-i2c";
212 reg = <0x3100 0x100>;
213 interrupts = <43 2>;
214 interrupt-parent = <&mpic>;
215 dfsrr;
216 };
217
218 serial0: serial@4500 {
219 cell-index = <0>;
220 device_type = "serial";
221 compatible = "ns16550";
222 reg = <0x4500 0x100>;
223 clock-frequency = <0>;
224 interrupts = <42 2>;
225 interrupt-parent = <&mpic>;
226 };
227
228 serial1: serial@4600 {
229 cell-index = <1>;
230 device_type = "serial";
231 compatible = "ns16550";
232 reg = <0x4600 0x100>;
233 clock-frequency = <0>;
234 interrupts = <42 2>;
235 interrupt-parent = <&mpic>;
236 };
237
238 spi@7000 {
239 cell-index = <0>;
240 #address-cells = <1>;
241 #size-cells = <0>;
242 compatible = "fsl,espi";
243 reg = <0x7000 0x1000>;
244 interrupts = <59 0x2>;
245 interrupt-parent = <&mpic>;
246 mode = "cpu";
247
248 fsl_m25p80@0 {
249 #address-cells = <1>;
250 #size-cells = <1>;
251 compatible = "fsl,espi-flash";
252 reg = <0>;
253 linux,modalias = "fsl_m25p80";
254 modal = "s25sl128b";
255 spi-max-frequency = <50000000>;
256 mode = <0>;
257
258 partition@0 {
259 /* 512KB for u-boot Bootloader Image */
260 reg = <0x0 0x00080000>;
261 label = "SPI (RO) U-Boot Image";
262 read-only;
263 };
264
265 partition@80000 {
266 /* 512KB for DTB Image */
267 reg = <0x00080000 0x00080000>;
268 label = "SPI (RO) DTB Image";
269 read-only;
270 };
271
272 partition@100000 {
273 /* 4MB for Linux Kernel Image */
274 reg = <0x00100000 0x00400000>;
275 label = "SPI (RO) Linux Kernel Image";
276 read-only;
277 };
278
279 partition@500000 {
280 /* 4MB for Compressed RFS Image */
281 reg = <0x00500000 0x00400000>;
282 label = "SPI (RO) Compressed RFS Image";
283 read-only;
284 };
285
286 partition@900000 {
287 /* 7MB for JFFS2 based RFS */
288 reg = <0x00900000 0x00700000>;
289 label = "SPI (RW) JFFS2 RFS";
290 };
291 };
292 };
293
294 gpio: gpio-controller@f000 {
295 #gpio-cells = <2>;
296 compatible = "fsl,mpc8572-gpio";
297 reg = <0xf000 0x100>;
298 interrupts = <47 0x2>;
299 interrupt-parent = <&mpic>;
300 gpio-controller;
301 };
302
303 L2: l2-cache-controller@20000 {
304 compatible = "fsl,p1020-l2-cache-controller";
305 reg = <0x20000 0x1000>;
306 cache-line-size = <32>; // 32 bytes
307 cache-size = <0x40000>; // L2,256K
308 interrupt-parent = <&mpic>;
309 interrupts = <16 2>;
310 };
311
312 dma@21300 {
313 #address-cells = <1>;
314 #size-cells = <1>;
315 compatible = "fsl,eloplus-dma";
316 reg = <0x21300 0x4>;
317 ranges = <0x0 0x21100 0x200>;
318 cell-index = <0>;
319 dma-channel@0 {
320 compatible = "fsl,eloplus-dma-channel";
321 reg = <0x0 0x80>;
322 cell-index = <0>;
323 interrupt-parent = <&mpic>;
324 interrupts = <20 2>;
325 };
326 dma-channel@80 {
327 compatible = "fsl,eloplus-dma-channel";
328 reg = <0x80 0x80>;
329 cell-index = <1>;
330 interrupt-parent = <&mpic>;
331 interrupts = <21 2>;
332 };
333 dma-channel@100 {
334 compatible = "fsl,eloplus-dma-channel";
335 reg = <0x100 0x80>;
336 cell-index = <2>;
337 interrupt-parent = <&mpic>;
338 interrupts = <22 2>;
339 };
340 dma-channel@180 {
341 compatible = "fsl,eloplus-dma-channel";
342 reg = <0x180 0x80>;
343 cell-index = <3>;
344 interrupt-parent = <&mpic>;
345 interrupts = <23 2>;
346 };
347 };
348
349 usb@22000 {
350 #address-cells = <1>;
351 #size-cells = <0>;
352 compatible = "fsl-usb2-dr";
353 reg = <0x22000 0x1000>;
354 interrupt-parent = <&mpic>;
355 interrupts = <28 0x2>;
356 phy_type = "ulpi";
357 };
358
359 usb@23000 {
360 #address-cells = <1>;
361 #size-cells = <0>;
362 compatible = "fsl-usb2-dr";
363 reg = <0x23000 0x1000>;
364 interrupt-parent = <&mpic>;
365 interrupts = <46 0x2>;
366 phy_type = "ulpi";
367 };
368
369 sdhci@2e000 {
370 compatible = "fsl,p1020-esdhc", "fsl,esdhc";
371 reg = <0x2e000 0x1000>;
372 interrupts = <72 0x2>;
373 interrupt-parent = <&mpic>;
374 /* Filled in by U-Boot */
375 clock-frequency = <0>;
376 };
377
378 crypto@30000 {
379 compatible = "fsl,sec3.1", "fsl,sec3.0", "fsl,sec2.4",
380 "fsl,sec2.2", "fsl,sec2.1", "fsl,sec2.0";
381 reg = <0x30000 0x10000>;
382 interrupts = <45 2 58 2>;
383 interrupt-parent = <&mpic>;
384 fsl,num-channels = <4>;
385 fsl,channel-fifo-len = <24>;
386 fsl,exec-units-mask = <0xbfe>;
387 fsl,descriptor-types-mask = <0x3ab0ebf>;
388 };
389
390 mpic: pic@40000 {
391 interrupt-controller;
392 #address-cells = <0>;
393 #interrupt-cells = <2>;
394 reg = <0x40000 0x40000>;
395 compatible = "chrp,open-pic";
396 device_type = "open-pic";
397 };
398
399 msi@41600 {
400 compatible = "fsl,p1020-msi", "fsl,mpic-msi";
401 reg = <0x41600 0x80>;
402 msi-available-ranges = <0 0x100>;
403 interrupts = <
404 0xe0 0
405 0xe1 0
406 0xe2 0
407 0xe3 0
408 0xe4 0
409 0xe5 0
410 0xe6 0
411 0xe7 0>;
412 interrupt-parent = <&mpic>;
413 };
414
415 global-utilities@e0000 { //global utilities block
416 compatible = "fsl,p1020-guts";
417 reg = <0xe0000 0x1000>;
418 fsl,has-rstcr;
419 };
420 };
421
422 pci0: pcie@ffe09000 {
423 compatible = "fsl,mpc8548-pcie";
424 device_type = "pci";
425 #interrupt-cells = <1>;
426 #size-cells = <2>;
427 #address-cells = <3>;
428 reg = <0 0xffe09000 0 0x1000>;
429 bus-range = <0 255>;
430 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
431 0x1000000 0x0 0x00000000 0 0xffc30000 0x0 0x10000>;
432 clock-frequency = <33333333>;
433 interrupt-parent = <&mpic>;
434 interrupts = <16 2>;
435 pcie@0 {
436 reg = <0x0 0x0 0x0 0x0 0x0>;
437 #size-cells = <2>;
438 #address-cells = <3>;
439 device_type = "pci";
440 ranges = <0x2000000 0x0 0xa0000000
441 0x2000000 0x0 0xa0000000
442 0x0 0x20000000
443
444 0x1000000 0x0 0x0
445 0x1000000 0x0 0x0
446 0x0 0x100000>;
447 };
448 };
449
450 pci1: pcie@ffe0a000 {
451 compatible = "fsl,mpc8548-pcie";
452 device_type = "pci";
453 #interrupt-cells = <1>;
454 #size-cells = <2>;
455 #address-cells = <3>;
456 reg = <0 0xffe0a000 0 0x1000>;
457 bus-range = <0 255>;
458 ranges = <0x2000000 0x0 0xc0000000 0 0xc0000000 0x0 0x20000000
459 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>;
460 clock-frequency = <33333333>;
461 interrupt-parent = <&mpic>;
462 interrupts = <16 2>;
463 pcie@0 {
464 reg = <0x0 0x0 0x0 0x0 0x0>;
465 #size-cells = <2>;
466 #address-cells = <3>;
467 device_type = "pci";
468 ranges = <0x2000000 0x0 0xc0000000
469 0x2000000 0x0 0xc0000000
470 0x0 0x20000000
471
472 0x1000000 0x0 0x0
473 0x1000000 0x0 0x0
474 0x0 0x100000>;
475 };
476 };
477};
diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
new file mode 100644
index 000000000000..0fe93d0c8b2e
--- /dev/null
+++ b/arch/powerpc/boot/dts/p2020rdb_camp_core0.dts
@@ -0,0 +1,363 @@
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 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/dts-v1/;
18/ {
19 model = "fsl,P2020";
20 compatible = "fsl,P2020RDB", "fsl,MPC85XXRDB-CAMP";
21 #address-cells = <2>;
22 #size-cells = <2>;
23
24 aliases {
25 ethernet1 = &enet1;
26 ethernet2 = &enet2;
27 serial0 = &serial0;
28 pci0 = &pci0;
29 };
30
31 cpus {
32 #address-cells = <1>;
33 #size-cells = <0>;
34
35 PowerPC,P2020@0 {
36 device_type = "cpu";
37 reg = <0x0>;
38 next-level-cache = <&L2>;
39 };
40 };
41
42 memory {
43 device_type = "memory";
44 };
45
46 soc@ffe00000 {
47 #address-cells = <1>;
48 #size-cells = <1>;
49 device_type = "soc";
50 compatible = "fsl,p2020-immr", "simple-bus";
51 ranges = <0x0 0x0 0xffe00000 0x100000>;
52 bus-frequency = <0>; // Filled out by uboot.
53
54 ecm-law@0 {
55 compatible = "fsl,ecm-law";
56 reg = <0x0 0x1000>;
57 fsl,num-laws = <12>;
58 };
59
60 ecm@1000 {
61 compatible = "fsl,p2020-ecm", "fsl,ecm";
62 reg = <0x1000 0x1000>;
63 interrupts = <17 2>;
64 interrupt-parent = <&mpic>;
65 };
66
67 memory-controller@2000 {
68 compatible = "fsl,p2020-memory-controller";
69 reg = <0x2000 0x1000>;
70 interrupt-parent = <&mpic>;
71 interrupts = <18 2>;
72 };
73
74 i2c@3000 {
75 #address-cells = <1>;
76 #size-cells = <0>;
77 cell-index = <0>;
78 compatible = "fsl-i2c";
79 reg = <0x3000 0x100>;
80 interrupts = <43 2>;
81 interrupt-parent = <&mpic>;
82 dfsrr;
83 rtc@68 {
84 compatible = "dallas,ds1339";
85 reg = <0x68>;
86 };
87 };
88
89 i2c@3100 {
90 #address-cells = <1>;
91 #size-cells = <0>;
92 cell-index = <1>;
93 compatible = "fsl-i2c";
94 reg = <0x3100 0x100>;
95 interrupts = <43 2>;
96 interrupt-parent = <&mpic>;
97 dfsrr;
98 };
99
100 serial0: serial@4500 {
101 cell-index = <0>;
102 device_type = "serial";
103 compatible = "ns16550";
104 reg = <0x4500 0x100>;
105 clock-frequency = <0>;
106 };
107
108 spi@7000 {
109 cell-index = <0>;
110 #address-cells = <1>;
111 #size-cells = <0>;
112 compatible = "fsl,espi";
113 reg = <0x7000 0x1000>;
114 interrupts = <59 0x2>;
115 interrupt-parent = <&mpic>;
116 mode = "cpu";
117
118 fsl_m25p80@0 {
119 #address-cells = <1>;
120 #size-cells = <1>;
121 compatible = "fsl,espi-flash";
122 reg = <0>;
123 linux,modalias = "fsl_m25p80";
124 modal = "s25sl128b";
125 spi-max-frequency = <50000000>;
126 mode = <0>;
127
128 partition@0 {
129 /* 512KB for u-boot Bootloader Image */
130 reg = <0x0 0x00080000>;
131 label = "SPI (RO) U-Boot Image";
132 read-only;
133 };
134
135 partition@80000 {
136 /* 512KB for DTB Image */
137 reg = <0x00080000 0x00080000>;
138 label = "SPI (RO) DTB Image";
139 read-only;
140 };
141
142 partition@100000 {
143 /* 4MB for Linux Kernel Image */
144 reg = <0x00100000 0x00400000>;
145 label = "SPI (RO) Linux Kernel Image";
146 read-only;
147 };
148
149 partition@500000 {
150 /* 4MB for Compressed RFS Image */
151 reg = <0x00500000 0x00400000>;
152 label = "SPI (RO) Compressed RFS Image";
153 read-only;
154 };
155
156 partition@900000 {
157 /* 7MB for JFFS2 based RFS */
158 reg = <0x00900000 0x00700000>;
159 label = "SPI (RW) JFFS2 RFS";
160 };
161 };
162 };
163
164 gpio: gpio-controller@f000 {
165 #gpio-cells = <2>;
166 compatible = "fsl,mpc8572-gpio";
167 reg = <0xf000 0x100>;
168 interrupts = <47 0x2>;
169 interrupt-parent = <&mpic>;
170 gpio-controller;
171 };
172
173 L2: l2-cache-controller@20000 {
174 compatible = "fsl,p2020-l2-cache-controller";
175 reg = <0x20000 0x1000>;
176 cache-line-size = <32>; // 32 bytes
177 cache-size = <0x80000>; // L2,512K
178 interrupt-parent = <&mpic>;
179 interrupts = <16 2>;
180 };
181
182 dma@21300 {
183 #address-cells = <1>;
184 #size-cells = <1>;
185 compatible = "fsl,eloplus-dma";
186 reg = <0x21300 0x4>;
187 ranges = <0x0 0x21100 0x200>;
188 cell-index = <0>;
189 dma-channel@0 {
190 compatible = "fsl,eloplus-dma-channel";
191 reg = <0x0 0x80>;
192 cell-index = <0>;
193 interrupt-parent = <&mpic>;
194 interrupts = <20 2>;
195 };
196 dma-channel@80 {
197 compatible = "fsl,eloplus-dma-channel";
198 reg = <0x80 0x80>;
199 cell-index = <1>;
200 interrupt-parent = <&mpic>;
201 interrupts = <21 2>;
202 };
203 dma-channel@100 {
204 compatible = "fsl,eloplus-dma-channel";
205 reg = <0x100 0x80>;
206 cell-index = <2>;
207 interrupt-parent = <&mpic>;
208 interrupts = <22 2>;
209 };
210 dma-channel@180 {
211 compatible = "fsl,eloplus-dma-channel";
212 reg = <0x180 0x80>;
213 cell-index = <3>;
214 interrupt-parent = <&mpic>;
215 interrupts = <23 2>;
216 };
217 };
218
219 usb@22000 {
220 #address-cells = <1>;
221 #size-cells = <0>;
222 compatible = "fsl-usb2-dr";
223 reg = <0x22000 0x1000>;
224 interrupt-parent = <&mpic>;
225 interrupts = <28 0x2>;
226 phy_type = "ulpi";
227 };
228
229 mdio@24520 {
230 #address-cells = <1>;
231 #size-cells = <0>;
232 compatible = "fsl,gianfar-mdio";
233 reg = <0x24520 0x20>;
234
235 phy0: ethernet-phy@0 {
236 interrupt-parent = <&mpic>;
237 interrupts = <3 1>;
238 reg = <0x0>;
239 };
240 phy1: ethernet-phy@1 {
241 interrupt-parent = <&mpic>;
242 interrupts = <3 1>;
243 reg = <0x1>;
244 };
245 };
246
247 mdio@25520 {
248 #address-cells = <1>;
249 #size-cells = <0>;
250 compatible = "fsl,gianfar-tbi";
251 reg = <0x26520 0x20>;
252
253 tbi0: tbi-phy@11 {
254 reg = <0x11>;
255 device_type = "tbi-phy";
256 };
257 };
258
259 enet1: ethernet@25000 {
260 #address-cells = <1>;
261 #size-cells = <1>;
262 cell-index = <1>;
263 device_type = "network";
264 model = "eTSEC";
265 compatible = "gianfar";
266 reg = <0x25000 0x1000>;
267 ranges = <0x0 0x25000 0x1000>;
268 local-mac-address = [ 00 00 00 00 00 00 ];
269 interrupts = <35 2 36 2 40 2>;
270 interrupt-parent = <&mpic>;
271 tbi-handle = <&tbi0>;
272 phy-handle = <&phy0>;
273 phy-connection-type = "sgmii";
274
275 };
276
277 enet2: ethernet@26000 {
278 #address-cells = <1>;
279 #size-cells = <1>;
280 cell-index = <2>;
281 device_type = "network";
282 model = "eTSEC";
283 compatible = "gianfar";
284 reg = <0x26000 0x1000>;
285 ranges = <0x0 0x26000 0x1000>;
286 local-mac-address = [ 00 00 00 00 00 00 ];
287 interrupts = <31 2 32 2 33 2>;
288 interrupt-parent = <&mpic>;
289 phy-handle = <&phy1>;
290 phy-connection-type = "rgmii-id";
291 };
292
293 sdhci@2e000 {
294 compatible = "fsl,p2020-esdhc", "fsl,esdhc";
295 reg = <0x2e000 0x1000>;
296 interrupts = <72 0x2>;
297 interrupt-parent = <&mpic>;
298 /* Filled in by U-Boot */
299 clock-frequency = <0>;
300 };
301
302 crypto@30000 {
303 compatible = "fsl,sec3.1", "fsl,sec3.0", "fsl,sec2.4",
304 "fsl,sec2.2", "fsl,sec2.1", "fsl,sec2.0";
305 reg = <0x30000 0x10000>;
306 interrupts = <45 2 58 2>;
307 interrupt-parent = <&mpic>;
308 fsl,num-channels = <4>;
309 fsl,channel-fifo-len = <24>;
310 fsl,exec-units-mask = <0xbfe>;
311 fsl,descriptor-types-mask = <0x3ab0ebf>;
312 };
313
314 mpic: pic@40000 {
315 interrupt-controller;
316 #address-cells = <0>;
317 #interrupt-cells = <2>;
318 reg = <0x40000 0x40000>;
319 compatible = "chrp,open-pic";
320 device_type = "open-pic";
321 protected-sources = <
322 42 76 77 78 79 /* serial1 , dma2 */
323 29 30 34 26 /* enet0, pci1 */
324 0xe0 0xe1 0xe2 0xe3 /* msi */
325 0xe4 0xe5 0xe6 0xe7
326 >;
327 };
328
329 global-utilities@e0000 {
330 compatible = "fsl,p2020-guts";
331 reg = <0xe0000 0x1000>;
332 fsl,has-rstcr;
333 };
334 };
335
336 pci0: pcie@ffe09000 {
337 compatible = "fsl,mpc8548-pcie";
338 device_type = "pci";
339 #interrupt-cells = <1>;
340 #size-cells = <2>;
341 #address-cells = <3>;
342 reg = <0 0xffe09000 0 0x1000>;
343 bus-range = <0 255>;
344 ranges = <0x2000000 0x0 0xa0000000 0 0xa0000000 0x0 0x20000000
345 0x1000000 0x0 0x00000000 0 0xffc30000 0x0 0x10000>;
346 clock-frequency = <33333333>;
347 interrupt-parent = <&mpic>;
348 interrupts = <25 2>;
349 pcie@0 {
350 reg = <0x0 0x0 0x0 0x0 0x0>;
351 #size-cells = <2>;
352 #address-cells = <3>;
353 device_type = "pci";
354 ranges = <0x2000000 0x0 0xa0000000
355 0x2000000 0x0 0xa0000000
356 0x0 0x20000000
357
358 0x1000000 0x0 0x0
359 0x1000000 0x0 0x0
360 0x0 0x100000>;
361 };
362 };
363};
diff --git a/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts b/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
new file mode 100644
index 000000000000..e95a51285328
--- /dev/null
+++ b/arch/powerpc/boot/dts/p2020rdb_camp_core1.dts
@@ -0,0 +1,184 @@
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 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/dts-v1/;
19/ {
20 model = "fsl,P2020";
21 compatible = "fsl,P2020RDB", "fsl,MPC85XXRDB-CAMP";
22 #address-cells = <2>;
23 #size-cells = <2>;
24
25 aliases {
26 ethernet0 = &enet0;
27 serial0 = &serial0;
28 pci1 = &pci1;
29 };
30
31 cpus {
32 #address-cells = <1>;
33 #size-cells = <0>;
34
35 PowerPC,P2020@1 {
36 device_type = "cpu";
37 reg = <0x1>;
38 next-level-cache = <&L2>;
39 };
40 };
41
42 memory {
43 device_type = "memory";
44 };
45
46 soc@ffe00000 {
47 #address-cells = <1>;
48 #size-cells = <1>;
49 device_type = "soc";
50 compatible = "fsl,p2020-immr", "simple-bus";
51 ranges = <0x0 0x0 0xffe00000 0x100000>;
52 bus-frequency = <0>; // Filled out by uboot.
53
54 serial0: serial@4600 {
55 cell-index = <1>;
56 device_type = "serial";
57 compatible = "ns16550";
58 reg = <0x4600 0x100>;
59 clock-frequency = <0>;
60 };
61
62 dma@c300 {
63 #address-cells = <1>;
64 #size-cells = <1>;
65 compatible = "fsl,eloplus-dma";
66 reg = <0xc300 0x4>;
67 ranges = <0x0 0xc100 0x200>;
68 cell-index = <1>;
69 dma-channel@0 {
70 compatible = "fsl,eloplus-dma-channel";
71 reg = <0x0 0x80>;
72 cell-index = <0>;
73 interrupt-parent = <&mpic>;
74 interrupts = <76 2>;
75 };
76 dma-channel@80 {
77 compatible = "fsl,eloplus-dma-channel";
78 reg = <0x80 0x80>;
79 cell-index = <1>;
80 interrupt-parent = <&mpic>;
81 interrupts = <77 2>;
82 };
83 dma-channel@100 {
84 compatible = "fsl,eloplus-dma-channel";
85 reg = <0x100 0x80>;
86 cell-index = <2>;
87 interrupt-parent = <&mpic>;
88 interrupts = <78 2>;
89 };
90 dma-channel@180 {
91 compatible = "fsl,eloplus-dma-channel";
92 reg = <0x180 0x80>;
93 cell-index = <3>;
94 interrupt-parent = <&mpic>;
95 interrupts = <79 2>;
96 };
97 };
98
99 L2: l2-cache-controller@20000 {
100 compatible = "fsl,p2020-l2-cache-controller";
101 reg = <0x20000 0x1000>;
102 cache-line-size = <32>; // 32 bytes
103 cache-size = <0x80000>; // L2,512K
104 interrupt-parent = <&mpic>;
105 };
106
107
108 enet0: ethernet@24000 {
109 #address-cells = <1>;
110 #size-cells = <1>;
111 cell-index = <0>;
112 device_type = "network";
113 model = "eTSEC";
114 compatible = "gianfar";
115 reg = <0x24000 0x1000>;
116 ranges = <0x0 0x24000 0x1000>;
117 local-mac-address = [ 00 00 00 00 00 00 ];
118 interrupts = <29 2 30 2 34 2>;
119 interrupt-parent = <&mpic>;
120 fixed-link = <1 1 1000 0 0>;
121 phy-connection-type = "rgmii-id";
122
123 };
124
125 mpic: pic@40000 {
126 interrupt-controller;
127 #address-cells = <0>;
128 #interrupt-cells = <2>;
129 reg = <0x40000 0x40000>;
130 compatible = "chrp,open-pic";
131 device_type = "open-pic";
132 protected-sources = <
133 17 18 43 42 59 47 /*ecm, mem, i2c, serial0, spi,gpio */
134 16 20 21 22 23 28 /* L2, dma1, USB */
135 03 35 36 40 31 32 33 /* mdio, enet1, enet2 */
136 72 45 58 25 /* sdhci, crypto , pci */
137 >;
138 };
139
140 msi@41600 {
141 compatible = "fsl,p2020-msi", "fsl,mpic-msi";
142 reg = <0x41600 0x80>;
143 msi-available-ranges = <0 0x100>;
144 interrupts = <
145 0xe0 0
146 0xe1 0
147 0xe2 0
148 0xe3 0
149 0xe4 0
150 0xe5 0
151 0xe6 0
152 0xe7 0>;
153 interrupt-parent = <&mpic>;
154 };
155 };
156
157 pci1: pcie@ffe0a000 {
158 compatible = "fsl,mpc8548-pcie";
159 device_type = "pci";
160 #interrupt-cells = <1>;
161 #size-cells = <2>;
162 #address-cells = <3>;
163 reg = <0 0xffe0a000 0 0x1000>;
164 bus-range = <0 255>;
165 ranges = <0x2000000 0x0 0xc0000000 0 0xc0000000 0x0 0x20000000
166 0x1000000 0x0 0x00000000 0 0xffc20000 0x0 0x10000>;
167 clock-frequency = <33333333>;
168 interrupt-parent = <&mpic>;
169 interrupts = <26 2>;
170 pcie@0 {
171 reg = <0x0 0x0 0x0 0x0 0x0>;
172 #size-cells = <2>;
173 #address-cells = <3>;
174 device_type = "pci";
175 ranges = <0x2000000 0x0 0xc0000000
176 0x2000000 0x0 0xc0000000
177 0x0 0x20000000
178
179 0x1000000 0x0 0x0
180 0x1000000 0x0 0x0
181 0x0 0x100000>;
182 };
183 };
184};
diff --git a/arch/powerpc/boot/dts/p4080ds.dts b/arch/powerpc/boot/dts/p4080ds.dts
new file mode 100644
index 000000000000..6b29eab05362
--- /dev/null
+++ b/arch/powerpc/boot/dts/p4080ds.dts
@@ -0,0 +1,554 @@
1/*
2 * P4080DS Device Tree Source
3 *
4 * Copyright 2009 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/dts-v1/;
13
14/ {
15 model = "fsl,P4080DS";
16 compatible = "fsl,P4080DS";
17 #address-cells = <2>;
18 #size-cells = <2>;
19
20 aliases {
21 ccsr = &soc;
22
23 serial0 = &serial0;
24 serial1 = &serial1;
25 serial2 = &serial2;
26 serial3 = &serial3;
27 pci0 = &pci0;
28 pci1 = &pci1;
29 pci2 = &pci2;
30 usb0 = &usb0;
31 usb1 = &usb1;
32 dma0 = &dma0;
33 dma1 = &dma1;
34 sdhc = &sdhc;
35
36 rio0 = &rapidio0;
37 };
38
39 cpus {
40 #address-cells = <1>;
41 #size-cells = <0>;
42
43 cpu0: PowerPC,4080@0 {
44 device_type = "cpu";
45 reg = <0>;
46 next-level-cache = <&L2_0>;
47 L2_0: l2-cache {
48 };
49 };
50 cpu1: PowerPC,4080@1 {
51 device_type = "cpu";
52 reg = <1>;
53 next-level-cache = <&L2_1>;
54 L2_1: l2-cache {
55 };
56 };
57 cpu2: PowerPC,4080@2 {
58 device_type = "cpu";
59 reg = <2>;
60 next-level-cache = <&L2_2>;
61 L2_2: l2-cache {
62 };
63 };
64 cpu3: PowerPC,4080@3 {
65 device_type = "cpu";
66 reg = <3>;
67 next-level-cache = <&L2_3>;
68 L2_3: l2-cache {
69 };
70 };
71 cpu4: PowerPC,4080@4 {
72 device_type = "cpu";
73 reg = <4>;
74 next-level-cache = <&L2_4>;
75 L2_4: l2-cache {
76 };
77 };
78 cpu5: PowerPC,4080@5 {
79 device_type = "cpu";
80 reg = <5>;
81 next-level-cache = <&L2_5>;
82 L2_5: l2-cache {
83 };
84 };
85 cpu6: PowerPC,4080@6 {
86 device_type = "cpu";
87 reg = <6>;
88 next-level-cache = <&L2_6>;
89 L2_6: l2-cache {
90 };
91 };
92 cpu7: PowerPC,4080@7 {
93 device_type = "cpu";
94 reg = <7>;
95 next-level-cache = <&L2_7>;
96 L2_7: l2-cache {
97 };
98 };
99 };
100
101 memory {
102 device_type = "memory";
103 };
104
105 soc: soc@ffe000000 {
106 #address-cells = <1>;
107 #size-cells = <1>;
108 device_type = "soc";
109 compatible = "simple-bus";
110 ranges = <0x00000000 0xf 0xfe000000 0x1000000>;
111 reg = <0xf 0xfe000000 0 0x00001000>;
112
113 corenet-law@0 {
114 compatible = "fsl,corenet-law";
115 reg = <0x0 0x1000>;
116 fsl,num-laws = <32>;
117 };
118
119 memory-controller@8000 {
120 compatible = "fsl,p4080-memory-controller";
121 reg = <0x8000 0x1000>;
122 interrupt-parent = <&mpic>;
123 interrupts = <0x12 2>;
124 };
125
126 memory-controller@9000 {
127 compatible = "fsl,p4080-memory-controller";
128 reg = <0x9000 0x1000>;
129 interrupt-parent = <&mpic>;
130 interrupts = <0x12 2>;
131 };
132
133 corenet-cf@18000 {
134 compatible = "fsl,corenet-cf";
135 reg = <0x18000 0x1000>;
136 fsl,ccf-num-csdids = <32>;
137 fsl,ccf-num-snoopids = <32>;
138 };
139
140 iommu@20000 {
141 compatible = "fsl,p4080-pamu";
142 reg = <0x20000 0x10000>;
143 interrupts = <24 2>;
144 interrupt-parent = <&mpic>;
145 };
146
147 mpic: pic@40000 {
148 interrupt-controller;
149 #address-cells = <0>;
150 #interrupt-cells = <2>;
151 reg = <0x40000 0x40000>;
152 compatible = "chrp,open-pic";
153 device_type = "open-pic";
154 };
155
156 dma0: dma@100300 {
157 #address-cells = <1>;
158 #size-cells = <1>;
159 compatible = "fsl,p4080-dma", "fsl,eloplus-dma";
160 reg = <0x100300 0x4>;
161 ranges = <0x0 0x100100 0x200>;
162 cell-index = <0>;
163 dma-channel@0 {
164 compatible = "fsl,p4080-dma-channel",
165 "fsl,eloplus-dma-channel";
166 reg = <0x0 0x80>;
167 cell-index = <0>;
168 interrupt-parent = <&mpic>;
169 interrupts = <28 2>;
170 };
171 dma-channel@80 {
172 compatible = "fsl,p4080-dma-channel",
173 "fsl,eloplus-dma-channel";
174 reg = <0x80 0x80>;
175 cell-index = <1>;
176 interrupt-parent = <&mpic>;
177 interrupts = <29 2>;
178 };
179 dma-channel@100 {
180 compatible = "fsl,p4080-dma-channel",
181 "fsl,eloplus-dma-channel";
182 reg = <0x100 0x80>;
183 cell-index = <2>;
184 interrupt-parent = <&mpic>;
185 interrupts = <30 2>;
186 };
187 dma-channel@180 {
188 compatible = "fsl,p4080-dma-channel",
189 "fsl,eloplus-dma-channel";
190 reg = <0x180 0x80>;
191 cell-index = <3>;
192 interrupt-parent = <&mpic>;
193 interrupts = <31 2>;
194 };
195 };
196
197 dma1: dma@101300 {
198 #address-cells = <1>;
199 #size-cells = <1>;
200 compatible = "fsl,p4080-dma", "fsl,eloplus-dma";
201 reg = <0x101300 0x4>;
202 ranges = <0x0 0x101100 0x200>;
203 cell-index = <1>;
204 dma-channel@0 {
205 compatible = "fsl,p4080-dma-channel",
206 "fsl,eloplus-dma-channel";
207 reg = <0x0 0x80>;
208 cell-index = <0>;
209 interrupt-parent = <&mpic>;
210 interrupts = <32 2>;
211 };
212 dma-channel@80 {
213 compatible = "fsl,p4080-dma-channel",
214 "fsl,eloplus-dma-channel";
215 reg = <0x80 0x80>;
216 cell-index = <1>;
217 interrupt-parent = <&mpic>;
218 interrupts = <33 2>;
219 };
220 dma-channel@100 {
221 compatible = "fsl,p4080-dma-channel",
222 "fsl,eloplus-dma-channel";
223 reg = <0x100 0x80>;
224 cell-index = <2>;
225 interrupt-parent = <&mpic>;
226 interrupts = <34 2>;
227 };
228 dma-channel@180 {
229 compatible = "fsl,p4080-dma-channel",
230 "fsl,eloplus-dma-channel";
231 reg = <0x180 0x80>;
232 cell-index = <3>;
233 interrupt-parent = <&mpic>;
234 interrupts = <35 2>;
235 };
236 };
237
238 spi@110000 {
239 cell-index = <0>;
240 #address-cells = <1>;
241 #size-cells = <0>;
242 compatible = "fsl,espi";
243 reg = <0x110000 0x1000>;
244 interrupts = <53 0x2>;
245 interrupt-parent = <&mpic>;
246 espi,num-ss-bits = <4>;
247 mode = "cpu";
248
249 fsl_m25p80@0 {
250 #address-cells = <1>;
251 #size-cells = <1>;
252 compatible = "fsl,espi-flash";
253 reg = <0>;
254 linux,modalias = "fsl_m25p80";
255 spi-max-frequency = <40000000>; /* input clock */
256 partition@u-boot {
257 label = "u-boot";
258 reg = <0x00000000 0x00100000>;
259 read-only;
260 };
261 partition@kernel {
262 label = "kernel";
263 reg = <0x00100000 0x00500000>;
264 read-only;
265 };
266 partition@dtb {
267 label = "dtb";
268 reg = <0x00600000 0x00100000>;
269 read-only;
270 };
271 partition@fs {
272 label = "file system";
273 reg = <0x00700000 0x00900000>;
274 };
275 };
276 };
277
278 sdhc: sdhc@114000 {
279 compatible = "fsl,p4080-esdhc", "fsl,esdhc";
280 reg = <0x114000 0x1000>;
281 interrupts = <48 2>;
282 interrupt-parent = <&mpic>;
283 };
284
285 i2c@118000 {
286 #address-cells = <1>;
287 #size-cells = <0>;
288 cell-index = <0>;
289 compatible = "fsl-i2c";
290 reg = <0x118000 0x100>;
291 interrupts = <38 2>;
292 interrupt-parent = <&mpic>;
293 dfsrr;
294 };
295
296 i2c@118100 {
297 #address-cells = <1>;
298 #size-cells = <0>;
299 cell-index = <1>;
300 compatible = "fsl-i2c";
301 reg = <0x118100 0x100>;
302 interrupts = <38 2>;
303 interrupt-parent = <&mpic>;
304 dfsrr;
305 eeprom@51 {
306 compatible = "at24,24c256";
307 reg = <0x51>;
308 };
309 eeprom@52 {
310 compatible = "at24,24c256";
311 reg = <0x52>;
312 };
313 rtc@68 {
314 compatible = "dallas,ds3232";
315 reg = <0x68>;
316 interrupts = <0 0x1>;
317 interrupt-parent = <&mpic>;
318 };
319 };
320
321 i2c@119000 {
322 #address-cells = <1>;
323 #size-cells = <0>;
324 cell-index = <2>;
325 compatible = "fsl-i2c";
326 reg = <0x119000 0x100>;
327 interrupts = <39 2>;
328 interrupt-parent = <&mpic>;
329 dfsrr;
330 };
331
332 i2c@119100 {
333 #address-cells = <1>;
334 #size-cells = <0>;
335 cell-index = <3>;
336 compatible = "fsl-i2c";
337 reg = <0x119100 0x100>;
338 interrupts = <39 2>;
339 interrupt-parent = <&mpic>;
340 dfsrr;
341 };
342
343 serial0: serial@11c500 {
344 cell-index = <0>;
345 device_type = "serial";
346 compatible = "ns16550";
347 reg = <0x11c500 0x100>;
348 clock-frequency = <0>;
349 interrupts = <36 2>;
350 interrupt-parent = <&mpic>;
351 };
352
353 serial1: serial@11c600 {
354 cell-index = <1>;
355 device_type = "serial";
356 compatible = "ns16550";
357 reg = <0x11c600 0x100>;
358 clock-frequency = <0>;
359 interrupts = <36 2>;
360 interrupt-parent = <&mpic>;
361 };
362
363 serial2: serial@11d500 {
364 cell-index = <2>;
365 device_type = "serial";
366 compatible = "ns16550";
367 reg = <0x11d500 0x100>;
368 clock-frequency = <0>;
369 interrupts = <37 2>;
370 interrupt-parent = <&mpic>;
371 };
372
373 serial3: serial@11d600 {
374 cell-index = <3>;
375 device_type = "serial";
376 compatible = "ns16550";
377 reg = <0x11d600 0x100>;
378 clock-frequency = <0>;
379 interrupts = <37 2>;
380 interrupt-parent = <&mpic>;
381 };
382
383 gpio0: gpio@130000 {
384 compatible = "fsl,p4080-gpio";
385 reg = <0x130000 0x1000>;
386 interrupts = <55 2>;
387 interrupt-parent = <&mpic>;
388 #gpio-cells = <2>;
389 gpio-controller;
390 };
391
392 usb0: usb@210000 {
393 compatible = "fsl,p4080-usb2-mph",
394 "fsl,mpc85xx-usb2-mph", "fsl-usb2-mph";
395 reg = <0x210000 0x1000>;
396 #address-cells = <1>;
397 #size-cells = <0>;
398 interrupt-parent = <&mpic>;
399 interrupts = <44 0x2>;
400 phy_type = "ulpi";
401 };
402
403 usb1: usb@211000 {
404 compatible = "fsl,p4080-usb2-dr",
405 "fsl,mpc85xx-usb2-dr", "fsl-usb2-dr";
406 reg = <0x211000 0x1000>;
407 #address-cells = <1>;
408 #size-cells = <0>;
409 interrupt-parent = <&mpic>;
410 interrupts = <45 0x2>;
411 dr_mode = "host";
412 phy_type = "ulpi";
413 };
414 };
415
416 rapidio0: rapidio@ffe0c0000 {
417 #address-cells = <2>;
418 #size-cells = <2>;
419 compatible = "fsl,rapidio-delta";
420 reg = <0xf 0xfe0c0000 0 0x20000>;
421 ranges = <0 0 0xf 0xf5000000 0 0x01000000>;
422 interrupt-parent = <&mpic>;
423 /* err_irq bell_outb_irq bell_inb_irq
424 msg1_tx_irq msg1_rx_irq msg2_tx_irq msg2_rx_irq */
425 interrupts = <16 2 56 2 57 2 60 2 61 2 62 2 63 2>;
426 };
427
428 localbus@ffe124000 {
429 compatible = "fsl,p4080-elbc", "fsl,elbc", "simple-bus";
430 reg = <0xf 0xfe124000 0 0x1000>;
431 interrupts = <25 2>;
432 #address-cells = <2>;
433 #size-cells = <1>;
434
435 ranges = <0 0 0xf 0xe8000000 0x08000000>;
436
437 flash@0,0 {
438 compatible = "cfi-flash";
439 reg = <0 0 0x08000000>;
440 bank-width = <2>;
441 device-width = <2>;
442 };
443 };
444
445 pci0: pcie@ffe200000 {
446 compatible = "fsl,p4080-pcie";
447 device_type = "pci";
448 #interrupt-cells = <1>;
449 #size-cells = <2>;
450 #address-cells = <3>;
451 reg = <0xf 0xfe200000 0 0x1000>;
452 bus-range = <0x0 0xff>;
453 ranges = <0x02000000 0 0xe0000000 0xc 0x00000000 0x0 0x20000000
454 0x01000000 0 0x00000000 0xf 0xf8000000 0x0 0x00010000>;
455 clock-frequency = <0x1fca055>;
456 interrupt-parent = <&mpic>;
457 interrupts = <16 2>;
458
459 interrupt-map-mask = <0xf800 0 0 7>;
460 interrupt-map = <
461 /* IDSEL 0x0 */
462 0000 0 0 1 &mpic 40 1
463 0000 0 0 2 &mpic 1 1
464 0000 0 0 3 &mpic 2 1
465 0000 0 0 4 &mpic 3 1
466 >;
467 pcie@0 {
468 reg = <0 0 0 0 0>;
469 #size-cells = <2>;
470 #address-cells = <3>;
471 device_type = "pci";
472 ranges = <0x02000000 0 0xe0000000
473 0x02000000 0 0xe0000000
474 0 0x20000000
475
476 0x01000000 0 0x00000000
477 0x01000000 0 0x00000000
478 0 0x00010000>;
479 };
480 };
481
482 pci1: pcie@ffe201000 {
483 compatible = "fsl,p4080-pcie";
484 device_type = "pci";
485 #interrupt-cells = <1>;
486 #size-cells = <2>;
487 #address-cells = <3>;
488 reg = <0xf 0xfe201000 0 0x1000>;
489 bus-range = <0 0xff>;
490 ranges = <0x02000000 0x0 0xe0000000 0xc 0x20000000 0x0 0x20000000
491 0x01000000 0x0 0x00000000 0xf 0xf8010000 0x0 0x00010000>;
492 clock-frequency = <0x1fca055>;
493 interrupt-parent = <&mpic>;
494 interrupts = <16 2>;
495 interrupt-map-mask = <0xf800 0 0 7>;
496 interrupt-map = <
497 /* IDSEL 0x0 */
498 0000 0 0 1 &mpic 41 1
499 0000 0 0 2 &mpic 5 1
500 0000 0 0 3 &mpic 6 1
501 0000 0 0 4 &mpic 7 1
502 >;
503 pcie@0 {
504 reg = <0 0 0 0 0>;
505 #size-cells = <2>;
506 #address-cells = <3>;
507 device_type = "pci";
508 ranges = <0x02000000 0 0xe0000000
509 0x02000000 0 0xe0000000
510 0 0x20000000
511
512 0x01000000 0 0x00000000
513 0x01000000 0 0x00000000
514 0 0x00010000>;
515 };
516 };
517
518 pci2: pcie@ffe202000 {
519 compatible = "fsl,p4080-pcie";
520 device_type = "pci";
521 #interrupt-cells = <1>;
522 #size-cells = <2>;
523 #address-cells = <3>;
524 reg = <0xf 0xfe202000 0 0x1000>;
525 bus-range = <0x0 0xff>;
526 ranges = <0x02000000 0 0xe0000000 0xc 0x40000000 0 0x20000000
527 0x01000000 0 0x00000000 0xf 0xf8020000 0 0x00010000>;
528 clock-frequency = <0x1fca055>;
529 interrupt-parent = <&mpic>;
530 interrupts = <16 2>;
531 interrupt-map-mask = <0xf800 0 0 7>;
532 interrupt-map = <
533 /* IDSEL 0x0 */
534 0000 0 0 1 &mpic 42 1
535 0000 0 0 2 &mpic 9 1
536 0000 0 0 3 &mpic 10 1
537 0000 0 0 4 &mpic 11 1
538 >;
539 pcie@0 {
540 reg = <0 0 0 0 0>;
541 #size-cells = <2>;
542 #address-cells = <3>;
543 device_type = "pci";
544 ranges = <0x02000000 0 0xe0000000
545 0x02000000 0 0xe0000000
546 0 0x20000000
547
548 0x01000000 0 0x00000000
549 0x01000000 0 0x00000000
550 0 0x00010000>;
551 };
552 };
553
554};
diff --git a/arch/powerpc/boot/dts/redwood.dts b/arch/powerpc/boot/dts/redwood.dts
index ad402c488741..d2af32e2bf7a 100644
--- a/arch/powerpc/boot/dts/redwood.dts
+++ b/arch/powerpc/boot/dts/redwood.dts
@@ -226,6 +226,7 @@
226 max-frame-size = <9000>; 226 max-frame-size = <9000>;
227 rx-fifo-size = <4096>; 227 rx-fifo-size = <4096>;
228 tx-fifo-size = <2048>; 228 tx-fifo-size = <2048>;
229 rx-fifo-size-gige = <16384>;
229 phy-mode = "rgmii"; 230 phy-mode = "rgmii";
230 phy-map = <0x00000000>; 231 phy-map = <0x00000000>;
231 rgmii-device = <&RGMII0>; 232 rgmii-device = <&RGMII0>;
diff --git a/arch/powerpc/boot/dts/yosemite.dts b/arch/powerpc/boot/dts/yosemite.dts
index 1fa3cb4c4ebb..64923245f0e5 100644
--- a/arch/powerpc/boot/dts/yosemite.dts
+++ b/arch/powerpc/boot/dts/yosemite.dts
@@ -282,20 +282,10 @@
282 /* Inbound 2GB range starting at 0 */ 282 /* Inbound 2GB range starting at 0 */
283 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x80000000>; 283 dma-ranges = <0x42000000 0x0 0x0 0x0 0x0 0x0 0x80000000>;
284 284
285 /* Bamboo has all 4 IRQ pins tied together per slot */
286 interrupt-map-mask = <0xf800 0x0 0x0 0x0>; 285 interrupt-map-mask = <0xf800 0x0 0x0 0x0>;
287 interrupt-map = < 286 interrupt-map = <
288 /* IDSEL 1 */ 287 /* IDSEL 12 */
289 0x800 0x0 0x0 0x0 &UIC0 0x1c 0x8 288 0x6000 0x0 0x0 0x0 &UIC0 0x19 0x8
290
291 /* IDSEL 2 */
292 0x1000 0x0 0x0 0x0 &UIC0 0x1b 0x8
293
294 /* IDSEL 3 */
295 0x1800 0x0 0x0 0x0 &UIC0 0x1a 0x8
296
297 /* IDSEL 4 */
298 0x2000 0x0 0x0 0x0 &UIC0 0x19 0x8
299 >; 289 >;
300 }; 290 };
301 }; 291 };
diff --git a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
index 28980738776c..6cd2cd65c2cd 100644
--- a/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
+++ b/arch/powerpc/configs/86xx/gef_ppc9a_defconfig
@@ -218,7 +218,7 @@ CONFIG_MPIC=y
218# CONFIG_MPIC_WEIRD is not set 218# CONFIG_MPIC_WEIRD is not set
219# CONFIG_PPC_I8259 is not set 219# CONFIG_PPC_I8259 is not set
220# CONFIG_PPC_RTAS is not set 220# CONFIG_PPC_RTAS is not set
221# CONFIG_MMIO_NVRAM is not set 221CONFIG_MMIO_NVRAM=y
222# CONFIG_PPC_MPC106 is not set 222# CONFIG_PPC_MPC106 is not set
223# CONFIG_PPC_970_NAP is not set 223# CONFIG_PPC_970_NAP is not set
224# CONFIG_PPC_INDIRECT_IO is not set 224# CONFIG_PPC_INDIRECT_IO is not set
diff --git a/arch/powerpc/configs/86xx/gef_sbc310_defconfig b/arch/powerpc/configs/86xx/gef_sbc310_defconfig
index e199d1cacbaf..a6a3768f7304 100644
--- a/arch/powerpc/configs/86xx/gef_sbc310_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc310_defconfig
@@ -218,7 +218,7 @@ CONFIG_MPIC=y
218# CONFIG_MPIC_WEIRD is not set 218# CONFIG_MPIC_WEIRD is not set
219# CONFIG_PPC_I8259 is not set 219# CONFIG_PPC_I8259 is not set
220# CONFIG_PPC_RTAS is not set 220# CONFIG_PPC_RTAS is not set
221# CONFIG_MMIO_NVRAM is not set 221CONFIG_MMIO_NVRAM=y
222# CONFIG_PPC_MPC106 is not set 222# CONFIG_PPC_MPC106 is not set
223# CONFIG_PPC_970_NAP is not set 223# CONFIG_PPC_970_NAP is not set
224# CONFIG_PPC_INDIRECT_IO is not set 224# CONFIG_PPC_INDIRECT_IO is not set
diff --git a/arch/powerpc/configs/86xx/gef_sbc610_defconfig b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
index 3b0fbfb28efd..1975d41e0763 100644
--- a/arch/powerpc/configs/86xx/gef_sbc610_defconfig
+++ b/arch/powerpc/configs/86xx/gef_sbc610_defconfig
@@ -219,7 +219,7 @@ CONFIG_MPIC=y
219# CONFIG_MPIC_WEIRD is not set 219# CONFIG_MPIC_WEIRD is not set
220# CONFIG_PPC_I8259 is not set 220# CONFIG_PPC_I8259 is not set
221# CONFIG_PPC_RTAS is not set 221# CONFIG_PPC_RTAS is not set
222# CONFIG_MMIO_NVRAM is not set 222CONFIG_MMIO_NVRAM=y
223# CONFIG_PPC_MPC106 is not set 223# CONFIG_PPC_MPC106 is not set
224# CONFIG_PPC_970_NAP is not set 224# CONFIG_PPC_970_NAP is not set
225# CONFIG_PPC_INDIRECT_IO is not set 225# CONFIG_PPC_INDIRECT_IO is not set
@@ -1124,7 +1124,7 @@ CONFIG_UNIX98_PTYS=y
1124# CONFIG_IPMI_HANDLER is not set 1124# CONFIG_IPMI_HANDLER is not set
1125CONFIG_HW_RANDOM=y 1125CONFIG_HW_RANDOM=y
1126# CONFIG_HW_RANDOM_TIMERIOMEM is not set 1126# CONFIG_HW_RANDOM_TIMERIOMEM is not set
1127# CONFIG_NVRAM is not set 1127CONFIG_NVRAM=y
1128# CONFIG_R3964 is not set 1128# CONFIG_R3964 is not set
1129# CONFIG_APPLICOM is not set 1129# CONFIG_APPLICOM is not set
1130# CONFIG_RAW_DRIVER is not set 1130# CONFIG_RAW_DRIVER is not set
diff --git a/arch/powerpc/include/asm/cpm.h b/arch/powerpc/include/asm/cpm.h
index 24d79e3abd8e..0835eb977ba9 100644
--- a/arch/powerpc/include/asm/cpm.h
+++ b/arch/powerpc/include/asm/cpm.h
@@ -3,8 +3,47 @@
3 3
4#include <linux/compiler.h> 4#include <linux/compiler.h>
5#include <linux/types.h> 5#include <linux/types.h>
6#include <linux/errno.h>
6#include <linux/of.h> 7#include <linux/of.h>
7 8
9/*
10 * USB Controller pram common to QE and CPM.
11 */
12struct usb_ctlr {
13 u8 usb_usmod;
14 u8 usb_usadr;
15 u8 usb_uscom;
16 u8 res1[1];
17 __be16 usb_usep[4];
18 u8 res2[4];
19 __be16 usb_usber;
20 u8 res3[2];
21 __be16 usb_usbmr;
22 u8 res4[1];
23 u8 usb_usbs;
24 /* Fields down below are QE-only */
25 __be16 usb_ussft;
26 u8 res5[2];
27 __be16 usb_usfrn;
28 u8 res6[0x22];
29} __attribute__ ((packed));
30
31/*
32 * Function code bits, usually generic to devices.
33 */
34#ifdef CONFIG_CPM1
35#define CPMFCR_GBL ((u_char)0x00) /* Flag doesn't exist in CPM1 */
36#define CPMFCR_TC2 ((u_char)0x00) /* Flag doesn't exist in CPM1 */
37#define CPMFCR_DTB ((u_char)0x00) /* Flag doesn't exist in CPM1 */
38#define CPMFCR_BDB ((u_char)0x00) /* Flag doesn't exist in CPM1 */
39#else
40#define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */
41#define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */
42#define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */
43#define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */
44#endif
45#define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */
46
8/* Opcodes common to CPM1 and CPM2 47/* Opcodes common to CPM1 and CPM2
9*/ 48*/
10#define CPM_CR_INIT_TRX ((ushort)0x0000) 49#define CPM_CR_INIT_TRX ((ushort)0x0000)
@@ -93,13 +132,56 @@ typedef struct cpm_buf_desc {
93#define BD_I2C_START (0x0400) 132#define BD_I2C_START (0x0400)
94 133
95int cpm_muram_init(void); 134int cpm_muram_init(void);
135
136#if defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE)
96unsigned long cpm_muram_alloc(unsigned long size, unsigned long align); 137unsigned long cpm_muram_alloc(unsigned long size, unsigned long align);
97int cpm_muram_free(unsigned long offset); 138int cpm_muram_free(unsigned long offset);
98unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size); 139unsigned long cpm_muram_alloc_fixed(unsigned long offset, unsigned long size);
99void __iomem *cpm_muram_addr(unsigned long offset); 140void __iomem *cpm_muram_addr(unsigned long offset);
100unsigned long cpm_muram_offset(void __iomem *addr); 141unsigned long cpm_muram_offset(void __iomem *addr);
101dma_addr_t cpm_muram_dma(void __iomem *addr); 142dma_addr_t cpm_muram_dma(void __iomem *addr);
143#else
144static inline unsigned long cpm_muram_alloc(unsigned long size,
145 unsigned long align)
146{
147 return -ENOSYS;
148}
149
150static inline int cpm_muram_free(unsigned long offset)
151{
152 return -ENOSYS;
153}
154
155static inline unsigned long cpm_muram_alloc_fixed(unsigned long offset,
156 unsigned long size)
157{
158 return -ENOSYS;
159}
160
161static inline void __iomem *cpm_muram_addr(unsigned long offset)
162{
163 return NULL;
164}
165
166static inline unsigned long cpm_muram_offset(void __iomem *addr)
167{
168 return -ENOSYS;
169}
170
171static inline dma_addr_t cpm_muram_dma(void __iomem *addr)
172{
173 return 0;
174}
175#endif /* defined(CONFIG_CPM) || defined(CONFIG_QUICC_ENGINE) */
176
177#ifdef CONFIG_CPM
102int cpm_command(u32 command, u8 opcode); 178int cpm_command(u32 command, u8 opcode);
179#else
180static inline int cpm_command(u32 command, u8 opcode)
181{
182 return -ENOSYS;
183}
184#endif /* CONFIG_CPM */
103 185
104int cpm2_gpiochip_add32(struct device_node *np); 186int cpm2_gpiochip_add32(struct device_node *np);
105 187
diff --git a/arch/powerpc/include/asm/cpm1.h b/arch/powerpc/include/asm/cpm1.h
index 7685ffde8821..81b01192f440 100644
--- a/arch/powerpc/include/asm/cpm1.h
+++ b/arch/powerpc/include/asm/cpm1.h
@@ -478,51 +478,6 @@ typedef struct iic {
478 char res2[2]; /* Reserved */ 478 char res2[2]; /* Reserved */
479} iic_t; 479} iic_t;
480 480
481/* SPI parameter RAM.
482*/
483typedef struct spi {
484 ushort spi_rbase; /* Rx Buffer descriptor base address */
485 ushort spi_tbase; /* Tx Buffer descriptor base address */
486 u_char spi_rfcr; /* Rx function code */
487 u_char spi_tfcr; /* Tx function code */
488 ushort spi_mrblr; /* Max receive buffer length */
489 uint spi_rstate; /* Internal */
490 uint spi_rdp; /* Internal */
491 ushort spi_rbptr; /* Internal */
492 ushort spi_rbc; /* Internal */
493 uint spi_rxtmp; /* Internal */
494 uint spi_tstate; /* Internal */
495 uint spi_tdp; /* Internal */
496 ushort spi_tbptr; /* Internal */
497 ushort spi_tbc; /* Internal */
498 uint spi_txtmp; /* Internal */
499 uint spi_res;
500 ushort spi_rpbase; /* Relocation pointer */
501 ushort spi_res2;
502} spi_t;
503
504/* SPI Mode register.
505*/
506#define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
507#define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
508#define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
509#define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
510#define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
511#define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
512#define SPMODE_EN ((ushort)0x0100) /* Enable */
513#define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
514#define SPMODE_LEN4 ((ushort)0x0030) /* 4 bits per char */
515#define SPMODE_LEN8 ((ushort)0x0070) /* 8 bits per char */
516#define SPMODE_LEN16 ((ushort)0x00f0) /* 16 bits per char */
517#define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
518
519/* SPIE fields */
520#define SPIE_MME 0x20
521#define SPIE_TXE 0x10
522#define SPIE_BSY 0x04
523#define SPIE_TXB 0x02
524#define SPIE_RXB 0x01
525
526/* 481/*
527 * RISC Controller Configuration Register definitons 482 * RISC Controller Configuration Register definitons
528 */ 483 */
diff --git a/arch/powerpc/include/asm/cpm2.h b/arch/powerpc/include/asm/cpm2.h
index 990ff191da8b..f42e9baf3a4e 100644
--- a/arch/powerpc/include/asm/cpm2.h
+++ b/arch/powerpc/include/asm/cpm2.h
@@ -124,14 +124,6 @@ static inline void cpm2_fastbrg(uint brg, uint rate, int div16)
124 __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT); 124 __cpm2_setbrg(brg, rate, CPM2_BRG_INT_CLK, div16, CPM_BRG_EXTC_INT);
125} 125}
126 126
127/* Function code bits, usually generic to devices.
128*/
129#define CPMFCR_GBL ((u_char)0x20) /* Set memory snooping */
130#define CPMFCR_EB ((u_char)0x10) /* Set big endian byte order */
131#define CPMFCR_TC2 ((u_char)0x04) /* Transfer code 2 value */
132#define CPMFCR_DTB ((u_char)0x02) /* Use local bus for data when set */
133#define CPMFCR_BDB ((u_char)0x01) /* Use local bus for BD when set */
134
135/* Parameter RAM offsets from the base. 127/* Parameter RAM offsets from the base.
136*/ 128*/
137#define PROFF_SCC1 ((uint)0x8000) 129#define PROFF_SCC1 ((uint)0x8000)
@@ -654,45 +646,6 @@ typedef struct iic {
654 uint iic_txtmp; /* Internal */ 646 uint iic_txtmp; /* Internal */
655} iic_t; 647} iic_t;
656 648
657/* SPI parameter RAM.
658*/
659typedef struct spi {
660 ushort spi_rbase; /* Rx Buffer descriptor base address */
661 ushort spi_tbase; /* Tx Buffer descriptor base address */
662 u_char spi_rfcr; /* Rx function code */
663 u_char spi_tfcr; /* Tx function code */
664 ushort spi_mrblr; /* Max receive buffer length */
665 uint spi_rstate; /* Internal */
666 uint spi_rdp; /* Internal */
667 ushort spi_rbptr; /* Internal */
668 ushort spi_rbc; /* Internal */
669 uint spi_rxtmp; /* Internal */
670 uint spi_tstate; /* Internal */
671 uint spi_tdp; /* Internal */
672 ushort spi_tbptr; /* Internal */
673 ushort spi_tbc; /* Internal */
674 uint spi_txtmp; /* Internal */
675 uint spi_res; /* Tx temp. */
676 uint spi_res1[4]; /* SDMA temp. */
677} spi_t;
678
679/* SPI Mode register.
680*/
681#define SPMODE_LOOP ((ushort)0x4000) /* Loopback */
682#define SPMODE_CI ((ushort)0x2000) /* Clock Invert */
683#define SPMODE_CP ((ushort)0x1000) /* Clock Phase */
684#define SPMODE_DIV16 ((ushort)0x0800) /* BRG/16 mode */
685#define SPMODE_REV ((ushort)0x0400) /* Reversed Data */
686#define SPMODE_MSTR ((ushort)0x0200) /* SPI Master */
687#define SPMODE_EN ((ushort)0x0100) /* Enable */
688#define SPMODE_LENMSK ((ushort)0x00f0) /* character length */
689#define SPMODE_PMMSK ((ushort)0x000f) /* prescale modulus */
690
691#define SPMODE_LEN(x) ((((x)-1)&0xF)<<4)
692#define SPMODE_PM(x) ((x) &0xF)
693
694#define SPI_EB ((u_char)0x10) /* big endian byte order */
695
696/* IDMA parameter RAM 649/* IDMA parameter RAM
697*/ 650*/
698typedef struct idma { 651typedef struct idma {
diff --git a/arch/powerpc/include/asm/exception-64s.h b/arch/powerpc/include/asm/exception-64s.h
index a98653b26231..57c400071995 100644
--- a/arch/powerpc/include/asm/exception-64s.h
+++ b/arch/powerpc/include/asm/exception-64s.h
@@ -147,6 +147,7 @@
147 .globl label##_pSeries; \ 147 .globl label##_pSeries; \
148label##_pSeries: \ 148label##_pSeries: \
149 HMT_MEDIUM; \ 149 HMT_MEDIUM; \
150 DO_KVM n; \
150 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ 151 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
151 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) 152 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
152 153
@@ -170,6 +171,7 @@ label##_pSeries: \
170 .globl label##_pSeries; \ 171 .globl label##_pSeries; \
171label##_pSeries: \ 172label##_pSeries: \
172 HMT_MEDIUM; \ 173 HMT_MEDIUM; \
174 DO_KVM n; \
173 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \ 175 mtspr SPRN_SPRG_SCRATCH0,r13; /* save r13 */ \
174 mfspr r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \ 176 mfspr r13,SPRN_SPRG_PACA; /* get paca address into r13 */ \
175 std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \ 177 std r9,PACA_EXGEN+EX_R9(r13); /* save r9, r10 */ \
diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h
index b1dafb6a9743..5856a66ab404 100644
--- a/arch/powerpc/include/asm/hugetlb.h
+++ b/arch/powerpc/include/asm/hugetlb.h
@@ -3,6 +3,10 @@
3 3
4#include <asm/page.h> 4#include <asm/page.h>
5 5
6pte_t *huge_pte_offset_and_shift(struct mm_struct *mm,
7 unsigned long addr, unsigned *shift);
8
9void flush_dcache_icache_hugepage(struct page *page);
6 10
7int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, 11int is_hugepage_only_range(struct mm_struct *mm, unsigned long addr,
8 unsigned long len); 12 unsigned long len);
@@ -11,12 +15,6 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
11 unsigned long end, unsigned long floor, 15 unsigned long end, unsigned long floor,
12 unsigned long ceiling); 16 unsigned long ceiling);
13 17
14void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
15 pte_t *ptep, pte_t pte);
16
17pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
18 pte_t *ptep);
19
20/* 18/*
21 * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs 19 * The version of vma_mmu_pagesize() in arch/powerpc/mm/hugetlbpage.c needs
22 * to override the version in mm/hugetlb.c 20 * to override the version in mm/hugetlb.c
@@ -42,9 +40,26 @@ static inline void hugetlb_prefault_arch_hook(struct mm_struct *mm)
42{ 40{
43} 41}
44 42
43
44static inline void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
45 pte_t *ptep, pte_t pte)
46{
47 set_pte_at(mm, addr, ptep, pte);
48}
49
50static inline pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
51 unsigned long addr, pte_t *ptep)
52{
53 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 1);
54 return __pte(old);
55}
56
45static inline void huge_ptep_clear_flush(struct vm_area_struct *vma, 57static inline void huge_ptep_clear_flush(struct vm_area_struct *vma,
46 unsigned long addr, pte_t *ptep) 58 unsigned long addr, pte_t *ptep)
47{ 59{
60 pte_t pte;
61 pte = huge_ptep_get_and_clear(vma->vm_mm, addr, ptep);
62 flush_tlb_page(vma, addr);
48} 63}
49 64
50static inline int huge_pte_none(pte_t pte) 65static inline int huge_pte_none(pte_t pte)
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index c27caac47ad1..f0275818b95c 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -212,6 +212,19 @@
212#define H_QUERY_INT_STATE 0x1E4 212#define H_QUERY_INT_STATE 0x1E4
213#define H_POLL_PENDING 0x1D8 213#define H_POLL_PENDING 0x1D8
214#define H_ILLAN_ATTRIBUTES 0x244 214#define H_ILLAN_ATTRIBUTES 0x244
215#define H_MODIFY_HEA_QP 0x250
216#define H_QUERY_HEA_QP 0x254
217#define H_QUERY_HEA 0x258
218#define H_QUERY_HEA_PORT 0x25C
219#define H_MODIFY_HEA_PORT 0x260
220#define H_REG_BCMC 0x264
221#define H_DEREG_BCMC 0x268
222#define H_REGISTER_HEA_RPAGES 0x26C
223#define H_DISABLE_AND_GET_HEA 0x270
224#define H_GET_HEA_INFO 0x274
225#define H_ALLOC_HEA_RESOURCE 0x278
226#define H_ADD_CONN 0x284
227#define H_DEL_CONN 0x288
215#define H_JOIN 0x298 228#define H_JOIN 0x298
216#define H_VASI_STATE 0x2A4 229#define H_VASI_STATE 0x2A4
217#define H_ENABLE_CRQ 0x2B0 230#define H_ENABLE_CRQ 0x2B0
diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index abbc2aaaced5..9f4c9d4f5803 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -64,11 +64,6 @@ extern void iseries_handle_interrupts(void);
64 get_paca()->hard_enabled = 0; \ 64 get_paca()->hard_enabled = 0; \
65 } while(0) 65 } while(0)
66 66
67static inline int irqs_disabled_flags(unsigned long flags)
68{
69 return flags == 0;
70}
71
72#else 67#else
73 68
74#if defined(CONFIG_BOOKE) 69#if defined(CONFIG_BOOKE)
diff --git a/arch/powerpc/include/asm/immap_cpm2.h b/arch/powerpc/include/asm/immap_cpm2.h
index d4f069bf0e57..7c64fda5357b 100644
--- a/arch/powerpc/include/asm/immap_cpm2.h
+++ b/arch/powerpc/include/asm/immap_cpm2.h
@@ -549,7 +549,7 @@ typedef struct comm_proc {
549 549
550/* USB Controller. 550/* USB Controller.
551*/ 551*/
552typedef struct usb_ctlr { 552typedef struct cpm_usb_ctlr {
553 u8 usb_usmod; 553 u8 usb_usmod;
554 u8 usb_usadr; 554 u8 usb_usadr;
555 u8 usb_uscom; 555 u8 usb_uscom;
diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h
index c346d0bcd230..4e10f508570a 100644
--- a/arch/powerpc/include/asm/immap_qe.h
+++ b/arch/powerpc/include/asm/immap_qe.h
@@ -210,7 +210,7 @@ struct sir {
210} __attribute__ ((packed)); 210} __attribute__ ((packed));
211 211
212/* USB Controller */ 212/* USB Controller */
213struct usb_ctlr { 213struct qe_usb_ctlr {
214 u8 usb_usmod; 214 u8 usb_usmod;
215 u8 usb_usadr; 215 u8 usb_usadr;
216 u8 usb_uscom; 216 u8 usb_uscom;
@@ -229,7 +229,7 @@ struct usb_ctlr {
229} __attribute__ ((packed)); 229} __attribute__ ((packed));
230 230
231/* MCC */ 231/* MCC */
232struct mcc { 232struct qe_mcc {
233 __be32 mcce; /* MCC event register */ 233 __be32 mcce; /* MCC event register */
234 __be32 mccm; /* MCC mask register */ 234 __be32 mccm; /* MCC mask register */
235 __be32 mccf; /* MCC configuration register */ 235 __be32 mccf; /* MCC configuration register */
@@ -431,9 +431,9 @@ struct qe_immap {
431 struct qe_mux qmx; /* QE Multiplexer */ 431 struct qe_mux qmx; /* QE Multiplexer */
432 struct qe_timers qet; /* QE Timers */ 432 struct qe_timers qet; /* QE Timers */
433 struct spi spi[0x2]; /* spi */ 433 struct spi spi[0x2]; /* spi */
434 struct mcc mcc; /* mcc */ 434 struct qe_mcc mcc; /* mcc */
435 struct qe_brg brg; /* brg */ 435 struct qe_brg brg; /* brg */
436 struct usb_ctlr usb; /* USB */ 436 struct qe_usb_ctlr usb; /* USB */
437 struct si1 si1; /* SI */ 437 struct si1 si1; /* SI */
438 u8 res11[0x800]; 438 u8 res11[0x800];
439 struct sir sir; /* SI Routing Tables */ 439 struct sir sir; /* SI Routing Tables */
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index bbcd1aaf3dfd..e054baef1845 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -17,8 +17,6 @@
17#include <asm/atomic.h> 17#include <asm/atomic.h>
18 18
19 19
20#define get_irq_desc(irq) (&irq_desc[(irq)])
21
22/* Define a way to iterate across irqs. */ 20/* Define a way to iterate across irqs. */
23#define for_each_irq(i) \ 21#define for_each_irq(i) \
24 for ((i) = 0; (i) < NR_IRQS; ++(i)) 22 for ((i) = 0; (i) < NR_IRQS; ++(i))
@@ -34,12 +32,15 @@ extern atomic_t ppc_n_lost_interrupts;
34 */ 32 */
35#define NO_IRQ_IGNORE ((unsigned int)-1) 33#define NO_IRQ_IGNORE ((unsigned int)-1)
36 34
37/* Total number of virq in the platform (make it a CONFIG_* option ? */ 35/* Total number of virq in the platform */
38#define NR_IRQS 512 36#define NR_IRQS CONFIG_NR_IRQS
39 37
40/* Number of irqs reserved for the legacy controller */ 38/* Number of irqs reserved for the legacy controller */
41#define NUM_ISA_INTERRUPTS 16 39#define NUM_ISA_INTERRUPTS 16
42 40
41/* Same thing, used by the generic IRQ code */
42#define NR_IRQS_LEGACY NUM_ISA_INTERRUPTS
43
43/* This type is the placeholder for a hardware interrupt number. It has to 44/* This type is the placeholder for a hardware interrupt number. It has to
44 * be big enough to enclose whatever representation is used by a given 45 * be big enough to enclose whatever representation is used by a given
45 * platform. 46 * platform.
@@ -99,7 +100,7 @@ struct irq_host_ops {
99 * interrupt controller has for that line) 100 * interrupt controller has for that line)
100 */ 101 */
101 int (*xlate)(struct irq_host *h, struct device_node *ctrler, 102 int (*xlate)(struct irq_host *h, struct device_node *ctrler,
102 u32 *intspec, unsigned int intsize, 103 const u32 *intspec, unsigned int intsize,
103 irq_hw_number_t *out_hwirq, unsigned int *out_type); 104 irq_hw_number_t *out_hwirq, unsigned int *out_type);
104}; 105};
105 106
@@ -313,7 +314,7 @@ extern void irq_free_virt(unsigned int virq, unsigned int count);
313 * of the of_irq_map_*() functions. 314 * of the of_irq_map_*() functions.
314 */ 315 */
315extern unsigned int irq_create_of_mapping(struct device_node *controller, 316extern unsigned int irq_create_of_mapping(struct device_node *controller,
316 u32 *intspec, unsigned int intsize); 317 const u32 *intspec, unsigned int intsize);
317 318
318/** 319/**
319 * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space 320 * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
diff --git a/arch/powerpc/include/asm/kvm.h b/arch/powerpc/include/asm/kvm.h
index bb2de6aa5ce0..81f3b0b5601e 100644
--- a/arch/powerpc/include/asm/kvm.h
+++ b/arch/powerpc/include/asm/kvm.h
@@ -46,6 +46,24 @@ struct kvm_regs {
46}; 46};
47 47
48struct kvm_sregs { 48struct kvm_sregs {
49 __u32 pvr;
50 union {
51 struct {
52 __u64 sdr1;
53 struct {
54 struct {
55 __u64 slbe;
56 __u64 slbv;
57 } slb[64];
58 } ppc64;
59 struct {
60 __u32 sr[16];
61 __u64 ibat[8];
62 __u64 dbat[8];
63 } ppc32;
64 } s;
65 __u8 pad[1020];
66 } u;
49}; 67};
50 68
51struct kvm_fpu { 69struct kvm_fpu {
diff --git a/arch/powerpc/include/asm/kvm_asm.h b/arch/powerpc/include/asm/kvm_asm.h
index 56bfae59837f..af2abe74f544 100644
--- a/arch/powerpc/include/asm/kvm_asm.h
+++ b/arch/powerpc/include/asm/kvm_asm.h
@@ -49,6 +49,46 @@
49#define BOOKE_INTERRUPT_SPE_FP_ROUND 34 49#define BOOKE_INTERRUPT_SPE_FP_ROUND 34
50#define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35 50#define BOOKE_INTERRUPT_PERFORMANCE_MONITOR 35
51 51
52/* book3s */
53
54#define BOOK3S_INTERRUPT_SYSTEM_RESET 0x100
55#define BOOK3S_INTERRUPT_MACHINE_CHECK 0x200
56#define BOOK3S_INTERRUPT_DATA_STORAGE 0x300
57#define BOOK3S_INTERRUPT_DATA_SEGMENT 0x380
58#define BOOK3S_INTERRUPT_INST_STORAGE 0x400
59#define BOOK3S_INTERRUPT_INST_SEGMENT 0x480
60#define BOOK3S_INTERRUPT_EXTERNAL 0x500
61#define BOOK3S_INTERRUPT_ALIGNMENT 0x600
62#define BOOK3S_INTERRUPT_PROGRAM 0x700
63#define BOOK3S_INTERRUPT_FP_UNAVAIL 0x800
64#define BOOK3S_INTERRUPT_DECREMENTER 0x900
65#define BOOK3S_INTERRUPT_SYSCALL 0xc00
66#define BOOK3S_INTERRUPT_TRACE 0xd00
67#define BOOK3S_INTERRUPT_PERFMON 0xf00
68#define BOOK3S_INTERRUPT_ALTIVEC 0xf20
69#define BOOK3S_INTERRUPT_VSX 0xf40
70
71#define BOOK3S_IRQPRIO_SYSTEM_RESET 0
72#define BOOK3S_IRQPRIO_DATA_SEGMENT 1
73#define BOOK3S_IRQPRIO_INST_SEGMENT 2
74#define BOOK3S_IRQPRIO_DATA_STORAGE 3
75#define BOOK3S_IRQPRIO_INST_STORAGE 4
76#define BOOK3S_IRQPRIO_ALIGNMENT 5
77#define BOOK3S_IRQPRIO_PROGRAM 6
78#define BOOK3S_IRQPRIO_FP_UNAVAIL 7
79#define BOOK3S_IRQPRIO_ALTIVEC 8
80#define BOOK3S_IRQPRIO_VSX 9
81#define BOOK3S_IRQPRIO_SYSCALL 10
82#define BOOK3S_IRQPRIO_MACHINE_CHECK 11
83#define BOOK3S_IRQPRIO_DEBUG 12
84#define BOOK3S_IRQPRIO_EXTERNAL 13
85#define BOOK3S_IRQPRIO_DECREMENTER 14
86#define BOOK3S_IRQPRIO_PERFORMANCE_MONITOR 15
87#define BOOK3S_IRQPRIO_MAX 16
88
89#define BOOK3S_HFLAG_DCBZ32 0x1
90#define BOOK3S_HFLAG_SLB 0x2
91
52#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */ 92#define RESUME_FLAG_NV (1<<0) /* Reload guest nonvolatile state? */
53#define RESUME_FLAG_HOST (1<<1) /* Resume host? */ 93#define RESUME_FLAG_HOST (1<<1) /* Resume host? */
54 94
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
new file mode 100644
index 000000000000..74b7369770d0
--- /dev/null
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -0,0 +1,139 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#ifndef __ASM_KVM_BOOK3S_H__
21#define __ASM_KVM_BOOK3S_H__
22
23#include <linux/types.h>
24#include <linux/kvm_host.h>
25#include <asm/kvm_ppc.h>
26
27struct kvmppc_slb {
28 u64 esid;
29 u64 vsid;
30 u64 orige;
31 u64 origv;
32 bool valid;
33 bool Ks;
34 bool Kp;
35 bool nx;
36 bool large;
37 bool class;
38};
39
40struct kvmppc_sr {
41 u32 raw;
42 u32 vsid;
43 bool Ks;
44 bool Kp;
45 bool nx;
46};
47
48struct kvmppc_bat {
49 u64 raw;
50 u32 bepi;
51 u32 bepi_mask;
52 bool vs;
53 bool vp;
54 u32 brpn;
55 u8 wimg;
56 u8 pp;
57};
58
59struct kvmppc_sid_map {
60 u64 guest_vsid;
61 u64 guest_esid;
62 u64 host_vsid;
63 bool valid;
64};
65
66#define SID_MAP_BITS 9
67#define SID_MAP_NUM (1 << SID_MAP_BITS)
68#define SID_MAP_MASK (SID_MAP_NUM - 1)
69
70struct kvmppc_vcpu_book3s {
71 struct kvm_vcpu vcpu;
72 struct kvmppc_sid_map sid_map[SID_MAP_NUM];
73 struct kvmppc_slb slb[64];
74 struct {
75 u64 esid;
76 u64 vsid;
77 } slb_shadow[64];
78 u8 slb_shadow_max;
79 struct kvmppc_sr sr[16];
80 struct kvmppc_bat ibat[8];
81 struct kvmppc_bat dbat[8];
82 u64 hid[6];
83 int slb_nr;
84 u64 sdr1;
85 u64 dsisr;
86 u64 hior;
87 u64 msr_mask;
88 u64 vsid_first;
89 u64 vsid_next;
90 u64 vsid_max;
91 int context_id;
92};
93
94#define CONTEXT_HOST 0
95#define CONTEXT_GUEST 1
96#define CONTEXT_GUEST_END 2
97
98#define VSID_REAL 0xfffffffffff00000
99#define VSID_REAL_DR 0xffffffffffe00000
100#define VSID_REAL_IR 0xffffffffffd00000
101#define VSID_BAT 0xffffffffffc00000
102#define VSID_PR 0x8000000000000000
103
104extern void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 ea, u64 ea_mask);
105extern void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 vp, u64 vp_mask);
106extern void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end);
107extern void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 new_msr);
108extern void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu);
109extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu);
110extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte);
111extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr);
112extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu);
113extern struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data);
114extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr, bool data);
115extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr);
116extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec);
117extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat,
118 bool upper, u32 val);
119
120extern u32 kvmppc_trampoline_lowmem;
121extern u32 kvmppc_trampoline_enter;
122
123static inline struct kvmppc_vcpu_book3s *to_book3s(struct kvm_vcpu *vcpu)
124{
125 return container_of(vcpu, struct kvmppc_vcpu_book3s, vcpu);
126}
127
128static inline ulong dsisr(void)
129{
130 ulong r;
131 asm ( "mfdsisr %0 " : "=r" (r) );
132 return r;
133}
134
135extern void kvm_return_point(void);
136
137#define INS_DCBZ 0x7c0007ec
138
139#endif /* __ASM_KVM_BOOK3S_H__ */
diff --git a/arch/powerpc/include/asm/kvm_book3s_64_asm.h b/arch/powerpc/include/asm/kvm_book3s_64_asm.h
new file mode 100644
index 000000000000..2e06ee8184ef
--- /dev/null
+++ b/arch/powerpc/include/asm/kvm_book3s_64_asm.h
@@ -0,0 +1,58 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#ifndef __ASM_KVM_BOOK3S_ASM_H__
21#define __ASM_KVM_BOOK3S_ASM_H__
22
23#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
24
25#include <asm/kvm_asm.h>
26
27.macro DO_KVM intno
28 .if (\intno == BOOK3S_INTERRUPT_SYSTEM_RESET) || \
29 (\intno == BOOK3S_INTERRUPT_MACHINE_CHECK) || \
30 (\intno == BOOK3S_INTERRUPT_DATA_STORAGE) || \
31 (\intno == BOOK3S_INTERRUPT_INST_STORAGE) || \
32 (\intno == BOOK3S_INTERRUPT_DATA_SEGMENT) || \
33 (\intno == BOOK3S_INTERRUPT_INST_SEGMENT) || \
34 (\intno == BOOK3S_INTERRUPT_EXTERNAL) || \
35 (\intno == BOOK3S_INTERRUPT_ALIGNMENT) || \
36 (\intno == BOOK3S_INTERRUPT_PROGRAM) || \
37 (\intno == BOOK3S_INTERRUPT_FP_UNAVAIL) || \
38 (\intno == BOOK3S_INTERRUPT_DECREMENTER) || \
39 (\intno == BOOK3S_INTERRUPT_SYSCALL) || \
40 (\intno == BOOK3S_INTERRUPT_TRACE) || \
41 (\intno == BOOK3S_INTERRUPT_PERFMON) || \
42 (\intno == BOOK3S_INTERRUPT_ALTIVEC) || \
43 (\intno == BOOK3S_INTERRUPT_VSX)
44
45 b kvmppc_trampoline_\intno
46kvmppc_resume_\intno:
47
48 .endif
49.endm
50
51#else
52
53.macro DO_KVM intno
54.endm
55
56#endif /* CONFIG_KVM_BOOK3S_64_HANDLER */
57
58#endif /* __ASM_KVM_BOOK3S_ASM_H__ */
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index c9c930ed11d7..1201f62d0d73 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -21,7 +21,8 @@
21#define __POWERPC_KVM_HOST_H__ 21#define __POWERPC_KVM_HOST_H__
22 22
23#include <linux/mutex.h> 23#include <linux/mutex.h>
24#include <linux/timer.h> 24#include <linux/hrtimer.h>
25#include <linux/interrupt.h>
25#include <linux/types.h> 26#include <linux/types.h>
26#include <linux/kvm_types.h> 27#include <linux/kvm_types.h>
27#include <asm/kvm_asm.h> 28#include <asm/kvm_asm.h>
@@ -37,6 +38,8 @@
37#define KVM_NR_PAGE_SIZES 1 38#define KVM_NR_PAGE_SIZES 1
38#define KVM_PAGES_PER_HPAGE(x) (1UL<<31) 39#define KVM_PAGES_PER_HPAGE(x) (1UL<<31)
39 40
41#define HPTEG_CACHE_NUM 1024
42
40struct kvm; 43struct kvm;
41struct kvm_run; 44struct kvm_run;
42struct kvm_vcpu; 45struct kvm_vcpu;
@@ -63,6 +66,17 @@ struct kvm_vcpu_stat {
63 u32 dec_exits; 66 u32 dec_exits;
64 u32 ext_intr_exits; 67 u32 ext_intr_exits;
65 u32 halt_wakeup; 68 u32 halt_wakeup;
69#ifdef CONFIG_PPC64
70 u32 pf_storage;
71 u32 pf_instruc;
72 u32 sp_storage;
73 u32 sp_instruc;
74 u32 queue_intr;
75 u32 ld;
76 u32 ld_slow;
77 u32 st;
78 u32 st_slow;
79#endif
66}; 80};
67 81
68enum kvm_exit_types { 82enum kvm_exit_types {
@@ -109,9 +123,53 @@ struct kvmppc_exit_timing {
109struct kvm_arch { 123struct kvm_arch {
110}; 124};
111 125
126struct kvmppc_pte {
127 u64 eaddr;
128 u64 vpage;
129 u64 raddr;
130 bool may_read;
131 bool may_write;
132 bool may_execute;
133};
134
135struct kvmppc_mmu {
136 /* book3s_64 only */
137 void (*slbmte)(struct kvm_vcpu *vcpu, u64 rb, u64 rs);
138 u64 (*slbmfee)(struct kvm_vcpu *vcpu, u64 slb_nr);
139 u64 (*slbmfev)(struct kvm_vcpu *vcpu, u64 slb_nr);
140 void (*slbie)(struct kvm_vcpu *vcpu, u64 slb_nr);
141 void (*slbia)(struct kvm_vcpu *vcpu);
142 /* book3s */
143 void (*mtsrin)(struct kvm_vcpu *vcpu, u32 srnum, ulong value);
144 u32 (*mfsrin)(struct kvm_vcpu *vcpu, u32 srnum);
145 int (*xlate)(struct kvm_vcpu *vcpu, gva_t eaddr, struct kvmppc_pte *pte, bool data);
146 void (*reset_msr)(struct kvm_vcpu *vcpu);
147 void (*tlbie)(struct kvm_vcpu *vcpu, ulong addr, bool large);
148 int (*esid_to_vsid)(struct kvm_vcpu *vcpu, u64 esid, u64 *vsid);
149 u64 (*ea_to_vp)(struct kvm_vcpu *vcpu, gva_t eaddr, bool data);
150 bool (*is_dcbz32)(struct kvm_vcpu *vcpu);
151};
152
153struct hpte_cache {
154 u64 host_va;
155 u64 pfn;
156 ulong slot;
157 struct kvmppc_pte pte;
158};
159
112struct kvm_vcpu_arch { 160struct kvm_vcpu_arch {
113 u32 host_stack; 161 ulong host_stack;
114 u32 host_pid; 162 u32 host_pid;
163#ifdef CONFIG_PPC64
164 ulong host_msr;
165 ulong host_r2;
166 void *host_retip;
167 ulong trampoline_lowmem;
168 ulong trampoline_enter;
169 ulong highmem_handler;
170 ulong host_paca_phys;
171 struct kvmppc_mmu mmu;
172#endif
115 173
116 u64 fpr[32]; 174 u64 fpr[32];
117 ulong gpr[32]; 175 ulong gpr[32];
@@ -123,6 +181,10 @@ struct kvm_vcpu_arch {
123 ulong xer; 181 ulong xer;
124 182
125 ulong msr; 183 ulong msr;
184#ifdef CONFIG_PPC64
185 ulong shadow_msr;
186 ulong hflags;
187#endif
126 u32 mmucr; 188 u32 mmucr;
127 ulong sprg0; 189 ulong sprg0;
128 ulong sprg1; 190 ulong sprg1;
@@ -149,6 +211,7 @@ struct kvm_vcpu_arch {
149 u32 ivor[64]; 211 u32 ivor[64];
150 ulong ivpr; 212 ulong ivpr;
151 u32 pir; 213 u32 pir;
214 u32 pvr;
152 215
153 u32 shadow_pid; 216 u32 shadow_pid;
154 u32 pid; 217 u32 pid;
@@ -174,6 +237,9 @@ struct kvm_vcpu_arch {
174#endif 237#endif
175 238
176 u32 last_inst; 239 u32 last_inst;
240#ifdef CONFIG_PPC64
241 ulong fault_dsisr;
242#endif
177 ulong fault_dear; 243 ulong fault_dear;
178 ulong fault_esr; 244 ulong fault_esr;
179 gpa_t paddr_accessed; 245 gpa_t paddr_accessed;
@@ -185,8 +251,15 @@ struct kvm_vcpu_arch {
185 251
186 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */ 252 u32 cpr0_cfgaddr; /* holds the last set cpr0_cfgaddr */
187 253
188 struct timer_list dec_timer; 254 struct hrtimer dec_timer;
255 struct tasklet_struct tasklet;
256 u64 dec_jiffies;
189 unsigned long pending_exceptions; 257 unsigned long pending_exceptions;
258
259#ifdef CONFIG_PPC64
260 struct hpte_cache hpte_cache[HPTEG_CACHE_NUM];
261 int hpte_cache_offset;
262#endif
190}; 263};
191 264
192#endif /* __POWERPC_KVM_HOST_H__ */ 265#endif /* __POWERPC_KVM_HOST_H__ */
diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
index 2c6ee349df5e..269ee46ab028 100644
--- a/arch/powerpc/include/asm/kvm_ppc.h
+++ b/arch/powerpc/include/asm/kvm_ppc.h
@@ -39,6 +39,7 @@ enum emulation_result {
39extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu); 39extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
40extern char kvmppc_handlers_start[]; 40extern char kvmppc_handlers_start[];
41extern unsigned long kvmppc_handler_len; 41extern unsigned long kvmppc_handler_len;
42extern void kvmppc_handler_highmem(void);
42 43
43extern void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu); 44extern void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu);
44extern int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu, 45extern int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
diff --git a/arch/powerpc/include/asm/lppaca.h b/arch/powerpc/include/asm/lppaca.h
index f78f65c38f05..14b592dfb4e8 100644
--- a/arch/powerpc/include/asm/lppaca.h
+++ b/arch/powerpc/include/asm/lppaca.h
@@ -100,7 +100,14 @@ struct lppaca {
100 // Used to pass parms from the OS to PLIC for SetAsrAndRfid 100 // Used to pass parms from the OS to PLIC for SetAsrAndRfid
101 u64 saved_gpr3; // Saved GPR3 x20-x27 101 u64 saved_gpr3; // Saved GPR3 x20-x27
102 u64 saved_gpr4; // Saved GPR4 x28-x2F 102 u64 saved_gpr4; // Saved GPR4 x28-x2F
103 u64 saved_gpr5; // Saved GPR5 x30-x37 103 union {
104 u64 saved_gpr5; /* Saved GPR5 x30-x37 */
105 struct {
106 u8 cede_latency_hint; /* x30 */
107 u8 reserved[7]; /* x31-x36 */
108 } fields;
109 } gpr5_dword;
110
104 111
105 u8 dtl_enable_mask; // Dispatch Trace Log mask x38-x38 112 u8 dtl_enable_mask; // Dispatch Trace Log mask x38-x38
106 u8 donate_dedicated_cpu; // Donate dedicated CPU cycles x39-x39 113 u8 donate_dedicated_cpu; // Donate dedicated CPU cycles x39-x39
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 9efa2be78331..9f0fc9e6ce0d 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -266,6 +266,11 @@ struct machdep_calls {
266 void (*suspend_disable_irqs)(void); 266 void (*suspend_disable_irqs)(void);
267 void (*suspend_enable_irqs)(void); 267 void (*suspend_enable_irqs)(void);
268#endif 268#endif
269
270#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
271 ssize_t (*cpu_probe)(const char *, size_t);
272 ssize_t (*cpu_release)(const char *, size_t);
273#endif
269}; 274};
270 275
271extern void e500_idle(void); 276extern void e500_idle(void);
diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
index 079c06eae446..a062c57696d0 100644
--- a/arch/powerpc/include/asm/macio.h
+++ b/arch/powerpc/include/asm/macio.h
@@ -39,6 +39,7 @@ struct macio_dev
39 struct macio_bus *bus; /* macio bus this device is on */ 39 struct macio_bus *bus; /* macio bus this device is on */
40 struct macio_dev *media_bay; /* Device is part of a media bay */ 40 struct macio_dev *media_bay; /* Device is part of a media bay */
41 struct of_device ofdev; 41 struct of_device ofdev;
42 struct device_dma_parameters dma_parms; /* ide needs that */
42 int n_resources; 43 int n_resources;
43 struct resource resource[MACIO_DEV_COUNT_RESOURCES]; 44 struct resource resource[MACIO_DEV_COUNT_RESOURCES];
44 int n_interrupts; 45 int n_interrupts;
@@ -78,6 +79,8 @@ static inline unsigned long macio_resource_len(struct macio_dev *dev, int resour
78 return res->end - res->start + 1; 79 return res->end - res->start + 1;
79} 80}
80 81
82extern int macio_enable_devres(struct macio_dev *dev);
83
81extern int macio_request_resource(struct macio_dev *dev, int resource_no, const char *name); 84extern int macio_request_resource(struct macio_dev *dev, int resource_no, const char *name);
82extern void macio_release_resource(struct macio_dev *dev, int resource_no); 85extern void macio_release_resource(struct macio_dev *dev, int resource_no);
83extern int macio_request_resources(struct macio_dev *dev, const char *name); 86extern int macio_request_resources(struct macio_dev *dev, const char *name);
@@ -131,6 +134,9 @@ struct macio_driver
131 int (*resume)(struct macio_dev* dev); 134 int (*resume)(struct macio_dev* dev);
132 int (*shutdown)(struct macio_dev* dev); 135 int (*shutdown)(struct macio_dev* dev);
133 136
137#ifdef CONFIG_PMAC_MEDIABAY
138 void (*mediabay_event)(struct macio_dev* dev, int mb_state);
139#endif
134 struct device_driver driver; 140 struct device_driver driver;
135}; 141};
136#define to_macio_driver(drv) container_of(drv,struct macio_driver, driver) 142#define to_macio_driver(drv) container_of(drv,struct macio_driver, driver)
diff --git a/arch/powerpc/include/asm/mediabay.h b/arch/powerpc/include/asm/mediabay.h
index b2efb3325808..11037a4133ee 100644
--- a/arch/powerpc/include/asm/mediabay.h
+++ b/arch/powerpc/include/asm/mediabay.h
@@ -17,26 +17,31 @@
17#define MB_POWER 6 /* media bay contains a Power device (???) */ 17#define MB_POWER 6 /* media bay contains a Power device (???) */
18#define MB_NO 7 /* media bay contains nothing */ 18#define MB_NO 7 /* media bay contains nothing */
19 19
20/* Number of bays in the machine or 0 */ 20struct macio_dev;
21extern int media_bay_count;
22 21
23#ifdef CONFIG_BLK_DEV_IDE_PMAC 22#ifdef CONFIG_PMAC_MEDIABAY
24#include <linux/ide.h>
25 23
26int check_media_bay_by_base(unsigned long base, int what); 24/* Check the content type of the bay, returns MB_NO if the bay is still
27/* called by IDE PMAC host driver to register IDE controller for media bay */ 25 * transitionning
28int media_bay_set_ide_infos(struct device_node *which_bay, unsigned long base, 26 */
29 int irq, ide_hwif_t *hwif); 27extern int check_media_bay(struct macio_dev *bay);
30 28
31int check_media_bay(struct device_node *which_bay, int what); 29/* The ATA driver uses the calls below to temporarily hold on the
30 * media bay callbacks while initializing the interface
31 */
32extern void lock_media_bay(struct macio_dev *bay);
33extern void unlock_media_bay(struct macio_dev *bay);
32 34
33#else 35#else
34 36
35static inline int check_media_bay(struct device_node *which_bay, int what) 37static inline int check_media_bay(struct macio_dev *bay)
36{ 38{
37 return -ENODEV; 39 return MB_NO;
38} 40}
39 41
42static inline void lock_media_bay(struct macio_dev *bay) { }
43static inline void unlock_media_bay(struct macio_dev *bay) { }
44
40#endif 45#endif
41 46
42#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/mmu-hash64.h b/arch/powerpc/include/asm/mmu-hash64.h
index bebe31c2e907..2102b214a87c 100644
--- a/arch/powerpc/include/asm/mmu-hash64.h
+++ b/arch/powerpc/include/asm/mmu-hash64.h
@@ -173,14 +173,6 @@ extern unsigned long tce_alloc_start, tce_alloc_end;
173 */ 173 */
174extern int mmu_ci_restrictions; 174extern int mmu_ci_restrictions;
175 175
176#ifdef CONFIG_HUGETLB_PAGE
177/*
178 * The page size indexes of the huge pages for use by hugetlbfs
179 */
180extern unsigned int mmu_huge_psizes[MMU_PAGE_COUNT];
181
182#endif /* CONFIG_HUGETLB_PAGE */
183
184/* 176/*
185 * This function sets the AVPN and L fields of the HPTE appropriately 177 * This function sets the AVPN and L fields of the HPTE appropriately
186 * for the page size 178 * for the page size
@@ -253,10 +245,11 @@ extern int __hash_page_64K(unsigned long ea, unsigned long access,
253 unsigned long vsid, pte_t *ptep, unsigned long trap, 245 unsigned long vsid, pte_t *ptep, unsigned long trap,
254 unsigned int local, int ssize); 246 unsigned int local, int ssize);
255struct mm_struct; 247struct mm_struct;
248unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap);
256extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); 249extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap);
257extern int hash_huge_page(struct mm_struct *mm, unsigned long access, 250int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
258 unsigned long ea, unsigned long vsid, int local, 251 pte_t *ptep, unsigned long trap, int local, int ssize,
259 unsigned long trap); 252 unsigned int shift, unsigned int mmu_psize);
260 253
261extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend, 254extern int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
262 unsigned long pstart, unsigned long prot, 255 unsigned long pstart, unsigned long prot,
@@ -380,6 +373,38 @@ extern void slb_set_size(u16 size);
380 373
381#ifndef __ASSEMBLY__ 374#ifndef __ASSEMBLY__
382 375
376#ifdef CONFIG_PPC_SUBPAGE_PROT
377/*
378 * For the sub-page protection option, we extend the PGD with one of
379 * these. Basically we have a 3-level tree, with the top level being
380 * the protptrs array. To optimize speed and memory consumption when
381 * only addresses < 4GB are being protected, pointers to the first
382 * four pages of sub-page protection words are stored in the low_prot
383 * array.
384 * Each page of sub-page protection words protects 1GB (4 bytes
385 * protects 64k). For the 3-level tree, each page of pointers then
386 * protects 8TB.
387 */
388struct subpage_prot_table {
389 unsigned long maxaddr; /* only addresses < this are protected */
390 unsigned int **protptrs[2];
391 unsigned int *low_prot[4];
392};
393
394#define SBP_L1_BITS (PAGE_SHIFT - 2)
395#define SBP_L2_BITS (PAGE_SHIFT - 3)
396#define SBP_L1_COUNT (1 << SBP_L1_BITS)
397#define SBP_L2_COUNT (1 << SBP_L2_BITS)
398#define SBP_L2_SHIFT (PAGE_SHIFT + SBP_L1_BITS)
399#define SBP_L3_SHIFT (SBP_L2_SHIFT + SBP_L2_BITS)
400
401extern void subpage_prot_free(struct mm_struct *mm);
402extern void subpage_prot_init_new_context(struct mm_struct *mm);
403#else
404static inline void subpage_prot_free(struct mm_struct *mm) {}
405static inline void subpage_prot_init_new_context(struct mm_struct *mm) { }
406#endif /* CONFIG_PPC_SUBPAGE_PROT */
407
383typedef unsigned long mm_context_id_t; 408typedef unsigned long mm_context_id_t;
384 409
385typedef struct { 410typedef struct {
@@ -393,6 +418,9 @@ typedef struct {
393 u16 sllp; /* SLB page size encoding */ 418 u16 sllp; /* SLB page size encoding */
394#endif 419#endif
395 unsigned long vdso_base; 420 unsigned long vdso_base;
421#ifdef CONFIG_PPC_SUBPAGE_PROT
422 struct subpage_prot_table spt;
423#endif /* CONFIG_PPC_SUBPAGE_PROT */
396} mm_context_t; 424} mm_context_t;
397 425
398 426
diff --git a/arch/powerpc/include/asm/mmu_context.h b/arch/powerpc/include/asm/mmu_context.h
index b34e94d94435..26383e0778aa 100644
--- a/arch/powerpc/include/asm/mmu_context.h
+++ b/arch/powerpc/include/asm/mmu_context.h
@@ -23,6 +23,8 @@ extern void switch_slb(struct task_struct *tsk, struct mm_struct *mm);
23extern void set_context(unsigned long id, pgd_t *pgd); 23extern void set_context(unsigned long id, pgd_t *pgd);
24 24
25#ifdef CONFIG_PPC_BOOK3S_64 25#ifdef CONFIG_PPC_BOOK3S_64
26extern int __init_new_context(void);
27extern void __destroy_context(int context_id);
26static inline void mmu_context_init(void) { } 28static inline void mmu_context_init(void) { }
27#else 29#else
28extern void mmu_context_init(void); 30extern void mmu_context_init(void);
diff --git a/arch/powerpc/include/asm/mpc52xx.h b/arch/powerpc/include/asm/mpc52xx.h
index 1b4f697abbdd..b664ce79a172 100644
--- a/arch/powerpc/include/asm/mpc52xx.h
+++ b/arch/powerpc/include/asm/mpc52xx.h
@@ -276,6 +276,53 @@ extern int mpc52xx_set_psc_clkdiv(int psc_id, int clkdiv);
276extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node); 276extern unsigned int mpc52xx_get_xtal_freq(struct device_node *node);
277extern void mpc52xx_restart(char *cmd); 277extern void mpc52xx_restart(char *cmd);
278 278
279/* mpc52xx_gpt.c */
280struct mpc52xx_gpt_priv;
281extern struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq);
282extern int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period,
283 int continuous);
284extern u64 mpc52xx_gpt_timer_period(struct mpc52xx_gpt_priv *gpt);
285extern int mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt);
286
287/* mpc52xx_lpbfifo.c */
288#define MPC52XX_LPBFIFO_FLAG_READ (0)
289#define MPC52XX_LPBFIFO_FLAG_WRITE (1<<0)
290#define MPC52XX_LPBFIFO_FLAG_NO_INCREMENT (1<<1)
291#define MPC52XX_LPBFIFO_FLAG_NO_DMA (1<<2)
292#define MPC52XX_LPBFIFO_FLAG_POLL_DMA (1<<3)
293
294struct mpc52xx_lpbfifo_request {
295 struct list_head list;
296
297 /* localplus bus address */
298 unsigned int cs;
299 size_t offset;
300
301 /* Memory address */
302 void *data;
303 phys_addr_t data_phys;
304
305 /* Details of transfer */
306 size_t size;
307 size_t pos; /* current position of transfer */
308 int flags;
309
310 /* What to do when finished */
311 void (*callback)(struct mpc52xx_lpbfifo_request *);
312
313 void *priv; /* Driver private data */
314
315 /* statistics */
316 int irq_count;
317 int irq_ticks;
318 u8 last_byte;
319 int buffer_not_done_cnt;
320};
321
322extern int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req);
323extern void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req);
324extern void mpc52xx_lpbfifo_poll(void);
325
279/* mpc52xx_pic.c */ 326/* mpc52xx_pic.c */
280extern void mpc52xx_init_irq(void); 327extern void mpc52xx_init_irq(void);
281extern unsigned int mpc52xx_get_irq(void); 328extern unsigned int mpc52xx_get_irq(void);
diff --git a/arch/powerpc/include/asm/nvram.h b/arch/powerpc/include/asm/nvram.h
index 6c587eddee59..850b72f27445 100644
--- a/arch/powerpc/include/asm/nvram.h
+++ b/arch/powerpc/include/asm/nvram.h
@@ -73,7 +73,6 @@ extern int nvram_write_error_log(char * buff, int length,
73extern int nvram_read_error_log(char * buff, int length, 73extern int nvram_read_error_log(char * buff, int length,
74 unsigned int * err_type, unsigned int *err_seq); 74 unsigned int * err_type, unsigned int *err_seq);
75extern int nvram_clear_error_log(void); 75extern int nvram_clear_error_log(void);
76extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
77 76
78extern int pSeries_nvram_init(void); 77extern int pSeries_nvram_init(void);
79 78
diff --git a/arch/powerpc/include/asm/pSeries_reconfig.h b/arch/powerpc/include/asm/pSeries_reconfig.h
index e482e5352e69..d4b4bfa26fb3 100644
--- a/arch/powerpc/include/asm/pSeries_reconfig.h
+++ b/arch/powerpc/include/asm/pSeries_reconfig.h
@@ -17,6 +17,7 @@
17#ifdef CONFIG_PPC_PSERIES 17#ifdef CONFIG_PPC_PSERIES
18extern int pSeries_reconfig_notifier_register(struct notifier_block *); 18extern int pSeries_reconfig_notifier_register(struct notifier_block *);
19extern void pSeries_reconfig_notifier_unregister(struct notifier_block *); 19extern void pSeries_reconfig_notifier_unregister(struct notifier_block *);
20extern struct blocking_notifier_head pSeries_reconfig_chain;
20#else /* !CONFIG_PPC_PSERIES */ 21#else /* !CONFIG_PPC_PSERIES */
21static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb) 22static inline int pSeries_reconfig_notifier_register(struct notifier_block *nb)
22{ 23{
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 7d8514ceceae..5e9b4ef71415 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -129,6 +129,15 @@ struct paca_struct {
129 u64 system_time; /* accumulated system TB ticks */ 129 u64 system_time; /* accumulated system TB ticks */
130 u64 startpurr; /* PURR/TB value snapshot */ 130 u64 startpurr; /* PURR/TB value snapshot */
131 u64 startspurr; /* SPURR value snapshot */ 131 u64 startspurr; /* SPURR value snapshot */
132
133#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
134 struct {
135 u64 esid;
136 u64 vsid;
137 } kvm_slb[64]; /* guest SLB */
138 u8 kvm_slb_max; /* highest used guest slb entry */
139 u8 kvm_in_guest; /* are we inside the guest? */
140#endif
132}; 141};
133 142
134extern struct paca_struct paca[]; 143extern struct paca_struct paca[];
diff --git a/arch/powerpc/include/asm/page.h b/arch/powerpc/include/asm/page.h
index ff24254990e1..e96d52a516ba 100644
--- a/arch/powerpc/include/asm/page.h
+++ b/arch/powerpc/include/asm/page.h
@@ -229,6 +229,20 @@ typedef unsigned long pgprot_t;
229 229
230#endif 230#endif
231 231
232typedef struct { signed long pd; } hugepd_t;
233#define HUGEPD_SHIFT_MASK 0x3f
234
235#ifdef CONFIG_HUGETLB_PAGE
236static inline int hugepd_ok(hugepd_t hpd)
237{
238 return (hpd.pd > 0);
239}
240
241#define is_hugepd(pdep) (hugepd_ok(*((hugepd_t *)(pdep))))
242#else /* CONFIG_HUGETLB_PAGE */
243#define is_hugepd(pdep) 0
244#endif /* CONFIG_HUGETLB_PAGE */
245
232struct page; 246struct page;
233extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg); 247extern void clear_user_page(void *page, unsigned long vaddr, struct page *pg);
234extern void copy_user_page(void *to, void *from, unsigned long vaddr, 248extern void copy_user_page(void *to, void *from, unsigned long vaddr,
diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h
index 3f17b83f55a1..bfc4e027e2ad 100644
--- a/arch/powerpc/include/asm/page_64.h
+++ b/arch/powerpc/include/asm/page_64.h
@@ -90,7 +90,7 @@ extern unsigned int HPAGE_SHIFT;
90#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT) 90#define HPAGE_SIZE ((1UL) << HPAGE_SHIFT)
91#define HPAGE_MASK (~(HPAGE_SIZE - 1)) 91#define HPAGE_MASK (~(HPAGE_SIZE - 1))
92#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT) 92#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
93#define HUGE_MAX_HSTATE 3 93#define HUGE_MAX_HSTATE (MMU_PAGE_COUNT-1)
94 94
95#endif /* __ASSEMBLY__ */ 95#endif /* __ASSEMBLY__ */
96 96
diff --git a/arch/powerpc/include/asm/pgalloc-32.h b/arch/powerpc/include/asm/pgalloc-32.h
index c9500d666a1d..580cf73b96e8 100644
--- a/arch/powerpc/include/asm/pgalloc-32.h
+++ b/arch/powerpc/include/asm/pgalloc-32.h
@@ -3,7 +3,8 @@
3 3
4#include <linux/threads.h> 4#include <linux/threads.h>
5 5
6#define PTE_NONCACHE_NUM 0 /* dummy for now to share code w/ppc64 */ 6/* For 32-bit, all levels of page tables are just drawn from get_free_page() */
7#define MAX_PGTABLE_INDEX_SIZE 0
7 8
8extern void __bad_pte(pmd_t *pmd); 9extern void __bad_pte(pmd_t *pmd);
9 10
@@ -36,11 +37,10 @@ extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
36extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); 37extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr);
37extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr); 38extern pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long addr);
38 39
39static inline void pgtable_free(pgtable_free_t pgf) 40static inline void pgtable_free(void *table, unsigned index_size)
40{ 41{
41 void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK); 42 BUG_ON(index_size); /* 32-bit doesn't use this */
42 43 free_page((unsigned long)table);
43 free_page((unsigned long)p);
44} 44}
45 45
46#define check_pgt_cache() do { } while (0) 46#define check_pgt_cache() do { } while (0)
diff --git a/arch/powerpc/include/asm/pgalloc-64.h b/arch/powerpc/include/asm/pgalloc-64.h
index e6f069c4f713..605f5c5398d1 100644
--- a/arch/powerpc/include/asm/pgalloc-64.h
+++ b/arch/powerpc/include/asm/pgalloc-64.h
@@ -11,27 +11,34 @@
11#include <linux/cpumask.h> 11#include <linux/cpumask.h>
12#include <linux/percpu.h> 12#include <linux/percpu.h>
13 13
14#ifndef CONFIG_PPC_SUBPAGE_PROT 14/*
15static inline void subpage_prot_free(pgd_t *pgd) {} 15 * Functions that deal with pagetables that could be at any level of
16#endif 16 * the table need to be passed an "index_size" so they know how to
17 * handle allocation. For PTE pages (which are linked to a struct
18 * page for now, and drawn from the main get_free_pages() pool), the
19 * allocation size will be (2^index_size * sizeof(pointer)) and
20 * allocations are drawn from the kmem_cache in PGT_CACHE(index_size).
21 *
22 * The maximum index size needs to be big enough to allow any
23 * pagetable sizes we need, but small enough to fit in the low bits of
24 * any page table pointer. In other words all pagetables, even tiny
25 * ones, must be aligned to allow at least enough low 0 bits to
26 * contain this value. This value is also used as a mask, so it must
27 * be one less than a power of two.
28 */
29#define MAX_PGTABLE_INDEX_SIZE 0xf
17 30
18extern struct kmem_cache *pgtable_cache[]; 31extern struct kmem_cache *pgtable_cache[];
19 32#define PGT_CACHE(shift) (pgtable_cache[(shift)-1])
20#define PGD_CACHE_NUM 0
21#define PUD_CACHE_NUM 1
22#define PMD_CACHE_NUM 1
23#define HUGEPTE_CACHE_NUM 2
24#define PTE_NONCACHE_NUM 7 /* from GFP rather than kmem_cache */
25 33
26static inline pgd_t *pgd_alloc(struct mm_struct *mm) 34static inline pgd_t *pgd_alloc(struct mm_struct *mm)
27{ 35{
28 return kmem_cache_alloc(pgtable_cache[PGD_CACHE_NUM], GFP_KERNEL); 36 return kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE), GFP_KERNEL);
29} 37}
30 38
31static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) 39static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
32{ 40{
33 subpage_prot_free(pgd); 41 kmem_cache_free(PGT_CACHE(PGD_INDEX_SIZE), pgd);
34 kmem_cache_free(pgtable_cache[PGD_CACHE_NUM], pgd);
35} 42}
36 43
37#ifndef CONFIG_PPC_64K_PAGES 44#ifndef CONFIG_PPC_64K_PAGES
@@ -40,13 +47,13 @@ static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
40 47
41static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr) 48static inline pud_t *pud_alloc_one(struct mm_struct *mm, unsigned long addr)
42{ 49{
43 return kmem_cache_alloc(pgtable_cache[PUD_CACHE_NUM], 50 return kmem_cache_alloc(PGT_CACHE(PUD_INDEX_SIZE),
44 GFP_KERNEL|__GFP_REPEAT); 51 GFP_KERNEL|__GFP_REPEAT);
45} 52}
46 53
47static inline void pud_free(struct mm_struct *mm, pud_t *pud) 54static inline void pud_free(struct mm_struct *mm, pud_t *pud)
48{ 55{
49 kmem_cache_free(pgtable_cache[PUD_CACHE_NUM], pud); 56 kmem_cache_free(PGT_CACHE(PUD_INDEX_SIZE), pud);
50} 57}
51 58
52static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd) 59static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
@@ -78,13 +85,13 @@ static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
78 85
79static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr) 86static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long addr)
80{ 87{
81 return kmem_cache_alloc(pgtable_cache[PMD_CACHE_NUM], 88 return kmem_cache_alloc(PGT_CACHE(PMD_INDEX_SIZE),
82 GFP_KERNEL|__GFP_REPEAT); 89 GFP_KERNEL|__GFP_REPEAT);
83} 90}
84 91
85static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd) 92static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
86{ 93{
87 kmem_cache_free(pgtable_cache[PMD_CACHE_NUM], pmd); 94 kmem_cache_free(PGT_CACHE(PMD_INDEX_SIZE), pmd);
88} 95}
89 96
90static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, 97static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
@@ -107,24 +114,22 @@ static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
107 return page; 114 return page;
108} 115}
109 116
110static inline void pgtable_free(pgtable_free_t pgf) 117static inline void pgtable_free(void *table, unsigned index_size)
111{ 118{
112 void *p = (void *)(pgf.val & ~PGF_CACHENUM_MASK); 119 if (!index_size)
113 int cachenum = pgf.val & PGF_CACHENUM_MASK; 120 free_page((unsigned long)table);
114 121 else {
115 if (cachenum == PTE_NONCACHE_NUM) 122 BUG_ON(index_size > MAX_PGTABLE_INDEX_SIZE);
116 free_page((unsigned long)p); 123 kmem_cache_free(PGT_CACHE(index_size), table);
117 else 124 }
118 kmem_cache_free(pgtable_cache[cachenum], p);
119} 125}
120 126
121#define __pmd_free_tlb(tlb, pmd,addr) \ 127#define __pmd_free_tlb(tlb, pmd, addr) \
122 pgtable_free_tlb(tlb, pgtable_free_cache(pmd, \ 128 pgtable_free_tlb(tlb, pmd, PMD_INDEX_SIZE)
123 PMD_CACHE_NUM, PMD_TABLE_SIZE-1))
124#ifndef CONFIG_PPC_64K_PAGES 129#ifndef CONFIG_PPC_64K_PAGES
125#define __pud_free_tlb(tlb, pud, addr) \ 130#define __pud_free_tlb(tlb, pud, addr) \
126 pgtable_free_tlb(tlb, pgtable_free_cache(pud, \ 131 pgtable_free_tlb(tlb, pud, PUD_INDEX_SIZE)
127 PUD_CACHE_NUM, PUD_TABLE_SIZE-1)) 132
128#endif /* CONFIG_PPC_64K_PAGES */ 133#endif /* CONFIG_PPC_64K_PAGES */
129 134
130#define check_pgt_cache() do { } while (0) 135#define check_pgt_cache() do { } while (0)
diff --git a/arch/powerpc/include/asm/pgalloc.h b/arch/powerpc/include/asm/pgalloc.h
index f2e812de7c3c..abe8532bd14e 100644
--- a/arch/powerpc/include/asm/pgalloc.h
+++ b/arch/powerpc/include/asm/pgalloc.h
@@ -24,25 +24,6 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t ptepage)
24 __free_page(ptepage); 24 __free_page(ptepage);
25} 25}
26 26
27typedef struct pgtable_free {
28 unsigned long val;
29} pgtable_free_t;
30
31/* This needs to be big enough to allow for MMU_PAGE_COUNT + 2 to be stored
32 * and small enough to fit in the low bits of any naturally aligned page
33 * table cache entry. Arbitrarily set to 0x1f, that should give us some
34 * room to grow
35 */
36#define PGF_CACHENUM_MASK 0x1f
37
38static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum,
39 unsigned long mask)
40{
41 BUG_ON(cachenum > PGF_CACHENUM_MASK);
42
43 return (pgtable_free_t){.val = ((unsigned long) p & ~mask) | cachenum};
44}
45
46#ifdef CONFIG_PPC64 27#ifdef CONFIG_PPC64
47#include <asm/pgalloc-64.h> 28#include <asm/pgalloc-64.h>
48#else 29#else
@@ -50,12 +31,12 @@ static inline pgtable_free_t pgtable_free_cache(void *p, int cachenum,
50#endif 31#endif
51 32
52#ifdef CONFIG_SMP 33#ifdef CONFIG_SMP
53extern void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf); 34extern void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift);
54extern void pte_free_finish(void); 35extern void pte_free_finish(void);
55#else /* CONFIG_SMP */ 36#else /* CONFIG_SMP */
56static inline void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf) 37static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift)
57{ 38{
58 pgtable_free(pgf); 39 pgtable_free(table, shift);
59} 40}
60static inline void pte_free_finish(void) { } 41static inline void pte_free_finish(void) { }
61#endif /* !CONFIG_SMP */ 42#endif /* !CONFIG_SMP */
@@ -63,12 +44,9 @@ static inline void pte_free_finish(void) { }
63static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage, 44static inline void __pte_free_tlb(struct mmu_gather *tlb, struct page *ptepage,
64 unsigned long address) 45 unsigned long address)
65{ 46{
66 pgtable_free_t pgf = pgtable_free_cache(page_address(ptepage),
67 PTE_NONCACHE_NUM,
68 PTE_TABLE_SIZE-1);
69 tlb_flush_pgtable(tlb, address); 47 tlb_flush_pgtable(tlb, address);
70 pgtable_page_dtor(ptepage); 48 pgtable_page_dtor(ptepage);
71 pgtable_free_tlb(tlb, pgf); 49 pgtable_free_tlb(tlb, page_address(ptepage), 0);
72} 50}
73 51
74#endif /* __KERNEL__ */ 52#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/pgtable-ppc64.h b/arch/powerpc/include/asm/pgtable-ppc64.h
index 806abe7a3fa5..49865045d56f 100644
--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -354,6 +354,7 @@ static inline void __ptep_set_access_flags(pte_t *ptep, pte_t entry)
354#define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE}) 354#define pgoff_to_pte(off) ((pte_t) {((off) << PTE_RPN_SHIFT)|_PAGE_FILE})
355#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT) 355#define PTE_FILE_MAX_BITS (BITS_PER_LONG - PTE_RPN_SHIFT)
356 356
357void pgtable_cache_add(unsigned shift, void (*ctor)(void *));
357void pgtable_cache_init(void); 358void pgtable_cache_init(void);
358 359
359/* 360/*
@@ -378,7 +379,18 @@ void pgtable_cache_init(void);
378 return pt; 379 return pt;
379} 380}
380 381
381pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long address); 382#ifdef CONFIG_HUGETLB_PAGE
383pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
384 unsigned *shift);
385#else
386static inline pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea,
387 unsigned *shift)
388{
389 if (shift)
390 *shift = 0;
391 return find_linux_pte(pgdir, ea);
392}
393#endif /* !CONFIG_HUGETLB_PAGE */
382 394
383#endif /* __ASSEMBLY__ */ 395#endif /* __ASSEMBLY__ */
384 396
diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h
index 2a5da069714e..21207e54825b 100644
--- a/arch/powerpc/include/asm/pgtable.h
+++ b/arch/powerpc/include/asm/pgtable.h
@@ -211,6 +211,9 @@ extern void paging_init(void);
211 */ 211 */
212extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t); 212extern void update_mmu_cache(struct vm_area_struct *, unsigned long, pte_t);
213 213
214extern int gup_hugepd(hugepd_t *hugepd, unsigned pdshift, unsigned long addr,
215 unsigned long end, int write, struct page **pages, int *nr);
216
214#endif /* __ASSEMBLY__ */ 217#endif /* __ASSEMBLY__ */
215 218
216#endif /* __KERNEL__ */ 219#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/pte-8xx.h b/arch/powerpc/include/asm/pte-8xx.h
index dd5ea95fe61e..d44826e4ff97 100644
--- a/arch/powerpc/include/asm/pte-8xx.h
+++ b/arch/powerpc/include/asm/pte-8xx.h
@@ -33,21 +33,21 @@
33#define _PAGE_NO_CACHE 0x0002 /* I: cache inhibit */ 33#define _PAGE_NO_CACHE 0x0002 /* I: cache inhibit */
34#define _PAGE_SHARED 0x0004 /* No ASID (context) compare */ 34#define _PAGE_SHARED 0x0004 /* No ASID (context) compare */
35#define _PAGE_SPECIAL 0x0008 /* SW entry, forced to 0 by the TLB miss */ 35#define _PAGE_SPECIAL 0x0008 /* SW entry, forced to 0 by the TLB miss */
36#define _PAGE_DIRTY 0x0100 /* C: page changed */
36 37
37/* These five software bits must be masked out when the entry is loaded 38/* These 4 software bits must be masked out when the entry is loaded
38 * into the TLB. 39 * into the TLB, 1 SW bit left(0x0080).
39 */ 40 */
40#define _PAGE_GUARDED 0x0010 /* software: guarded access */ 41#define _PAGE_GUARDED 0x0010 /* software: guarded access */
41#define _PAGE_DIRTY 0x0020 /* software: page changed */ 42#define _PAGE_ACCESSED 0x0020 /* software: page referenced */
42#define _PAGE_RW 0x0040 /* software: user write access allowed */ 43#define _PAGE_WRITETHRU 0x0040 /* software: caching is write through */
43#define _PAGE_ACCESSED 0x0080 /* software: page referenced */
44 44
45/* Setting any bits in the nibble with the follow two controls will 45/* Setting any bits in the nibble with the follow two controls will
46 * require a TLB exception handler change. It is assumed unused bits 46 * require a TLB exception handler change. It is assumed unused bits
47 * are always zero. 47 * are always zero.
48 */ 48 */
49#define _PAGE_HWWRITE 0x0100 /* h/w write enable: never set in Linux PTE */ 49#define _PAGE_RW 0x0400 /* lsb PP bits, inverted in HW */
50#define _PAGE_USER 0x0800 /* One of the PP bits, the other is USER&~RW */ 50#define _PAGE_USER 0x0800 /* msb PP bits */
51 51
52#define _PMD_PRESENT 0x0001 52#define _PMD_PRESENT 0x0001
53#define _PMD_BAD 0x0ff0 53#define _PMD_BAD 0x0ff0
diff --git a/arch/powerpc/include/asm/pte-hash64-64k.h b/arch/powerpc/include/asm/pte-hash64-64k.h
index 82b72207c51c..c4490f9c67c4 100644
--- a/arch/powerpc/include/asm/pte-hash64-64k.h
+++ b/arch/powerpc/include/asm/pte-hash64-64k.h
@@ -76,41 +76,4 @@
76 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \ 76 remap_pfn_range((vma), (addr), (pfn), PAGE_SIZE, \
77 __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN)) 77 __pgprot(pgprot_val((prot)) | _PAGE_4K_PFN))
78 78
79
80#ifdef CONFIG_PPC_SUBPAGE_PROT
81/*
82 * For the sub-page protection option, we extend the PGD with one of
83 * these. Basically we have a 3-level tree, with the top level being
84 * the protptrs array. To optimize speed and memory consumption when
85 * only addresses < 4GB are being protected, pointers to the first
86 * four pages of sub-page protection words are stored in the low_prot
87 * array.
88 * Each page of sub-page protection words protects 1GB (4 bytes
89 * protects 64k). For the 3-level tree, each page of pointers then
90 * protects 8TB.
91 */
92struct subpage_prot_table {
93 unsigned long maxaddr; /* only addresses < this are protected */
94 unsigned int **protptrs[2];
95 unsigned int *low_prot[4];
96};
97
98#undef PGD_TABLE_SIZE
99#define PGD_TABLE_SIZE ((sizeof(pgd_t) << PGD_INDEX_SIZE) + \
100 sizeof(struct subpage_prot_table))
101
102#define SBP_L1_BITS (PAGE_SHIFT - 2)
103#define SBP_L2_BITS (PAGE_SHIFT - 3)
104#define SBP_L1_COUNT (1 << SBP_L1_BITS)
105#define SBP_L2_COUNT (1 << SBP_L2_BITS)
106#define SBP_L2_SHIFT (PAGE_SHIFT + SBP_L1_BITS)
107#define SBP_L3_SHIFT (SBP_L2_SHIFT + SBP_L2_BITS)
108
109extern void subpage_prot_free(pgd_t *pgd);
110
111static inline struct subpage_prot_table *pgd_subpage_prot(pgd_t *pgd)
112{
113 return (struct subpage_prot_table *)(pgd + PTRS_PER_PGD);
114}
115#endif /* CONFIG_PPC_SUBPAGE_PROT */
116#endif /* __ASSEMBLY__ */ 79#endif /* __ASSEMBLY__ */
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index f388f0ab193f..0947b36e534c 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -87,7 +87,7 @@ extern spinlock_t cmxgcr_lock;
87 87
88/* Export QE common operations */ 88/* Export QE common operations */
89#ifdef CONFIG_QUICC_ENGINE 89#ifdef CONFIG_QUICC_ENGINE
90extern void __init qe_reset(void); 90extern void qe_reset(void);
91#else 91#else
92static inline void qe_reset(void) {} 92static inline void qe_reset(void) {}
93#endif 93#endif
@@ -145,8 +145,17 @@ static inline void qe_pin_set_gpio(struct qe_pin *qe_pin) {}
145static inline void qe_pin_set_dedicated(struct qe_pin *pin) {} 145static inline void qe_pin_set_dedicated(struct qe_pin *pin) {}
146#endif /* CONFIG_QE_GPIO */ 146#endif /* CONFIG_QE_GPIO */
147 147
148/* QE internal API */ 148#ifdef CONFIG_QUICC_ENGINE
149int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input); 149int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol, u32 cmd_input);
150#else
151static inline int qe_issue_cmd(u32 cmd, u32 device, u8 mcn_protocol,
152 u32 cmd_input)
153{
154 return -ENOSYS;
155}
156#endif /* CONFIG_QUICC_ENGINE */
157
158/* QE internal API */
150enum qe_clock qe_clock_source(const char *source); 159enum qe_clock qe_clock_source(const char *source);
151unsigned int qe_get_brg_clk(void); 160unsigned int qe_get_brg_clk(void);
152int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier); 161int qe_setbrg(enum qe_clock brg, unsigned int rate, unsigned int multiplier);
@@ -154,7 +163,28 @@ int qe_get_snum(void);
154void qe_put_snum(u8 snum); 163void qe_put_snum(u8 snum);
155unsigned int qe_get_num_of_risc(void); 164unsigned int qe_get_num_of_risc(void);
156unsigned int qe_get_num_of_snums(void); 165unsigned int qe_get_num_of_snums(void);
157int qe_alive_during_sleep(void); 166
167static inline int qe_alive_during_sleep(void)
168{
169 /*
170 * MPC8568E reference manual says:
171 *
172 * "...power down sequence waits for all I/O interfaces to become idle.
173 * In some applications this may happen eventually without actively
174 * shutting down interfaces, but most likely, software will have to
175 * take steps to shut down the eTSEC, QUICC Engine Block, and PCI
176 * interfaces before issuing the command (either the write to the core
177 * MSR[WE] as described above or writing to POWMGTCSR) to put the
178 * device into sleep state."
179 *
180 * MPC8569E reference manual has a similar paragraph.
181 */
182#ifdef CONFIG_PPC_85xx
183 return 0;
184#else
185 return 1;
186#endif
187}
158 188
159/* we actually use cpm_muram implementation, define this for convenience */ 189/* we actually use cpm_muram implementation, define this for convenience */
160#define qe_muram_init cpm_muram_init 190#define qe_muram_init cpm_muram_init
@@ -210,8 +240,15 @@ struct qe_firmware_info {
210 u64 extended_modes; /* Extended modes */ 240 u64 extended_modes; /* Extended modes */
211}; 241};
212 242
243#ifdef CONFIG_QUICC_ENGINE
213/* Upload a firmware to the QE */ 244/* Upload a firmware to the QE */
214int qe_upload_firmware(const struct qe_firmware *firmware); 245int qe_upload_firmware(const struct qe_firmware *firmware);
246#else
247static inline int qe_upload_firmware(const struct qe_firmware *firmware)
248{
249 return -ENOSYS;
250}
251#endif /* CONFIG_QUICC_ENGINE */
215 252
216/* Obtain information on the uploaded firmware */ 253/* Obtain information on the uploaded firmware */
217struct qe_firmware_info *qe_get_firmware_info(void); 254struct qe_firmware_info *qe_get_firmware_info(void);
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index d9ea8d39c342..1d3b270d3083 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -37,7 +37,7 @@ extern void cpu_die(void);
37extern void smp_send_debugger_break(int cpu); 37extern void smp_send_debugger_break(int cpu);
38extern void smp_message_recv(int); 38extern void smp_message_recv(int);
39 39
40DECLARE_PER_CPU(unsigned int, pvr); 40DECLARE_PER_CPU(unsigned int, cpu_pvr);
41 41
42#ifdef CONFIG_HOTPLUG_CPU 42#ifdef CONFIG_HOTPLUG_CPU
43extern void fixup_irqs(cpumask_t map); 43extern void fixup_irqs(cpumask_t map);
diff --git a/arch/powerpc/include/asm/systbl.h b/arch/powerpc/include/asm/systbl.h
index c7d671a7d9a1..07d2d19ab5e9 100644
--- a/arch/powerpc/include/asm/systbl.h
+++ b/arch/powerpc/include/asm/systbl.h
@@ -145,7 +145,7 @@ SYSCALL_SPU(setfsuid)
145SYSCALL_SPU(setfsgid) 145SYSCALL_SPU(setfsgid)
146SYSCALL_SPU(llseek) 146SYSCALL_SPU(llseek)
147COMPAT_SYS_SPU(getdents) 147COMPAT_SYS_SPU(getdents)
148SYSX_SPU(sys_select,ppc32_select,ppc_select) 148SYSX_SPU(sys_select,ppc32_select,sys_select)
149SYSCALL_SPU(flock) 149SYSCALL_SPU(flock)
150SYSCALL_SPU(msync) 150SYSCALL_SPU(msync)
151COMPAT_SYS_SPU(readv) 151COMPAT_SYS_SPU(readv)
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index b23664a0b86c..c002b0410219 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -42,10 +42,11 @@ obj-$(CONFIG_ALTIVEC) += vecemu.o
42obj-$(CONFIG_PPC_970_NAP) += idle_power4.o 42obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
43obj-$(CONFIG_PPC_OF) += of_device.o of_platform.o prom_parse.o 43obj-$(CONFIG_PPC_OF) += of_device.o of_platform.o prom_parse.o
44obj-$(CONFIG_PPC_CLOCK) += clock.o 44obj-$(CONFIG_PPC_CLOCK) += clock.o
45procfs-$(CONFIG_PPC64) := proc_ppc64.o 45procfs-y := proc_powerpc.o
46obj-$(CONFIG_PROC_FS) += $(procfs-y) 46obj-$(CONFIG_PROC_FS) += $(procfs-y)
47rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI) := rtas_pci.o 47rtaspci-$(CONFIG_PPC64)-$(CONFIG_PCI) := rtas_pci.o
48obj-$(CONFIG_PPC_RTAS) += rtas.o rtas-rtc.o $(rtaspci-y-y) 48obj-$(CONFIG_PPC_RTAS) += rtas.o rtas-rtc.o $(rtaspci-y-y)
49obj-$(CONFIG_PPC_RTAS_DAEMON) += rtasd.o
49obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o 50obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o
50obj-$(CONFIG_RTAS_PROC) += rtas-proc.o 51obj-$(CONFIG_RTAS_PROC) += rtas-proc.o
51obj-$(CONFIG_LPARCFG) += lparcfg.o 52obj-$(CONFIG_LPARCFG) += lparcfg.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 0812b0f414bb..a6c2b63227b3 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -190,6 +190,11 @@ int main(void)
190 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 190 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
191 DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); 191 DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
192 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); 192 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
193#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
194 DEFINE(PACA_KVM_IN_GUEST, offsetof(struct paca_struct, kvm_in_guest));
195 DEFINE(PACA_KVM_SLB, offsetof(struct paca_struct, kvm_slb));
196 DEFINE(PACA_KVM_SLB_MAX, offsetof(struct paca_struct, kvm_slb_max));
197#endif
193#endif /* CONFIG_PPC64 */ 198#endif /* CONFIG_PPC64 */
194 199
195 /* RTAS */ 200 /* RTAS */
@@ -398,14 +403,24 @@ int main(void)
398 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst)); 403 DEFINE(VCPU_LAST_INST, offsetof(struct kvm_vcpu, arch.last_inst));
399 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear)); 404 DEFINE(VCPU_FAULT_DEAR, offsetof(struct kvm_vcpu, arch.fault_dear));
400 DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr)); 405 DEFINE(VCPU_FAULT_ESR, offsetof(struct kvm_vcpu, arch.fault_esr));
406
407 /* book3s_64 */
408#ifdef CONFIG_PPC64
409 DEFINE(VCPU_FAULT_DSISR, offsetof(struct kvm_vcpu, arch.fault_dsisr));
410 DEFINE(VCPU_HOST_RETIP, offsetof(struct kvm_vcpu, arch.host_retip));
411 DEFINE(VCPU_HOST_R2, offsetof(struct kvm_vcpu, arch.host_r2));
412 DEFINE(VCPU_HOST_MSR, offsetof(struct kvm_vcpu, arch.host_msr));
413 DEFINE(VCPU_SHADOW_MSR, offsetof(struct kvm_vcpu, arch.shadow_msr));
414 DEFINE(VCPU_TRAMPOLINE_LOWMEM, offsetof(struct kvm_vcpu, arch.trampoline_lowmem));
415 DEFINE(VCPU_TRAMPOLINE_ENTER, offsetof(struct kvm_vcpu, arch.trampoline_enter));
416 DEFINE(VCPU_HIGHMEM_HANDLER, offsetof(struct kvm_vcpu, arch.highmem_handler));
417 DEFINE(VCPU_HFLAGS, offsetof(struct kvm_vcpu, arch.hflags));
418#endif
401#endif 419#endif
402#ifdef CONFIG_44x 420#ifdef CONFIG_44x
403 DEFINE(PGD_T_LOG2, PGD_T_LOG2); 421 DEFINE(PGD_T_LOG2, PGD_T_LOG2);
404 DEFINE(PTE_T_LOG2, PTE_T_LOG2); 422 DEFINE(PTE_T_LOG2, PTE_T_LOG2);
405#endif 423#endif
406#ifdef CONFIG_FSL_BOOKE
407 DEFINE(TLBCAM_SIZE, sizeof(struct tlbcam));
408#endif
409 424
410#ifdef CONFIG_KVM_EXIT_TIMING 425#ifdef CONFIG_KVM_EXIT_TIMING
411 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu, 426 DEFINE(VCPU_TIMING_EXIT_TBU, offsetof(struct kvm_vcpu,
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
index 0a8439aafdd1..6f4613dd05ef 100644
--- a/arch/powerpc/kernel/crash.c
+++ b/arch/powerpc/kernel/crash.c
@@ -373,7 +373,7 @@ void default_machine_crash_shutdown(struct pt_regs *regs)
373 hard_irq_disable(); 373 hard_irq_disable();
374 374
375 for_each_irq(i) { 375 for_each_irq(i) {
376 struct irq_desc *desc = irq_desc + i; 376 struct irq_desc *desc = irq_to_desc(i);
377 377
378 if (desc->status & IRQ_INPROGRESS) 378 if (desc->status & IRQ_INPROGRESS)
379 desc->chip->eoi(i); 379 desc->chip->eoi(i);
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index e96cbbd9b449..59c928564a03 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -21,7 +21,6 @@
21#include <asm/dma.h> 21#include <asm/dma.h>
22#include <asm/abs_addr.h> 22#include <asm/abs_addr.h>
23 23
24int swiotlb __read_mostly;
25unsigned int ppc_swiotlb_enable; 24unsigned int ppc_swiotlb_enable;
26 25
27/* 26/*
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index c7eb4e0eb86c..e3be98ffe2a7 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -41,6 +41,7 @@ __start_interrupts:
41 . = 0x200 41 . = 0x200
42_machine_check_pSeries: 42_machine_check_pSeries:
43 HMT_MEDIUM 43 HMT_MEDIUM
44 DO_KVM 0x200
44 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */ 45 mtspr SPRN_SPRG_SCRATCH0,r13 /* save r13 */
45 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 46 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
46 47
@@ -48,6 +49,7 @@ _machine_check_pSeries:
48 .globl data_access_pSeries 49 .globl data_access_pSeries
49data_access_pSeries: 50data_access_pSeries:
50 HMT_MEDIUM 51 HMT_MEDIUM
52 DO_KVM 0x300
51 mtspr SPRN_SPRG_SCRATCH0,r13 53 mtspr SPRN_SPRG_SCRATCH0,r13
52BEGIN_FTR_SECTION 54BEGIN_FTR_SECTION
53 mfspr r13,SPRN_SPRG_PACA 55 mfspr r13,SPRN_SPRG_PACA
@@ -77,6 +79,7 @@ ALT_FTR_SECTION_END_IFCLR(CPU_FTR_SLB)
77 .globl data_access_slb_pSeries 79 .globl data_access_slb_pSeries
78data_access_slb_pSeries: 80data_access_slb_pSeries:
79 HMT_MEDIUM 81 HMT_MEDIUM
82 DO_KVM 0x380
80 mtspr SPRN_SPRG_SCRATCH0,r13 83 mtspr SPRN_SPRG_SCRATCH0,r13
81 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */ 84 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */
82 std r3,PACA_EXSLB+EX_R3(r13) 85 std r3,PACA_EXSLB+EX_R3(r13)
@@ -115,6 +118,7 @@ data_access_slb_pSeries:
115 .globl instruction_access_slb_pSeries 118 .globl instruction_access_slb_pSeries
116instruction_access_slb_pSeries: 119instruction_access_slb_pSeries:
117 HMT_MEDIUM 120 HMT_MEDIUM
121 DO_KVM 0x480
118 mtspr SPRN_SPRG_SCRATCH0,r13 122 mtspr SPRN_SPRG_SCRATCH0,r13
119 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */ 123 mfspr r13,SPRN_SPRG_PACA /* get paca address into r13 */
120 std r3,PACA_EXSLB+EX_R3(r13) 124 std r3,PACA_EXSLB+EX_R3(r13)
@@ -154,6 +158,7 @@ instruction_access_slb_pSeries:
154 .globl system_call_pSeries 158 .globl system_call_pSeries
155system_call_pSeries: 159system_call_pSeries:
156 HMT_MEDIUM 160 HMT_MEDIUM
161 DO_KVM 0xc00
157BEGIN_FTR_SECTION 162BEGIN_FTR_SECTION
158 cmpdi r0,0x1ebe 163 cmpdi r0,0x1ebe
159 beq- 1f 164 beq- 1f
@@ -187,14 +192,17 @@ END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
187 */ 192 */
188performance_monitor_pSeries_1: 193performance_monitor_pSeries_1:
189 . = 0xf00 194 . = 0xf00
195 DO_KVM 0xf00
190 b performance_monitor_pSeries 196 b performance_monitor_pSeries
191 197
192altivec_unavailable_pSeries_1: 198altivec_unavailable_pSeries_1:
193 . = 0xf20 199 . = 0xf20
200 DO_KVM 0xf20
194 b altivec_unavailable_pSeries 201 b altivec_unavailable_pSeries
195 202
196vsx_unavailable_pSeries_1: 203vsx_unavailable_pSeries_1:
197 . = 0xf40 204 . = 0xf40
205 DO_KVM 0xf40
198 b vsx_unavailable_pSeries 206 b vsx_unavailable_pSeries
199 207
200#ifdef CONFIG_CBE_RAS 208#ifdef CONFIG_CBE_RAS
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index c38afdb45d7b..925807488022 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -37,6 +37,7 @@
37#include <asm/firmware.h> 37#include <asm/firmware.h>
38#include <asm/page_64.h> 38#include <asm/page_64.h>
39#include <asm/irqflags.h> 39#include <asm/irqflags.h>
40#include <asm/kvm_book3s_64_asm.h>
40 41
41/* The physical memory is layed out such that the secondary processor 42/* The physical memory is layed out such that the secondary processor
42 * spin code sits at 0x0000...0x00ff. On server, the vectors follow 43 * spin code sits at 0x0000...0x00ff. On server, the vectors follow
@@ -165,6 +166,12 @@ exception_marker:
165#include "exceptions-64s.S" 166#include "exceptions-64s.S"
166#endif 167#endif
167 168
169/* KVM trampoline code needs to be close to the interrupt handlers */
170
171#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
172#include "../kvm/book3s_64_rmhandlers.S"
173#endif
174
168_GLOBAL(generic_secondary_thread_init) 175_GLOBAL(generic_secondary_thread_init)
169 mr r24,r3 176 mr r24,r3
170 177
diff --git a/arch/powerpc/kernel/head_8xx.S b/arch/powerpc/kernel/head_8xx.S
index 6ded19d01891..678f98cd5e64 100644
--- a/arch/powerpc/kernel/head_8xx.S
+++ b/arch/powerpc/kernel/head_8xx.S
@@ -206,6 +206,8 @@ MachineCheck:
206 EXCEPTION_PROLOG 206 EXCEPTION_PROLOG
207 mfspr r4,SPRN_DAR 207 mfspr r4,SPRN_DAR
208 stw r4,_DAR(r11) 208 stw r4,_DAR(r11)
209 li r5,0x00f0
210 mtspr SPRN_DAR,r5 /* Tag DAR, to be used in DTLB Error */
209 mfspr r5,SPRN_DSISR 211 mfspr r5,SPRN_DSISR
210 stw r5,_DSISR(r11) 212 stw r5,_DSISR(r11)
211 addi r3,r1,STACK_FRAME_OVERHEAD 213 addi r3,r1,STACK_FRAME_OVERHEAD
@@ -222,6 +224,8 @@ DataAccess:
222 stw r10,_DSISR(r11) 224 stw r10,_DSISR(r11)
223 mr r5,r10 225 mr r5,r10
224 mfspr r4,SPRN_DAR 226 mfspr r4,SPRN_DAR
227 li r10,0x00f0
228 mtspr SPRN_DAR,r10 /* Tag DAR, to be used in DTLB Error */
225 EXC_XFER_EE_LITE(0x300, handle_page_fault) 229 EXC_XFER_EE_LITE(0x300, handle_page_fault)
226 230
227/* Instruction access exception. 231/* Instruction access exception.
@@ -244,6 +248,8 @@ Alignment:
244 EXCEPTION_PROLOG 248 EXCEPTION_PROLOG
245 mfspr r4,SPRN_DAR 249 mfspr r4,SPRN_DAR
246 stw r4,_DAR(r11) 250 stw r4,_DAR(r11)
251 li r5,0x00f0
252 mtspr SPRN_DAR,r5 /* Tag DAR, to be used in DTLB Error */
247 mfspr r5,SPRN_DSISR 253 mfspr r5,SPRN_DSISR
248 stw r5,_DSISR(r11) 254 stw r5,_DSISR(r11)
249 addi r3,r1,STACK_FRAME_OVERHEAD 255 addi r3,r1,STACK_FRAME_OVERHEAD
@@ -333,26 +339,20 @@ InstructionTLBMiss:
333 mfspr r11, SPRN_MD_TWC /* ....and get the pte address */ 339 mfspr r11, SPRN_MD_TWC /* ....and get the pte address */
334 lwz r10, 0(r11) /* Get the pte */ 340 lwz r10, 0(r11) /* Get the pte */
335 341
336#ifdef CONFIG_SWAP 342 andi. r11, r10, _PAGE_ACCESSED | _PAGE_PRESENT
337 /* do not set the _PAGE_ACCESSED bit of a non-present page */ 343 cmpwi cr0, r11, _PAGE_ACCESSED | _PAGE_PRESENT
338 andi. r11, r10, _PAGE_PRESENT 344 bne- cr0, 2f
339 beq 4f 345
340 ori r10, r10, _PAGE_ACCESSED 346 /* Clear PP lsb, 0x400 */
341 mfspr r11, SPRN_MD_TWC /* get the pte address again */ 347 rlwinm r10, r10, 0, 22, 20
342 stw r10, 0(r11)
3434:
344#else
345 ori r10, r10, _PAGE_ACCESSED
346 stw r10, 0(r11)
347#endif
348 348
349 /* The Linux PTE won't go exactly into the MMU TLB. 349 /* The Linux PTE won't go exactly into the MMU TLB.
350 * Software indicator bits 21, 22 and 28 must be clear. 350 * Software indicator bits 22 and 28 must be clear.
351 * Software indicator bits 24, 25, 26, and 27 must be 351 * Software indicator bits 24, 25, 26, and 27 must be
352 * set. All other Linux PTE bits control the behavior 352 * set. All other Linux PTE bits control the behavior
353 * of the MMU. 353 * of the MMU.
354 */ 354 */
3552: li r11, 0x00f0 355 li r11, 0x00f0
356 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */ 356 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
357 DO_8xx_CPU6(0x2d80, r3) 357 DO_8xx_CPU6(0x2d80, r3)
358 mtspr SPRN_MI_RPN, r10 /* Update TLB entry */ 358 mtspr SPRN_MI_RPN, r10 /* Update TLB entry */
@@ -365,6 +365,22 @@ InstructionTLBMiss:
365 lwz r3, 8(r0) 365 lwz r3, 8(r0)
366#endif 366#endif
367 rfi 367 rfi
3682:
369 mfspr r11, SPRN_SRR1
370 /* clear all error bits as TLB Miss
371 * sets a few unconditionally
372 */
373 rlwinm r11, r11, 0, 0xffff
374 mtspr SPRN_SRR1, r11
375
376 mfspr r10, SPRN_M_TW /* Restore registers */
377 lwz r11, 0(r0)
378 mtcr r11
379 lwz r11, 4(r0)
380#ifdef CONFIG_8xx_CPU6
381 lwz r3, 8(r0)
382#endif
383 b InstructionAccess
368 384
369 . = 0x1200 385 . = 0x1200
370DataStoreTLBMiss: 386DataStoreTLBMiss:
@@ -406,29 +422,45 @@ DataStoreTLBMiss:
406 * above. 422 * above.
407 */ 423 */
408 rlwimi r11, r10, 0, 27, 27 424 rlwimi r11, r10, 0, 27, 27
425 /* Insert the WriteThru flag into the TWC from the Linux PTE.
426 * It is bit 25 in the Linux PTE and bit 30 in the TWC
427 */
428 rlwimi r11, r10, 32-5, 30, 30
409 DO_8xx_CPU6(0x3b80, r3) 429 DO_8xx_CPU6(0x3b80, r3)
410 mtspr SPRN_MD_TWC, r11 430 mtspr SPRN_MD_TWC, r11
411 431
412#ifdef CONFIG_SWAP 432 /* Both _PAGE_ACCESSED and _PAGE_PRESENT has to be set.
413 /* do not set the _PAGE_ACCESSED bit of a non-present page */ 433 * We also need to know if the insn is a load/store, so:
414 andi. r11, r10, _PAGE_PRESENT 434 * Clear _PAGE_PRESENT and load that which will
415 beq 4f 435 * trap into DTLB Error with store bit set accordinly.
416 ori r10, r10, _PAGE_ACCESSED 436 */
4174: 437 /* PRESENT=0x1, ACCESSED=0x20
418 /* and update pte in table */ 438 * r11 = ((r10 & PRESENT) & ((r10 & ACCESSED) >> 5));
419#else 439 * r10 = (r10 & ~PRESENT) | r11;
420 ori r10, r10, _PAGE_ACCESSED 440 */
421#endif 441 rlwinm r11, r10, 32-5, _PAGE_PRESENT
422 mfspr r11, SPRN_MD_TWC /* get the pte address again */ 442 and r11, r11, r10
423 stw r10, 0(r11) 443 rlwimi r10, r11, 0, _PAGE_PRESENT
444
445 /* Honour kernel RO, User NA */
446 /* 0x200 == Extended encoding, bit 22 */
447 /* r11 = (r10 & _PAGE_USER) >> 2 */
448 rlwinm r11, r10, 32-2, 0x200
449 or r10, r11, r10
450 /* r11 = (r10 & _PAGE_RW) >> 1 */
451 rlwinm r11, r10, 32-1, 0x200
452 or r10, r11, r10
453 /* invert RW and 0x200 bits */
454 xori r10, r10, _PAGE_RW | 0x200
424 455
425 /* The Linux PTE won't go exactly into the MMU TLB. 456 /* The Linux PTE won't go exactly into the MMU TLB.
426 * Software indicator bits 21, 22 and 28 must be clear. 457 * Software indicator bits 22 and 28 must be clear.
427 * Software indicator bits 24, 25, 26, and 27 must be 458 * Software indicator bits 24, 25, 26, and 27 must be
428 * set. All other Linux PTE bits control the behavior 459 * set. All other Linux PTE bits control the behavior
429 * of the MMU. 460 * of the MMU.
430 */ 461 */
4312: li r11, 0x00f0 4622: li r11, 0x00f0
463 mtspr SPRN_DAR,r11 /* Tag DAR */
432 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */ 464 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
433 DO_8xx_CPU6(0x3d80, r3) 465 DO_8xx_CPU6(0x3d80, r3)
434 mtspr SPRN_MD_RPN, r10 /* Update TLB entry */ 466 mtspr SPRN_MD_RPN, r10 /* Update TLB entry */
@@ -469,97 +501,10 @@ DataTLBError:
469 stw r10, 0(r0) 501 stw r10, 0(r0)
470 stw r11, 4(r0) 502 stw r11, 4(r0)
471 503
472 /* First, make sure this was a store operation.
473 */
474 mfspr r10, SPRN_DSISR
475 andis. r11, r10, 0x0200 /* If set, indicates store op */
476 beq 2f
477
478 /* The EA of a data TLB miss is automatically stored in the MD_EPN
479 * register. The EA of a data TLB error is automatically stored in
480 * the DAR, but not the MD_EPN register. We must copy the 20 most
481 * significant bits of the EA from the DAR to MD_EPN before we
482 * start walking the page tables. We also need to copy the CASID
483 * value from the M_CASID register.
484 * Addendum: The EA of a data TLB error is _supposed_ to be stored
485 * in DAR, but it seems that this doesn't happen in some cases, such
486 * as when the error is due to a dcbi instruction to a page with a
487 * TLB that doesn't have the changed bit set. In such cases, there
488 * does not appear to be any way to recover the EA of the error
489 * since it is neither in DAR nor MD_EPN. As a workaround, the
490 * _PAGE_HWWRITE bit is set for all kernel data pages when the PTEs
491 * are initialized in mapin_ram(). This will avoid the problem,
492 * assuming we only use the dcbi instruction on kernel addresses.
493 */
494 mfspr r10, SPRN_DAR 504 mfspr r10, SPRN_DAR
495 rlwinm r11, r10, 0, 0, 19 505 cmpwi cr0, r10, 0x00f0
496 ori r11, r11, MD_EVALID 506 beq- FixupDAR /* must be a buggy dcbX, icbi insn. */
497 mfspr r10, SPRN_M_CASID 507DARFixed:/* Return from dcbx instruction bug workaround, r10 holds value of DAR */
498 rlwimi r11, r10, 0, 28, 31
499 DO_8xx_CPU6(0x3780, r3)
500 mtspr SPRN_MD_EPN, r11
501
502 mfspr r10, SPRN_M_TWB /* Get level 1 table entry address */
503
504 /* If we are faulting a kernel address, we have to use the
505 * kernel page tables.
506 */
507 andi. r11, r10, 0x0800
508 beq 3f
509 lis r11, swapper_pg_dir@h
510 ori r11, r11, swapper_pg_dir@l
511 rlwimi r10, r11, 0, 2, 19
5123:
513 lwz r11, 0(r10) /* Get the level 1 entry */
514 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */
515 beq 2f /* If zero, bail */
516
517 /* We have a pte table, so fetch the pte from the table.
518 */
519 ori r11, r11, 1 /* Set valid bit in physical L2 page */
520 DO_8xx_CPU6(0x3b80, r3)
521 mtspr SPRN_MD_TWC, r11 /* Load pte table base address */
522 mfspr r11, SPRN_MD_TWC /* ....and get the pte address */
523 lwz r10, 0(r11) /* Get the pte */
524
525 andi. r11, r10, _PAGE_RW /* Is it writeable? */
526 beq 2f /* Bail out if not */
527
528 /* Update 'changed', among others.
529 */
530#ifdef CONFIG_SWAP
531 ori r10, r10, _PAGE_DIRTY|_PAGE_HWWRITE
532 /* do not set the _PAGE_ACCESSED bit of a non-present page */
533 andi. r11, r10, _PAGE_PRESENT
534 beq 4f
535 ori r10, r10, _PAGE_ACCESSED
5364:
537#else
538 ori r10, r10, _PAGE_DIRTY|_PAGE_ACCESSED|_PAGE_HWWRITE
539#endif
540 mfspr r11, SPRN_MD_TWC /* Get pte address again */
541 stw r10, 0(r11) /* and update pte in table */
542
543 /* The Linux PTE won't go exactly into the MMU TLB.
544 * Software indicator bits 21, 22 and 28 must be clear.
545 * Software indicator bits 24, 25, 26, and 27 must be
546 * set. All other Linux PTE bits control the behavior
547 * of the MMU.
548 */
549 li r11, 0x00f0
550 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
551 DO_8xx_CPU6(0x3d80, r3)
552 mtspr SPRN_MD_RPN, r10 /* Update TLB entry */
553
554 mfspr r10, SPRN_M_TW /* Restore registers */
555 lwz r11, 0(r0)
556 mtcr r11
557 lwz r11, 4(r0)
558#ifdef CONFIG_8xx_CPU6
559 lwz r3, 8(r0)
560#endif
561 rfi
5622:
563 mfspr r10, SPRN_M_TW /* Restore registers */ 508 mfspr r10, SPRN_M_TW /* Restore registers */
564 lwz r11, 0(r0) 509 lwz r11, 0(r0)
565 mtcr r11 510 mtcr r11
@@ -588,6 +533,140 @@ DataTLBError:
588 533
589 . = 0x2000 534 . = 0x2000
590 535
536/* This is the procedure to calculate the data EA for buggy dcbx,dcbi instructions
537 * by decoding the registers used by the dcbx instruction and adding them.
538 * DAR is set to the calculated address and r10 also holds the EA on exit.
539 */
540 /* define if you don't want to use self modifying code */
541#define NO_SELF_MODIFYING_CODE
542FixupDAR:/* Entry point for dcbx workaround. */
543 /* fetch instruction from memory. */
544 mfspr r10, SPRN_SRR0
545 DO_8xx_CPU6(0x3780, r3)
546 mtspr SPRN_MD_EPN, r10
547 mfspr r11, SPRN_M_TWB /* Get level 1 table entry address */
548 cmplwi cr0, r11, 0x0800
549 blt- 3f /* Branch if user space */
550 lis r11, (swapper_pg_dir-PAGE_OFFSET)@h
551 ori r11, r11, (swapper_pg_dir-PAGE_OFFSET)@l
552 rlwimi r11, r10, 32-20, 0xffc /* r11 = r11&~0xffc|(r10>>20)&0xffc */
5533: lwz r11, 0(r11) /* Get the level 1 entry */
554 DO_8xx_CPU6(0x3b80, r3)
555 mtspr SPRN_MD_TWC, r11 /* Load pte table base address */
556 mfspr r11, SPRN_MD_TWC /* ....and get the pte address */
557 lwz r11, 0(r11) /* Get the pte */
558 /* concat physical page address(r11) and page offset(r10) */
559 rlwimi r11, r10, 0, 20, 31
560 lwz r11,0(r11)
561/* Check if it really is a dcbx instruction. */
562/* dcbt and dcbtst does not generate DTLB Misses/Errors,
563 * no need to include them here */
564 srwi r10, r11, 26 /* check if major OP code is 31 */
565 cmpwi cr0, r10, 31
566 bne- 141f
567 rlwinm r10, r11, 0, 21, 30
568 cmpwi cr0, r10, 2028 /* Is dcbz? */
569 beq+ 142f
570 cmpwi cr0, r10, 940 /* Is dcbi? */
571 beq+ 142f
572 cmpwi cr0, r10, 108 /* Is dcbst? */
573 beq+ 144f /* Fix up store bit! */
574 cmpwi cr0, r10, 172 /* Is dcbf? */
575 beq+ 142f
576 cmpwi cr0, r10, 1964 /* Is icbi? */
577 beq+ 142f
578141: mfspr r10, SPRN_DAR /* r10 must hold DAR at exit */
579 b DARFixed /* Nope, go back to normal TLB processing */
580
581144: mfspr r10, SPRN_DSISR
582 rlwinm r10, r10,0,7,5 /* Clear store bit for buggy dcbst insn */
583 mtspr SPRN_DSISR, r10
584142: /* continue, it was a dcbx, dcbi instruction. */
585#ifdef CONFIG_8xx_CPU6
586 lwz r3, 8(r0) /* restore r3 from memory */
587#endif
588#ifndef NO_SELF_MODIFYING_CODE
589 andis. r10,r11,0x1f /* test if reg RA is r0 */
590 li r10,modified_instr@l
591 dcbtst r0,r10 /* touch for store */
592 rlwinm r11,r11,0,0,20 /* Zero lower 10 bits */
593 oris r11,r11,640 /* Transform instr. to a "add r10,RA,RB" */
594 ori r11,r11,532
595 stw r11,0(r10) /* store add/and instruction */
596 dcbf 0,r10 /* flush new instr. to memory. */
597 icbi 0,r10 /* invalidate instr. cache line */
598 lwz r11, 4(r0) /* restore r11 from memory */
599 mfspr r10, SPRN_M_TW /* restore r10 from M_TW */
600 isync /* Wait until new instr is loaded from memory */
601modified_instr:
602 .space 4 /* this is where the add instr. is stored */
603 bne+ 143f
604 subf r10,r0,r10 /* r10=r10-r0, only if reg RA is r0 */
605143: mtdar r10 /* store faulting EA in DAR */
606 b DARFixed /* Go back to normal TLB handling */
607#else
608 mfctr r10
609 mtdar r10 /* save ctr reg in DAR */
610 rlwinm r10, r11, 24, 24, 28 /* offset into jump table for reg RB */
611 addi r10, r10, 150f@l /* add start of table */
612 mtctr r10 /* load ctr with jump address */
613 xor r10, r10, r10 /* sum starts at zero */
614 bctr /* jump into table */
615150:
616 add r10, r10, r0 ;b 151f
617 add r10, r10, r1 ;b 151f
618 add r10, r10, r2 ;b 151f
619 add r10, r10, r3 ;b 151f
620 add r10, r10, r4 ;b 151f
621 add r10, r10, r5 ;b 151f
622 add r10, r10, r6 ;b 151f
623 add r10, r10, r7 ;b 151f
624 add r10, r10, r8 ;b 151f
625 add r10, r10, r9 ;b 151f
626 mtctr r11 ;b 154f /* r10 needs special handling */
627 mtctr r11 ;b 153f /* r11 needs special handling */
628 add r10, r10, r12 ;b 151f
629 add r10, r10, r13 ;b 151f
630 add r10, r10, r14 ;b 151f
631 add r10, r10, r15 ;b 151f
632 add r10, r10, r16 ;b 151f
633 add r10, r10, r17 ;b 151f
634 add r10, r10, r18 ;b 151f
635 add r10, r10, r19 ;b 151f
636 add r10, r10, r20 ;b 151f
637 add r10, r10, r21 ;b 151f
638 add r10, r10, r22 ;b 151f
639 add r10, r10, r23 ;b 151f
640 add r10, r10, r24 ;b 151f
641 add r10, r10, r25 ;b 151f
642 add r10, r10, r26 ;b 151f
643 add r10, r10, r27 ;b 151f
644 add r10, r10, r28 ;b 151f
645 add r10, r10, r29 ;b 151f
646 add r10, r10, r30 ;b 151f
647 add r10, r10, r31
648151:
649 rlwinm. r11,r11,19,24,28 /* offset into jump table for reg RA */
650 beq 152f /* if reg RA is zero, don't add it */
651 addi r11, r11, 150b@l /* add start of table */
652 mtctr r11 /* load ctr with jump address */
653 rlwinm r11,r11,0,16,10 /* make sure we don't execute this more than once */
654 bctr /* jump into table */
655152:
656 mfdar r11
657 mtctr r11 /* restore ctr reg from DAR */
658 mtdar r10 /* save fault EA to DAR */
659 b DARFixed /* Go back to normal TLB handling */
660
661 /* special handling for r10,r11 since these are modified already */
662153: lwz r11, 4(r0) /* load r11 from memory */
663 b 155f
664154: mfspr r11, SPRN_M_TW /* load r10 from M_TW */
665155: add r10, r10, r11 /* add it */
666 mfctr r11 /* restore r11 */
667 b 151b
668#endif
669
591 .globl giveup_fpu 670 .globl giveup_fpu
592giveup_fpu: 671giveup_fpu:
593 blr 672 blr
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S
index 975788ca05d2..7f4bd7f3b6af 100644
--- a/arch/powerpc/kernel/head_fsl_booke.S
+++ b/arch/powerpc/kernel/head_fsl_booke.S
@@ -944,28 +944,6 @@ _GLOBAL(__setup_e500mc_ivors)
944 blr 944 blr
945 945
946/* 946/*
947 * extern void loadcam_entry(unsigned int index)
948 *
949 * Load TLBCAM[index] entry in to the L2 CAM MMU
950 */
951_GLOBAL(loadcam_entry)
952 lis r4,TLBCAM@ha
953 addi r4,r4,TLBCAM@l
954 mulli r5,r3,TLBCAM_SIZE
955 add r3,r5,r4
956 lwz r4,0(r3)
957 mtspr SPRN_MAS0,r4
958 lwz r4,4(r3)
959 mtspr SPRN_MAS1,r4
960 lwz r4,8(r3)
961 mtspr SPRN_MAS2,r4
962 lwz r4,12(r3)
963 mtspr SPRN_MAS3,r4
964 tlbwe
965 isync
966 blr
967
968/*
969 * extern void giveup_altivec(struct task_struct *prev) 947 * extern void giveup_altivec(struct task_struct *prev)
970 * 948 *
971 * The e500 core does not have an AltiVec unit. 949 * The e500 core does not have an AltiVec unit.
diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c
index 1882bf419fa6..8dc7547c2377 100644
--- a/arch/powerpc/kernel/io.c
+++ b/arch/powerpc/kernel/io.c
@@ -161,7 +161,7 @@ void _memcpy_fromio(void *dest, const volatile void __iomem *src,
161 dest++; 161 dest++;
162 n--; 162 n--;
163 } 163 }
164 while(n > 4) { 164 while(n >= 4) {
165 *((u32 *)dest) = *((volatile u32 *)vsrc); 165 *((u32 *)dest) = *((volatile u32 *)vsrc);
166 eieio(); 166 eieio();
167 vsrc += 4; 167 vsrc += 4;
@@ -190,7 +190,7 @@ void _memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n)
190 vdest++; 190 vdest++;
191 n--; 191 n--;
192 } 192 }
193 while(n > 4) { 193 while(n >= 4) {
194 *((volatile u32 *)vdest) = *((volatile u32 *)src); 194 *((volatile u32 *)vdest) = *((volatile u32 *)src);
195 src += 4; 195 src += 4;
196 vdest += 4; 196 vdest += 4;
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 02a334662cc0..f6dca4f4b295 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -87,7 +87,10 @@ extern int tau_interrupts(int);
87#endif /* CONFIG_PPC32 */ 87#endif /* CONFIG_PPC32 */
88 88
89#ifdef CONFIG_PPC64 89#ifdef CONFIG_PPC64
90
91#ifndef CONFIG_SPARSE_IRQ
90EXPORT_SYMBOL(irq_desc); 92EXPORT_SYMBOL(irq_desc);
93#endif
91 94
92int distribute_irqs = 1; 95int distribute_irqs = 1;
93 96
@@ -189,33 +192,7 @@ int show_interrupts(struct seq_file *p, void *v)
189 for_each_online_cpu(j) 192 for_each_online_cpu(j)
190 seq_printf(p, "CPU%d ", j); 193 seq_printf(p, "CPU%d ", j);
191 seq_putc(p, '\n'); 194 seq_putc(p, '\n');
192 } 195 } else if (i == nr_irqs) {
193
194 if (i < NR_IRQS) {
195 desc = get_irq_desc(i);
196 spin_lock_irqsave(&desc->lock, flags);
197 action = desc->action;
198 if (!action || !action->handler)
199 goto skip;
200 seq_printf(p, "%3d: ", i);
201#ifdef CONFIG_SMP
202 for_each_online_cpu(j)
203 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
204#else
205 seq_printf(p, "%10u ", kstat_irqs(i));
206#endif /* CONFIG_SMP */
207 if (desc->chip)
208 seq_printf(p, " %s ", desc->chip->typename);
209 else
210 seq_puts(p, " None ");
211 seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge ");
212 seq_printf(p, " %s", action->name);
213 for (action = action->next; action; action = action->next)
214 seq_printf(p, ", %s", action->name);
215 seq_putc(p, '\n');
216skip:
217 spin_unlock_irqrestore(&desc->lock, flags);
218 } else if (i == NR_IRQS) {
219#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT) 196#if defined(CONFIG_PPC32) && defined(CONFIG_TAU_INT)
220 if (tau_initialized){ 197 if (tau_initialized){
221 seq_puts(p, "TAU: "); 198 seq_puts(p, "TAU: ");
@@ -225,30 +202,68 @@ skip:
225 } 202 }
226#endif /* CONFIG_PPC32 && CONFIG_TAU_INT*/ 203#endif /* CONFIG_PPC32 && CONFIG_TAU_INT*/
227 seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts); 204 seq_printf(p, "BAD: %10u\n", ppc_spurious_interrupts);
205
206 return 0;
228 } 207 }
208
209 desc = irq_to_desc(i);
210 if (!desc)
211 return 0;
212
213 spin_lock_irqsave(&desc->lock, flags);
214
215 action = desc->action;
216 if (!action || !action->handler)
217 goto skip;
218
219 seq_printf(p, "%3d: ", i);
220#ifdef CONFIG_SMP
221 for_each_online_cpu(j)
222 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
223#else
224 seq_printf(p, "%10u ", kstat_irqs(i));
225#endif /* CONFIG_SMP */
226
227 if (desc->chip)
228 seq_printf(p, " %s ", desc->chip->name);
229 else
230 seq_puts(p, " None ");
231
232 seq_printf(p, "%s", (desc->status & IRQ_LEVEL) ? "Level " : "Edge ");
233 seq_printf(p, " %s", action->name);
234
235 for (action = action->next; action; action = action->next)
236 seq_printf(p, ", %s", action->name);
237 seq_putc(p, '\n');
238
239skip:
240 spin_unlock_irqrestore(&desc->lock, flags);
241
229 return 0; 242 return 0;
230} 243}
231 244
232#ifdef CONFIG_HOTPLUG_CPU 245#ifdef CONFIG_HOTPLUG_CPU
233void fixup_irqs(cpumask_t map) 246void fixup_irqs(cpumask_t map)
234{ 247{
248 struct irq_desc *desc;
235 unsigned int irq; 249 unsigned int irq;
236 static int warned; 250 static int warned;
237 251
238 for_each_irq(irq) { 252 for_each_irq(irq) {
239 cpumask_t mask; 253 cpumask_t mask;
240 254
241 if (irq_desc[irq].status & IRQ_PER_CPU) 255 desc = irq_to_desc(irq);
256 if (desc && desc->status & IRQ_PER_CPU)
242 continue; 257 continue;
243 258
244 cpumask_and(&mask, irq_desc[irq].affinity, &map); 259 cpumask_and(&mask, desc->affinity, &map);
245 if (any_online_cpu(mask) == NR_CPUS) { 260 if (any_online_cpu(mask) == NR_CPUS) {
246 printk("Breaking affinity for irq %i\n", irq); 261 printk("Breaking affinity for irq %i\n", irq);
247 mask = map; 262 mask = map;
248 } 263 }
249 if (irq_desc[irq].chip->set_affinity) 264 if (desc->chip->set_affinity)
250 irq_desc[irq].chip->set_affinity(irq, &mask); 265 desc->chip->set_affinity(irq, &mask);
251 else if (irq_desc[irq].action && !(warned++)) 266 else if (desc->action && !(warned++))
252 printk("Cannot set affinity for irq %i\n", irq); 267 printk("Cannot set affinity for irq %i\n", irq);
253 } 268 }
254 269
@@ -275,7 +290,7 @@ static inline void handle_one_irq(unsigned int irq)
275 return; 290 return;
276 } 291 }
277 292
278 desc = irq_desc + irq; 293 desc = irq_to_desc(irq);
279 saved_sp_limit = current->thread.ksp_limit; 294 saved_sp_limit = current->thread.ksp_limit;
280 295
281 irqtp->task = curtp->task; 296 irqtp->task = curtp->task;
@@ -541,7 +556,7 @@ struct irq_host *irq_alloc_host(struct device_node *of_node,
541 smp_wmb(); 556 smp_wmb();
542 557
543 /* Clear norequest flags */ 558 /* Clear norequest flags */
544 get_irq_desc(i)->status &= ~IRQ_NOREQUEST; 559 irq_to_desc(i)->status &= ~IRQ_NOREQUEST;
545 560
546 /* Legacy flags are left to default at this point, 561 /* Legacy flags are left to default at this point,
547 * one can then use irq_create_mapping() to 562 * one can then use irq_create_mapping() to
@@ -607,8 +622,16 @@ void irq_set_virq_count(unsigned int count)
607static int irq_setup_virq(struct irq_host *host, unsigned int virq, 622static int irq_setup_virq(struct irq_host *host, unsigned int virq,
608 irq_hw_number_t hwirq) 623 irq_hw_number_t hwirq)
609{ 624{
625 struct irq_desc *desc;
626
627 desc = irq_to_desc_alloc_node(virq, 0);
628 if (!desc) {
629 pr_debug("irq: -> allocating desc failed\n");
630 goto error;
631 }
632
610 /* Clear IRQ_NOREQUEST flag */ 633 /* Clear IRQ_NOREQUEST flag */
611 get_irq_desc(virq)->status &= ~IRQ_NOREQUEST; 634 desc->status &= ~IRQ_NOREQUEST;
612 635
613 /* map it */ 636 /* map it */
614 smp_wmb(); 637 smp_wmb();
@@ -617,11 +640,14 @@ static int irq_setup_virq(struct irq_host *host, unsigned int virq,
617 640
618 if (host->ops->map(host, virq, hwirq)) { 641 if (host->ops->map(host, virq, hwirq)) {
619 pr_debug("irq: -> mapping failed, freeing\n"); 642 pr_debug("irq: -> mapping failed, freeing\n");
620 irq_free_virt(virq, 1); 643 goto error;
621 return -1;
622 } 644 }
623 645
624 return 0; 646 return 0;
647
648error:
649 irq_free_virt(virq, 1);
650 return -1;
625} 651}
626 652
627unsigned int irq_create_direct_mapping(struct irq_host *host) 653unsigned int irq_create_direct_mapping(struct irq_host *host)
@@ -705,7 +731,7 @@ unsigned int irq_create_mapping(struct irq_host *host,
705EXPORT_SYMBOL_GPL(irq_create_mapping); 731EXPORT_SYMBOL_GPL(irq_create_mapping);
706 732
707unsigned int irq_create_of_mapping(struct device_node *controller, 733unsigned int irq_create_of_mapping(struct device_node *controller,
708 u32 *intspec, unsigned int intsize) 734 const u32 *intspec, unsigned int intsize)
709{ 735{
710 struct irq_host *host; 736 struct irq_host *host;
711 irq_hw_number_t hwirq; 737 irq_hw_number_t hwirq;
@@ -738,7 +764,7 @@ unsigned int irq_create_of_mapping(struct device_node *controller,
738 764
739 /* Set type if specified and different than the current one */ 765 /* Set type if specified and different than the current one */
740 if (type != IRQ_TYPE_NONE && 766 if (type != IRQ_TYPE_NONE &&
741 type != (get_irq_desc(virq)->status & IRQF_TRIGGER_MASK)) 767 type != (irq_to_desc(virq)->status & IRQF_TRIGGER_MASK))
742 set_irq_type(virq, type); 768 set_irq_type(virq, type);
743 return virq; 769 return virq;
744} 770}
@@ -810,7 +836,7 @@ void irq_dispose_mapping(unsigned int virq)
810 irq_map[virq].hwirq = host->inval_irq; 836 irq_map[virq].hwirq = host->inval_irq;
811 837
812 /* Set some flags */ 838 /* Set some flags */
813 get_irq_desc(virq)->status |= IRQ_NOREQUEST; 839 irq_to_desc(virq)->status |= IRQ_NOREQUEST;
814 840
815 /* Free it */ 841 /* Free it */
816 irq_free_virt(virq, 1); 842 irq_free_virt(virq, 1);
@@ -1002,12 +1028,24 @@ void irq_free_virt(unsigned int virq, unsigned int count)
1002 spin_unlock_irqrestore(&irq_big_lock, flags); 1028 spin_unlock_irqrestore(&irq_big_lock, flags);
1003} 1029}
1004 1030
1005void irq_early_init(void) 1031int arch_early_irq_init(void)
1006{ 1032{
1007 unsigned int i; 1033 struct irq_desc *desc;
1034 int i;
1035
1036 for (i = 0; i < NR_IRQS; i++) {
1037 desc = irq_to_desc(i);
1038 if (desc)
1039 desc->status |= IRQ_NOREQUEST;
1040 }
1008 1041
1009 for (i = 0; i < NR_IRQS; i++) 1042 return 0;
1010 get_irq_desc(i)->status |= IRQ_NOREQUEST; 1043}
1044
1045int arch_init_chip_data(struct irq_desc *desc, int node)
1046{
1047 desc->status |= IRQ_NOREQUEST;
1048 return 0;
1011} 1049}
1012 1050
1013/* We need to create the radix trees late */ 1051/* We need to create the radix trees late */
@@ -1069,16 +1107,19 @@ static int virq_debug_show(struct seq_file *m, void *private)
1069 seq_printf(m, "%-5s %-7s %-15s %s\n", "virq", "hwirq", 1107 seq_printf(m, "%-5s %-7s %-15s %s\n", "virq", "hwirq",
1070 "chip name", "host name"); 1108 "chip name", "host name");
1071 1109
1072 for (i = 1; i < NR_IRQS; i++) { 1110 for (i = 1; i < nr_irqs; i++) {
1073 desc = get_irq_desc(i); 1111 desc = irq_to_desc(i);
1112 if (!desc)
1113 continue;
1114
1074 spin_lock_irqsave(&desc->lock, flags); 1115 spin_lock_irqsave(&desc->lock, flags);
1075 1116
1076 if (desc->action && desc->action->handler) { 1117 if (desc->action && desc->action->handler) {
1077 seq_printf(m, "%5d ", i); 1118 seq_printf(m, "%5d ", i);
1078 seq_printf(m, "0x%05lx ", virq_to_hw(i)); 1119 seq_printf(m, "0x%05lx ", virq_to_hw(i));
1079 1120
1080 if (desc->chip && desc->chip->typename) 1121 if (desc->chip && desc->chip->name)
1081 p = desc->chip->typename; 1122 p = desc->chip->name;
1082 else 1123 else
1083 p = none; 1124 p = none;
1084 seq_printf(m, "%-15s ", p); 1125 seq_printf(m, "%-15s ", p);
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index ed0ac4e4b8d8..79a00bb9c64c 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -781,9 +781,9 @@ static int __init lparcfg_init(void)
781 !firmware_has_feature(FW_FEATURE_ISERIES)) 781 !firmware_has_feature(FW_FEATURE_ISERIES))
782 mode |= S_IWUSR; 782 mode |= S_IWUSR;
783 783
784 ent = proc_create("ppc64/lparcfg", mode, NULL, &lparcfg_fops); 784 ent = proc_create("powerpc/lparcfg", mode, NULL, &lparcfg_fops);
785 if (!ent) { 785 if (!ent) {
786 printk(KERN_ERR "Failed to create ppc64/lparcfg\n"); 786 printk(KERN_ERR "Failed to create powerpc/lparcfg\n");
787 return -EIO; 787 return -EIO;
788 } 788 }
789 789
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index da9c0c4c10f3..8649f536f8df 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -502,15 +502,7 @@ _GLOBAL(clear_pages)
502 li r0,PAGE_SIZE/L1_CACHE_BYTES 502 li r0,PAGE_SIZE/L1_CACHE_BYTES
503 slw r0,r0,r4 503 slw r0,r0,r4
504 mtctr r0 504 mtctr r0
505#ifdef CONFIG_8xx
506 li r4, 0
5071: stw r4, 0(r3)
508 stw r4, 4(r3)
509 stw r4, 8(r3)
510 stw r4, 12(r3)
511#else
5121: dcbz 0,r3 5051: dcbz 0,r3
513#endif
514 addi r3,r3,L1_CACHE_BYTES 506 addi r3,r3,L1_CACHE_BYTES
515 bdnz 1b 507 bdnz 1b
516 blr 508 blr
@@ -535,15 +527,6 @@ _GLOBAL(copy_page)
535 addi r3,r3,-4 527 addi r3,r3,-4
536 addi r4,r4,-4 528 addi r4,r4,-4
537 529
538#ifdef CONFIG_8xx
539 /* don't use prefetch on 8xx */
540 li r0,4096/L1_CACHE_BYTES
541 mtctr r0
5421: COPY_16_BYTES
543 bdnz 1b
544 blr
545
546#else /* not 8xx, we can prefetch */
547 li r5,4 530 li r5,4
548 531
549#if MAX_COPY_PREFETCH > 1 532#if MAX_COPY_PREFETCH > 1
@@ -584,7 +567,6 @@ _GLOBAL(copy_page)
584 li r0,MAX_COPY_PREFETCH 567 li r0,MAX_COPY_PREFETCH
585 li r11,4 568 li r11,4
586 b 2b 569 b 2b
587#endif /* CONFIG_8xx */
588 570
589/* 571/*
590 * void atomic_clear_mask(atomic_t mask, atomic_t *addr) 572 * void atomic_clear_mask(atomic_t mask, atomic_t *addr)
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index 0ed31f220482..ad461e735aec 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -139,8 +139,8 @@ out:
139 139
140} 140}
141 141
142static int dev_nvram_ioctl(struct inode *inode, struct file *file, 142static long dev_nvram_ioctl(struct file *file, unsigned int cmd,
143 unsigned int cmd, unsigned long arg) 143 unsigned long arg)
144{ 144{
145 switch(cmd) { 145 switch(cmd) {
146#ifdef CONFIG_PPC_PMAC 146#ifdef CONFIG_PPC_PMAC
@@ -169,11 +169,11 @@ static int dev_nvram_ioctl(struct inode *inode, struct file *file,
169} 169}
170 170
171const struct file_operations nvram_fops = { 171const struct file_operations nvram_fops = {
172 .owner = THIS_MODULE, 172 .owner = THIS_MODULE,
173 .llseek = dev_nvram_llseek, 173 .llseek = dev_nvram_llseek,
174 .read = dev_nvram_read, 174 .read = dev_nvram_read,
175 .write = dev_nvram_write, 175 .write = dev_nvram_write,
176 .ioctl = dev_nvram_ioctl, 176 .unlocked_ioctl = dev_nvram_ioctl,
177}; 177};
178 178
179static struct miscdevice nvram_dev = { 179static struct miscdevice nvram_dev = {
@@ -184,7 +184,7 @@ static struct miscdevice nvram_dev = {
184 184
185 185
186#ifdef DEBUG_NVRAM 186#ifdef DEBUG_NVRAM
187static void nvram_print_partitions(char * label) 187static void __init nvram_print_partitions(char * label)
188{ 188{
189 struct list_head * p; 189 struct list_head * p;
190 struct nvram_partition * tmp_part; 190 struct nvram_partition * tmp_part;
@@ -202,7 +202,7 @@ static void nvram_print_partitions(char * label)
202#endif 202#endif
203 203
204 204
205static int nvram_write_header(struct nvram_partition * part) 205static int __init nvram_write_header(struct nvram_partition * part)
206{ 206{
207 loff_t tmp_index; 207 loff_t tmp_index;
208 int rc; 208 int rc;
@@ -214,7 +214,7 @@ static int nvram_write_header(struct nvram_partition * part)
214} 214}
215 215
216 216
217static unsigned char nvram_checksum(struct nvram_header *p) 217static unsigned char __init nvram_checksum(struct nvram_header *p)
218{ 218{
219 unsigned int c_sum, c_sum2; 219 unsigned int c_sum, c_sum2;
220 unsigned short *sp = (unsigned short *)p->name; /* assume 6 shorts */ 220 unsigned short *sp = (unsigned short *)p->name; /* assume 6 shorts */
@@ -228,32 +228,7 @@ static unsigned char nvram_checksum(struct nvram_header *p)
228 return c_sum; 228 return c_sum;
229} 229}
230 230
231 231static int __init nvram_remove_os_partition(void)
232/*
233 * Find an nvram partition, sig can be 0 for any
234 * partition or name can be NULL for any name, else
235 * tries to match both
236 */
237struct nvram_partition *nvram_find_partition(int sig, const char *name)
238{
239 struct nvram_partition * part;
240 struct list_head * p;
241
242 list_for_each(p, &nvram_part->partition) {
243 part = list_entry(p, struct nvram_partition, partition);
244
245 if (sig && part->header.signature != sig)
246 continue;
247 if (name && 0 != strncmp(name, part->header.name, 12))
248 continue;
249 return part;
250 }
251 return NULL;
252}
253EXPORT_SYMBOL(nvram_find_partition);
254
255
256static int nvram_remove_os_partition(void)
257{ 232{
258 struct list_head *i; 233 struct list_head *i;
259 struct list_head *j; 234 struct list_head *j;
@@ -319,7 +294,7 @@ static int nvram_remove_os_partition(void)
319 * Will create a partition starting at the first free 294 * Will create a partition starting at the first free
320 * space found if space has enough room. 295 * space found if space has enough room.
321 */ 296 */
322static int nvram_create_os_partition(void) 297static int __init nvram_create_os_partition(void)
323{ 298{
324 struct nvram_partition *part; 299 struct nvram_partition *part;
325 struct nvram_partition *new_part; 300 struct nvram_partition *new_part;
@@ -422,7 +397,7 @@ static int nvram_create_os_partition(void)
422 * 5.) If the max chunk cannot be allocated then try finding a chunk 397 * 5.) If the max chunk cannot be allocated then try finding a chunk
423 * that will satisfy the minum needed (NVRAM_MIN_REQ). 398 * that will satisfy the minum needed (NVRAM_MIN_REQ).
424 */ 399 */
425static int nvram_setup_partition(void) 400static int __init nvram_setup_partition(void)
426{ 401{
427 struct list_head * p; 402 struct list_head * p;
428 struct nvram_partition * part; 403 struct nvram_partition * part;
@@ -480,7 +455,7 @@ static int nvram_setup_partition(void)
480} 455}
481 456
482 457
483static int nvram_scan_partitions(void) 458static int __init nvram_scan_partitions(void)
484{ 459{
485 loff_t cur_index = 0; 460 loff_t cur_index = 0;
486 struct nvram_header phead; 461 struct nvram_header phead;
@@ -706,6 +681,9 @@ int nvram_clear_error_log(void)
706 int clear_word = ERR_FLAG_ALREADY_LOGGED; 681 int clear_word = ERR_FLAG_ALREADY_LOGGED;
707 int rc; 682 int rc;
708 683
684 if (nvram_error_log_index == -1)
685 return -1;
686
709 tmp_index = nvram_error_log_index; 687 tmp_index = nvram_error_log_index;
710 688
711 rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index); 689 rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index);
diff --git a/arch/powerpc/kernel/perf_callchain.c b/arch/powerpc/kernel/perf_callchain.c
index 0a03cf70d247..a3c11cac3d71 100644
--- a/arch/powerpc/kernel/perf_callchain.c
+++ b/arch/powerpc/kernel/perf_callchain.c
@@ -119,13 +119,6 @@ static void perf_callchain_kernel(struct pt_regs *regs,
119} 119}
120 120
121#ifdef CONFIG_PPC64 121#ifdef CONFIG_PPC64
122
123#ifdef CONFIG_HUGETLB_PAGE
124#define is_huge_psize(pagesize) (HPAGE_SHIFT && mmu_huge_psizes[pagesize])
125#else
126#define is_huge_psize(pagesize) 0
127#endif
128
129/* 122/*
130 * On 64-bit we don't want to invoke hash_page on user addresses from 123 * On 64-bit we don't want to invoke hash_page on user addresses from
131 * interrupt context, so if the access faults, we read the page tables 124 * interrupt context, so if the access faults, we read the page tables
@@ -135,7 +128,7 @@ static int read_user_stack_slow(void __user *ptr, void *ret, int nb)
135{ 128{
136 pgd_t *pgdir; 129 pgd_t *pgdir;
137 pte_t *ptep, pte; 130 pte_t *ptep, pte;
138 int pagesize; 131 unsigned shift;
139 unsigned long addr = (unsigned long) ptr; 132 unsigned long addr = (unsigned long) ptr;
140 unsigned long offset; 133 unsigned long offset;
141 unsigned long pfn; 134 unsigned long pfn;
@@ -145,17 +138,14 @@ static int read_user_stack_slow(void __user *ptr, void *ret, int nb)
145 if (!pgdir) 138 if (!pgdir)
146 return -EFAULT; 139 return -EFAULT;
147 140
148 pagesize = get_slice_psize(current->mm, addr); 141 ptep = find_linux_pte_or_hugepte(pgdir, addr, &shift);
142 if (!shift)
143 shift = PAGE_SHIFT;
149 144
150 /* align address to page boundary */ 145 /* align address to page boundary */
151 offset = addr & ((1ul << mmu_psize_defs[pagesize].shift) - 1); 146 offset = addr & ((1UL << shift) - 1);
152 addr -= offset; 147 addr -= offset;
153 148
154 if (is_huge_psize(pagesize))
155 ptep = huge_pte_offset(current->mm, addr);
156 else
157 ptep = find_linux_pte(pgdir, addr);
158
159 if (ptep == NULL) 149 if (ptep == NULL)
160 return -EFAULT; 150 return -EFAULT;
161 pte = *ptep; 151 pte = *ptep;
@@ -497,11 +487,11 @@ static void perf_callchain_user_32(struct pt_regs *regs,
497 * Since we can't get PMU interrupts inside a PMU interrupt handler, 487 * Since we can't get PMU interrupts inside a PMU interrupt handler,
498 * we don't need separate irq and nmi entries here. 488 * we don't need separate irq and nmi entries here.
499 */ 489 */
500static DEFINE_PER_CPU(struct perf_callchain_entry, callchain); 490static DEFINE_PER_CPU(struct perf_callchain_entry, cpu_perf_callchain);
501 491
502struct perf_callchain_entry *perf_callchain(struct pt_regs *regs) 492struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
503{ 493{
504 struct perf_callchain_entry *entry = &__get_cpu_var(callchain); 494 struct perf_callchain_entry *entry = &__get_cpu_var(cpu_perf_callchain);
505 495
506 entry->nr = 0; 496 entry->nr = 0;
507 497
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index c8b27bb4dbde..425451453e96 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -96,8 +96,6 @@ EXPORT_SYMBOL(copy_4K_page);
96EXPORT_SYMBOL(isa_io_base); 96EXPORT_SYMBOL(isa_io_base);
97EXPORT_SYMBOL(isa_mem_base); 97EXPORT_SYMBOL(isa_mem_base);
98EXPORT_SYMBOL(pci_dram_offset); 98EXPORT_SYMBOL(pci_dram_offset);
99EXPORT_SYMBOL(pci_alloc_consistent);
100EXPORT_SYMBOL(pci_free_consistent);
101#endif /* CONFIG_PCI */ 99#endif /* CONFIG_PCI */
102 100
103EXPORT_SYMBOL(start_thread); 101EXPORT_SYMBOL(start_thread);
@@ -162,7 +160,6 @@ EXPORT_SYMBOL(screen_info);
162 160
163#ifdef CONFIG_PPC32 161#ifdef CONFIG_PPC32
164EXPORT_SYMBOL(timer_interrupt); 162EXPORT_SYMBOL(timer_interrupt);
165EXPORT_SYMBOL(irq_desc);
166EXPORT_SYMBOL(tb_ticks_per_jiffy); 163EXPORT_SYMBOL(tb_ticks_per_jiffy);
167EXPORT_SYMBOL(cacheable_memcpy); 164EXPORT_SYMBOL(cacheable_memcpy);
168EXPORT_SYMBOL(cacheable_memzero); 165EXPORT_SYMBOL(cacheable_memzero);
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_powerpc.c
index c647ddef40dc..1ed3b8d7981e 100644
--- a/arch/powerpc/kernel/proc_ppc64.c
+++ b/arch/powerpc/kernel/proc_powerpc.c
@@ -28,55 +28,7 @@
28#include <asm/uaccess.h> 28#include <asm/uaccess.h>
29#include <asm/prom.h> 29#include <asm/prom.h>
30 30
31static loff_t page_map_seek( struct file *file, loff_t off, int whence); 31#ifdef CONFIG_PPC64
32static ssize_t page_map_read( struct file *file, char __user *buf, size_t nbytes,
33 loff_t *ppos);
34static int page_map_mmap( struct file *file, struct vm_area_struct *vma );
35
36static const struct file_operations page_map_fops = {
37 .llseek = page_map_seek,
38 .read = page_map_read,
39 .mmap = page_map_mmap
40};
41
42/*
43 * Create the ppc64 and ppc64/rtas directories early. This allows us to
44 * assume that they have been previously created in drivers.
45 */
46static int __init proc_ppc64_create(void)
47{
48 struct proc_dir_entry *root;
49
50 root = proc_mkdir("ppc64", NULL);
51 if (!root)
52 return 1;
53
54 if (!of_find_node_by_path("/rtas"))
55 return 0;
56
57 if (!proc_mkdir("rtas", root))
58 return 1;
59
60 if (!proc_symlink("rtas", NULL, "ppc64/rtas"))
61 return 1;
62
63 return 0;
64}
65core_initcall(proc_ppc64_create);
66
67static int __init proc_ppc64_init(void)
68{
69 struct proc_dir_entry *pde;
70
71 pde = proc_create_data("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL,
72 &page_map_fops, vdso_data);
73 if (!pde)
74 return 1;
75 pde->size = PAGE_SIZE;
76
77 return 0;
78}
79__initcall(proc_ppc64_init);
80 32
81static loff_t page_map_seek( struct file *file, loff_t off, int whence) 33static loff_t page_map_seek( struct file *file, loff_t off, int whence)
82{ 34{
@@ -120,3 +72,55 @@ static int page_map_mmap( struct file *file, struct vm_area_struct *vma )
120 return 0; 72 return 0;
121} 73}
122 74
75static const struct file_operations page_map_fops = {
76 .llseek = page_map_seek,
77 .read = page_map_read,
78 .mmap = page_map_mmap
79};
80
81
82static int __init proc_ppc64_init(void)
83{
84 struct proc_dir_entry *pde;
85
86 pde = proc_create_data("powerpc/systemcfg", S_IFREG|S_IRUGO, NULL,
87 &page_map_fops, vdso_data);
88 if (!pde)
89 return 1;
90 pde->size = PAGE_SIZE;
91
92 return 0;
93}
94__initcall(proc_ppc64_init);
95
96#endif /* CONFIG_PPC64 */
97
98/*
99 * Create the ppc64 and ppc64/rtas directories early. This allows us to
100 * assume that they have been previously created in drivers.
101 */
102static int __init proc_ppc64_create(void)
103{
104 struct proc_dir_entry *root;
105
106 root = proc_mkdir("powerpc", NULL);
107 if (!root)
108 return 1;
109
110#ifdef CONFIG_PPC64
111 if (!proc_symlink("ppc64", NULL, "powerpc"))
112 pr_err("Failed to create link /proc/ppc64 -> /proc/powerpc\n");
113#endif
114
115 if (!of_find_node_by_path("/rtas"))
116 return 0;
117
118 if (!proc_mkdir("rtas", root))
119 return 1;
120
121 if (!proc_symlink("rtas", NULL, "powerpc/rtas"))
122 return 1;
123
124 return 0;
125}
126core_initcall(proc_ppc64_create);
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c
index 13011a96a977..a85117d5c9a4 100644
--- a/arch/powerpc/kernel/rtas_flash.c
+++ b/arch/powerpc/kernel/rtas_flash.c
@@ -6,7 +6,7 @@
6 * as published by the Free Software Foundation; either version 6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 * 8 *
9 * /proc/ppc64/rtas/firmware_flash interface 9 * /proc/powerpc/rtas/firmware_flash interface
10 * 10 *
11 * This file implements a firmware_flash interface to pump a firmware 11 * This file implements a firmware_flash interface to pump a firmware
12 * image into the kernel. At reboot time rtas_restart() will see the 12 * image into the kernel. At reboot time rtas_restart() will see the
@@ -740,7 +740,7 @@ static int __init rtas_flash_init(void)
740 return 1; 740 return 1;
741 } 741 }
742 742
743 firmware_flash_pde = create_flash_pde("ppc64/rtas/" 743 firmware_flash_pde = create_flash_pde("powerpc/rtas/"
744 FIRMWARE_FLASH_NAME, 744 FIRMWARE_FLASH_NAME,
745 &rtas_flash_operations); 745 &rtas_flash_operations);
746 if (firmware_flash_pde == NULL) { 746 if (firmware_flash_pde == NULL) {
@@ -754,7 +754,7 @@ static int __init rtas_flash_init(void)
754 if (rc != 0) 754 if (rc != 0)
755 goto cleanup; 755 goto cleanup;
756 756
757 firmware_update_pde = create_flash_pde("ppc64/rtas/" 757 firmware_update_pde = create_flash_pde("powerpc/rtas/"
758 FIRMWARE_UPDATE_NAME, 758 FIRMWARE_UPDATE_NAME,
759 &rtas_flash_operations); 759 &rtas_flash_operations);
760 if (firmware_update_pde == NULL) { 760 if (firmware_update_pde == NULL) {
@@ -768,7 +768,7 @@ static int __init rtas_flash_init(void)
768 if (rc != 0) 768 if (rc != 0)
769 goto cleanup; 769 goto cleanup;
770 770
771 validate_pde = create_flash_pde("ppc64/rtas/" VALIDATE_FLASH_NAME, 771 validate_pde = create_flash_pde("powerpc/rtas/" VALIDATE_FLASH_NAME,
772 &validate_flash_operations); 772 &validate_flash_operations);
773 if (validate_pde == NULL) { 773 if (validate_pde == NULL) {
774 rc = -ENOMEM; 774 rc = -ENOMEM;
@@ -781,7 +781,7 @@ static int __init rtas_flash_init(void)
781 if (rc != 0) 781 if (rc != 0)
782 goto cleanup; 782 goto cleanup;
783 783
784 manage_pde = create_flash_pde("ppc64/rtas/" MANAGE_FLASH_NAME, 784 manage_pde = create_flash_pde("powerpc/rtas/" MANAGE_FLASH_NAME,
785 &manage_flash_operations); 785 &manage_flash_operations);
786 if (manage_pde == NULL) { 786 if (manage_pde == NULL) {
787 rc = -ENOMEM; 787 rc = -ENOMEM;
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/kernel/rtasd.c
index b3cbac855924..2e4832ab2108 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/kernel/rtasd.c
@@ -39,6 +39,7 @@ static unsigned long rtas_log_start;
39static unsigned long rtas_log_size; 39static unsigned long rtas_log_size;
40 40
41static int surveillance_timeout = -1; 41static int surveillance_timeout = -1;
42
42static unsigned int rtas_error_log_max; 43static unsigned int rtas_error_log_max;
43static unsigned int rtas_error_log_buffer_max; 44static unsigned int rtas_error_log_buffer_max;
44 45
@@ -213,9 +214,11 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
213 return; 214 return;
214 } 215 }
215 216
217#ifdef CONFIG_PPC64
216 /* Write error to NVRAM */ 218 /* Write error to NVRAM */
217 if (logging_enabled && !(err_type & ERR_FLAG_BOOT)) 219 if (logging_enabled && !(err_type & ERR_FLAG_BOOT))
218 nvram_write_error_log(buf, len, err_type, error_log_cnt); 220 nvram_write_error_log(buf, len, err_type, error_log_cnt);
221#endif /* CONFIG_PPC64 */
219 222
220 /* 223 /*
221 * rtas errors can occur during boot, and we do want to capture 224 * rtas errors can occur during boot, and we do want to capture
@@ -264,7 +267,6 @@ void pSeries_log_error(char *buf, unsigned int err_type, int fatal)
264 267
265} 268}
266 269
267
268static int rtas_log_open(struct inode * inode, struct file * file) 270static int rtas_log_open(struct inode * inode, struct file * file)
269{ 271{
270 return 0; 272 return 0;
@@ -300,6 +302,7 @@ static ssize_t rtas_log_read(struct file * file, char __user * buf,
300 return -ENOMEM; 302 return -ENOMEM;
301 303
302 spin_lock_irqsave(&rtasd_log_lock, s); 304 spin_lock_irqsave(&rtasd_log_lock, s);
305
303 /* if it's 0, then we know we got the last one (the one in NVRAM) */ 306 /* if it's 0, then we know we got the last one (the one in NVRAM) */
304 while (rtas_log_size == 0) { 307 while (rtas_log_size == 0) {
305 if (file->f_flags & O_NONBLOCK) { 308 if (file->f_flags & O_NONBLOCK) {
@@ -313,7 +316,9 @@ static ssize_t rtas_log_read(struct file * file, char __user * buf,
313 error = -ENODATA; 316 error = -ENODATA;
314 goto out; 317 goto out;
315 } 318 }
319#ifdef CONFIG_PPC64
316 nvram_clear_error_log(); 320 nvram_clear_error_log();
321#endif /* CONFIG_PPC64 */
317 322
318 spin_unlock_irqrestore(&rtasd_log_lock, s); 323 spin_unlock_irqrestore(&rtasd_log_lock, s);
319 error = wait_event_interruptible(rtas_log_wait, rtas_log_size); 324 error = wait_event_interruptible(rtas_log_wait, rtas_log_size);
@@ -427,14 +432,11 @@ static void rtas_event_scan(struct work_struct *w)
427 put_online_cpus(); 432 put_online_cpus();
428} 433}
429 434
430static void start_event_scan(void) 435#ifdef CONFIG_PPC64
436static void retreive_nvram_error_log(void)
431{ 437{
432 unsigned int err_type; 438 unsigned int err_type ;
433 int rc; 439 int rc ;
434
435 printk(KERN_DEBUG "RTAS daemon started\n");
436 pr_debug("rtasd: will sleep for %d milliseconds\n",
437 (30000 / rtas_event_scan_rate));
438 440
439 /* See if we have any error stored in NVRAM */ 441 /* See if we have any error stored in NVRAM */
440 memset(logdata, 0, rtas_error_log_max); 442 memset(logdata, 0, rtas_error_log_max);
@@ -442,12 +444,26 @@ static void start_event_scan(void)
442 &err_type, &error_log_cnt); 444 &err_type, &error_log_cnt);
443 /* We can use rtas_log_buf now */ 445 /* We can use rtas_log_buf now */
444 logging_enabled = 1; 446 logging_enabled = 1;
445
446 if (!rc) { 447 if (!rc) {
447 if (err_type != ERR_FLAG_ALREADY_LOGGED) { 448 if (err_type != ERR_FLAG_ALREADY_LOGGED) {
448 pSeries_log_error(logdata, err_type | ERR_FLAG_BOOT, 0); 449 pSeries_log_error(logdata, err_type | ERR_FLAG_BOOT, 0);
449 } 450 }
450 } 451 }
452}
453#else /* CONFIG_PPC64 */
454static void retreive_nvram_error_log(void)
455{
456}
457#endif /* CONFIG_PPC64 */
458
459static void start_event_scan(void)
460{
461 printk(KERN_DEBUG "RTAS daemon started\n");
462 pr_debug("rtasd: will sleep for %d milliseconds\n",
463 (30000 / rtas_event_scan_rate));
464
465 /* Retreive errors from nvram if any */
466 retreive_nvram_error_log();
451 467
452 schedule_delayed_work_on(first_cpu(cpu_online_map), &event_scan_work, 468 schedule_delayed_work_on(first_cpu(cpu_online_map), &event_scan_work,
453 event_scan_delay); 469 event_scan_delay);
@@ -457,13 +473,13 @@ static int __init rtas_init(void)
457{ 473{
458 struct proc_dir_entry *entry; 474 struct proc_dir_entry *entry;
459 475
460 if (!machine_is(pseries)) 476 if (!machine_is(pseries) && !machine_is(chrp))
461 return 0; 477 return 0;
462 478
463 /* No RTAS */ 479 /* No RTAS */
464 event_scan = rtas_token("event-scan"); 480 event_scan = rtas_token("event-scan");
465 if (event_scan == RTAS_UNKNOWN_SERVICE) { 481 if (event_scan == RTAS_UNKNOWN_SERVICE) {
466 printk(KERN_DEBUG "rtasd: no event-scan on system\n"); 482 printk(KERN_INFO "rtasd: No event-scan on system\n");
467 return -ENODEV; 483 return -ENODEV;
468 } 484 }
469 485
@@ -483,7 +499,7 @@ static int __init rtas_init(void)
483 return -ENOMEM; 499 return -ENOMEM;
484 } 500 }
485 501
486 entry = proc_create("ppc64/rtas/error_log", S_IRUSR, NULL, 502 entry = proc_create("powerpc/rtas/error_log", S_IRUSR, NULL,
487 &proc_rtas_log_operations); 503 &proc_rtas_log_operations);
488 if (!entry) 504 if (!entry)
489 printk(KERN_ERR "Failed to create error_log proc entry\n"); 505 printk(KERN_ERR "Failed to create error_log proc entry\n");
@@ -492,11 +508,16 @@ static int __init rtas_init(void)
492 508
493 return 0; 509 return 0;
494} 510}
511__initcall(rtas_init);
495 512
496static int __init surveillance_setup(char *str) 513static int __init surveillance_setup(char *str)
497{ 514{
498 int i; 515 int i;
499 516
517 /* We only do surveillance on pseries */
518 if (!machine_is(pseries))
519 return 0;
520
500 if (get_option(&str,&i)) { 521 if (get_option(&str,&i)) {
501 if (i >= 0 && i <= 255) 522 if (i >= 0 && i <= 255)
502 surveillance_timeout = i; 523 surveillance_timeout = i;
@@ -504,6 +525,7 @@ static int __init surveillance_setup(char *str)
504 525
505 return 1; 526 return 1;
506} 527}
528__setup("surveillance=", surveillance_setup);
507 529
508static int __init rtasmsgs_setup(char *str) 530static int __init rtasmsgs_setup(char *str)
509{ 531{
@@ -514,6 +536,4 @@ static int __init rtasmsgs_setup(char *str)
514 536
515 return 1; 537 return 1;
516} 538}
517__initcall(rtas_init);
518__setup("surveillance=", surveillance_setup);
519__setup("rtasmsgs=", rtasmsgs_setup); 539__setup("rtasmsgs=", rtasmsgs_setup);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index 845c72ab7357..03dd6a248198 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -157,7 +157,7 @@ extern u32 cpu_temp_both(unsigned long cpu);
157#endif /* CONFIG_TAU */ 157#endif /* CONFIG_TAU */
158 158
159#ifdef CONFIG_SMP 159#ifdef CONFIG_SMP
160DEFINE_PER_CPU(unsigned int, pvr); 160DEFINE_PER_CPU(unsigned int, cpu_pvr);
161#endif 161#endif
162 162
163static int show_cpuinfo(struct seq_file *m, void *v) 163static int show_cpuinfo(struct seq_file *m, void *v)
@@ -209,7 +209,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
209 } 209 }
210 210
211#ifdef CONFIG_SMP 211#ifdef CONFIG_SMP
212 pvr = per_cpu(pvr, cpu_id); 212 pvr = per_cpu(cpu_pvr, cpu_id);
213#else 213#else
214 pvr = mfspr(SPRN_PVR); 214 pvr = mfspr(SPRN_PVR);
215#endif 215#endif
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index df2c9e932b37..6568406b2a30 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -356,11 +356,6 @@ void __init setup_system(void)
356 */ 356 */
357 initialize_cache_info(); 357 initialize_cache_info();
358 358
359 /*
360 * Initialize irq remapping subsystem
361 */
362 irq_early_init();
363
364#ifdef CONFIG_PPC_RTAS 359#ifdef CONFIG_PPC_RTAS
365 /* 360 /*
366 * Initialize RTAS if available 361 * Initialize RTAS if available
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 9b86a74d2815..a521fb8a40ee 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -218,6 +218,9 @@ void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
218 218
219static void stop_this_cpu(void *dummy) 219static void stop_this_cpu(void *dummy)
220{ 220{
221 /* Remove this CPU */
222 set_cpu_online(smp_processor_id(), false);
223
221 local_irq_disable(); 224 local_irq_disable();
222 while (1) 225 while (1)
223 ; 226 ;
@@ -232,7 +235,7 @@ struct thread_info *current_set[NR_CPUS];
232 235
233static void __devinit smp_store_cpu_info(int id) 236static void __devinit smp_store_cpu_info(int id)
234{ 237{
235 per_cpu(pvr, id) = mfspr(SPRN_PVR); 238 per_cpu(cpu_pvr, id) = mfspr(SPRN_PVR);
236} 239}
237 240
238static void __init smp_create_idle(unsigned int cpu) 241static void __init smp_create_idle(unsigned int cpu)
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index c04832c4a02e..3370e62e43d4 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -140,7 +140,6 @@ static inline unsigned long do_mmap2(unsigned long addr, size_t len,
140 unsigned long prot, unsigned long flags, 140 unsigned long prot, unsigned long flags,
141 unsigned long fd, unsigned long off, int shift) 141 unsigned long fd, unsigned long off, int shift)
142{ 142{
143 struct file * file = NULL;
144 unsigned long ret = -EINVAL; 143 unsigned long ret = -EINVAL;
145 144
146 if (!arch_validate_prot(prot)) 145 if (!arch_validate_prot(prot))
@@ -151,20 +150,8 @@ static inline unsigned long do_mmap2(unsigned long addr, size_t len,
151 goto out; 150 goto out;
152 off >>= shift; 151 off >>= shift;
153 } 152 }
154
155 ret = -EBADF;
156 if (!(flags & MAP_ANONYMOUS)) {
157 if (!(file = fget(fd)))
158 goto out;
159 }
160
161 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
162 153
163 down_write(&current->mm->mmap_sem); 154 ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off);
164 ret = do_mmap_pgoff(file, addr, len, prot, flags, off);
165 up_write(&current->mm->mmap_sem);
166 if (file)
167 fput(file);
168out: 155out:
169 return ret; 156 return ret;
170} 157}
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 956ab33fd73f..e235e52dc4fe 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -461,6 +461,25 @@ static void unregister_cpu_online(unsigned int cpu)
461 461
462 cacheinfo_cpu_offline(cpu); 462 cacheinfo_cpu_offline(cpu);
463} 463}
464
465#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
466ssize_t arch_cpu_probe(const char *buf, size_t count)
467{
468 if (ppc_md.cpu_probe)
469 return ppc_md.cpu_probe(buf, count);
470
471 return -EINVAL;
472}
473
474ssize_t arch_cpu_release(const char *buf, size_t count)
475{
476 if (ppc_md.cpu_release)
477 return ppc_md.cpu_release(buf, count);
478
479 return -EINVAL;
480}
481#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
482
464#endif /* CONFIG_HOTPLUG_CPU */ 483#endif /* CONFIG_HOTPLUG_CPU */
465 484
466static int __cpuinit sysfs_cpu_notify(struct notifier_block *self, 485static int __cpuinit sysfs_cpu_notify(struct notifier_block *self,
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 674800b242d6..9ba2cc88591d 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -269,6 +269,7 @@ void account_system_vtime(struct task_struct *tsk)
269 per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled; 269 per_cpu(cputime_scaled_last_delta, smp_processor_id()) = deltascaled;
270 local_irq_restore(flags); 270 local_irq_restore(flags);
271} 271}
272EXPORT_SYMBOL_GPL(account_system_vtime);
272 273
273/* 274/*
274 * Transfer the user and system times accumulated in the paca 275 * Transfer the user and system times accumulated in the paca
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 9d1f9354d6ca..804f0f30f227 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -198,28 +198,6 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
198 info.si_code = code; 198 info.si_code = code;
199 info.si_addr = (void __user *) addr; 199 info.si_addr = (void __user *) addr;
200 force_sig_info(signr, &info, current); 200 force_sig_info(signr, &info, current);
201
202 /*
203 * Init gets no signals that it doesn't have a handler for.
204 * That's all very well, but if it has caused a synchronous
205 * exception and we ignore the resulting signal, it will just
206 * generate the same exception over and over again and we get
207 * nowhere. Better to kill it and let the kernel panic.
208 */
209 if (is_global_init(current)) {
210 __sighandler_t handler;
211
212 spin_lock_irq(&current->sighand->siglock);
213 handler = current->sighand->action[signr-1].sa.sa_handler;
214 spin_unlock_irq(&current->sighand->siglock);
215 if (handler == SIG_DFL) {
216 /* init has generated a synchronous exception
217 and it doesn't have a handler for the signal */
218 printk(KERN_CRIT "init has generated signal %d "
219 "but has no handler for it\n", signr);
220 do_exit(signr);
221 }
222 }
223} 201}
224 202
225#ifdef CONFIG_PPC64 203#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kernel/vector.S b/arch/powerpc/kernel/vector.S
index 67b6916f0e94..fe460482fa68 100644
--- a/arch/powerpc/kernel/vector.S
+++ b/arch/powerpc/kernel/vector.S
@@ -58,7 +58,7 @@ _GLOBAL(load_up_altivec)
58 * all 1's 58 * all 1's
59 */ 59 */
60 mfspr r4,SPRN_VRSAVE 60 mfspr r4,SPRN_VRSAVE
61 cmpdi 0,r4,0 61 cmpwi 0,r4,0
62 bne+ 1f 62 bne+ 1f
63 li r4,-1 63 li r4,-1
64 mtspr SPRN_VRSAVE,r4 64 mtspr SPRN_VRSAVE,r4
diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig
index c29926846613..07703f72330e 100644
--- a/arch/powerpc/kvm/Kconfig
+++ b/arch/powerpc/kvm/Kconfig
@@ -21,6 +21,23 @@ config KVM
21 select PREEMPT_NOTIFIERS 21 select PREEMPT_NOTIFIERS
22 select ANON_INODES 22 select ANON_INODES
23 23
24config KVM_BOOK3S_64_HANDLER
25 bool
26
27config KVM_BOOK3S_64
28 tristate "KVM support for PowerPC book3s_64 processors"
29 depends on EXPERIMENTAL && PPC64
30 select KVM
31 select KVM_BOOK3S_64_HANDLER
32 ---help---
33 Support running unmodified book3s_64 and book3s_32 guest kernels
34 in virtual machines on book3s_64 host processors.
35
36 This module provides access to the hardware capabilities through
37 a character device node named /dev/kvm.
38
39 If unsure, say N.
40
24config KVM_440 41config KVM_440
25 bool "KVM support for PowerPC 440 processors" 42 bool "KVM support for PowerPC 440 processors"
26 depends on EXPERIMENTAL && 44x 43 depends on EXPERIMENTAL && 44x
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index 37655fe19f2f..56484d652377 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -12,26 +12,45 @@ CFLAGS_44x_tlb.o := -I.
12CFLAGS_e500_tlb.o := -I. 12CFLAGS_e500_tlb.o := -I.
13CFLAGS_emulate.o := -I. 13CFLAGS_emulate.o := -I.
14 14
15kvm-objs := $(common-objs-y) powerpc.o emulate.o 15common-objs-y += powerpc.o emulate.o
16obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o 16obj-$(CONFIG_KVM_EXIT_TIMING) += timing.o
17obj-$(CONFIG_KVM) += kvm.o 17obj-$(CONFIG_KVM_BOOK3S_64_HANDLER) += book3s_64_exports.o
18 18
19AFLAGS_booke_interrupts.o := -I$(obj) 19AFLAGS_booke_interrupts.o := -I$(obj)
20 20
21kvm-440-objs := \ 21kvm-440-objs := \
22 $(common-objs-y) \
22 booke.o \ 23 booke.o \
23 booke_emulate.o \ 24 booke_emulate.o \
24 booke_interrupts.o \ 25 booke_interrupts.o \
25 44x.o \ 26 44x.o \
26 44x_tlb.o \ 27 44x_tlb.o \
27 44x_emulate.o 28 44x_emulate.o
28obj-$(CONFIG_KVM_440) += kvm-440.o 29kvm-objs-$(CONFIG_KVM_440) := $(kvm-440-objs)
29 30
30kvm-e500-objs := \ 31kvm-e500-objs := \
32 $(common-objs-y) \
31 booke.o \ 33 booke.o \
32 booke_emulate.o \ 34 booke_emulate.o \
33 booke_interrupts.o \ 35 booke_interrupts.o \
34 e500.o \ 36 e500.o \
35 e500_tlb.o \ 37 e500_tlb.o \
36 e500_emulate.o 38 e500_emulate.o
37obj-$(CONFIG_KVM_E500) += kvm-e500.o 39kvm-objs-$(CONFIG_KVM_E500) := $(kvm-e500-objs)
40
41kvm-book3s_64-objs := \
42 $(common-objs-y) \
43 book3s.o \
44 book3s_64_emulate.o \
45 book3s_64_interrupts.o \
46 book3s_64_mmu_host.o \
47 book3s_64_mmu.o \
48 book3s_32_mmu.o
49kvm-objs-$(CONFIG_KVM_BOOK3S_64) := $(kvm-book3s_64-objs)
50
51kvm-objs := $(kvm-objs-m) $(kvm-objs-y)
52
53obj-$(CONFIG_KVM_440) += kvm.o
54obj-$(CONFIG_KVM_E500) += kvm.o
55obj-$(CONFIG_KVM_BOOK3S_64) += kvm.o
56
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
new file mode 100644
index 000000000000..3e294bd9b8c6
--- /dev/null
+++ b/arch/powerpc/kvm/book3s.c
@@ -0,0 +1,974 @@
1/*
2 * Copyright (C) 2009. SUSE Linux Products GmbH. All rights reserved.
3 *
4 * Authors:
5 * Alexander Graf <agraf@suse.de>
6 * Kevin Wolf <mail@kevin-wolf.de>
7 *
8 * Description:
9 * This file is derived from arch/powerpc/kvm/44x.c,
10 * by Hollis Blanchard <hollisb@us.ibm.com>.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License, version 2, as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/kvm_host.h>
18#include <linux/err.h>
19
20#include <asm/reg.h>
21#include <asm/cputable.h>
22#include <asm/cacheflush.h>
23#include <asm/tlbflush.h>
24#include <asm/uaccess.h>
25#include <asm/io.h>
26#include <asm/kvm_ppc.h>
27#include <asm/kvm_book3s.h>
28#include <asm/mmu_context.h>
29#include <linux/sched.h>
30#include <linux/vmalloc.h>
31
32#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
33
34/* #define EXIT_DEBUG */
35/* #define EXIT_DEBUG_SIMPLE */
36
37/* Without AGGRESSIVE_DEC we only fire off a DEC interrupt when DEC turns 0.
38 * When set, we retrigger a DEC interrupt after that if DEC <= 0.
39 * PPC32 Linux runs faster without AGGRESSIVE_DEC, PPC64 Linux requires it. */
40
41/* #define AGGRESSIVE_DEC */
42
43struct kvm_stats_debugfs_item debugfs_entries[] = {
44 { "exits", VCPU_STAT(sum_exits) },
45 { "mmio", VCPU_STAT(mmio_exits) },
46 { "sig", VCPU_STAT(signal_exits) },
47 { "sysc", VCPU_STAT(syscall_exits) },
48 { "inst_emu", VCPU_STAT(emulated_inst_exits) },
49 { "dec", VCPU_STAT(dec_exits) },
50 { "ext_intr", VCPU_STAT(ext_intr_exits) },
51 { "queue_intr", VCPU_STAT(queue_intr) },
52 { "halt_wakeup", VCPU_STAT(halt_wakeup) },
53 { "pf_storage", VCPU_STAT(pf_storage) },
54 { "sp_storage", VCPU_STAT(sp_storage) },
55 { "pf_instruc", VCPU_STAT(pf_instruc) },
56 { "sp_instruc", VCPU_STAT(sp_instruc) },
57 { "ld", VCPU_STAT(ld) },
58 { "ld_slow", VCPU_STAT(ld_slow) },
59 { "st", VCPU_STAT(st) },
60 { "st_slow", VCPU_STAT(st_slow) },
61 { NULL }
62};
63
64void kvmppc_core_load_host_debugstate(struct kvm_vcpu *vcpu)
65{
66}
67
68void kvmppc_core_load_guest_debugstate(struct kvm_vcpu *vcpu)
69{
70}
71
72void kvmppc_core_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
73{
74 memcpy(get_paca()->kvm_slb, to_book3s(vcpu)->slb_shadow, sizeof(get_paca()->kvm_slb));
75 get_paca()->kvm_slb_max = to_book3s(vcpu)->slb_shadow_max;
76}
77
78void kvmppc_core_vcpu_put(struct kvm_vcpu *vcpu)
79{
80 memcpy(to_book3s(vcpu)->slb_shadow, get_paca()->kvm_slb, sizeof(get_paca()->kvm_slb));
81 to_book3s(vcpu)->slb_shadow_max = get_paca()->kvm_slb_max;
82}
83
84#if defined(AGGRESSIVE_DEC) || defined(EXIT_DEBUG)
85static u32 kvmppc_get_dec(struct kvm_vcpu *vcpu)
86{
87 u64 jd = mftb() - vcpu->arch.dec_jiffies;
88 return vcpu->arch.dec - jd;
89}
90#endif
91
92void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr)
93{
94 ulong old_msr = vcpu->arch.msr;
95
96#ifdef EXIT_DEBUG
97 printk(KERN_INFO "KVM: Set MSR to 0x%llx\n", msr);
98#endif
99 msr &= to_book3s(vcpu)->msr_mask;
100 vcpu->arch.msr = msr;
101 vcpu->arch.shadow_msr = msr | MSR_USER32;
102 vcpu->arch.shadow_msr &= ( MSR_VEC | MSR_VSX | MSR_FP | MSR_FE0 |
103 MSR_USER64 | MSR_SE | MSR_BE | MSR_DE |
104 MSR_FE1);
105
106 if (msr & (MSR_WE|MSR_POW)) {
107 if (!vcpu->arch.pending_exceptions) {
108 kvm_vcpu_block(vcpu);
109 vcpu->stat.halt_wakeup++;
110 }
111 }
112
113 if (((vcpu->arch.msr & (MSR_IR|MSR_DR)) != (old_msr & (MSR_IR|MSR_DR))) ||
114 (vcpu->arch.msr & MSR_PR) != (old_msr & MSR_PR)) {
115 kvmppc_mmu_flush_segments(vcpu);
116 kvmppc_mmu_map_segment(vcpu, vcpu->arch.pc);
117 }
118}
119
120void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags)
121{
122 vcpu->arch.srr0 = vcpu->arch.pc;
123 vcpu->arch.srr1 = vcpu->arch.msr | flags;
124 vcpu->arch.pc = to_book3s(vcpu)->hior + vec;
125 vcpu->arch.mmu.reset_msr(vcpu);
126}
127
128void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
129{
130 unsigned int prio;
131
132 vcpu->stat.queue_intr++;
133 switch (vec) {
134 case 0x100: prio = BOOK3S_IRQPRIO_SYSTEM_RESET; break;
135 case 0x200: prio = BOOK3S_IRQPRIO_MACHINE_CHECK; break;
136 case 0x300: prio = BOOK3S_IRQPRIO_DATA_STORAGE; break;
137 case 0x380: prio = BOOK3S_IRQPRIO_DATA_SEGMENT; break;
138 case 0x400: prio = BOOK3S_IRQPRIO_INST_STORAGE; break;
139 case 0x480: prio = BOOK3S_IRQPRIO_INST_SEGMENT; break;
140 case 0x500: prio = BOOK3S_IRQPRIO_EXTERNAL; break;
141 case 0x600: prio = BOOK3S_IRQPRIO_ALIGNMENT; break;
142 case 0x700: prio = BOOK3S_IRQPRIO_PROGRAM; break;
143 case 0x800: prio = BOOK3S_IRQPRIO_FP_UNAVAIL; break;
144 case 0x900: prio = BOOK3S_IRQPRIO_DECREMENTER; break;
145 case 0xc00: prio = BOOK3S_IRQPRIO_SYSCALL; break;
146 case 0xd00: prio = BOOK3S_IRQPRIO_DEBUG; break;
147 case 0xf20: prio = BOOK3S_IRQPRIO_ALTIVEC; break;
148 case 0xf40: prio = BOOK3S_IRQPRIO_VSX; break;
149 default: prio = BOOK3S_IRQPRIO_MAX; break;
150 }
151
152 set_bit(prio, &vcpu->arch.pending_exceptions);
153#ifdef EXIT_DEBUG
154 printk(KERN_INFO "Queueing interrupt %x\n", vec);
155#endif
156}
157
158
159void kvmppc_core_queue_program(struct kvm_vcpu *vcpu)
160{
161 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_PROGRAM);
162}
163
164void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu)
165{
166 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DECREMENTER);
167}
168
169int kvmppc_core_pending_dec(struct kvm_vcpu *vcpu)
170{
171 return test_bit(BOOK3S_INTERRUPT_DECREMENTER >> 7, &vcpu->arch.pending_exceptions);
172}
173
174void kvmppc_core_queue_external(struct kvm_vcpu *vcpu,
175 struct kvm_interrupt *irq)
176{
177 kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_EXTERNAL);
178}
179
180int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority)
181{
182 int deliver = 1;
183 int vec = 0;
184
185 switch (priority) {
186 case BOOK3S_IRQPRIO_DECREMENTER:
187 deliver = vcpu->arch.msr & MSR_EE;
188 vec = BOOK3S_INTERRUPT_DECREMENTER;
189 break;
190 case BOOK3S_IRQPRIO_EXTERNAL:
191 deliver = vcpu->arch.msr & MSR_EE;
192 vec = BOOK3S_INTERRUPT_EXTERNAL;
193 break;
194 case BOOK3S_IRQPRIO_SYSTEM_RESET:
195 vec = BOOK3S_INTERRUPT_SYSTEM_RESET;
196 break;
197 case BOOK3S_IRQPRIO_MACHINE_CHECK:
198 vec = BOOK3S_INTERRUPT_MACHINE_CHECK;
199 break;
200 case BOOK3S_IRQPRIO_DATA_STORAGE:
201 vec = BOOK3S_INTERRUPT_DATA_STORAGE;
202 break;
203 case BOOK3S_IRQPRIO_INST_STORAGE:
204 vec = BOOK3S_INTERRUPT_INST_STORAGE;
205 break;
206 case BOOK3S_IRQPRIO_DATA_SEGMENT:
207 vec = BOOK3S_INTERRUPT_DATA_SEGMENT;
208 break;
209 case BOOK3S_IRQPRIO_INST_SEGMENT:
210 vec = BOOK3S_INTERRUPT_INST_SEGMENT;
211 break;
212 case BOOK3S_IRQPRIO_ALIGNMENT:
213 vec = BOOK3S_INTERRUPT_ALIGNMENT;
214 break;
215 case BOOK3S_IRQPRIO_PROGRAM:
216 vec = BOOK3S_INTERRUPT_PROGRAM;
217 break;
218 case BOOK3S_IRQPRIO_VSX:
219 vec = BOOK3S_INTERRUPT_VSX;
220 break;
221 case BOOK3S_IRQPRIO_ALTIVEC:
222 vec = BOOK3S_INTERRUPT_ALTIVEC;
223 break;
224 case BOOK3S_IRQPRIO_FP_UNAVAIL:
225 vec = BOOK3S_INTERRUPT_FP_UNAVAIL;
226 break;
227 case BOOK3S_IRQPRIO_SYSCALL:
228 vec = BOOK3S_INTERRUPT_SYSCALL;
229 break;
230 case BOOK3S_IRQPRIO_DEBUG:
231 vec = BOOK3S_INTERRUPT_TRACE;
232 break;
233 case BOOK3S_IRQPRIO_PERFORMANCE_MONITOR:
234 vec = BOOK3S_INTERRUPT_PERFMON;
235 break;
236 default:
237 deliver = 0;
238 printk(KERN_ERR "KVM: Unknown interrupt: 0x%x\n", priority);
239 break;
240 }
241
242#if 0
243 printk(KERN_INFO "Deliver interrupt 0x%x? %x\n", vec, deliver);
244#endif
245
246 if (deliver)
247 kvmppc_inject_interrupt(vcpu, vec, 0ULL);
248
249 return deliver;
250}
251
252void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu)
253{
254 unsigned long *pending = &vcpu->arch.pending_exceptions;
255 unsigned int priority;
256
257 /* XXX be more clever here - no need to mftb() on every entry */
258 /* Issue DEC again if it's still active */
259#ifdef AGGRESSIVE_DEC
260 if (vcpu->arch.msr & MSR_EE)
261 if (kvmppc_get_dec(vcpu) & 0x80000000)
262 kvmppc_core_queue_dec(vcpu);
263#endif
264
265#ifdef EXIT_DEBUG
266 if (vcpu->arch.pending_exceptions)
267 printk(KERN_EMERG "KVM: Check pending: %lx\n", vcpu->arch.pending_exceptions);
268#endif
269 priority = __ffs(*pending);
270 while (priority <= (sizeof(unsigned int) * 8)) {
271 if (kvmppc_book3s_irqprio_deliver(vcpu, priority)) {
272 clear_bit(priority, &vcpu->arch.pending_exceptions);
273 break;
274 }
275
276 priority = find_next_bit(pending,
277 BITS_PER_BYTE * sizeof(*pending),
278 priority + 1);
279 }
280}
281
282void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr)
283{
284 vcpu->arch.hflags &= ~BOOK3S_HFLAG_SLB;
285 vcpu->arch.pvr = pvr;
286 if ((pvr >= 0x330000) && (pvr < 0x70330000)) {
287 kvmppc_mmu_book3s_64_init(vcpu);
288 to_book3s(vcpu)->hior = 0xfff00000;
289 to_book3s(vcpu)->msr_mask = 0xffffffffffffffffULL;
290 } else {
291 kvmppc_mmu_book3s_32_init(vcpu);
292 to_book3s(vcpu)->hior = 0;
293 to_book3s(vcpu)->msr_mask = 0xffffffffULL;
294 }
295
296 /* If we are in hypervisor level on 970, we can tell the CPU to
297 * treat DCBZ as 32 bytes store */
298 vcpu->arch.hflags &= ~BOOK3S_HFLAG_DCBZ32;
299 if (vcpu->arch.mmu.is_dcbz32(vcpu) && (mfmsr() & MSR_HV) &&
300 !strcmp(cur_cpu_spec->platform, "ppc970"))
301 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
302
303}
304
305/* Book3s_32 CPUs always have 32 bytes cache line size, which Linux assumes. To
306 * make Book3s_32 Linux work on Book3s_64, we have to make sure we trap dcbz to
307 * emulate 32 bytes dcbz length.
308 *
309 * The Book3s_64 inventors also realized this case and implemented a special bit
310 * in the HID5 register, which is a hypervisor ressource. Thus we can't use it.
311 *
312 * My approach here is to patch the dcbz instruction on executing pages.
313 */
314static void kvmppc_patch_dcbz(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte)
315{
316 bool touched = false;
317 hva_t hpage;
318 u32 *page;
319 int i;
320
321 hpage = gfn_to_hva(vcpu->kvm, pte->raddr >> PAGE_SHIFT);
322 if (kvm_is_error_hva(hpage))
323 return;
324
325 hpage |= pte->raddr & ~PAGE_MASK;
326 hpage &= ~0xFFFULL;
327
328 page = vmalloc(HW_PAGE_SIZE);
329
330 if (copy_from_user(page, (void __user *)hpage, HW_PAGE_SIZE))
331 goto out;
332
333 for (i=0; i < HW_PAGE_SIZE / 4; i++)
334 if ((page[i] & 0xff0007ff) == INS_DCBZ) {
335 page[i] &= 0xfffffff7; // reserved instruction, so we trap
336 touched = true;
337 }
338
339 if (touched)
340 copy_to_user((void __user *)hpage, page, HW_PAGE_SIZE);
341
342out:
343 vfree(page);
344}
345
346static int kvmppc_xlate(struct kvm_vcpu *vcpu, ulong eaddr, bool data,
347 struct kvmppc_pte *pte)
348{
349 int relocated = (vcpu->arch.msr & (data ? MSR_DR : MSR_IR));
350 int r;
351
352 if (relocated) {
353 r = vcpu->arch.mmu.xlate(vcpu, eaddr, pte, data);
354 } else {
355 pte->eaddr = eaddr;
356 pte->raddr = eaddr & 0xffffffff;
357 pte->vpage = eaddr >> 12;
358 switch (vcpu->arch.msr & (MSR_DR|MSR_IR)) {
359 case 0:
360 pte->vpage |= VSID_REAL;
361 case MSR_DR:
362 pte->vpage |= VSID_REAL_DR;
363 case MSR_IR:
364 pte->vpage |= VSID_REAL_IR;
365 }
366 pte->may_read = true;
367 pte->may_write = true;
368 pte->may_execute = true;
369 r = 0;
370 }
371
372 return r;
373}
374
375static hva_t kvmppc_bad_hva(void)
376{
377 return PAGE_OFFSET;
378}
379
380static hva_t kvmppc_pte_to_hva(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte,
381 bool read)
382{
383 hva_t hpage;
384
385 if (read && !pte->may_read)
386 goto err;
387
388 if (!read && !pte->may_write)
389 goto err;
390
391 hpage = gfn_to_hva(vcpu->kvm, pte->raddr >> PAGE_SHIFT);
392 if (kvm_is_error_hva(hpage))
393 goto err;
394
395 return hpage | (pte->raddr & ~PAGE_MASK);
396err:
397 return kvmppc_bad_hva();
398}
399
400int kvmppc_st(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr)
401{
402 struct kvmppc_pte pte;
403 hva_t hva = eaddr;
404
405 vcpu->stat.st++;
406
407 if (kvmppc_xlate(vcpu, eaddr, false, &pte))
408 goto err;
409
410 hva = kvmppc_pte_to_hva(vcpu, &pte, false);
411 if (kvm_is_error_hva(hva))
412 goto err;
413
414 if (copy_to_user((void __user *)hva, ptr, size)) {
415 printk(KERN_INFO "kvmppc_st at 0x%lx failed\n", hva);
416 goto err;
417 }
418
419 return 0;
420
421err:
422 return -ENOENT;
423}
424
425int kvmppc_ld(struct kvm_vcpu *vcpu, ulong eaddr, int size, void *ptr,
426 bool data)
427{
428 struct kvmppc_pte pte;
429 hva_t hva = eaddr;
430
431 vcpu->stat.ld++;
432
433 if (kvmppc_xlate(vcpu, eaddr, data, &pte))
434 goto err;
435
436 hva = kvmppc_pte_to_hva(vcpu, &pte, true);
437 if (kvm_is_error_hva(hva))
438 goto err;
439
440 if (copy_from_user(ptr, (void __user *)hva, size)) {
441 printk(KERN_INFO "kvmppc_ld at 0x%lx failed\n", hva);
442 goto err;
443 }
444
445 return 0;
446
447err:
448 return -ENOENT;
449}
450
451static int kvmppc_visible_gfn(struct kvm_vcpu *vcpu, gfn_t gfn)
452{
453 return kvm_is_visible_gfn(vcpu->kvm, gfn);
454}
455
456int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
457 ulong eaddr, int vec)
458{
459 bool data = (vec == BOOK3S_INTERRUPT_DATA_STORAGE);
460 int r = RESUME_GUEST;
461 int relocated;
462 int page_found = 0;
463 struct kvmppc_pte pte;
464 bool is_mmio = false;
465
466 if ( vec == BOOK3S_INTERRUPT_DATA_STORAGE ) {
467 relocated = (vcpu->arch.msr & MSR_DR);
468 } else {
469 relocated = (vcpu->arch.msr & MSR_IR);
470 }
471
472 /* Resolve real address if translation turned on */
473 if (relocated) {
474 page_found = vcpu->arch.mmu.xlate(vcpu, eaddr, &pte, data);
475 } else {
476 pte.may_execute = true;
477 pte.may_read = true;
478 pte.may_write = true;
479 pte.raddr = eaddr & 0xffffffff;
480 pte.eaddr = eaddr;
481 pte.vpage = eaddr >> 12;
482 switch (vcpu->arch.msr & (MSR_DR|MSR_IR)) {
483 case 0:
484 pte.vpage |= VSID_REAL;
485 case MSR_DR:
486 pte.vpage |= VSID_REAL_DR;
487 case MSR_IR:
488 pte.vpage |= VSID_REAL_IR;
489 }
490 }
491
492 if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
493 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32))) {
494 /*
495 * If we do the dcbz hack, we have to NX on every execution,
496 * so we can patch the executing code. This renders our guest
497 * NX-less.
498 */
499 pte.may_execute = !data;
500 }
501
502 if (page_found == -ENOENT) {
503 /* Page not found in guest PTE entries */
504 vcpu->arch.dear = vcpu->arch.fault_dear;
505 to_book3s(vcpu)->dsisr = vcpu->arch.fault_dsisr;
506 vcpu->arch.msr |= (vcpu->arch.shadow_msr & 0x00000000f8000000ULL);
507 kvmppc_book3s_queue_irqprio(vcpu, vec);
508 } else if (page_found == -EPERM) {
509 /* Storage protection */
510 vcpu->arch.dear = vcpu->arch.fault_dear;
511 to_book3s(vcpu)->dsisr = vcpu->arch.fault_dsisr & ~DSISR_NOHPTE;
512 to_book3s(vcpu)->dsisr |= DSISR_PROTFAULT;
513 vcpu->arch.msr |= (vcpu->arch.shadow_msr & 0x00000000f8000000ULL);
514 kvmppc_book3s_queue_irqprio(vcpu, vec);
515 } else if (page_found == -EINVAL) {
516 /* Page not found in guest SLB */
517 vcpu->arch.dear = vcpu->arch.fault_dear;
518 kvmppc_book3s_queue_irqprio(vcpu, vec + 0x80);
519 } else if (!is_mmio &&
520 kvmppc_visible_gfn(vcpu, pte.raddr >> PAGE_SHIFT)) {
521 /* The guest's PTE is not mapped yet. Map on the host */
522 kvmppc_mmu_map_page(vcpu, &pte);
523 if (data)
524 vcpu->stat.sp_storage++;
525 else if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
526 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32)))
527 kvmppc_patch_dcbz(vcpu, &pte);
528 } else {
529 /* MMIO */
530 vcpu->stat.mmio_exits++;
531 vcpu->arch.paddr_accessed = pte.raddr;
532 r = kvmppc_emulate_mmio(run, vcpu);
533 if ( r == RESUME_HOST_NV )
534 r = RESUME_HOST;
535 if ( r == RESUME_GUEST_NV )
536 r = RESUME_GUEST;
537 }
538
539 return r;
540}
541
542int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
543 unsigned int exit_nr)
544{
545 int r = RESUME_HOST;
546
547 vcpu->stat.sum_exits++;
548
549 run->exit_reason = KVM_EXIT_UNKNOWN;
550 run->ready_for_interrupt_injection = 1;
551#ifdef EXIT_DEBUG
552 printk(KERN_EMERG "exit_nr=0x%x | pc=0x%lx | dar=0x%lx | dec=0x%x | msr=0x%lx\n",
553 exit_nr, vcpu->arch.pc, vcpu->arch.fault_dear,
554 kvmppc_get_dec(vcpu), vcpu->arch.msr);
555#elif defined (EXIT_DEBUG_SIMPLE)
556 if ((exit_nr != 0x900) && (exit_nr != 0x500))
557 printk(KERN_EMERG "exit_nr=0x%x | pc=0x%lx | dar=0x%lx | msr=0x%lx\n",
558 exit_nr, vcpu->arch.pc, vcpu->arch.fault_dear,
559 vcpu->arch.msr);
560#endif
561 kvm_resched(vcpu);
562 switch (exit_nr) {
563 case BOOK3S_INTERRUPT_INST_STORAGE:
564 vcpu->stat.pf_instruc++;
565 /* only care about PTEG not found errors, but leave NX alone */
566 if (vcpu->arch.shadow_msr & 0x40000000) {
567 r = kvmppc_handle_pagefault(run, vcpu, vcpu->arch.pc, exit_nr);
568 vcpu->stat.sp_instruc++;
569 } else if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
570 (!(vcpu->arch.hflags & BOOK3S_HFLAG_DCBZ32))) {
571 /*
572 * XXX If we do the dcbz hack we use the NX bit to flush&patch the page,
573 * so we can't use the NX bit inside the guest. Let's cross our fingers,
574 * that no guest that needs the dcbz hack does NX.
575 */
576 kvmppc_mmu_pte_flush(vcpu, vcpu->arch.pc, ~0xFFFULL);
577 } else {
578 vcpu->arch.msr |= (vcpu->arch.shadow_msr & 0x58000000);
579 kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
580 kvmppc_mmu_pte_flush(vcpu, vcpu->arch.pc, ~0xFFFULL);
581 r = RESUME_GUEST;
582 }
583 break;
584 case BOOK3S_INTERRUPT_DATA_STORAGE:
585 vcpu->stat.pf_storage++;
586 /* The only case we need to handle is missing shadow PTEs */
587 if (vcpu->arch.fault_dsisr & DSISR_NOHPTE) {
588 r = kvmppc_handle_pagefault(run, vcpu, vcpu->arch.fault_dear, exit_nr);
589 } else {
590 vcpu->arch.dear = vcpu->arch.fault_dear;
591 to_book3s(vcpu)->dsisr = vcpu->arch.fault_dsisr;
592 kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
593 kvmppc_mmu_pte_flush(vcpu, vcpu->arch.dear, ~0xFFFULL);
594 r = RESUME_GUEST;
595 }
596 break;
597 case BOOK3S_INTERRUPT_DATA_SEGMENT:
598 if (kvmppc_mmu_map_segment(vcpu, vcpu->arch.fault_dear) < 0) {
599 vcpu->arch.dear = vcpu->arch.fault_dear;
600 kvmppc_book3s_queue_irqprio(vcpu,
601 BOOK3S_INTERRUPT_DATA_SEGMENT);
602 }
603 r = RESUME_GUEST;
604 break;
605 case BOOK3S_INTERRUPT_INST_SEGMENT:
606 if (kvmppc_mmu_map_segment(vcpu, vcpu->arch.pc) < 0) {
607 kvmppc_book3s_queue_irqprio(vcpu,
608 BOOK3S_INTERRUPT_INST_SEGMENT);
609 }
610 r = RESUME_GUEST;
611 break;
612 /* We're good on these - the host merely wanted to get our attention */
613 case BOOK3S_INTERRUPT_DECREMENTER:
614 vcpu->stat.dec_exits++;
615 r = RESUME_GUEST;
616 break;
617 case BOOK3S_INTERRUPT_EXTERNAL:
618 vcpu->stat.ext_intr_exits++;
619 r = RESUME_GUEST;
620 break;
621 case BOOK3S_INTERRUPT_PROGRAM:
622 {
623 enum emulation_result er;
624
625 if (vcpu->arch.msr & MSR_PR) {
626#ifdef EXIT_DEBUG
627 printk(KERN_INFO "Userspace triggered 0x700 exception at 0x%lx (0x%x)\n", vcpu->arch.pc, vcpu->arch.last_inst);
628#endif
629 if ((vcpu->arch.last_inst & 0xff0007ff) !=
630 (INS_DCBZ & 0xfffffff7)) {
631 kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
632 r = RESUME_GUEST;
633 break;
634 }
635 }
636
637 vcpu->stat.emulated_inst_exits++;
638 er = kvmppc_emulate_instruction(run, vcpu);
639 switch (er) {
640 case EMULATE_DONE:
641 r = RESUME_GUEST;
642 break;
643 case EMULATE_FAIL:
644 printk(KERN_CRIT "%s: emulation at %lx failed (%08x)\n",
645 __func__, vcpu->arch.pc, vcpu->arch.last_inst);
646 kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
647 r = RESUME_GUEST;
648 break;
649 default:
650 BUG();
651 }
652 break;
653 }
654 case BOOK3S_INTERRUPT_SYSCALL:
655#ifdef EXIT_DEBUG
656 printk(KERN_INFO "Syscall Nr %d\n", (int)vcpu->arch.gpr[0]);
657#endif
658 vcpu->stat.syscall_exits++;
659 kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
660 r = RESUME_GUEST;
661 break;
662 case BOOK3S_INTERRUPT_MACHINE_CHECK:
663 case BOOK3S_INTERRUPT_FP_UNAVAIL:
664 case BOOK3S_INTERRUPT_TRACE:
665 case BOOK3S_INTERRUPT_ALTIVEC:
666 case BOOK3S_INTERRUPT_VSX:
667 kvmppc_book3s_queue_irqprio(vcpu, exit_nr);
668 r = RESUME_GUEST;
669 break;
670 default:
671 /* Ugh - bork here! What did we get? */
672 printk(KERN_EMERG "exit_nr=0x%x | pc=0x%lx | msr=0x%lx\n", exit_nr, vcpu->arch.pc, vcpu->arch.shadow_msr);
673 r = RESUME_HOST;
674 BUG();
675 break;
676 }
677
678
679 if (!(r & RESUME_HOST)) {
680 /* To avoid clobbering exit_reason, only check for signals if
681 * we aren't already exiting to userspace for some other
682 * reason. */
683 if (signal_pending(current)) {
684#ifdef EXIT_DEBUG
685 printk(KERN_EMERG "KVM: Going back to host\n");
686#endif
687 vcpu->stat.signal_exits++;
688 run->exit_reason = KVM_EXIT_INTR;
689 r = -EINTR;
690 } else {
691 /* In case an interrupt came in that was triggered
692 * from userspace (like DEC), we need to check what
693 * to inject now! */
694 kvmppc_core_deliver_interrupts(vcpu);
695 }
696 }
697
698#ifdef EXIT_DEBUG
699 printk(KERN_EMERG "KVM exit: vcpu=0x%p pc=0x%lx r=0x%x\n", vcpu, vcpu->arch.pc, r);
700#endif
701
702 return r;
703}
704
705int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
706{
707 return 0;
708}
709
710int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
711{
712 int i;
713
714 regs->pc = vcpu->arch.pc;
715 regs->cr = vcpu->arch.cr;
716 regs->ctr = vcpu->arch.ctr;
717 regs->lr = vcpu->arch.lr;
718 regs->xer = vcpu->arch.xer;
719 regs->msr = vcpu->arch.msr;
720 regs->srr0 = vcpu->arch.srr0;
721 regs->srr1 = vcpu->arch.srr1;
722 regs->pid = vcpu->arch.pid;
723 regs->sprg0 = vcpu->arch.sprg0;
724 regs->sprg1 = vcpu->arch.sprg1;
725 regs->sprg2 = vcpu->arch.sprg2;
726 regs->sprg3 = vcpu->arch.sprg3;
727 regs->sprg5 = vcpu->arch.sprg4;
728 regs->sprg6 = vcpu->arch.sprg5;
729 regs->sprg7 = vcpu->arch.sprg6;
730
731 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
732 regs->gpr[i] = vcpu->arch.gpr[i];
733
734 return 0;
735}
736
737int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
738{
739 int i;
740
741 vcpu->arch.pc = regs->pc;
742 vcpu->arch.cr = regs->cr;
743 vcpu->arch.ctr = regs->ctr;
744 vcpu->arch.lr = regs->lr;
745 vcpu->arch.xer = regs->xer;
746 kvmppc_set_msr(vcpu, regs->msr);
747 vcpu->arch.srr0 = regs->srr0;
748 vcpu->arch.srr1 = regs->srr1;
749 vcpu->arch.sprg0 = regs->sprg0;
750 vcpu->arch.sprg1 = regs->sprg1;
751 vcpu->arch.sprg2 = regs->sprg2;
752 vcpu->arch.sprg3 = regs->sprg3;
753 vcpu->arch.sprg5 = regs->sprg4;
754 vcpu->arch.sprg6 = regs->sprg5;
755 vcpu->arch.sprg7 = regs->sprg6;
756
757 for (i = 0; i < ARRAY_SIZE(vcpu->arch.gpr); i++)
758 vcpu->arch.gpr[i] = regs->gpr[i];
759
760 return 0;
761}
762
763int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
764 struct kvm_sregs *sregs)
765{
766 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
767 int i;
768
769 sregs->pvr = vcpu->arch.pvr;
770
771 sregs->u.s.sdr1 = to_book3s(vcpu)->sdr1;
772 if (vcpu->arch.hflags & BOOK3S_HFLAG_SLB) {
773 for (i = 0; i < 64; i++) {
774 sregs->u.s.ppc64.slb[i].slbe = vcpu3s->slb[i].orige | i;
775 sregs->u.s.ppc64.slb[i].slbv = vcpu3s->slb[i].origv;
776 }
777 } else {
778 for (i = 0; i < 16; i++) {
779 sregs->u.s.ppc32.sr[i] = vcpu3s->sr[i].raw;
780 sregs->u.s.ppc32.sr[i] = vcpu3s->sr[i].raw;
781 }
782 for (i = 0; i < 8; i++) {
783 sregs->u.s.ppc32.ibat[i] = vcpu3s->ibat[i].raw;
784 sregs->u.s.ppc32.dbat[i] = vcpu3s->dbat[i].raw;
785 }
786 }
787 return 0;
788}
789
790int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
791 struct kvm_sregs *sregs)
792{
793 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
794 int i;
795
796 kvmppc_set_pvr(vcpu, sregs->pvr);
797
798 vcpu3s->sdr1 = sregs->u.s.sdr1;
799 if (vcpu->arch.hflags & BOOK3S_HFLAG_SLB) {
800 for (i = 0; i < 64; i++) {
801 vcpu->arch.mmu.slbmte(vcpu, sregs->u.s.ppc64.slb[i].slbv,
802 sregs->u.s.ppc64.slb[i].slbe);
803 }
804 } else {
805 for (i = 0; i < 16; i++) {
806 vcpu->arch.mmu.mtsrin(vcpu, i, sregs->u.s.ppc32.sr[i]);
807 }
808 for (i = 0; i < 8; i++) {
809 kvmppc_set_bat(vcpu, &(vcpu3s->ibat[i]), false,
810 (u32)sregs->u.s.ppc32.ibat[i]);
811 kvmppc_set_bat(vcpu, &(vcpu3s->ibat[i]), true,
812 (u32)(sregs->u.s.ppc32.ibat[i] >> 32));
813 kvmppc_set_bat(vcpu, &(vcpu3s->dbat[i]), false,
814 (u32)sregs->u.s.ppc32.dbat[i]);
815 kvmppc_set_bat(vcpu, &(vcpu3s->dbat[i]), true,
816 (u32)(sregs->u.s.ppc32.dbat[i] >> 32));
817 }
818 }
819
820 /* Flush the MMU after messing with the segments */
821 kvmppc_mmu_pte_flush(vcpu, 0, 0);
822 return 0;
823}
824
825int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
826{
827 return -ENOTSUPP;
828}
829
830int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
831{
832 return -ENOTSUPP;
833}
834
835int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
836 struct kvm_translation *tr)
837{
838 return 0;
839}
840
841/*
842 * Get (and clear) the dirty memory log for a memory slot.
843 */
844int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
845 struct kvm_dirty_log *log)
846{
847 struct kvm_memory_slot *memslot;
848 struct kvm_vcpu *vcpu;
849 ulong ga, ga_end;
850 int is_dirty = 0;
851 int r, n;
852
853 down_write(&kvm->slots_lock);
854
855 r = kvm_get_dirty_log(kvm, log, &is_dirty);
856 if (r)
857 goto out;
858
859 /* If nothing is dirty, don't bother messing with page tables. */
860 if (is_dirty) {
861 memslot = &kvm->memslots[log->slot];
862
863 ga = memslot->base_gfn << PAGE_SHIFT;
864 ga_end = ga + (memslot->npages << PAGE_SHIFT);
865
866 kvm_for_each_vcpu(n, vcpu, kvm)
867 kvmppc_mmu_pte_pflush(vcpu, ga, ga_end);
868
869 n = ALIGN(memslot->npages, BITS_PER_LONG) / 8;
870 memset(memslot->dirty_bitmap, 0, n);
871 }
872
873 r = 0;
874out:
875 up_write(&kvm->slots_lock);
876 return r;
877}
878
879int kvmppc_core_check_processor_compat(void)
880{
881 return 0;
882}
883
884struct kvm_vcpu *kvmppc_core_vcpu_create(struct kvm *kvm, unsigned int id)
885{
886 struct kvmppc_vcpu_book3s *vcpu_book3s;
887 struct kvm_vcpu *vcpu;
888 int err;
889
890 vcpu_book3s = (struct kvmppc_vcpu_book3s *)__get_free_pages( GFP_KERNEL | __GFP_ZERO,
891 get_order(sizeof(struct kvmppc_vcpu_book3s)));
892 if (!vcpu_book3s) {
893 err = -ENOMEM;
894 goto out;
895 }
896
897 vcpu = &vcpu_book3s->vcpu;
898 err = kvm_vcpu_init(vcpu, kvm, id);
899 if (err)
900 goto free_vcpu;
901
902 vcpu->arch.host_retip = kvm_return_point;
903 vcpu->arch.host_msr = mfmsr();
904 /* default to book3s_64 (970fx) */
905 vcpu->arch.pvr = 0x3C0301;
906 kvmppc_set_pvr(vcpu, vcpu->arch.pvr);
907 vcpu_book3s->slb_nr = 64;
908
909 /* remember where some real-mode handlers are */
910 vcpu->arch.trampoline_lowmem = kvmppc_trampoline_lowmem;
911 vcpu->arch.trampoline_enter = kvmppc_trampoline_enter;
912 vcpu->arch.highmem_handler = (ulong)kvmppc_handler_highmem;
913
914 vcpu->arch.shadow_msr = MSR_USER64;
915
916 err = __init_new_context();
917 if (err < 0)
918 goto free_vcpu;
919 vcpu_book3s->context_id = err;
920
921 vcpu_book3s->vsid_max = ((vcpu_book3s->context_id + 1) << USER_ESID_BITS) - 1;
922 vcpu_book3s->vsid_first = vcpu_book3s->context_id << USER_ESID_BITS;
923 vcpu_book3s->vsid_next = vcpu_book3s->vsid_first;
924
925 return vcpu;
926
927free_vcpu:
928 free_pages((long)vcpu_book3s, get_order(sizeof(struct kvmppc_vcpu_book3s)));
929out:
930 return ERR_PTR(err);
931}
932
933void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
934{
935 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
936
937 __destroy_context(vcpu_book3s->context_id);
938 kvm_vcpu_uninit(vcpu);
939 free_pages((long)vcpu_book3s, get_order(sizeof(struct kvmppc_vcpu_book3s)));
940}
941
942extern int __kvmppc_vcpu_entry(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
943int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
944{
945 int ret;
946
947 /* No need to go into the guest when all we do is going out */
948 if (signal_pending(current)) {
949 kvm_run->exit_reason = KVM_EXIT_INTR;
950 return -EINTR;
951 }
952
953 /* XXX we get called with irq disabled - change that! */
954 local_irq_enable();
955
956 ret = __kvmppc_vcpu_entry(kvm_run, vcpu);
957
958 local_irq_disable();
959
960 return ret;
961}
962
963static int kvmppc_book3s_init(void)
964{
965 return kvm_init(NULL, sizeof(struct kvmppc_vcpu_book3s), THIS_MODULE);
966}
967
968static void kvmppc_book3s_exit(void)
969{
970 kvm_exit();
971}
972
973module_init(kvmppc_book3s_init);
974module_exit(kvmppc_book3s_exit);
diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm/book3s_32_mmu.c
new file mode 100644
index 000000000000..faf99f20d993
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_32_mmu.c
@@ -0,0 +1,372 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#include <linux/types.h>
21#include <linux/string.h>
22#include <linux/kvm.h>
23#include <linux/kvm_host.h>
24#include <linux/highmem.h>
25
26#include <asm/tlbflush.h>
27#include <asm/kvm_ppc.h>
28#include <asm/kvm_book3s.h>
29
30/* #define DEBUG_MMU */
31/* #define DEBUG_MMU_PTE */
32/* #define DEBUG_MMU_PTE_IP 0xfff14c40 */
33
34#ifdef DEBUG_MMU
35#define dprintk(X...) printk(KERN_INFO X)
36#else
37#define dprintk(X...) do { } while(0)
38#endif
39
40#ifdef DEBUG_PTE
41#define dprintk_pte(X...) printk(KERN_INFO X)
42#else
43#define dprintk_pte(X...) do { } while(0)
44#endif
45
46#define PTEG_FLAG_ACCESSED 0x00000100
47#define PTEG_FLAG_DIRTY 0x00000080
48
49static inline bool check_debug_ip(struct kvm_vcpu *vcpu)
50{
51#ifdef DEBUG_MMU_PTE_IP
52 return vcpu->arch.pc == DEBUG_MMU_PTE_IP;
53#else
54 return true;
55#endif
56}
57
58static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr,
59 struct kvmppc_pte *pte, bool data);
60
61static struct kvmppc_sr *find_sr(struct kvmppc_vcpu_book3s *vcpu_book3s, gva_t eaddr)
62{
63 return &vcpu_book3s->sr[(eaddr >> 28) & 0xf];
64}
65
66static u64 kvmppc_mmu_book3s_32_ea_to_vp(struct kvm_vcpu *vcpu, gva_t eaddr,
67 bool data)
68{
69 struct kvmppc_sr *sre = find_sr(to_book3s(vcpu), eaddr);
70 struct kvmppc_pte pte;
71
72 if (!kvmppc_mmu_book3s_32_xlate_bat(vcpu, eaddr, &pte, data))
73 return pte.vpage;
74
75 return (((u64)eaddr >> 12) & 0xffff) | (((u64)sre->vsid) << 16);
76}
77
78static void kvmppc_mmu_book3s_32_reset_msr(struct kvm_vcpu *vcpu)
79{
80 kvmppc_set_msr(vcpu, 0);
81}
82
83static hva_t kvmppc_mmu_book3s_32_get_pteg(struct kvmppc_vcpu_book3s *vcpu_book3s,
84 struct kvmppc_sr *sre, gva_t eaddr,
85 bool primary)
86{
87 u32 page, hash, pteg, htabmask;
88 hva_t r;
89
90 page = (eaddr & 0x0FFFFFFF) >> 12;
91 htabmask = ((vcpu_book3s->sdr1 & 0x1FF) << 16) | 0xFFC0;
92
93 hash = ((sre->vsid ^ page) << 6);
94 if (!primary)
95 hash = ~hash;
96 hash &= htabmask;
97
98 pteg = (vcpu_book3s->sdr1 & 0xffff0000) | hash;
99
100 dprintk("MMU: pc=0x%lx eaddr=0x%lx sdr1=0x%llx pteg=0x%x vsid=0x%x\n",
101 vcpu_book3s->vcpu.arch.pc, eaddr, vcpu_book3s->sdr1, pteg,
102 sre->vsid);
103
104 r = gfn_to_hva(vcpu_book3s->vcpu.kvm, pteg >> PAGE_SHIFT);
105 if (kvm_is_error_hva(r))
106 return r;
107 return r | (pteg & ~PAGE_MASK);
108}
109
110static u32 kvmppc_mmu_book3s_32_get_ptem(struct kvmppc_sr *sre, gva_t eaddr,
111 bool primary)
112{
113 return ((eaddr & 0x0fffffff) >> 22) | (sre->vsid << 7) |
114 (primary ? 0 : 0x40) | 0x80000000;
115}
116
117static int kvmppc_mmu_book3s_32_xlate_bat(struct kvm_vcpu *vcpu, gva_t eaddr,
118 struct kvmppc_pte *pte, bool data)
119{
120 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
121 struct kvmppc_bat *bat;
122 int i;
123
124 for (i = 0; i < 8; i++) {
125 if (data)
126 bat = &vcpu_book3s->dbat[i];
127 else
128 bat = &vcpu_book3s->ibat[i];
129
130 if (vcpu->arch.msr & MSR_PR) {
131 if (!bat->vp)
132 continue;
133 } else {
134 if (!bat->vs)
135 continue;
136 }
137
138 if (check_debug_ip(vcpu))
139 {
140 dprintk_pte("%cBAT %02d: 0x%lx - 0x%x (0x%x)\n",
141 data ? 'd' : 'i', i, eaddr, bat->bepi,
142 bat->bepi_mask);
143 }
144 if ((eaddr & bat->bepi_mask) == bat->bepi) {
145 pte->raddr = bat->brpn | (eaddr & ~bat->bepi_mask);
146 pte->vpage = (eaddr >> 12) | VSID_BAT;
147 pte->may_read = bat->pp;
148 pte->may_write = bat->pp > 1;
149 pte->may_execute = true;
150 if (!pte->may_read) {
151 printk(KERN_INFO "BAT is not readable!\n");
152 continue;
153 }
154 if (!pte->may_write) {
155 /* let's treat r/o BATs as not-readable for now */
156 dprintk_pte("BAT is read-only!\n");
157 continue;
158 }
159
160 return 0;
161 }
162 }
163
164 return -ENOENT;
165}
166
167static int kvmppc_mmu_book3s_32_xlate_pte(struct kvm_vcpu *vcpu, gva_t eaddr,
168 struct kvmppc_pte *pte, bool data,
169 bool primary)
170{
171 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
172 struct kvmppc_sr *sre;
173 hva_t ptegp;
174 u32 pteg[16];
175 u64 ptem = 0;
176 int i;
177 int found = 0;
178
179 sre = find_sr(vcpu_book3s, eaddr);
180
181 dprintk_pte("SR 0x%lx: vsid=0x%x, raw=0x%x\n", eaddr >> 28,
182 sre->vsid, sre->raw);
183
184 pte->vpage = kvmppc_mmu_book3s_32_ea_to_vp(vcpu, eaddr, data);
185
186 ptegp = kvmppc_mmu_book3s_32_get_pteg(vcpu_book3s, sre, eaddr, primary);
187 if (kvm_is_error_hva(ptegp)) {
188 printk(KERN_INFO "KVM: Invalid PTEG!\n");
189 goto no_page_found;
190 }
191
192 ptem = kvmppc_mmu_book3s_32_get_ptem(sre, eaddr, primary);
193
194 if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) {
195 printk(KERN_ERR "KVM: Can't copy data from 0x%lx!\n", ptegp);
196 goto no_page_found;
197 }
198
199 for (i=0; i<16; i+=2) {
200 if (ptem == pteg[i]) {
201 u8 pp;
202
203 pte->raddr = (pteg[i+1] & ~(0xFFFULL)) | (eaddr & 0xFFF);
204 pp = pteg[i+1] & 3;
205
206 if ((sre->Kp && (vcpu->arch.msr & MSR_PR)) ||
207 (sre->Ks && !(vcpu->arch.msr & MSR_PR)))
208 pp |= 4;
209
210 pte->may_write = false;
211 pte->may_read = false;
212 pte->may_execute = true;
213 switch (pp) {
214 case 0:
215 case 1:
216 case 2:
217 case 6:
218 pte->may_write = true;
219 case 3:
220 case 5:
221 case 7:
222 pte->may_read = true;
223 break;
224 }
225
226 if ( !pte->may_read )
227 continue;
228
229 dprintk_pte("MMU: Found PTE -> %x %x - %x\n",
230 pteg[i], pteg[i+1], pp);
231 found = 1;
232 break;
233 }
234 }
235
236 /* Update PTE C and A bits, so the guest's swapper knows we used the
237 page */
238 if (found) {
239 u32 oldpte = pteg[i+1];
240
241 if (pte->may_read)
242 pteg[i+1] |= PTEG_FLAG_ACCESSED;
243 if (pte->may_write)
244 pteg[i+1] |= PTEG_FLAG_DIRTY;
245 else
246 dprintk_pte("KVM: Mapping read-only page!\n");
247
248 /* Write back into the PTEG */
249 if (pteg[i+1] != oldpte)
250 copy_to_user((void __user *)ptegp, pteg, sizeof(pteg));
251
252 return 0;
253 }
254
255no_page_found:
256
257 if (check_debug_ip(vcpu)) {
258 dprintk_pte("KVM MMU: No PTE found (sdr1=0x%llx ptegp=0x%lx)\n",
259 to_book3s(vcpu)->sdr1, ptegp);
260 for (i=0; i<16; i+=2) {
261 dprintk_pte(" %02d: 0x%x - 0x%x (0x%llx)\n",
262 i, pteg[i], pteg[i+1], ptem);
263 }
264 }
265
266 return -ENOENT;
267}
268
269static int kvmppc_mmu_book3s_32_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
270 struct kvmppc_pte *pte, bool data)
271{
272 int r;
273
274 pte->eaddr = eaddr;
275 r = kvmppc_mmu_book3s_32_xlate_bat(vcpu, eaddr, pte, data);
276 if (r < 0)
277 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte, data, true);
278 if (r < 0)
279 r = kvmppc_mmu_book3s_32_xlate_pte(vcpu, eaddr, pte, data, false);
280
281 return r;
282}
283
284
285static u32 kvmppc_mmu_book3s_32_mfsrin(struct kvm_vcpu *vcpu, u32 srnum)
286{
287 return to_book3s(vcpu)->sr[srnum].raw;
288}
289
290static void kvmppc_mmu_book3s_32_mtsrin(struct kvm_vcpu *vcpu, u32 srnum,
291 ulong value)
292{
293 struct kvmppc_sr *sre;
294
295 sre = &to_book3s(vcpu)->sr[srnum];
296
297 /* Flush any left-over shadows from the previous SR */
298
299 /* XXX Not necessary? */
300 /* kvmppc_mmu_pte_flush(vcpu, ((u64)sre->vsid) << 28, 0xf0000000ULL); */
301
302 /* And then put in the new SR */
303 sre->raw = value;
304 sre->vsid = (value & 0x0fffffff);
305 sre->Ks = (value & 0x40000000) ? true : false;
306 sre->Kp = (value & 0x20000000) ? true : false;
307 sre->nx = (value & 0x10000000) ? true : false;
308
309 /* Map the new segment */
310 kvmppc_mmu_map_segment(vcpu, srnum << SID_SHIFT);
311}
312
313static void kvmppc_mmu_book3s_32_tlbie(struct kvm_vcpu *vcpu, ulong ea, bool large)
314{
315 kvmppc_mmu_pte_flush(vcpu, ea, ~0xFFFULL);
316}
317
318static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, u64 esid,
319 u64 *vsid)
320{
321 /* In case we only have one of MSR_IR or MSR_DR set, let's put
322 that in the real-mode context (and hope RM doesn't access
323 high memory) */
324 switch (vcpu->arch.msr & (MSR_DR|MSR_IR)) {
325 case 0:
326 *vsid = (VSID_REAL >> 16) | esid;
327 break;
328 case MSR_IR:
329 *vsid = (VSID_REAL_IR >> 16) | esid;
330 break;
331 case MSR_DR:
332 *vsid = (VSID_REAL_DR >> 16) | esid;
333 break;
334 case MSR_DR|MSR_IR:
335 {
336 ulong ea;
337 ea = esid << SID_SHIFT;
338 *vsid = find_sr(to_book3s(vcpu), ea)->vsid;
339 break;
340 }
341 default:
342 BUG();
343 }
344
345 return 0;
346}
347
348static bool kvmppc_mmu_book3s_32_is_dcbz32(struct kvm_vcpu *vcpu)
349{
350 return true;
351}
352
353
354void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu)
355{
356 struct kvmppc_mmu *mmu = &vcpu->arch.mmu;
357
358 mmu->mtsrin = kvmppc_mmu_book3s_32_mtsrin;
359 mmu->mfsrin = kvmppc_mmu_book3s_32_mfsrin;
360 mmu->xlate = kvmppc_mmu_book3s_32_xlate;
361 mmu->reset_msr = kvmppc_mmu_book3s_32_reset_msr;
362 mmu->tlbie = kvmppc_mmu_book3s_32_tlbie;
363 mmu->esid_to_vsid = kvmppc_mmu_book3s_32_esid_to_vsid;
364 mmu->ea_to_vp = kvmppc_mmu_book3s_32_ea_to_vp;
365 mmu->is_dcbz32 = kvmppc_mmu_book3s_32_is_dcbz32;
366
367 mmu->slbmte = NULL;
368 mmu->slbmfee = NULL;
369 mmu->slbmfev = NULL;
370 mmu->slbie = NULL;
371 mmu->slbia = NULL;
372}
diff --git a/arch/powerpc/kvm/book3s_64_emulate.c b/arch/powerpc/kvm/book3s_64_emulate.c
new file mode 100644
index 000000000000..1027eac6d474
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_64_emulate.c
@@ -0,0 +1,345 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#include <asm/kvm_ppc.h>
21#include <asm/disassemble.h>
22#include <asm/kvm_book3s.h>
23#include <asm/reg.h>
24
25#define OP_19_XOP_RFID 18
26#define OP_19_XOP_RFI 50
27
28#define OP_31_XOP_MFMSR 83
29#define OP_31_XOP_MTMSR 146
30#define OP_31_XOP_MTMSRD 178
31#define OP_31_XOP_MTSRIN 242
32#define OP_31_XOP_TLBIEL 274
33#define OP_31_XOP_TLBIE 306
34#define OP_31_XOP_SLBMTE 402
35#define OP_31_XOP_SLBIE 434
36#define OP_31_XOP_SLBIA 498
37#define OP_31_XOP_MFSRIN 659
38#define OP_31_XOP_SLBMFEV 851
39#define OP_31_XOP_EIOIO 854
40#define OP_31_XOP_SLBMFEE 915
41
42/* DCBZ is actually 1014, but we patch it to 1010 so we get a trap */
43#define OP_31_XOP_DCBZ 1010
44
45int kvmppc_core_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
46 unsigned int inst, int *advance)
47{
48 int emulated = EMULATE_DONE;
49
50 switch (get_op(inst)) {
51 case 19:
52 switch (get_xop(inst)) {
53 case OP_19_XOP_RFID:
54 case OP_19_XOP_RFI:
55 vcpu->arch.pc = vcpu->arch.srr0;
56 kvmppc_set_msr(vcpu, vcpu->arch.srr1);
57 *advance = 0;
58 break;
59
60 default:
61 emulated = EMULATE_FAIL;
62 break;
63 }
64 break;
65 case 31:
66 switch (get_xop(inst)) {
67 case OP_31_XOP_MFMSR:
68 vcpu->arch.gpr[get_rt(inst)] = vcpu->arch.msr;
69 break;
70 case OP_31_XOP_MTMSRD:
71 {
72 ulong rs = vcpu->arch.gpr[get_rs(inst)];
73 if (inst & 0x10000) {
74 vcpu->arch.msr &= ~(MSR_RI | MSR_EE);
75 vcpu->arch.msr |= rs & (MSR_RI | MSR_EE);
76 } else
77 kvmppc_set_msr(vcpu, rs);
78 break;
79 }
80 case OP_31_XOP_MTMSR:
81 kvmppc_set_msr(vcpu, vcpu->arch.gpr[get_rs(inst)]);
82 break;
83 case OP_31_XOP_MFSRIN:
84 {
85 int srnum;
86
87 srnum = (vcpu->arch.gpr[get_rb(inst)] >> 28) & 0xf;
88 if (vcpu->arch.mmu.mfsrin) {
89 u32 sr;
90 sr = vcpu->arch.mmu.mfsrin(vcpu, srnum);
91 vcpu->arch.gpr[get_rt(inst)] = sr;
92 }
93 break;
94 }
95 case OP_31_XOP_MTSRIN:
96 vcpu->arch.mmu.mtsrin(vcpu,
97 (vcpu->arch.gpr[get_rb(inst)] >> 28) & 0xf,
98 vcpu->arch.gpr[get_rs(inst)]);
99 break;
100 case OP_31_XOP_TLBIE:
101 case OP_31_XOP_TLBIEL:
102 {
103 bool large = (inst & 0x00200000) ? true : false;
104 ulong addr = vcpu->arch.gpr[get_rb(inst)];
105 vcpu->arch.mmu.tlbie(vcpu, addr, large);
106 break;
107 }
108 case OP_31_XOP_EIOIO:
109 break;
110 case OP_31_XOP_SLBMTE:
111 if (!vcpu->arch.mmu.slbmte)
112 return EMULATE_FAIL;
113
114 vcpu->arch.mmu.slbmte(vcpu, vcpu->arch.gpr[get_rs(inst)],
115 vcpu->arch.gpr[get_rb(inst)]);
116 break;
117 case OP_31_XOP_SLBIE:
118 if (!vcpu->arch.mmu.slbie)
119 return EMULATE_FAIL;
120
121 vcpu->arch.mmu.slbie(vcpu, vcpu->arch.gpr[get_rb(inst)]);
122 break;
123 case OP_31_XOP_SLBIA:
124 if (!vcpu->arch.mmu.slbia)
125 return EMULATE_FAIL;
126
127 vcpu->arch.mmu.slbia(vcpu);
128 break;
129 case OP_31_XOP_SLBMFEE:
130 if (!vcpu->arch.mmu.slbmfee) {
131 emulated = EMULATE_FAIL;
132 } else {
133 ulong t, rb;
134
135 rb = vcpu->arch.gpr[get_rb(inst)];
136 t = vcpu->arch.mmu.slbmfee(vcpu, rb);
137 vcpu->arch.gpr[get_rt(inst)] = t;
138 }
139 break;
140 case OP_31_XOP_SLBMFEV:
141 if (!vcpu->arch.mmu.slbmfev) {
142 emulated = EMULATE_FAIL;
143 } else {
144 ulong t, rb;
145
146 rb = vcpu->arch.gpr[get_rb(inst)];
147 t = vcpu->arch.mmu.slbmfev(vcpu, rb);
148 vcpu->arch.gpr[get_rt(inst)] = t;
149 }
150 break;
151 case OP_31_XOP_DCBZ:
152 {
153 ulong rb = vcpu->arch.gpr[get_rb(inst)];
154 ulong ra = 0;
155 ulong addr;
156 u32 zeros[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
157
158 if (get_ra(inst))
159 ra = vcpu->arch.gpr[get_ra(inst)];
160
161 addr = (ra + rb) & ~31ULL;
162 if (!(vcpu->arch.msr & MSR_SF))
163 addr &= 0xffffffff;
164
165 if (kvmppc_st(vcpu, addr, 32, zeros)) {
166 vcpu->arch.dear = addr;
167 vcpu->arch.fault_dear = addr;
168 to_book3s(vcpu)->dsisr = DSISR_PROTFAULT |
169 DSISR_ISSTORE;
170 kvmppc_book3s_queue_irqprio(vcpu,
171 BOOK3S_INTERRUPT_DATA_STORAGE);
172 kvmppc_mmu_pte_flush(vcpu, addr, ~0xFFFULL);
173 }
174
175 break;
176 }
177 default:
178 emulated = EMULATE_FAIL;
179 }
180 break;
181 default:
182 emulated = EMULATE_FAIL;
183 }
184
185 return emulated;
186}
187
188void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat, bool upper,
189 u32 val)
190{
191 if (upper) {
192 /* Upper BAT */
193 u32 bl = (val >> 2) & 0x7ff;
194 bat->bepi_mask = (~bl << 17);
195 bat->bepi = val & 0xfffe0000;
196 bat->vs = (val & 2) ? 1 : 0;
197 bat->vp = (val & 1) ? 1 : 0;
198 bat->raw = (bat->raw & 0xffffffff00000000ULL) | val;
199 } else {
200 /* Lower BAT */
201 bat->brpn = val & 0xfffe0000;
202 bat->wimg = (val >> 3) & 0xf;
203 bat->pp = val & 3;
204 bat->raw = (bat->raw & 0x00000000ffffffffULL) | ((u64)val << 32);
205 }
206}
207
208static void kvmppc_write_bat(struct kvm_vcpu *vcpu, int sprn, u32 val)
209{
210 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
211 struct kvmppc_bat *bat;
212
213 switch (sprn) {
214 case SPRN_IBAT0U ... SPRN_IBAT3L:
215 bat = &vcpu_book3s->ibat[(sprn - SPRN_IBAT0U) / 2];
216 break;
217 case SPRN_IBAT4U ... SPRN_IBAT7L:
218 bat = &vcpu_book3s->ibat[(sprn - SPRN_IBAT4U) / 2];
219 break;
220 case SPRN_DBAT0U ... SPRN_DBAT3L:
221 bat = &vcpu_book3s->dbat[(sprn - SPRN_DBAT0U) / 2];
222 break;
223 case SPRN_DBAT4U ... SPRN_DBAT7L:
224 bat = &vcpu_book3s->dbat[(sprn - SPRN_DBAT4U) / 2];
225 break;
226 default:
227 BUG();
228 }
229
230 kvmppc_set_bat(vcpu, bat, !(sprn % 2), val);
231}
232
233int kvmppc_core_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs)
234{
235 int emulated = EMULATE_DONE;
236
237 switch (sprn) {
238 case SPRN_SDR1:
239 to_book3s(vcpu)->sdr1 = vcpu->arch.gpr[rs];
240 break;
241 case SPRN_DSISR:
242 to_book3s(vcpu)->dsisr = vcpu->arch.gpr[rs];
243 break;
244 case SPRN_DAR:
245 vcpu->arch.dear = vcpu->arch.gpr[rs];
246 break;
247 case SPRN_HIOR:
248 to_book3s(vcpu)->hior = vcpu->arch.gpr[rs];
249 break;
250 case SPRN_IBAT0U ... SPRN_IBAT3L:
251 case SPRN_IBAT4U ... SPRN_IBAT7L:
252 case SPRN_DBAT0U ... SPRN_DBAT3L:
253 case SPRN_DBAT4U ... SPRN_DBAT7L:
254 kvmppc_write_bat(vcpu, sprn, (u32)vcpu->arch.gpr[rs]);
255 /* BAT writes happen so rarely that we're ok to flush
256 * everything here */
257 kvmppc_mmu_pte_flush(vcpu, 0, 0);
258 break;
259 case SPRN_HID0:
260 to_book3s(vcpu)->hid[0] = vcpu->arch.gpr[rs];
261 break;
262 case SPRN_HID1:
263 to_book3s(vcpu)->hid[1] = vcpu->arch.gpr[rs];
264 break;
265 case SPRN_HID2:
266 to_book3s(vcpu)->hid[2] = vcpu->arch.gpr[rs];
267 break;
268 case SPRN_HID4:
269 to_book3s(vcpu)->hid[4] = vcpu->arch.gpr[rs];
270 break;
271 case SPRN_HID5:
272 to_book3s(vcpu)->hid[5] = vcpu->arch.gpr[rs];
273 /* guest HID5 set can change is_dcbz32 */
274 if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
275 (mfmsr() & MSR_HV))
276 vcpu->arch.hflags |= BOOK3S_HFLAG_DCBZ32;
277 break;
278 case SPRN_ICTC:
279 case SPRN_THRM1:
280 case SPRN_THRM2:
281 case SPRN_THRM3:
282 case SPRN_CTRLF:
283 case SPRN_CTRLT:
284 break;
285 default:
286 printk(KERN_INFO "KVM: invalid SPR write: %d\n", sprn);
287#ifndef DEBUG_SPR
288 emulated = EMULATE_FAIL;
289#endif
290 break;
291 }
292
293 return emulated;
294}
295
296int kvmppc_core_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
297{
298 int emulated = EMULATE_DONE;
299
300 switch (sprn) {
301 case SPRN_SDR1:
302 vcpu->arch.gpr[rt] = to_book3s(vcpu)->sdr1;
303 break;
304 case SPRN_DSISR:
305 vcpu->arch.gpr[rt] = to_book3s(vcpu)->dsisr;
306 break;
307 case SPRN_DAR:
308 vcpu->arch.gpr[rt] = vcpu->arch.dear;
309 break;
310 case SPRN_HIOR:
311 vcpu->arch.gpr[rt] = to_book3s(vcpu)->hior;
312 break;
313 case SPRN_HID0:
314 vcpu->arch.gpr[rt] = to_book3s(vcpu)->hid[0];
315 break;
316 case SPRN_HID1:
317 vcpu->arch.gpr[rt] = to_book3s(vcpu)->hid[1];
318 break;
319 case SPRN_HID2:
320 vcpu->arch.gpr[rt] = to_book3s(vcpu)->hid[2];
321 break;
322 case SPRN_HID4:
323 vcpu->arch.gpr[rt] = to_book3s(vcpu)->hid[4];
324 break;
325 case SPRN_HID5:
326 vcpu->arch.gpr[rt] = to_book3s(vcpu)->hid[5];
327 break;
328 case SPRN_THRM1:
329 case SPRN_THRM2:
330 case SPRN_THRM3:
331 case SPRN_CTRLF:
332 case SPRN_CTRLT:
333 vcpu->arch.gpr[rt] = 0;
334 break;
335 default:
336 printk(KERN_INFO "KVM: invalid SPR read: %d\n", sprn);
337#ifndef DEBUG_SPR
338 emulated = EMULATE_FAIL;
339#endif
340 break;
341 }
342
343 return emulated;
344}
345
diff --git a/arch/powerpc/kvm/book3s_64_exports.c b/arch/powerpc/kvm/book3s_64_exports.c
new file mode 100644
index 000000000000..5b2db38ed86c
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_64_exports.c
@@ -0,0 +1,24 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#include <linux/module.h>
21#include <asm/kvm_book3s.h>
22
23EXPORT_SYMBOL_GPL(kvmppc_trampoline_enter);
24EXPORT_SYMBOL_GPL(kvmppc_trampoline_lowmem);
diff --git a/arch/powerpc/kvm/book3s_64_interrupts.S b/arch/powerpc/kvm/book3s_64_interrupts.S
new file mode 100644
index 000000000000..7b55d8094c8b
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_64_interrupts.S
@@ -0,0 +1,392 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#include <asm/ppc_asm.h>
21#include <asm/kvm_asm.h>
22#include <asm/reg.h>
23#include <asm/page.h>
24#include <asm/asm-offsets.h>
25#include <asm/exception-64s.h>
26
27#define KVMPPC_HANDLE_EXIT .kvmppc_handle_exit
28#define ULONG_SIZE 8
29#define VCPU_GPR(n) (VCPU_GPRS + (n * ULONG_SIZE))
30
31.macro mfpaca tmp_reg, src_reg, offset, vcpu_reg
32 ld \tmp_reg, (PACA_EXMC+\offset)(r13)
33 std \tmp_reg, VCPU_GPR(\src_reg)(\vcpu_reg)
34.endm
35
36.macro DISABLE_INTERRUPTS
37 mfmsr r0
38 rldicl r0,r0,48,1
39 rotldi r0,r0,16
40 mtmsrd r0,1
41.endm
42
43/*****************************************************************************
44 * *
45 * Guest entry / exit code that is in kernel module memory (highmem) *
46 * *
47 ****************************************************************************/
48
49/* Registers:
50 * r3: kvm_run pointer
51 * r4: vcpu pointer
52 */
53_GLOBAL(__kvmppc_vcpu_entry)
54
55kvm_start_entry:
56 /* Write correct stack frame */
57 mflr r0
58 std r0,16(r1)
59
60 /* Save host state to the stack */
61 stdu r1, -SWITCH_FRAME_SIZE(r1)
62
63 /* Save r3 (kvm_run) and r4 (vcpu) */
64 SAVE_2GPRS(3, r1)
65
66 /* Save non-volatile registers (r14 - r31) */
67 SAVE_NVGPRS(r1)
68
69 /* Save LR */
70 mflr r14
71 std r14, _LINK(r1)
72
73/* XXX optimize non-volatile loading away */
74kvm_start_lightweight:
75
76 DISABLE_INTERRUPTS
77
78 /* Save R1/R2 in the PACA */
79 std r1, PACAR1(r13)
80 std r2, (PACA_EXMC+EX_SRR0)(r13)
81 ld r3, VCPU_HIGHMEM_HANDLER(r4)
82 std r3, PACASAVEDMSR(r13)
83
84 /* Load non-volatile guest state from the vcpu */
85 ld r14, VCPU_GPR(r14)(r4)
86 ld r15, VCPU_GPR(r15)(r4)
87 ld r16, VCPU_GPR(r16)(r4)
88 ld r17, VCPU_GPR(r17)(r4)
89 ld r18, VCPU_GPR(r18)(r4)
90 ld r19, VCPU_GPR(r19)(r4)
91 ld r20, VCPU_GPR(r20)(r4)
92 ld r21, VCPU_GPR(r21)(r4)
93 ld r22, VCPU_GPR(r22)(r4)
94 ld r23, VCPU_GPR(r23)(r4)
95 ld r24, VCPU_GPR(r24)(r4)
96 ld r25, VCPU_GPR(r25)(r4)
97 ld r26, VCPU_GPR(r26)(r4)
98 ld r27, VCPU_GPR(r27)(r4)
99 ld r28, VCPU_GPR(r28)(r4)
100 ld r29, VCPU_GPR(r29)(r4)
101 ld r30, VCPU_GPR(r30)(r4)
102 ld r31, VCPU_GPR(r31)(r4)
103
104 ld r9, VCPU_PC(r4) /* r9 = vcpu->arch.pc */
105 ld r10, VCPU_SHADOW_MSR(r4) /* r10 = vcpu->arch.shadow_msr */
106
107 ld r3, VCPU_TRAMPOLINE_ENTER(r4)
108 mtsrr0 r3
109
110 LOAD_REG_IMMEDIATE(r3, MSR_KERNEL & ~(MSR_IR | MSR_DR))
111 mtsrr1 r3
112
113 /* Load guest state in the respective registers */
114 lwz r3, VCPU_CR(r4) /* r3 = vcpu->arch.cr */
115 stw r3, (PACA_EXMC + EX_CCR)(r13)
116
117 ld r3, VCPU_CTR(r4) /* r3 = vcpu->arch.ctr */
118 mtctr r3 /* CTR = r3 */
119
120 ld r3, VCPU_LR(r4) /* r3 = vcpu->arch.lr */
121 mtlr r3 /* LR = r3 */
122
123 ld r3, VCPU_XER(r4) /* r3 = vcpu->arch.xer */
124 std r3, (PACA_EXMC + EX_R3)(r13)
125
126 /* Some guests may need to have dcbz set to 32 byte length.
127 *
128 * Usually we ensure that by patching the guest's instructions
129 * to trap on dcbz and emulate it in the hypervisor.
130 *
131 * If we can, we should tell the CPU to use 32 byte dcbz though,
132 * because that's a lot faster.
133 */
134
135 ld r3, VCPU_HFLAGS(r4)
136 rldicl. r3, r3, 0, 63 /* CR = ((r3 & 1) == 0) */
137 beq no_dcbz32_on
138
139 mfspr r3,SPRN_HID5
140 ori r3, r3, 0x80 /* XXX HID5_dcbz32 = 0x80 */
141 mtspr SPRN_HID5,r3
142
143no_dcbz32_on:
144 /* Load guest GPRs */
145
146 ld r3, VCPU_GPR(r9)(r4)
147 std r3, (PACA_EXMC + EX_R9)(r13)
148 ld r3, VCPU_GPR(r10)(r4)
149 std r3, (PACA_EXMC + EX_R10)(r13)
150 ld r3, VCPU_GPR(r11)(r4)
151 std r3, (PACA_EXMC + EX_R11)(r13)
152 ld r3, VCPU_GPR(r12)(r4)
153 std r3, (PACA_EXMC + EX_R12)(r13)
154 ld r3, VCPU_GPR(r13)(r4)
155 std r3, (PACA_EXMC + EX_R13)(r13)
156
157 ld r0, VCPU_GPR(r0)(r4)
158 ld r1, VCPU_GPR(r1)(r4)
159 ld r2, VCPU_GPR(r2)(r4)
160 ld r3, VCPU_GPR(r3)(r4)
161 ld r5, VCPU_GPR(r5)(r4)
162 ld r6, VCPU_GPR(r6)(r4)
163 ld r7, VCPU_GPR(r7)(r4)
164 ld r8, VCPU_GPR(r8)(r4)
165 ld r4, VCPU_GPR(r4)(r4)
166
167 /* This sets the Magic value for the trampoline */
168
169 li r11, 1
170 stb r11, PACA_KVM_IN_GUEST(r13)
171
172 /* Jump to SLB patching handlder and into our guest */
173 RFI
174
175/*
176 * This is the handler in module memory. It gets jumped at from the
177 * lowmem trampoline code, so it's basically the guest exit code.
178 *
179 */
180
181.global kvmppc_handler_highmem
182kvmppc_handler_highmem:
183
184 /*
185 * Register usage at this point:
186 *
187 * R00 = guest R13
188 * R01 = host R1
189 * R02 = host R2
190 * R10 = guest PC
191 * R11 = guest MSR
192 * R12 = exit handler id
193 * R13 = PACA
194 * PACA.exmc.R9 = guest R1
195 * PACA.exmc.R10 = guest R10
196 * PACA.exmc.R11 = guest R11
197 * PACA.exmc.R12 = guest R12
198 * PACA.exmc.R13 = guest R2
199 * PACA.exmc.DAR = guest DAR
200 * PACA.exmc.DSISR = guest DSISR
201 * PACA.exmc.LR = guest instruction
202 * PACA.exmc.CCR = guest CR
203 * PACA.exmc.SRR0 = guest R0
204 *
205 */
206
207 std r3, (PACA_EXMC+EX_R3)(r13)
208
209 /* save the exit id in R3 */
210 mr r3, r12
211
212 /* R12 = vcpu */
213 ld r12, GPR4(r1)
214
215 /* Now save the guest state */
216
217 std r0, VCPU_GPR(r13)(r12)
218 std r4, VCPU_GPR(r4)(r12)
219 std r5, VCPU_GPR(r5)(r12)
220 std r6, VCPU_GPR(r6)(r12)
221 std r7, VCPU_GPR(r7)(r12)
222 std r8, VCPU_GPR(r8)(r12)
223 std r9, VCPU_GPR(r9)(r12)
224
225 /* get registers from PACA */
226 mfpaca r5, r0, EX_SRR0, r12
227 mfpaca r5, r3, EX_R3, r12
228 mfpaca r5, r1, EX_R9, r12
229 mfpaca r5, r10, EX_R10, r12
230 mfpaca r5, r11, EX_R11, r12
231 mfpaca r5, r12, EX_R12, r12
232 mfpaca r5, r2, EX_R13, r12
233
234 lwz r5, (PACA_EXMC+EX_LR)(r13)
235 stw r5, VCPU_LAST_INST(r12)
236
237 lwz r5, (PACA_EXMC+EX_CCR)(r13)
238 stw r5, VCPU_CR(r12)
239
240 ld r5, VCPU_HFLAGS(r12)
241 rldicl. r5, r5, 0, 63 /* CR = ((r5 & 1) == 0) */
242 beq no_dcbz32_off
243
244 mfspr r5,SPRN_HID5
245 rldimi r5,r5,6,56
246 mtspr SPRN_HID5,r5
247
248no_dcbz32_off:
249
250 /* XXX maybe skip on lightweight? */
251 std r14, VCPU_GPR(r14)(r12)
252 std r15, VCPU_GPR(r15)(r12)
253 std r16, VCPU_GPR(r16)(r12)
254 std r17, VCPU_GPR(r17)(r12)
255 std r18, VCPU_GPR(r18)(r12)
256 std r19, VCPU_GPR(r19)(r12)
257 std r20, VCPU_GPR(r20)(r12)
258 std r21, VCPU_GPR(r21)(r12)
259 std r22, VCPU_GPR(r22)(r12)
260 std r23, VCPU_GPR(r23)(r12)
261 std r24, VCPU_GPR(r24)(r12)
262 std r25, VCPU_GPR(r25)(r12)
263 std r26, VCPU_GPR(r26)(r12)
264 std r27, VCPU_GPR(r27)(r12)
265 std r28, VCPU_GPR(r28)(r12)
266 std r29, VCPU_GPR(r29)(r12)
267 std r30, VCPU_GPR(r30)(r12)
268 std r31, VCPU_GPR(r31)(r12)
269
270 /* Restore non-volatile host registers (r14 - r31) */
271 REST_NVGPRS(r1)
272
273 /* Save guest PC (R10) */
274 std r10, VCPU_PC(r12)
275
276 /* Save guest msr (R11) */
277 std r11, VCPU_SHADOW_MSR(r12)
278
279 /* Save guest CTR (in R12) */
280 mfctr r5
281 std r5, VCPU_CTR(r12)
282
283 /* Save guest LR */
284 mflr r5
285 std r5, VCPU_LR(r12)
286
287 /* Save guest XER */
288 mfxer r5
289 std r5, VCPU_XER(r12)
290
291 /* Save guest DAR */
292 ld r5, (PACA_EXMC+EX_DAR)(r13)
293 std r5, VCPU_FAULT_DEAR(r12)
294
295 /* Save guest DSISR */
296 lwz r5, (PACA_EXMC+EX_DSISR)(r13)
297 std r5, VCPU_FAULT_DSISR(r12)
298
299 /* Restore host msr -> SRR1 */
300 ld r7, VCPU_HOST_MSR(r12)
301 mtsrr1 r7
302
303 /* Restore host IP -> SRR0 */
304 ld r6, VCPU_HOST_RETIP(r12)
305 mtsrr0 r6
306
307 /*
308 * For some interrupts, we need to call the real Linux
309 * handler, so it can do work for us. This has to happen
310 * as if the interrupt arrived from the kernel though,
311 * so let's fake it here where most state is restored.
312 *
313 * Call Linux for hardware interrupts/decrementer
314 * r3 = address of interrupt handler (exit reason)
315 */
316
317 cmpwi r3, BOOK3S_INTERRUPT_EXTERNAL
318 beq call_linux_handler
319 cmpwi r3, BOOK3S_INTERRUPT_DECREMENTER
320 beq call_linux_handler
321
322 /* Back to Interruptable Mode! (goto kvm_return_point) */
323 RFI
324
325call_linux_handler:
326
327 /*
328 * If we land here we need to jump back to the handler we
329 * came from.
330 *
331 * We have a page that we can access from real mode, so let's
332 * jump back to that and use it as a trampoline to get back into the
333 * interrupt handler!
334 *
335 * R3 still contains the exit code,
336 * R6 VCPU_HOST_RETIP and
337 * R7 VCPU_HOST_MSR
338 */
339
340 mtlr r3
341
342 ld r5, VCPU_TRAMPOLINE_LOWMEM(r12)
343 mtsrr0 r5
344 LOAD_REG_IMMEDIATE(r5, MSR_KERNEL & ~(MSR_IR | MSR_DR))
345 mtsrr1 r5
346
347 RFI
348
349.global kvm_return_point
350kvm_return_point:
351
352 /* Jump back to lightweight entry if we're supposed to */
353 /* go back into the guest */
354 mr r5, r3
355 /* Restore r3 (kvm_run) and r4 (vcpu) */
356 REST_2GPRS(3, r1)
357 bl KVMPPC_HANDLE_EXIT
358
359#if 0 /* XXX get lightweight exits back */
360 cmpwi r3, RESUME_GUEST
361 bne kvm_exit_heavyweight
362
363 /* put VCPU and KVM_RUN back into place and roll again! */
364 REST_2GPRS(3, r1)
365 b kvm_start_lightweight
366
367kvm_exit_heavyweight:
368 /* Restore non-volatile host registers */
369 ld r14, _LINK(r1)
370 mtlr r14
371 REST_NVGPRS(r1)
372
373 addi r1, r1, SWITCH_FRAME_SIZE
374#else
375 ld r4, _LINK(r1)
376 mtlr r4
377
378 cmpwi r3, RESUME_GUEST
379 bne kvm_exit_heavyweight
380
381 REST_2GPRS(3, r1)
382
383 addi r1, r1, SWITCH_FRAME_SIZE
384
385 b kvm_start_entry
386
387kvm_exit_heavyweight:
388
389 addi r1, r1, SWITCH_FRAME_SIZE
390#endif
391
392 blr
diff --git a/arch/powerpc/kvm/book3s_64_mmu.c b/arch/powerpc/kvm/book3s_64_mmu.c
new file mode 100644
index 000000000000..5598f88f142e
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_64_mmu.c
@@ -0,0 +1,478 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#include <linux/types.h>
21#include <linux/string.h>
22#include <linux/kvm.h>
23#include <linux/kvm_host.h>
24#include <linux/highmem.h>
25
26#include <asm/tlbflush.h>
27#include <asm/kvm_ppc.h>
28#include <asm/kvm_book3s.h>
29
30/* #define DEBUG_MMU */
31
32#ifdef DEBUG_MMU
33#define dprintk(X...) printk(KERN_INFO X)
34#else
35#define dprintk(X...) do { } while(0)
36#endif
37
38static void kvmppc_mmu_book3s_64_reset_msr(struct kvm_vcpu *vcpu)
39{
40 kvmppc_set_msr(vcpu, MSR_SF);
41}
42
43static struct kvmppc_slb *kvmppc_mmu_book3s_64_find_slbe(
44 struct kvmppc_vcpu_book3s *vcpu_book3s,
45 gva_t eaddr)
46{
47 int i;
48 u64 esid = GET_ESID(eaddr);
49 u64 esid_1t = GET_ESID_1T(eaddr);
50
51 for (i = 0; i < vcpu_book3s->slb_nr; i++) {
52 u64 cmp_esid = esid;
53
54 if (!vcpu_book3s->slb[i].valid)
55 continue;
56
57 if (vcpu_book3s->slb[i].large)
58 cmp_esid = esid_1t;
59
60 if (vcpu_book3s->slb[i].esid == cmp_esid)
61 return &vcpu_book3s->slb[i];
62 }
63
64 dprintk("KVM: No SLB entry found for 0x%lx [%llx | %llx]\n",
65 eaddr, esid, esid_1t);
66 for (i = 0; i < vcpu_book3s->slb_nr; i++) {
67 if (vcpu_book3s->slb[i].vsid)
68 dprintk(" %d: %c%c %llx %llx\n", i,
69 vcpu_book3s->slb[i].valid ? 'v' : ' ',
70 vcpu_book3s->slb[i].large ? 'l' : ' ',
71 vcpu_book3s->slb[i].esid,
72 vcpu_book3s->slb[i].vsid);
73 }
74
75 return NULL;
76}
77
78static u64 kvmppc_mmu_book3s_64_ea_to_vp(struct kvm_vcpu *vcpu, gva_t eaddr,
79 bool data)
80{
81 struct kvmppc_slb *slb;
82
83 slb = kvmppc_mmu_book3s_64_find_slbe(to_book3s(vcpu), eaddr);
84 if (!slb)
85 return 0;
86
87 if (slb->large)
88 return (((u64)eaddr >> 12) & 0xfffffff) |
89 (((u64)slb->vsid) << 28);
90
91 return (((u64)eaddr >> 12) & 0xffff) | (((u64)slb->vsid) << 16);
92}
93
94static int kvmppc_mmu_book3s_64_get_pagesize(struct kvmppc_slb *slbe)
95{
96 return slbe->large ? 24 : 12;
97}
98
99static u32 kvmppc_mmu_book3s_64_get_page(struct kvmppc_slb *slbe, gva_t eaddr)
100{
101 int p = kvmppc_mmu_book3s_64_get_pagesize(slbe);
102 return ((eaddr & 0xfffffff) >> p);
103}
104
105static hva_t kvmppc_mmu_book3s_64_get_pteg(
106 struct kvmppc_vcpu_book3s *vcpu_book3s,
107 struct kvmppc_slb *slbe, gva_t eaddr,
108 bool second)
109{
110 u64 hash, pteg, htabsize;
111 u32 page;
112 hva_t r;
113
114 page = kvmppc_mmu_book3s_64_get_page(slbe, eaddr);
115 htabsize = ((1 << ((vcpu_book3s->sdr1 & 0x1f) + 11)) - 1);
116
117 hash = slbe->vsid ^ page;
118 if (second)
119 hash = ~hash;
120 hash &= ((1ULL << 39ULL) - 1ULL);
121 hash &= htabsize;
122 hash <<= 7ULL;
123
124 pteg = vcpu_book3s->sdr1 & 0xfffffffffffc0000ULL;
125 pteg |= hash;
126
127 dprintk("MMU: page=0x%x sdr1=0x%llx pteg=0x%llx vsid=0x%llx\n",
128 page, vcpu_book3s->sdr1, pteg, slbe->vsid);
129
130 r = gfn_to_hva(vcpu_book3s->vcpu.kvm, pteg >> PAGE_SHIFT);
131 if (kvm_is_error_hva(r))
132 return r;
133 return r | (pteg & ~PAGE_MASK);
134}
135
136static u64 kvmppc_mmu_book3s_64_get_avpn(struct kvmppc_slb *slbe, gva_t eaddr)
137{
138 int p = kvmppc_mmu_book3s_64_get_pagesize(slbe);
139 u64 avpn;
140
141 avpn = kvmppc_mmu_book3s_64_get_page(slbe, eaddr);
142 avpn |= slbe->vsid << (28 - p);
143
144 if (p < 24)
145 avpn >>= ((80 - p) - 56) - 8;
146 else
147 avpn <<= 8;
148
149 return avpn;
150}
151
152static int kvmppc_mmu_book3s_64_xlate(struct kvm_vcpu *vcpu, gva_t eaddr,
153 struct kvmppc_pte *gpte, bool data)
154{
155 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
156 struct kvmppc_slb *slbe;
157 hva_t ptegp;
158 u64 pteg[16];
159 u64 avpn = 0;
160 int i;
161 u8 key = 0;
162 bool found = false;
163 bool perm_err = false;
164 int second = 0;
165
166 slbe = kvmppc_mmu_book3s_64_find_slbe(vcpu_book3s, eaddr);
167 if (!slbe)
168 goto no_seg_found;
169
170do_second:
171 ptegp = kvmppc_mmu_book3s_64_get_pteg(vcpu_book3s, slbe, eaddr, second);
172 if (kvm_is_error_hva(ptegp))
173 goto no_page_found;
174
175 avpn = kvmppc_mmu_book3s_64_get_avpn(slbe, eaddr);
176
177 if(copy_from_user(pteg, (void __user *)ptegp, sizeof(pteg))) {
178 printk(KERN_ERR "KVM can't copy data from 0x%lx!\n", ptegp);
179 goto no_page_found;
180 }
181
182 if ((vcpu->arch.msr & MSR_PR) && slbe->Kp)
183 key = 4;
184 else if (!(vcpu->arch.msr & MSR_PR) && slbe->Ks)
185 key = 4;
186
187 for (i=0; i<16; i+=2) {
188 u64 v = pteg[i];
189 u64 r = pteg[i+1];
190
191 /* Valid check */
192 if (!(v & HPTE_V_VALID))
193 continue;
194 /* Hash check */
195 if ((v & HPTE_V_SECONDARY) != second)
196 continue;
197
198 /* AVPN compare */
199 if (HPTE_V_AVPN_VAL(avpn) == HPTE_V_AVPN_VAL(v)) {
200 u8 pp = (r & HPTE_R_PP) | key;
201 int eaddr_mask = 0xFFF;
202
203 gpte->eaddr = eaddr;
204 gpte->vpage = kvmppc_mmu_book3s_64_ea_to_vp(vcpu,
205 eaddr,
206 data);
207 if (slbe->large)
208 eaddr_mask = 0xFFFFFF;
209 gpte->raddr = (r & HPTE_R_RPN) | (eaddr & eaddr_mask);
210 gpte->may_execute = ((r & HPTE_R_N) ? false : true);
211 gpte->may_read = false;
212 gpte->may_write = false;
213
214 switch (pp) {
215 case 0:
216 case 1:
217 case 2:
218 case 6:
219 gpte->may_write = true;
220 /* fall through */
221 case 3:
222 case 5:
223 case 7:
224 gpte->may_read = true;
225 break;
226 }
227
228 if (!gpte->may_read) {
229 perm_err = true;
230 continue;
231 }
232
233 dprintk("KVM MMU: Translated 0x%lx [0x%llx] -> 0x%llx "
234 "-> 0x%llx\n",
235 eaddr, avpn, gpte->vpage, gpte->raddr);
236 found = true;
237 break;
238 }
239 }
240
241 /* Update PTE R and C bits, so the guest's swapper knows we used the
242 * page */
243 if (found) {
244 u32 oldr = pteg[i+1];
245
246 if (gpte->may_read) {
247 /* Set the accessed flag */
248 pteg[i+1] |= HPTE_R_R;
249 }
250 if (gpte->may_write) {
251 /* Set the dirty flag */
252 pteg[i+1] |= HPTE_R_C;
253 } else {
254 dprintk("KVM: Mapping read-only page!\n");
255 }
256
257 /* Write back into the PTEG */
258 if (pteg[i+1] != oldr)
259 copy_to_user((void __user *)ptegp, pteg, sizeof(pteg));
260
261 return 0;
262 } else {
263 dprintk("KVM MMU: No PTE found (ea=0x%lx sdr1=0x%llx "
264 "ptegp=0x%lx)\n",
265 eaddr, to_book3s(vcpu)->sdr1, ptegp);
266 for (i = 0; i < 16; i += 2)
267 dprintk(" %02d: 0x%llx - 0x%llx (0x%llx)\n",
268 i, pteg[i], pteg[i+1], avpn);
269
270 if (!second) {
271 second = HPTE_V_SECONDARY;
272 goto do_second;
273 }
274 }
275
276
277no_page_found:
278
279
280 if (perm_err)
281 return -EPERM;
282
283 return -ENOENT;
284
285no_seg_found:
286
287 dprintk("KVM MMU: Trigger segment fault\n");
288 return -EINVAL;
289}
290
291static void kvmppc_mmu_book3s_64_slbmte(struct kvm_vcpu *vcpu, u64 rs, u64 rb)
292{
293 struct kvmppc_vcpu_book3s *vcpu_book3s;
294 u64 esid, esid_1t;
295 int slb_nr;
296 struct kvmppc_slb *slbe;
297
298 dprintk("KVM MMU: slbmte(0x%llx, 0x%llx)\n", rs, rb);
299
300 vcpu_book3s = to_book3s(vcpu);
301
302 esid = GET_ESID(rb);
303 esid_1t = GET_ESID_1T(rb);
304 slb_nr = rb & 0xfff;
305
306 if (slb_nr > vcpu_book3s->slb_nr)
307 return;
308
309 slbe = &vcpu_book3s->slb[slb_nr];
310
311 slbe->large = (rs & SLB_VSID_L) ? 1 : 0;
312 slbe->esid = slbe->large ? esid_1t : esid;
313 slbe->vsid = rs >> 12;
314 slbe->valid = (rb & SLB_ESID_V) ? 1 : 0;
315 slbe->Ks = (rs & SLB_VSID_KS) ? 1 : 0;
316 slbe->Kp = (rs & SLB_VSID_KP) ? 1 : 0;
317 slbe->nx = (rs & SLB_VSID_N) ? 1 : 0;
318 slbe->class = (rs & SLB_VSID_C) ? 1 : 0;
319
320 slbe->orige = rb & (ESID_MASK | SLB_ESID_V);
321 slbe->origv = rs;
322
323 /* Map the new segment */
324 kvmppc_mmu_map_segment(vcpu, esid << SID_SHIFT);
325}
326
327static u64 kvmppc_mmu_book3s_64_slbmfee(struct kvm_vcpu *vcpu, u64 slb_nr)
328{
329 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
330 struct kvmppc_slb *slbe;
331
332 if (slb_nr > vcpu_book3s->slb_nr)
333 return 0;
334
335 slbe = &vcpu_book3s->slb[slb_nr];
336
337 return slbe->orige;
338}
339
340static u64 kvmppc_mmu_book3s_64_slbmfev(struct kvm_vcpu *vcpu, u64 slb_nr)
341{
342 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
343 struct kvmppc_slb *slbe;
344
345 if (slb_nr > vcpu_book3s->slb_nr)
346 return 0;
347
348 slbe = &vcpu_book3s->slb[slb_nr];
349
350 return slbe->origv;
351}
352
353static void kvmppc_mmu_book3s_64_slbie(struct kvm_vcpu *vcpu, u64 ea)
354{
355 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
356 struct kvmppc_slb *slbe;
357
358 dprintk("KVM MMU: slbie(0x%llx)\n", ea);
359
360 slbe = kvmppc_mmu_book3s_64_find_slbe(vcpu_book3s, ea);
361
362 if (!slbe)
363 return;
364
365 dprintk("KVM MMU: slbie(0x%llx, 0x%llx)\n", ea, slbe->esid);
366
367 slbe->valid = false;
368
369 kvmppc_mmu_map_segment(vcpu, ea);
370}
371
372static void kvmppc_mmu_book3s_64_slbia(struct kvm_vcpu *vcpu)
373{
374 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
375 int i;
376
377 dprintk("KVM MMU: slbia()\n");
378
379 for (i = 1; i < vcpu_book3s->slb_nr; i++)
380 vcpu_book3s->slb[i].valid = false;
381
382 if (vcpu->arch.msr & MSR_IR) {
383 kvmppc_mmu_flush_segments(vcpu);
384 kvmppc_mmu_map_segment(vcpu, vcpu->arch.pc);
385 }
386}
387
388static void kvmppc_mmu_book3s_64_mtsrin(struct kvm_vcpu *vcpu, u32 srnum,
389 ulong value)
390{
391 u64 rb = 0, rs = 0;
392
393 /* ESID = srnum */
394 rb |= (srnum & 0xf) << 28;
395 /* Set the valid bit */
396 rb |= 1 << 27;
397 /* Index = ESID */
398 rb |= srnum;
399
400 /* VSID = VSID */
401 rs |= (value & 0xfffffff) << 12;
402 /* flags = flags */
403 rs |= ((value >> 27) & 0xf) << 9;
404
405 kvmppc_mmu_book3s_64_slbmte(vcpu, rs, rb);
406}
407
408static void kvmppc_mmu_book3s_64_tlbie(struct kvm_vcpu *vcpu, ulong va,
409 bool large)
410{
411 u64 mask = 0xFFFFFFFFFULL;
412
413 dprintk("KVM MMU: tlbie(0x%lx)\n", va);
414
415 if (large)
416 mask = 0xFFFFFF000ULL;
417 kvmppc_mmu_pte_vflush(vcpu, va >> 12, mask);
418}
419
420static int kvmppc_mmu_book3s_64_esid_to_vsid(struct kvm_vcpu *vcpu, u64 esid,
421 u64 *vsid)
422{
423 switch (vcpu->arch.msr & (MSR_DR|MSR_IR)) {
424 case 0:
425 *vsid = (VSID_REAL >> 16) | esid;
426 break;
427 case MSR_IR:
428 *vsid = (VSID_REAL_IR >> 16) | esid;
429 break;
430 case MSR_DR:
431 *vsid = (VSID_REAL_DR >> 16) | esid;
432 break;
433 case MSR_DR|MSR_IR:
434 {
435 ulong ea;
436 struct kvmppc_slb *slb;
437 ea = esid << SID_SHIFT;
438 slb = kvmppc_mmu_book3s_64_find_slbe(to_book3s(vcpu), ea);
439 if (slb)
440 *vsid = slb->vsid;
441 else
442 return -ENOENT;
443
444 break;
445 }
446 default:
447 BUG();
448 break;
449 }
450
451 return 0;
452}
453
454static bool kvmppc_mmu_book3s_64_is_dcbz32(struct kvm_vcpu *vcpu)
455{
456 return (to_book3s(vcpu)->hid[5] & 0x80);
457}
458
459void kvmppc_mmu_book3s_64_init(struct kvm_vcpu *vcpu)
460{
461 struct kvmppc_mmu *mmu = &vcpu->arch.mmu;
462
463 mmu->mfsrin = NULL;
464 mmu->mtsrin = kvmppc_mmu_book3s_64_mtsrin;
465 mmu->slbmte = kvmppc_mmu_book3s_64_slbmte;
466 mmu->slbmfee = kvmppc_mmu_book3s_64_slbmfee;
467 mmu->slbmfev = kvmppc_mmu_book3s_64_slbmfev;
468 mmu->slbie = kvmppc_mmu_book3s_64_slbie;
469 mmu->slbia = kvmppc_mmu_book3s_64_slbia;
470 mmu->xlate = kvmppc_mmu_book3s_64_xlate;
471 mmu->reset_msr = kvmppc_mmu_book3s_64_reset_msr;
472 mmu->tlbie = kvmppc_mmu_book3s_64_tlbie;
473 mmu->esid_to_vsid = kvmppc_mmu_book3s_64_esid_to_vsid;
474 mmu->ea_to_vp = kvmppc_mmu_book3s_64_ea_to_vp;
475 mmu->is_dcbz32 = kvmppc_mmu_book3s_64_is_dcbz32;
476
477 vcpu->arch.hflags |= BOOK3S_HFLAG_SLB;
478}
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
new file mode 100644
index 000000000000..f2899b297ffd
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -0,0 +1,408 @@
1/*
2 * Copyright (C) 2009 SUSE Linux Products GmbH. All rights reserved.
3 *
4 * Authors:
5 * Alexander Graf <agraf@suse.de>
6 * Kevin Wolf <mail@kevin-wolf.de>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License, version 2, as
10 * published by the Free Software Foundation.
11 *
12 * 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 */
21
22#include <linux/kvm_host.h>
23
24#include <asm/kvm_ppc.h>
25#include <asm/kvm_book3s.h>
26#include <asm/mmu-hash64.h>
27#include <asm/machdep.h>
28#include <asm/mmu_context.h>
29#include <asm/hw_irq.h>
30
31#define PTE_SIZE 12
32#define VSID_ALL 0
33
34/* #define DEBUG_MMU */
35/* #define DEBUG_SLB */
36
37#ifdef DEBUG_MMU
38#define dprintk_mmu(a, ...) printk(KERN_INFO a, __VA_ARGS__)
39#else
40#define dprintk_mmu(a, ...) do { } while(0)
41#endif
42
43#ifdef DEBUG_SLB
44#define dprintk_slb(a, ...) printk(KERN_INFO a, __VA_ARGS__)
45#else
46#define dprintk_slb(a, ...) do { } while(0)
47#endif
48
49static void invalidate_pte(struct hpte_cache *pte)
50{
51 dprintk_mmu("KVM: Flushing SPT %d: 0x%llx (0x%llx) -> 0x%llx\n",
52 i, pte->pte.eaddr, pte->pte.vpage, pte->host_va);
53
54 ppc_md.hpte_invalidate(pte->slot, pte->host_va,
55 MMU_PAGE_4K, MMU_SEGSIZE_256M,
56 false);
57 pte->host_va = 0;
58 kvm_release_pfn_dirty(pte->pfn);
59}
60
61void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, u64 guest_ea, u64 ea_mask)
62{
63 int i;
64
65 dprintk_mmu("KVM: Flushing %d Shadow PTEs: 0x%llx & 0x%llx\n",
66 vcpu->arch.hpte_cache_offset, guest_ea, ea_mask);
67 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
68
69 guest_ea &= ea_mask;
70 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
71 struct hpte_cache *pte;
72
73 pte = &vcpu->arch.hpte_cache[i];
74 if (!pte->host_va)
75 continue;
76
77 if ((pte->pte.eaddr & ea_mask) == guest_ea) {
78 invalidate_pte(pte);
79 }
80 }
81
82 /* Doing a complete flush -> start from scratch */
83 if (!ea_mask)
84 vcpu->arch.hpte_cache_offset = 0;
85}
86
87void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 guest_vp, u64 vp_mask)
88{
89 int i;
90
91 dprintk_mmu("KVM: Flushing %d Shadow vPTEs: 0x%llx & 0x%llx\n",
92 vcpu->arch.hpte_cache_offset, guest_vp, vp_mask);
93 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
94
95 guest_vp &= vp_mask;
96 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
97 struct hpte_cache *pte;
98
99 pte = &vcpu->arch.hpte_cache[i];
100 if (!pte->host_va)
101 continue;
102
103 if ((pte->pte.vpage & vp_mask) == guest_vp) {
104 invalidate_pte(pte);
105 }
106 }
107}
108
109void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, u64 pa_start, u64 pa_end)
110{
111 int i;
112
113 dprintk_mmu("KVM: Flushing %d Shadow pPTEs: 0x%llx & 0x%llx\n",
114 vcpu->arch.hpte_cache_offset, guest_pa, pa_mask);
115 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
116
117 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
118 struct hpte_cache *pte;
119
120 pte = &vcpu->arch.hpte_cache[i];
121 if (!pte->host_va)
122 continue;
123
124 if ((pte->pte.raddr >= pa_start) &&
125 (pte->pte.raddr < pa_end)) {
126 invalidate_pte(pte);
127 }
128 }
129}
130
131struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data)
132{
133 int i;
134 u64 guest_vp;
135
136 guest_vp = vcpu->arch.mmu.ea_to_vp(vcpu, ea, false);
137 for (i=0; i<vcpu->arch.hpte_cache_offset; i++) {
138 struct hpte_cache *pte;
139
140 pte = &vcpu->arch.hpte_cache[i];
141 if (!pte->host_va)
142 continue;
143
144 if (pte->pte.vpage == guest_vp)
145 return &pte->pte;
146 }
147
148 return NULL;
149}
150
151static int kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu)
152{
153 if (vcpu->arch.hpte_cache_offset == HPTEG_CACHE_NUM)
154 kvmppc_mmu_pte_flush(vcpu, 0, 0);
155
156 return vcpu->arch.hpte_cache_offset++;
157}
158
159/* We keep 512 gvsid->hvsid entries, mapping the guest ones to the array using
160 * a hash, so we don't waste cycles on looping */
161static u16 kvmppc_sid_hash(struct kvm_vcpu *vcpu, u64 gvsid)
162{
163 return (u16)(((gvsid >> (SID_MAP_BITS * 7)) & SID_MAP_MASK) ^
164 ((gvsid >> (SID_MAP_BITS * 6)) & SID_MAP_MASK) ^
165 ((gvsid >> (SID_MAP_BITS * 5)) & SID_MAP_MASK) ^
166 ((gvsid >> (SID_MAP_BITS * 4)) & SID_MAP_MASK) ^
167 ((gvsid >> (SID_MAP_BITS * 3)) & SID_MAP_MASK) ^
168 ((gvsid >> (SID_MAP_BITS * 2)) & SID_MAP_MASK) ^
169 ((gvsid >> (SID_MAP_BITS * 1)) & SID_MAP_MASK) ^
170 ((gvsid >> (SID_MAP_BITS * 0)) & SID_MAP_MASK));
171}
172
173
174static struct kvmppc_sid_map *find_sid_vsid(struct kvm_vcpu *vcpu, u64 gvsid)
175{
176 struct kvmppc_sid_map *map;
177 u16 sid_map_mask;
178
179 if (vcpu->arch.msr & MSR_PR)
180 gvsid |= VSID_PR;
181
182 sid_map_mask = kvmppc_sid_hash(vcpu, gvsid);
183 map = &to_book3s(vcpu)->sid_map[sid_map_mask];
184 if (map->guest_vsid == gvsid) {
185 dprintk_slb("SLB: Searching 0x%llx -> 0x%llx\n",
186 gvsid, map->host_vsid);
187 return map;
188 }
189
190 map = &to_book3s(vcpu)->sid_map[SID_MAP_MASK - sid_map_mask];
191 if (map->guest_vsid == gvsid) {
192 dprintk_slb("SLB: Searching 0x%llx -> 0x%llx\n",
193 gvsid, map->host_vsid);
194 return map;
195 }
196
197 dprintk_slb("SLB: Searching 0x%llx -> not found\n", gvsid);
198 return NULL;
199}
200
201int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
202{
203 pfn_t hpaddr;
204 ulong hash, hpteg, va;
205 u64 vsid;
206 int ret;
207 int rflags = 0x192;
208 int vflags = 0;
209 int attempt = 0;
210 struct kvmppc_sid_map *map;
211
212 /* Get host physical address for gpa */
213 hpaddr = gfn_to_pfn(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT);
214 if (kvm_is_error_hva(hpaddr)) {
215 printk(KERN_INFO "Couldn't get guest page for gfn %llx!\n", orig_pte->eaddr);
216 return -EINVAL;
217 }
218 hpaddr <<= PAGE_SHIFT;
219#if PAGE_SHIFT == 12
220#elif PAGE_SHIFT == 16
221 hpaddr |= orig_pte->raddr & 0xf000;
222#else
223#error Unknown page size
224#endif
225
226 /* and write the mapping ea -> hpa into the pt */
227 vcpu->arch.mmu.esid_to_vsid(vcpu, orig_pte->eaddr >> SID_SHIFT, &vsid);
228 map = find_sid_vsid(vcpu, vsid);
229 if (!map) {
230 kvmppc_mmu_map_segment(vcpu, orig_pte->eaddr);
231 map = find_sid_vsid(vcpu, vsid);
232 }
233 BUG_ON(!map);
234
235 vsid = map->host_vsid;
236 va = hpt_va(orig_pte->eaddr, vsid, MMU_SEGSIZE_256M);
237
238 if (!orig_pte->may_write)
239 rflags |= HPTE_R_PP;
240 else
241 mark_page_dirty(vcpu->kvm, orig_pte->raddr >> PAGE_SHIFT);
242
243 if (!orig_pte->may_execute)
244 rflags |= HPTE_R_N;
245
246 hash = hpt_hash(va, PTE_SIZE, MMU_SEGSIZE_256M);
247
248map_again:
249 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
250
251 /* In case we tried normal mapping already, let's nuke old entries */
252 if (attempt > 1)
253 if (ppc_md.hpte_remove(hpteg) < 0)
254 return -1;
255
256 ret = ppc_md.hpte_insert(hpteg, va, hpaddr, rflags, vflags, MMU_PAGE_4K, MMU_SEGSIZE_256M);
257
258 if (ret < 0) {
259 /* If we couldn't map a primary PTE, try a secondary */
260#ifdef USE_SECONDARY
261 hash = ~hash;
262 attempt++;
263 if (attempt % 2)
264 vflags = HPTE_V_SECONDARY;
265 else
266 vflags = 0;
267#else
268 attempt = 2;
269#endif
270 goto map_again;
271 } else {
272 int hpte_id = kvmppc_mmu_hpte_cache_next(vcpu);
273 struct hpte_cache *pte = &vcpu->arch.hpte_cache[hpte_id];
274
275 dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%lx (0x%llx) -> %lx\n",
276 ((rflags & HPTE_R_PP) == 3) ? '-' : 'w',
277 (rflags & HPTE_R_N) ? '-' : 'x',
278 orig_pte->eaddr, hpteg, va, orig_pte->vpage, hpaddr);
279
280 pte->slot = hpteg + (ret & 7);
281 pte->host_va = va;
282 pte->pte = *orig_pte;
283 pte->pfn = hpaddr >> PAGE_SHIFT;
284 }
285
286 return 0;
287}
288
289static struct kvmppc_sid_map *create_sid_map(struct kvm_vcpu *vcpu, u64 gvsid)
290{
291 struct kvmppc_sid_map *map;
292 struct kvmppc_vcpu_book3s *vcpu_book3s = to_book3s(vcpu);
293 u16 sid_map_mask;
294 static int backwards_map = 0;
295
296 if (vcpu->arch.msr & MSR_PR)
297 gvsid |= VSID_PR;
298
299 /* We might get collisions that trap in preceding order, so let's
300 map them differently */
301
302 sid_map_mask = kvmppc_sid_hash(vcpu, gvsid);
303 if (backwards_map)
304 sid_map_mask = SID_MAP_MASK - sid_map_mask;
305
306 map = &to_book3s(vcpu)->sid_map[sid_map_mask];
307
308 /* Make sure we're taking the other map next time */
309 backwards_map = !backwards_map;
310
311 /* Uh-oh ... out of mappings. Let's flush! */
312 if (vcpu_book3s->vsid_next == vcpu_book3s->vsid_max) {
313 vcpu_book3s->vsid_next = vcpu_book3s->vsid_first;
314 memset(vcpu_book3s->sid_map, 0,
315 sizeof(struct kvmppc_sid_map) * SID_MAP_NUM);
316 kvmppc_mmu_pte_flush(vcpu, 0, 0);
317 kvmppc_mmu_flush_segments(vcpu);
318 }
319 map->host_vsid = vcpu_book3s->vsid_next++;
320
321 map->guest_vsid = gvsid;
322 map->valid = true;
323
324 return map;
325}
326
327static int kvmppc_mmu_next_segment(struct kvm_vcpu *vcpu, ulong esid)
328{
329 int i;
330 int max_slb_size = 64;
331 int found_inval = -1;
332 int r;
333
334 if (!get_paca()->kvm_slb_max)
335 get_paca()->kvm_slb_max = 1;
336
337 /* Are we overwriting? */
338 for (i = 1; i < get_paca()->kvm_slb_max; i++) {
339 if (!(get_paca()->kvm_slb[i].esid & SLB_ESID_V))
340 found_inval = i;
341 else if ((get_paca()->kvm_slb[i].esid & ESID_MASK) == esid)
342 return i;
343 }
344
345 /* Found a spare entry that was invalidated before */
346 if (found_inval > 0)
347 return found_inval;
348
349 /* No spare invalid entry, so create one */
350
351 if (mmu_slb_size < 64)
352 max_slb_size = mmu_slb_size;
353
354 /* Overflowing -> purge */
355 if ((get_paca()->kvm_slb_max) == max_slb_size)
356 kvmppc_mmu_flush_segments(vcpu);
357
358 r = get_paca()->kvm_slb_max;
359 get_paca()->kvm_slb_max++;
360
361 return r;
362}
363
364int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr)
365{
366 u64 esid = eaddr >> SID_SHIFT;
367 u64 slb_esid = (eaddr & ESID_MASK) | SLB_ESID_V;
368 u64 slb_vsid = SLB_VSID_USER;
369 u64 gvsid;
370 int slb_index;
371 struct kvmppc_sid_map *map;
372
373 slb_index = kvmppc_mmu_next_segment(vcpu, eaddr & ESID_MASK);
374
375 if (vcpu->arch.mmu.esid_to_vsid(vcpu, esid, &gvsid)) {
376 /* Invalidate an entry */
377 get_paca()->kvm_slb[slb_index].esid = 0;
378 return -ENOENT;
379 }
380
381 map = find_sid_vsid(vcpu, gvsid);
382 if (!map)
383 map = create_sid_map(vcpu, gvsid);
384
385 map->guest_esid = esid;
386
387 slb_vsid |= (map->host_vsid << 12);
388 slb_vsid &= ~SLB_VSID_KP;
389 slb_esid |= slb_index;
390
391 get_paca()->kvm_slb[slb_index].esid = slb_esid;
392 get_paca()->kvm_slb[slb_index].vsid = slb_vsid;
393
394 dprintk_slb("slbmte %#llx, %#llx\n", slb_vsid, slb_esid);
395
396 return 0;
397}
398
399void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu)
400{
401 get_paca()->kvm_slb_max = 1;
402 get_paca()->kvm_slb[0].esid = 0;
403}
404
405void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu)
406{
407 kvmppc_mmu_pte_flush(vcpu, 0, 0);
408}
diff --git a/arch/powerpc/kvm/book3s_64_rmhandlers.S b/arch/powerpc/kvm/book3s_64_rmhandlers.S
new file mode 100644
index 000000000000..fb7dd2e9ac88
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_64_rmhandlers.S
@@ -0,0 +1,131 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#include <asm/ppc_asm.h>
21#include <asm/kvm_asm.h>
22#include <asm/reg.h>
23#include <asm/page.h>
24#include <asm/asm-offsets.h>
25#include <asm/exception-64s.h>
26
27/*****************************************************************************
28 * *
29 * Real Mode handlers that need to be in low physical memory *
30 * *
31 ****************************************************************************/
32
33
34.macro INTERRUPT_TRAMPOLINE intno
35
36.global kvmppc_trampoline_\intno
37kvmppc_trampoline_\intno:
38
39 mtspr SPRN_SPRG_SCRATCH0, r13 /* Save r13 */
40
41 /*
42 * First thing to do is to find out if we're coming
43 * from a KVM guest or a Linux process.
44 *
45 * To distinguish, we check a magic byte in the PACA
46 */
47 mfspr r13, SPRN_SPRG_PACA /* r13 = PACA */
48 std r12, (PACA_EXMC + EX_R12)(r13)
49 mfcr r12
50 stw r12, (PACA_EXMC + EX_CCR)(r13)
51 lbz r12, PACA_KVM_IN_GUEST(r13)
52 cmpwi r12, 0
53 bne ..kvmppc_handler_hasmagic_\intno
54 /* No KVM guest? Then jump back to the Linux handler! */
55 lwz r12, (PACA_EXMC + EX_CCR)(r13)
56 mtcr r12
57 ld r12, (PACA_EXMC + EX_R12)(r13)
58 mfspr r13, SPRN_SPRG_SCRATCH0 /* r13 = original r13 */
59 b kvmppc_resume_\intno /* Get back original handler */
60
61 /* Now we know we're handling a KVM guest */
62..kvmppc_handler_hasmagic_\intno:
63 /* Unset guest state */
64 li r12, 0
65 stb r12, PACA_KVM_IN_GUEST(r13)
66
67 std r1, (PACA_EXMC+EX_R9)(r13)
68 std r10, (PACA_EXMC+EX_R10)(r13)
69 std r11, (PACA_EXMC+EX_R11)(r13)
70 std r2, (PACA_EXMC+EX_R13)(r13)
71
72 mfsrr0 r10
73 mfsrr1 r11
74
75 /* Restore R1/R2 so we can handle faults */
76 ld r1, PACAR1(r13)
77 ld r2, (PACA_EXMC+EX_SRR0)(r13)
78
79 /* Let's store which interrupt we're handling */
80 li r12, \intno
81
82 /* Jump into the SLB exit code that goes to the highmem handler */
83 b kvmppc_handler_trampoline_exit
84
85.endm
86
87INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_SYSTEM_RESET
88INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_MACHINE_CHECK
89INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_DATA_STORAGE
90INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_DATA_SEGMENT
91INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_INST_STORAGE
92INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_INST_SEGMENT
93INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_EXTERNAL
94INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_ALIGNMENT
95INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_PROGRAM
96INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_FP_UNAVAIL
97INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_DECREMENTER
98INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_SYSCALL
99INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_TRACE
100INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_PERFMON
101INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_ALTIVEC
102INTERRUPT_TRAMPOLINE BOOK3S_INTERRUPT_VSX
103
104/*
105 * This trampoline brings us back to a real mode handler
106 *
107 * Input Registers:
108 *
109 * R6 = SRR0
110 * R7 = SRR1
111 * LR = real-mode IP
112 *
113 */
114.global kvmppc_handler_lowmem_trampoline
115kvmppc_handler_lowmem_trampoline:
116
117 mtsrr0 r6
118 mtsrr1 r7
119 blr
120kvmppc_handler_lowmem_trampoline_end:
121
122.global kvmppc_trampoline_lowmem
123kvmppc_trampoline_lowmem:
124 .long kvmppc_handler_lowmem_trampoline - _stext
125
126.global kvmppc_trampoline_enter
127kvmppc_trampoline_enter:
128 .long kvmppc_handler_trampoline_enter - _stext
129
130#include "book3s_64_slb.S"
131
diff --git a/arch/powerpc/kvm/book3s_64_slb.S b/arch/powerpc/kvm/book3s_64_slb.S
new file mode 100644
index 000000000000..ecd237a03fd0
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_64_slb.S
@@ -0,0 +1,262 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License, version 2, as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * You should have received a copy of the GNU General Public License
12 * along with this program; if not, write to the Free Software
13 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
14 *
15 * Copyright SUSE Linux Products GmbH 2009
16 *
17 * Authors: Alexander Graf <agraf@suse.de>
18 */
19
20#define SHADOW_SLB_ESID(num) (SLBSHADOW_SAVEAREA + (num * 0x10))
21#define SHADOW_SLB_VSID(num) (SLBSHADOW_SAVEAREA + (num * 0x10) + 0x8)
22#define UNBOLT_SLB_ENTRY(num) \
23 ld r9, SHADOW_SLB_ESID(num)(r12); \
24 /* Invalid? Skip. */; \
25 rldicl. r0, r9, 37, 63; \
26 beq slb_entry_skip_ ## num; \
27 xoris r9, r9, SLB_ESID_V@h; \
28 std r9, SHADOW_SLB_ESID(num)(r12); \
29 slb_entry_skip_ ## num:
30
31#define REBOLT_SLB_ENTRY(num) \
32 ld r10, SHADOW_SLB_ESID(num)(r11); \
33 cmpdi r10, 0; \
34 beq slb_exit_skip_1; \
35 oris r10, r10, SLB_ESID_V@h; \
36 ld r9, SHADOW_SLB_VSID(num)(r11); \
37 slbmte r9, r10; \
38 std r10, SHADOW_SLB_ESID(num)(r11); \
39slb_exit_skip_ ## num:
40
41/******************************************************************************
42 * *
43 * Entry code *
44 * *
45 *****************************************************************************/
46
47.global kvmppc_handler_trampoline_enter
48kvmppc_handler_trampoline_enter:
49
50 /* Required state:
51 *
52 * MSR = ~IR|DR
53 * R13 = PACA
54 * R9 = guest IP
55 * R10 = guest MSR
56 * R11 = free
57 * R12 = free
58 * PACA[PACA_EXMC + EX_R9] = guest R9
59 * PACA[PACA_EXMC + EX_R10] = guest R10
60 * PACA[PACA_EXMC + EX_R11] = guest R11
61 * PACA[PACA_EXMC + EX_R12] = guest R12
62 * PACA[PACA_EXMC + EX_R13] = guest R13
63 * PACA[PACA_EXMC + EX_CCR] = guest CR
64 * PACA[PACA_EXMC + EX_R3] = guest XER
65 */
66
67 mtsrr0 r9
68 mtsrr1 r10
69
70 mtspr SPRN_SPRG_SCRATCH0, r0
71
72 /* Remove LPAR shadow entries */
73
74#if SLB_NUM_BOLTED == 3
75
76 ld r12, PACA_SLBSHADOWPTR(r13)
77
78 /* Save off the first entry so we can slbie it later */
79 ld r10, SHADOW_SLB_ESID(0)(r12)
80 ld r11, SHADOW_SLB_VSID(0)(r12)
81
82 /* Remove bolted entries */
83 UNBOLT_SLB_ENTRY(0)
84 UNBOLT_SLB_ENTRY(1)
85 UNBOLT_SLB_ENTRY(2)
86
87#else
88#error unknown number of bolted entries
89#endif
90
91 /* Flush SLB */
92
93 slbia
94
95 /* r0 = esid & ESID_MASK */
96 rldicr r10, r10, 0, 35
97 /* r0 |= CLASS_BIT(VSID) */
98 rldic r12, r11, 56 - 36, 36
99 or r10, r10, r12
100 slbie r10
101
102 isync
103
104 /* Fill SLB with our shadow */
105
106 lbz r12, PACA_KVM_SLB_MAX(r13)
107 mulli r12, r12, 16
108 addi r12, r12, PACA_KVM_SLB
109 add r12, r12, r13
110
111 /* for (r11 = kvm_slb; r11 < kvm_slb + kvm_slb_size; r11+=slb_entry) */
112 li r11, PACA_KVM_SLB
113 add r11, r11, r13
114
115slb_loop_enter:
116
117 ld r10, 0(r11)
118
119 rldicl. r0, r10, 37, 63
120 beq slb_loop_enter_skip
121
122 ld r9, 8(r11)
123 slbmte r9, r10
124
125slb_loop_enter_skip:
126 addi r11, r11, 16
127 cmpd cr0, r11, r12
128 blt slb_loop_enter
129
130slb_do_enter:
131
132 /* Enter guest */
133
134 mfspr r0, SPRN_SPRG_SCRATCH0
135
136 ld r9, (PACA_EXMC+EX_R9)(r13)
137 ld r10, (PACA_EXMC+EX_R10)(r13)
138 ld r12, (PACA_EXMC+EX_R12)(r13)
139
140 lwz r11, (PACA_EXMC+EX_CCR)(r13)
141 mtcr r11
142
143 ld r11, (PACA_EXMC+EX_R3)(r13)
144 mtxer r11
145
146 ld r11, (PACA_EXMC+EX_R11)(r13)
147 ld r13, (PACA_EXMC+EX_R13)(r13)
148
149 RFI
150kvmppc_handler_trampoline_enter_end:
151
152
153
154/******************************************************************************
155 * *
156 * Exit code *
157 * *
158 *****************************************************************************/
159
160.global kvmppc_handler_trampoline_exit
161kvmppc_handler_trampoline_exit:
162
163 /* Register usage at this point:
164 *
165 * SPRG_SCRATCH0 = guest R13
166 * R01 = host R1
167 * R02 = host R2
168 * R10 = guest PC
169 * R11 = guest MSR
170 * R12 = exit handler id
171 * R13 = PACA
172 * PACA.exmc.CCR = guest CR
173 * PACA.exmc.R9 = guest R1
174 * PACA.exmc.R10 = guest R10
175 * PACA.exmc.R11 = guest R11
176 * PACA.exmc.R12 = guest R12
177 * PACA.exmc.R13 = guest R2
178 *
179 */
180
181 /* Save registers */
182
183 std r0, (PACA_EXMC+EX_SRR0)(r13)
184 std r9, (PACA_EXMC+EX_R3)(r13)
185 std r10, (PACA_EXMC+EX_LR)(r13)
186 std r11, (PACA_EXMC+EX_DAR)(r13)
187
188 /*
189 * In order for us to easily get the last instruction,
190 * we got the #vmexit at, we exploit the fact that the
191 * virtual layout is still the same here, so we can just
192 * ld from the guest's PC address
193 */
194
195 /* We only load the last instruction when it's safe */
196 cmpwi r12, BOOK3S_INTERRUPT_DATA_STORAGE
197 beq ld_last_inst
198 cmpwi r12, BOOK3S_INTERRUPT_PROGRAM
199 beq ld_last_inst
200
201 b no_ld_last_inst
202
203ld_last_inst:
204 /* Save off the guest instruction we're at */
205 /* 1) enable paging for data */
206 mfmsr r9
207 ori r11, r9, MSR_DR /* Enable paging for data */
208 mtmsr r11
209 /* 2) fetch the instruction */
210 lwz r0, 0(r10)
211 /* 3) disable paging again */
212 mtmsr r9
213
214no_ld_last_inst:
215
216 /* Restore bolted entries from the shadow and fix it along the way */
217
218 /* We don't store anything in entry 0, so we don't need to take care of it */
219 slbia
220 isync
221
222#if SLB_NUM_BOLTED == 3
223
224 ld r11, PACA_SLBSHADOWPTR(r13)
225
226 REBOLT_SLB_ENTRY(0)
227 REBOLT_SLB_ENTRY(1)
228 REBOLT_SLB_ENTRY(2)
229
230#else
231#error unknown number of bolted entries
232#endif
233
234slb_do_exit:
235
236 /* Restore registers */
237
238 ld r11, (PACA_EXMC+EX_DAR)(r13)
239 ld r10, (PACA_EXMC+EX_LR)(r13)
240 ld r9, (PACA_EXMC+EX_R3)(r13)
241
242 /* Save last inst */
243 stw r0, (PACA_EXMC+EX_LR)(r13)
244
245 /* Save DAR and DSISR before going to paged mode */
246 mfdar r0
247 std r0, (PACA_EXMC+EX_DAR)(r13)
248 mfdsisr r0
249 stw r0, (PACA_EXMC+EX_DSISR)(r13)
250
251 /* RFI into the highmem handler */
252 mfmsr r0
253 ori r0, r0, MSR_IR|MSR_DR|MSR_RI /* Enable paging */
254 mtsrr1 r0
255 ld r0, PACASAVEDMSR(r13) /* Highmem handler address */
256 mtsrr0 r0
257
258 mfspr r0, SPRN_SPRG_SCRATCH0
259
260 RFI
261kvmppc_handler_trampoline_exit_end:
262
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index e7bf4d029484..06f5a9ecc42c 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -520,6 +520,11 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
520 return kvmppc_core_vcpu_translate(vcpu, tr); 520 return kvmppc_core_vcpu_translate(vcpu, tr);
521} 521}
522 522
523int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
524{
525 return -ENOTSUPP;
526}
527
523int __init kvmppc_booke_init(void) 528int __init kvmppc_booke_init(void)
524{ 529{
525 unsigned long ivor[16]; 530 unsigned long ivor[16];
diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
index 7737146af3fb..4a9ac6640fad 100644
--- a/arch/powerpc/kvm/emulate.c
+++ b/arch/powerpc/kvm/emulate.c
@@ -18,7 +18,7 @@
18 */ 18 */
19 19
20#include <linux/jiffies.h> 20#include <linux/jiffies.h>
21#include <linux/timer.h> 21#include <linux/hrtimer.h>
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/string.h> 23#include <linux/string.h>
24#include <linux/kvm_host.h> 24#include <linux/kvm_host.h>
@@ -32,6 +32,7 @@
32#include "trace.h" 32#include "trace.h"
33 33
34#define OP_TRAP 3 34#define OP_TRAP 3
35#define OP_TRAP_64 2
35 36
36#define OP_31_XOP_LWZX 23 37#define OP_31_XOP_LWZX 23
37#define OP_31_XOP_LBZX 87 38#define OP_31_XOP_LBZX 87
@@ -64,19 +65,45 @@
64#define OP_STH 44 65#define OP_STH 44
65#define OP_STHU 45 66#define OP_STHU 45
66 67
68#ifdef CONFIG_PPC64
69static int kvmppc_dec_enabled(struct kvm_vcpu *vcpu)
70{
71 return 1;
72}
73#else
74static int kvmppc_dec_enabled(struct kvm_vcpu *vcpu)
75{
76 return vcpu->arch.tcr & TCR_DIE;
77}
78#endif
79
67void kvmppc_emulate_dec(struct kvm_vcpu *vcpu) 80void kvmppc_emulate_dec(struct kvm_vcpu *vcpu)
68{ 81{
69 if (vcpu->arch.tcr & TCR_DIE) { 82 unsigned long dec_nsec;
83
84 pr_debug("mtDEC: %x\n", vcpu->arch.dec);
85#ifdef CONFIG_PPC64
86 /* POWER4+ triggers a dec interrupt if the value is < 0 */
87 if (vcpu->arch.dec & 0x80000000) {
88 hrtimer_try_to_cancel(&vcpu->arch.dec_timer);
89 kvmppc_core_queue_dec(vcpu);
90 return;
91 }
92#endif
93 if (kvmppc_dec_enabled(vcpu)) {
70 /* The decrementer ticks at the same rate as the timebase, so 94 /* The decrementer ticks at the same rate as the timebase, so
71 * that's how we convert the guest DEC value to the number of 95 * that's how we convert the guest DEC value to the number of
72 * host ticks. */ 96 * host ticks. */
73 unsigned long nr_jiffies;
74 97
75 nr_jiffies = vcpu->arch.dec / tb_ticks_per_jiffy; 98 hrtimer_try_to_cancel(&vcpu->arch.dec_timer);
76 mod_timer(&vcpu->arch.dec_timer, 99 dec_nsec = vcpu->arch.dec;
77 get_jiffies_64() + nr_jiffies); 100 dec_nsec *= 1000;
101 dec_nsec /= tb_ticks_per_usec;
102 hrtimer_start(&vcpu->arch.dec_timer, ktime_set(0, dec_nsec),
103 HRTIMER_MODE_REL);
104 vcpu->arch.dec_jiffies = get_tb();
78 } else { 105 } else {
79 del_timer(&vcpu->arch.dec_timer); 106 hrtimer_try_to_cancel(&vcpu->arch.dec_timer);
80 } 107 }
81} 108}
82 109
@@ -111,9 +138,15 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
111 /* this default type might be overwritten by subcategories */ 138 /* this default type might be overwritten by subcategories */
112 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS); 139 kvmppc_set_exit_type(vcpu, EMULATED_INST_EXITS);
113 140
141 pr_debug(KERN_INFO "Emulating opcode %d / %d\n", get_op(inst), get_xop(inst));
142
114 switch (get_op(inst)) { 143 switch (get_op(inst)) {
115 case OP_TRAP: 144 case OP_TRAP:
145#ifdef CONFIG_PPC64
146 case OP_TRAP_64:
147#else
116 vcpu->arch.esr |= ESR_PTR; 148 vcpu->arch.esr |= ESR_PTR;
149#endif
117 kvmppc_core_queue_program(vcpu); 150 kvmppc_core_queue_program(vcpu);
118 advance = 0; 151 advance = 0;
119 break; 152 break;
@@ -188,17 +221,19 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
188 case SPRN_SRR1: 221 case SPRN_SRR1:
189 vcpu->arch.gpr[rt] = vcpu->arch.srr1; break; 222 vcpu->arch.gpr[rt] = vcpu->arch.srr1; break;
190 case SPRN_PVR: 223 case SPRN_PVR:
191 vcpu->arch.gpr[rt] = mfspr(SPRN_PVR); break; 224 vcpu->arch.gpr[rt] = vcpu->arch.pvr; break;
192 case SPRN_PIR: 225 case SPRN_PIR:
193 vcpu->arch.gpr[rt] = mfspr(SPRN_PIR); break; 226 vcpu->arch.gpr[rt] = vcpu->vcpu_id; break;
227 case SPRN_MSSSR0:
228 vcpu->arch.gpr[rt] = 0; break;
194 229
195 /* Note: mftb and TBRL/TBWL are user-accessible, so 230 /* Note: mftb and TBRL/TBWL are user-accessible, so
196 * the guest can always access the real TB anyways. 231 * the guest can always access the real TB anyways.
197 * In fact, we probably will never see these traps. */ 232 * In fact, we probably will never see these traps. */
198 case SPRN_TBWL: 233 case SPRN_TBWL:
199 vcpu->arch.gpr[rt] = mftbl(); break; 234 vcpu->arch.gpr[rt] = get_tb() >> 32; break;
200 case SPRN_TBWU: 235 case SPRN_TBWU:
201 vcpu->arch.gpr[rt] = mftbu(); break; 236 vcpu->arch.gpr[rt] = get_tb(); break;
202 237
203 case SPRN_SPRG0: 238 case SPRN_SPRG0:
204 vcpu->arch.gpr[rt] = vcpu->arch.sprg0; break; 239 vcpu->arch.gpr[rt] = vcpu->arch.sprg0; break;
@@ -211,6 +246,13 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
211 /* Note: SPRG4-7 are user-readable, so we don't get 246 /* Note: SPRG4-7 are user-readable, so we don't get
212 * a trap. */ 247 * a trap. */
213 248
249 case SPRN_DEC:
250 {
251 u64 jd = get_tb() - vcpu->arch.dec_jiffies;
252 vcpu->arch.gpr[rt] = vcpu->arch.dec - jd;
253 pr_debug(KERN_INFO "mfDEC: %x - %llx = %lx\n", vcpu->arch.dec, jd, vcpu->arch.gpr[rt]);
254 break;
255 }
214 default: 256 default:
215 emulated = kvmppc_core_emulate_mfspr(vcpu, sprn, rt); 257 emulated = kvmppc_core_emulate_mfspr(vcpu, sprn, rt);
216 if (emulated == EMULATE_FAIL) { 258 if (emulated == EMULATE_FAIL) {
@@ -260,6 +302,8 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
260 case SPRN_TBWL: break; 302 case SPRN_TBWL: break;
261 case SPRN_TBWU: break; 303 case SPRN_TBWU: break;
262 304
305 case SPRN_MSSSR0: break;
306
263 case SPRN_DEC: 307 case SPRN_DEC:
264 vcpu->arch.dec = vcpu->arch.gpr[rs]; 308 vcpu->arch.dec = vcpu->arch.gpr[rs];
265 kvmppc_emulate_dec(vcpu); 309 kvmppc_emulate_dec(vcpu);
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 5902bbc2411e..f06cf93b178e 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -23,6 +23,7 @@
23#include <linux/kvm_host.h> 23#include <linux/kvm_host.h>
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/vmalloc.h> 25#include <linux/vmalloc.h>
26#include <linux/hrtimer.h>
26#include <linux/fs.h> 27#include <linux/fs.h>
27#include <asm/cputable.h> 28#include <asm/cputable.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
@@ -144,6 +145,9 @@ int kvm_dev_ioctl_check_extension(long ext)
144 int r; 145 int r;
145 146
146 switch (ext) { 147 switch (ext) {
148 case KVM_CAP_PPC_SEGSTATE:
149 r = 1;
150 break;
147 case KVM_CAP_COALESCED_MMIO: 151 case KVM_CAP_COALESCED_MMIO:
148 r = KVM_COALESCED_MMIO_PAGE_OFFSET; 152 r = KVM_COALESCED_MMIO_PAGE_OFFSET;
149 break; 153 break;
@@ -209,10 +213,25 @@ static void kvmppc_decrementer_func(unsigned long data)
209 } 213 }
210} 214}
211 215
216/*
217 * low level hrtimer wake routine. Because this runs in hardirq context
218 * we schedule a tasklet to do the real work.
219 */
220enum hrtimer_restart kvmppc_decrementer_wakeup(struct hrtimer *timer)
221{
222 struct kvm_vcpu *vcpu;
223
224 vcpu = container_of(timer, struct kvm_vcpu, arch.dec_timer);
225 tasklet_schedule(&vcpu->arch.tasklet);
226
227 return HRTIMER_NORESTART;
228}
229
212int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) 230int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
213{ 231{
214 setup_timer(&vcpu->arch.dec_timer, kvmppc_decrementer_func, 232 hrtimer_init(&vcpu->arch.dec_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
215 (unsigned long)vcpu); 233 tasklet_init(&vcpu->arch.tasklet, kvmppc_decrementer_func, (ulong)vcpu);
234 vcpu->arch.dec_timer.function = kvmppc_decrementer_wakeup;
216 235
217 return 0; 236 return 0;
218} 237}
@@ -410,11 +429,6 @@ out:
410 return r; 429 return r;
411} 430}
412 431
413int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log)
414{
415 return -ENOTSUPP;
416}
417
418long kvm_arch_vm_ioctl(struct file *filp, 432long kvm_arch_vm_ioctl(struct file *filp,
419 unsigned int ioctl, unsigned long arg) 433 unsigned int ioctl, unsigned long arg)
420{ 434{
diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
index 2aa371e30079..70378551c0cc 100644
--- a/arch/powerpc/kvm/timing.c
+++ b/arch/powerpc/kvm/timing.c
@@ -23,6 +23,7 @@
23#include <linux/seq_file.h> 23#include <linux/seq_file.h>
24#include <linux/debugfs.h> 24#include <linux/debugfs.h>
25#include <linux/uaccess.h> 25#include <linux/uaccess.h>
26#include <linux/module.h>
26 27
27#include <asm/time.h> 28#include <asm/time.h>
28#include <asm-generic/div64.h> 29#include <asm-generic/div64.h>
diff --git a/arch/powerpc/kvm/trace.h b/arch/powerpc/kvm/trace.h
index 67f219de0455..a8e840018052 100644
--- a/arch/powerpc/kvm/trace.h
+++ b/arch/powerpc/kvm/trace.h
@@ -12,8 +12,8 @@
12 * Tracepoint for guest mode entry. 12 * Tracepoint for guest mode entry.
13 */ 13 */
14TRACE_EVENT(kvm_ppc_instr, 14TRACE_EVENT(kvm_ppc_instr,
15 TP_PROTO(unsigned int inst, unsigned long pc, unsigned int emulate), 15 TP_PROTO(unsigned int inst, unsigned long _pc, unsigned int emulate),
16 TP_ARGS(inst, pc, emulate), 16 TP_ARGS(inst, _pc, emulate),
17 17
18 TP_STRUCT__entry( 18 TP_STRUCT__entry(
19 __field( unsigned int, inst ) 19 __field( unsigned int, inst )
@@ -23,7 +23,7 @@ TRACE_EVENT(kvm_ppc_instr,
23 23
24 TP_fast_assign( 24 TP_fast_assign(
25 __entry->inst = inst; 25 __entry->inst = inst;
26 __entry->pc = pc; 26 __entry->pc = _pc;
27 __entry->emulate = emulate; 27 __entry->emulate = emulate;
28 ), 28 ),
29 29
diff --git a/arch/powerpc/lib/copy_32.S b/arch/powerpc/lib/copy_32.S
index c657de59abca..74a7f4130b4c 100644
--- a/arch/powerpc/lib/copy_32.S
+++ b/arch/powerpc/lib/copy_32.S
@@ -98,20 +98,7 @@ _GLOBAL(cacheable_memzero)
98 bdnz 4b 98 bdnz 4b
993: mtctr r9 993: mtctr r9
100 li r7,4 100 li r7,4
101#if !defined(CONFIG_8xx)
10210: dcbz r7,r6 10110: dcbz r7,r6
103#else
10410: stw r4, 4(r6)
105 stw r4, 8(r6)
106 stw r4, 12(r6)
107 stw r4, 16(r6)
108#if CACHE_LINE_SIZE >= 32
109 stw r4, 20(r6)
110 stw r4, 24(r6)
111 stw r4, 28(r6)
112 stw r4, 32(r6)
113#endif /* CACHE_LINE_SIZE */
114#endif
115 addi r6,r6,CACHELINE_BYTES 102 addi r6,r6,CACHELINE_BYTES
116 bdnz 10b 103 bdnz 10b
117 clrlwi r5,r8,32-LG_CACHELINE_BYTES 104 clrlwi r5,r8,32-LG_CACHELINE_BYTES
@@ -200,9 +187,7 @@ _GLOBAL(cacheable_memcpy)
200 mtctr r0 187 mtctr r0
201 beq 63f 188 beq 63f
20253: 18953:
203#if !defined(CONFIG_8xx)
204 dcbz r11,r6 190 dcbz r11,r6
205#endif
206 COPY_16_BYTES 191 COPY_16_BYTES
207#if L1_CACHE_BYTES >= 32 192#if L1_CACHE_BYTES >= 32
208 COPY_16_BYTES 193 COPY_16_BYTES
@@ -356,14 +341,6 @@ _GLOBAL(__copy_tofrom_user)
356 li r11,4 341 li r11,4
357 beq 63f 342 beq 63f
358 343
359#ifdef CONFIG_8xx
360 /* Don't use prefetch on 8xx */
361 mtctr r0
362 li r0,0
36353: COPY_16_BYTES_WITHEX(0)
364 bdnz 53b
365
366#else /* not CONFIG_8xx */
367 /* Here we decide how far ahead to prefetch the source */ 344 /* Here we decide how far ahead to prefetch the source */
368 li r3,4 345 li r3,4
369 cmpwi r0,1 346 cmpwi r0,1
@@ -416,7 +393,6 @@ _GLOBAL(__copy_tofrom_user)
416 li r3,4 393 li r3,4
417 li r7,0 394 li r7,0
418 bne 114b 395 bne 114b
419#endif /* CONFIG_8xx */
420 396
42163: srwi. r0,r5,2 39763: srwi. r0,r5,2
422 mtctr r0 398 mtctr r0
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index 6fb8fc8d2fea..ce68708bbad5 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -28,7 +28,10 @@ obj-$(CONFIG_44x) += 44x_mmu.o
28obj-$(CONFIG_FSL_BOOKE) += fsl_booke_mmu.o 28obj-$(CONFIG_FSL_BOOKE) += fsl_booke_mmu.o
29obj-$(CONFIG_NEED_MULTIPLE_NODES) += numa.o 29obj-$(CONFIG_NEED_MULTIPLE_NODES) += numa.o
30obj-$(CONFIG_PPC_MM_SLICES) += slice.o 30obj-$(CONFIG_PPC_MM_SLICES) += slice.o
31obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 31ifeq ($(CONFIG_HUGETLB_PAGE),y)
32obj-y += hugetlbpage.o
33obj-$(CONFIG_PPC_STD_MMU_64) += hugetlbpage-hash64.o
34endif
32obj-$(CONFIG_PPC_SUBPAGE_PROT) += subpage-prot.o 35obj-$(CONFIG_PPC_SUBPAGE_PROT) += subpage-prot.o
33obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o 36obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-noncoherent.o
34obj-$(CONFIG_HIGHMEM) += highmem.o 37obj-$(CONFIG_HIGHMEM) += highmem.o
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index e7dae82c1285..26fb6b990b0a 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -40,7 +40,7 @@
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <asm/tlbflush.h> 41#include <asm/tlbflush.h>
42#include <asm/siginfo.h> 42#include <asm/siginfo.h>
43 43#include <mm/mmu_decl.h>
44 44
45#ifdef CONFIG_KPROBES 45#ifdef CONFIG_KPROBES
46static inline int notify_page_fault(struct pt_regs *regs) 46static inline int notify_page_fault(struct pt_regs *regs)
@@ -246,6 +246,12 @@ good_area:
246 goto bad_area; 246 goto bad_area;
247#endif /* CONFIG_6xx */ 247#endif /* CONFIG_6xx */
248#if defined(CONFIG_8xx) 248#if defined(CONFIG_8xx)
249 /* 8xx sometimes need to load a invalid/non-present TLBs.
250 * These must be invalidated separately as linux mm don't.
251 */
252 if (error_code & 0x40000000) /* no translation? */
253 _tlbil_va(address, 0, 0, 0);
254
249 /* The MPC8xx seems to always set 0x80000000, which is 255 /* The MPC8xx seems to always set 0x80000000, which is
250 * "undefined". Of those that can be set, this is the only 256 * "undefined". Of those that can be set, this is the only
251 * one which seems bad. 257 * one which seems bad.
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index dc93e95b256e..fcfcb6e976c7 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -54,26 +54,35 @@
54 54
55#include "mmu_decl.h" 55#include "mmu_decl.h"
56 56
57extern void loadcam_entry(unsigned int index);
58unsigned int tlbcam_index; 57unsigned int tlbcam_index;
59static unsigned long cam[CONFIG_LOWMEM_CAM_NUM];
60 58
61#define NUM_TLBCAMS (16) 59#define NUM_TLBCAMS (64)
62 60
63#if defined(CONFIG_LOWMEM_CAM_NUM_BOOL) && (CONFIG_LOWMEM_CAM_NUM >= NUM_TLBCAMS) 61#if defined(CONFIG_LOWMEM_CAM_NUM_BOOL) && (CONFIG_LOWMEM_CAM_NUM >= NUM_TLBCAMS)
64#error "LOWMEM_CAM_NUM must be less than NUM_TLBCAMS" 62#error "LOWMEM_CAM_NUM must be less than NUM_TLBCAMS"
65#endif 63#endif
66 64
67struct tlbcam TLBCAM[NUM_TLBCAMS]; 65struct tlbcam {
66 u32 MAS0;
67 u32 MAS1;
68 unsigned long MAS2;
69 u32 MAS3;
70 u32 MAS7;
71} TLBCAM[NUM_TLBCAMS];
68 72
69struct tlbcamrange { 73struct tlbcamrange {
70 unsigned long start; 74 unsigned long start;
71 unsigned long limit; 75 unsigned long limit;
72 phys_addr_t phys; 76 phys_addr_t phys;
73} tlbcam_addrs[NUM_TLBCAMS]; 77} tlbcam_addrs[NUM_TLBCAMS];
74 78
75extern unsigned int tlbcam_index; 79extern unsigned int tlbcam_index;
76 80
81unsigned long tlbcam_sz(int idx)
82{
83 return tlbcam_addrs[idx].limit - tlbcam_addrs[idx].start + 1;
84}
85
77/* 86/*
78 * Return PA for this VA if it is mapped by a CAM, or 0 87 * Return PA for this VA if it is mapped by a CAM, or 0
79 */ 88 */
@@ -94,23 +103,36 @@ unsigned long p_mapped_by_tlbcam(phys_addr_t pa)
94 int b; 103 int b;
95 for (b = 0; b < tlbcam_index; ++b) 104 for (b = 0; b < tlbcam_index; ++b)
96 if (pa >= tlbcam_addrs[b].phys 105 if (pa >= tlbcam_addrs[b].phys
97 && pa < (tlbcam_addrs[b].limit-tlbcam_addrs[b].start) 106 && pa < (tlbcam_addrs[b].limit-tlbcam_addrs[b].start)
98 +tlbcam_addrs[b].phys) 107 +tlbcam_addrs[b].phys)
99 return tlbcam_addrs[b].start+(pa-tlbcam_addrs[b].phys); 108 return tlbcam_addrs[b].start+(pa-tlbcam_addrs[b].phys);
100 return 0; 109 return 0;
101} 110}
102 111
112void loadcam_entry(int idx)
113{
114 mtspr(SPRN_MAS0, TLBCAM[idx].MAS0);
115 mtspr(SPRN_MAS1, TLBCAM[idx].MAS1);
116 mtspr(SPRN_MAS2, TLBCAM[idx].MAS2);
117 mtspr(SPRN_MAS3, TLBCAM[idx].MAS3);
118
119 if (cur_cpu_spec->cpu_features & MMU_FTR_BIG_PHYS)
120 mtspr(SPRN_MAS7, TLBCAM[idx].MAS7);
121
122 asm volatile("isync;tlbwe;isync" : : : "memory");
123}
124
103/* 125/*
104 * Set up one of the I/D BAT (block address translation) register pairs. 126 * Set up one of the I/D BAT (block address translation) register pairs.
105 * The parameters are not checked; in particular size must be a power 127 * The parameters are not checked; in particular size must be a power
106 * of 4 between 4k and 256M. 128 * of 4 between 4k and 256M.
107 */ 129 */
108void settlbcam(int index, unsigned long virt, phys_addr_t phys, 130static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
109 unsigned int size, int flags, unsigned int pid) 131 unsigned long size, unsigned long flags, unsigned int pid)
110{ 132{
111 unsigned int tsize, lz; 133 unsigned int tsize, lz;
112 134
113 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (size)); 135 asm (PPC_CNTLZL "%0,%1" : "=r" (lz) : "r" (size));
114 tsize = 21 - lz; 136 tsize = 21 - lz;
115 137
116#ifdef CONFIG_SMP 138#ifdef CONFIG_SMP
@@ -128,8 +150,10 @@ void settlbcam(int index, unsigned long virt, phys_addr_t phys,
128 TLBCAM[index].MAS2 |= (flags & _PAGE_GUARDED) ? MAS2_G : 0; 150 TLBCAM[index].MAS2 |= (flags & _PAGE_GUARDED) ? MAS2_G : 0;
129 TLBCAM[index].MAS2 |= (flags & _PAGE_ENDIAN) ? MAS2_E : 0; 151 TLBCAM[index].MAS2 |= (flags & _PAGE_ENDIAN) ? MAS2_E : 0;
130 152
131 TLBCAM[index].MAS3 = (phys & PAGE_MASK) | MAS3_SX | MAS3_SR; 153 TLBCAM[index].MAS3 = (phys & MAS3_RPN) | MAS3_SX | MAS3_SR;
132 TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_SW : 0); 154 TLBCAM[index].MAS3 |= ((flags & _PAGE_RW) ? MAS3_SW : 0);
155 if (cur_cpu_spec->cpu_features & MMU_FTR_BIG_PHYS)
156 TLBCAM[index].MAS7 = (u64)phys >> 32;
133 157
134#ifndef CONFIG_KGDB /* want user access for breakpoints */ 158#ifndef CONFIG_KGDB /* want user access for breakpoints */
135 if (flags & _PAGE_USER) { 159 if (flags & _PAGE_USER) {
@@ -148,27 +172,44 @@ void settlbcam(int index, unsigned long virt, phys_addr_t phys,
148 loadcam_entry(index); 172 loadcam_entry(index);
149} 173}
150 174
151void invalidate_tlbcam_entry(int index) 175unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx)
152{
153 TLBCAM[index].MAS0 = MAS0_TLBSEL(1) | MAS0_ESEL(index);
154 TLBCAM[index].MAS1 = ~MAS1_VALID;
155
156 loadcam_entry(index);
157}
158
159unsigned long __init mmu_mapin_ram(void)
160{ 176{
177 int i;
161 unsigned long virt = PAGE_OFFSET; 178 unsigned long virt = PAGE_OFFSET;
162 phys_addr_t phys = memstart_addr; 179 phys_addr_t phys = memstart_addr;
180 unsigned long amount_mapped = 0;
181 unsigned long max_cam = (mfspr(SPRN_TLB1CFG) >> 16) & 0xf;
182
183 /* Convert (4^max) kB to (2^max) bytes */
184 max_cam = max_cam * 2 + 10;
163 185
164 while (tlbcam_index < ARRAY_SIZE(cam) && cam[tlbcam_index]) { 186 /* Calculate CAM values */
165 settlbcam(tlbcam_index, virt, phys, cam[tlbcam_index], PAGE_KERNEL_X, 0); 187 for (i = 0; ram && i < max_cam_idx; i++) {
166 virt += cam[tlbcam_index]; 188 unsigned int camsize = __ilog2(ram) & ~1U;
167 phys += cam[tlbcam_index]; 189 unsigned int align = __ffs(virt | phys) & ~1U;
168 tlbcam_index++; 190 unsigned long cam_sz;
191
192 if (camsize > align)
193 camsize = align;
194 if (camsize > max_cam)
195 camsize = max_cam;
196
197 cam_sz = 1UL << camsize;
198 settlbcam(i, virt, phys, cam_sz, PAGE_KERNEL_X, 0);
199
200 ram -= cam_sz;
201 amount_mapped += cam_sz;
202 virt += cam_sz;
203 phys += cam_sz;
169 } 204 }
205 tlbcam_index = i;
206
207 return amount_mapped;
208}
170 209
171 return virt - PAGE_OFFSET; 210unsigned long __init mmu_mapin_ram(void)
211{
212 return tlbcam_addrs[tlbcam_index - 1].limit - PAGE_OFFSET + 1;
172} 213}
173 214
174/* 215/*
@@ -179,46 +220,21 @@ void __init MMU_init_hw(void)
179 flush_instruction_cache(); 220 flush_instruction_cache();
180} 221}
181 222
182void __init 223void __init adjust_total_lowmem(void)
183adjust_total_lowmem(void)
184{ 224{
185 phys_addr_t ram; 225 unsigned long ram;
186 unsigned int max_cam = (mfspr(SPRN_TLB1CFG) >> 16) & 0xff;
187 char buf[ARRAY_SIZE(cam) * 5 + 1], *p = buf;
188 int i; 226 int i;
189 unsigned long virt = PAGE_OFFSET & 0xffffffffUL;
190 unsigned long phys = memstart_addr & 0xffffffffUL;
191
192 /* Convert (4^max) kB to (2^max) bytes */
193 max_cam = max_cam * 2 + 10;
194 227
195 /* adjust lowmem size to __max_low_memory */ 228 /* adjust lowmem size to __max_low_memory */
196 ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem); 229 ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem);
197 230
198 /* Calculate CAM values */ 231 __max_low_memory = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM);
199 __max_low_memory = 0;
200 for (i = 0; ram && i < ARRAY_SIZE(cam); i++) {
201 unsigned int camsize = __ilog2(ram) & ~1U;
202 unsigned int align = __ffs(virt | phys) & ~1U;
203 232
204 if (camsize > align) 233 pr_info("Memory CAM mapping: ");
205 camsize = align; 234 for (i = 0; i < tlbcam_index - 1; i++)
206 if (camsize > max_cam) 235 pr_cont("%lu/", tlbcam_sz(i) >> 20);
207 camsize = max_cam; 236 pr_cont("%lu Mb, residual: %dMb\n", tlbcam_sz(tlbcam_index - 1) >> 20,
208
209 cam[i] = 1UL << camsize;
210 ram -= cam[i];
211 __max_low_memory += cam[i];
212 virt += cam[i];
213 phys += cam[i];
214
215 p += sprintf(p, "%lu/", cam[i] >> 20);
216 }
217 for (; i < ARRAY_SIZE(cam); i++)
218 p += sprintf(p, "0/");
219 p[-1] = '\0';
220
221 pr_info("Memory CAM mapping: %s Mb, residual: %dMb\n", buf,
222 (unsigned int)((total_lowmem - __max_low_memory) >> 20)); 237 (unsigned int)((total_lowmem - __max_low_memory) >> 20));
238
223 __initial_memory_limit_addr = memstart_addr + __max_low_memory; 239 __initial_memory_limit_addr = memstart_addr + __max_low_memory;
224} 240}
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c
index bc122a120bf0..d7efdbf640c7 100644
--- a/arch/powerpc/mm/gup.c
+++ b/arch/powerpc/mm/gup.c
@@ -55,57 +55,6 @@ static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
55 return 1; 55 return 1;
56} 56}
57 57
58#ifdef CONFIG_HUGETLB_PAGE
59static noinline int gup_huge_pte(pte_t *ptep, struct hstate *hstate,
60 unsigned long *addr, unsigned long end,
61 int write, struct page **pages, int *nr)
62{
63 unsigned long mask;
64 unsigned long pte_end;
65 struct page *head, *page;
66 pte_t pte;
67 int refs;
68
69 pte_end = (*addr + huge_page_size(hstate)) & huge_page_mask(hstate);
70 if (pte_end < end)
71 end = pte_end;
72
73 pte = *ptep;
74 mask = _PAGE_PRESENT|_PAGE_USER;
75 if (write)
76 mask |= _PAGE_RW;
77 if ((pte_val(pte) & mask) != mask)
78 return 0;
79 /* hugepages are never "special" */
80 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
81
82 refs = 0;
83 head = pte_page(pte);
84 page = head + ((*addr & ~huge_page_mask(hstate)) >> PAGE_SHIFT);
85 do {
86 VM_BUG_ON(compound_head(page) != head);
87 pages[*nr] = page;
88 (*nr)++;
89 page++;
90 refs++;
91 } while (*addr += PAGE_SIZE, *addr != end);
92
93 if (!page_cache_add_speculative(head, refs)) {
94 *nr -= refs;
95 return 0;
96 }
97 if (unlikely(pte_val(pte) != pte_val(*ptep))) {
98 /* Could be optimized better */
99 while (*nr) {
100 put_page(page);
101 (*nr)--;
102 }
103 }
104
105 return 1;
106}
107#endif /* CONFIG_HUGETLB_PAGE */
108
109static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end, 58static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
110 int write, struct page **pages, int *nr) 59 int write, struct page **pages, int *nr)
111{ 60{
@@ -119,7 +68,11 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
119 next = pmd_addr_end(addr, end); 68 next = pmd_addr_end(addr, end);
120 if (pmd_none(pmd)) 69 if (pmd_none(pmd))
121 return 0; 70 return 0;
122 if (!gup_pte_range(pmd, addr, next, write, pages, nr)) 71 if (is_hugepd(pmdp)) {
72 if (!gup_hugepd((hugepd_t *)pmdp, PMD_SHIFT,
73 addr, next, write, pages, nr))
74 return 0;
75 } else if (!gup_pte_range(pmd, addr, next, write, pages, nr))
123 return 0; 76 return 0;
124 } while (pmdp++, addr = next, addr != end); 77 } while (pmdp++, addr = next, addr != end);
125 78
@@ -139,7 +92,11 @@ static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
139 next = pud_addr_end(addr, end); 92 next = pud_addr_end(addr, end);
140 if (pud_none(pud)) 93 if (pud_none(pud))
141 return 0; 94 return 0;
142 if (!gup_pmd_range(pud, addr, next, write, pages, nr)) 95 if (is_hugepd(pudp)) {
96 if (!gup_hugepd((hugepd_t *)pudp, PUD_SHIFT,
97 addr, next, write, pages, nr))
98 return 0;
99 } else if (!gup_pmd_range(pud, addr, next, write, pages, nr))
143 return 0; 100 return 0;
144 } while (pudp++, addr = next, addr != end); 101 } while (pudp++, addr = next, addr != end);
145 102
@@ -154,10 +111,6 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
154 unsigned long next; 111 unsigned long next;
155 pgd_t *pgdp; 112 pgd_t *pgdp;
156 int nr = 0; 113 int nr = 0;
157#ifdef CONFIG_PPC64
158 unsigned int shift;
159 int psize;
160#endif
161 114
162 pr_devel("%s(%lx,%x,%s)\n", __func__, start, nr_pages, write ? "write" : "read"); 115 pr_devel("%s(%lx,%x,%s)\n", __func__, start, nr_pages, write ? "write" : "read");
163 116
@@ -172,25 +125,6 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
172 125
173 pr_devel(" aligned: %lx .. %lx\n", start, end); 126 pr_devel(" aligned: %lx .. %lx\n", start, end);
174 127
175#ifdef CONFIG_HUGETLB_PAGE
176 /* We bail out on slice boundary crossing when hugetlb is
177 * enabled in order to not have to deal with two different
178 * page table formats
179 */
180 if (addr < SLICE_LOW_TOP) {
181 if (end > SLICE_LOW_TOP)
182 goto slow_irqon;
183
184 if (unlikely(GET_LOW_SLICE_INDEX(addr) !=
185 GET_LOW_SLICE_INDEX(end - 1)))
186 goto slow_irqon;
187 } else {
188 if (unlikely(GET_HIGH_SLICE_INDEX(addr) !=
189 GET_HIGH_SLICE_INDEX(end - 1)))
190 goto slow_irqon;
191 }
192#endif /* CONFIG_HUGETLB_PAGE */
193
194 /* 128 /*
195 * XXX: batch / limit 'nr', to avoid large irq off latency 129 * XXX: batch / limit 'nr', to avoid large irq off latency
196 * needs some instrumenting to determine the common sizes used by 130 * needs some instrumenting to determine the common sizes used by
@@ -210,54 +144,23 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
210 */ 144 */
211 local_irq_disable(); 145 local_irq_disable();
212 146
213#ifdef CONFIG_PPC64 147 pgdp = pgd_offset(mm, addr);
214 /* Those bits are related to hugetlbfs implementation and only exist 148 do {
215 * on 64-bit for now 149 pgd_t pgd = *pgdp;
216 */ 150
217 psize = get_slice_psize(mm, addr); 151 pr_devel(" %016lx: normal pgd %p\n", addr,
218 shift = mmu_psize_defs[psize].shift; 152 (void *)pgd_val(pgd));
219#endif /* CONFIG_PPC64 */ 153 next = pgd_addr_end(addr, end);
220 154 if (pgd_none(pgd))
221#ifdef CONFIG_HUGETLB_PAGE 155 goto slow;
222 if (unlikely(mmu_huge_psizes[psize])) { 156 if (is_hugepd(pgdp)) {
223 pte_t *ptep; 157 if (!gup_hugepd((hugepd_t *)pgdp, PGDIR_SHIFT,
224 unsigned long a = addr; 158 addr, next, write, pages, &nr))
225 unsigned long sz = ((1UL) << shift);
226 struct hstate *hstate = size_to_hstate(sz);
227
228 BUG_ON(!hstate);
229 /*
230 * XXX: could be optimized to avoid hstate
231 * lookup entirely (just use shift)
232 */
233
234 do {
235 VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, a)].shift);
236 ptep = huge_pte_offset(mm, a);
237 pr_devel(" %016lx: huge ptep %p\n", a, ptep);
238 if (!ptep || !gup_huge_pte(ptep, hstate, &a, end, write, pages,
239 &nr))
240 goto slow;
241 } while (a != end);
242 } else
243#endif /* CONFIG_HUGETLB_PAGE */
244 {
245 pgdp = pgd_offset(mm, addr);
246 do {
247 pgd_t pgd = *pgdp;
248
249#ifdef CONFIG_PPC64
250 VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, addr)].shift);
251#endif
252 pr_devel(" %016lx: normal pgd %p\n", addr,
253 (void *)pgd_val(pgd));
254 next = pgd_addr_end(addr, end);
255 if (pgd_none(pgd))
256 goto slow;
257 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
258 goto slow; 159 goto slow;
259 } while (pgdp++, addr = next, addr != end); 160 } else if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
260 } 161 goto slow;
162 } while (pgdp++, addr = next, addr != end);
163
261 local_irq_enable(); 164 local_irq_enable();
262 165
263 VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT); 166 VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT);
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 1ade7eb6ae00..50f867d657df 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -92,6 +92,7 @@ struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
92struct hash_pte *htab_address; 92struct hash_pte *htab_address;
93unsigned long htab_size_bytes; 93unsigned long htab_size_bytes;
94unsigned long htab_hash_mask; 94unsigned long htab_hash_mask;
95EXPORT_SYMBOL_GPL(htab_hash_mask);
95int mmu_linear_psize = MMU_PAGE_4K; 96int mmu_linear_psize = MMU_PAGE_4K;
96int mmu_virtual_psize = MMU_PAGE_4K; 97int mmu_virtual_psize = MMU_PAGE_4K;
97int mmu_vmalloc_psize = MMU_PAGE_4K; 98int mmu_vmalloc_psize = MMU_PAGE_4K;
@@ -102,6 +103,7 @@ int mmu_io_psize = MMU_PAGE_4K;
102int mmu_kernel_ssize = MMU_SEGSIZE_256M; 103int mmu_kernel_ssize = MMU_SEGSIZE_256M;
103int mmu_highuser_ssize = MMU_SEGSIZE_256M; 104int mmu_highuser_ssize = MMU_SEGSIZE_256M;
104u16 mmu_slb_size = 64; 105u16 mmu_slb_size = 64;
106EXPORT_SYMBOL_GPL(mmu_slb_size);
105#ifdef CONFIG_HUGETLB_PAGE 107#ifdef CONFIG_HUGETLB_PAGE
106unsigned int HPAGE_SHIFT; 108unsigned int HPAGE_SHIFT;
107#endif 109#endif
@@ -481,16 +483,6 @@ static void __init htab_init_page_sizes(void)
481#ifdef CONFIG_HUGETLB_PAGE 483#ifdef CONFIG_HUGETLB_PAGE
482 /* Reserve 16G huge page memory sections for huge pages */ 484 /* Reserve 16G huge page memory sections for huge pages */
483 of_scan_flat_dt(htab_dt_scan_hugepage_blocks, NULL); 485 of_scan_flat_dt(htab_dt_scan_hugepage_blocks, NULL);
484
485/* Set default large page size. Currently, we pick 16M or 1M depending
486 * on what is available
487 */
488 if (mmu_psize_defs[MMU_PAGE_16M].shift)
489 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_16M].shift;
490 /* With 4k/4level pagetables, we can't (for now) cope with a
491 * huge page size < PMD_SIZE */
492 else if (mmu_psize_defs[MMU_PAGE_1M].shift)
493 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_1M].shift;
494#endif /* CONFIG_HUGETLB_PAGE */ 486#endif /* CONFIG_HUGETLB_PAGE */
495} 487}
496 488
@@ -785,7 +777,7 @@ unsigned int hash_page_do_lazy_icache(unsigned int pp, pte_t pte, int trap)
785 /* page is dirty */ 777 /* page is dirty */
786 if (!test_bit(PG_arch_1, &page->flags) && !PageReserved(page)) { 778 if (!test_bit(PG_arch_1, &page->flags) && !PageReserved(page)) {
787 if (trap == 0x400) { 779 if (trap == 0x400) {
788 __flush_dcache_icache(page_address(page)); 780 flush_dcache_icache_page(page);
789 set_bit(PG_arch_1, &page->flags); 781 set_bit(PG_arch_1, &page->flags);
790 } else 782 } else
791 pp |= HPTE_R_N; 783 pp |= HPTE_R_N;
@@ -843,9 +835,9 @@ void demote_segment_4k(struct mm_struct *mm, unsigned long addr)
843 * Result is 0: full permissions, _PAGE_RW: read-only, 835 * Result is 0: full permissions, _PAGE_RW: read-only,
844 * _PAGE_USER or _PAGE_USER|_PAGE_RW: no access. 836 * _PAGE_USER or _PAGE_USER|_PAGE_RW: no access.
845 */ 837 */
846static int subpage_protection(pgd_t *pgdir, unsigned long ea) 838static int subpage_protection(struct mm_struct *mm, unsigned long ea)
847{ 839{
848 struct subpage_prot_table *spt = pgd_subpage_prot(pgdir); 840 struct subpage_prot_table *spt = &mm->context.spt;
849 u32 spp = 0; 841 u32 spp = 0;
850 u32 **sbpm, *sbpp; 842 u32 **sbpm, *sbpp;
851 843
@@ -873,7 +865,7 @@ static int subpage_protection(pgd_t *pgdir, unsigned long ea)
873} 865}
874 866
875#else /* CONFIG_PPC_SUBPAGE_PROT */ 867#else /* CONFIG_PPC_SUBPAGE_PROT */
876static inline int subpage_protection(pgd_t *pgdir, unsigned long ea) 868static inline int subpage_protection(struct mm_struct *mm, unsigned long ea)
877{ 869{
878 return 0; 870 return 0;
879} 871}
@@ -891,6 +883,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
891 unsigned long vsid; 883 unsigned long vsid;
892 struct mm_struct *mm; 884 struct mm_struct *mm;
893 pte_t *ptep; 885 pte_t *ptep;
886 unsigned hugeshift;
894 const struct cpumask *tmp; 887 const struct cpumask *tmp;
895 int rc, user_region = 0, local = 0; 888 int rc, user_region = 0, local = 0;
896 int psize, ssize; 889 int psize, ssize;
@@ -943,30 +936,31 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
943 if (user_region && cpumask_equal(mm_cpumask(mm), tmp)) 936 if (user_region && cpumask_equal(mm_cpumask(mm), tmp))
944 local = 1; 937 local = 1;
945 938
946#ifdef CONFIG_HUGETLB_PAGE
947 /* Handle hugepage regions */
948 if (HPAGE_SHIFT && mmu_huge_psizes[psize]) {
949 DBG_LOW(" -> huge page !\n");
950 return hash_huge_page(mm, access, ea, vsid, local, trap);
951 }
952#endif /* CONFIG_HUGETLB_PAGE */
953
954#ifndef CONFIG_PPC_64K_PAGES 939#ifndef CONFIG_PPC_64K_PAGES
955 /* If we use 4K pages and our psize is not 4K, then we are hitting 940 /* If we use 4K pages and our psize is not 4K, then we might
956 * a special driver mapping, we need to align the address before 941 * be hitting a special driver mapping, and need to align the
957 * we fetch the PTE 942 * address before we fetch the PTE.
943 *
944 * It could also be a hugepage mapping, in which case this is
945 * not necessary, but it's not harmful, either.
958 */ 946 */
959 if (psize != MMU_PAGE_4K) 947 if (psize != MMU_PAGE_4K)
960 ea &= ~((1ul << mmu_psize_defs[psize].shift) - 1); 948 ea &= ~((1ul << mmu_psize_defs[psize].shift) - 1);
961#endif /* CONFIG_PPC_64K_PAGES */ 949#endif /* CONFIG_PPC_64K_PAGES */
962 950
963 /* Get PTE and page size from page tables */ 951 /* Get PTE and page size from page tables */
964 ptep = find_linux_pte(pgdir, ea); 952 ptep = find_linux_pte_or_hugepte(pgdir, ea, &hugeshift);
965 if (ptep == NULL || !pte_present(*ptep)) { 953 if (ptep == NULL || !pte_present(*ptep)) {
966 DBG_LOW(" no PTE !\n"); 954 DBG_LOW(" no PTE !\n");
967 return 1; 955 return 1;
968 } 956 }
969 957
958#ifdef CONFIG_HUGETLB_PAGE
959 if (hugeshift)
960 return __hash_page_huge(ea, access, vsid, ptep, trap, local,
961 ssize, hugeshift, psize);
962#endif /* CONFIG_HUGETLB_PAGE */
963
970#ifndef CONFIG_PPC_64K_PAGES 964#ifndef CONFIG_PPC_64K_PAGES
971 DBG_LOW(" i-pte: %016lx\n", pte_val(*ptep)); 965 DBG_LOW(" i-pte: %016lx\n", pte_val(*ptep));
972#else 966#else
diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
new file mode 100644
index 000000000000..199539882f92
--- /dev/null
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -0,0 +1,139 @@
1/*
2 * PPC64 Huge TLB Page Support for hash based MMUs (POWER4 and later)
3 *
4 * Copyright (C) 2003 David Gibson, IBM Corporation.
5 *
6 * Based on the IA-32 version:
7 * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
8 */
9
10#include <linux/mm.h>
11#include <linux/hugetlb.h>
12#include <asm/pgtable.h>
13#include <asm/pgalloc.h>
14#include <asm/cacheflush.h>
15#include <asm/machdep.h>
16
17int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
18 pte_t *ptep, unsigned long trap, int local, int ssize,
19 unsigned int shift, unsigned int mmu_psize)
20{
21 unsigned long old_pte, new_pte;
22 unsigned long va, rflags, pa, sz;
23 long slot;
24 int err = 1;
25
26 BUG_ON(shift != mmu_psize_defs[mmu_psize].shift);
27
28 /* Search the Linux page table for a match with va */
29 va = hpt_va(ea, vsid, ssize);
30
31 /*
32 * Check the user's access rights to the page. If access should be
33 * prevented then send the problem up to do_page_fault.
34 */
35 if (unlikely(access & ~pte_val(*ptep)))
36 goto out;
37 /*
38 * At this point, we have a pte (old_pte) which can be used to build
39 * or update an HPTE. There are 2 cases:
40 *
41 * 1. There is a valid (present) pte with no associated HPTE (this is
42 * the most common case)
43 * 2. There is a valid (present) pte with an associated HPTE. The
44 * current values of the pp bits in the HPTE prevent access
45 * because we are doing software DIRTY bit management and the
46 * page is currently not DIRTY.
47 */
48
49
50 do {
51 old_pte = pte_val(*ptep);
52 if (old_pte & _PAGE_BUSY)
53 goto out;
54 new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED;
55 } while(old_pte != __cmpxchg_u64((unsigned long *)ptep,
56 old_pte, new_pte));
57
58 rflags = 0x2 | (!(new_pte & _PAGE_RW));
59 /* _PAGE_EXEC -> HW_NO_EXEC since it's inverted */
60 rflags |= ((new_pte & _PAGE_EXEC) ? 0 : HPTE_R_N);
61 sz = ((1UL) << shift);
62 if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
63 /* No CPU has hugepages but lacks no execute, so we
64 * don't need to worry about that case */
65 rflags = hash_page_do_lazy_icache(rflags, __pte(old_pte), trap);
66
67 /* Check if pte already has an hpte (case 2) */
68 if (unlikely(old_pte & _PAGE_HASHPTE)) {
69 /* There MIGHT be an HPTE for this pte */
70 unsigned long hash, slot;
71
72 hash = hpt_hash(va, shift, ssize);
73 if (old_pte & _PAGE_F_SECOND)
74 hash = ~hash;
75 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
76 slot += (old_pte & _PAGE_F_GIX) >> 12;
77
78 if (ppc_md.hpte_updatepp(slot, rflags, va, mmu_psize,
79 ssize, local) == -1)
80 old_pte &= ~_PAGE_HPTEFLAGS;
81 }
82
83 if (likely(!(old_pte & _PAGE_HASHPTE))) {
84 unsigned long hash = hpt_hash(va, shift, ssize);
85 unsigned long hpte_group;
86
87 pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT;
88
89repeat:
90 hpte_group = ((hash & htab_hash_mask) *
91 HPTES_PER_GROUP) & ~0x7UL;
92
93 /* clear HPTE slot informations in new PTE */
94#ifdef CONFIG_PPC_64K_PAGES
95 new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0;
96#else
97 new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE;
98#endif
99 /* Add in WIMG bits */
100 rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
101 _PAGE_COHERENT | _PAGE_GUARDED));
102
103 /* Insert into the hash table, primary slot */
104 slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 0,
105 mmu_psize, ssize);
106
107 /* Primary is full, try the secondary */
108 if (unlikely(slot == -1)) {
109 hpte_group = ((~hash & htab_hash_mask) *
110 HPTES_PER_GROUP) & ~0x7UL;
111 slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags,
112 HPTE_V_SECONDARY,
113 mmu_psize, ssize);
114 if (slot == -1) {
115 if (mftb() & 0x1)
116 hpte_group = ((hash & htab_hash_mask) *
117 HPTES_PER_GROUP)&~0x7UL;
118
119 ppc_md.hpte_remove(hpte_group);
120 goto repeat;
121 }
122 }
123
124 if (unlikely(slot == -2))
125 panic("hash_huge_page: pte_insert failed\n");
126
127 new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
128 }
129
130 /*
131 * No need to use ldarx/stdcx here
132 */
133 *ptep = __pte(new_pte & ~_PAGE_BUSY);
134
135 err = 0;
136
137 out:
138 return err;
139}
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 90df6ffe3a43..123f7070238a 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -7,29 +7,17 @@
7 * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com> 7 * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
8 */ 8 */
9 9
10#include <linux/init.h>
11#include <linux/fs.h>
12#include <linux/mm.h> 10#include <linux/mm.h>
11#include <linux/io.h>
13#include <linux/hugetlb.h> 12#include <linux/hugetlb.h>
14#include <linux/pagemap.h> 13#include <asm/pgtable.h>
15#include <linux/slab.h>
16#include <linux/err.h>
17#include <linux/sysctl.h>
18#include <asm/mman.h>
19#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
20#include <asm/tlb.h> 15#include <asm/tlb.h>
21#include <asm/tlbflush.h>
22#include <asm/mmu_context.h>
23#include <asm/machdep.h>
24#include <asm/cputable.h>
25#include <asm/spu.h>
26 16
27#define PAGE_SHIFT_64K 16 17#define PAGE_SHIFT_64K 16
28#define PAGE_SHIFT_16M 24 18#define PAGE_SHIFT_16M 24
29#define PAGE_SHIFT_16G 34 19#define PAGE_SHIFT_16G 34
30 20
31#define NUM_LOW_AREAS (0x100000000UL >> SID_SHIFT)
32#define NUM_HIGH_AREAS (PGTABLE_RANGE >> HTLB_AREA_SHIFT)
33#define MAX_NUMBER_GPAGES 1024 21#define MAX_NUMBER_GPAGES 1024
34 22
35/* Tracks the 16G pages after the device tree is scanned and before the 23/* Tracks the 16G pages after the device tree is scanned and before the
@@ -37,53 +25,17 @@
37static unsigned long gpage_freearray[MAX_NUMBER_GPAGES]; 25static unsigned long gpage_freearray[MAX_NUMBER_GPAGES];
38static unsigned nr_gpages; 26static unsigned nr_gpages;
39 27
40/* Array of valid huge page sizes - non-zero value(hugepte_shift) is
41 * stored for the huge page sizes that are valid.
42 */
43unsigned int mmu_huge_psizes[MMU_PAGE_COUNT] = { }; /* initialize all to 0 */
44
45#define hugepte_shift mmu_huge_psizes
46#define PTRS_PER_HUGEPTE(psize) (1 << hugepte_shift[psize])
47#define HUGEPTE_TABLE_SIZE(psize) (sizeof(pte_t) << hugepte_shift[psize])
48
49#define HUGEPD_SHIFT(psize) (mmu_psize_to_shift(psize) \
50 + hugepte_shift[psize])
51#define HUGEPD_SIZE(psize) (1UL << HUGEPD_SHIFT(psize))
52#define HUGEPD_MASK(psize) (~(HUGEPD_SIZE(psize)-1))
53
54/* Subtract one from array size because we don't need a cache for 4K since
55 * is not a huge page size */
56#define HUGE_PGTABLE_INDEX(psize) (HUGEPTE_CACHE_NUM + psize - 1)
57#define HUGEPTE_CACHE_NAME(psize) (huge_pgtable_cache_name[psize])
58
59static const char *huge_pgtable_cache_name[MMU_PAGE_COUNT] = {
60 [MMU_PAGE_64K] = "hugepte_cache_64K",
61 [MMU_PAGE_1M] = "hugepte_cache_1M",
62 [MMU_PAGE_16M] = "hugepte_cache_16M",
63 [MMU_PAGE_16G] = "hugepte_cache_16G",
64};
65
66/* Flag to mark huge PD pointers. This means pmd_bad() and pud_bad() 28/* Flag to mark huge PD pointers. This means pmd_bad() and pud_bad()
67 * will choke on pointers to hugepte tables, which is handy for 29 * will choke on pointers to hugepte tables, which is handy for
68 * catching screwups early. */ 30 * catching screwups early. */
69#define HUGEPD_OK 0x1
70
71typedef struct { unsigned long pd; } hugepd_t;
72
73#define hugepd_none(hpd) ((hpd).pd == 0)
74 31
75static inline int shift_to_mmu_psize(unsigned int shift) 32static inline int shift_to_mmu_psize(unsigned int shift)
76{ 33{
77 switch (shift) { 34 int psize;
78#ifndef CONFIG_PPC_64K_PAGES 35
79 case PAGE_SHIFT_64K: 36 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize)
80 return MMU_PAGE_64K; 37 if (mmu_psize_defs[psize].shift == shift)
81#endif 38 return psize;
82 case PAGE_SHIFT_16M:
83 return MMU_PAGE_16M;
84 case PAGE_SHIFT_16G:
85 return MMU_PAGE_16G;
86 }
87 return -1; 39 return -1;
88} 40}
89 41
@@ -94,71 +46,126 @@ static inline unsigned int mmu_psize_to_shift(unsigned int mmu_psize)
94 BUG(); 46 BUG();
95} 47}
96 48
49#define hugepd_none(hpd) ((hpd).pd == 0)
50
97static inline pte_t *hugepd_page(hugepd_t hpd) 51static inline pte_t *hugepd_page(hugepd_t hpd)
98{ 52{
99 BUG_ON(!(hpd.pd & HUGEPD_OK)); 53 BUG_ON(!hugepd_ok(hpd));
100 return (pte_t *)(hpd.pd & ~HUGEPD_OK); 54 return (pte_t *)((hpd.pd & ~HUGEPD_SHIFT_MASK) | 0xc000000000000000);
55}
56
57static inline unsigned int hugepd_shift(hugepd_t hpd)
58{
59 return hpd.pd & HUGEPD_SHIFT_MASK;
101} 60}
102 61
103static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, 62static inline pte_t *hugepte_offset(hugepd_t *hpdp, unsigned long addr, unsigned pdshift)
104 struct hstate *hstate)
105{ 63{
106 unsigned int shift = huge_page_shift(hstate); 64 unsigned long idx = (addr & ((1UL << pdshift) - 1)) >> hugepd_shift(*hpdp);
107 int psize = shift_to_mmu_psize(shift);
108 unsigned long idx = ((addr >> shift) & (PTRS_PER_HUGEPTE(psize)-1));
109 pte_t *dir = hugepd_page(*hpdp); 65 pte_t *dir = hugepd_page(*hpdp);
110 66
111 return dir + idx; 67 return dir + idx;
112} 68}
113 69
70pte_t *find_linux_pte_or_hugepte(pgd_t *pgdir, unsigned long ea, unsigned *shift)
71{
72 pgd_t *pg;
73 pud_t *pu;
74 pmd_t *pm;
75 hugepd_t *hpdp = NULL;
76 unsigned pdshift = PGDIR_SHIFT;
77
78 if (shift)
79 *shift = 0;
80
81 pg = pgdir + pgd_index(ea);
82 if (is_hugepd(pg)) {
83 hpdp = (hugepd_t *)pg;
84 } else if (!pgd_none(*pg)) {
85 pdshift = PUD_SHIFT;
86 pu = pud_offset(pg, ea);
87 if (is_hugepd(pu))
88 hpdp = (hugepd_t *)pu;
89 else if (!pud_none(*pu)) {
90 pdshift = PMD_SHIFT;
91 pm = pmd_offset(pu, ea);
92 if (is_hugepd(pm))
93 hpdp = (hugepd_t *)pm;
94 else if (!pmd_none(*pm)) {
95 return pte_offset_map(pm, ea);
96 }
97 }
98 }
99
100 if (!hpdp)
101 return NULL;
102
103 if (shift)
104 *shift = hugepd_shift(*hpdp);
105 return hugepte_offset(hpdp, ea, pdshift);
106}
107
108pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
109{
110 return find_linux_pte_or_hugepte(mm->pgd, addr, NULL);
111}
112
114static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp, 113static int __hugepte_alloc(struct mm_struct *mm, hugepd_t *hpdp,
115 unsigned long address, unsigned int psize) 114 unsigned long address, unsigned pdshift, unsigned pshift)
116{ 115{
117 pte_t *new = kmem_cache_zalloc(pgtable_cache[HUGE_PGTABLE_INDEX(psize)], 116 pte_t *new = kmem_cache_zalloc(PGT_CACHE(pdshift - pshift),
118 GFP_KERNEL|__GFP_REPEAT); 117 GFP_KERNEL|__GFP_REPEAT);
118
119 BUG_ON(pshift > HUGEPD_SHIFT_MASK);
120 BUG_ON((unsigned long)new & HUGEPD_SHIFT_MASK);
119 121
120 if (! new) 122 if (! new)
121 return -ENOMEM; 123 return -ENOMEM;
122 124
123 spin_lock(&mm->page_table_lock); 125 spin_lock(&mm->page_table_lock);
124 if (!hugepd_none(*hpdp)) 126 if (!hugepd_none(*hpdp))
125 kmem_cache_free(pgtable_cache[HUGE_PGTABLE_INDEX(psize)], new); 127 kmem_cache_free(PGT_CACHE(pdshift - pshift), new);
126 else 128 else
127 hpdp->pd = (unsigned long)new | HUGEPD_OK; 129 hpdp->pd = ((unsigned long)new & ~0x8000000000000000) | pshift;
128 spin_unlock(&mm->page_table_lock); 130 spin_unlock(&mm->page_table_lock);
129 return 0; 131 return 0;
130} 132}
131 133
132 134pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr, unsigned long sz)
133static pud_t *hpud_offset(pgd_t *pgd, unsigned long addr, struct hstate *hstate)
134{
135 if (huge_page_shift(hstate) < PUD_SHIFT)
136 return pud_offset(pgd, addr);
137 else
138 return (pud_t *) pgd;
139}
140static pud_t *hpud_alloc(struct mm_struct *mm, pgd_t *pgd, unsigned long addr,
141 struct hstate *hstate)
142{ 135{
143 if (huge_page_shift(hstate) < PUD_SHIFT) 136 pgd_t *pg;
144 return pud_alloc(mm, pgd, addr); 137 pud_t *pu;
145 else 138 pmd_t *pm;
146 return (pud_t *) pgd; 139 hugepd_t *hpdp = NULL;
147} 140 unsigned pshift = __ffs(sz);
148static pmd_t *hpmd_offset(pud_t *pud, unsigned long addr, struct hstate *hstate) 141 unsigned pdshift = PGDIR_SHIFT;
149{ 142
150 if (huge_page_shift(hstate) < PMD_SHIFT) 143 addr &= ~(sz-1);
151 return pmd_offset(pud, addr); 144
152 else 145 pg = pgd_offset(mm, addr);
153 return (pmd_t *) pud; 146 if (pshift >= PUD_SHIFT) {
154} 147 hpdp = (hugepd_t *)pg;
155static pmd_t *hpmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long addr, 148 } else {
156 struct hstate *hstate) 149 pdshift = PUD_SHIFT;
157{ 150 pu = pud_alloc(mm, pg, addr);
158 if (huge_page_shift(hstate) < PMD_SHIFT) 151 if (pshift >= PMD_SHIFT) {
159 return pmd_alloc(mm, pud, addr); 152 hpdp = (hugepd_t *)pu;
160 else 153 } else {
161 return (pmd_t *) pud; 154 pdshift = PMD_SHIFT;
155 pm = pmd_alloc(mm, pu, addr);
156 hpdp = (hugepd_t *)pm;
157 }
158 }
159
160 if (!hpdp)
161 return NULL;
162
163 BUG_ON(!hugepd_none(*hpdp) && !hugepd_ok(*hpdp));
164
165 if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, pdshift, pshift))
166 return NULL;
167
168 return hugepte_offset(hpdp, addr, pdshift);
162} 169}
163 170
164/* Build list of addresses of gigantic pages. This function is used in early 171/* Build list of addresses of gigantic pages. This function is used in early
@@ -192,94 +199,38 @@ int alloc_bootmem_huge_page(struct hstate *hstate)
192 return 1; 199 return 1;
193} 200}
194 201
195
196/* Modelled after find_linux_pte() */
197pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
198{
199 pgd_t *pg;
200 pud_t *pu;
201 pmd_t *pm;
202
203 unsigned int psize;
204 unsigned int shift;
205 unsigned long sz;
206 struct hstate *hstate;
207 psize = get_slice_psize(mm, addr);
208 shift = mmu_psize_to_shift(psize);
209 sz = ((1UL) << shift);
210 hstate = size_to_hstate(sz);
211
212 addr &= hstate->mask;
213
214 pg = pgd_offset(mm, addr);
215 if (!pgd_none(*pg)) {
216 pu = hpud_offset(pg, addr, hstate);
217 if (!pud_none(*pu)) {
218 pm = hpmd_offset(pu, addr, hstate);
219 if (!pmd_none(*pm))
220 return hugepte_offset((hugepd_t *)pm, addr,
221 hstate);
222 }
223 }
224
225 return NULL;
226}
227
228pte_t *huge_pte_alloc(struct mm_struct *mm,
229 unsigned long addr, unsigned long sz)
230{
231 pgd_t *pg;
232 pud_t *pu;
233 pmd_t *pm;
234 hugepd_t *hpdp = NULL;
235 struct hstate *hstate;
236 unsigned int psize;
237 hstate = size_to_hstate(sz);
238
239 psize = get_slice_psize(mm, addr);
240 BUG_ON(!mmu_huge_psizes[psize]);
241
242 addr &= hstate->mask;
243
244 pg = pgd_offset(mm, addr);
245 pu = hpud_alloc(mm, pg, addr, hstate);
246
247 if (pu) {
248 pm = hpmd_alloc(mm, pu, addr, hstate);
249 if (pm)
250 hpdp = (hugepd_t *)pm;
251 }
252
253 if (! hpdp)
254 return NULL;
255
256 if (hugepd_none(*hpdp) && __hugepte_alloc(mm, hpdp, addr, psize))
257 return NULL;
258
259 return hugepte_offset(hpdp, addr, hstate);
260}
261
262int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep) 202int huge_pmd_unshare(struct mm_struct *mm, unsigned long *addr, pte_t *ptep)
263{ 203{
264 return 0; 204 return 0;
265} 205}
266 206
267static void free_hugepte_range(struct mmu_gather *tlb, hugepd_t *hpdp, 207static void free_hugepd_range(struct mmu_gather *tlb, hugepd_t *hpdp, int pdshift,
268 unsigned int psize) 208 unsigned long start, unsigned long end,
209 unsigned long floor, unsigned long ceiling)
269{ 210{
270 pte_t *hugepte = hugepd_page(*hpdp); 211 pte_t *hugepte = hugepd_page(*hpdp);
212 unsigned shift = hugepd_shift(*hpdp);
213 unsigned long pdmask = ~((1UL << pdshift) - 1);
214
215 start &= pdmask;
216 if (start < floor)
217 return;
218 if (ceiling) {
219 ceiling &= pdmask;
220 if (! ceiling)
221 return;
222 }
223 if (end - 1 > ceiling - 1)
224 return;
271 225
272 hpdp->pd = 0; 226 hpdp->pd = 0;
273 tlb->need_flush = 1; 227 tlb->need_flush = 1;
274 pgtable_free_tlb(tlb, pgtable_free_cache(hugepte, 228 pgtable_free_tlb(tlb, hugepte, pdshift - shift);
275 HUGEPTE_CACHE_NUM+psize-1,
276 PGF_CACHENUM_MASK));
277} 229}
278 230
279static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud, 231static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
280 unsigned long addr, unsigned long end, 232 unsigned long addr, unsigned long end,
281 unsigned long floor, unsigned long ceiling, 233 unsigned long floor, unsigned long ceiling)
282 unsigned int psize)
283{ 234{
284 pmd_t *pmd; 235 pmd_t *pmd;
285 unsigned long next; 236 unsigned long next;
@@ -291,7 +242,8 @@ static void hugetlb_free_pmd_range(struct mmu_gather *tlb, pud_t *pud,
291 next = pmd_addr_end(addr, end); 242 next = pmd_addr_end(addr, end);
292 if (pmd_none(*pmd)) 243 if (pmd_none(*pmd))
293 continue; 244 continue;
294 free_hugepte_range(tlb, (hugepd_t *)pmd, psize); 245 free_hugepd_range(tlb, (hugepd_t *)pmd, PMD_SHIFT,
246 addr, next, floor, ceiling);
295 } while (pmd++, addr = next, addr != end); 247 } while (pmd++, addr = next, addr != end);
296 248
297 start &= PUD_MASK; 249 start &= PUD_MASK;
@@ -317,23 +269,19 @@ static void hugetlb_free_pud_range(struct mmu_gather *tlb, pgd_t *pgd,
317 pud_t *pud; 269 pud_t *pud;
318 unsigned long next; 270 unsigned long next;
319 unsigned long start; 271 unsigned long start;
320 unsigned int shift;
321 unsigned int psize = get_slice_psize(tlb->mm, addr);
322 shift = mmu_psize_to_shift(psize);
323 272
324 start = addr; 273 start = addr;
325 pud = pud_offset(pgd, addr); 274 pud = pud_offset(pgd, addr);
326 do { 275 do {
327 next = pud_addr_end(addr, end); 276 next = pud_addr_end(addr, end);
328 if (shift < PMD_SHIFT) { 277 if (!is_hugepd(pud)) {
329 if (pud_none_or_clear_bad(pud)) 278 if (pud_none_or_clear_bad(pud))
330 continue; 279 continue;
331 hugetlb_free_pmd_range(tlb, pud, addr, next, floor, 280 hugetlb_free_pmd_range(tlb, pud, addr, next, floor,
332 ceiling, psize); 281 ceiling);
333 } else { 282 } else {
334 if (pud_none(*pud)) 283 free_hugepd_range(tlb, (hugepd_t *)pud, PUD_SHIFT,
335 continue; 284 addr, next, floor, ceiling);
336 free_hugepte_range(tlb, (hugepd_t *)pud, psize);
337 } 285 }
338 } while (pud++, addr = next, addr != end); 286 } while (pud++, addr = next, addr != end);
339 287
@@ -364,121 +312,56 @@ void hugetlb_free_pgd_range(struct mmu_gather *tlb,
364{ 312{
365 pgd_t *pgd; 313 pgd_t *pgd;
366 unsigned long next; 314 unsigned long next;
367 unsigned long start;
368 315
369 /* 316 /*
370 * Comments below take from the normal free_pgd_range(). They 317 * Because there are a number of different possible pagetable
371 * apply here too. The tests against HUGEPD_MASK below are 318 * layouts for hugepage ranges, we limit knowledge of how
372 * essential, because we *don't* test for this at the bottom 319 * things should be laid out to the allocation path
373 * level. Without them we'll attempt to free a hugepte table 320 * (huge_pte_alloc(), above). Everything else works out the
374 * when we unmap just part of it, even if there are other 321 * structure as it goes from information in the hugepd
375 * active mappings using it. 322 * pointers. That means that we can't here use the
376 * 323 * optimization used in the normal page free_pgd_range(), of
377 * The next few lines have given us lots of grief... 324 * checking whether we're actually covering a large enough
378 * 325 * range to have to do anything at the top level of the walk
379 * Why are we testing HUGEPD* at this top level? Because 326 * instead of at the bottom.
380 * often there will be no work to do at all, and we'd prefer
381 * not to go all the way down to the bottom just to discover
382 * that.
383 *
384 * Why all these "- 1"s? Because 0 represents both the bottom
385 * of the address space and the top of it (using -1 for the
386 * top wouldn't help much: the masks would do the wrong thing).
387 * The rule is that addr 0 and floor 0 refer to the bottom of
388 * the address space, but end 0 and ceiling 0 refer to the top
389 * Comparisons need to use "end - 1" and "ceiling - 1" (though
390 * that end 0 case should be mythical).
391 * 327 *
392 * Wherever addr is brought up or ceiling brought down, we 328 * To make sense of this, you should probably go read the big
393 * must be careful to reject "the opposite 0" before it 329 * block comment at the top of the normal free_pgd_range(),
394 * confuses the subsequent tests. But what about where end is 330 * too.
395 * brought down by HUGEPD_SIZE below? no, end can't go down to
396 * 0 there.
397 *
398 * Whereas we round start (addr) and ceiling down, by different
399 * masks at different levels, in order to test whether a table
400 * now has no other vmas using it, so can be freed, we don't
401 * bother to round floor or end up - the tests don't need that.
402 */ 331 */
403 unsigned int psize = get_slice_psize(tlb->mm, addr);
404
405 addr &= HUGEPD_MASK(psize);
406 if (addr < floor) {
407 addr += HUGEPD_SIZE(psize);
408 if (!addr)
409 return;
410 }
411 if (ceiling) {
412 ceiling &= HUGEPD_MASK(psize);
413 if (!ceiling)
414 return;
415 }
416 if (end - 1 > ceiling - 1)
417 end -= HUGEPD_SIZE(psize);
418 if (addr > end - 1)
419 return;
420 332
421 start = addr;
422 pgd = pgd_offset(tlb->mm, addr); 333 pgd = pgd_offset(tlb->mm, addr);
423 do { 334 do {
424 psize = get_slice_psize(tlb->mm, addr);
425 BUG_ON(!mmu_huge_psizes[psize]);
426 next = pgd_addr_end(addr, end); 335 next = pgd_addr_end(addr, end);
427 if (mmu_psize_to_shift(psize) < PUD_SHIFT) { 336 if (!is_hugepd(pgd)) {
428 if (pgd_none_or_clear_bad(pgd)) 337 if (pgd_none_or_clear_bad(pgd))
429 continue; 338 continue;
430 hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling); 339 hugetlb_free_pud_range(tlb, pgd, addr, next, floor, ceiling);
431 } else { 340 } else {
432 if (pgd_none(*pgd)) 341 free_hugepd_range(tlb, (hugepd_t *)pgd, PGDIR_SHIFT,
433 continue; 342 addr, next, floor, ceiling);
434 free_hugepte_range(tlb, (hugepd_t *)pgd, psize);
435 } 343 }
436 } while (pgd++, addr = next, addr != end); 344 } while (pgd++, addr = next, addr != end);
437} 345}
438 346
439void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
440 pte_t *ptep, pte_t pte)
441{
442 if (pte_present(*ptep)) {
443 /* We open-code pte_clear because we need to pass the right
444 * argument to hpte_need_flush (huge / !huge). Might not be
445 * necessary anymore if we make hpte_need_flush() get the
446 * page size from the slices
447 */
448 unsigned int psize = get_slice_psize(mm, addr);
449 unsigned int shift = mmu_psize_to_shift(psize);
450 unsigned long sz = ((1UL) << shift);
451 struct hstate *hstate = size_to_hstate(sz);
452 pte_update(mm, addr & hstate->mask, ptep, ~0UL, 1);
453 }
454 *ptep = __pte(pte_val(pte) & ~_PAGE_HPTEFLAGS);
455}
456
457pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,
458 pte_t *ptep)
459{
460 unsigned long old = pte_update(mm, addr, ptep, ~0UL, 1);
461 return __pte(old);
462}
463
464struct page * 347struct page *
465follow_huge_addr(struct mm_struct *mm, unsigned long address, int write) 348follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
466{ 349{
467 pte_t *ptep; 350 pte_t *ptep;
468 struct page *page; 351 struct page *page;
469 unsigned int mmu_psize = get_slice_psize(mm, address); 352 unsigned shift;
353 unsigned long mask;
354
355 ptep = find_linux_pte_or_hugepte(mm->pgd, address, &shift);
470 356
471 /* Verify it is a huge page else bail. */ 357 /* Verify it is a huge page else bail. */
472 if (!mmu_huge_psizes[mmu_psize]) 358 if (!ptep || !shift)
473 return ERR_PTR(-EINVAL); 359 return ERR_PTR(-EINVAL);
474 360
475 ptep = huge_pte_offset(mm, address); 361 mask = (1UL << shift) - 1;
476 page = pte_page(*ptep); 362 page = pte_page(*ptep);
477 if (page) { 363 if (page)
478 unsigned int shift = mmu_psize_to_shift(mmu_psize); 364 page += (address & mask) / PAGE_SIZE;
479 unsigned long sz = ((1UL) << shift);
480 page += (address % sz) / PAGE_SIZE;
481 }
482 365
483 return page; 366 return page;
484} 367}
@@ -501,6 +384,82 @@ follow_huge_pmd(struct mm_struct *mm, unsigned long address,
501 return NULL; 384 return NULL;
502} 385}
503 386
387static noinline int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr,
388 unsigned long end, int write, struct page **pages, int *nr)
389{
390 unsigned long mask;
391 unsigned long pte_end;
392 struct page *head, *page;
393 pte_t pte;
394 int refs;
395
396 pte_end = (addr + sz) & ~(sz-1);
397 if (pte_end < end)
398 end = pte_end;
399
400 pte = *ptep;
401 mask = _PAGE_PRESENT | _PAGE_USER;
402 if (write)
403 mask |= _PAGE_RW;
404
405 if ((pte_val(pte) & mask) != mask)
406 return 0;
407
408 /* hugepages are never "special" */
409 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
410
411 refs = 0;
412 head = pte_page(pte);
413
414 page = head + ((addr & (sz-1)) >> PAGE_SHIFT);
415 do {
416 VM_BUG_ON(compound_head(page) != head);
417 pages[*nr] = page;
418 (*nr)++;
419 page++;
420 refs++;
421 } while (addr += PAGE_SIZE, addr != end);
422
423 if (!page_cache_add_speculative(head, refs)) {
424 *nr -= refs;
425 return 0;
426 }
427
428 if (unlikely(pte_val(pte) != pte_val(*ptep))) {
429 /* Could be optimized better */
430 while (*nr) {
431 put_page(page);
432 (*nr)--;
433 }
434 }
435
436 return 1;
437}
438
439static unsigned long hugepte_addr_end(unsigned long addr, unsigned long end,
440 unsigned long sz)
441{
442 unsigned long __boundary = (addr + sz) & ~(sz-1);
443 return (__boundary - 1 < end - 1) ? __boundary : end;
444}
445
446int gup_hugepd(hugepd_t *hugepd, unsigned pdshift,
447 unsigned long addr, unsigned long end,
448 int write, struct page **pages, int *nr)
449{
450 pte_t *ptep;
451 unsigned long sz = 1UL << hugepd_shift(*hugepd);
452 unsigned long next;
453
454 ptep = hugepte_offset(hugepd, addr, pdshift);
455 do {
456 next = hugepte_addr_end(addr, end, sz);
457 if (!gup_hugepte(ptep, sz, addr, end, write, pages, nr))
458 return 0;
459 } while (ptep++, addr = next, addr != end);
460
461 return 1;
462}
504 463
505unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr, 464unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
506 unsigned long len, unsigned long pgoff, 465 unsigned long len, unsigned long pgoff,
@@ -509,8 +468,6 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
509 struct hstate *hstate = hstate_file(file); 468 struct hstate *hstate = hstate_file(file);
510 int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate)); 469 int mmu_psize = shift_to_mmu_psize(huge_page_shift(hstate));
511 470
512 if (!mmu_huge_psizes[mmu_psize])
513 return -EINVAL;
514 return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1, 0); 471 return slice_get_unmapped_area(addr, len, flags, mmu_psize, 1, 0);
515} 472}
516 473
@@ -521,229 +478,46 @@ unsigned long vma_mmu_pagesize(struct vm_area_struct *vma)
521 return 1UL << mmu_psize_to_shift(psize); 478 return 1UL << mmu_psize_to_shift(psize);
522} 479}
523 480
524/* 481static int __init add_huge_page_size(unsigned long long size)
525 * Called by asm hashtable.S for doing lazy icache flush
526 */
527static unsigned int hash_huge_page_do_lazy_icache(unsigned long rflags,
528 pte_t pte, int trap, unsigned long sz)
529{ 482{
530 struct page *page; 483 int shift = __ffs(size);
531 int i; 484 int mmu_psize;
532
533 if (!pfn_valid(pte_pfn(pte)))
534 return rflags;
535
536 page = pte_page(pte);
537
538 /* page is dirty */
539 if (!test_bit(PG_arch_1, &page->flags) && !PageReserved(page)) {
540 if (trap == 0x400) {
541 for (i = 0; i < (sz / PAGE_SIZE); i++)
542 __flush_dcache_icache(page_address(page+i));
543 set_bit(PG_arch_1, &page->flags);
544 } else {
545 rflags |= HPTE_R_N;
546 }
547 }
548 return rflags;
549}
550 485
551int hash_huge_page(struct mm_struct *mm, unsigned long access, 486 /* Check that it is a page size supported by the hardware and
552 unsigned long ea, unsigned long vsid, int local, 487 * that it fits within pagetable and slice limits. */
553 unsigned long trap) 488 if (!is_power_of_2(size)
554{ 489 || (shift > SLICE_HIGH_SHIFT) || (shift <= PAGE_SHIFT))
555 pte_t *ptep; 490 return -EINVAL;
556 unsigned long old_pte, new_pte;
557 unsigned long va, rflags, pa, sz;
558 long slot;
559 int err = 1;
560 int ssize = user_segment_size(ea);
561 unsigned int mmu_psize;
562 int shift;
563 mmu_psize = get_slice_psize(mm, ea);
564
565 if (!mmu_huge_psizes[mmu_psize])
566 goto out;
567 ptep = huge_pte_offset(mm, ea);
568
569 /* Search the Linux page table for a match with va */
570 va = hpt_va(ea, vsid, ssize);
571 491
572 /* 492 if ((mmu_psize = shift_to_mmu_psize(shift)) < 0)
573 * If no pte found or not present, send the problem up to 493 return -EINVAL;
574 * do_page_fault
575 */
576 if (unlikely(!ptep || pte_none(*ptep)))
577 goto out;
578 494
579 /* 495#ifdef CONFIG_SPU_FS_64K_LS
580 * Check the user's access rights to the page. If access should be 496 /* Disable support for 64K huge pages when 64K SPU local store
581 * prevented then send the problem up to do_page_fault. 497 * support is enabled as the current implementation conflicts.
582 */ 498 */
583 if (unlikely(access & ~pte_val(*ptep))) 499 if (shift == PAGE_SHIFT_64K)
584 goto out; 500 return -EINVAL;
585 /* 501#endif /* CONFIG_SPU_FS_64K_LS */
586 * At this point, we have a pte (old_pte) which can be used to build
587 * or update an HPTE. There are 2 cases:
588 *
589 * 1. There is a valid (present) pte with no associated HPTE (this is
590 * the most common case)
591 * 2. There is a valid (present) pte with an associated HPTE. The
592 * current values of the pp bits in the HPTE prevent access
593 * because we are doing software DIRTY bit management and the
594 * page is currently not DIRTY.
595 */
596
597
598 do {
599 old_pte = pte_val(*ptep);
600 if (old_pte & _PAGE_BUSY)
601 goto out;
602 new_pte = old_pte | _PAGE_BUSY | _PAGE_ACCESSED;
603 } while(old_pte != __cmpxchg_u64((unsigned long *)ptep,
604 old_pte, new_pte));
605
606 rflags = 0x2 | (!(new_pte & _PAGE_RW));
607 /* _PAGE_EXEC -> HW_NO_EXEC since it's inverted */
608 rflags |= ((new_pte & _PAGE_EXEC) ? 0 : HPTE_R_N);
609 shift = mmu_psize_to_shift(mmu_psize);
610 sz = ((1UL) << shift);
611 if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
612 /* No CPU has hugepages but lacks no execute, so we
613 * don't need to worry about that case */
614 rflags = hash_huge_page_do_lazy_icache(rflags, __pte(old_pte),
615 trap, sz);
616
617 /* Check if pte already has an hpte (case 2) */
618 if (unlikely(old_pte & _PAGE_HASHPTE)) {
619 /* There MIGHT be an HPTE for this pte */
620 unsigned long hash, slot;
621
622 hash = hpt_hash(va, shift, ssize);
623 if (old_pte & _PAGE_F_SECOND)
624 hash = ~hash;
625 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
626 slot += (old_pte & _PAGE_F_GIX) >> 12;
627
628 if (ppc_md.hpte_updatepp(slot, rflags, va, mmu_psize,
629 ssize, local) == -1)
630 old_pte &= ~_PAGE_HPTEFLAGS;
631 }
632
633 if (likely(!(old_pte & _PAGE_HASHPTE))) {
634 unsigned long hash = hpt_hash(va, shift, ssize);
635 unsigned long hpte_group;
636
637 pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT;
638
639repeat:
640 hpte_group = ((hash & htab_hash_mask) *
641 HPTES_PER_GROUP) & ~0x7UL;
642
643 /* clear HPTE slot informations in new PTE */
644#ifdef CONFIG_PPC_64K_PAGES
645 new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0;
646#else
647 new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HASHPTE;
648#endif
649 /* Add in WIMG bits */
650 rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
651 _PAGE_COHERENT | _PAGE_GUARDED));
652
653 /* Insert into the hash table, primary slot */
654 slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags, 0,
655 mmu_psize, ssize);
656
657 /* Primary is full, try the secondary */
658 if (unlikely(slot == -1)) {
659 hpte_group = ((~hash & htab_hash_mask) *
660 HPTES_PER_GROUP) & ~0x7UL;
661 slot = ppc_md.hpte_insert(hpte_group, va, pa, rflags,
662 HPTE_V_SECONDARY,
663 mmu_psize, ssize);
664 if (slot == -1) {
665 if (mftb() & 0x1)
666 hpte_group = ((hash & htab_hash_mask) *
667 HPTES_PER_GROUP)&~0x7UL;
668
669 ppc_md.hpte_remove(hpte_group);
670 goto repeat;
671 }
672 }
673
674 if (unlikely(slot == -2))
675 panic("hash_huge_page: pte_insert failed\n");
676
677 new_pte |= (slot << 12) & (_PAGE_F_SECOND | _PAGE_F_GIX);
678 }
679 502
680 /* 503 BUG_ON(mmu_psize_defs[mmu_psize].shift != shift);
681 * No need to use ldarx/stdcx here
682 */
683 *ptep = __pte(new_pte & ~_PAGE_BUSY);
684 504
685 err = 0; 505 /* Return if huge page size has already been setup */
506 if (size_to_hstate(size))
507 return 0;
686 508
687 out: 509 hugetlb_add_hstate(shift - PAGE_SHIFT);
688 return err;
689}
690 510
691static void __init set_huge_psize(int psize) 511 return 0;
692{
693 /* Check that it is a page size supported by the hardware and
694 * that it fits within pagetable limits. */
695 if (mmu_psize_defs[psize].shift &&
696 mmu_psize_defs[psize].shift < SID_SHIFT_1T &&
697 (mmu_psize_defs[psize].shift > MIN_HUGEPTE_SHIFT ||
698 mmu_psize_defs[psize].shift == PAGE_SHIFT_64K ||
699 mmu_psize_defs[psize].shift == PAGE_SHIFT_16G)) {
700 /* Return if huge page size has already been setup or is the
701 * same as the base page size. */
702 if (mmu_huge_psizes[psize] ||
703 mmu_psize_defs[psize].shift == PAGE_SHIFT)
704 return;
705 if (WARN_ON(HUGEPTE_CACHE_NAME(psize) == NULL))
706 return;
707 hugetlb_add_hstate(mmu_psize_defs[psize].shift - PAGE_SHIFT);
708
709 switch (mmu_psize_defs[psize].shift) {
710 case PAGE_SHIFT_64K:
711 /* We only allow 64k hpages with 4k base page,
712 * which was checked above, and always put them
713 * at the PMD */
714 hugepte_shift[psize] = PMD_SHIFT;
715 break;
716 case PAGE_SHIFT_16M:
717 /* 16M pages can be at two different levels
718 * of pagestables based on base page size */
719 if (PAGE_SHIFT == PAGE_SHIFT_64K)
720 hugepte_shift[psize] = PMD_SHIFT;
721 else /* 4k base page */
722 hugepte_shift[psize] = PUD_SHIFT;
723 break;
724 case PAGE_SHIFT_16G:
725 /* 16G pages are always at PGD level */
726 hugepte_shift[psize] = PGDIR_SHIFT;
727 break;
728 }
729 hugepte_shift[psize] -= mmu_psize_defs[psize].shift;
730 } else
731 hugepte_shift[psize] = 0;
732} 512}
733 513
734static int __init hugepage_setup_sz(char *str) 514static int __init hugepage_setup_sz(char *str)
735{ 515{
736 unsigned long long size; 516 unsigned long long size;
737 int mmu_psize;
738 int shift;
739 517
740 size = memparse(str, &str); 518 size = memparse(str, &str);
741 519
742 shift = __ffs(size); 520 if (add_huge_page_size(size) != 0)
743 mmu_psize = shift_to_mmu_psize(shift);
744 if (mmu_psize >= 0 && mmu_psize_defs[mmu_psize].shift)
745 set_huge_psize(mmu_psize);
746 else
747 printk(KERN_WARNING "Invalid huge page size specified(%llu)\n", size); 521 printk(KERN_WARNING "Invalid huge page size specified(%llu)\n", size);
748 522
749 return 1; 523 return 1;
@@ -752,41 +526,55 @@ __setup("hugepagesz=", hugepage_setup_sz);
752 526
753static int __init hugetlbpage_init(void) 527static int __init hugetlbpage_init(void)
754{ 528{
755 unsigned int psize; 529 int psize;
756 530
757 if (!cpu_has_feature(CPU_FTR_16M_PAGE)) 531 if (!cpu_has_feature(CPU_FTR_16M_PAGE))
758 return -ENODEV; 532 return -ENODEV;
759 533
760 /* Add supported huge page sizes. Need to change HUGE_MAX_HSTATE 534 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
761 * and adjust PTE_NONCACHE_NUM if the number of supported huge page 535 unsigned shift;
762 * sizes changes. 536 unsigned pdshift;
763 */
764 set_huge_psize(MMU_PAGE_16M);
765 set_huge_psize(MMU_PAGE_16G);
766 537
767 /* Temporarily disable support for 64K huge pages when 64K SPU local 538 if (!mmu_psize_defs[psize].shift)
768 * store support is enabled as the current implementation conflicts. 539 continue;
769 */
770#ifndef CONFIG_SPU_FS_64K_LS
771 set_huge_psize(MMU_PAGE_64K);
772#endif
773 540
774 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) { 541 shift = mmu_psize_to_shift(psize);
775 if (mmu_huge_psizes[psize]) { 542
776 pgtable_cache[HUGE_PGTABLE_INDEX(psize)] = 543 if (add_huge_page_size(1ULL << shift) < 0)
777 kmem_cache_create( 544 continue;
778 HUGEPTE_CACHE_NAME(psize), 545
779 HUGEPTE_TABLE_SIZE(psize), 546 if (shift < PMD_SHIFT)
780 HUGEPTE_TABLE_SIZE(psize), 547 pdshift = PMD_SHIFT;
781 0, 548 else if (shift < PUD_SHIFT)
782 NULL); 549 pdshift = PUD_SHIFT;
783 if (!pgtable_cache[HUGE_PGTABLE_INDEX(psize)]) 550 else
784 panic("hugetlbpage_init(): could not create %s"\ 551 pdshift = PGDIR_SHIFT;
785 "\n", HUGEPTE_CACHE_NAME(psize)); 552
786 } 553 pgtable_cache_add(pdshift - shift, NULL);
554 if (!PGT_CACHE(pdshift - shift))
555 panic("hugetlbpage_init(): could not create "
556 "pgtable cache for %d bit pagesize\n", shift);
787 } 557 }
788 558
559 /* Set default large page size. Currently, we pick 16M or 1M
560 * depending on what is available
561 */
562 if (mmu_psize_defs[MMU_PAGE_16M].shift)
563 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_16M].shift;
564 else if (mmu_psize_defs[MMU_PAGE_1M].shift)
565 HPAGE_SHIFT = mmu_psize_defs[MMU_PAGE_1M].shift;
566
789 return 0; 567 return 0;
790} 568}
791 569
792module_init(hugetlbpage_init); 570module_init(hugetlbpage_init);
571
572void flush_dcache_icache_hugepage(struct page *page)
573{
574 int i;
575
576 BUG_ON(!PageCompound(page));
577
578 for (i = 0; i < (1UL << compound_order(page)); i++)
579 __flush_dcache_icache(page_address(page+i));
580}
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 335c578b9cc3..776f28d02b6b 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -41,6 +41,7 @@
41#include <linux/module.h> 41#include <linux/module.h>
42#include <linux/poison.h> 42#include <linux/poison.h>
43#include <linux/lmb.h> 43#include <linux/lmb.h>
44#include <linux/hugetlb.h>
44 45
45#include <asm/pgalloc.h> 46#include <asm/pgalloc.h>
46#include <asm/page.h> 47#include <asm/page.h>
@@ -119,30 +120,63 @@ static void pmd_ctor(void *addr)
119 memset(addr, 0, PMD_TABLE_SIZE); 120 memset(addr, 0, PMD_TABLE_SIZE);
120} 121}
121 122
122static const unsigned int pgtable_cache_size[2] = { 123struct kmem_cache *pgtable_cache[MAX_PGTABLE_INDEX_SIZE];
123 PGD_TABLE_SIZE, PMD_TABLE_SIZE 124
124}; 125/*
125static const char *pgtable_cache_name[ARRAY_SIZE(pgtable_cache_size)] = { 126 * Create a kmem_cache() for pagetables. This is not used for PTE
126#ifdef CONFIG_PPC_64K_PAGES 127 * pages - they're linked to struct page, come from the normal free
127 "pgd_cache", "pmd_cache", 128 * pages pool and have a different entry size (see real_pte_t) to
128#else 129 * everything else. Caches created by this function are used for all
129 "pgd_cache", "pud_pmd_cache", 130 * the higher level pagetables, and for hugepage pagetables.
130#endif /* CONFIG_PPC_64K_PAGES */ 131 */
131}; 132void pgtable_cache_add(unsigned shift, void (*ctor)(void *))
132 133{
133#ifdef CONFIG_HUGETLB_PAGE 134 char *name;
134/* Hugepages need an extra cache per hugepagesize, initialized in 135 unsigned long table_size = sizeof(void *) << shift;
135 * hugetlbpage.c. We can't put into the tables above, because HPAGE_SHIFT 136 unsigned long align = table_size;
136 * is not compile time constant. */ 137
137struct kmem_cache *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)+MMU_PAGE_COUNT]; 138 /* When batching pgtable pointers for RCU freeing, we store
138#else 139 * the index size in the low bits. Table alignment must be
139struct kmem_cache *pgtable_cache[ARRAY_SIZE(pgtable_cache_size)]; 140 * big enough to fit it.
140#endif 141 *
142 * Likewise, hugeapge pagetable pointers contain a (different)
143 * shift value in the low bits. All tables must be aligned so
144 * as to leave enough 0 bits in the address to contain it. */
145 unsigned long minalign = max(MAX_PGTABLE_INDEX_SIZE + 1,
146 HUGEPD_SHIFT_MASK + 1);
147 struct kmem_cache *new;
148
149 /* It would be nice if this was a BUILD_BUG_ON(), but at the
150 * moment, gcc doesn't seem to recognize is_power_of_2 as a
151 * constant expression, so so much for that. */
152 BUG_ON(!is_power_of_2(minalign));
153 BUG_ON((shift < 1) || (shift > MAX_PGTABLE_INDEX_SIZE));
154
155 if (PGT_CACHE(shift))
156 return; /* Already have a cache of this size */
157
158 align = max_t(unsigned long, align, minalign);
159 name = kasprintf(GFP_KERNEL, "pgtable-2^%d", shift);
160 new = kmem_cache_create(name, table_size, align, 0, ctor);
161 PGT_CACHE(shift) = new;
162
163 pr_debug("Allocated pgtable cache for order %d\n", shift);
164}
165
141 166
142void pgtable_cache_init(void) 167void pgtable_cache_init(void)
143{ 168{
144 pgtable_cache[0] = kmem_cache_create(pgtable_cache_name[0], PGD_TABLE_SIZE, PGD_TABLE_SIZE, SLAB_PANIC, pgd_ctor); 169 pgtable_cache_add(PGD_INDEX_SIZE, pgd_ctor);
145 pgtable_cache[1] = kmem_cache_create(pgtable_cache_name[1], PMD_TABLE_SIZE, PMD_TABLE_SIZE, SLAB_PANIC, pmd_ctor); 170 pgtable_cache_add(PMD_INDEX_SIZE, pmd_ctor);
171 if (!PGT_CACHE(PGD_INDEX_SIZE) || !PGT_CACHE(PMD_INDEX_SIZE))
172 panic("Couldn't allocate pgtable caches");
173
174 /* In all current configs, when the PUD index exists it's the
175 * same size as either the pgd or pmd index. Verify that the
176 * initialization above has also created a PUD cache. This
177 * will need re-examiniation if we add new possibilities for
178 * the pagetable layout. */
179 BUG_ON(PUD_INDEX_SIZE && !PGT_CACHE(PUD_INDEX_SIZE));
146} 180}
147 181
148#ifdef CONFIG_SPARSEMEM_VMEMMAP 182#ifdef CONFIG_SPARSEMEM_VMEMMAP
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 59736317bf0e..b9b152558f9c 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -32,6 +32,7 @@
32#include <linux/pagemap.h> 32#include <linux/pagemap.h>
33#include <linux/suspend.h> 33#include <linux/suspend.h>
34#include <linux/lmb.h> 34#include <linux/lmb.h>
35#include <linux/hugetlb.h>
35 36
36#include <asm/pgalloc.h> 37#include <asm/pgalloc.h>
37#include <asm/prom.h> 38#include <asm/prom.h>
@@ -417,18 +418,26 @@ EXPORT_SYMBOL(flush_dcache_page);
417 418
418void flush_dcache_icache_page(struct page *page) 419void flush_dcache_icache_page(struct page *page)
419{ 420{
421#ifdef CONFIG_HUGETLB_PAGE
422 if (PageCompound(page)) {
423 flush_dcache_icache_hugepage(page);
424 return;
425 }
426#endif
420#ifdef CONFIG_BOOKE 427#ifdef CONFIG_BOOKE
421 void *start = kmap_atomic(page, KM_PPC_SYNC_ICACHE); 428 {
422 __flush_dcache_icache(start); 429 void *start = kmap_atomic(page, KM_PPC_SYNC_ICACHE);
423 kunmap_atomic(start, KM_PPC_SYNC_ICACHE); 430 __flush_dcache_icache(start);
431 kunmap_atomic(start, KM_PPC_SYNC_ICACHE);
432 }
424#elif defined(CONFIG_8xx) || defined(CONFIG_PPC64) 433#elif defined(CONFIG_8xx) || defined(CONFIG_PPC64)
425 /* On 8xx there is no need to kmap since highmem is not supported */ 434 /* On 8xx there is no need to kmap since highmem is not supported */
426 __flush_dcache_icache(page_address(page)); 435 __flush_dcache_icache(page_address(page));
427#else 436#else
428 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT); 437 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
429#endif 438#endif
430
431} 439}
440
432void clear_user_page(void *page, unsigned long vaddr, struct page *pg) 441void clear_user_page(void *page, unsigned long vaddr, struct page *pg)
433{ 442{
434 clear_page(page); 443 clear_page(page);
diff --git a/arch/powerpc/mm/mmu_context_hash64.c b/arch/powerpc/mm/mmu_context_hash64.c
index dbeb86ac90cd..b910d37aea1a 100644
--- a/arch/powerpc/mm/mmu_context_hash64.c
+++ b/arch/powerpc/mm/mmu_context_hash64.c
@@ -18,6 +18,7 @@
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/idr.h> 20#include <linux/idr.h>
21#include <linux/module.h>
21 22
22#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
23 24
@@ -32,7 +33,7 @@ static DEFINE_IDR(mmu_context_idr);
32#define NO_CONTEXT 0 33#define NO_CONTEXT 0
33#define MAX_CONTEXT ((1UL << 19) - 1) 34#define MAX_CONTEXT ((1UL << 19) - 1)
34 35
35int init_new_context(struct task_struct *tsk, struct mm_struct *mm) 36int __init_new_context(void)
36{ 37{
37 int index; 38 int index;
38 int err; 39 int err;
@@ -57,22 +58,41 @@ again:
57 return -ENOMEM; 58 return -ENOMEM;
58 } 59 }
59 60
61 return index;
62}
63EXPORT_SYMBOL_GPL(__init_new_context);
64
65int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
66{
67 int index;
68
69 index = __init_new_context();
70 if (index < 0)
71 return index;
72
60 /* The old code would re-promote on fork, we don't do that 73 /* The old code would re-promote on fork, we don't do that
61 * when using slices as it could cause problem promoting slices 74 * when using slices as it could cause problem promoting slices
62 * that have been forced down to 4K 75 * that have been forced down to 4K
63 */ 76 */
64 if (slice_mm_new_context(mm)) 77 if (slice_mm_new_context(mm))
65 slice_set_user_psize(mm, mmu_virtual_psize); 78 slice_set_user_psize(mm, mmu_virtual_psize);
79 subpage_prot_init_new_context(mm);
66 mm->context.id = index; 80 mm->context.id = index;
67 81
68 return 0; 82 return 0;
69} 83}
70 84
71void destroy_context(struct mm_struct *mm) 85void __destroy_context(int context_id)
72{ 86{
73 spin_lock(&mmu_context_lock); 87 spin_lock(&mmu_context_lock);
74 idr_remove(&mmu_context_idr, mm->context.id); 88 idr_remove(&mmu_context_idr, context_id);
75 spin_unlock(&mmu_context_lock); 89 spin_unlock(&mmu_context_lock);
90}
91EXPORT_SYMBOL_GPL(__destroy_context);
76 92
93void destroy_context(struct mm_struct *mm)
94{
95 __destroy_context(mm->context.id);
96 subpage_prot_free(mm);
77 mm->context.id = NO_CONTEXT; 97 mm->context.id = NO_CONTEXT;
78} 98}
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index d2e5321d5ea6..e27a990af42d 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -98,21 +98,10 @@ extern void _tlbia(void);
98 98
99#ifdef CONFIG_PPC32 99#ifdef CONFIG_PPC32
100 100
101struct tlbcam {
102 u32 MAS0;
103 u32 MAS1;
104 u32 MAS2;
105 u32 MAS3;
106 u32 MAS7;
107};
108
109extern void mapin_ram(void); 101extern void mapin_ram(void);
110extern int map_page(unsigned long va, phys_addr_t pa, int flags); 102extern int map_page(unsigned long va, phys_addr_t pa, int flags);
111extern void setbat(int index, unsigned long virt, phys_addr_t phys, 103extern void setbat(int index, unsigned long virt, phys_addr_t phys,
112 unsigned int size, int flags); 104 unsigned int size, int flags);
113extern void settlbcam(int index, unsigned long virt, phys_addr_t phys,
114 unsigned int size, int flags, unsigned int pid);
115extern void invalidate_tlbcam_entry(int index);
116 105
117extern int __map_without_bats; 106extern int __map_without_bats;
118extern unsigned long ioremap_base; 107extern unsigned long ioremap_base;
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index 53040931de32..99df697c601a 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -49,12 +49,12 @@ struct pte_freelist_batch
49{ 49{
50 struct rcu_head rcu; 50 struct rcu_head rcu;
51 unsigned int index; 51 unsigned int index;
52 pgtable_free_t tables[0]; 52 unsigned long tables[0];
53}; 53};
54 54
55#define PTE_FREELIST_SIZE \ 55#define PTE_FREELIST_SIZE \
56 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \ 56 ((PAGE_SIZE - sizeof(struct pte_freelist_batch)) \
57 / sizeof(pgtable_free_t)) 57 / sizeof(unsigned long))
58 58
59static void pte_free_smp_sync(void *arg) 59static void pte_free_smp_sync(void *arg)
60{ 60{
@@ -64,13 +64,13 @@ static void pte_free_smp_sync(void *arg)
64/* This is only called when we are critically out of memory 64/* This is only called when we are critically out of memory
65 * (and fail to get a page in pte_free_tlb). 65 * (and fail to get a page in pte_free_tlb).
66 */ 66 */
67static void pgtable_free_now(pgtable_free_t pgf) 67static void pgtable_free_now(void *table, unsigned shift)
68{ 68{
69 pte_freelist_forced_free++; 69 pte_freelist_forced_free++;
70 70
71 smp_call_function(pte_free_smp_sync, NULL, 1); 71 smp_call_function(pte_free_smp_sync, NULL, 1);
72 72
73 pgtable_free(pgf); 73 pgtable_free(table, shift);
74} 74}
75 75
76static void pte_free_rcu_callback(struct rcu_head *head) 76static void pte_free_rcu_callback(struct rcu_head *head)
@@ -79,8 +79,12 @@ static void pte_free_rcu_callback(struct rcu_head *head)
79 container_of(head, struct pte_freelist_batch, rcu); 79 container_of(head, struct pte_freelist_batch, rcu);
80 unsigned int i; 80 unsigned int i;
81 81
82 for (i = 0; i < batch->index; i++) 82 for (i = 0; i < batch->index; i++) {
83 pgtable_free(batch->tables[i]); 83 void *table = (void *)(batch->tables[i] & ~MAX_PGTABLE_INDEX_SIZE);
84 unsigned shift = batch->tables[i] & MAX_PGTABLE_INDEX_SIZE;
85
86 pgtable_free(table, shift);
87 }
84 88
85 free_page((unsigned long)batch); 89 free_page((unsigned long)batch);
86} 90}
@@ -91,25 +95,28 @@ static void pte_free_submit(struct pte_freelist_batch *batch)
91 call_rcu(&batch->rcu, pte_free_rcu_callback); 95 call_rcu(&batch->rcu, pte_free_rcu_callback);
92} 96}
93 97
94void pgtable_free_tlb(struct mmu_gather *tlb, pgtable_free_t pgf) 98void pgtable_free_tlb(struct mmu_gather *tlb, void *table, unsigned shift)
95{ 99{
96 /* This is safe since tlb_gather_mmu has disabled preemption */ 100 /* This is safe since tlb_gather_mmu has disabled preemption */
97 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur); 101 struct pte_freelist_batch **batchp = &__get_cpu_var(pte_freelist_cur);
102 unsigned long pgf;
98 103
99 if (atomic_read(&tlb->mm->mm_users) < 2 || 104 if (atomic_read(&tlb->mm->mm_users) < 2 ||
100 cpumask_equal(mm_cpumask(tlb->mm), cpumask_of(smp_processor_id()))){ 105 cpumask_equal(mm_cpumask(tlb->mm), cpumask_of(smp_processor_id()))){
101 pgtable_free(pgf); 106 pgtable_free(table, shift);
102 return; 107 return;
103 } 108 }
104 109
105 if (*batchp == NULL) { 110 if (*batchp == NULL) {
106 *batchp = (struct pte_freelist_batch *)__get_free_page(GFP_ATOMIC); 111 *batchp = (struct pte_freelist_batch *)__get_free_page(GFP_ATOMIC);
107 if (*batchp == NULL) { 112 if (*batchp == NULL) {
108 pgtable_free_now(pgf); 113 pgtable_free_now(table, shift);
109 return; 114 return;
110 } 115 }
111 (*batchp)->index = 0; 116 (*batchp)->index = 0;
112 } 117 }
118 BUG_ON(shift > MAX_PGTABLE_INDEX_SIZE);
119 pgf = (unsigned long)table | shift;
113 (*batchp)->tables[(*batchp)->index++] = pgf; 120 (*batchp)->tables[(*batchp)->index++] = pgf;
114 if ((*batchp)->index == PTE_FREELIST_SIZE) { 121 if ((*batchp)->index == PTE_FREELIST_SIZE) {
115 pte_free_submit(*batchp); 122 pte_free_submit(*batchp);
diff --git a/arch/powerpc/mm/subpage-prot.c b/arch/powerpc/mm/subpage-prot.c
index 4cafc0c33d0a..a040b81e93bd 100644
--- a/arch/powerpc/mm/subpage-prot.c
+++ b/arch/powerpc/mm/subpage-prot.c
@@ -24,9 +24,9 @@
24 * Also makes sure that the subpage_prot_table structure is 24 * Also makes sure that the subpage_prot_table structure is
25 * reinitialized for the next user. 25 * reinitialized for the next user.
26 */ 26 */
27void subpage_prot_free(pgd_t *pgd) 27void subpage_prot_free(struct mm_struct *mm)
28{ 28{
29 struct subpage_prot_table *spt = pgd_subpage_prot(pgd); 29 struct subpage_prot_table *spt = &mm->context.spt;
30 unsigned long i, j, addr; 30 unsigned long i, j, addr;
31 u32 **p; 31 u32 **p;
32 32
@@ -51,6 +51,13 @@ void subpage_prot_free(pgd_t *pgd)
51 spt->maxaddr = 0; 51 spt->maxaddr = 0;
52} 52}
53 53
54void subpage_prot_init_new_context(struct mm_struct *mm)
55{
56 struct subpage_prot_table *spt = &mm->context.spt;
57
58 memset(spt, 0, sizeof(*spt));
59}
60
54static void hpte_flush_range(struct mm_struct *mm, unsigned long addr, 61static void hpte_flush_range(struct mm_struct *mm, unsigned long addr,
55 int npages) 62 int npages)
56{ 63{
@@ -87,7 +94,7 @@ static void hpte_flush_range(struct mm_struct *mm, unsigned long addr,
87static void subpage_prot_clear(unsigned long addr, unsigned long len) 94static void subpage_prot_clear(unsigned long addr, unsigned long len)
88{ 95{
89 struct mm_struct *mm = current->mm; 96 struct mm_struct *mm = current->mm;
90 struct subpage_prot_table *spt = pgd_subpage_prot(mm->pgd); 97 struct subpage_prot_table *spt = &mm->context.spt;
91 u32 **spm, *spp; 98 u32 **spm, *spp;
92 int i, nw; 99 int i, nw;
93 unsigned long next, limit; 100 unsigned long next, limit;
@@ -136,7 +143,7 @@ static void subpage_prot_clear(unsigned long addr, unsigned long len)
136long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map) 143long sys_subpage_prot(unsigned long addr, unsigned long len, u32 __user *map)
137{ 144{
138 struct mm_struct *mm = current->mm; 145 struct mm_struct *mm = current->mm;
139 struct subpage_prot_table *spt = pgd_subpage_prot(mm->pgd); 146 struct subpage_prot_table *spt = &mm->context.spt;
140 u32 **spm, *spp; 147 u32 **spm, *spp;
141 int i, nw; 148 int i, nw;
142 unsigned long next, limit; 149 unsigned long next, limit;
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c
index 2b2f35f6985e..282d9306361f 100644
--- a/arch/powerpc/mm/tlb_hash64.c
+++ b/arch/powerpc/mm/tlb_hash64.c
@@ -53,11 +53,6 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
53 53
54 i = batch->index; 54 i = batch->index;
55 55
56 /* We mask the address for the base page size. Huge pages will
57 * have applied their own masking already
58 */
59 addr &= PAGE_MASK;
60
61 /* Get page size (maybe move back to caller). 56 /* Get page size (maybe move back to caller).
62 * 57 *
63 * NOTE: when using special 64K mappings in 4K environment like 58 * NOTE: when using special 64K mappings in 4K environment like
@@ -75,6 +70,9 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr,
75 } else 70 } else
76 psize = pte_pagesize_index(mm, addr, pte); 71 psize = pte_pagesize_index(mm, addr, pte);
77 72
73 /* Mask the address for the correct page size */
74 addr &= ~((1UL << mmu_psize_defs[psize].shift) - 1);
75
78 /* Build full vaddr */ 76 /* Build full vaddr */
79 if (!is_kernel_addr(addr)) { 77 if (!is_kernel_addr(addr)) {
80 ssize = user_segment_size(addr); 78 ssize = user_segment_size(addr);
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c
index a6ce80566625..da9b20a63769 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads_cpld.c
@@ -79,7 +79,7 @@ cpld_unmask_irq(unsigned int irq)
79} 79}
80 80
81static struct irq_chip cpld_pic = { 81static struct irq_chip cpld_pic = {
82 .typename = " CPLD PIC ", 82 .name = " CPLD PIC ",
83 .mask = cpld_mask_irq, 83 .mask = cpld_mask_irq,
84 .ack = cpld_mask_irq, 84 .ack = cpld_mask_irq,
85 .unmask = cpld_unmask_irq, 85 .unmask = cpld_unmask_irq,
@@ -132,7 +132,7 @@ static int
132cpld_pic_host_map(struct irq_host *h, unsigned int virq, 132cpld_pic_host_map(struct irq_host *h, unsigned int virq,
133 irq_hw_number_t hw) 133 irq_hw_number_t hw)
134{ 134{
135 get_irq_desc(virq)->status |= IRQ_LEVEL; 135 irq_to_desc(virq)->status |= IRQ_LEVEL;
136 set_irq_chip_and_handler(virq, &cpld_pic, handle_level_irq); 136 set_irq_chip_and_handler(virq, &cpld_pic, handle_level_irq);
137 return 0; 137 return 0;
138} 138}
diff --git a/arch/powerpc/platforms/52xx/Kconfig b/arch/powerpc/platforms/52xx/Kconfig
index 8b8e9560a315..47ea1be1481b 100644
--- a/arch/powerpc/platforms/52xx/Kconfig
+++ b/arch/powerpc/platforms/52xx/Kconfig
@@ -62,3 +62,8 @@ config PPC_MPC5200_GPIO
62 select GENERIC_GPIO 62 select GENERIC_GPIO
63 help 63 help
64 Enable gpiolib support for mpc5200 based boards 64 Enable gpiolib support for mpc5200 based boards
65
66config PPC_MPC5200_LPBFIFO
67 tristate "MPC5200 LocalPlus bus FIFO driver"
68 depends on PPC_MPC52xx
69 select PPC_BESTCOMM_GEN_BD
diff --git a/arch/powerpc/platforms/52xx/Makefile b/arch/powerpc/platforms/52xx/Makefile
index bfd4f52cf3dd..2bc8cd0c5cfc 100644
--- a/arch/powerpc/platforms/52xx/Makefile
+++ b/arch/powerpc/platforms/52xx/Makefile
@@ -15,3 +15,4 @@ ifeq ($(CONFIG_PPC_LITE5200),y)
15endif 15endif
16 16
17obj-$(CONFIG_PPC_MPC5200_GPIO) += mpc52xx_gpio.o 17obj-$(CONFIG_PPC_MPC5200_GPIO) += mpc52xx_gpio.o
18obj-$(CONFIG_PPC_MPC5200_LPBFIFO) += mpc52xx_lpbfifo.o
diff --git a/arch/powerpc/platforms/52xx/media5200.c b/arch/powerpc/platforms/52xx/media5200.c
index 68e4f1696d14..cc0c854291d7 100644
--- a/arch/powerpc/platforms/52xx/media5200.c
+++ b/arch/powerpc/platforms/52xx/media5200.c
@@ -74,7 +74,7 @@ static void media5200_irq_mask(unsigned int virq)
74} 74}
75 75
76static struct irq_chip media5200_irq_chip = { 76static struct irq_chip media5200_irq_chip = {
77 .typename = "Media5200 FPGA", 77 .name = "Media5200 FPGA",
78 .unmask = media5200_irq_unmask, 78 .unmask = media5200_irq_unmask,
79 .mask = media5200_irq_mask, 79 .mask = media5200_irq_mask,
80 .mask_ack = media5200_irq_mask, 80 .mask_ack = media5200_irq_mask,
@@ -114,7 +114,7 @@ void media5200_irq_cascade(unsigned int virq, struct irq_desc *desc)
114static int media5200_irq_map(struct irq_host *h, unsigned int virq, 114static int media5200_irq_map(struct irq_host *h, unsigned int virq,
115 irq_hw_number_t hw) 115 irq_hw_number_t hw)
116{ 116{
117 struct irq_desc *desc = get_irq_desc(virq); 117 struct irq_desc *desc = irq_to_desc(virq);
118 118
119 pr_debug("%s: h=%p, virq=%i, hwirq=%i\n", __func__, h, virq, (int)hw); 119 pr_debug("%s: h=%p, virq=%i, hwirq=%i\n", __func__, h, virq, (int)hw);
120 set_irq_chip_data(virq, &media5200_irq); 120 set_irq_chip_data(virq, &media5200_irq);
@@ -127,7 +127,7 @@ static int media5200_irq_map(struct irq_host *h, unsigned int virq,
127} 127}
128 128
129static int media5200_irq_xlate(struct irq_host *h, struct device_node *ct, 129static int media5200_irq_xlate(struct irq_host *h, struct device_node *ct,
130 u32 *intspec, unsigned int intsize, 130 const u32 *intspec, unsigned int intsize,
131 irq_hw_number_t *out_hwirq, 131 irq_hw_number_t *out_hwirq,
132 unsigned int *out_flags) 132 unsigned int *out_flags)
133{ 133{
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index bfbcd418e690..6f8ebe1085b3 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -16,8 +16,14 @@
16 * output signals or measure input signals. 16 * output signals or measure input signals.
17 * 17 *
18 * This driver supports the GPIO and IRQ controller functions of the GPT 18 * This driver supports the GPIO and IRQ controller functions of the GPT
19 * device. Timer functions are not yet supported, nor is the watchdog 19 * device. Timer functions are not yet supported.
20 * timer. 20 *
21 * The timer gpt0 can be used as watchdog (wdt). If the wdt mode is used,
22 * this prevents the use of any gpt0 gpt function (i.e. they will fail with
23 * -EBUSY). Thus, the safety wdt function always has precedence over the gpt
24 * function. If the kernel has been compiled with CONFIG_WATCHDOG_NOWAYOUT,
25 * this means that gpt0 is locked in wdt mode until the next reboot - this
26 * may be a requirement in safety applications.
21 * 27 *
22 * To use the GPIO function, the following two properties must be added 28 * To use the GPIO function, the following two properties must be added
23 * to the device tree node for the gpt device (typically in the .dts file 29 * to the device tree node for the gpt device (typically in the .dts file
@@ -46,17 +52,24 @@
46 * the output mode. This driver does not change the output mode setting. 52 * the output mode. This driver does not change the output mode setting.
47 */ 53 */
48 54
55#include <linux/device.h>
49#include <linux/irq.h> 56#include <linux/irq.h>
50#include <linux/interrupt.h> 57#include <linux/interrupt.h>
51#include <linux/io.h> 58#include <linux/io.h>
59#include <linux/list.h>
60#include <linux/mutex.h>
52#include <linux/of.h> 61#include <linux/of.h>
53#include <linux/of_platform.h> 62#include <linux/of_platform.h>
54#include <linux/of_gpio.h> 63#include <linux/of_gpio.h>
55#include <linux/kernel.h> 64#include <linux/kernel.h>
65#include <linux/watchdog.h>
66#include <linux/miscdevice.h>
67#include <linux/uaccess.h>
68#include <asm/div64.h>
56#include <asm/mpc52xx.h> 69#include <asm/mpc52xx.h>
57 70
58MODULE_DESCRIPTION("Freescale MPC52xx gpt driver"); 71MODULE_DESCRIPTION("Freescale MPC52xx gpt driver");
59MODULE_AUTHOR("Sascha Hauer, Grant Likely"); 72MODULE_AUTHOR("Sascha Hauer, Grant Likely, Albrecht Dreß");
60MODULE_LICENSE("GPL"); 73MODULE_LICENSE("GPL");
61 74
62/** 75/**
@@ -66,18 +79,27 @@ MODULE_LICENSE("GPL");
66 * @lock: spinlock to coordinate between different functions. 79 * @lock: spinlock to coordinate between different functions.
67 * @of_gc: of_gpio_chip instance structure; used when GPIO is enabled 80 * @of_gc: of_gpio_chip instance structure; used when GPIO is enabled
68 * @irqhost: Pointer to irq_host instance; used when IRQ mode is supported 81 * @irqhost: Pointer to irq_host instance; used when IRQ mode is supported
82 * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicates
83 * if the gpt may be used as wdt, bit 1 (MPC52xx_GPT_IS_WDT) indicates
84 * if the timer is actively used as wdt which blocks gpt functions
69 */ 85 */
70struct mpc52xx_gpt_priv { 86struct mpc52xx_gpt_priv {
87 struct list_head list; /* List of all GPT devices */
71 struct device *dev; 88 struct device *dev;
72 struct mpc52xx_gpt __iomem *regs; 89 struct mpc52xx_gpt __iomem *regs;
73 spinlock_t lock; 90 spinlock_t lock;
74 struct irq_host *irqhost; 91 struct irq_host *irqhost;
92 u32 ipb_freq;
93 u8 wdt_mode;
75 94
76#if defined(CONFIG_GPIOLIB) 95#if defined(CONFIG_GPIOLIB)
77 struct of_gpio_chip of_gc; 96 struct of_gpio_chip of_gc;
78#endif 97#endif
79}; 98};
80 99
100LIST_HEAD(mpc52xx_gpt_list);
101DEFINE_MUTEX(mpc52xx_gpt_list_mutex);
102
81#define MPC52xx_GPT_MODE_MS_MASK (0x07) 103#define MPC52xx_GPT_MODE_MS_MASK (0x07)
82#define MPC52xx_GPT_MODE_MS_IC (0x01) 104#define MPC52xx_GPT_MODE_MS_IC (0x01)
83#define MPC52xx_GPT_MODE_MS_OC (0x02) 105#define MPC52xx_GPT_MODE_MS_OC (0x02)
@@ -88,15 +110,25 @@ struct mpc52xx_gpt_priv {
88#define MPC52xx_GPT_MODE_GPIO_OUT_LOW (0x20) 110#define MPC52xx_GPT_MODE_GPIO_OUT_LOW (0x20)
89#define MPC52xx_GPT_MODE_GPIO_OUT_HIGH (0x30) 111#define MPC52xx_GPT_MODE_GPIO_OUT_HIGH (0x30)
90 112
113#define MPC52xx_GPT_MODE_COUNTER_ENABLE (0x1000)
114#define MPC52xx_GPT_MODE_CONTINUOUS (0x0400)
115#define MPC52xx_GPT_MODE_OPEN_DRAIN (0x0200)
91#define MPC52xx_GPT_MODE_IRQ_EN (0x0100) 116#define MPC52xx_GPT_MODE_IRQ_EN (0x0100)
117#define MPC52xx_GPT_MODE_WDT_EN (0x8000)
92 118
93#define MPC52xx_GPT_MODE_ICT_MASK (0x030000) 119#define MPC52xx_GPT_MODE_ICT_MASK (0x030000)
94#define MPC52xx_GPT_MODE_ICT_RISING (0x010000) 120#define MPC52xx_GPT_MODE_ICT_RISING (0x010000)
95#define MPC52xx_GPT_MODE_ICT_FALLING (0x020000) 121#define MPC52xx_GPT_MODE_ICT_FALLING (0x020000)
96#define MPC52xx_GPT_MODE_ICT_TOGGLE (0x030000) 122#define MPC52xx_GPT_MODE_ICT_TOGGLE (0x030000)
97 123
124#define MPC52xx_GPT_MODE_WDT_PING (0xa5)
125
98#define MPC52xx_GPT_STATUS_IRQMASK (0x000f) 126#define MPC52xx_GPT_STATUS_IRQMASK (0x000f)
99 127
128#define MPC52xx_GPT_CAN_WDT (1 << 0)
129#define MPC52xx_GPT_IS_WDT (1 << 1)
130
131
100/* --------------------------------------------------------------------- 132/* ---------------------------------------------------------------------
101 * Cascaded interrupt controller hooks 133 * Cascaded interrupt controller hooks
102 */ 134 */
@@ -149,7 +181,7 @@ static int mpc52xx_gpt_irq_set_type(unsigned int virq, unsigned int flow_type)
149} 181}
150 182
151static struct irq_chip mpc52xx_gpt_irq_chip = { 183static struct irq_chip mpc52xx_gpt_irq_chip = {
152 .typename = "MPC52xx GPT", 184 .name = "MPC52xx GPT",
153 .unmask = mpc52xx_gpt_irq_unmask, 185 .unmask = mpc52xx_gpt_irq_unmask,
154 .mask = mpc52xx_gpt_irq_mask, 186 .mask = mpc52xx_gpt_irq_mask,
155 .ack = mpc52xx_gpt_irq_ack, 187 .ack = mpc52xx_gpt_irq_ack,
@@ -182,7 +214,7 @@ static int mpc52xx_gpt_irq_map(struct irq_host *h, unsigned int virq,
182} 214}
183 215
184static int mpc52xx_gpt_irq_xlate(struct irq_host *h, struct device_node *ct, 216static int mpc52xx_gpt_irq_xlate(struct irq_host *h, struct device_node *ct,
185 u32 *intspec, unsigned int intsize, 217 const u32 *intspec, unsigned int intsize,
186 irq_hw_number_t *out_hwirq, 218 irq_hw_number_t *out_hwirq,
187 unsigned int *out_flags) 219 unsigned int *out_flags)
188{ 220{
@@ -190,7 +222,7 @@ static int mpc52xx_gpt_irq_xlate(struct irq_host *h, struct device_node *ct,
190 222
191 dev_dbg(gpt->dev, "%s: flags=%i\n", __func__, intspec[0]); 223 dev_dbg(gpt->dev, "%s: flags=%i\n", __func__, intspec[0]);
192 224
193 if ((intsize < 1) || (intspec[0] < 1) || (intspec[0] > 3)) { 225 if ((intsize < 1) || (intspec[0] > 3)) {
194 dev_err(gpt->dev, "bad irq specifier in %s\n", ct->full_name); 226 dev_err(gpt->dev, "bad irq specifier in %s\n", ct->full_name);
195 return -EINVAL; 227 return -EINVAL;
196 } 228 }
@@ -211,13 +243,11 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
211{ 243{
212 int cascade_virq; 244 int cascade_virq;
213 unsigned long flags; 245 unsigned long flags;
214 246 u32 mode;
215 /* Only setup cascaded IRQ if device tree claims the GPT is
216 * an interrupt controller */
217 if (!of_find_property(node, "interrupt-controller", NULL))
218 return;
219 247
220 cascade_virq = irq_of_parse_and_map(node, 0); 248 cascade_virq = irq_of_parse_and_map(node, 0);
249 if (!cascade_virq)
250 return;
221 251
222 gpt->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, 1, 252 gpt->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, 1,
223 &mpc52xx_gpt_irq_ops, -1); 253 &mpc52xx_gpt_irq_ops, -1);
@@ -227,14 +257,16 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
227 } 257 }
228 258
229 gpt->irqhost->host_data = gpt; 259 gpt->irqhost->host_data = gpt;
230
231 set_irq_data(cascade_virq, gpt); 260 set_irq_data(cascade_virq, gpt);
232 set_irq_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade); 261 set_irq_chained_handler(cascade_virq, mpc52xx_gpt_irq_cascade);
233 262
234 /* Set to Input Capture mode */ 263 /* If the GPT is currently disabled, then change it to be in Input
264 * Capture mode. If the mode is non-zero, then the pin could be
265 * already in use for something. */
235 spin_lock_irqsave(&gpt->lock, flags); 266 spin_lock_irqsave(&gpt->lock, flags);
236 clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK, 267 mode = in_be32(&gpt->regs->mode);
237 MPC52xx_GPT_MODE_MS_IC); 268 if ((mode & MPC52xx_GPT_MODE_MS_MASK) == 0)
269 out_be32(&gpt->regs->mode, mode | MPC52xx_GPT_MODE_MS_IC);
238 spin_unlock_irqrestore(&gpt->lock, flags); 270 spin_unlock_irqrestore(&gpt->lock, flags);
239 271
240 dev_dbg(gpt->dev, "%s() complete. virq=%i\n", __func__, cascade_virq); 272 dev_dbg(gpt->dev, "%s() complete. virq=%i\n", __func__, cascade_virq);
@@ -335,6 +367,354 @@ static void
335mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *p, struct device_node *np) { } 367mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *p, struct device_node *np) { }
336#endif /* defined(CONFIG_GPIOLIB) */ 368#endif /* defined(CONFIG_GPIOLIB) */
337 369
370/***********************************************************************
371 * Timer API
372 */
373
374/**
375 * mpc52xx_gpt_from_irq - Return the GPT device associated with an IRQ number
376 * @irq: irq of timer.
377 */
378struct mpc52xx_gpt_priv *mpc52xx_gpt_from_irq(int irq)
379{
380 struct mpc52xx_gpt_priv *gpt;
381 struct list_head *pos;
382
383 /* Iterate over the list of timers looking for a matching device */
384 mutex_lock(&mpc52xx_gpt_list_mutex);
385 list_for_each(pos, &mpc52xx_gpt_list) {
386 gpt = container_of(pos, struct mpc52xx_gpt_priv, list);
387 if (gpt->irqhost && irq == irq_linear_revmap(gpt->irqhost, 0)) {
388 mutex_unlock(&mpc52xx_gpt_list_mutex);
389 return gpt;
390 }
391 }
392 mutex_unlock(&mpc52xx_gpt_list_mutex);
393
394 return NULL;
395}
396EXPORT_SYMBOL(mpc52xx_gpt_from_irq);
397
398static int mpc52xx_gpt_do_start(struct mpc52xx_gpt_priv *gpt, u64 period,
399 int continuous, int as_wdt)
400{
401 u32 clear, set;
402 u64 clocks;
403 u32 prescale;
404 unsigned long flags;
405
406 clear = MPC52xx_GPT_MODE_MS_MASK | MPC52xx_GPT_MODE_CONTINUOUS;
407 set = MPC52xx_GPT_MODE_MS_GPIO | MPC52xx_GPT_MODE_COUNTER_ENABLE;
408 if (as_wdt) {
409 clear |= MPC52xx_GPT_MODE_IRQ_EN;
410 set |= MPC52xx_GPT_MODE_WDT_EN;
411 } else if (continuous)
412 set |= MPC52xx_GPT_MODE_CONTINUOUS;
413
414 /* Determine the number of clocks in the requested period. 64 bit
415 * arithmatic is done here to preserve the precision until the value
416 * is scaled back down into the u32 range. Period is in 'ns', bus
417 * frequency is in Hz. */
418 clocks = period * (u64)gpt->ipb_freq;
419 do_div(clocks, 1000000000); /* Scale it down to ns range */
420
421 /* This device cannot handle a clock count greater than 32 bits */
422 if (clocks > 0xffffffff)
423 return -EINVAL;
424
425 /* Calculate the prescaler and count values from the clocks value.
426 * 'clocks' is the number of clock ticks in the period. The timer
427 * has 16 bit precision and a 16 bit prescaler. Prescaler is
428 * calculated by integer dividing the clocks by 0x10000 (shifting
429 * down 16 bits) to obtain the smallest possible divisor for clocks
430 * to get a 16 bit count value.
431 *
432 * Note: the prescale register is '1' based, not '0' based. ie. a
433 * value of '1' means divide the clock by one. 0xffff divides the
434 * clock by 0xffff. '0x0000' does not divide by zero, but wraps
435 * around and divides by 0x10000. That is why prescale must be
436 * a u32 variable, not a u16, for this calculation. */
437 prescale = (clocks >> 16) + 1;
438 do_div(clocks, prescale);
439 if (clocks > 0xffff) {
440 pr_err("calculation error; prescale:%x clocks:%llx\n",
441 prescale, clocks);
442 return -EINVAL;
443 }
444
445 /* Set and enable the timer, reject an attempt to use a wdt as gpt */
446 spin_lock_irqsave(&gpt->lock, flags);
447 if (as_wdt)
448 gpt->wdt_mode |= MPC52xx_GPT_IS_WDT;
449 else if ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) != 0) {
450 spin_unlock_irqrestore(&gpt->lock, flags);
451 return -EBUSY;
452 }
453 out_be32(&gpt->regs->count, prescale << 16 | clocks);
454 clrsetbits_be32(&gpt->regs->mode, clear, set);
455 spin_unlock_irqrestore(&gpt->lock, flags);
456
457 return 0;
458}
459
460/**
461 * mpc52xx_gpt_start_timer - Set and enable the GPT timer
462 * @gpt: Pointer to gpt private data structure
463 * @period: period of timer in ns; max. ~130s @ 33MHz IPB clock
464 * @continuous: set to 1 to make timer continuous free running
465 *
466 * An interrupt will be generated every time the timer fires
467 */
468int mpc52xx_gpt_start_timer(struct mpc52xx_gpt_priv *gpt, u64 period,
469 int continuous)
470{
471 return mpc52xx_gpt_do_start(gpt, period, continuous, 0);
472}
473EXPORT_SYMBOL(mpc52xx_gpt_start_timer);
474
475/**
476 * mpc52xx_gpt_stop_timer - Stop a gpt
477 * @gpt: Pointer to gpt private data structure
478 *
479 * Returns an error if attempting to stop a wdt
480 */
481int mpc52xx_gpt_stop_timer(struct mpc52xx_gpt_priv *gpt)
482{
483 unsigned long flags;
484
485 /* reject the operation if the timer is used as watchdog (gpt 0 only) */
486 spin_lock_irqsave(&gpt->lock, flags);
487 if ((gpt->wdt_mode & MPC52xx_GPT_IS_WDT) != 0) {
488 spin_unlock_irqrestore(&gpt->lock, flags);
489 return -EBUSY;
490 }
491
492 clrbits32(&gpt->regs->mode, MPC52xx_GPT_MODE_COUNTER_ENABLE);
493 spin_unlock_irqrestore(&gpt->lock, flags);
494 return 0;
495}
496EXPORT_SYMBOL(mpc52xx_gpt_stop_timer);
497
498/**
499 * mpc52xx_gpt_timer_period - Read the timer period
500 * @gpt: Pointer to gpt private data structure
501 *
502 * Returns the timer period in ns
503 */
504u64 mpc52xx_gpt_timer_period(struct mpc52xx_gpt_priv *gpt)
505{
506 u64 period;
507 u64 prescale;
508 unsigned long flags;
509
510 spin_lock_irqsave(&gpt->lock, flags);
511 period = in_be32(&gpt->regs->count);
512 spin_unlock_irqrestore(&gpt->lock, flags);
513
514 prescale = period >> 16;
515 period &= 0xffff;
516 if (prescale == 0)
517 prescale = 0x10000;
518 period = period * prescale * 1000000000ULL;
519 do_div(period, (u64)gpt->ipb_freq);
520 return period;
521}
522EXPORT_SYMBOL(mpc52xx_gpt_timer_period);
523
524#if defined(CONFIG_MPC5200_WDT)
525/***********************************************************************
526 * Watchdog API for gpt0
527 */
528
529#define WDT_IDENTITY "mpc52xx watchdog on GPT0"
530
531/* wdt_is_active stores wether or not the /dev/watchdog device is opened */
532static unsigned long wdt_is_active;
533
534/* wdt-capable gpt */
535static struct mpc52xx_gpt_priv *mpc52xx_gpt_wdt;
536
537/* low-level wdt functions */
538static inline void mpc52xx_gpt_wdt_ping(struct mpc52xx_gpt_priv *gpt_wdt)
539{
540 unsigned long flags;
541
542 spin_lock_irqsave(&gpt_wdt->lock, flags);
543 out_8((u8 *) &gpt_wdt->regs->mode, MPC52xx_GPT_MODE_WDT_PING);
544 spin_unlock_irqrestore(&gpt_wdt->lock, flags);
545}
546
547/* wdt misc device api */
548static ssize_t mpc52xx_wdt_write(struct file *file, const char __user *data,
549 size_t len, loff_t *ppos)
550{
551 struct mpc52xx_gpt_priv *gpt_wdt = file->private_data;
552 mpc52xx_gpt_wdt_ping(gpt_wdt);
553 return 0;
554}
555
556static struct watchdog_info mpc5200_wdt_info = {
557 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
558 .identity = WDT_IDENTITY,
559};
560
561static long mpc52xx_wdt_ioctl(struct file *file, unsigned int cmd,
562 unsigned long arg)
563{
564 struct mpc52xx_gpt_priv *gpt_wdt = file->private_data;
565 int __user *data = (int __user *)arg;
566 int timeout;
567 u64 real_timeout;
568 int ret = 0;
569
570 switch (cmd) {
571 case WDIOC_GETSUPPORT:
572 ret = copy_to_user(data, &mpc5200_wdt_info,
573 sizeof(mpc5200_wdt_info));
574 if (ret)
575 ret = -EFAULT;
576 break;
577
578 case WDIOC_GETSTATUS:
579 case WDIOC_GETBOOTSTATUS:
580 ret = put_user(0, data);
581 break;
582
583 case WDIOC_KEEPALIVE:
584 mpc52xx_gpt_wdt_ping(gpt_wdt);
585 break;
586
587 case WDIOC_SETTIMEOUT:
588 ret = get_user(timeout, data);
589 if (ret)
590 break;
591 real_timeout = (u64) timeout * 1000000000ULL;
592 ret = mpc52xx_gpt_do_start(gpt_wdt, real_timeout, 0, 1);
593 if (ret)
594 break;
595 /* fall through and return the timeout */
596
597 case WDIOC_GETTIMEOUT:
598 /* we need to round here as to avoid e.g. the following
599 * situation:
600 * - timeout requested is 1 second;
601 * - real timeout @33MHz is 999997090ns
602 * - the int divide by 10^9 will return 0.
603 */
604 real_timeout =
605 mpc52xx_gpt_timer_period(gpt_wdt) + 500000000ULL;
606 do_div(real_timeout, 1000000000ULL);
607 timeout = (int) real_timeout;
608 ret = put_user(timeout, data);
609 break;
610
611 default:
612 ret = -ENOTTY;
613 }
614 return ret;
615}
616
617static int mpc52xx_wdt_open(struct inode *inode, struct file *file)
618{
619 int ret;
620
621 /* sanity check */
622 if (!mpc52xx_gpt_wdt)
623 return -ENODEV;
624
625 /* /dev/watchdog can only be opened once */
626 if (test_and_set_bit(0, &wdt_is_active))
627 return -EBUSY;
628
629 /* Set and activate the watchdog with 30 seconds timeout */
630 ret = mpc52xx_gpt_do_start(mpc52xx_gpt_wdt, 30ULL * 1000000000ULL,
631 0, 1);
632 if (ret) {
633 clear_bit(0, &wdt_is_active);
634 return ret;
635 }
636
637 file->private_data = mpc52xx_gpt_wdt;
638 return nonseekable_open(inode, file);
639}
640
641static int mpc52xx_wdt_release(struct inode *inode, struct file *file)
642{
643 /* note: releasing the wdt in NOWAYOUT-mode does not stop it */
644#if !defined(CONFIG_WATCHDOG_NOWAYOUT)
645 struct mpc52xx_gpt_priv *gpt_wdt = file->private_data;
646 unsigned long flags;
647
648 spin_lock_irqsave(&gpt_wdt->lock, flags);
649 clrbits32(&gpt_wdt->regs->mode,
650 MPC52xx_GPT_MODE_COUNTER_ENABLE | MPC52xx_GPT_MODE_WDT_EN);
651 gpt_wdt->wdt_mode &= ~MPC52xx_GPT_IS_WDT;
652 spin_unlock_irqrestore(&gpt_wdt->lock, flags);
653#endif
654 clear_bit(0, &wdt_is_active);
655 return 0;
656}
657
658
659static const struct file_operations mpc52xx_wdt_fops = {
660 .owner = THIS_MODULE,
661 .llseek = no_llseek,
662 .write = mpc52xx_wdt_write,
663 .unlocked_ioctl = mpc52xx_wdt_ioctl,
664 .open = mpc52xx_wdt_open,
665 .release = mpc52xx_wdt_release,
666};
667
668static struct miscdevice mpc52xx_wdt_miscdev = {
669 .minor = WATCHDOG_MINOR,
670 .name = "watchdog",
671 .fops = &mpc52xx_wdt_fops,
672};
673
674static int __devinit mpc52xx_gpt_wdt_init(void)
675{
676 int err;
677
678 /* try to register the watchdog misc device */
679 err = misc_register(&mpc52xx_wdt_miscdev);
680 if (err)
681 pr_err("%s: cannot register watchdog device\n", WDT_IDENTITY);
682 else
683 pr_info("%s: watchdog device registered\n", WDT_IDENTITY);
684 return err;
685}
686
687static int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
688 const u32 *period)
689{
690 u64 real_timeout;
691
692 /* remember the gpt for the wdt operation */
693 mpc52xx_gpt_wdt = gpt;
694
695 /* configure the wdt if the device tree contained a timeout */
696 if (!period || *period == 0)
697 return 0;
698
699 real_timeout = (u64) *period * 1000000000ULL;
700 if (mpc52xx_gpt_do_start(gpt, real_timeout, 0, 1))
701 dev_warn(gpt->dev, "starting as wdt failed\n");
702 else
703 dev_info(gpt->dev, "watchdog set to %us timeout\n", *period);
704 return 0;
705}
706
707#else
708
709static int __devinit mpc52xx_gpt_wdt_init(void)
710{
711 return 0;
712}
713
714#define mpc52xx_gpt_wdt_setup(x, y) (0)
715
716#endif /* CONFIG_MPC5200_WDT */
717
338/* --------------------------------------------------------------------- 718/* ---------------------------------------------------------------------
339 * of_platform bus binding code 719 * of_platform bus binding code
340 */ 720 */
@@ -349,6 +729,7 @@ static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev,
349 729
350 spin_lock_init(&gpt->lock); 730 spin_lock_init(&gpt->lock);
351 gpt->dev = &ofdev->dev; 731 gpt->dev = &ofdev->dev;
732 gpt->ipb_freq = mpc5xxx_get_bus_frequency(ofdev->node);
352 gpt->regs = of_iomap(ofdev->node, 0); 733 gpt->regs = of_iomap(ofdev->node, 0);
353 if (!gpt->regs) { 734 if (!gpt->regs) {
354 kfree(gpt); 735 kfree(gpt);
@@ -360,6 +741,26 @@ static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev,
360 mpc52xx_gpt_gpio_setup(gpt, ofdev->node); 741 mpc52xx_gpt_gpio_setup(gpt, ofdev->node);
361 mpc52xx_gpt_irq_setup(gpt, ofdev->node); 742 mpc52xx_gpt_irq_setup(gpt, ofdev->node);
362 743
744 mutex_lock(&mpc52xx_gpt_list_mutex);
745 list_add(&gpt->list, &mpc52xx_gpt_list);
746 mutex_unlock(&mpc52xx_gpt_list_mutex);
747
748 /* check if this device could be a watchdog */
749 if (of_get_property(ofdev->node, "fsl,has-wdt", NULL) ||
750 of_get_property(ofdev->node, "has-wdt", NULL)) {
751 const u32 *on_boot_wdt;
752
753 gpt->wdt_mode = MPC52xx_GPT_CAN_WDT;
754 on_boot_wdt = of_get_property(ofdev->node, "fsl,wdt-on-boot",
755 NULL);
756 if (on_boot_wdt) {
757 dev_info(gpt->dev, "used as watchdog\n");
758 gpt->wdt_mode |= MPC52xx_GPT_IS_WDT;
759 } else
760 dev_info(gpt->dev, "can function as watchdog\n");
761 mpc52xx_gpt_wdt_setup(gpt, on_boot_wdt);
762 }
763
363 return 0; 764 return 0;
364} 765}
365 766
@@ -394,3 +795,4 @@ static int __init mpc52xx_gpt_init(void)
394 795
395/* Make sure GPIOs and IRQs get set up before anyone tries to use them */ 796/* Make sure GPIOs and IRQs get set up before anyone tries to use them */
396subsys_initcall(mpc52xx_gpt_init); 797subsys_initcall(mpc52xx_gpt_init);
798device_initcall(mpc52xx_gpt_wdt_init);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
new file mode 100644
index 000000000000..929d017535a3
--- /dev/null
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -0,0 +1,560 @@
1/*
2 * LocalPlus Bus FIFO driver for the Freescale MPC52xx.
3 *
4 * Copyright (C) 2009 Secret Lab Technologies Ltd.
5 *
6 * This file is released under the GPLv2
7 *
8 * Todo:
9 * - Add support for multiple requests to be queued.
10 */
11
12#include <linux/interrupt.h>
13#include <linux/kernel.h>
14#include <linux/of.h>
15#include <linux/of_platform.h>
16#include <linux/spinlock.h>
17#include <asm/io.h>
18#include <asm/prom.h>
19#include <asm/mpc52xx.h>
20#include <asm/time.h>
21
22#include <sysdev/bestcomm/bestcomm.h>
23#include <sysdev/bestcomm/bestcomm_priv.h>
24#include <sysdev/bestcomm/gen_bd.h>
25
26MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>");
27MODULE_DESCRIPTION("MPC5200 LocalPlus FIFO device driver");
28MODULE_LICENSE("GPL");
29
30#define LPBFIFO_REG_PACKET_SIZE (0x00)
31#define LPBFIFO_REG_START_ADDRESS (0x04)
32#define LPBFIFO_REG_CONTROL (0x08)
33#define LPBFIFO_REG_ENABLE (0x0C)
34#define LPBFIFO_REG_BYTES_DONE_STATUS (0x14)
35#define LPBFIFO_REG_FIFO_DATA (0x40)
36#define LPBFIFO_REG_FIFO_STATUS (0x44)
37#define LPBFIFO_REG_FIFO_CONTROL (0x48)
38#define LPBFIFO_REG_FIFO_ALARM (0x4C)
39
40struct mpc52xx_lpbfifo {
41 struct device *dev;
42 phys_addr_t regs_phys;
43 void __iomem *regs;
44 int irq;
45 spinlock_t lock;
46
47 struct bcom_task *bcom_tx_task;
48 struct bcom_task *bcom_rx_task;
49 struct bcom_task *bcom_cur_task;
50
51 /* Current state data */
52 struct mpc52xx_lpbfifo_request *req;
53 int dma_irqs_enabled;
54};
55
56/* The MPC5200 has only one fifo, so only need one instance structure */
57static struct mpc52xx_lpbfifo lpbfifo;
58
59/**
60 * mpc52xx_lpbfifo_kick - Trigger the next block of data to be transfered
61 */
62static void mpc52xx_lpbfifo_kick(struct mpc52xx_lpbfifo_request *req)
63{
64 size_t transfer_size = req->size - req->pos;
65 struct bcom_bd *bd;
66 void __iomem *reg;
67 u32 *data;
68 int i;
69 int bit_fields;
70 int dma = !(req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA);
71 int write = req->flags & MPC52XX_LPBFIFO_FLAG_WRITE;
72 int poll_dma = req->flags & MPC52XX_LPBFIFO_FLAG_POLL_DMA;
73
74 /* Set and clear the reset bits; is good practice in User Manual */
75 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000);
76
77 /* set master enable bit */
78 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x00000001);
79 if (!dma) {
80 /* While the FIFO can be setup for transfer sizes as large as
81 * 16M-1, the FIFO itself is only 512 bytes deep and it does
82 * not generate interrupts for FIFO full events (only transfer
83 * complete will raise an IRQ). Therefore when not using
84 * Bestcomm to drive the FIFO it needs to either be polled, or
85 * transfers need to constrained to the size of the fifo.
86 *
87 * This driver restricts the size of the transfer
88 */
89 if (transfer_size > 512)
90 transfer_size = 512;
91
92 /* Load the FIFO with data */
93 if (write) {
94 reg = lpbfifo.regs + LPBFIFO_REG_FIFO_DATA;
95 data = req->data + req->pos;
96 for (i = 0; i < transfer_size; i += 4)
97 out_be32(reg, *data++);
98 }
99
100 /* Unmask both error and completion irqs */
101 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x00000301);
102 } else {
103 /* Choose the correct direction
104 *
105 * Configure the watermarks so DMA will always complete correctly.
106 * It may be worth experimenting with the ALARM value to see if
107 * there is a performance impacit. However, if it is wrong there
108 * is a risk of DMA not transferring the last chunk of data
109 */
110 if (write) {
111 out_be32(lpbfifo.regs + LPBFIFO_REG_FIFO_ALARM, 0x1e4);
112 out_8(lpbfifo.regs + LPBFIFO_REG_FIFO_CONTROL, 7);
113 lpbfifo.bcom_cur_task = lpbfifo.bcom_tx_task;
114 } else {
115 out_be32(lpbfifo.regs + LPBFIFO_REG_FIFO_ALARM, 0x1ff);
116 out_8(lpbfifo.regs + LPBFIFO_REG_FIFO_CONTROL, 0);
117 lpbfifo.bcom_cur_task = lpbfifo.bcom_rx_task;
118
119 if (poll_dma) {
120 if (lpbfifo.dma_irqs_enabled) {
121 disable_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task));
122 lpbfifo.dma_irqs_enabled = 0;
123 }
124 } else {
125 if (!lpbfifo.dma_irqs_enabled) {
126 enable_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task));
127 lpbfifo.dma_irqs_enabled = 1;
128 }
129 }
130 }
131
132 bd = bcom_prepare_next_buffer(lpbfifo.bcom_cur_task);
133 bd->status = transfer_size;
134 if (!write) {
135 /*
136 * In the DMA read case, the DMA doesn't complete,
137 * possibly due to incorrect watermarks in the ALARM
138 * and CONTROL regs. For now instead of trying to
139 * determine the right watermarks that will make this
140 * work, just increase the number of bytes the FIFO is
141 * expecting.
142 *
143 * When submitting another operation, the FIFO will get
144 * reset, so the condition of the FIFO waiting for a
145 * non-existent 4 bytes will get cleared.
146 */
147 transfer_size += 4; /* BLECH! */
148 }
149 bd->data[0] = req->data_phys + req->pos;
150 bcom_submit_next_buffer(lpbfifo.bcom_cur_task, NULL);
151
152 /* error irq & master enabled bit */
153 bit_fields = 0x00000201;
154
155 /* Unmask irqs */
156 if (write && (!poll_dma))
157 bit_fields |= 0x00000100; /* completion irq too */
158 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, bit_fields);
159 }
160
161 /* Set transfer size, width, chip select and READ mode */
162 out_be32(lpbfifo.regs + LPBFIFO_REG_START_ADDRESS,
163 req->offset + req->pos);
164 out_be32(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, transfer_size);
165
166 bit_fields = req->cs << 24 | 0x000008;
167 if (!write)
168 bit_fields |= 0x010000; /* read mode */
169 out_be32(lpbfifo.regs + LPBFIFO_REG_CONTROL, bit_fields);
170
171 /* Kick it off */
172 out_8(lpbfifo.regs + LPBFIFO_REG_PACKET_SIZE, 0x01);
173 if (dma)
174 bcom_enable(lpbfifo.bcom_cur_task);
175}
176
177/**
178 * mpc52xx_lpbfifo_irq - IRQ handler for LPB FIFO
179 *
180 * On transmit, the dma completion irq triggers before the fifo completion
181 * triggers. Handle the dma completion here instead of the LPB FIFO Bestcomm
182 * task completion irq becuase everyting is not really done until the LPB FIFO
183 * completion irq triggers.
184 *
185 * In other words:
186 * For DMA, on receive, the "Fat Lady" is the bestcom completion irq. on
187 * transmit, the fifo completion irq is the "Fat Lady". The opera (or in this
188 * case the DMA/FIFO operation) is not finished until the "Fat Lady" sings.
189 *
190 * Reasons for entering this routine:
191 * 1) PIO mode rx and tx completion irq
192 * 2) DMA interrupt mode tx completion irq
193 * 3) DMA polled mode tx
194 *
195 * Exit conditions:
196 * 1) Transfer aborted
197 * 2) FIFO complete without DMA; more data to do
198 * 3) FIFO complete without DMA; all data transfered
199 * 4) FIFO complete using DMA
200 *
201 * Condition 1 can occur regardless of whether or not DMA is used.
202 * It requires executing the callback to report the error and exiting
203 * immediately.
204 *
205 * Condition 2 requires programming the FIFO with the next block of data
206 *
207 * Condition 3 requires executing the callback to report completion
208 *
209 * Condition 4 means the same as 3, except that we also retrieve the bcom
210 * buffer so DMA doesn't get clogged up.
211 *
212 * To make things trickier, the spinlock must be dropped before
213 * executing the callback, otherwise we could end up with a deadlock
214 * or nested spinlock condition. The out path is non-trivial, so
215 * extra fiddling is done to make sure all paths lead to the same
216 * outbound code.
217 */
218static irqreturn_t mpc52xx_lpbfifo_irq(int irq, void *dev_id)
219{
220 struct mpc52xx_lpbfifo_request *req;
221 u32 status = in_8(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS);
222 void __iomem *reg;
223 u32 *data;
224 int count, i;
225 int do_callback = 0;
226 u32 ts;
227 unsigned long flags;
228 int dma, write, poll_dma;
229
230 spin_lock_irqsave(&lpbfifo.lock, flags);
231 ts = get_tbl();
232
233 req = lpbfifo.req;
234 if (!req) {
235 spin_unlock_irqrestore(&lpbfifo.lock, flags);
236 pr_err("bogus LPBFIFO IRQ\n");
237 return IRQ_HANDLED;
238 }
239
240 dma = !(req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA);
241 write = req->flags & MPC52XX_LPBFIFO_FLAG_WRITE;
242 poll_dma = req->flags & MPC52XX_LPBFIFO_FLAG_POLL_DMA;
243
244 if (dma && !write) {
245 spin_unlock_irqrestore(&lpbfifo.lock, flags);
246 pr_err("bogus LPBFIFO IRQ (dma and not writting)\n");
247 return IRQ_HANDLED;
248 }
249
250 if ((status & 0x01) == 0) {
251 goto out;
252 }
253
254 /* check abort bit */
255 if (status & 0x10) {
256 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000);
257 do_callback = 1;
258 goto out;
259 }
260
261 /* Read result from hardware */
262 count = in_be32(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS);
263 count &= 0x00ffffff;
264
265 if (!dma && !write) {
266 /* copy the data out of the FIFO */
267 reg = lpbfifo.regs + LPBFIFO_REG_FIFO_DATA;
268 data = req->data + req->pos;
269 for (i = 0; i < count; i += 4)
270 *data++ = in_be32(reg);
271 }
272
273 /* Update transfer position and count */
274 req->pos += count;
275
276 /* Decide what to do next */
277 if (req->size - req->pos)
278 mpc52xx_lpbfifo_kick(req); /* more work to do */
279 else
280 do_callback = 1;
281
282 out:
283 /* Clear the IRQ */
284 out_8(lpbfifo.regs + LPBFIFO_REG_BYTES_DONE_STATUS, 0x01);
285
286 if (dma && (status & 0x11)) {
287 /*
288 * Count the DMA as complete only when the FIFO completion
289 * status or abort bits are set.
290 *
291 * (status & 0x01) should always be the case except sometimes
292 * when using polled DMA.
293 *
294 * (status & 0x10) {transfer aborted}: This case needs more
295 * testing.
296 */
297 bcom_retrieve_buffer(lpbfifo.bcom_cur_task, &status, NULL);
298 }
299 req->last_byte = ((u8 *)req->data)[req->size - 1];
300
301 /* When the do_callback flag is set; it means the transfer is finished
302 * so set the FIFO as idle */
303 if (do_callback)
304 lpbfifo.req = NULL;
305
306 if (irq != 0) /* don't increment on polled case */
307 req->irq_count++;
308
309 req->irq_ticks += get_tbl() - ts;
310 spin_unlock_irqrestore(&lpbfifo.lock, flags);
311
312 /* Spinlock is released; it is now safe to call the callback */
313 if (do_callback && req->callback)
314 req->callback(req);
315
316 return IRQ_HANDLED;
317}
318
319/**
320 * mpc52xx_lpbfifo_bcom_irq - IRQ handler for LPB FIFO Bestcomm task
321 *
322 * Only used when receiving data.
323 */
324static irqreturn_t mpc52xx_lpbfifo_bcom_irq(int irq, void *dev_id)
325{
326 struct mpc52xx_lpbfifo_request *req;
327 unsigned long flags;
328 u32 status;
329 u32 ts;
330
331 spin_lock_irqsave(&lpbfifo.lock, flags);
332 ts = get_tbl();
333
334 req = lpbfifo.req;
335 if (!req || (req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA)) {
336 spin_unlock_irqrestore(&lpbfifo.lock, flags);
337 return IRQ_HANDLED;
338 }
339
340 if (irq != 0) /* don't increment on polled case */
341 req->irq_count++;
342
343 if (!bcom_buffer_done(lpbfifo.bcom_cur_task)) {
344 spin_unlock_irqrestore(&lpbfifo.lock, flags);
345
346 req->buffer_not_done_cnt++;
347 if ((req->buffer_not_done_cnt % 1000) == 0)
348 pr_err("transfer stalled\n");
349
350 return IRQ_HANDLED;
351 }
352
353 bcom_retrieve_buffer(lpbfifo.bcom_cur_task, &status, NULL);
354
355 req->last_byte = ((u8 *)req->data)[req->size - 1];
356
357 req->pos = status & 0x00ffffff;
358
359 /* Mark the FIFO as idle */
360 lpbfifo.req = NULL;
361
362 /* Release the lock before calling out to the callback. */
363 req->irq_ticks += get_tbl() - ts;
364 spin_unlock_irqrestore(&lpbfifo.lock, flags);
365
366 if (req->callback)
367 req->callback(req);
368
369 return IRQ_HANDLED;
370}
371
372/**
373 * mpc52xx_lpbfifo_bcom_poll - Poll for DMA completion
374 */
375void mpc52xx_lpbfifo_poll(void)
376{
377 struct mpc52xx_lpbfifo_request *req = lpbfifo.req;
378 int dma = !(req->flags & MPC52XX_LPBFIFO_FLAG_NO_DMA);
379 int write = req->flags & MPC52XX_LPBFIFO_FLAG_WRITE;
380
381 /*
382 * For more information, see comments on the "Fat Lady"
383 */
384 if (dma && write)
385 mpc52xx_lpbfifo_irq(0, NULL);
386 else
387 mpc52xx_lpbfifo_bcom_irq(0, NULL);
388}
389EXPORT_SYMBOL(mpc52xx_lpbfifo_poll);
390
391/**
392 * mpc52xx_lpbfifo_submit - Submit an LPB FIFO transfer request.
393 * @req: Pointer to request structure
394 */
395int mpc52xx_lpbfifo_submit(struct mpc52xx_lpbfifo_request *req)
396{
397 unsigned long flags;
398
399 if (!lpbfifo.regs)
400 return -ENODEV;
401
402 spin_lock_irqsave(&lpbfifo.lock, flags);
403
404 /* If the req pointer is already set, then a transfer is in progress */
405 if (lpbfifo.req) {
406 spin_unlock_irqrestore(&lpbfifo.lock, flags);
407 return -EBUSY;
408 }
409
410 /* Setup the transfer */
411 lpbfifo.req = req;
412 req->irq_count = 0;
413 req->irq_ticks = 0;
414 req->buffer_not_done_cnt = 0;
415 req->pos = 0;
416
417 mpc52xx_lpbfifo_kick(req);
418 spin_unlock_irqrestore(&lpbfifo.lock, flags);
419 return 0;
420}
421EXPORT_SYMBOL(mpc52xx_lpbfifo_submit);
422
423void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req)
424{
425 unsigned long flags;
426
427 spin_lock_irqsave(&lpbfifo.lock, flags);
428 if (lpbfifo.req == req) {
429 /* Put it into reset and clear the state */
430 bcom_gen_bd_rx_reset(lpbfifo.bcom_rx_task);
431 bcom_gen_bd_tx_reset(lpbfifo.bcom_tx_task);
432 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000);
433 lpbfifo.req = NULL;
434 }
435 spin_unlock_irqrestore(&lpbfifo.lock, flags);
436}
437EXPORT_SYMBOL(mpc52xx_lpbfifo_abort);
438
439static int __devinit
440mpc52xx_lpbfifo_probe(struct of_device *op, const struct of_device_id *match)
441{
442 struct resource res;
443 int rc = -ENOMEM;
444
445 if (lpbfifo.dev != NULL)
446 return -ENOSPC;
447
448 lpbfifo.irq = irq_of_parse_and_map(op->node, 0);
449 if (!lpbfifo.irq)
450 return -ENODEV;
451
452 if (of_address_to_resource(op->node, 0, &res))
453 return -ENODEV;
454 lpbfifo.regs_phys = res.start;
455 lpbfifo.regs = of_iomap(op->node, 0);
456 if (!lpbfifo.regs)
457 return -ENOMEM;
458
459 spin_lock_init(&lpbfifo.lock);
460
461 /* Put FIFO into reset */
462 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000);
463
464 /* Register the interrupt handler */
465 rc = request_irq(lpbfifo.irq, mpc52xx_lpbfifo_irq, 0,
466 "mpc52xx-lpbfifo", &lpbfifo);
467 if (rc)
468 goto err_irq;
469
470 /* Request the Bestcomm receive (fifo --> memory) task and IRQ */
471 lpbfifo.bcom_rx_task =
472 bcom_gen_bd_rx_init(2, res.start + LPBFIFO_REG_FIFO_DATA,
473 BCOM_INITIATOR_SCLPC, BCOM_IPR_SCLPC,
474 16*1024*1024);
475 if (!lpbfifo.bcom_rx_task)
476 goto err_bcom_rx;
477
478 rc = request_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task),
479 mpc52xx_lpbfifo_bcom_irq, 0,
480 "mpc52xx-lpbfifo-rx", &lpbfifo);
481 if (rc)
482 goto err_bcom_rx_irq;
483
484 /* Request the Bestcomm transmit (memory --> fifo) task and IRQ */
485 lpbfifo.bcom_tx_task =
486 bcom_gen_bd_tx_init(2, res.start + LPBFIFO_REG_FIFO_DATA,
487 BCOM_INITIATOR_SCLPC, BCOM_IPR_SCLPC);
488 if (!lpbfifo.bcom_tx_task)
489 goto err_bcom_tx;
490
491 lpbfifo.dev = &op->dev;
492 return 0;
493
494 err_bcom_tx:
495 free_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), &lpbfifo);
496 err_bcom_rx_irq:
497 bcom_gen_bd_rx_release(lpbfifo.bcom_rx_task);
498 err_bcom_rx:
499 err_irq:
500 iounmap(lpbfifo.regs);
501 lpbfifo.regs = NULL;
502
503 dev_err(&op->dev, "mpc52xx_lpbfifo_probe() failed\n");
504 return -ENODEV;
505}
506
507
508static int __devexit mpc52xx_lpbfifo_remove(struct of_device *op)
509{
510 if (lpbfifo.dev != &op->dev)
511 return 0;
512
513 /* Put FIFO in reset */
514 out_be32(lpbfifo.regs + LPBFIFO_REG_ENABLE, 0x01010000);
515
516 /* Release the bestcomm transmit task */
517 free_irq(bcom_get_task_irq(lpbfifo.bcom_tx_task), &lpbfifo);
518 bcom_gen_bd_tx_release(lpbfifo.bcom_tx_task);
519
520 /* Release the bestcomm receive task */
521 free_irq(bcom_get_task_irq(lpbfifo.bcom_rx_task), &lpbfifo);
522 bcom_gen_bd_rx_release(lpbfifo.bcom_rx_task);
523
524 free_irq(lpbfifo.irq, &lpbfifo);
525 iounmap(lpbfifo.regs);
526 lpbfifo.regs = NULL;
527 lpbfifo.dev = NULL;
528
529 return 0;
530}
531
532static struct of_device_id mpc52xx_lpbfifo_match[] __devinitconst = {
533 { .compatible = "fsl,mpc5200-lpbfifo", },
534 {},
535};
536
537static struct of_platform_driver mpc52xx_lpbfifo_driver = {
538 .owner = THIS_MODULE,
539 .name = "mpc52xx-lpbfifo",
540 .match_table = mpc52xx_lpbfifo_match,
541 .probe = mpc52xx_lpbfifo_probe,
542 .remove = __devexit_p(mpc52xx_lpbfifo_remove),
543};
544
545/***********************************************************************
546 * Module init/exit
547 */
548static int __init mpc52xx_lpbfifo_init(void)
549{
550 pr_debug("Registering LocalPlus bus FIFO driver\n");
551 return of_register_platform_driver(&mpc52xx_lpbfifo_driver);
552}
553module_init(mpc52xx_lpbfifo_init);
554
555static void __exit mpc52xx_lpbfifo_exit(void)
556{
557 pr_debug("Unregistering LocalPlus bus FIFO driver\n");
558 of_unregister_platform_driver(&mpc52xx_lpbfifo_driver);
559}
560module_exit(mpc52xx_lpbfifo_exit);
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pic.c b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
index 480f806fd0a9..4bf4bf7b063e 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -220,7 +220,7 @@ static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
220} 220}
221 221
222static struct irq_chip mpc52xx_extirq_irqchip = { 222static struct irq_chip mpc52xx_extirq_irqchip = {
223 .typename = "MPC52xx External", 223 .name = "MPC52xx External",
224 .mask = mpc52xx_extirq_mask, 224 .mask = mpc52xx_extirq_mask,
225 .unmask = mpc52xx_extirq_unmask, 225 .unmask = mpc52xx_extirq_unmask,
226 .ack = mpc52xx_extirq_ack, 226 .ack = mpc52xx_extirq_ack,
@@ -258,7 +258,7 @@ static void mpc52xx_main_unmask(unsigned int virq)
258} 258}
259 259
260static struct irq_chip mpc52xx_main_irqchip = { 260static struct irq_chip mpc52xx_main_irqchip = {
261 .typename = "MPC52xx Main", 261 .name = "MPC52xx Main",
262 .mask = mpc52xx_main_mask, 262 .mask = mpc52xx_main_mask,
263 .mask_ack = mpc52xx_main_mask, 263 .mask_ack = mpc52xx_main_mask,
264 .unmask = mpc52xx_main_unmask, 264 .unmask = mpc52xx_main_unmask,
@@ -291,7 +291,7 @@ static void mpc52xx_periph_unmask(unsigned int virq)
291} 291}
292 292
293static struct irq_chip mpc52xx_periph_irqchip = { 293static struct irq_chip mpc52xx_periph_irqchip = {
294 .typename = "MPC52xx Peripherals", 294 .name = "MPC52xx Peripherals",
295 .mask = mpc52xx_periph_mask, 295 .mask = mpc52xx_periph_mask,
296 .mask_ack = mpc52xx_periph_mask, 296 .mask_ack = mpc52xx_periph_mask,
297 .unmask = mpc52xx_periph_unmask, 297 .unmask = mpc52xx_periph_unmask,
@@ -335,7 +335,7 @@ static void mpc52xx_sdma_ack(unsigned int virq)
335} 335}
336 336
337static struct irq_chip mpc52xx_sdma_irqchip = { 337static struct irq_chip mpc52xx_sdma_irqchip = {
338 .typename = "MPC52xx SDMA", 338 .name = "MPC52xx SDMA",
339 .mask = mpc52xx_sdma_mask, 339 .mask = mpc52xx_sdma_mask,
340 .unmask = mpc52xx_sdma_unmask, 340 .unmask = mpc52xx_sdma_unmask,
341 .ack = mpc52xx_sdma_ack, 341 .ack = mpc52xx_sdma_ack,
@@ -355,7 +355,7 @@ static int mpc52xx_is_extirq(int l1, int l2)
355 * mpc52xx_irqhost_xlate - translate virq# from device tree interrupts property 355 * mpc52xx_irqhost_xlate - translate virq# from device tree interrupts property
356 */ 356 */
357static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct, 357static int mpc52xx_irqhost_xlate(struct irq_host *h, struct device_node *ct,
358 u32 *intspec, unsigned int intsize, 358 const u32 *intspec, unsigned int intsize,
359 irq_hw_number_t *out_hwirq, 359 irq_hw_number_t *out_hwirq,
360 unsigned int *out_flags) 360 unsigned int *out_flags)
361{ 361{
diff --git a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
index 7ee979f323d1..9d962d7c72c1 100644
--- a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
+++ b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
@@ -69,7 +69,6 @@ static void pq2ads_pci_unmask_irq(unsigned int virq)
69} 69}
70 70
71static struct irq_chip pq2ads_pci_ic = { 71static struct irq_chip pq2ads_pci_ic = {
72 .typename = "PQ2 ADS PCI",
73 .name = "PQ2 ADS PCI", 72 .name = "PQ2 ADS PCI",
74 .end = pq2ads_pci_unmask_irq, 73 .end = pq2ads_pci_unmask_irq,
75 .mask = pq2ads_pci_mask_irq, 74 .mask = pq2ads_pci_mask_irq,
@@ -107,7 +106,7 @@ static void pq2ads_pci_irq_demux(unsigned int irq, struct irq_desc *desc)
107static int pci_pic_host_map(struct irq_host *h, unsigned int virq, 106static int pci_pic_host_map(struct irq_host *h, unsigned int virq,
108 irq_hw_number_t hw) 107 irq_hw_number_t hw)
109{ 108{
110 get_irq_desc(virq)->status |= IRQ_LEVEL; 109 irq_to_desc(virq)->status |= IRQ_LEVEL;
111 set_irq_chip_data(virq, h->host_data); 110 set_irq_chip_data(virq, h->host_data);
112 set_irq_chip_and_handler(virq, &pq2ads_pci_ic, handle_level_irq); 111 set_irq_chip_and_handler(virq, &pq2ads_pci_ic, handle_level_irq);
113 return 0; 112 return 0;
diff --git a/arch/powerpc/platforms/83xx/mpc832x_rdb.c b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
index 567ded7c3b9b..17f99745f0e4 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_rdb.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_rdb.c
@@ -74,7 +74,7 @@ static int __init of_fsl_spi_probe(char *type, char *compatible, u32 sysclk,
74 74
75 prop = of_get_property(np, "mode", NULL); 75 prop = of_get_property(np, "mode", NULL);
76 if (prop && !strcmp(prop, "cpu-qe")) 76 if (prop && !strcmp(prop, "cpu-qe"))
77 pdata.qe_mode = 1; 77 pdata.flags = SPI_QE_CPU_MODE;
78 78
79 for (j = 0; j < num_board_infos; j++) { 79 for (j = 0; j < num_board_infos; j++) {
80 if (board_infos[j].bus_num == pdata.bus_num) 80 if (board_infos[j].bus_num == pdata.bus_num)
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index 08e65fc8b98c..d306f07b9aa1 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -96,6 +96,7 @@ int fsl_deep_sleep(void)
96{ 96{
97 return deep_sleeping; 97 return deep_sleeping;
98} 98}
99EXPORT_SYMBOL(fsl_deep_sleep);
99 100
100static int mpc83xx_change_state(void) 101static int mpc83xx_change_state(void)
101{ 102{
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index d3a975e8fd3e..d95121894eb7 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -1,6 +1,7 @@
1menuconfig MPC85xx 1menuconfig FSL_SOC_BOOKE
2 bool "Machine Type" 2 bool "Freescale Book-E Machine Type"
3 depends on PPC_85xx 3 depends on PPC_85xx || PPC_BOOK3E
4 select FSL_SOC
4 select PPC_UDBG_16550 5 select PPC_UDBG_16550
5 select MPIC 6 select MPIC
6 select PPC_PCI_CHOICE 7 select PPC_PCI_CHOICE
@@ -8,7 +9,7 @@ menuconfig MPC85xx
8 select SERIAL_8250_SHARE_IRQ if SERIAL_8250 9 select SERIAL_8250_SHARE_IRQ if SERIAL_8250
9 default y 10 default y
10 11
11if MPC85xx 12if FSL_SOC_BOOKE
12 13
13config MPC8540_ADS 14config MPC8540_ADS
14 bool "Freescale MPC8540 ADS" 15 bool "Freescale MPC8540 ADS"
@@ -144,7 +145,19 @@ config SBC8560
144 help 145 help
145 This option enables support for the Wind River SBC8560 board 146 This option enables support for the Wind River SBC8560 board
146 147
147endif # MPC85xx 148config P4080_DS
149 bool "Freescale P4080 DS"
150 select DEFAULT_UIMAGE
151 select PPC_FSL_BOOK3E
152 select PPC_E500MC
153 select PHYS_64BIT
154 select SWIOTLB
155 select MPC8xxx_GPIO
156 select HAS_RAPIDIO
157 help
158 This option enables support for the P4080 DS board
159
160endif # FSL_SOC_BOOKE
148 161
149config TQM85xx 162config TQM85xx
150 bool 163 bool
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 9098aea0cf32..387c128f2c8c 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MPC8536_DS) += mpc8536_ds.o
10obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o 10obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o
11obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o 11obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
12obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o 12obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
13obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
13obj-$(CONFIG_STX_GP3) += stx_gp3.o 14obj-$(CONFIG_STX_GP3) += stx_gp3.o
14obj-$(CONFIG_TQM85xx) += tqm85xx.o 15obj-$(CONFIG_TQM85xx) += tqm85xx.o
15obj-$(CONFIG_SBC8560) += sbc8560.o 16obj-$(CONFIG_SBC8560) += sbc8560.o
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.c b/arch/powerpc/platforms/85xx/corenet_ds.c
new file mode 100644
index 000000000000..534c2ecc89d9
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/corenet_ds.c
@@ -0,0 +1,125 @@
1/*
2 * Corenet based SoC DS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2009 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19#include <linux/lmb.h>
20
21#include <asm/system.h>
22#include <asm/time.h>
23#include <asm/machdep.h>
24#include <asm/pci-bridge.h>
25#include <mm/mmu_decl.h>
26#include <asm/prom.h>
27#include <asm/udbg.h>
28#include <asm/mpic.h>
29
30#include <linux/of_platform.h>
31#include <sysdev/fsl_soc.h>
32#include <sysdev/fsl_pci.h>
33
34void __init corenet_ds_pic_init(void)
35{
36 struct mpic *mpic;
37 struct resource r;
38 struct device_node *np = NULL;
39 unsigned int flags = MPIC_PRIMARY | MPIC_BIG_ENDIAN |
40 MPIC_BROKEN_FRR_NIRQS | MPIC_SINGLE_DEST_CPU;
41
42 np = of_find_node_by_type(np, "open-pic");
43
44 if (np == NULL) {
45 printk(KERN_ERR "Could not find open-pic node\n");
46 return;
47 }
48
49 if (of_address_to_resource(np, 0, &r)) {
50 printk(KERN_ERR "Failed to map mpic register space\n");
51 of_node_put(np);
52 return;
53 }
54
55 if (ppc_md.get_irq == mpic_get_coreint_irq)
56 flags |= MPIC_ENABLE_COREINT;
57
58 mpic = mpic_alloc(np, r.start, flags, 0, 256, " OpenPIC ");
59 BUG_ON(mpic == NULL);
60
61 mpic_init(mpic);
62}
63
64#ifdef CONFIG_PCI
65static int primary_phb_addr;
66#endif
67
68/*
69 * Setup the architecture
70 */
71#ifdef CONFIG_SMP
72void __init mpc85xx_smp_init(void);
73#endif
74
75void __init corenet_ds_setup_arch(void)
76{
77#ifdef CONFIG_PCI
78 struct device_node *np;
79 struct pci_controller *hose;
80#endif
81 dma_addr_t max = 0xffffffff;
82
83#ifdef CONFIG_SMP
84 mpc85xx_smp_init();
85#endif
86
87#ifdef CONFIG_PCI
88 for_each_compatible_node(np, "pci", "fsl,p4080-pcie") {
89 struct resource rsrc;
90 of_address_to_resource(np, 0, &rsrc);
91 if ((rsrc.start & 0xfffff) == primary_phb_addr)
92 fsl_add_bridge(np, 1);
93 else
94 fsl_add_bridge(np, 0);
95
96 hose = pci_find_hose_for_OF_device(np);
97 max = min(max, hose->dma_window_base_cur +
98 hose->dma_window_size);
99 }
100#endif
101
102#ifdef CONFIG_SWIOTLB
103 if (lmb_end_of_DRAM() > max) {
104 ppc_swiotlb_enable = 1;
105 set_pci_dma_ops(&swiotlb_dma_ops);
106 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
107 }
108#endif
109 pr_info("%s board from Freescale Semiconductor\n", ppc_md.name);
110}
111
112static const struct of_device_id of_device_ids[] __devinitconst = {
113 {
114 .compatible = "simple-bus"
115 },
116 {
117 .compatible = "fsl,rapidio-delta",
118 },
119 {}
120};
121
122int __init corenet_ds_publish_devices(void)
123{
124 return of_platform_bus_probe(NULL, of_device_ids, NULL);
125}
diff --git a/arch/powerpc/platforms/85xx/corenet_ds.h b/arch/powerpc/platforms/85xx/corenet_ds.h
new file mode 100644
index 000000000000..ddd700b23031
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/corenet_ds.h
@@ -0,0 +1,19 @@
1/*
2 * Corenet based SoC DS Setup
3 *
4 * Copyright 2009 Freescale Semiconductor Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 */
11
12#ifndef CORENET_DS_H
13#define CORENET_DS_H
14
15extern void __init corenet_ds_pic_init(void);
16extern void __init corenet_ds_setup_arch(void);
17extern int __init corenet_ds_publish_devices(void);
18
19#endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 3909d57b86e3..c5028a2e5a58 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -301,6 +301,7 @@ static struct of_device_id mpc85xx_ids[] = {
301 { .compatible = "fsl,qe", }, 301 { .compatible = "fsl,qe", },
302 { .compatible = "gianfar", }, 302 { .compatible = "gianfar", },
303 { .compatible = "fsl,rapidio-delta", }, 303 { .compatible = "fsl,rapidio-delta", },
304 { .compatible = "fsl,mpc8548-guts", },
304 {}, 305 {},
305}; 306};
306 307
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
index c8468de4acf6..088f30b0c088 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_rdb.c
@@ -44,6 +44,7 @@ void __init mpc85xx_rdb_pic_init(void)
44 struct mpic *mpic; 44 struct mpic *mpic;
45 struct resource r; 45 struct resource r;
46 struct device_node *np; 46 struct device_node *np;
47 unsigned long root = of_get_flat_dt_root();
47 48
48 np = of_find_node_by_type(NULL, "open-pic"); 49 np = of_find_node_by_type(NULL, "open-pic");
49 if (np == NULL) { 50 if (np == NULL) {
@@ -57,11 +58,18 @@ void __init mpc85xx_rdb_pic_init(void)
57 return; 58 return;
58 } 59 }
59 60
60 mpic = mpic_alloc(np, r.start, 61 if (of_flat_dt_is_compatible(root, "fsl,85XXRDB-CAMP")) {
62 mpic = mpic_alloc(np, r.start,
63 MPIC_PRIMARY |
64 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS,
65 0, 256, " OpenPIC ");
66 } else {
67 mpic = mpic_alloc(np, r.start,
61 MPIC_PRIMARY | MPIC_WANTS_RESET | 68 MPIC_PRIMARY | MPIC_WANTS_RESET |
62 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS | 69 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
63 MPIC_SINGLE_DEST_CPU, 70 MPIC_SINGLE_DEST_CPU,
64 0, 256, " OpenPIC "); 71 0, 256, " OpenPIC ");
72 }
65 73
66 BUG_ON(mpic == NULL); 74 BUG_ON(mpic == NULL);
67 of_node_put(np); 75 of_node_put(np);
@@ -113,6 +121,7 @@ static int __init mpc85xxrdb_publish_devices(void)
113 return of_platform_bus_probe(NULL, mpc85xxrdb_ids, NULL); 121 return of_platform_bus_probe(NULL, mpc85xxrdb_ids, NULL);
114} 122}
115machine_device_initcall(p2020_rdb, mpc85xxrdb_publish_devices); 123machine_device_initcall(p2020_rdb, mpc85xxrdb_publish_devices);
124machine_device_initcall(p1020_rdb, mpc85xxrdb_publish_devices);
116 125
117/* 126/*
118 * Called very early, device-tree isn't unflattened 127 * Called very early, device-tree isn't unflattened
@@ -126,6 +135,15 @@ static int __init p2020_rdb_probe(void)
126 return 0; 135 return 0;
127} 136}
128 137
138static int __init p1020_rdb_probe(void)
139{
140 unsigned long root = of_get_flat_dt_root();
141
142 if (of_flat_dt_is_compatible(root, "fsl,P1020RDB"))
143 return 1;
144 return 0;
145}
146
129define_machine(p2020_rdb) { 147define_machine(p2020_rdb) {
130 .name = "P2020 RDB", 148 .name = "P2020 RDB",
131 .probe = p2020_rdb_probe, 149 .probe = p2020_rdb_probe,
@@ -139,3 +157,17 @@ define_machine(p2020_rdb) {
139 .calibrate_decr = generic_calibrate_decr, 157 .calibrate_decr = generic_calibrate_decr,
140 .progress = udbg_progress, 158 .progress = udbg_progress,
141}; 159};
160
161define_machine(p1020_rdb) {
162 .name = "P1020 RDB",
163 .probe = p1020_rdb_probe,
164 .setup_arch = mpc85xx_rdb_setup_arch,
165 .init_IRQ = mpc85xx_rdb_pic_init,
166#ifdef CONFIG_PCI
167 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
168#endif
169 .get_irq = mpic_get_irq,
170 .restart = fsl_rstcr_restart,
171 .calibrate_decr = generic_calibrate_decr,
172 .progress = udbg_progress,
173};
diff --git a/arch/powerpc/platforms/85xx/p4080_ds.c b/arch/powerpc/platforms/85xx/p4080_ds.c
new file mode 100644
index 000000000000..84170460497b
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p4080_ds.c
@@ -0,0 +1,74 @@
1/*
2 * P4080 DS Setup
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * Copyright 2009 Freescale Semiconductor Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/pci.h>
16#include <linux/kdev_t.h>
17#include <linux/delay.h>
18#include <linux/interrupt.h>
19
20#include <asm/system.h>
21#include <asm/time.h>
22#include <asm/machdep.h>
23#include <asm/pci-bridge.h>
24#include <mm/mmu_decl.h>
25#include <asm/prom.h>
26#include <asm/udbg.h>
27#include <asm/mpic.h>
28
29#include <linux/of_platform.h>
30#include <sysdev/fsl_soc.h>
31#include <sysdev/fsl_pci.h>
32
33#include "corenet_ds.h"
34
35#ifdef CONFIG_PCI
36static int primary_phb_addr;
37#endif
38
39/*
40 * Called very early, device-tree isn't unflattened
41 */
42static int __init p4080_ds_probe(void)
43{
44 unsigned long root = of_get_flat_dt_root();
45
46 if (of_flat_dt_is_compatible(root, "fsl,P4080DS")) {
47#ifdef CONFIG_PCI
48 /* treat PCIe1 as primary,
49 * shouldn't matter as we have no ISA on the board
50 */
51 primary_phb_addr = 0x0000;
52#endif
53 return 1;
54 } else {
55 return 0;
56 }
57}
58
59define_machine(p4080_ds) {
60 .name = "P4080 DS",
61 .probe = p4080_ds_probe,
62 .setup_arch = corenet_ds_setup_arch,
63 .init_IRQ = corenet_ds_pic_init,
64#ifdef CONFIG_PCI
65 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
66#endif
67 .get_irq = mpic_get_coreint_irq,
68 .restart = fsl_rstcr_restart,
69 .calibrate_decr = generic_calibrate_decr,
70 .progress = udbg_progress,
71};
72
73machine_device_initcall(p4080_ds, corenet_ds_publish_devices);
74machine_arch_initcall(p4080_ds, swiotlb_setup_bus_notifier);
diff --git a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
index 60edf63d0157..e5da5f62b24a 100644
--- a/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
+++ b/arch/powerpc/platforms/85xx/socrates_fpga_pic.c
@@ -232,7 +232,7 @@ static int socrates_fpga_pic_set_type(unsigned int virq,
232} 232}
233 233
234static struct irq_chip socrates_fpga_pic_chip = { 234static struct irq_chip socrates_fpga_pic_chip = {
235 .typename = " FPGA-PIC ", 235 .name = " FPGA-PIC ",
236 .ack = socrates_fpga_pic_ack, 236 .ack = socrates_fpga_pic_ack,
237 .mask = socrates_fpga_pic_mask, 237 .mask = socrates_fpga_pic_mask,
238 .mask_ack = socrates_fpga_pic_mask_ack, 238 .mask_ack = socrates_fpga_pic_mask_ack,
@@ -245,7 +245,7 @@ static int socrates_fpga_pic_host_map(struct irq_host *h, unsigned int virq,
245 irq_hw_number_t hwirq) 245 irq_hw_number_t hwirq)
246{ 246{
247 /* All interrupts are LEVEL sensitive */ 247 /* All interrupts are LEVEL sensitive */
248 get_irq_desc(virq)->status |= IRQ_LEVEL; 248 irq_to_desc(virq)->status |= IRQ_LEVEL;
249 set_irq_chip_and_handler(virq, &socrates_fpga_pic_chip, 249 set_irq_chip_and_handler(virq, &socrates_fpga_pic_chip,
250 handle_fasteoi_irq); 250 handle_fasteoi_irq);
251 251
@@ -253,7 +253,7 @@ static int socrates_fpga_pic_host_map(struct irq_host *h, unsigned int virq,
253} 253}
254 254
255static int socrates_fpga_pic_host_xlate(struct irq_host *h, 255static int socrates_fpga_pic_host_xlate(struct irq_host *h,
256 struct device_node *ct, u32 *intspec, unsigned int intsize, 256 struct device_node *ct, const u32 *intspec, unsigned int intsize,
257 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 257 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
258{ 258{
259 struct socrates_fpga_irq_info *fpga_irq = &fpga_irqs[intspec[0]]; 259 struct socrates_fpga_irq_info *fpga_irq = &fpga_irqs[intspec[0]];
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig
index 9c7b64a3402b..2bbfd530d6d8 100644
--- a/arch/powerpc/platforms/86xx/Kconfig
+++ b/arch/powerpc/platforms/86xx/Kconfig
@@ -35,6 +35,7 @@ config MPC8610_HPCD
35config GEF_PPC9A 35config GEF_PPC9A
36 bool "GE Fanuc PPC9A" 36 bool "GE Fanuc PPC9A"
37 select DEFAULT_UIMAGE 37 select DEFAULT_UIMAGE
38 select MMIO_NVRAM
38 select GENERIC_GPIO 39 select GENERIC_GPIO
39 select ARCH_REQUIRE_GPIOLIB 40 select ARCH_REQUIRE_GPIOLIB
40 help 41 help
@@ -43,6 +44,7 @@ config GEF_PPC9A
43config GEF_SBC310 44config GEF_SBC310
44 bool "GE Fanuc SBC310" 45 bool "GE Fanuc SBC310"
45 select DEFAULT_UIMAGE 46 select DEFAULT_UIMAGE
47 select MMIO_NVRAM
46 select GENERIC_GPIO 48 select GENERIC_GPIO
47 select ARCH_REQUIRE_GPIOLIB 49 select ARCH_REQUIRE_GPIOLIB
48 help 50 help
@@ -51,6 +53,7 @@ config GEF_SBC310
51config GEF_SBC610 53config GEF_SBC610
52 bool "GE Fanuc SBC610" 54 bool "GE Fanuc SBC610"
53 select DEFAULT_UIMAGE 55 select DEFAULT_UIMAGE
56 select MMIO_NVRAM
54 select GENERIC_GPIO 57 select GENERIC_GPIO
55 select ARCH_REQUIRE_GPIOLIB 58 select ARCH_REQUIRE_GPIOLIB
56 select HAS_RAPIDIO 59 select HAS_RAPIDIO
diff --git a/arch/powerpc/platforms/86xx/gef_pic.c b/arch/powerpc/platforms/86xx/gef_pic.c
index 50d0a2b63809..0110a8736d33 100644
--- a/arch/powerpc/platforms/86xx/gef_pic.c
+++ b/arch/powerpc/platforms/86xx/gef_pic.c
@@ -149,7 +149,7 @@ static void gef_pic_unmask(unsigned int virq)
149} 149}
150 150
151static struct irq_chip gef_pic_chip = { 151static struct irq_chip gef_pic_chip = {
152 .typename = "gefp", 152 .name = "gefp",
153 .mask = gef_pic_mask, 153 .mask = gef_pic_mask,
154 .mask_ack = gef_pic_mask_ack, 154 .mask_ack = gef_pic_mask_ack,
155 .unmask = gef_pic_unmask, 155 .unmask = gef_pic_unmask,
@@ -163,14 +163,14 @@ static int gef_pic_host_map(struct irq_host *h, unsigned int virq,
163 irq_hw_number_t hwirq) 163 irq_hw_number_t hwirq)
164{ 164{
165 /* All interrupts are LEVEL sensitive */ 165 /* All interrupts are LEVEL sensitive */
166 get_irq_desc(virq)->status |= IRQ_LEVEL; 166 irq_to_desc(virq)->status |= IRQ_LEVEL;
167 set_irq_chip_and_handler(virq, &gef_pic_chip, handle_level_irq); 167 set_irq_chip_and_handler(virq, &gef_pic_chip, handle_level_irq);
168 168
169 return 0; 169 return 0;
170} 170}
171 171
172static int gef_pic_host_xlate(struct irq_host *h, struct device_node *ct, 172static int gef_pic_host_xlate(struct irq_host *h, struct device_node *ct,
173 u32 *intspec, unsigned int intsize, 173 const u32 *intspec, unsigned int intsize,
174 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 174 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
175{ 175{
176 176
diff --git a/arch/powerpc/platforms/86xx/gef_ppc9a.c b/arch/powerpc/platforms/86xx/gef_ppc9a.c
index 287f7bd17dd9..a792e5d85813 100644
--- a/arch/powerpc/platforms/86xx/gef_ppc9a.c
+++ b/arch/powerpc/platforms/86xx/gef_ppc9a.c
@@ -33,6 +33,7 @@
33#include <asm/udbg.h> 33#include <asm/udbg.h>
34 34
35#include <asm/mpic.h> 35#include <asm/mpic.h>
36#include <asm/nvram.h>
36 37
37#include <sysdev/fsl_pci.h> 38#include <sysdev/fsl_pci.h>
38#include <sysdev/fsl_soc.h> 39#include <sysdev/fsl_soc.h>
@@ -95,6 +96,10 @@ static void __init gef_ppc9a_setup_arch(void)
95 printk(KERN_WARNING "Unable to map board registers\n"); 96 printk(KERN_WARNING "Unable to map board registers\n");
96 of_node_put(regs); 97 of_node_put(regs);
97 } 98 }
99
100#if defined(CONFIG_MMIO_NVRAM)
101 mmio_nvram_init();
102#endif
98} 103}
99 104
100/* Return the PCB revision */ 105/* Return the PCB revision */
diff --git a/arch/powerpc/platforms/86xx/gef_sbc310.c b/arch/powerpc/platforms/86xx/gef_sbc310.c
index 90754e752bd8..6a1a613836c2 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc310.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc310.c
@@ -33,6 +33,7 @@
33#include <asm/udbg.h> 33#include <asm/udbg.h>
34 34
35#include <asm/mpic.h> 35#include <asm/mpic.h>
36#include <asm/nvram.h>
36 37
37#include <sysdev/fsl_pci.h> 38#include <sysdev/fsl_pci.h>
38#include <sysdev/fsl_soc.h> 39#include <sysdev/fsl_soc.h>
@@ -95,6 +96,10 @@ static void __init gef_sbc310_setup_arch(void)
95 printk(KERN_WARNING "Unable to map board registers\n"); 96 printk(KERN_WARNING "Unable to map board registers\n");
96 of_node_put(regs); 97 of_node_put(regs);
97 } 98 }
99
100#if defined(CONFIG_MMIO_NVRAM)
101 mmio_nvram_init();
102#endif
98} 103}
99 104
100/* Return the PCB revision */ 105/* Return the PCB revision */
diff --git a/arch/powerpc/platforms/86xx/gef_sbc610.c b/arch/powerpc/platforms/86xx/gef_sbc610.c
index 72b31a6010a0..e10688a0fc4e 100644
--- a/arch/powerpc/platforms/86xx/gef_sbc610.c
+++ b/arch/powerpc/platforms/86xx/gef_sbc610.c
@@ -33,6 +33,7 @@
33#include <asm/udbg.h> 33#include <asm/udbg.h>
34 34
35#include <asm/mpic.h> 35#include <asm/mpic.h>
36#include <asm/nvram.h>
36 37
37#include <sysdev/fsl_pci.h> 38#include <sysdev/fsl_pci.h>
38#include <sysdev/fsl_soc.h> 39#include <sysdev/fsl_soc.h>
@@ -95,6 +96,10 @@ static void __init gef_sbc610_setup_arch(void)
95 printk(KERN_WARNING "Unable to map board registers\n"); 96 printk(KERN_WARNING "Unable to map board registers\n");
96 of_node_put(regs); 97 of_node_put(regs);
97 } 98 }
99
100#if defined(CONFIG_MMIO_NVRAM)
101 mmio_nvram_init();
102#endif
98} 103}
99 104
100/* Return the PCB revision */ 105/* Return the PCB revision */
diff --git a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
index 627908a4cd77..5abe137f6309 100644
--- a/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
+++ b/arch/powerpc/platforms/86xx/mpc8610_hpcd.c
@@ -19,6 +19,7 @@
19#include <linux/stddef.h> 19#include <linux/stddef.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/pci.h> 21#include <linux/pci.h>
22#include <linux/interrupt.h>
22#include <linux/kdev_t.h> 23#include <linux/kdev_t.h>
23#include <linux/delay.h> 24#include <linux/delay.h>
24#include <linux/seq_file.h> 25#include <linux/seq_file.h>
@@ -41,10 +42,46 @@
41 42
42#include "mpc86xx.h" 43#include "mpc86xx.h"
43 44
45static struct device_node *pixis_node;
44static unsigned char *pixis_bdcfg0, *pixis_arch; 46static unsigned char *pixis_bdcfg0, *pixis_arch;
45 47
48#ifdef CONFIG_SUSPEND
49static irqreturn_t mpc8610_sw9_irq(int irq, void *data)
50{
51 pr_debug("%s: PIXIS' event (sw9/wakeup) IRQ handled\n", __func__);
52 return IRQ_HANDLED;
53}
54
55static void __init mpc8610_suspend_init(void)
56{
57 int irq;
58 int ret;
59
60 if (!pixis_node)
61 return;
62
63 irq = irq_of_parse_and_map(pixis_node, 0);
64 if (!irq) {
65 pr_err("%s: can't map pixis event IRQ.\n", __func__);
66 return;
67 }
68
69 ret = request_irq(irq, mpc8610_sw9_irq, 0, "sw9/wakeup", NULL);
70 if (ret) {
71 pr_err("%s: can't request pixis event IRQ: %d\n",
72 __func__, ret);
73 irq_dispose_mapping(irq);
74 }
75
76 enable_irq_wake(irq);
77}
78#else
79static inline void mpc8610_suspend_init(void) { }
80#endif /* CONFIG_SUSPEND */
81
46static struct of_device_id __initdata mpc8610_ids[] = { 82static struct of_device_id __initdata mpc8610_ids[] = {
47 { .compatible = "fsl,mpc8610-immr", }, 83 { .compatible = "fsl,mpc8610-immr", },
84 { .compatible = "fsl,mpc8610-guts", },
48 { .compatible = "simple-bus", }, 85 { .compatible = "simple-bus", },
49 { .compatible = "gianfar", }, 86 { .compatible = "gianfar", },
50 {} 87 {}
@@ -55,6 +92,9 @@ static int __init mpc8610_declare_of_platform_devices(void)
55 /* Firstly, register PIXIS GPIOs. */ 92 /* Firstly, register PIXIS GPIOs. */
56 simple_gpiochip_init("fsl,fpga-pixis-gpio-bank"); 93 simple_gpiochip_init("fsl,fpga-pixis-gpio-bank");
57 94
95 /* Enable wakeup on PIXIS' event IRQ. */
96 mpc8610_suspend_init();
97
58 /* Without this call, the SSI device driver won't get probed. */ 98 /* Without this call, the SSI device driver won't get probed. */
59 of_platform_bus_probe(NULL, mpc8610_ids, NULL); 99 of_platform_bus_probe(NULL, mpc8610_ids, NULL);
60 100
@@ -250,10 +290,10 @@ static void __init mpc86xx_hpcd_setup_arch(void)
250 diu_ops.set_sysfs_monitor_port = mpc8610hpcd_set_sysfs_monitor_port; 290 diu_ops.set_sysfs_monitor_port = mpc8610hpcd_set_sysfs_monitor_port;
251#endif 291#endif
252 292
253 np = of_find_compatible_node(NULL, NULL, "fsl,fpga-pixis"); 293 pixis_node = of_find_compatible_node(NULL, NULL, "fsl,fpga-pixis");
254 if (np) { 294 if (pixis_node) {
255 of_address_to_resource(np, 0, &r); 295 of_address_to_resource(pixis_node, 0, &r);
256 of_node_put(np); 296 of_node_put(pixis_node);
257 pixis = ioremap(r.start, 32); 297 pixis = ioremap(r.start, 32);
258 if (!pixis) { 298 if (!pixis) {
259 printk(KERN_ERR "Err: can't map FPGA cfg register!\n"); 299 printk(KERN_ERR "Err: can't map FPGA cfg register!\n");
diff --git a/arch/powerpc/platforms/8xx/m8xx_setup.c b/arch/powerpc/platforms/8xx/m8xx_setup.c
index 385acfc48397..242954c4293f 100644
--- a/arch/powerpc/platforms/8xx/m8xx_setup.c
+++ b/arch/powerpc/platforms/8xx/m8xx_setup.c
@@ -222,7 +222,7 @@ static void cpm_cascade(unsigned int irq, struct irq_desc *desc)
222 int cascade_irq; 222 int cascade_irq;
223 223
224 if ((cascade_irq = cpm_get_irq()) >= 0) { 224 if ((cascade_irq = cpm_get_irq()) >= 0) {
225 struct irq_desc *cdesc = irq_desc + cascade_irq; 225 struct irq_desc *cdesc = irq_to_desc(cascade_irq);
226 226
227 generic_handle_irq(cascade_irq); 227 generic_handle_irq(cascade_irq);
228 cdesc->chip->eoi(cascade_irq); 228 cdesc->chip->eoi(cascade_irq);
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 04a8061045c4..d1663db7810f 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -86,6 +86,11 @@ config RTAS_ERROR_LOGGING
86 depends on PPC_RTAS 86 depends on PPC_RTAS
87 default n 87 default n
88 88
89config PPC_RTAS_DAEMON
90 bool
91 depends on PPC_RTAS
92 default n
93
89config RTAS_PROC 94config RTAS_PROC
90 bool "Proc interface to RTAS" 95 bool "Proc interface to RTAS"
91 depends on PPC_RTAS 96 depends on PPC_RTAS
@@ -255,7 +260,7 @@ config QE_GPIO
255 260
256config CPM2 261config CPM2
257 bool "Enable support for the CPM2 (Communications Processor Module)" 262 bool "Enable support for the CPM2 (Communications Processor Module)"
258 depends on MPC85xx || 8260 263 depends on (FSL_SOC_BOOKE && PPC32) || 8260
259 select CPM 264 select CPM
260 select PPC_LIB_RHEAP 265 select PPC_LIB_RHEAP
261 select PPC_PCI_CHOICE 266 select PPC_PCI_CHOICE
@@ -300,7 +305,7 @@ source "arch/powerpc/sysdev/bestcomm/Kconfig"
300 305
301config MPC8xxx_GPIO 306config MPC8xxx_GPIO
302 bool "MPC8xxx GPIO support" 307 bool "MPC8xxx GPIO support"
303 depends on PPC_MPC831x || PPC_MPC834x || PPC_MPC837x || PPC_85xx || PPC_86xx 308 depends on PPC_MPC831x || PPC_MPC834x || PPC_MPC837x || FSL_SOC_BOOKE || PPC_86xx
304 select GENERIC_GPIO 309 select GENERIC_GPIO
305 select ARCH_REQUIRE_GPIOLIB 310 select ARCH_REQUIRE_GPIOLIB
306 help 311 help
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index e382cae678b8..2eab27a94cc9 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -28,8 +28,6 @@ config PPC_BOOK3S_32
28config PPC_85xx 28config PPC_85xx
29 bool "Freescale 85xx" 29 bool "Freescale 85xx"
30 select E500 30 select E500
31 select FSL_SOC
32 select MPC85xx
33 31
34config PPC_8xx 32config PPC_8xx
35 bool "Freescale 8xx" 33 bool "Freescale 8xx"
@@ -138,6 +136,14 @@ config PPC_FPU
138 bool 136 bool
139 default y if PPC64 137 default y if PPC64
140 138
139config FSL_EMB_PERFMON
140 bool "Freescale Embedded Perfmon"
141 depends on E500 || PPC_83xx
142 help
143 This is the Performance Monitor support found on the e500 core
144 and some e300 cores (c3 and c4). Select this only if your
145 core supports the Embedded Performance Monitor APU
146
141config 4xx 147config 4xx
142 bool 148 bool
143 depends on 40x || 44x 149 depends on 40x || 44x
@@ -153,13 +159,6 @@ config FSL_BOOKE
153 depends on E200 || E500 159 depends on E200 || E500
154 default y 160 default y
155 161
156config FSL_EMB_PERFMON
157 bool "Freescale Embedded Perfmon"
158 depends on E500 || PPC_83xx
159 help
160 This is the Performance Monitor support found on the e500 core
161 and some e300 cores (c3 and c4). Select this only if your
162 core supports the Embedded Performance Monitor APU
163 162
164config PTE_64BIT 163config PTE_64BIT
165 bool 164 bool
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index a6812ee00100..fdb9f0b0d7a8 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -12,7 +12,7 @@ obj-$(CONFIG_PPC_MPC52xx) += 52xx/
12obj-$(CONFIG_PPC_8xx) += 8xx/ 12obj-$(CONFIG_PPC_8xx) += 8xx/
13obj-$(CONFIG_PPC_82xx) += 82xx/ 13obj-$(CONFIG_PPC_82xx) += 82xx/
14obj-$(CONFIG_PPC_83xx) += 83xx/ 14obj-$(CONFIG_PPC_83xx) += 83xx/
15obj-$(CONFIG_PPC_85xx) += 85xx/ 15obj-$(CONFIG_FSL_SOC_BOOKE) += 85xx/
16obj-$(CONFIG_PPC_86xx) += 86xx/ 16obj-$(CONFIG_PPC_86xx) += 86xx/
17obj-$(CONFIG_PPC_PSERIES) += pseries/ 17obj-$(CONFIG_PPC_PSERIES) += pseries/
18obj-$(CONFIG_PPC_ISERIES) += iseries/ 18obj-$(CONFIG_PPC_ISERIES) += iseries/
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index a86c34b3bb84..96fe896f6df3 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -312,7 +312,7 @@ static struct irq_chip msic_irq_chip = {
312 .mask = mask_msi_irq, 312 .mask = mask_msi_irq,
313 .unmask = unmask_msi_irq, 313 .unmask = unmask_msi_irq,
314 .shutdown = unmask_msi_irq, 314 .shutdown = unmask_msi_irq,
315 .typename = "AXON-MSI", 315 .name = "AXON-MSI",
316}; 316};
317 317
318static int msic_host_map(struct irq_host *h, unsigned int virq, 318static int msic_host_map(struct irq_host *h, unsigned int virq,
diff --git a/arch/powerpc/platforms/cell/beat_interrupt.c b/arch/powerpc/platforms/cell/beat_interrupt.c
index 72254848a228..36052a9ebcda 100644
--- a/arch/powerpc/platforms/cell/beat_interrupt.c
+++ b/arch/powerpc/platforms/cell/beat_interrupt.c
@@ -110,7 +110,7 @@ static void beatic_end_irq(unsigned int irq_plug)
110} 110}
111 111
112static struct irq_chip beatic_pic = { 112static struct irq_chip beatic_pic = {
113 .typename = " CELL-BEAT ", 113 .name = " CELL-BEAT ",
114 .unmask = beatic_unmask_irq, 114 .unmask = beatic_unmask_irq,
115 .mask = beatic_mask_irq, 115 .mask = beatic_mask_irq,
116 .eoi = beatic_end_irq, 116 .eoi = beatic_end_irq,
@@ -136,7 +136,7 @@ static void beatic_pic_host_unmap(struct irq_host *h, unsigned int virq)
136static int beatic_pic_host_map(struct irq_host *h, unsigned int virq, 136static int beatic_pic_host_map(struct irq_host *h, unsigned int virq,
137 irq_hw_number_t hw) 137 irq_hw_number_t hw)
138{ 138{
139 struct irq_desc *desc = get_irq_desc(virq); 139 struct irq_desc *desc = irq_to_desc(virq);
140 int64_t err; 140 int64_t err;
141 141
142 err = beat_construct_and_connect_irq_plug(virq, hw); 142 err = beat_construct_and_connect_irq_plug(virq, hw);
@@ -166,11 +166,11 @@ static void beatic_pic_host_remap(struct irq_host *h, unsigned int virq,
166 * Note: We have only 1 entry to translate. 166 * Note: We have only 1 entry to translate.
167 */ 167 */
168static int beatic_pic_host_xlate(struct irq_host *h, struct device_node *ct, 168static int beatic_pic_host_xlate(struct irq_host *h, struct device_node *ct,
169 u32 *intspec, unsigned int intsize, 169 const u32 *intspec, unsigned int intsize,
170 irq_hw_number_t *out_hwirq, 170 irq_hw_number_t *out_hwirq,
171 unsigned int *out_flags) 171 unsigned int *out_flags)
172{ 172{
173 u64 *intspec2 = (u64 *)intspec; 173 const u64 *intspec2 = (const u64 *)intspec;
174 174
175 *out_hwirq = *intspec2; 175 *out_hwirq = *intspec2;
176 *out_flags |= IRQ_TYPE_LEVEL_LOW; 176 *out_flags |= IRQ_TYPE_LEVEL_LOW;
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 882e47080e74..7267effc8078 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -54,7 +54,7 @@ struct iic {
54 struct device_node *node; 54 struct device_node *node;
55}; 55};
56 56
57static DEFINE_PER_CPU(struct iic, iic); 57static DEFINE_PER_CPU(struct iic, cpu_iic);
58#define IIC_NODE_COUNT 2 58#define IIC_NODE_COUNT 2
59static struct irq_host *iic_host; 59static struct irq_host *iic_host;
60 60
@@ -82,13 +82,13 @@ static void iic_unmask(unsigned int irq)
82 82
83static void iic_eoi(unsigned int irq) 83static void iic_eoi(unsigned int irq)
84{ 84{
85 struct iic *iic = &__get_cpu_var(iic); 85 struct iic *iic = &__get_cpu_var(cpu_iic);
86 out_be64(&iic->regs->prio, iic->eoi_stack[--iic->eoi_ptr]); 86 out_be64(&iic->regs->prio, iic->eoi_stack[--iic->eoi_ptr]);
87 BUG_ON(iic->eoi_ptr < 0); 87 BUG_ON(iic->eoi_ptr < 0);
88} 88}
89 89
90static struct irq_chip iic_chip = { 90static struct irq_chip iic_chip = {
91 .typename = " CELL-IIC ", 91 .name = " CELL-IIC ",
92 .mask = iic_mask, 92 .mask = iic_mask,
93 .unmask = iic_unmask, 93 .unmask = iic_unmask,
94 .eoi = iic_eoi, 94 .eoi = iic_eoi,
@@ -133,7 +133,7 @@ static void iic_ioexc_cascade(unsigned int irq, struct irq_desc *desc)
133 133
134 134
135static struct irq_chip iic_ioexc_chip = { 135static struct irq_chip iic_ioexc_chip = {
136 .typename = " CELL-IOEX", 136 .name = " CELL-IOEX",
137 .mask = iic_mask, 137 .mask = iic_mask,
138 .unmask = iic_unmask, 138 .unmask = iic_unmask,
139 .eoi = iic_ioexc_eoi, 139 .eoi = iic_ioexc_eoi,
@@ -146,7 +146,7 @@ static unsigned int iic_get_irq(void)
146 struct iic *iic; 146 struct iic *iic;
147 unsigned int virq; 147 unsigned int virq;
148 148
149 iic = &__get_cpu_var(iic); 149 iic = &__get_cpu_var(cpu_iic);
150 *(unsigned long *) &pending = 150 *(unsigned long *) &pending =
151 in_be64((u64 __iomem *) &iic->regs->pending_destr); 151 in_be64((u64 __iomem *) &iic->regs->pending_destr);
152 if (!(pending.flags & CBE_IIC_IRQ_VALID)) 152 if (!(pending.flags & CBE_IIC_IRQ_VALID))
@@ -161,12 +161,12 @@ static unsigned int iic_get_irq(void)
161 161
162void iic_setup_cpu(void) 162void iic_setup_cpu(void)
163{ 163{
164 out_be64(&__get_cpu_var(iic).regs->prio, 0xff); 164 out_be64(&__get_cpu_var(cpu_iic).regs->prio, 0xff);
165} 165}
166 166
167u8 iic_get_target_id(int cpu) 167u8 iic_get_target_id(int cpu)
168{ 168{
169 return per_cpu(iic, cpu).target_id; 169 return per_cpu(cpu_iic, cpu).target_id;
170} 170}
171 171
172EXPORT_SYMBOL_GPL(iic_get_target_id); 172EXPORT_SYMBOL_GPL(iic_get_target_id);
@@ -181,7 +181,7 @@ static inline int iic_ipi_to_irq(int ipi)
181 181
182void iic_cause_IPI(int cpu, int mesg) 182void iic_cause_IPI(int cpu, int mesg)
183{ 183{
184 out_be64(&per_cpu(iic, cpu).regs->generate, (0xf - mesg) << 4); 184 out_be64(&per_cpu(cpu_iic, cpu).regs->generate, (0xf - mesg) << 4);
185} 185}
186 186
187struct irq_host *iic_get_irq_host(int node) 187struct irq_host *iic_get_irq_host(int node)
@@ -297,7 +297,7 @@ static int iic_host_map(struct irq_host *h, unsigned int virq,
297} 297}
298 298
299static int iic_host_xlate(struct irq_host *h, struct device_node *ct, 299static int iic_host_xlate(struct irq_host *h, struct device_node *ct,
300 u32 *intspec, unsigned int intsize, 300 const u32 *intspec, unsigned int intsize,
301 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 301 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
302 302
303{ 303{
@@ -348,7 +348,7 @@ static void __init init_one_iic(unsigned int hw_cpu, unsigned long addr,
348 /* XXX FIXME: should locate the linux CPU number from the HW cpu 348 /* XXX FIXME: should locate the linux CPU number from the HW cpu
349 * number properly. We are lucky for now 349 * number properly. We are lucky for now
350 */ 350 */
351 struct iic *iic = &per_cpu(iic, hw_cpu); 351 struct iic *iic = &per_cpu(cpu_iic, hw_cpu);
352 352
353 iic->regs = ioremap(addr, sizeof(struct cbe_iic_thread_regs)); 353 iic->regs = ioremap(addr, sizeof(struct cbe_iic_thread_regs));
354 BUG_ON(iic->regs == NULL); 354 BUG_ON(iic->regs == NULL);
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index 4e5655624ae8..01244f254a11 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -102,7 +102,7 @@ static void spider_ack_irq(unsigned int virq)
102 102
103 /* Reset edge detection logic if necessary 103 /* Reset edge detection logic if necessary
104 */ 104 */
105 if (get_irq_desc(virq)->status & IRQ_LEVEL) 105 if (irq_to_desc(virq)->status & IRQ_LEVEL)
106 return; 106 return;
107 107
108 /* Only interrupts 47 to 50 can be set to edge */ 108 /* Only interrupts 47 to 50 can be set to edge */
@@ -119,7 +119,7 @@ static int spider_set_irq_type(unsigned int virq, unsigned int type)
119 struct spider_pic *pic = spider_virq_to_pic(virq); 119 struct spider_pic *pic = spider_virq_to_pic(virq);
120 unsigned int hw = irq_map[virq].hwirq; 120 unsigned int hw = irq_map[virq].hwirq;
121 void __iomem *cfg = spider_get_irq_config(pic, hw); 121 void __iomem *cfg = spider_get_irq_config(pic, hw);
122 struct irq_desc *desc = get_irq_desc(virq); 122 struct irq_desc *desc = irq_to_desc(virq);
123 u32 old_mask; 123 u32 old_mask;
124 u32 ic; 124 u32 ic;
125 125
@@ -168,7 +168,7 @@ static int spider_set_irq_type(unsigned int virq, unsigned int type)
168} 168}
169 169
170static struct irq_chip spider_pic = { 170static struct irq_chip spider_pic = {
171 .typename = " SPIDER ", 171 .name = " SPIDER ",
172 .unmask = spider_unmask_irq, 172 .unmask = spider_unmask_irq,
173 .mask = spider_mask_irq, 173 .mask = spider_mask_irq,
174 .ack = spider_ack_irq, 174 .ack = spider_ack_irq,
@@ -187,7 +187,7 @@ static int spider_host_map(struct irq_host *h, unsigned int virq,
187} 187}
188 188
189static int spider_host_xlate(struct irq_host *h, struct device_node *ct, 189static int spider_host_xlate(struct irq_host *h, struct device_node *ct,
190 u32 *intspec, unsigned int intsize, 190 const u32 *intspec, unsigned int intsize,
191 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 191 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
192 192
193{ 193{
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index 884e8bcec499..64a4c2d85f7c 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -2494,7 +2494,7 @@ static ssize_t spufs_switch_log_read(struct file *file, char __user *buf,
2494 struct spu_context *ctx = SPUFS_I(inode)->i_ctx; 2494 struct spu_context *ctx = SPUFS_I(inode)->i_ctx;
2495 int error = 0, cnt = 0; 2495 int error = 0, cnt = 0;
2496 2496
2497 if (!buf || len < 0) 2497 if (!buf)
2498 return -EINVAL; 2498 return -EINVAL;
2499 2499
2500 error = spu_acquire(ctx); 2500 error = spu_acquire(ctx);
diff --git a/arch/powerpc/platforms/chrp/Kconfig b/arch/powerpc/platforms/chrp/Kconfig
index 37d438bd5b7a..bc0b0efdc5fe 100644
--- a/arch/powerpc/platforms/chrp/Kconfig
+++ b/arch/powerpc/platforms/chrp/Kconfig
@@ -5,6 +5,8 @@ config PPC_CHRP
5 select PPC_I8259 5 select PPC_I8259
6 select PPC_INDIRECT_PCI 6 select PPC_INDIRECT_PCI
7 select PPC_RTAS 7 select PPC_RTAS
8 select PPC_RTAS_DAEMON
9 select RTAS_ERROR_LOGGING
8 select PPC_MPC106 10 select PPC_MPC106
9 select PPC_UDBG_16550 11 select PPC_UDBG_16550
10 select PPC_NATIVE 12 select PPC_NATIVE
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index cd4ad9aea760..52f3df3b4ca0 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -364,19 +364,6 @@ void __init chrp_setup_arch(void)
364 if (ppc_md.progress) ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0x0); 364 if (ppc_md.progress) ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0x0);
365} 365}
366 366
367void
368chrp_event_scan(unsigned long unused)
369{
370 unsigned char log[1024];
371 int ret = 0;
372
373 /* XXX: we should loop until the hardware says no more error logs -- Cort */
374 rtas_call(rtas_token("event-scan"), 4, 1, &ret, 0xffffffff, 0,
375 __pa(log), 1024);
376 mod_timer(&__get_cpu_var(heartbeat_timer),
377 jiffies + event_scan_interval);
378}
379
380static void chrp_8259_cascade(unsigned int irq, struct irq_desc *desc) 367static void chrp_8259_cascade(unsigned int irq, struct irq_desc *desc)
381{ 368{
382 unsigned int cascade_irq = i8259_irq(); 369 unsigned int cascade_irq = i8259_irq();
@@ -568,9 +555,6 @@ void __init chrp_init_IRQ(void)
568void __init 555void __init
569chrp_init2(void) 556chrp_init2(void)
570{ 557{
571 struct device_node *device;
572 const unsigned int *p = NULL;
573
574#ifdef CONFIG_NVRAM 558#ifdef CONFIG_NVRAM
575 chrp_nvram_init(); 559 chrp_nvram_init();
576#endif 560#endif
@@ -582,40 +566,6 @@ chrp_init2(void)
582 request_region(0x80,0x10,"dma page reg"); 566 request_region(0x80,0x10,"dma page reg");
583 request_region(0xc0,0x20,"dma2"); 567 request_region(0xc0,0x20,"dma2");
584 568
585 /* Get the event scan rate for the rtas so we know how
586 * often it expects a heartbeat. -- Cort
587 */
588 device = of_find_node_by_name(NULL, "rtas");
589 if (device)
590 p = of_get_property(device, "rtas-event-scan-rate", NULL);
591 if (p && *p) {
592 /*
593 * Arrange to call chrp_event_scan at least *p times
594 * per minute. We use 59 rather than 60 here so that
595 * the rate will be slightly higher than the minimum.
596 * This all assumes we don't do hotplug CPU on any
597 * machine that needs the event scans done.
598 */
599 unsigned long interval, offset;
600 int cpu, ncpus;
601 struct timer_list *timer;
602
603 interval = HZ * 59 / *p;
604 offset = HZ;
605 ncpus = num_online_cpus();
606 event_scan_interval = ncpus * interval;
607 for (cpu = 0; cpu < ncpus; ++cpu) {
608 timer = &per_cpu(heartbeat_timer, cpu);
609 setup_timer(timer, chrp_event_scan, 0);
610 timer->expires = jiffies + offset;
611 add_timer_on(timer, cpu);
612 offset += interval;
613 }
614 printk("RTAS Event Scan Rate: %u (%lu jiffies)\n",
615 *p, interval);
616 }
617 of_node_put(device);
618
619 if (ppc_md.progress) 569 if (ppc_md.progress)
620 ppc_md.progress(" Have fun! ", 0x7777); 570 ppc_md.progress(" Have fun! ", 0x7777);
621} 571}
diff --git a/arch/powerpc/platforms/iseries/htab.c b/arch/powerpc/platforms/iseries/htab.c
index f99c6c4b6985..3ae66ab9d5e7 100644
--- a/arch/powerpc/platforms/iseries/htab.c
+++ b/arch/powerpc/platforms/iseries/htab.c
@@ -19,8 +19,7 @@
19 19
20#include "call_hpt.h" 20#include "call_hpt.h"
21 21
22static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp = 22static spinlock_t iSeries_hlocks[64] __cacheline_aligned_in_smp;
23 { [0 ... 63] = SPIN_LOCK_UNLOCKED};
24 23
25/* 24/*
26 * Very primitive algorithm for picking up a lock 25 * Very primitive algorithm for picking up a lock
@@ -245,6 +244,11 @@ static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
245 244
246void __init hpte_init_iSeries(void) 245void __init hpte_init_iSeries(void)
247{ 246{
247 int i;
248
249 for (i = 0; i < ARRAY_SIZE(iSeries_hlocks); i++)
250 spin_lock_init(&iSeries_hlocks[i]);
251
248 ppc_md.hpte_invalidate = iSeries_hpte_invalidate; 252 ppc_md.hpte_invalidate = iSeries_hpte_invalidate;
249 ppc_md.hpte_updatepp = iSeries_hpte_updatepp; 253 ppc_md.hpte_updatepp = iSeries_hpte_updatepp;
250 ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp; 254 ppc_md.hpte_updateboltedpp = iSeries_hpte_updateboltedpp;
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index 94f444758836..07762259c60a 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -214,7 +214,7 @@ void __init iSeries_activate_IRQs()
214 unsigned long flags; 214 unsigned long flags;
215 215
216 for_each_irq (irq) { 216 for_each_irq (irq) {
217 struct irq_desc *desc = get_irq_desc(irq); 217 struct irq_desc *desc = irq_to_desc(irq);
218 218
219 if (desc && desc->chip && desc->chip->startup) { 219 if (desc && desc->chip && desc->chip->startup) {
220 spin_lock_irqsave(&desc->lock, flags); 220 spin_lock_irqsave(&desc->lock, flags);
@@ -273,7 +273,7 @@ static void iseries_end_IRQ(unsigned int irq)
273} 273}
274 274
275static struct irq_chip iseries_pic = { 275static struct irq_chip iseries_pic = {
276 .typename = "iSeries irq controller", 276 .name = "iSeries irq controller",
277 .startup = iseries_startup_IRQ, 277 .startup = iseries_startup_IRQ,
278 .shutdown = iseries_shutdown_IRQ, 278 .shutdown = iseries_shutdown_IRQ,
279 .unmask = iseries_enable_IRQ, 279 .unmask = iseries_enable_IRQ,
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index d212006a5b3c..09e827296276 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -152,12 +152,12 @@ static unsigned int pmac_startup_irq(unsigned int virq)
152 unsigned long bit = 1UL << (src & 0x1f); 152 unsigned long bit = 1UL << (src & 0x1f);
153 int i = src >> 5; 153 int i = src >> 5;
154 154
155 spin_lock_irqsave(&pmac_pic_lock, flags); 155 spin_lock_irqsave(&pmac_pic_lock, flags);
156 if ((irq_desc[virq].status & IRQ_LEVEL) == 0) 156 if ((irq_to_desc(virq)->status & IRQ_LEVEL) == 0)
157 out_le32(&pmac_irq_hw[i]->ack, bit); 157 out_le32(&pmac_irq_hw[i]->ack, bit);
158 __set_bit(src, ppc_cached_irq_mask); 158 __set_bit(src, ppc_cached_irq_mask);
159 __pmac_set_irq_mask(src, 0); 159 __pmac_set_irq_mask(src, 0);
160 spin_unlock_irqrestore(&pmac_pic_lock, flags); 160 spin_unlock_irqrestore(&pmac_pic_lock, flags);
161 161
162 return 0; 162 return 0;
163} 163}
@@ -195,7 +195,7 @@ static int pmac_retrigger(unsigned int virq)
195} 195}
196 196
197static struct irq_chip pmac_pic = { 197static struct irq_chip pmac_pic = {
198 .typename = " PMAC-PIC ", 198 .name = " PMAC-PIC ",
199 .startup = pmac_startup_irq, 199 .startup = pmac_startup_irq,
200 .mask = pmac_mask_irq, 200 .mask = pmac_mask_irq,
201 .ack = pmac_ack_irq, 201 .ack = pmac_ack_irq,
@@ -285,7 +285,7 @@ static int pmac_pic_host_match(struct irq_host *h, struct device_node *node)
285static int pmac_pic_host_map(struct irq_host *h, unsigned int virq, 285static int pmac_pic_host_map(struct irq_host *h, unsigned int virq,
286 irq_hw_number_t hw) 286 irq_hw_number_t hw)
287{ 287{
288 struct irq_desc *desc = get_irq_desc(virq); 288 struct irq_desc *desc = irq_to_desc(virq);
289 int level; 289 int level;
290 290
291 if (hw >= max_irqs) 291 if (hw >= max_irqs)
@@ -303,7 +303,7 @@ static int pmac_pic_host_map(struct irq_host *h, unsigned int virq,
303} 303}
304 304
305static int pmac_pic_host_xlate(struct irq_host *h, struct device_node *ct, 305static int pmac_pic_host_xlate(struct irq_host *h, struct device_node *ct,
306 u32 *intspec, unsigned int intsize, 306 const u32 *intspec, unsigned int intsize,
307 irq_hw_number_t *out_hwirq, 307 irq_hw_number_t *out_hwirq,
308 unsigned int *out_flags) 308 unsigned int *out_flags)
309 309
diff --git a/arch/powerpc/platforms/ps3/interrupt.c b/arch/powerpc/platforms/ps3/interrupt.c
index 8ec5ccf76b19..59d9712d7364 100644
--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -152,7 +152,7 @@ static void ps3_chip_eoi(unsigned int virq)
152 */ 152 */
153 153
154static struct irq_chip ps3_irq_chip = { 154static struct irq_chip ps3_irq_chip = {
155 .typename = "ps3", 155 .name = "ps3",
156 .mask = ps3_chip_mask, 156 .mask = ps3_chip_mask,
157 .unmask = ps3_chip_unmask, 157 .unmask = ps3_chip_unmask,
158 .eoi = ps3_chip_eoi, 158 .eoi = ps3_chip_eoi,
diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 189a25b80735..e81b028a2a48 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -34,7 +34,7 @@
34#if defined(DEBUG) 34#if defined(DEBUG)
35#define DBG udbg_printf 35#define DBG udbg_printf
36#else 36#else
37#define DBG pr_debug 37#define DBG pr_devel
38#endif 38#endif
39 39
40enum { 40enum {
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index f0e6f28427bd..27554c807fd5 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -4,6 +4,7 @@ config PPC_PSERIES
4 select MPIC 4 select MPIC
5 select PPC_I8259 5 select PPC_I8259
6 select PPC_RTAS 6 select PPC_RTAS
7 select PPC_RTAS_DAEMON
7 select RTAS_ERROR_LOGGING 8 select RTAS_ERROR_LOGGING
8 select PPC_UDBG_16550 9 select PPC_UDBG_16550
9 select PPC_NATIVE 10 select PPC_NATIVE
@@ -59,7 +60,7 @@ config PPC_SMLPAR
59 60
60config CMM 61config CMM
61 tristate "Collaborative memory management" 62 tristate "Collaborative memory management"
62 depends on PPC_SMLPAR && !CRASH_DUMP 63 depends on PPC_SMLPAR
63 default y 64 default y
64 help 65 help
65 Select this option, if you want to enable the kernel interface 66 Select this option, if you want to enable the kernel interface
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 790c0b872d4f..0ff5174ae4f5 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -7,8 +7,8 @@ EXTRA_CFLAGS += -DDEBUG
7endif 7endif
8 8
9obj-y := lpar.o hvCall.o nvram.o reconfig.o \ 9obj-y := lpar.o hvCall.o nvram.o reconfig.o \
10 setup.o iommu.o ras.o rtasd.o \ 10 setup.o iommu.o ras.o \
11 firmware.o power.o 11 firmware.o power.o dlpar.o
12obj-$(CONFIG_SMP) += smp.o 12obj-$(CONFIG_SMP) += smp.o
13obj-$(CONFIG_XICS) += xics.o 13obj-$(CONFIG_XICS) += xics.o
14obj-$(CONFIG_SCANLOG) += scanlog.o 14obj-$(CONFIG_SCANLOG) += scanlog.o
diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 6567439fe78d..bcdcf0ccc8d7 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -229,8 +229,9 @@ static void cmm_get_mpp(void)
229{ 229{
230 int rc; 230 int rc;
231 struct hvcall_mpp_data mpp_data; 231 struct hvcall_mpp_data mpp_data;
232 unsigned long active_pages_target; 232 signed long active_pages_target, page_loan_request, target;
233 signed long page_loan_request; 233 signed long total_pages = totalram_pages + loaned_pages;
234 signed long min_mem_pages = (min_mem_mb * 1024 * 1024) / PAGE_SIZE;
234 235
235 rc = h_get_mpp(&mpp_data); 236 rc = h_get_mpp(&mpp_data);
236 237
@@ -238,17 +239,25 @@ static void cmm_get_mpp(void)
238 return; 239 return;
239 240
240 page_loan_request = div_s64((s64)mpp_data.loan_request, PAGE_SIZE); 241 page_loan_request = div_s64((s64)mpp_data.loan_request, PAGE_SIZE);
241 loaned_pages_target = page_loan_request + loaned_pages; 242 target = page_loan_request + (signed long)loaned_pages;
242 if (loaned_pages_target > oom_freed_pages) 243
243 loaned_pages_target -= oom_freed_pages; 244 if (target < 0 || total_pages < min_mem_pages)
245 target = 0;
246
247 if (target > oom_freed_pages)
248 target -= oom_freed_pages;
244 else 249 else
245 loaned_pages_target = 0; 250 target = 0;
251
252 active_pages_target = total_pages - target;
253
254 if (min_mem_pages > active_pages_target)
255 target = total_pages - min_mem_pages;
246 256
247 active_pages_target = totalram_pages + loaned_pages - loaned_pages_target; 257 if (target < 0)
258 target = 0;
248 259
249 if ((min_mem_mb * 1024 * 1024) > (active_pages_target * PAGE_SIZE)) 260 loaned_pages_target = target;
250 loaned_pages_target = totalram_pages + loaned_pages -
251 ((min_mem_mb * 1024 * 1024) / PAGE_SIZE);
252 261
253 cmm_dbg("delta = %ld, loaned = %lu, target = %lu, oom = %lu, totalram = %lu\n", 262 cmm_dbg("delta = %ld, loaned = %lu, target = %lu, oom = %lu, totalram = %lu\n",
254 page_loan_request, loaned_pages, loaned_pages_target, 263 page_loan_request, loaned_pages, loaned_pages_target,
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
new file mode 100644
index 000000000000..12df9e8812a9
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -0,0 +1,558 @@
1/*
2 * Support for dynamic reconfiguration for PCI, Memory, and CPU
3 * Hotplug and Dynamic Logical Partitioning on RPA platforms.
4 *
5 * Copyright (C) 2009 Nathan Fontenot
6 * Copyright (C) 2009 IBM Corporation
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
10 * 2 as published by the Free Software Foundation.
11 */
12
13#include <linux/kernel.h>
14#include <linux/kref.h>
15#include <linux/notifier.h>
16#include <linux/proc_fs.h>
17#include <linux/spinlock.h>
18#include <linux/cpu.h>
19#include "offline_states.h"
20
21#include <asm/prom.h>
22#include <asm/machdep.h>
23#include <asm/uaccess.h>
24#include <asm/rtas.h>
25#include <asm/pSeries_reconfig.h>
26
27struct cc_workarea {
28 u32 drc_index;
29 u32 zero;
30 u32 name_offset;
31 u32 prop_length;
32 u32 prop_offset;
33};
34
35static void dlpar_free_cc_property(struct property *prop)
36{
37 kfree(prop->name);
38 kfree(prop->value);
39 kfree(prop);
40}
41
42static struct property *dlpar_parse_cc_property(struct cc_workarea *ccwa)
43{
44 struct property *prop;
45 char *name;
46 char *value;
47
48 prop = kzalloc(sizeof(*prop), GFP_KERNEL);
49 if (!prop)
50 return NULL;
51
52 name = (char *)ccwa + ccwa->name_offset;
53 prop->name = kstrdup(name, GFP_KERNEL);
54
55 prop->length = ccwa->prop_length;
56 value = (char *)ccwa + ccwa->prop_offset;
57 prop->value = kzalloc(prop->length, GFP_KERNEL);
58 if (!prop->value) {
59 dlpar_free_cc_property(prop);
60 return NULL;
61 }
62
63 memcpy(prop->value, value, prop->length);
64 return prop;
65}
66
67static struct device_node *dlpar_parse_cc_node(struct cc_workarea *ccwa)
68{
69 struct device_node *dn;
70 char *name;
71
72 dn = kzalloc(sizeof(*dn), GFP_KERNEL);
73 if (!dn)
74 return NULL;
75
76 /* The configure connector reported name does not contain a
77 * preceeding '/', so we allocate a buffer large enough to
78 * prepend this to the full_name.
79 */
80 name = (char *)ccwa + ccwa->name_offset;
81 dn->full_name = kmalloc(strlen(name) + 2, GFP_KERNEL);
82 if (!dn->full_name) {
83 kfree(dn);
84 return NULL;
85 }
86
87 sprintf(dn->full_name, "/%s", name);
88 return dn;
89}
90
91static void dlpar_free_one_cc_node(struct device_node *dn)
92{
93 struct property *prop;
94
95 while (dn->properties) {
96 prop = dn->properties;
97 dn->properties = prop->next;
98 dlpar_free_cc_property(prop);
99 }
100
101 kfree(dn->full_name);
102 kfree(dn);
103}
104
105static void dlpar_free_cc_nodes(struct device_node *dn)
106{
107 if (dn->child)
108 dlpar_free_cc_nodes(dn->child);
109
110 if (dn->sibling)
111 dlpar_free_cc_nodes(dn->sibling);
112
113 dlpar_free_one_cc_node(dn);
114}
115
116#define NEXT_SIBLING 1
117#define NEXT_CHILD 2
118#define NEXT_PROPERTY 3
119#define PREV_PARENT 4
120#define MORE_MEMORY 5
121#define CALL_AGAIN -2
122#define ERR_CFG_USE -9003
123
124struct device_node *dlpar_configure_connector(u32 drc_index)
125{
126 struct device_node *dn;
127 struct device_node *first_dn = NULL;
128 struct device_node *last_dn = NULL;
129 struct property *property;
130 struct property *last_property = NULL;
131 struct cc_workarea *ccwa;
132 int cc_token;
133 int rc;
134
135 cc_token = rtas_token("ibm,configure-connector");
136 if (cc_token == RTAS_UNKNOWN_SERVICE)
137 return NULL;
138
139 spin_lock(&rtas_data_buf_lock);
140 ccwa = (struct cc_workarea *)&rtas_data_buf[0];
141 ccwa->drc_index = drc_index;
142 ccwa->zero = 0;
143
144 rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL);
145 while (rc) {
146 switch (rc) {
147 case NEXT_SIBLING:
148 dn = dlpar_parse_cc_node(ccwa);
149 if (!dn)
150 goto cc_error;
151
152 dn->parent = last_dn->parent;
153 last_dn->sibling = dn;
154 last_dn = dn;
155 break;
156
157 case NEXT_CHILD:
158 dn = dlpar_parse_cc_node(ccwa);
159 if (!dn)
160 goto cc_error;
161
162 if (!first_dn)
163 first_dn = dn;
164 else {
165 dn->parent = last_dn;
166 if (last_dn)
167 last_dn->child = dn;
168 }
169
170 last_dn = dn;
171 break;
172
173 case NEXT_PROPERTY:
174 property = dlpar_parse_cc_property(ccwa);
175 if (!property)
176 goto cc_error;
177
178 if (!last_dn->properties)
179 last_dn->properties = property;
180 else
181 last_property->next = property;
182
183 last_property = property;
184 break;
185
186 case PREV_PARENT:
187 last_dn = last_dn->parent;
188 break;
189
190 case CALL_AGAIN:
191 break;
192
193 case MORE_MEMORY:
194 case ERR_CFG_USE:
195 default:
196 printk(KERN_ERR "Unexpected Error (%d) "
197 "returned from configure-connector\n", rc);
198 goto cc_error;
199 }
200
201 rc = rtas_call(cc_token, 2, 1, NULL, rtas_data_buf, NULL);
202 }
203
204 spin_unlock(&rtas_data_buf_lock);
205 return first_dn;
206
207cc_error:
208 if (first_dn)
209 dlpar_free_cc_nodes(first_dn);
210 spin_unlock(&rtas_data_buf_lock);
211 return NULL;
212}
213
214static struct device_node *derive_parent(const char *path)
215{
216 struct device_node *parent;
217 char *last_slash;
218
219 last_slash = strrchr(path, '/');
220 if (last_slash == path) {
221 parent = of_find_node_by_path("/");
222 } else {
223 char *parent_path;
224 int parent_path_len = last_slash - path + 1;
225 parent_path = kmalloc(parent_path_len, GFP_KERNEL);
226 if (!parent_path)
227 return NULL;
228
229 strlcpy(parent_path, path, parent_path_len);
230 parent = of_find_node_by_path(parent_path);
231 kfree(parent_path);
232 }
233
234 return parent;
235}
236
237int dlpar_attach_node(struct device_node *dn)
238{
239 struct proc_dir_entry *ent;
240 int rc;
241
242 of_node_set_flag(dn, OF_DYNAMIC);
243 kref_init(&dn->kref);
244 dn->parent = derive_parent(dn->full_name);
245 if (!dn->parent)
246 return -ENOMEM;
247
248 rc = blocking_notifier_call_chain(&pSeries_reconfig_chain,
249 PSERIES_RECONFIG_ADD, dn);
250 if (rc == NOTIFY_BAD) {
251 printk(KERN_ERR "Failed to add device node %s\n",
252 dn->full_name);
253 return -ENOMEM; /* For now, safe to assume kmalloc failure */
254 }
255
256 of_attach_node(dn);
257
258#ifdef CONFIG_PROC_DEVICETREE
259 ent = proc_mkdir(strrchr(dn->full_name, '/') + 1, dn->parent->pde);
260 if (ent)
261 proc_device_tree_add_node(dn, ent);
262#endif
263
264 of_node_put(dn->parent);
265 return 0;
266}
267
268int dlpar_detach_node(struct device_node *dn)
269{
270 struct device_node *parent = dn->parent;
271 struct property *prop = dn->properties;
272
273#ifdef CONFIG_PROC_DEVICETREE
274 while (prop) {
275 remove_proc_entry(prop->name, dn->pde);
276 prop = prop->next;
277 }
278
279 if (dn->pde)
280 remove_proc_entry(dn->pde->name, parent->pde);
281#endif
282
283 blocking_notifier_call_chain(&pSeries_reconfig_chain,
284 PSERIES_RECONFIG_REMOVE, dn);
285 of_detach_node(dn);
286 of_node_put(dn); /* Must decrement the refcount */
287
288 return 0;
289}
290
291#define DR_ENTITY_SENSE 9003
292#define DR_ENTITY_PRESENT 1
293#define DR_ENTITY_UNUSABLE 2
294#define ALLOCATION_STATE 9003
295#define ALLOC_UNUSABLE 0
296#define ALLOC_USABLE 1
297#define ISOLATION_STATE 9001
298#define ISOLATE 0
299#define UNISOLATE 1
300
301int dlpar_acquire_drc(u32 drc_index)
302{
303 int dr_status, rc;
304
305 rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status,
306 DR_ENTITY_SENSE, drc_index);
307 if (rc || dr_status != DR_ENTITY_UNUSABLE)
308 return -1;
309
310 rc = rtas_set_indicator(ALLOCATION_STATE, drc_index, ALLOC_USABLE);
311 if (rc)
312 return rc;
313
314 rc = rtas_set_indicator(ISOLATION_STATE, drc_index, UNISOLATE);
315 if (rc) {
316 rtas_set_indicator(ALLOCATION_STATE, drc_index, ALLOC_UNUSABLE);
317 return rc;
318 }
319
320 return 0;
321}
322
323int dlpar_release_drc(u32 drc_index)
324{
325 int dr_status, rc;
326
327 rc = rtas_call(rtas_token("get-sensor-state"), 2, 2, &dr_status,
328 DR_ENTITY_SENSE, drc_index);
329 if (rc || dr_status != DR_ENTITY_PRESENT)
330 return -1;
331
332 rc = rtas_set_indicator(ISOLATION_STATE, drc_index, ISOLATE);
333 if (rc)
334 return rc;
335
336 rc = rtas_set_indicator(ALLOCATION_STATE, drc_index, ALLOC_UNUSABLE);
337 if (rc) {
338 rtas_set_indicator(ISOLATION_STATE, drc_index, UNISOLATE);
339 return rc;
340 }
341
342 return 0;
343}
344
345#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
346
347static DEFINE_MUTEX(pseries_cpu_hotplug_mutex);
348
349void cpu_hotplug_driver_lock()
350{
351 mutex_lock(&pseries_cpu_hotplug_mutex);
352}
353
354void cpu_hotplug_driver_unlock()
355{
356 mutex_unlock(&pseries_cpu_hotplug_mutex);
357}
358
359static int dlpar_online_cpu(struct device_node *dn)
360{
361 int rc = 0;
362 unsigned int cpu;
363 int len, nthreads, i;
364 const u32 *intserv;
365
366 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
367 if (!intserv)
368 return -EINVAL;
369
370 nthreads = len / sizeof(u32);
371
372 cpu_maps_update_begin();
373 for (i = 0; i < nthreads; i++) {
374 for_each_present_cpu(cpu) {
375 if (get_hard_smp_processor_id(cpu) != intserv[i])
376 continue;
377 BUG_ON(get_cpu_current_state(cpu)
378 != CPU_STATE_OFFLINE);
379 cpu_maps_update_done();
380 rc = cpu_up(cpu);
381 if (rc)
382 goto out;
383 cpu_maps_update_begin();
384
385 break;
386 }
387 if (cpu == num_possible_cpus())
388 printk(KERN_WARNING "Could not find cpu to online "
389 "with physical id 0x%x\n", intserv[i]);
390 }
391 cpu_maps_update_done();
392
393out:
394 return rc;
395
396}
397
398static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
399{
400 struct device_node *dn;
401 unsigned long drc_index;
402 char *cpu_name;
403 int rc;
404
405 cpu_hotplug_driver_lock();
406 rc = strict_strtoul(buf, 0, &drc_index);
407 if (rc) {
408 rc = -EINVAL;
409 goto out;
410 }
411
412 dn = dlpar_configure_connector(drc_index);
413 if (!dn) {
414 rc = -EINVAL;
415 goto out;
416 }
417
418 /* configure-connector reports cpus as living in the base
419 * directory of the device tree. CPUs actually live in the
420 * cpus directory so we need to fixup the full_name.
421 */
422 cpu_name = kzalloc(strlen(dn->full_name) + strlen("/cpus") + 1,
423 GFP_KERNEL);
424 if (!cpu_name) {
425 dlpar_free_cc_nodes(dn);
426 rc = -ENOMEM;
427 goto out;
428 }
429
430 sprintf(cpu_name, "/cpus%s", dn->full_name);
431 kfree(dn->full_name);
432 dn->full_name = cpu_name;
433
434 rc = dlpar_acquire_drc(drc_index);
435 if (rc) {
436 dlpar_free_cc_nodes(dn);
437 rc = -EINVAL;
438 goto out;
439 }
440
441 rc = dlpar_attach_node(dn);
442 if (rc) {
443 dlpar_release_drc(drc_index);
444 dlpar_free_cc_nodes(dn);
445 }
446
447 rc = dlpar_online_cpu(dn);
448out:
449 cpu_hotplug_driver_unlock();
450
451 return rc ? rc : count;
452}
453
454static int dlpar_offline_cpu(struct device_node *dn)
455{
456 int rc = 0;
457 unsigned int cpu;
458 int len, nthreads, i;
459 const u32 *intserv;
460
461 intserv = of_get_property(dn, "ibm,ppc-interrupt-server#s", &len);
462 if (!intserv)
463 return -EINVAL;
464
465 nthreads = len / sizeof(u32);
466
467 cpu_maps_update_begin();
468 for (i = 0; i < nthreads; i++) {
469 for_each_present_cpu(cpu) {
470 if (get_hard_smp_processor_id(cpu) != intserv[i])
471 continue;
472
473 if (get_cpu_current_state(cpu) == CPU_STATE_OFFLINE)
474 break;
475
476 if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) {
477 cpu_maps_update_done();
478 rc = cpu_down(cpu);
479 if (rc)
480 goto out;
481 cpu_maps_update_begin();
482 break;
483
484 }
485
486 /*
487 * The cpu is in CPU_STATE_INACTIVE.
488 * Upgrade it's state to CPU_STATE_OFFLINE.
489 */
490 set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
491 BUG_ON(plpar_hcall_norets(H_PROD, intserv[i])
492 != H_SUCCESS);
493 __cpu_die(cpu);
494 break;
495 }
496 if (cpu == num_possible_cpus())
497 printk(KERN_WARNING "Could not find cpu to offline "
498 "with physical id 0x%x\n", intserv[i]);
499 }
500 cpu_maps_update_done();
501
502out:
503 return rc;
504
505}
506
507static ssize_t dlpar_cpu_release(const char *buf, size_t count)
508{
509 struct device_node *dn;
510 const u32 *drc_index;
511 int rc;
512
513 dn = of_find_node_by_path(buf);
514 if (!dn)
515 return -EINVAL;
516
517 drc_index = of_get_property(dn, "ibm,my-drc-index", NULL);
518 if (!drc_index) {
519 of_node_put(dn);
520 return -EINVAL;
521 }
522
523 cpu_hotplug_driver_lock();
524 rc = dlpar_offline_cpu(dn);
525 if (rc) {
526 of_node_put(dn);
527 rc = -EINVAL;
528 goto out;
529 }
530
531 rc = dlpar_release_drc(*drc_index);
532 if (rc) {
533 of_node_put(dn);
534 goto out;
535 }
536
537 rc = dlpar_detach_node(dn);
538 if (rc) {
539 dlpar_acquire_drc(*drc_index);
540 goto out;
541 }
542
543 of_node_put(dn);
544out:
545 cpu_hotplug_driver_unlock();
546 return rc ? rc : count;
547}
548
549static int __init pseries_dlpar_init(void)
550{
551 ppc_md.cpu_probe = dlpar_cpu_probe;
552 ppc_md.cpu_release = dlpar_cpu_release;
553
554 return 0;
555}
556machine_device_initcall(pseries, pseries_dlpar_init);
557
558#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c
index 937a544a236d..c5f3116b6ca5 100644
--- a/arch/powerpc/platforms/pseries/dtl.c
+++ b/arch/powerpc/platforms/pseries/dtl.c
@@ -54,7 +54,7 @@ struct dtl {
54 int buf_entries; 54 int buf_entries;
55 u64 last_idx; 55 u64 last_idx;
56}; 56};
57static DEFINE_PER_CPU(struct dtl, dtl); 57static DEFINE_PER_CPU(struct dtl, cpu_dtl);
58 58
59/* 59/*
60 * Dispatch trace log event mask: 60 * Dispatch trace log event mask:
@@ -261,7 +261,7 @@ static int dtl_init(void)
261 261
262 /* set up the per-cpu log structures */ 262 /* set up the per-cpu log structures */
263 for_each_possible_cpu(i) { 263 for_each_possible_cpu(i) {
264 struct dtl *dtl = &per_cpu(dtl, i); 264 struct dtl *dtl = &per_cpu(cpu_dtl, i);
265 dtl->cpu = i; 265 dtl->cpu = i;
266 266
267 rc = dtl_setup_file(dtl); 267 rc = dtl_setup_file(dtl);
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index 0e8db6771252..ef8e45448480 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -63,22 +63,6 @@ static void print_device_node_tree(struct pci_dn *pdn, int dent)
63} 63}
64#endif 64#endif
65 65
66/**
67 * irq_in_use - return true if this irq is being used
68 */
69static int irq_in_use(unsigned int irq)
70{
71 int rc = 0;
72 unsigned long flags;
73 struct irq_desc *desc = irq_desc + irq;
74
75 spin_lock_irqsave(&desc->lock, flags);
76 if (desc->action)
77 rc = 1;
78 spin_unlock_irqrestore(&desc->lock, flags);
79 return rc;
80}
81
82/** 66/**
83 * eeh_disable_irq - disable interrupt for the recovering device 67 * eeh_disable_irq - disable interrupt for the recovering device
84 */ 68 */
@@ -93,7 +77,7 @@ static void eeh_disable_irq(struct pci_dev *dev)
93 if (dev->msi_enabled || dev->msix_enabled) 77 if (dev->msi_enabled || dev->msix_enabled)
94 return; 78 return;
95 79
96 if (!irq_in_use(dev->irq)) 80 if (!irq_has_action(dev->irq))
97 return; 81 return;
98 82
99 PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED; 83 PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED;
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index ebff6d9a4e39..6ea4698d9176 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -30,6 +30,7 @@
30#include <asm/pSeries_reconfig.h> 30#include <asm/pSeries_reconfig.h>
31#include "xics.h" 31#include "xics.h"
32#include "plpar_wrappers.h" 32#include "plpar_wrappers.h"
33#include "offline_states.h"
33 34
34/* This version can't take the spinlock, because it never returns */ 35/* This version can't take the spinlock, because it never returns */
35static struct rtas_args rtas_stop_self_args = { 36static struct rtas_args rtas_stop_self_args = {
@@ -39,6 +40,55 @@ static struct rtas_args rtas_stop_self_args = {
39 .rets = &rtas_stop_self_args.args[0], 40 .rets = &rtas_stop_self_args.args[0],
40}; 41};
41 42
43static DEFINE_PER_CPU(enum cpu_state_vals, preferred_offline_state) =
44 CPU_STATE_OFFLINE;
45static DEFINE_PER_CPU(enum cpu_state_vals, current_state) = CPU_STATE_OFFLINE;
46
47static enum cpu_state_vals default_offline_state = CPU_STATE_OFFLINE;
48
49static int cede_offline_enabled __read_mostly = 1;
50
51/*
52 * Enable/disable cede_offline when available.
53 */
54static int __init setup_cede_offline(char *str)
55{
56 if (!strcmp(str, "off"))
57 cede_offline_enabled = 0;
58 else if (!strcmp(str, "on"))
59 cede_offline_enabled = 1;
60 else
61 return 0;
62 return 1;
63}
64
65__setup("cede_offline=", setup_cede_offline);
66
67enum cpu_state_vals get_cpu_current_state(int cpu)
68{
69 return per_cpu(current_state, cpu);
70}
71
72void set_cpu_current_state(int cpu, enum cpu_state_vals state)
73{
74 per_cpu(current_state, cpu) = state;
75}
76
77enum cpu_state_vals get_preferred_offline_state(int cpu)
78{
79 return per_cpu(preferred_offline_state, cpu);
80}
81
82void set_preferred_offline_state(int cpu, enum cpu_state_vals state)
83{
84 per_cpu(preferred_offline_state, cpu) = state;
85}
86
87void set_default_offline_state(int cpu)
88{
89 per_cpu(preferred_offline_state, cpu) = default_offline_state;
90}
91
42static void rtas_stop_self(void) 92static void rtas_stop_self(void)
43{ 93{
44 struct rtas_args *args = &rtas_stop_self_args; 94 struct rtas_args *args = &rtas_stop_self_args;
@@ -56,11 +106,61 @@ static void rtas_stop_self(void)
56 106
57static void pseries_mach_cpu_die(void) 107static void pseries_mach_cpu_die(void)
58{ 108{
109 unsigned int cpu = smp_processor_id();
110 unsigned int hwcpu = hard_smp_processor_id();
111 u8 cede_latency_hint = 0;
112
59 local_irq_disable(); 113 local_irq_disable();
60 idle_task_exit(); 114 idle_task_exit();
61 xics_teardown_cpu(); 115 xics_teardown_cpu();
62 unregister_slb_shadow(hard_smp_processor_id(), __pa(get_slb_shadow())); 116
63 rtas_stop_self(); 117 if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
118 set_cpu_current_state(cpu, CPU_STATE_INACTIVE);
119 cede_latency_hint = 2;
120
121 get_lppaca()->idle = 1;
122 if (!get_lppaca()->shared_proc)
123 get_lppaca()->donate_dedicated_cpu = 1;
124
125 printk(KERN_INFO
126 "cpu %u (hwid %u) ceding for offline with hint %d\n",
127 cpu, hwcpu, cede_latency_hint);
128 while (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
129 extended_cede_processor(cede_latency_hint);
130 printk(KERN_INFO "cpu %u (hwid %u) returned from cede.\n",
131 cpu, hwcpu);
132 printk(KERN_INFO
133 "Decrementer value = %x Timebase value = %llx\n",
134 get_dec(), get_tb());
135 }
136
137 printk(KERN_INFO "cpu %u (hwid %u) got prodded to go online\n",
138 cpu, hwcpu);
139
140 if (!get_lppaca()->shared_proc)
141 get_lppaca()->donate_dedicated_cpu = 0;
142 get_lppaca()->idle = 0;
143 }
144
145 if (get_preferred_offline_state(cpu) == CPU_STATE_ONLINE) {
146 unregister_slb_shadow(hwcpu, __pa(get_slb_shadow()));
147
148 /*
149 * NOTE: Calling start_secondary() here for now to
150 * start new context.
151 * However, need to do it cleanly by resetting the
152 * stack pointer.
153 */
154 start_secondary();
155
156 } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
157
158 set_cpu_current_state(cpu, CPU_STATE_OFFLINE);
159 unregister_slb_shadow(hard_smp_processor_id(),
160 __pa(get_slb_shadow()));
161 rtas_stop_self();
162 }
163
64 /* Should never get here... */ 164 /* Should never get here... */
65 BUG(); 165 BUG();
66 for(;;); 166 for(;;);
@@ -106,18 +206,43 @@ static int pseries_cpu_disable(void)
106 return 0; 206 return 0;
107} 207}
108 208
209/*
210 * pseries_cpu_die: Wait for the cpu to die.
211 * @cpu: logical processor id of the CPU whose death we're awaiting.
212 *
213 * This function is called from the context of the thread which is performing
214 * the cpu-offline. Here we wait for long enough to allow the cpu in question
215 * to self-destroy so that the cpu-offline thread can send the CPU_DEAD
216 * notifications.
217 *
218 * OTOH, pseries_mach_cpu_die() is called by the @cpu when it wants to
219 * self-destruct.
220 */
109static void pseries_cpu_die(unsigned int cpu) 221static void pseries_cpu_die(unsigned int cpu)
110{ 222{
111 int tries; 223 int tries;
112 int cpu_status; 224 int cpu_status = 1;
113 unsigned int pcpu = get_hard_smp_processor_id(cpu); 225 unsigned int pcpu = get_hard_smp_processor_id(cpu);
114 226
115 for (tries = 0; tries < 25; tries++) { 227 if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
116 cpu_status = query_cpu_stopped(pcpu); 228 cpu_status = 1;
117 if (cpu_status == 0 || cpu_status == -1) 229 for (tries = 0; tries < 1000; tries++) {
118 break; 230 if (get_cpu_current_state(cpu) == CPU_STATE_INACTIVE) {
119 cpu_relax(); 231 cpu_status = 0;
232 break;
233 }
234 cpu_relax();
235 }
236 } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
237
238 for (tries = 0; tries < 25; tries++) {
239 cpu_status = query_cpu_stopped(pcpu);
240 if (cpu_status == 0 || cpu_status == -1)
241 break;
242 cpu_relax();
243 }
120 } 244 }
245
121 if (cpu_status != 0) { 246 if (cpu_status != 0) {
122 printk("Querying DEAD? cpu %i (%i) shows %i\n", 247 printk("Querying DEAD? cpu %i (%i) shows %i\n",
123 cpu, pcpu, cpu_status); 248 cpu, pcpu, cpu_status);
@@ -252,10 +377,41 @@ static struct notifier_block pseries_smp_nb = {
252 .notifier_call = pseries_smp_notifier, 377 .notifier_call = pseries_smp_notifier,
253}; 378};
254 379
380#define MAX_CEDE_LATENCY_LEVELS 4
381#define CEDE_LATENCY_PARAM_LENGTH 10
382#define CEDE_LATENCY_PARAM_MAX_LENGTH \
383 (MAX_CEDE_LATENCY_LEVELS * CEDE_LATENCY_PARAM_LENGTH * sizeof(char))
384#define CEDE_LATENCY_TOKEN 45
385
386static char cede_parameters[CEDE_LATENCY_PARAM_MAX_LENGTH];
387
388static int parse_cede_parameters(void)
389{
390 int call_status;
391
392 memset(cede_parameters, 0, CEDE_LATENCY_PARAM_MAX_LENGTH);
393 call_status = rtas_call(rtas_token("ibm,get-system-parameter"), 3, 1,
394 NULL,
395 CEDE_LATENCY_TOKEN,
396 __pa(cede_parameters),
397 CEDE_LATENCY_PARAM_MAX_LENGTH);
398
399 if (call_status != 0)
400 printk(KERN_INFO "CEDE_LATENCY: \
401 %s %s Error calling get-system-parameter(0x%x)\n",
402 __FILE__, __func__, call_status);
403 else
404 printk(KERN_INFO "CEDE_LATENCY: \
405 get-system-parameter successful.\n");
406
407 return call_status;
408}
409
255static int __init pseries_cpu_hotplug_init(void) 410static int __init pseries_cpu_hotplug_init(void)
256{ 411{
257 struct device_node *np; 412 struct device_node *np;
258 const char *typep; 413 const char *typep;
414 int cpu;
259 415
260 for_each_node_by_name(np, "interrupt-controller") { 416 for_each_node_by_name(np, "interrupt-controller") {
261 typep = of_get_property(np, "compatible", NULL); 417 typep = of_get_property(np, "compatible", NULL);
@@ -283,8 +439,16 @@ static int __init pseries_cpu_hotplug_init(void)
283 smp_ops->cpu_die = pseries_cpu_die; 439 smp_ops->cpu_die = pseries_cpu_die;
284 440
285 /* Processors can be added/removed only on LPAR */ 441 /* Processors can be added/removed only on LPAR */
286 if (firmware_has_feature(FW_FEATURE_LPAR)) 442 if (firmware_has_feature(FW_FEATURE_LPAR)) {
287 pSeries_reconfig_notifier_register(&pseries_smp_nb); 443 pSeries_reconfig_notifier_register(&pseries_smp_nb);
444 cpu_maps_update_begin();
445 if (cede_offline_enabled && parse_cede_parameters() == 0) {
446 default_offline_state = CPU_STATE_INACTIVE;
447 for_each_online_cpu(cpu)
448 set_default_offline_state(cpu);
449 }
450 cpu_maps_update_done();
451 }
288 452
289 return 0; 453 return 0;
290} 454}
diff --git a/arch/powerpc/platforms/pseries/offline_states.h b/arch/powerpc/platforms/pseries/offline_states.h
new file mode 100644
index 000000000000..22574e0d9d91
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/offline_states.h
@@ -0,0 +1,18 @@
1#ifndef _OFFLINE_STATES_H_
2#define _OFFLINE_STATES_H_
3
4/* Cpu offline states go here */
5enum cpu_state_vals {
6 CPU_STATE_OFFLINE,
7 CPU_STATE_INACTIVE,
8 CPU_STATE_ONLINE,
9 CPU_MAX_OFFLINE_STATES
10};
11
12extern enum cpu_state_vals get_cpu_current_state(int cpu);
13extern void set_cpu_current_state(int cpu, enum cpu_state_vals state);
14extern enum cpu_state_vals get_preferred_offline_state(int cpu);
15extern void set_preferred_offline_state(int cpu, enum cpu_state_vals state);
16extern void set_default_offline_state(int cpu);
17extern int start_secondary(void);
18#endif
diff --git a/arch/powerpc/platforms/pseries/plpar_wrappers.h b/arch/powerpc/platforms/pseries/plpar_wrappers.h
index a24a6b2333b2..0603c91538ae 100644
--- a/arch/powerpc/platforms/pseries/plpar_wrappers.h
+++ b/arch/powerpc/platforms/pseries/plpar_wrappers.h
@@ -9,11 +9,33 @@ static inline long poll_pending(void)
9 return plpar_hcall_norets(H_POLL_PENDING); 9 return plpar_hcall_norets(H_POLL_PENDING);
10} 10}
11 11
12static inline u8 get_cede_latency_hint(void)
13{
14 return get_lppaca()->gpr5_dword.fields.cede_latency_hint;
15}
16
17static inline void set_cede_latency_hint(u8 latency_hint)
18{
19 get_lppaca()->gpr5_dword.fields.cede_latency_hint = latency_hint;
20}
21
12static inline long cede_processor(void) 22static inline long cede_processor(void)
13{ 23{
14 return plpar_hcall_norets(H_CEDE); 24 return plpar_hcall_norets(H_CEDE);
15} 25}
16 26
27static inline long extended_cede_processor(unsigned long latency_hint)
28{
29 long rc;
30 u8 old_latency_hint = get_cede_latency_hint();
31
32 set_cede_latency_hint(latency_hint);
33 rc = cede_processor();
34 set_cede_latency_hint(old_latency_hint);
35
36 return rc;
37}
38
17static inline long vpa_call(unsigned long flags, unsigned long cpu, 39static inline long vpa_call(unsigned long flags, unsigned long cpu,
18 unsigned long vpa) 40 unsigned long vpa)
19{ 41{
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 2e2bbe120b90..a2305d29bbbd 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -96,7 +96,7 @@ static struct device_node *derive_parent(const char *path)
96 return parent; 96 return parent;
97} 97}
98 98
99static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain); 99BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
100 100
101int pSeries_reconfig_notifier_register(struct notifier_block *nb) 101int pSeries_reconfig_notifier_register(struct notifier_block *nb)
102{ 102{
@@ -184,7 +184,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
184} 184}
185 185
186/* 186/*
187 * /proc/ppc64/ofdt - yucky binary interface for adding and removing 187 * /proc/powerpc/ofdt - yucky binary interface for adding and removing
188 * OF device nodes. Should be deprecated as soon as we get an 188 * OF device nodes. Should be deprecated as soon as we get an
189 * in-kernel wrapper for the RTAS ibm,configure-connector call. 189 * in-kernel wrapper for the RTAS ibm,configure-connector call.
190 */ 190 */
@@ -543,7 +543,7 @@ static const struct file_operations ofdt_fops = {
543 .write = ofdt_write 543 .write = ofdt_write
544}; 544};
545 545
546/* create /proc/ppc64/ofdt write-only by root */ 546/* create /proc/powerpc/ofdt write-only by root */
547static int proc_ppc64_create_ofdt(void) 547static int proc_ppc64_create_ofdt(void)
548{ 548{
549 struct proc_dir_entry *ent; 549 struct proc_dir_entry *ent;
@@ -551,7 +551,7 @@ static int proc_ppc64_create_ofdt(void)
551 if (!machine_is(pseries)) 551 if (!machine_is(pseries))
552 return 0; 552 return 0;
553 553
554 ent = proc_create("ppc64/ofdt", S_IWUSR, NULL, &ofdt_fops); 554 ent = proc_create("powerpc/ofdt", S_IWUSR, NULL, &ofdt_fops);
555 if (ent) 555 if (ent)
556 ent->size = 0; 556 ent->size = 0;
557 557
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index 417eca79df69..1b45c458f952 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -13,7 +13,7 @@
13 * of this data using this driver. A dump exists if the device-tree 13 * of this data using this driver. A dump exists if the device-tree
14 * /chosen/ibm,scan-log-data property exists. 14 * /chosen/ibm,scan-log-data property exists.
15 * 15 *
16 * This driver exports /proc/ppc64/scan-log-dump which can be read. 16 * This driver exports /proc/powerpc/scan-log-dump which can be read.
17 * The driver supports only sequential reads. 17 * The driver supports only sequential reads.
18 * 18 *
19 * The driver looks at a write to the driver for the single word "reset". 19 * The driver looks at a write to the driver for the single word "reset".
@@ -186,7 +186,7 @@ static int __init scanlog_init(void)
186 if (!data) 186 if (!data)
187 goto err; 187 goto err;
188 188
189 ent = proc_create_data("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, 189 ent = proc_create_data("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
190 &scanlog_fops, data); 190 &scanlog_fops, data);
191 if (!ent) 191 if (!ent)
192 goto err; 192 goto err;
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 440000cc7130..8868c012268a 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -48,6 +48,7 @@
48#include "plpar_wrappers.h" 48#include "plpar_wrappers.h"
49#include "pseries.h" 49#include "pseries.h"
50#include "xics.h" 50#include "xics.h"
51#include "offline_states.h"
51 52
52 53
53/* 54/*
@@ -84,6 +85,9 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
84 /* Fixup atomic count: it exited inside IRQ handler. */ 85 /* Fixup atomic count: it exited inside IRQ handler. */
85 task_thread_info(paca[lcpu].__current)->preempt_count = 0; 86 task_thread_info(paca[lcpu].__current)->preempt_count = 0;
86 87
88 if (get_cpu_current_state(lcpu) == CPU_STATE_INACTIVE)
89 goto out;
90
87 /* 91 /*
88 * If the RTAS start-cpu token does not exist then presume the 92 * If the RTAS start-cpu token does not exist then presume the
89 * cpu is already spinning. 93 * cpu is already spinning.
@@ -98,6 +102,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
98 return 0; 102 return 0;
99 } 103 }
100 104
105out:
101 return 1; 106 return 1;
102} 107}
103 108
@@ -111,12 +116,16 @@ static void __devinit smp_xics_setup_cpu(int cpu)
111 vpa_init(cpu); 116 vpa_init(cpu);
112 117
113 cpu_clear(cpu, of_spin_map); 118 cpu_clear(cpu, of_spin_map);
119 set_cpu_current_state(cpu, CPU_STATE_ONLINE);
120 set_default_offline_state(cpu);
114 121
115} 122}
116#endif /* CONFIG_XICS */ 123#endif /* CONFIG_XICS */
117 124
118static void __devinit smp_pSeries_kick_cpu(int nr) 125static void __devinit smp_pSeries_kick_cpu(int nr)
119{ 126{
127 long rc;
128 unsigned long hcpuid;
120 BUG_ON(nr < 0 || nr >= NR_CPUS); 129 BUG_ON(nr < 0 || nr >= NR_CPUS);
121 130
122 if (!smp_startup_cpu(nr)) 131 if (!smp_startup_cpu(nr))
@@ -128,6 +137,16 @@ static void __devinit smp_pSeries_kick_cpu(int nr)
128 * the processor will continue on to secondary_start 137 * the processor will continue on to secondary_start
129 */ 138 */
130 paca[nr].cpu_start = 1; 139 paca[nr].cpu_start = 1;
140
141 set_preferred_offline_state(nr, CPU_STATE_ONLINE);
142
143 if (get_cpu_current_state(nr) == CPU_STATE_INACTIVE) {
144 hcpuid = get_hard_smp_processor_id(nr);
145 rc = plpar_hcall_norets(H_PROD, hcpuid);
146 if (rc != H_SUCCESS)
147 panic("Error: Prod to wake up processor %d Ret= %ld\n",
148 nr, rc);
149 }
131} 150}
132 151
133static int smp_pSeries_cpu_bootable(unsigned int nr) 152static int smp_pSeries_cpu_bootable(unsigned int nr)
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index b9bf0eedccf2..7d01b58f3989 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -20,6 +20,7 @@
20#include <linux/cpu.h> 20#include <linux/cpu.h>
21#include <linux/msi.h> 21#include <linux/msi.h>
22#include <linux/of.h> 22#include <linux/of.h>
23#include <linux/percpu.h>
23 24
24#include <asm/firmware.h> 25#include <asm/firmware.h>
25#include <asm/io.h> 26#include <asm/io.h>
@@ -46,6 +47,12 @@ static struct irq_host *xics_host;
46 */ 47 */
47#define IPI_PRIORITY 4 48#define IPI_PRIORITY 4
48 49
50/* The least favored priority */
51#define LOWEST_PRIORITY 0xFF
52
53/* The number of priorities defined above */
54#define MAX_NUM_PRIORITIES 3
55
49static unsigned int default_server = 0xFF; 56static unsigned int default_server = 0xFF;
50static unsigned int default_distrib_server = 0; 57static unsigned int default_distrib_server = 0;
51static unsigned int interrupt_server_size = 8; 58static unsigned int interrupt_server_size = 8;
@@ -56,6 +63,12 @@ static int ibm_set_xive;
56static int ibm_int_on; 63static int ibm_int_on;
57static int ibm_int_off; 64static int ibm_int_off;
58 65
66struct xics_cppr {
67 unsigned char stack[MAX_NUM_PRIORITIES];
68 int index;
69};
70
71static DEFINE_PER_CPU(struct xics_cppr, xics_cppr);
59 72
60/* Direct hardware low level accessors */ 73/* Direct hardware low level accessors */
61 74
@@ -157,7 +170,7 @@ static int get_irq_server(unsigned int virq, unsigned int strict_check)
157 cpumask_t cpumask; 170 cpumask_t cpumask;
158 cpumask_t tmp = CPU_MASK_NONE; 171 cpumask_t tmp = CPU_MASK_NONE;
159 172
160 cpumask_copy(&cpumask, irq_desc[virq].affinity); 173 cpumask_copy(&cpumask, irq_to_desc(virq)->affinity);
161 if (!distribute_irqs) 174 if (!distribute_irqs)
162 return default_server; 175 return default_server;
163 176
@@ -284,6 +297,19 @@ static inline unsigned int xics_xirr_vector(unsigned int xirr)
284 return xirr & 0x00ffffff; 297 return xirr & 0x00ffffff;
285} 298}
286 299
300static void push_cppr(unsigned int vec)
301{
302 struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr);
303
304 if (WARN_ON(os_cppr->index >= MAX_NUM_PRIORITIES - 1))
305 return;
306
307 if (vec == XICS_IPI)
308 os_cppr->stack[++os_cppr->index] = IPI_PRIORITY;
309 else
310 os_cppr->stack[++os_cppr->index] = DEFAULT_PRIORITY;
311}
312
287static unsigned int xics_get_irq_direct(void) 313static unsigned int xics_get_irq_direct(void)
288{ 314{
289 unsigned int xirr = direct_xirr_info_get(); 315 unsigned int xirr = direct_xirr_info_get();
@@ -294,8 +320,10 @@ static unsigned int xics_get_irq_direct(void)
294 return NO_IRQ; 320 return NO_IRQ;
295 321
296 irq = irq_radix_revmap_lookup(xics_host, vec); 322 irq = irq_radix_revmap_lookup(xics_host, vec);
297 if (likely(irq != NO_IRQ)) 323 if (likely(irq != NO_IRQ)) {
324 push_cppr(vec);
298 return irq; 325 return irq;
326 }
299 327
300 /* We don't have a linux mapping, so have rtas mask it. */ 328 /* We don't have a linux mapping, so have rtas mask it. */
301 xics_mask_unknown_vec(vec); 329 xics_mask_unknown_vec(vec);
@@ -315,8 +343,10 @@ static unsigned int xics_get_irq_lpar(void)
315 return NO_IRQ; 343 return NO_IRQ;
316 344
317 irq = irq_radix_revmap_lookup(xics_host, vec); 345 irq = irq_radix_revmap_lookup(xics_host, vec);
318 if (likely(irq != NO_IRQ)) 346 if (likely(irq != NO_IRQ)) {
347 push_cppr(vec);
319 return irq; 348 return irq;
349 }
320 350
321 /* We don't have a linux mapping, so have RTAS mask it. */ 351 /* We don't have a linux mapping, so have RTAS mask it. */
322 xics_mask_unknown_vec(vec); 352 xics_mask_unknown_vec(vec);
@@ -326,12 +356,22 @@ static unsigned int xics_get_irq_lpar(void)
326 return NO_IRQ; 356 return NO_IRQ;
327} 357}
328 358
359static unsigned char pop_cppr(void)
360{
361 struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr);
362
363 if (WARN_ON(os_cppr->index < 1))
364 return LOWEST_PRIORITY;
365
366 return os_cppr->stack[--os_cppr->index];
367}
368
329static void xics_eoi_direct(unsigned int virq) 369static void xics_eoi_direct(unsigned int virq)
330{ 370{
331 unsigned int irq = (unsigned int)irq_map[virq].hwirq; 371 unsigned int irq = (unsigned int)irq_map[virq].hwirq;
332 372
333 iosync(); 373 iosync();
334 direct_xirr_info_set((0xff << 24) | irq); 374 direct_xirr_info_set((pop_cppr() << 24) | irq);
335} 375}
336 376
337static void xics_eoi_lpar(unsigned int virq) 377static void xics_eoi_lpar(unsigned int virq)
@@ -339,7 +379,7 @@ static void xics_eoi_lpar(unsigned int virq)
339 unsigned int irq = (unsigned int)irq_map[virq].hwirq; 379 unsigned int irq = (unsigned int)irq_map[virq].hwirq;
340 380
341 iosync(); 381 iosync();
342 lpar_xirr_info_set((0xff << 24) | irq); 382 lpar_xirr_info_set((pop_cppr() << 24) | irq);
343} 383}
344 384
345static int xics_set_affinity(unsigned int virq, const struct cpumask *cpumask) 385static int xics_set_affinity(unsigned int virq, const struct cpumask *cpumask)
@@ -388,7 +428,7 @@ static int xics_set_affinity(unsigned int virq, const struct cpumask *cpumask)
388} 428}
389 429
390static struct irq_chip xics_pic_direct = { 430static struct irq_chip xics_pic_direct = {
391 .typename = " XICS ", 431 .name = " XICS ",
392 .startup = xics_startup, 432 .startup = xics_startup,
393 .mask = xics_mask_irq, 433 .mask = xics_mask_irq,
394 .unmask = xics_unmask_irq, 434 .unmask = xics_unmask_irq,
@@ -397,7 +437,7 @@ static struct irq_chip xics_pic_direct = {
397}; 437};
398 438
399static struct irq_chip xics_pic_lpar = { 439static struct irq_chip xics_pic_lpar = {
400 .typename = " XICS ", 440 .name = " XICS ",
401 .startup = xics_startup, 441 .startup = xics_startup,
402 .mask = xics_mask_irq, 442 .mask = xics_mask_irq,
403 .unmask = xics_unmask_irq, 443 .unmask = xics_unmask_irq,
@@ -428,13 +468,13 @@ static int xics_host_map(struct irq_host *h, unsigned int virq,
428 /* Insert the interrupt mapping into the radix tree for fast lookup */ 468 /* Insert the interrupt mapping into the radix tree for fast lookup */
429 irq_radix_revmap_insert(xics_host, virq, hw); 469 irq_radix_revmap_insert(xics_host, virq, hw);
430 470
431 get_irq_desc(virq)->status |= IRQ_LEVEL; 471 irq_to_desc(virq)->status |= IRQ_LEVEL;
432 set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq); 472 set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq);
433 return 0; 473 return 0;
434} 474}
435 475
436static int xics_host_xlate(struct irq_host *h, struct device_node *ct, 476static int xics_host_xlate(struct irq_host *h, struct device_node *ct,
437 u32 *intspec, unsigned int intsize, 477 const u32 *intspec, unsigned int intsize,
438 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 478 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
439 479
440{ 480{
@@ -746,6 +786,12 @@ void __init xics_init_IRQ(void)
746 786
747static void xics_set_cpu_priority(unsigned char cppr) 787static void xics_set_cpu_priority(unsigned char cppr)
748{ 788{
789 struct xics_cppr *os_cppr = &__get_cpu_var(xics_cppr);
790
791 BUG_ON(os_cppr->index != 0);
792
793 os_cppr->stack[os_cppr->index] = cppr;
794
749 if (firmware_has_feature(FW_FEATURE_LPAR)) 795 if (firmware_has_feature(FW_FEATURE_LPAR))
750 lpar_cppr_info(cppr); 796 lpar_cppr_info(cppr);
751 else 797 else
@@ -772,7 +818,7 @@ static void xics_set_cpu_giq(unsigned int gserver, unsigned int join)
772 818
773void xics_setup_cpu(void) 819void xics_setup_cpu(void)
774{ 820{
775 xics_set_cpu_priority(0xff); 821 xics_set_cpu_priority(LOWEST_PRIORITY);
776 822
777 xics_set_cpu_giq(default_distrib_server, 1); 823 xics_set_cpu_giq(default_distrib_server, 1);
778} 824}
@@ -852,7 +898,7 @@ void xics_migrate_irqs_away(void)
852 /* We need to get IPIs still. */ 898 /* We need to get IPIs still. */
853 if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) 899 if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS)
854 continue; 900 continue;
855 desc = get_irq_desc(virq); 901 desc = irq_to_desc(virq);
856 902
857 /* We only need to migrate enabled IRQS */ 903 /* We only need to migrate enabled IRQS */
858 if (desc == NULL || desc->chip == NULL 904 if (desc == NULL || desc->chip == NULL
@@ -881,7 +927,7 @@ void xics_migrate_irqs_away(void)
881 virq, cpu); 927 virq, cpu);
882 928
883 /* Reset affinity to all cpus */ 929 /* Reset affinity to all cpus */
884 cpumask_setall(irq_desc[virq].affinity); 930 cpumask_setall(irq_to_desc(virq)->affinity);
885 desc->chip->set_affinity(virq, cpu_all_mask); 931 desc->chip->set_affinity(virq, cpu_all_mask);
886unlock: 932unlock:
887 spin_unlock_irqrestore(&desc->lock, flags); 933 spin_unlock_irqrestore(&desc->lock, flags);
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 9d4b17462f13..5642924fb9fb 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_U3_DART) += dart_iommu.o
16obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o 16obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o
17obj-$(CONFIG_FSL_SOC) += fsl_soc.o 17obj-$(CONFIG_FSL_SOC) += fsl_soc.o
18obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y) 18obj-$(CONFIG_FSL_PCI) += fsl_pci.o $(fsl-msi-obj-y)
19obj-$(CONFIG_FSL_PMC) += fsl_pmc.o
19obj-$(CONFIG_FSL_LBC) += fsl_lbc.o 20obj-$(CONFIG_FSL_LBC) += fsl_lbc.o
20obj-$(CONFIG_FSL_GTM) += fsl_gtm.o 21obj-$(CONFIG_FSL_GTM) += fsl_gtm.o
21obj-$(CONFIG_MPC8xxx_GPIO) += mpc8xxx_gpio.o 22obj-$(CONFIG_MPC8xxx_GPIO) += mpc8xxx_gpio.o
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 82424cd7e128..a4b41dbde128 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -77,7 +77,7 @@ static void cpm_end_irq(unsigned int irq)
77} 77}
78 78
79static struct irq_chip cpm_pic = { 79static struct irq_chip cpm_pic = {
80 .typename = " CPM PIC ", 80 .name = " CPM PIC ",
81 .mask = cpm_mask_irq, 81 .mask = cpm_mask_irq,
82 .unmask = cpm_unmask_irq, 82 .unmask = cpm_unmask_irq,
83 .eoi = cpm_end_irq, 83 .eoi = cpm_end_irq,
@@ -102,7 +102,7 @@ static int cpm_pic_host_map(struct irq_host *h, unsigned int virq,
102{ 102{
103 pr_debug("cpm_pic_host_map(%d, 0x%lx)\n", virq, hw); 103 pr_debug("cpm_pic_host_map(%d, 0x%lx)\n", virq, hw);
104 104
105 get_irq_desc(virq)->status |= IRQ_LEVEL; 105 irq_to_desc(virq)->status |= IRQ_LEVEL;
106 set_irq_chip_and_handler(virq, &cpm_pic, handle_fasteoi_irq); 106 set_irq_chip_and_handler(virq, &cpm_pic, handle_fasteoi_irq);
107 return 0; 107 return 0;
108} 108}
diff --git a/arch/powerpc/sysdev/cpm2_pic.c b/arch/powerpc/sysdev/cpm2_pic.c
index 78f1f7cca0a0..971483f0dfac 100644
--- a/arch/powerpc/sysdev/cpm2_pic.c
+++ b/arch/powerpc/sysdev/cpm2_pic.c
@@ -115,11 +115,13 @@ static void cpm2_ack(unsigned int virq)
115 115
116static void cpm2_end_irq(unsigned int virq) 116static void cpm2_end_irq(unsigned int virq)
117{ 117{
118 struct irq_desc *desc;
118 int bit, word; 119 int bit, word;
119 unsigned int irq_nr = virq_to_hw(virq); 120 unsigned int irq_nr = virq_to_hw(virq);
120 121
121 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS)) 122 desc = irq_to_desc(irq_nr);
122 && irq_desc[irq_nr].action) { 123 if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))
124 && desc->action) {
123 125
124 bit = irq_to_siubit[irq_nr]; 126 bit = irq_to_siubit[irq_nr];
125 word = irq_to_siureg[irq_nr]; 127 word = irq_to_siureg[irq_nr];
@@ -138,7 +140,7 @@ static void cpm2_end_irq(unsigned int virq)
138static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type) 140static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
139{ 141{
140 unsigned int src = virq_to_hw(virq); 142 unsigned int src = virq_to_hw(virq);
141 struct irq_desc *desc = get_irq_desc(virq); 143 struct irq_desc *desc = irq_to_desc(virq);
142 unsigned int vold, vnew, edibit; 144 unsigned int vold, vnew, edibit;
143 145
144 if (flow_type == IRQ_TYPE_NONE) 146 if (flow_type == IRQ_TYPE_NONE)
@@ -182,7 +184,7 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
182} 184}
183 185
184static struct irq_chip cpm2_pic = { 186static struct irq_chip cpm2_pic = {
185 .typename = " CPM2 SIU ", 187 .name = " CPM2 SIU ",
186 .mask = cpm2_mask_irq, 188 .mask = cpm2_mask_irq,
187 .unmask = cpm2_unmask_irq, 189 .unmask = cpm2_unmask_irq,
188 .ack = cpm2_ack, 190 .ack = cpm2_ack,
@@ -210,13 +212,13 @@ static int cpm2_pic_host_map(struct irq_host *h, unsigned int virq,
210{ 212{
211 pr_debug("cpm2_pic_host_map(%d, 0x%lx)\n", virq, hw); 213 pr_debug("cpm2_pic_host_map(%d, 0x%lx)\n", virq, hw);
212 214
213 get_irq_desc(virq)->status |= IRQ_LEVEL; 215 irq_to_desc(virq)->status |= IRQ_LEVEL;
214 set_irq_chip_and_handler(virq, &cpm2_pic, handle_level_irq); 216 set_irq_chip_and_handler(virq, &cpm2_pic, handle_level_irq);
215 return 0; 217 return 0;
216} 218}
217 219
218static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct, 220static int cpm2_pic_host_xlate(struct irq_host *h, struct device_node *ct,
219 u32 *intspec, unsigned int intsize, 221 const u32 *intspec, unsigned int intsize,
220 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 222 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
221{ 223{
222 *out_hwirq = intspec[0]; 224 *out_hwirq = intspec[0];
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index e4b6d66d93de..9de72c96e6d1 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -72,7 +72,7 @@ static phys_addr_t muram_pbase;
72/* Max address size we deal with */ 72/* Max address size we deal with */
73#define OF_MAX_ADDR_CELLS 4 73#define OF_MAX_ADDR_CELLS 4
74 74
75int __init cpm_muram_init(void) 75int cpm_muram_init(void)
76{ 76{
77 struct device_node *np; 77 struct device_node *np;
78 struct resource r; 78 struct resource r;
@@ -81,6 +81,9 @@ int __init cpm_muram_init(void)
81 int i = 0; 81 int i = 0;
82 int ret = 0; 82 int ret = 0;
83 83
84 if (muram_pbase)
85 return 0;
86
84 spin_lock_init(&cpm_muram_lock); 87 spin_lock_init(&cpm_muram_lock);
85 /* initialize the info header */ 88 /* initialize the info header */
86 rh_init(&cpm_muram_info, 1, 89 rh_init(&cpm_muram_info, 1,
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index da38a1ff97bb..62e50258cdef 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -47,7 +47,7 @@ static struct irq_chip fsl_msi_chip = {
47 .mask = mask_msi_irq, 47 .mask = mask_msi_irq,
48 .unmask = unmask_msi_irq, 48 .unmask = unmask_msi_irq,
49 .ack = fsl_msi_end_irq, 49 .ack = fsl_msi_end_irq,
50 .typename = " FSL-MSI ", 50 .name = " FSL-MSI ",
51}; 51};
52 52
53static int fsl_msi_host_map(struct irq_host *h, unsigned int virq, 53static int fsl_msi_host_map(struct irq_host *h, unsigned int virq,
@@ -55,7 +55,7 @@ static int fsl_msi_host_map(struct irq_host *h, unsigned int virq,
55{ 55{
56 struct irq_chip *chip = &fsl_msi_chip; 56 struct irq_chip *chip = &fsl_msi_chip;
57 57
58 get_irq_desc(virq)->status |= IRQ_TYPE_EDGE_FALLING; 58 irq_to_desc(virq)->status |= IRQ_TYPE_EDGE_FALLING;
59 59
60 set_irq_chip_and_handler(virq, chip, handle_edge_irq); 60 set_irq_chip_and_handler(virq, chip, handle_edge_irq);
61 61
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index ae88b1448018..4e3a3e345ab3 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -56,7 +56,7 @@ static int __init fsl_pcie_check_link(struct pci_controller *hose)
56 return 0; 56 return 0;
57} 57}
58 58
59#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) 59#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
60static int __init setup_one_atmu(struct ccsr_pci __iomem *pci, 60static int __init setup_one_atmu(struct ccsr_pci __iomem *pci,
61 unsigned int index, const struct resource *res, 61 unsigned int index, const struct resource *res,
62 resource_size_t offset) 62 resource_size_t offset)
@@ -392,9 +392,23 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8536, quirk_fsl_pcie_header);
392DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_header); 392DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_header);
393DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header); 393DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header);
394DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header); 394DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header);
395DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1011E, quirk_fsl_pcie_header);
396DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1011, quirk_fsl_pcie_header);
397DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013E, quirk_fsl_pcie_header);
398DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013, quirk_fsl_pcie_header);
399DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020E, quirk_fsl_pcie_header);
400DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020, quirk_fsl_pcie_header);
401DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022E, quirk_fsl_pcie_header);
402DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022, quirk_fsl_pcie_header);
403DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010E, quirk_fsl_pcie_header);
404DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010, quirk_fsl_pcie_header);
395DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020E, quirk_fsl_pcie_header); 405DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020E, quirk_fsl_pcie_header);
396DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020, quirk_fsl_pcie_header); 406DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020, quirk_fsl_pcie_header);
397#endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */ 407DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4040E, quirk_fsl_pcie_header);
408DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4040, quirk_fsl_pcie_header);
409DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080E, quirk_fsl_pcie_header);
410DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080, quirk_fsl_pcie_header);
411#endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */
398 412
399#if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x) 413#if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x)
400DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8314E, quirk_fsl_pcie_header); 414DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8314E, quirk_fsl_pcie_header);
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c
new file mode 100644
index 000000000000..a7635a993dca
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_pmc.c
@@ -0,0 +1,88 @@
1/*
2 * Suspend/resume support
3 *
4 * Copyright 2009 MontaVista Software, Inc.
5 *
6 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/init.h>
15#include <linux/types.h>
16#include <linux/errno.h>
17#include <linux/suspend.h>
18#include <linux/delay.h>
19#include <linux/device.h>
20#include <linux/of_platform.h>
21
22struct pmc_regs {
23 __be32 devdisr;
24 __be32 devdisr2;
25 __be32 :32;
26 __be32 :32;
27 __be32 pmcsr;
28#define PMCSR_SLP (1 << 17)
29};
30
31static struct device *pmc_dev;
32static struct pmc_regs __iomem *pmc_regs;
33
34static int pmc_suspend_enter(suspend_state_t state)
35{
36 int ret;
37
38 setbits32(&pmc_regs->pmcsr, PMCSR_SLP);
39 /* At this point, the CPU is asleep. */
40
41 /* Upon resume, wait for SLP bit to be clear. */
42 ret = spin_event_timeout((in_be32(&pmc_regs->pmcsr) & PMCSR_SLP) == 0,
43 10000, 10) ? 0 : -ETIMEDOUT;
44 if (ret)
45 dev_err(pmc_dev, "tired waiting for SLP bit to clear\n");
46 return ret;
47}
48
49static int pmc_suspend_valid(suspend_state_t state)
50{
51 if (state != PM_SUSPEND_STANDBY)
52 return 0;
53 return 1;
54}
55
56static struct platform_suspend_ops pmc_suspend_ops = {
57 .valid = pmc_suspend_valid,
58 .enter = pmc_suspend_enter,
59};
60
61static int pmc_probe(struct of_device *ofdev, const struct of_device_id *id)
62{
63 pmc_regs = of_iomap(ofdev->node, 0);
64 if (!pmc_regs)
65 return -ENOMEM;
66
67 pmc_dev = &ofdev->dev;
68 suspend_set_ops(&pmc_suspend_ops);
69 return 0;
70}
71
72static const struct of_device_id pmc_ids[] = {
73 { .compatible = "fsl,mpc8548-pmc", },
74 { .compatible = "fsl,mpc8641d-pmc", },
75 { },
76};
77
78static struct of_platform_driver pmc_driver = {
79 .driver.name = "fsl-pmc",
80 .match_table = pmc_ids,
81 .probe = pmc_probe,
82};
83
84static int __init pmc_init(void)
85{
86 return of_register_platform_driver(&pmc_driver);
87}
88device_initcall(pmc_init);
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index adca4affcf1f..b91f7acdda6f 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -372,7 +372,7 @@ err:
372 372
373arch_initcall(fsl_usb_of_init); 373arch_initcall(fsl_usb_of_init);
374 374
375#if defined(CONFIG_PPC_85xx) || defined(CONFIG_PPC_86xx) 375#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
376static __be32 __iomem *rstcr; 376static __be32 __iomem *rstcr;
377 377
378static int __init setup_rstcr(void) 378static int __init setup_rstcr(void)
diff --git a/arch/powerpc/sysdev/i8259.c b/arch/powerpc/sysdev/i8259.c
index a96584ab33dd..0a55db8a5a29 100644
--- a/arch/powerpc/sysdev/i8259.c
+++ b/arch/powerpc/sysdev/i8259.c
@@ -135,7 +135,7 @@ static void i8259_unmask_irq(unsigned int irq_nr)
135} 135}
136 136
137static struct irq_chip i8259_pic = { 137static struct irq_chip i8259_pic = {
138 .typename = " i8259 ", 138 .name = " i8259 ",
139 .mask = i8259_mask_irq, 139 .mask = i8259_mask_irq,
140 .disable = i8259_mask_irq, 140 .disable = i8259_mask_irq,
141 .unmask = i8259_unmask_irq, 141 .unmask = i8259_unmask_irq,
@@ -175,12 +175,12 @@ static int i8259_host_map(struct irq_host *h, unsigned int virq,
175 175
176 /* We block the internal cascade */ 176 /* We block the internal cascade */
177 if (hw == 2) 177 if (hw == 2)
178 get_irq_desc(virq)->status |= IRQ_NOREQUEST; 178 irq_to_desc(virq)->status |= IRQ_NOREQUEST;
179 179
180 /* We use the level handler only for now, we might want to 180 /* We use the level handler only for now, we might want to
181 * be more cautious here but that works for now 181 * be more cautious here but that works for now
182 */ 182 */
183 get_irq_desc(virq)->status |= IRQ_LEVEL; 183 irq_to_desc(virq)->status |= IRQ_LEVEL;
184 set_irq_chip_and_handler(virq, &i8259_pic, handle_level_irq); 184 set_irq_chip_and_handler(virq, &i8259_pic, handle_level_irq);
185 return 0; 185 return 0;
186} 186}
@@ -198,7 +198,7 @@ static void i8259_host_unmap(struct irq_host *h, unsigned int virq)
198} 198}
199 199
200static int i8259_host_xlate(struct irq_host *h, struct device_node *ct, 200static int i8259_host_xlate(struct irq_host *h, struct device_node *ct,
201 u32 *intspec, unsigned int intsize, 201 const u32 *intspec, unsigned int intsize,
202 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 202 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
203{ 203{
204 static unsigned char map_isa_senses[4] = { 204 static unsigned char map_isa_senses[4] = {
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index cb7689c4bfbd..28cdddd2f89e 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -605,7 +605,7 @@ static int ipic_set_irq_type(unsigned int virq, unsigned int flow_type)
605{ 605{
606 struct ipic *ipic = ipic_from_irq(virq); 606 struct ipic *ipic = ipic_from_irq(virq);
607 unsigned int src = ipic_irq_to_hw(virq); 607 unsigned int src = ipic_irq_to_hw(virq);
608 struct irq_desc *desc = get_irq_desc(virq); 608 struct irq_desc *desc = irq_to_desc(virq);
609 unsigned int vold, vnew, edibit; 609 unsigned int vold, vnew, edibit;
610 610
611 if (flow_type == IRQ_TYPE_NONE) 611 if (flow_type == IRQ_TYPE_NONE)
@@ -660,7 +660,7 @@ static int ipic_set_irq_type(unsigned int virq, unsigned int flow_type)
660 660
661/* level interrupts and edge interrupts have different ack operations */ 661/* level interrupts and edge interrupts have different ack operations */
662static struct irq_chip ipic_level_irq_chip = { 662static struct irq_chip ipic_level_irq_chip = {
663 .typename = " IPIC ", 663 .name = " IPIC ",
664 .unmask = ipic_unmask_irq, 664 .unmask = ipic_unmask_irq,
665 .mask = ipic_mask_irq, 665 .mask = ipic_mask_irq,
666 .mask_ack = ipic_mask_irq, 666 .mask_ack = ipic_mask_irq,
@@ -668,7 +668,7 @@ static struct irq_chip ipic_level_irq_chip = {
668}; 668};
669 669
670static struct irq_chip ipic_edge_irq_chip = { 670static struct irq_chip ipic_edge_irq_chip = {
671 .typename = " IPIC ", 671 .name = " IPIC ",
672 .unmask = ipic_unmask_irq, 672 .unmask = ipic_unmask_irq,
673 .mask = ipic_mask_irq, 673 .mask = ipic_mask_irq,
674 .mask_ack = ipic_mask_irq_and_ack, 674 .mask_ack = ipic_mask_irq_and_ack,
@@ -697,7 +697,7 @@ static int ipic_host_map(struct irq_host *h, unsigned int virq,
697} 697}
698 698
699static int ipic_host_xlate(struct irq_host *h, struct device_node *ct, 699static int ipic_host_xlate(struct irq_host *h, struct device_node *ct,
700 u32 *intspec, unsigned int intsize, 700 const u32 *intspec, unsigned int intsize,
701 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 701 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
702 702
703{ 703{
diff --git a/arch/powerpc/sysdev/mpc8xx_pic.c b/arch/powerpc/sysdev/mpc8xx_pic.c
index 5d2d5522ef41..69bd6f4dff83 100644
--- a/arch/powerpc/sysdev/mpc8xx_pic.c
+++ b/arch/powerpc/sysdev/mpc8xx_pic.c
@@ -72,7 +72,7 @@ static void mpc8xx_end_irq(unsigned int virq)
72 72
73static int mpc8xx_set_irq_type(unsigned int virq, unsigned int flow_type) 73static int mpc8xx_set_irq_type(unsigned int virq, unsigned int flow_type)
74{ 74{
75 struct irq_desc *desc = get_irq_desc(virq); 75 struct irq_desc *desc = irq_to_desc(virq);
76 76
77 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); 77 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
78 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK; 78 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
@@ -94,7 +94,7 @@ static int mpc8xx_set_irq_type(unsigned int virq, unsigned int flow_type)
94} 94}
95 95
96static struct irq_chip mpc8xx_pic = { 96static struct irq_chip mpc8xx_pic = {
97 .typename = " MPC8XX SIU ", 97 .name = " MPC8XX SIU ",
98 .unmask = mpc8xx_unmask_irq, 98 .unmask = mpc8xx_unmask_irq,
99 .mask = mpc8xx_mask_irq, 99 .mask = mpc8xx_mask_irq,
100 .ack = mpc8xx_ack, 100 .ack = mpc8xx_ack,
@@ -130,7 +130,7 @@ static int mpc8xx_pic_host_map(struct irq_host *h, unsigned int virq,
130 130
131 131
132static int mpc8xx_pic_host_xlate(struct irq_host *h, struct device_node *ct, 132static int mpc8xx_pic_host_xlate(struct irq_host *h, struct device_node *ct,
133 u32 *intspec, unsigned int intsize, 133 const u32 *intspec, unsigned int intsize,
134 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 134 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
135{ 135{
136 static unsigned char map_pic_senses[4] = { 136 static unsigned char map_pic_senses[4] = {
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 30c44e6b0413..aa9d06e5925b 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -572,7 +572,7 @@ static int irq_choose_cpu(unsigned int virt_irq)
572 cpumask_t mask; 572 cpumask_t mask;
573 int cpuid; 573 int cpuid;
574 574
575 cpumask_copy(&mask, irq_desc[virt_irq].affinity); 575 cpumask_copy(&mask, irq_to_desc(virt_irq)->affinity);
576 if (cpus_equal(mask, CPU_MASK_ALL)) { 576 if (cpus_equal(mask, CPU_MASK_ALL)) {
577 static int irq_rover; 577 static int irq_rover;
578 static DEFINE_SPINLOCK(irq_rover_lock); 578 static DEFINE_SPINLOCK(irq_rover_lock);
@@ -621,7 +621,7 @@ static struct mpic *mpic_find(unsigned int irq)
621 if (irq < NUM_ISA_INTERRUPTS) 621 if (irq < NUM_ISA_INTERRUPTS)
622 return NULL; 622 return NULL;
623 623
624 return irq_desc[irq].chip_data; 624 return irq_to_desc(irq)->chip_data;
625} 625}
626 626
627/* Determine if the linux irq is an IPI */ 627/* Determine if the linux irq is an IPI */
@@ -648,14 +648,14 @@ static inline u32 mpic_physmask(u32 cpumask)
648/* Get the mpic structure from the IPI number */ 648/* Get the mpic structure from the IPI number */
649static inline struct mpic * mpic_from_ipi(unsigned int ipi) 649static inline struct mpic * mpic_from_ipi(unsigned int ipi)
650{ 650{
651 return irq_desc[ipi].chip_data; 651 return irq_to_desc(ipi)->chip_data;
652} 652}
653#endif 653#endif
654 654
655/* Get the mpic structure from the irq number */ 655/* Get the mpic structure from the irq number */
656static inline struct mpic * mpic_from_irq(unsigned int irq) 656static inline struct mpic * mpic_from_irq(unsigned int irq)
657{ 657{
658 return irq_desc[irq].chip_data; 658 return irq_to_desc(irq)->chip_data;
659} 659}
660 660
661/* Send an EOI */ 661/* Send an EOI */
@@ -735,7 +735,7 @@ static void mpic_unmask_ht_irq(unsigned int irq)
735 735
736 mpic_unmask_irq(irq); 736 mpic_unmask_irq(irq);
737 737
738 if (irq_desc[irq].status & IRQ_LEVEL) 738 if (irq_to_desc(irq)->status & IRQ_LEVEL)
739 mpic_ht_end_irq(mpic, src); 739 mpic_ht_end_irq(mpic, src);
740} 740}
741 741
@@ -745,7 +745,7 @@ static unsigned int mpic_startup_ht_irq(unsigned int irq)
745 unsigned int src = mpic_irq_to_hw(irq); 745 unsigned int src = mpic_irq_to_hw(irq);
746 746
747 mpic_unmask_irq(irq); 747 mpic_unmask_irq(irq);
748 mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status); 748 mpic_startup_ht_interrupt(mpic, src, irq_to_desc(irq)->status);
749 749
750 return 0; 750 return 0;
751} 751}
@@ -755,7 +755,7 @@ static void mpic_shutdown_ht_irq(unsigned int irq)
755 struct mpic *mpic = mpic_from_irq(irq); 755 struct mpic *mpic = mpic_from_irq(irq);
756 unsigned int src = mpic_irq_to_hw(irq); 756 unsigned int src = mpic_irq_to_hw(irq);
757 757
758 mpic_shutdown_ht_interrupt(mpic, src, irq_desc[irq].status); 758 mpic_shutdown_ht_interrupt(mpic, src, irq_to_desc(irq)->status);
759 mpic_mask_irq(irq); 759 mpic_mask_irq(irq);
760} 760}
761 761
@@ -772,7 +772,7 @@ static void mpic_end_ht_irq(unsigned int irq)
772 * latched another edge interrupt coming in anyway 772 * latched another edge interrupt coming in anyway
773 */ 773 */
774 774
775 if (irq_desc[irq].status & IRQ_LEVEL) 775 if (irq_to_desc(irq)->status & IRQ_LEVEL)
776 mpic_ht_end_irq(mpic, src); 776 mpic_ht_end_irq(mpic, src);
777 mpic_eoi(mpic); 777 mpic_eoi(mpic);
778} 778}
@@ -856,7 +856,7 @@ int mpic_set_irq_type(unsigned int virq, unsigned int flow_type)
856{ 856{
857 struct mpic *mpic = mpic_from_irq(virq); 857 struct mpic *mpic = mpic_from_irq(virq);
858 unsigned int src = mpic_irq_to_hw(virq); 858 unsigned int src = mpic_irq_to_hw(virq);
859 struct irq_desc *desc = get_irq_desc(virq); 859 struct irq_desc *desc = irq_to_desc(virq);
860 unsigned int vecpri, vold, vnew; 860 unsigned int vecpri, vold, vnew;
861 861
862 DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n", 862 DBG("mpic: set_irq_type(mpic:@%p,virq:%d,src:0x%x,type:0x%x)\n",
@@ -994,7 +994,7 @@ static int mpic_host_map(struct irq_host *h, unsigned int virq,
994} 994}
995 995
996static int mpic_host_xlate(struct irq_host *h, struct device_node *ct, 996static int mpic_host_xlate(struct irq_host *h, struct device_node *ct,
997 u32 *intspec, unsigned int intsize, 997 const u32 *intspec, unsigned int intsize,
998 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 998 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
999 999
1000{ 1000{
@@ -1062,19 +1062,19 @@ struct mpic * __init mpic_alloc(struct device_node *node,
1062 mpic->name = name; 1062 mpic->name = name;
1063 1063
1064 mpic->hc_irq = mpic_irq_chip; 1064 mpic->hc_irq = mpic_irq_chip;
1065 mpic->hc_irq.typename = name; 1065 mpic->hc_irq.name = name;
1066 if (flags & MPIC_PRIMARY) 1066 if (flags & MPIC_PRIMARY)
1067 mpic->hc_irq.set_affinity = mpic_set_affinity; 1067 mpic->hc_irq.set_affinity = mpic_set_affinity;
1068#ifdef CONFIG_MPIC_U3_HT_IRQS 1068#ifdef CONFIG_MPIC_U3_HT_IRQS
1069 mpic->hc_ht_irq = mpic_irq_ht_chip; 1069 mpic->hc_ht_irq = mpic_irq_ht_chip;
1070 mpic->hc_ht_irq.typename = name; 1070 mpic->hc_ht_irq.name = name;
1071 if (flags & MPIC_PRIMARY) 1071 if (flags & MPIC_PRIMARY)
1072 mpic->hc_ht_irq.set_affinity = mpic_set_affinity; 1072 mpic->hc_ht_irq.set_affinity = mpic_set_affinity;
1073#endif /* CONFIG_MPIC_U3_HT_IRQS */ 1073#endif /* CONFIG_MPIC_U3_HT_IRQS */
1074 1074
1075#ifdef CONFIG_SMP 1075#ifdef CONFIG_SMP
1076 mpic->hc_ipi = mpic_ipi_chip; 1076 mpic->hc_ipi = mpic_ipi_chip;
1077 mpic->hc_ipi.typename = name; 1077 mpic->hc_ipi.name = name;
1078#endif /* CONFIG_SMP */ 1078#endif /* CONFIG_SMP */
1079 1079
1080 mpic->flags = flags; 1080 mpic->flags = flags;
diff --git a/arch/powerpc/sysdev/mpic_pasemi_msi.c b/arch/powerpc/sysdev/mpic_pasemi_msi.c
index 656cb772b691..0f6ab06f8474 100644
--- a/arch/powerpc/sysdev/mpic_pasemi_msi.c
+++ b/arch/powerpc/sysdev/mpic_pasemi_msi.c
@@ -60,7 +60,7 @@ static struct irq_chip mpic_pasemi_msi_chip = {
60 .eoi = mpic_end_irq, 60 .eoi = mpic_end_irq,
61 .set_type = mpic_set_irq_type, 61 .set_type = mpic_set_irq_type,
62 .set_affinity = mpic_set_affinity, 62 .set_affinity = mpic_set_affinity,
63 .typename = "PASEMI-MSI ", 63 .name = "PASEMI-MSI ",
64}; 64};
65 65
66static int pasemi_msi_check_device(struct pci_dev *pdev, int nvec, int type) 66static int pasemi_msi_check_device(struct pci_dev *pdev, int nvec, int type)
diff --git a/arch/powerpc/sysdev/mpic_u3msi.c b/arch/powerpc/sysdev/mpic_u3msi.c
index 0a8f5a9e87c9..d3caf23e6312 100644
--- a/arch/powerpc/sysdev/mpic_u3msi.c
+++ b/arch/powerpc/sysdev/mpic_u3msi.c
@@ -42,7 +42,7 @@ static struct irq_chip mpic_u3msi_chip = {
42 .eoi = mpic_end_irq, 42 .eoi = mpic_end_irq,
43 .set_type = mpic_set_irq_type, 43 .set_type = mpic_set_irq_type,
44 .set_affinity = mpic_set_affinity, 44 .set_affinity = mpic_set_affinity,
45 .typename = "MPIC-U3MSI", 45 .name = "MPIC-U3MSI",
46}; 46};
47 47
48static u64 read_ht_magic_addr(struct pci_dev *pdev, unsigned int pos) 48static u64 read_ht_magic_addr(struct pci_dev *pdev, unsigned int pos)
diff --git a/arch/powerpc/sysdev/mv64x60_pic.c b/arch/powerpc/sysdev/mv64x60_pic.c
index 2aa4ed066db1..485b92477d7c 100644
--- a/arch/powerpc/sysdev/mv64x60_pic.c
+++ b/arch/powerpc/sysdev/mv64x60_pic.c
@@ -213,7 +213,7 @@ static int mv64x60_host_map(struct irq_host *h, unsigned int virq,
213{ 213{
214 int level1; 214 int level1;
215 215
216 get_irq_desc(virq)->status |= IRQ_LEVEL; 216 irq_to_desc(virq)->status |= IRQ_LEVEL;
217 217
218 level1 = (hwirq & MV64x60_LEVEL1_MASK) >> MV64x60_LEVEL1_OFFSET; 218 level1 = (hwirq & MV64x60_LEVEL1_MASK) >> MV64x60_LEVEL1_OFFSET;
219 BUG_ON(level1 > MV64x60_LEVEL1_GPP); 219 BUG_ON(level1 > MV64x60_LEVEL1_GPP);
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 464271bea6c9..149393c02c3f 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -27,6 +27,8 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/ioport.h> 28#include <linux/ioport.h>
29#include <linux/crc32.h> 29#include <linux/crc32.h>
30#include <linux/mod_devicetable.h>
31#include <linux/of_platform.h>
30#include <asm/irq.h> 32#include <asm/irq.h>
31#include <asm/page.h> 33#include <asm/page.h>
32#include <asm/pgtable.h> 34#include <asm/pgtable.h>
@@ -65,19 +67,6 @@ static unsigned int qe_num_of_snum;
65 67
66static phys_addr_t qebase = -1; 68static phys_addr_t qebase = -1;
67 69
68int qe_alive_during_sleep(void)
69{
70 static int ret = -1;
71
72 if (ret != -1)
73 return ret;
74
75 ret = !of_find_compatible_node(NULL, NULL, "fsl,mpc8569-pmc");
76
77 return ret;
78}
79EXPORT_SYMBOL(qe_alive_during_sleep);
80
81phys_addr_t get_qe_base(void) 70phys_addr_t get_qe_base(void)
82{ 71{
83 struct device_node *qe; 72 struct device_node *qe;
@@ -104,7 +93,7 @@ phys_addr_t get_qe_base(void)
104 93
105EXPORT_SYMBOL(get_qe_base); 94EXPORT_SYMBOL(get_qe_base);
106 95
107void __init qe_reset(void) 96void qe_reset(void)
108{ 97{
109 if (qe_immr == NULL) 98 if (qe_immr == NULL)
110 qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE); 99 qe_immr = ioremap(get_qe_base(), QE_IMMAP_SIZE);
@@ -330,16 +319,18 @@ EXPORT_SYMBOL(qe_put_snum);
330static int qe_sdma_init(void) 319static int qe_sdma_init(void)
331{ 320{
332 struct sdma __iomem *sdma = &qe_immr->sdma; 321 struct sdma __iomem *sdma = &qe_immr->sdma;
333 unsigned long sdma_buf_offset; 322 static unsigned long sdma_buf_offset = (unsigned long)-ENOMEM;
334 323
335 if (!sdma) 324 if (!sdma)
336 return -ENODEV; 325 return -ENODEV;
337 326
338 /* allocate 2 internal temporary buffers (512 bytes size each) for 327 /* allocate 2 internal temporary buffers (512 bytes size each) for
339 * the SDMA */ 328 * the SDMA */
340 sdma_buf_offset = qe_muram_alloc(512 * 2, 4096); 329 if (IS_ERR_VALUE(sdma_buf_offset)) {
341 if (IS_ERR_VALUE(sdma_buf_offset)) 330 sdma_buf_offset = qe_muram_alloc(512 * 2, 4096);
342 return -ENOMEM; 331 if (IS_ERR_VALUE(sdma_buf_offset))
332 return -ENOMEM;
333 }
343 334
344 out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK); 335 out_be32(&sdma->sdebcr, (u32) sdma_buf_offset & QE_SDEBCR_BA_MASK);
345 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK | 336 out_be32(&sdma->sdmr, (QE_SDMR_GLB_1_MSK |
@@ -349,7 +340,7 @@ static int qe_sdma_init(void)
349} 340}
350 341
351/* The maximum number of RISCs we support */ 342/* The maximum number of RISCs we support */
352#define MAX_QE_RISC 2 343#define MAX_QE_RISC 4
353 344
354/* Firmware information stored here for qe_get_firmware_info() */ 345/* Firmware information stored here for qe_get_firmware_info() */
355static struct qe_firmware_info qe_firmware_info; 346static struct qe_firmware_info qe_firmware_info;
@@ -658,3 +649,35 @@ unsigned int qe_get_num_of_snums(void)
658 return num_of_snums; 649 return num_of_snums;
659} 650}
660EXPORT_SYMBOL(qe_get_num_of_snums); 651EXPORT_SYMBOL(qe_get_num_of_snums);
652
653#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx)
654static int qe_resume(struct of_device *ofdev)
655{
656 if (!qe_alive_during_sleep())
657 qe_reset();
658 return 0;
659}
660
661static int qe_probe(struct of_device *ofdev, const struct of_device_id *id)
662{
663 return 0;
664}
665
666static const struct of_device_id qe_ids[] = {
667 { .compatible = "fsl,qe", },
668 { },
669};
670
671static struct of_platform_driver qe_driver = {
672 .driver.name = "fsl-qe",
673 .match_table = qe_ids,
674 .probe = qe_probe,
675 .resume = qe_resume,
676};
677
678static int __init qe_drv_init(void)
679{
680 return of_register_platform_driver(&qe_driver);
681}
682device_initcall(qe_drv_init);
683#endif /* defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) */
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index 3faa42e03a85..2acc928d1920 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -189,7 +189,7 @@ static inline void qe_ic_write(volatile __be32 __iomem * base, unsigned int reg
189 189
190static inline struct qe_ic *qe_ic_from_irq(unsigned int virq) 190static inline struct qe_ic *qe_ic_from_irq(unsigned int virq)
191{ 191{
192 return irq_desc[virq].chip_data; 192 return irq_to_desc(virq)->chip_data;
193} 193}
194 194
195#define virq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq) 195#define virq_to_hw(virq) ((unsigned int)irq_map[virq].hwirq)
@@ -237,7 +237,7 @@ static void qe_ic_mask_irq(unsigned int virq)
237} 237}
238 238
239static struct irq_chip qe_ic_irq_chip = { 239static struct irq_chip qe_ic_irq_chip = {
240 .typename = " QEIC ", 240 .name = " QEIC ",
241 .unmask = qe_ic_unmask_irq, 241 .unmask = qe_ic_unmask_irq,
242 .mask = qe_ic_mask_irq, 242 .mask = qe_ic_mask_irq,
243 .mask_ack = qe_ic_mask_irq, 243 .mask_ack = qe_ic_mask_irq,
@@ -263,7 +263,7 @@ static int qe_ic_host_map(struct irq_host *h, unsigned int virq,
263 chip = &qe_ic->hc_irq; 263 chip = &qe_ic->hc_irq;
264 264
265 set_irq_chip_data(virq, qe_ic); 265 set_irq_chip_data(virq, qe_ic);
266 get_irq_desc(virq)->status |= IRQ_LEVEL; 266 irq_to_desc(virq)->status |= IRQ_LEVEL;
267 267
268 set_irq_chip_and_handler(virq, chip, handle_level_irq); 268 set_irq_chip_and_handler(virq, chip, handle_level_irq);
269 269
@@ -271,7 +271,7 @@ static int qe_ic_host_map(struct irq_host *h, unsigned int virq,
271} 271}
272 272
273static int qe_ic_host_xlate(struct irq_host *h, struct device_node *ct, 273static int qe_ic_host_xlate(struct irq_host *h, struct device_node *ct,
274 u32 * intspec, unsigned int intsize, 274 const u32 * intspec, unsigned int intsize,
275 irq_hw_number_t * out_hwirq, 275 irq_hw_number_t * out_hwirq,
276 unsigned int *out_flags) 276 unsigned int *out_flags)
277{ 277{
diff --git a/arch/powerpc/sysdev/tsi108_pci.c b/arch/powerpc/sysdev/tsi108_pci.c
index cf244a419e96..595034cfb85a 100644
--- a/arch/powerpc/sysdev/tsi108_pci.c
+++ b/arch/powerpc/sysdev/tsi108_pci.c
@@ -376,7 +376,7 @@ static void tsi108_pci_irq_end(u_int irq)
376 */ 376 */
377 377
378static struct irq_chip tsi108_pci_irq = { 378static struct irq_chip tsi108_pci_irq = {
379 .typename = "tsi108_PCI_int", 379 .name = "tsi108_PCI_int",
380 .mask = tsi108_pci_irq_disable, 380 .mask = tsi108_pci_irq_disable,
381 .ack = tsi108_pci_irq_ack, 381 .ack = tsi108_pci_irq_ack,
382 .end = tsi108_pci_irq_end, 382 .end = tsi108_pci_irq_end,
@@ -384,7 +384,7 @@ static struct irq_chip tsi108_pci_irq = {
384}; 384};
385 385
386static int pci_irq_host_xlate(struct irq_host *h, struct device_node *ct, 386static int pci_irq_host_xlate(struct irq_host *h, struct device_node *ct,
387 u32 *intspec, unsigned int intsize, 387 const u32 *intspec, unsigned int intsize,
388 irq_hw_number_t *out_hwirq, unsigned int *out_flags) 388 irq_hw_number_t *out_hwirq, unsigned int *out_flags)
389{ 389{
390 *out_hwirq = intspec[0]; 390 *out_hwirq = intspec[0];
@@ -398,7 +398,7 @@ static int pci_irq_host_map(struct irq_host *h, unsigned int virq,
398 DBG("%s(%d, 0x%lx)\n", __func__, virq, hw); 398 DBG("%s(%d, 0x%lx)\n", __func__, virq, hw);
399 if ((virq >= 1) && (virq <= 4)){ 399 if ((virq >= 1) && (virq <= 4)){
400 irq = virq + IRQ_PCI_INTAD_BASE - 1; 400 irq = virq + IRQ_PCI_INTAD_BASE - 1;
401 get_irq_desc(irq)->status |= IRQ_LEVEL; 401 irq_to_desc(irq)->status |= IRQ_LEVEL;
402 set_irq_chip(irq, &tsi108_pci_irq); 402 set_irq_chip(irq, &tsi108_pci_irq);
403 } 403 }
404 return 0; 404 return 0;
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 466ce9ace127..7d10074b3304 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -57,7 +57,7 @@ struct uic {
57 57
58static void uic_unmask_irq(unsigned int virq) 58static void uic_unmask_irq(unsigned int virq)
59{ 59{
60 struct irq_desc *desc = get_irq_desc(virq); 60 struct irq_desc *desc = irq_to_desc(virq);
61 struct uic *uic = get_irq_chip_data(virq); 61 struct uic *uic = get_irq_chip_data(virq);
62 unsigned int src = uic_irq_to_hw(virq); 62 unsigned int src = uic_irq_to_hw(virq);
63 unsigned long flags; 63 unsigned long flags;
@@ -101,7 +101,7 @@ static void uic_ack_irq(unsigned int virq)
101 101
102static void uic_mask_ack_irq(unsigned int virq) 102static void uic_mask_ack_irq(unsigned int virq)
103{ 103{
104 struct irq_desc *desc = get_irq_desc(virq); 104 struct irq_desc *desc = irq_to_desc(virq);
105 struct uic *uic = get_irq_chip_data(virq); 105 struct uic *uic = get_irq_chip_data(virq);
106 unsigned int src = uic_irq_to_hw(virq); 106 unsigned int src = uic_irq_to_hw(virq);
107 unsigned long flags; 107 unsigned long flags;
@@ -129,7 +129,7 @@ static int uic_set_irq_type(unsigned int virq, unsigned int flow_type)
129{ 129{
130 struct uic *uic = get_irq_chip_data(virq); 130 struct uic *uic = get_irq_chip_data(virq);
131 unsigned int src = uic_irq_to_hw(virq); 131 unsigned int src = uic_irq_to_hw(virq);
132 struct irq_desc *desc = get_irq_desc(virq); 132 struct irq_desc *desc = irq_to_desc(virq);
133 unsigned long flags; 133 unsigned long flags;
134 int trigger, polarity; 134 int trigger, polarity;
135 u32 tr, pr, mask; 135 u32 tr, pr, mask;
@@ -177,7 +177,7 @@ static int uic_set_irq_type(unsigned int virq, unsigned int flow_type)
177} 177}
178 178
179static struct irq_chip uic_irq_chip = { 179static struct irq_chip uic_irq_chip = {
180 .typename = " UIC ", 180 .name = " UIC ",
181 .unmask = uic_unmask_irq, 181 .unmask = uic_unmask_irq,
182 .mask = uic_mask_irq, 182 .mask = uic_mask_irq,
183 .mask_ack = uic_mask_ack_irq, 183 .mask_ack = uic_mask_ack_irq,
@@ -202,7 +202,7 @@ static int uic_host_map(struct irq_host *h, unsigned int virq,
202} 202}
203 203
204static int uic_host_xlate(struct irq_host *h, struct device_node *ct, 204static int uic_host_xlate(struct irq_host *h, struct device_node *ct,
205 u32 *intspec, unsigned int intsize, 205 const u32 *intspec, unsigned int intsize,
206 irq_hw_number_t *out_hwirq, unsigned int *out_type) 206 irq_hw_number_t *out_hwirq, unsigned int *out_type)
207 207
208{ 208{
diff --git a/arch/powerpc/sysdev/xilinx_intc.c b/arch/powerpc/sysdev/xilinx_intc.c
index 40edad520770..1e0ccfaf403e 100644
--- a/arch/powerpc/sysdev/xilinx_intc.c
+++ b/arch/powerpc/sysdev/xilinx_intc.c
@@ -79,7 +79,7 @@ static void xilinx_intc_mask(unsigned int virq)
79 79
80static int xilinx_intc_set_type(unsigned int virq, unsigned int flow_type) 80static int xilinx_intc_set_type(unsigned int virq, unsigned int flow_type)
81{ 81{
82 struct irq_desc *desc = get_irq_desc(virq); 82 struct irq_desc *desc = irq_to_desc(virq);
83 83
84 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL); 84 desc->status &= ~(IRQ_TYPE_SENSE_MASK | IRQ_LEVEL);
85 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK; 85 desc->status |= flow_type & IRQ_TYPE_SENSE_MASK;
@@ -106,7 +106,7 @@ static void xilinx_intc_level_unmask(unsigned int virq)
106} 106}
107 107
108static struct irq_chip xilinx_intc_level_irqchip = { 108static struct irq_chip xilinx_intc_level_irqchip = {
109 .typename = "Xilinx Level INTC", 109 .name = "Xilinx Level INTC",
110 .mask = xilinx_intc_mask, 110 .mask = xilinx_intc_mask,
111 .mask_ack = xilinx_intc_mask, 111 .mask_ack = xilinx_intc_mask,
112 .unmask = xilinx_intc_level_unmask, 112 .unmask = xilinx_intc_level_unmask,
@@ -133,7 +133,7 @@ static void xilinx_intc_edge_ack(unsigned int virq)
133} 133}
134 134
135static struct irq_chip xilinx_intc_edge_irqchip = { 135static struct irq_chip xilinx_intc_edge_irqchip = {
136 .typename = "Xilinx Edge INTC", 136 .name = "Xilinx Edge INTC",
137 .mask = xilinx_intc_mask, 137 .mask = xilinx_intc_mask,
138 .unmask = xilinx_intc_edge_unmask, 138 .unmask = xilinx_intc_edge_unmask,
139 .ack = xilinx_intc_edge_ack, 139 .ack = xilinx_intc_edge_ack,
@@ -148,7 +148,7 @@ static struct irq_chip xilinx_intc_edge_irqchip = {
148 * xilinx_intc_xlate - translate virq# from device tree interrupts property 148 * xilinx_intc_xlate - translate virq# from device tree interrupts property
149 */ 149 */
150static int xilinx_intc_xlate(struct irq_host *h, struct device_node *ct, 150static int xilinx_intc_xlate(struct irq_host *h, struct device_node *ct,
151 u32 *intspec, unsigned int intsize, 151 const u32 *intspec, unsigned int intsize,
152 irq_hw_number_t *out_hwirq, 152 irq_hw_number_t *out_hwirq,
153 unsigned int *out_flags) 153 unsigned int *out_flags)
154{ 154{
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index bdbe96c8a7e4..4e6152c13764 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1641,7 +1641,8 @@ static void super_regs(void)
1641 ptrLpPaca->saved_srr0, ptrLpPaca->saved_srr1); 1641 ptrLpPaca->saved_srr0, ptrLpPaca->saved_srr1);
1642 printf(" Saved Gpr3=%.16lx Saved Gpr4=%.16lx \n", 1642 printf(" Saved Gpr3=%.16lx Saved Gpr4=%.16lx \n",
1643 ptrLpPaca->saved_gpr3, ptrLpPaca->saved_gpr4); 1643 ptrLpPaca->saved_gpr3, ptrLpPaca->saved_gpr4);
1644 printf(" Saved Gpr5=%.16lx \n", ptrLpPaca->saved_gpr5); 1644 printf(" Saved Gpr5=%.16lx \n",
1645 ptrLpPaca->gpr5_dword.saved_gpr5);
1645 } 1646 }
1646#endif 1647#endif
1647 1648
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 25c31d681402..22c9e557bb22 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -624,38 +624,6 @@ struct mmap_arg_struct_emu31 {
624 u32 offset; 624 u32 offset;
625}; 625};
626 626
627/* common code for old and new mmaps */
628static inline long do_mmap2(
629 unsigned long addr, unsigned long len,
630 unsigned long prot, unsigned long flags,
631 unsigned long fd, unsigned long pgoff)
632{
633 struct file * file = NULL;
634 unsigned long error = -EBADF;
635
636 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
637 if (!(flags & MAP_ANONYMOUS)) {
638 file = fget(fd);
639 if (!file)
640 goto out;
641 }
642
643 down_write(&current->mm->mmap_sem);
644 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
645 if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) {
646 /* Result is out of bounds. */
647 do_munmap(current->mm, addr, len);
648 error = -ENOMEM;
649 }
650 up_write(&current->mm->mmap_sem);
651
652 if (file)
653 fput(file);
654out:
655 return error;
656}
657
658
659asmlinkage unsigned long 627asmlinkage unsigned long
660old32_mmap(struct mmap_arg_struct_emu31 __user *arg) 628old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
661{ 629{
@@ -669,7 +637,8 @@ old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
669 if (a.offset & ~PAGE_MASK) 637 if (a.offset & ~PAGE_MASK)
670 goto out; 638 goto out;
671 639
672 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); 640 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
641 a.offset >> PAGE_SHIFT);
673out: 642out:
674 return error; 643 return error;
675} 644}
@@ -682,7 +651,7 @@ sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
682 651
683 if (copy_from_user(&a, arg, sizeof(a))) 652 if (copy_from_user(&a, arg, sizeof(a)))
684 goto out; 653 goto out;
685 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 654 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
686out: 655out:
687 return error; 656 return error;
688} 657}
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index e9d94f61d500..86a74c9c9e63 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -32,32 +32,6 @@
32#include <asm/uaccess.h> 32#include <asm/uaccess.h>
33#include "entry.h" 33#include "entry.h"
34 34
35/* common code for old and new mmaps */
36static inline long do_mmap2(
37 unsigned long addr, unsigned long len,
38 unsigned long prot, unsigned long flags,
39 unsigned long fd, unsigned long pgoff)
40{
41 long error = -EBADF;
42 struct file * file = NULL;
43
44 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
45 if (!(flags & MAP_ANONYMOUS)) {
46 file = fget(fd);
47 if (!file)
48 goto out;
49 }
50
51 down_write(&current->mm->mmap_sem);
52 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
53 up_write(&current->mm->mmap_sem);
54
55 if (file)
56 fput(file);
57out:
58 return error;
59}
60
61/* 35/*
62 * Perform the select(nd, in, out, ex, tv) and mmap() system 36 * Perform the select(nd, in, out, ex, tv) and mmap() system
63 * calls. Linux for S/390 isn't able to handle more than 5 37 * calls. Linux for S/390 isn't able to handle more than 5
@@ -81,7 +55,7 @@ SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg)
81 55
82 if (copy_from_user(&a, arg, sizeof(a))) 56 if (copy_from_user(&a, arg, sizeof(a)))
83 goto out; 57 goto out;
84 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); 58 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
85out: 59out:
86 return error; 60 return error;
87} 61}
@@ -98,7 +72,7 @@ SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg)
98 if (a.offset & ~PAGE_MASK) 72 if (a.offset & ~PAGE_MASK)
99 goto out; 73 goto out;
100 74
101 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); 75 error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
102out: 76out:
103 return error; 77 return error;
104} 78}
diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c
index 001249469866..856ed68a58e6 100644
--- a/arch/score/kernel/sys_score.c
+++ b/arch/score/kernel/sys_score.c
@@ -36,34 +36,16 @@ asmlinkage long
36sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 36sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
37 unsigned long flags, unsigned long fd, unsigned long pgoff) 37 unsigned long flags, unsigned long fd, unsigned long pgoff)
38{ 38{
39 int error = -EBADF; 39 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
40 struct file *file = NULL;
41
42 if (pgoff & (~PAGE_MASK >> 12))
43 return -EINVAL;
44
45 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
46 if (!(flags & MAP_ANONYMOUS)) {
47 file = fget(fd);
48 if (!file)
49 return error;
50 }
51
52 down_write(&current->mm->mmap_sem);
53 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
54 up_write(&current->mm->mmap_sem);
55
56 if (file)
57 fput(file);
58
59 return error;
60} 40}
61 41
62asmlinkage long 42asmlinkage long
63sys_mmap(unsigned long addr, unsigned long len, unsigned long prot, 43sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
64 unsigned long flags, unsigned long fd, off_t pgoff) 44 unsigned long flags, unsigned long fd, off_t offset)
65{ 45{
66 return sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); 46 if (unlikely(offset & ~PAGE_MASK))
47 return -EINVAL;
48 return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
67} 49}
68 50
69asmlinkage long 51asmlinkage long
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 8aa5d1ceaf14..71399cde03b5 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -28,37 +28,13 @@
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29#include <asm/cachectl.h> 29#include <asm/cachectl.h>
30 30
31static inline long
32do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
33 unsigned long flags, int fd, unsigned long pgoff)
34{
35 int error = -EBADF;
36 struct file *file = NULL;
37
38 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
39 if (!(flags & MAP_ANONYMOUS)) {
40 file = fget(fd);
41 if (!file)
42 goto out;
43 }
44
45 down_write(&current->mm->mmap_sem);
46 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
47 up_write(&current->mm->mmap_sem);
48
49 if (file)
50 fput(file);
51out:
52 return error;
53}
54
55asmlinkage int old_mmap(unsigned long addr, unsigned long len, 31asmlinkage int old_mmap(unsigned long addr, unsigned long len,
56 unsigned long prot, unsigned long flags, 32 unsigned long prot, unsigned long flags,
57 int fd, unsigned long off) 33 int fd, unsigned long off)
58{ 34{
59 if (off & ~PAGE_MASK) 35 if (off & ~PAGE_MASK)
60 return -EINVAL; 36 return -EINVAL;
61 return do_mmap2(addr, len, prot, flags, fd, off>>PAGE_SHIFT); 37 return sys_mmap_pgoff(addr, len, prot, flags, fd, off>>PAGE_SHIFT);
62} 38}
63 39
64asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, 40asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
@@ -74,7 +50,7 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
74 50
75 pgoff >>= PAGE_SHIFT - 12; 51 pgoff >>= PAGE_SHIFT - 12;
76 52
77 return do_mmap2(addr, len, prot, flags, fd, pgoff); 53 return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
78} 54}
79 55
80/* 56/*
diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
index d2984fa42d3d..afeb710ec5c3 100644
--- a/arch/sh/mm/mmap.c
+++ b/arch/sh/mm/mmap.c
@@ -54,7 +54,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
54 /* We do not accept a shared mapping if it would violate 54 /* We do not accept a shared mapping if it would violate
55 * cache aliasing constraints. 55 * cache aliasing constraints.
56 */ 56 */
57 if ((flags & MAP_SHARED) && (addr & shm_align_mask)) 57 if ((flags & MAP_SHARED) &&
58 ((addr - (pgoff << PAGE_SHIFT)) & shm_align_mask))
58 return -EINVAL; 59 return -EINVAL;
59 return addr; 60 return addr;
60 } 61 }
diff --git a/arch/sparc/include/asm/fcntl.h b/arch/sparc/include/asm/fcntl.h
index d4d9c9d852c3..3b9cfb39175e 100644
--- a/arch/sparc/include/asm/fcntl.h
+++ b/arch/sparc/include/asm/fcntl.h
@@ -1,14 +1,12 @@
1#ifndef _SPARC_FCNTL_H 1#ifndef _SPARC_FCNTL_H
2#define _SPARC_FCNTL_H 2#define _SPARC_FCNTL_H
3 3
4/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
5 located on an ext2 file system */
6#define O_APPEND 0x0008 4#define O_APPEND 0x0008
7#define FASYNC 0x0040 /* fcntl, for BSD compatibility */ 5#define FASYNC 0x0040 /* fcntl, for BSD compatibility */
8#define O_CREAT 0x0200 /* not fcntl */ 6#define O_CREAT 0x0200 /* not fcntl */
9#define O_TRUNC 0x0400 /* not fcntl */ 7#define O_TRUNC 0x0400 /* not fcntl */
10#define O_EXCL 0x0800 /* not fcntl */ 8#define O_EXCL 0x0800 /* not fcntl */
11#define O_SYNC 0x2000 9#define O_DSYNC 0x2000 /* used to be O_SYNC, see below */
12#define O_NONBLOCK 0x4000 10#define O_NONBLOCK 0x4000
13#if defined(__sparc__) && defined(__arch64__) 11#if defined(__sparc__) && defined(__arch64__)
14#define O_NDELAY 0x0004 12#define O_NDELAY 0x0004
@@ -20,6 +18,21 @@
20#define O_DIRECT 0x100000 /* direct disk access hint */ 18#define O_DIRECT 0x100000 /* direct disk access hint */
21#define O_NOATIME 0x200000 19#define O_NOATIME 0x200000
22#define O_CLOEXEC 0x400000 20#define O_CLOEXEC 0x400000
21/*
22 * Before Linux 2.6.32 only O_DSYNC semantics were implemented, but using
23 * the O_SYNC flag. We continue to use the existing numerical value
24 * for O_DSYNC semantics now, but using the correct symbolic name for it.
25 * This new value is used to request true Posix O_SYNC semantics. It is
26 * defined in this strange way to make sure applications compiled against
27 * new headers get at least O_DSYNC semantics on older kernels.
28 *
29 * This has the nice side-effect that we can simply test for O_DSYNC
30 * wherever we do not care if O_DSYNC or O_SYNC is used.
31 *
32 * Note: __O_SYNC must never be used directly.
33 */
34#define __O_SYNC 0x800000
35#define O_SYNC (__O_SYNC|O_DSYNC)
23 36
24#define F_GETOWN 5 /* for sockets. */ 37#define F_GETOWN 5 /* for sockets. */
25#define F_SETOWN 6 /* for sockets. */ 38#define F_SETOWN 6 /* for sockets. */
diff --git a/arch/sparc/include/asm/pci_64.h b/arch/sparc/include/asm/pci_64.h
index b63e51c3c3ee..b0576df6ec83 100644
--- a/arch/sparc/include/asm/pci_64.h
+++ b/arch/sparc/include/asm/pci_64.h
@@ -16,8 +16,6 @@
16 16
17#define PCI_IRQ_NONE 0xffffffff 17#define PCI_IRQ_NONE 0xffffffff
18 18
19#define PCI_CACHE_LINE_BYTES 64
20
21static inline void pcibios_set_master(struct pci_dev *dev) 19static inline void pcibios_set_master(struct pci_dev *dev)
22{ 20{
23 /* No special bus mastering setup handling */ 21 /* No special bus mastering setup handling */
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
index b129611590a4..f30f4a1ead23 100644
--- a/arch/sparc/kernel/nmi.c
+++ b/arch/sparc/kernel/nmi.c
@@ -47,7 +47,7 @@ static DEFINE_PER_CPU(short, wd_enabled);
47static int endflag __initdata; 47static int endflag __initdata;
48 48
49static DEFINE_PER_CPU(unsigned int, last_irq_sum); 49static DEFINE_PER_CPU(unsigned int, last_irq_sum);
50static DEFINE_PER_CPU(local_t, alert_counter); 50static DEFINE_PER_CPU(long, alert_counter);
51static DEFINE_PER_CPU(int, nmi_touch); 51static DEFINE_PER_CPU(int, nmi_touch);
52 52
53void touch_nmi_watchdog(void) 53void touch_nmi_watchdog(void)
@@ -112,13 +112,13 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
112 touched = 1; 112 touched = 1;
113 } 113 }
114 if (!touched && __get_cpu_var(last_irq_sum) == sum) { 114 if (!touched && __get_cpu_var(last_irq_sum) == sum) {
115 local_inc(&__get_cpu_var(alert_counter)); 115 __this_cpu_inc(per_cpu_var(alert_counter));
116 if (local_read(&__get_cpu_var(alert_counter)) == 30 * nmi_hz) 116 if (__this_cpu_read(per_cpu_var(alert_counter)) == 30 * nmi_hz)
117 die_nmi("BUG: NMI Watchdog detected LOCKUP", 117 die_nmi("BUG: NMI Watchdog detected LOCKUP",
118 regs, panic_on_timeout); 118 regs, panic_on_timeout);
119 } else { 119 } else {
120 __get_cpu_var(last_irq_sum) = sum; 120 __get_cpu_var(last_irq_sum) = sum;
121 local_set(&__get_cpu_var(alert_counter), 0); 121 __this_cpu_write(per_cpu_var(alert_counter), 0);
122 } 122 }
123 if (__get_cpu_var(wd_enabled)) { 123 if (__get_cpu_var(wd_enabled)) {
124 write_pic(picl_value(nmi_hz)); 124 write_pic(picl_value(nmi_hz));
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index c68648662802..b85374f7cf94 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -1081,3 +1081,10 @@ void pci_resource_to_user(const struct pci_dev *pdev, int bar,
1081 *start = rp->start - offset; 1081 *start = rp->start - offset;
1082 *end = rp->end - offset; 1082 *end = rp->end - offset;
1083} 1083}
1084
1085static int __init pcibios_init(void)
1086{
1087 pci_dfl_cache_line_size = 64 >> 2;
1088 return 0;
1089}
1090subsys_initcall(pcibios_init);
diff --git a/arch/sparc/kernel/sys_sparc32.c b/arch/sparc/kernel/sys_sparc32.c
index 00abe87e5b51..dc0ac197e7e2 100644
--- a/arch/sparc/kernel/sys_sparc32.c
+++ b/arch/sparc/kernel/sys_sparc32.c
@@ -564,28 +564,6 @@ asmlinkage long sparc32_open(const char __user *filename,
564 return do_sys_open(AT_FDCWD, filename, flags, mode); 564 return do_sys_open(AT_FDCWD, filename, flags, mode);
565} 565}
566 566
567extern unsigned long do_mremap(unsigned long addr,
568 unsigned long old_len, unsigned long new_len,
569 unsigned long flags, unsigned long new_addr);
570
571asmlinkage unsigned long sys32_mremap(unsigned long addr,
572 unsigned long old_len, unsigned long new_len,
573 unsigned long flags, u32 __new_addr)
574{
575 unsigned long ret = -EINVAL;
576 unsigned long new_addr = __new_addr;
577
578 if (unlikely(sparc_mmap_check(addr, old_len)))
579 goto out;
580 if (unlikely(sparc_mmap_check(new_addr, new_len)))
581 goto out;
582 down_write(&current->mm->mmap_sem);
583 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
584 up_write(&current->mm->mmap_sem);
585out:
586 return ret;
587}
588
589long sys32_lookup_dcookie(unsigned long cookie_high, 567long sys32_lookup_dcookie(unsigned long cookie_high,
590 unsigned long cookie_low, 568 unsigned long cookie_low,
591 char __user *buf, size_t len) 569 char __user *buf, size_t len)
diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
index 03035c852a43..3a82e65d8db2 100644
--- a/arch/sparc/kernel/sys_sparc_32.c
+++ b/arch/sparc/kernel/sys_sparc_32.c
@@ -45,7 +45,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
45 /* We do not accept a shared mapping if it would violate 45 /* We do not accept a shared mapping if it would violate
46 * cache aliasing constraints. 46 * cache aliasing constraints.
47 */ 47 */
48 if ((flags & MAP_SHARED) && (addr & (SHMLBA - 1))) 48 if ((flags & MAP_SHARED) &&
49 ((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)))
49 return -EINVAL; 50 return -EINVAL;
50 return addr; 51 return addr;
51 } 52 }
@@ -79,15 +80,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
79 } 80 }
80} 81}
81 82
82asmlinkage unsigned long sparc_brk(unsigned long brk)
83{
84 if(ARCH_SUN4C) {
85 if ((brk & 0xe0000000) != (current->mm->brk & 0xe0000000))
86 return current->mm->brk;
87 }
88 return sys_brk(brk);
89}
90
91/* 83/*
92 * sys_pipe() is the normal C calling standard for creating 84 * sys_pipe() is the normal C calling standard for creating
93 * a pipe. It's not the way unix traditionally does this, though. 85 * a pipe. It's not the way unix traditionally does this, though.
@@ -234,31 +226,6 @@ int sparc_mmap_check(unsigned long addr, unsigned long len)
234} 226}
235 227
236/* Linux version of mmap */ 228/* Linux version of mmap */
237static unsigned long do_mmap2(unsigned long addr, unsigned long len,
238 unsigned long prot, unsigned long flags, unsigned long fd,
239 unsigned long pgoff)
240{
241 struct file * file = NULL;
242 unsigned long retval = -EBADF;
243
244 if (!(flags & MAP_ANONYMOUS)) {
245 file = fget(fd);
246 if (!file)
247 goto out;
248 }
249
250 len = PAGE_ALIGN(len);
251 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
252
253 down_write(&current->mm->mmap_sem);
254 retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
255 up_write(&current->mm->mmap_sem);
256
257 if (file)
258 fput(file);
259out:
260 return retval;
261}
262 229
263asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 230asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
264 unsigned long prot, unsigned long flags, unsigned long fd, 231 unsigned long prot, unsigned long flags, unsigned long fd,
@@ -266,14 +233,16 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
266{ 233{
267 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE 234 /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
268 we have. */ 235 we have. */
269 return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12)); 236 return sys_mmap_pgoff(addr, len, prot, flags, fd,
237 pgoff >> (PAGE_SHIFT - 12));
270} 238}
271 239
272asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len, 240asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
273 unsigned long prot, unsigned long flags, unsigned long fd, 241 unsigned long prot, unsigned long flags, unsigned long fd,
274 unsigned long off) 242 unsigned long off)
275{ 243{
276 return do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT); 244 /* no alignment check? */
245 return sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
277} 246}
278 247
279long sparc_remap_file_pages(unsigned long start, unsigned long size, 248long sparc_remap_file_pages(unsigned long start, unsigned long size,
@@ -287,27 +256,6 @@ long sparc_remap_file_pages(unsigned long start, unsigned long size,
287 (pgoff >> (PAGE_SHIFT - 12)), flags); 256 (pgoff >> (PAGE_SHIFT - 12)), flags);
288} 257}
289 258
290extern unsigned long do_mremap(unsigned long addr,
291 unsigned long old_len, unsigned long new_len,
292 unsigned long flags, unsigned long new_addr);
293
294asmlinkage unsigned long sparc_mremap(unsigned long addr,
295 unsigned long old_len, unsigned long new_len,
296 unsigned long flags, unsigned long new_addr)
297{
298 unsigned long ret = -EINVAL;
299
300 if (unlikely(sparc_mmap_check(addr, old_len)))
301 goto out;
302 if (unlikely(sparc_mmap_check(new_addr, new_len)))
303 goto out;
304 down_write(&current->mm->mmap_sem);
305 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
306 up_write(&current->mm->mmap_sem);
307out:
308 return ret;
309}
310
311/* we come to here via sys_nis_syscall so it can setup the regs argument */ 259/* we come to here via sys_nis_syscall so it can setup the regs argument */
312asmlinkage unsigned long 260asmlinkage unsigned long
313c_sys_nis_syscall (struct pt_regs *regs) 261c_sys_nis_syscall (struct pt_regs *regs)
diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
index e2d102447a43..cfa0e19abe3b 100644
--- a/arch/sparc/kernel/sys_sparc_64.c
+++ b/arch/sparc/kernel/sys_sparc_64.c
@@ -317,10 +317,14 @@ bottomup:
317unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags) 317unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags)
318{ 318{
319 unsigned long align_goal, addr = -ENOMEM; 319 unsigned long align_goal, addr = -ENOMEM;
320 unsigned long (*get_area)(struct file *, unsigned long,
321 unsigned long, unsigned long, unsigned long);
322
323 get_area = current->mm->get_unmapped_area;
320 324
321 if (flags & MAP_FIXED) { 325 if (flags & MAP_FIXED) {
322 /* Ok, don't mess with it. */ 326 /* Ok, don't mess with it. */
323 return get_unmapped_area(NULL, orig_addr, len, pgoff, flags); 327 return get_area(NULL, orig_addr, len, pgoff, flags);
324 } 328 }
325 flags &= ~MAP_SHARED; 329 flags &= ~MAP_SHARED;
326 330
@@ -333,7 +337,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
333 align_goal = (64UL * 1024); 337 align_goal = (64UL * 1024);
334 338
335 do { 339 do {
336 addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags); 340 addr = get_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
337 if (!(addr & ~PAGE_MASK)) { 341 if (!(addr & ~PAGE_MASK)) {
338 addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL); 342 addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL);
339 break; 343 break;
@@ -351,7 +355,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
351 * be obtained. 355 * be obtained.
352 */ 356 */
353 if (addr & ~PAGE_MASK) 357 if (addr & ~PAGE_MASK)
354 addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags); 358 addr = get_area(NULL, orig_addr, len, pgoff, flags);
355 359
356 return addr; 360 return addr;
357} 361}
@@ -399,18 +403,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
399 } 403 }
400} 404}
401 405
402SYSCALL_DEFINE1(sparc_brk, unsigned long, brk)
403{
404 /* People could try to be nasty and use ta 0x6d in 32bit programs */
405 if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32)
406 return current->mm->brk;
407
408 if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk)))
409 return current->mm->brk;
410
411 return sys_brk(brk);
412}
413
414/* 406/*
415 * sys_pipe() is the normal C calling standard for creating 407 * sys_pipe() is the normal C calling standard for creating
416 * a pipe. It's not the way unix traditionally does this, though. 408 * a pipe. It's not the way unix traditionally does this, though.
@@ -568,23 +560,13 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
568 unsigned long, prot, unsigned long, flags, unsigned long, fd, 560 unsigned long, prot, unsigned long, flags, unsigned long, fd,
569 unsigned long, off) 561 unsigned long, off)
570{ 562{
571 struct file * file = NULL; 563 unsigned long retval = -EINVAL;
572 unsigned long retval = -EBADF;
573
574 if (!(flags & MAP_ANONYMOUS)) {
575 file = fget(fd);
576 if (!file)
577 goto out;
578 }
579 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
580 len = PAGE_ALIGN(len);
581 564
582 down_write(&current->mm->mmap_sem); 565 if ((off + PAGE_ALIGN(len)) < off)
583 retval = do_mmap(file, addr, len, prot, flags, off); 566 goto out;
584 up_write(&current->mm->mmap_sem); 567 if (off & ~PAGE_MASK)
585 568 goto out;
586 if (file) 569 retval = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
587 fput(file);
588out: 570out:
589 return retval; 571 return retval;
590} 572}
@@ -614,12 +596,6 @@ SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len,
614 596
615 if (test_thread_flag(TIF_32BIT)) 597 if (test_thread_flag(TIF_32BIT))
616 goto out; 598 goto out;
617 if (unlikely(new_len >= VA_EXCLUDE_START))
618 goto out;
619 if (unlikely(sparc_mmap_check(addr, old_len)))
620 goto out;
621 if (unlikely(sparc_mmap_check(new_addr, new_len)))
622 goto out;
623 599
624 down_write(&current->mm->mmap_sem); 600 down_write(&current->mm->mmap_sem);
625 ret = do_mremap(addr, old_len, new_len, flags, new_addr); 601 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h
index a63c5d2d9849..d2f999ae2b85 100644
--- a/arch/sparc/kernel/systbls.h
+++ b/arch/sparc/kernel/systbls.h
@@ -9,7 +9,6 @@
9struct new_utsname; 9struct new_utsname;
10 10
11extern asmlinkage unsigned long sys_getpagesize(void); 11extern asmlinkage unsigned long sys_getpagesize(void);
12extern asmlinkage unsigned long sparc_brk(unsigned long brk);
13extern asmlinkage long sparc_pipe(struct pt_regs *regs); 12extern asmlinkage long sparc_pipe(struct pt_regs *regs);
14extern asmlinkage long sys_ipc(unsigned int call, int first, 13extern asmlinkage long sys_ipc(unsigned int call, int first,
15 unsigned long second, 14 unsigned long second,
diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
index ceb1530f8aa6..801fc8e5a0e8 100644
--- a/arch/sparc/kernel/systbls_32.S
+++ b/arch/sparc/kernel/systbls_32.S
@@ -19,7 +19,7 @@ sys_call_table:
19/*0*/ .long sys_restart_syscall, sys_exit, sys_fork, sys_read, sys_write 19/*0*/ .long sys_restart_syscall, sys_exit, sys_fork, sys_read, sys_write
20/*5*/ .long sys_open, sys_close, sys_wait4, sys_creat, sys_link 20/*5*/ .long sys_open, sys_close, sys_wait4, sys_creat, sys_link
21/*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod 21/*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod
22/*15*/ .long sys_chmod, sys_lchown16, sparc_brk, sys_nis_syscall, sys_lseek 22/*15*/ .long sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, sys_lseek
23/*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 23/*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
24/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause 24/*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause
25/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice 25/*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
@@ -67,7 +67,7 @@ sys_call_table:
67/*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall 67/*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
68/*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler 68/*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
69/*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep 69/*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
70/*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl 70/*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
71/*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep 71/*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
72/*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun 72/*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
73/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy 73/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
index cc8e7862e95a..e575b46bd7a9 100644
--- a/arch/sparc/kernel/systbls_64.S
+++ b/arch/sparc/kernel/systbls_64.S
@@ -21,7 +21,7 @@ sys_call_table32:
21/*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write 21/*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write
22/*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link 22/*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link
23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod 23/*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod
24/*15*/ .word sys_chmod, sys_lchown16, sys_sparc_brk, sys32_perfctr, sys32_lseek 24/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys32_perfctr, sys32_lseek
25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16 25/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause 26/*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause
27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice 27/*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
@@ -68,7 +68,7 @@ sys_call_table32:
68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall 68 .word compat_sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys32_mlockall
69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler 69/*240*/ .word sys_munlockall, sys32_sched_setparam, sys32_sched_getparam, sys32_sched_setscheduler, sys32_sched_getscheduler
70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep 70 .word sys_sched_yield, sys32_sched_get_priority_max, sys32_sched_get_priority_min, sys32_sched_rr_get_interval, compat_sys_nanosleep
71/*250*/ .word sys32_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl 71/*250*/ .word sys_mremap, compat_sys_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep 72 .word sys32_sync_file_range, compat_sys_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun 73/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 74 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
@@ -96,7 +96,7 @@ sys_call_table:
96/*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write 96/*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write
97/*5*/ .word sys_open, sys_close, sys_wait4, sys_creat, sys_link 97/*5*/ .word sys_open, sys_close, sys_wait4, sys_creat, sys_link
98/*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod 98/*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod
99/*15*/ .word sys_chmod, sys_lchown, sys_sparc_brk, sys_perfctr, sys_lseek 99/*15*/ .word sys_chmod, sys_lchown, sys_brk, sys_perfctr, sys_lseek
100/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid 100/*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
101/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall 101/*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
102/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice 102/*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index a4625c7b2bf9..cccab850c27e 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -8,6 +8,7 @@
8#include "linux/mm.h" 8#include "linux/mm.h"
9#include "linux/sched.h" 9#include "linux/sched.h"
10#include "linux/utsname.h" 10#include "linux/utsname.h"
11#include "linux/syscalls.h"
11#include "asm/current.h" 12#include "asm/current.h"
12#include "asm/mman.h" 13#include "asm/mman.h"
13#include "asm/uaccess.h" 14#include "asm/uaccess.h"
@@ -37,31 +38,6 @@ long sys_vfork(void)
37 return ret; 38 return ret;
38} 39}
39 40
40/* common code for old and new mmaps */
41long sys_mmap2(unsigned long addr, unsigned long len,
42 unsigned long prot, unsigned long flags,
43 unsigned long fd, unsigned long pgoff)
44{
45 long error = -EBADF;
46 struct file * file = NULL;
47
48 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
49 if (!(flags & MAP_ANONYMOUS)) {
50 file = fget(fd);
51 if (!file)
52 goto out;
53 }
54
55 down_write(&current->mm->mmap_sem);
56 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
57 up_write(&current->mm->mmap_sem);
58
59 if (file)
60 fput(file);
61 out:
62 return error;
63}
64
65long old_mmap(unsigned long addr, unsigned long len, 41long old_mmap(unsigned long addr, unsigned long len,
66 unsigned long prot, unsigned long flags, 42 unsigned long prot, unsigned long flags,
67 unsigned long fd, unsigned long offset) 43 unsigned long fd, unsigned long offset)
@@ -70,7 +46,7 @@ long old_mmap(unsigned long addr, unsigned long len,
70 if (offset & ~PAGE_MASK) 46 if (offset & ~PAGE_MASK)
71 goto out; 47 goto out;
72 48
73 err = sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); 49 err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
74 out: 50 out:
75 return err; 51 return err;
76} 52}
diff --git a/arch/um/sys-i386/shared/sysdep/syscalls.h b/arch/um/sys-i386/shared/sysdep/syscalls.h
index 905698197e35..e7787679e317 100644
--- a/arch/um/sys-i386/shared/sysdep/syscalls.h
+++ b/arch/um/sys-i386/shared/sysdep/syscalls.h
@@ -20,7 +20,3 @@ extern syscall_handler_t *sys_call_table[];
20#define EXECUTE_SYSCALL(syscall, regs) \ 20#define EXECUTE_SYSCALL(syscall, regs) \
21 ((long (*)(struct syscall_args)) \ 21 ((long (*)(struct syscall_args)) \
22 (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs)) 22 (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
23
24extern long sys_mmap2(unsigned long addr, unsigned long len,
25 unsigned long prot, unsigned long flags,
26 unsigned long fd, unsigned long pgoff);
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index 731318e5ac1d..bc01e3ebfeb2 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -187,8 +187,8 @@ config HAVE_MMIOTRACE_SUPPORT
187 def_bool y 187 def_bool y
188 188
189config X86_DECODER_SELFTEST 189config X86_DECODER_SELFTEST
190 bool "x86 instruction decoder selftest" 190 bool "x86 instruction decoder selftest"
191 depends on DEBUG_KERNEL 191 depends on DEBUG_KERNEL && KPROBES
192 ---help--- 192 ---help---
193 Perform x86 instruction decoder selftests at build time. 193 Perform x86 instruction decoder selftests at build time.
194 This option is useful for checking the sanity of x86 instruction 194 This option is useful for checking the sanity of x86 instruction
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 4eefdca9832b..53147ad85b96 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -696,7 +696,7 @@ ia32_sys_call_table:
696 .quad quiet_ni_syscall /* streams2 */ 696 .quad quiet_ni_syscall /* streams2 */
697 .quad stub32_vfork /* 190 */ 697 .quad stub32_vfork /* 190 */
698 .quad compat_sys_getrlimit 698 .quad compat_sys_getrlimit
699 .quad sys32_mmap2 699 .quad sys_mmap_pgoff
700 .quad sys32_truncate64 700 .quad sys32_truncate64
701 .quad sys32_ftruncate64 701 .quad sys32_ftruncate64
702 .quad sys32_stat64 /* 195 */ 702 .quad sys32_stat64 /* 195 */
diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
index df82c0e48ded..422572c77923 100644
--- a/arch/x86/ia32/sys_ia32.c
+++ b/arch/x86/ia32/sys_ia32.c
@@ -155,9 +155,6 @@ struct mmap_arg_struct {
155asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) 155asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg)
156{ 156{
157 struct mmap_arg_struct a; 157 struct mmap_arg_struct a;
158 struct file *file = NULL;
159 unsigned long retval;
160 struct mm_struct *mm ;
161 158
162 if (copy_from_user(&a, arg, sizeof(a))) 159 if (copy_from_user(&a, arg, sizeof(a)))
163 return -EFAULT; 160 return -EFAULT;
@@ -165,22 +162,8 @@ asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg)
165 if (a.offset & ~PAGE_MASK) 162 if (a.offset & ~PAGE_MASK)
166 return -EINVAL; 163 return -EINVAL;
167 164
168 if (!(a.flags & MAP_ANONYMOUS)) { 165 return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
169 file = fget(a.fd);
170 if (!file)
171 return -EBADF;
172 }
173
174 mm = current->mm;
175 down_write(&mm->mmap_sem);
176 retval = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags,
177 a.offset>>PAGE_SHIFT); 166 a.offset>>PAGE_SHIFT);
178 if (file)
179 fput(file);
180
181 up_write(&mm->mmap_sem);
182
183 return retval;
184} 167}
185 168
186asmlinkage long sys32_mprotect(unsigned long start, size_t len, 169asmlinkage long sys32_mprotect(unsigned long start, size_t len,
@@ -483,30 +466,6 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd,
483 return ret; 466 return ret;
484} 467}
485 468
486asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len,
487 unsigned long prot, unsigned long flags,
488 unsigned long fd, unsigned long pgoff)
489{
490 struct mm_struct *mm = current->mm;
491 unsigned long error;
492 struct file *file = NULL;
493
494 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
495 if (!(flags & MAP_ANONYMOUS)) {
496 file = fget(fd);
497 if (!file)
498 return -EBADF;
499 }
500
501 down_write(&mm->mmap_sem);
502 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
503 up_write(&mm->mmap_sem);
504
505 if (file)
506 fput(file);
507 return error;
508}
509
510asmlinkage long sys32_olduname(struct oldold_utsname __user *name) 469asmlinkage long sys32_olduname(struct oldold_utsname __user *name)
511{ 470{
512 char *arch = "x86_64"; 471 char *arch = "x86_64";
diff --git a/arch/x86/include/asm/amd_iommu_proto.h b/arch/x86/include/asm/amd_iommu_proto.h
index 84786fb9a23b..4d817f9e6e77 100644
--- a/arch/x86/include/asm/amd_iommu_proto.h
+++ b/arch/x86/include/asm/amd_iommu_proto.h
@@ -28,7 +28,9 @@ extern void amd_iommu_flush_all_domains(void);
28extern void amd_iommu_flush_all_devices(void); 28extern void amd_iommu_flush_all_devices(void);
29extern void amd_iommu_apply_erratum_63(u16 devid); 29extern void amd_iommu_apply_erratum_63(u16 devid);
30extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu); 30extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu);
31 31extern int amd_iommu_init_devices(void);
32extern void amd_iommu_uninit_devices(void);
33extern void amd_iommu_init_notifier(void);
32#ifndef CONFIG_AMD_IOMMU_STATS 34#ifndef CONFIG_AMD_IOMMU_STATS
33 35
34static inline void amd_iommu_stats_init(void) { } 36static inline void amd_iommu_stats_init(void) { }
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 6a635bd39867..4611f085cd43 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -113,7 +113,7 @@
113 */ 113 */
114#define LOCAL_PENDING_VECTOR 0xec 114#define LOCAL_PENDING_VECTOR 0xec
115 115
116#define UV_BAU_MESSAGE 0xec 116#define UV_BAU_MESSAGE 0xea
117 117
118/* 118/*
119 * Self IPI vector for machine checks 119 * Self IPI vector for machine checks
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index 5bef931f8b14..2d228fc9b4b7 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -244,6 +244,9 @@ do { \
244 244
245#define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0) 245#define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0)
246 246
247struct msr *msrs_alloc(void);
248void msrs_free(struct msr *msrs);
249
247#ifdef CONFIG_SMP 250#ifdef CONFIG_SMP
248int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h); 251int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
249int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h); 252int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index b399988eee3a..b4bf9a942ed0 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -118,11 +118,27 @@ extern int __init pcibios_init(void);
118 118
119/* pci-mmconfig.c */ 119/* pci-mmconfig.c */
120 120
121/* "PCI MMCONFIG %04x [bus %02x-%02x]" */
122#define PCI_MMCFG_RESOURCE_NAME_LEN (22 + 4 + 2 + 2)
123
124struct pci_mmcfg_region {
125 struct list_head list;
126 struct resource res;
127 u64 address;
128 char __iomem *virt;
129 u16 segment;
130 u8 start_bus;
131 u8 end_bus;
132 char name[PCI_MMCFG_RESOURCE_NAME_LEN];
133};
134
121extern int __init pci_mmcfg_arch_init(void); 135extern int __init pci_mmcfg_arch_init(void);
122extern void __init pci_mmcfg_arch_free(void); 136extern void __init pci_mmcfg_arch_free(void);
137extern struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus);
138
139extern struct list_head pci_mmcfg_list;
123 140
124extern struct acpi_mcfg_allocation *pci_mmcfg_config; 141#define PCI_MMCFG_BUS_OFFSET(bus) ((bus) << 20)
125extern int pci_mmcfg_config_num;
126 142
127/* 143/*
128 * AMD Fam10h CPUs are buggy, and cannot access MMIO config space 144 * AMD Fam10h CPUs are buggy, and cannot access MMIO config space
diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h
index b65a36defeb7..0c44196b78ac 100644
--- a/arch/x86/include/asm/percpu.h
+++ b/arch/x86/include/asm/percpu.h
@@ -74,31 +74,31 @@ extern void __bad_percpu_size(void);
74 74
75#define percpu_to_op(op, var, val) \ 75#define percpu_to_op(op, var, val) \
76do { \ 76do { \
77 typedef typeof(var) T__; \ 77 typedef typeof(var) pto_T__; \
78 if (0) { \ 78 if (0) { \
79 T__ tmp__; \ 79 pto_T__ pto_tmp__; \
80 tmp__ = (val); \ 80 pto_tmp__ = (val); \
81 } \ 81 } \
82 switch (sizeof(var)) { \ 82 switch (sizeof(var)) { \
83 case 1: \ 83 case 1: \
84 asm(op "b %1,"__percpu_arg(0) \ 84 asm(op "b %1,"__percpu_arg(0) \
85 : "+m" (var) \ 85 : "+m" (var) \
86 : "qi" ((T__)(val))); \ 86 : "qi" ((pto_T__)(val))); \
87 break; \ 87 break; \
88 case 2: \ 88 case 2: \
89 asm(op "w %1,"__percpu_arg(0) \ 89 asm(op "w %1,"__percpu_arg(0) \
90 : "+m" (var) \ 90 : "+m" (var) \
91 : "ri" ((T__)(val))); \ 91 : "ri" ((pto_T__)(val))); \
92 break; \ 92 break; \
93 case 4: \ 93 case 4: \
94 asm(op "l %1,"__percpu_arg(0) \ 94 asm(op "l %1,"__percpu_arg(0) \
95 : "+m" (var) \ 95 : "+m" (var) \
96 : "ri" ((T__)(val))); \ 96 : "ri" ((pto_T__)(val))); \
97 break; \ 97 break; \
98 case 8: \ 98 case 8: \
99 asm(op "q %1,"__percpu_arg(0) \ 99 asm(op "q %1,"__percpu_arg(0) \
100 : "+m" (var) \ 100 : "+m" (var) \
101 : "re" ((T__)(val))); \ 101 : "re" ((pto_T__)(val))); \
102 break; \ 102 break; \
103 default: __bad_percpu_size(); \ 103 default: __bad_percpu_size(); \
104 } \ 104 } \
@@ -106,31 +106,31 @@ do { \
106 106
107#define percpu_from_op(op, var, constraint) \ 107#define percpu_from_op(op, var, constraint) \
108({ \ 108({ \
109 typeof(var) ret__; \ 109 typeof(var) pfo_ret__; \
110 switch (sizeof(var)) { \ 110 switch (sizeof(var)) { \
111 case 1: \ 111 case 1: \
112 asm(op "b "__percpu_arg(1)",%0" \ 112 asm(op "b "__percpu_arg(1)",%0" \
113 : "=q" (ret__) \ 113 : "=q" (pfo_ret__) \
114 : constraint); \ 114 : constraint); \
115 break; \ 115 break; \
116 case 2: \ 116 case 2: \
117 asm(op "w "__percpu_arg(1)",%0" \ 117 asm(op "w "__percpu_arg(1)",%0" \
118 : "=r" (ret__) \ 118 : "=r" (pfo_ret__) \
119 : constraint); \ 119 : constraint); \
120 break; \ 120 break; \
121 case 4: \ 121 case 4: \
122 asm(op "l "__percpu_arg(1)",%0" \ 122 asm(op "l "__percpu_arg(1)",%0" \
123 : "=r" (ret__) \ 123 : "=r" (pfo_ret__) \
124 : constraint); \ 124 : constraint); \
125 break; \ 125 break; \
126 case 8: \ 126 case 8: \
127 asm(op "q "__percpu_arg(1)",%0" \ 127 asm(op "q "__percpu_arg(1)",%0" \
128 : "=r" (ret__) \ 128 : "=r" (pfo_ret__) \
129 : constraint); \ 129 : constraint); \
130 break; \ 130 break; \
131 default: __bad_percpu_size(); \ 131 default: __bad_percpu_size(); \
132 } \ 132 } \
133 ret__; \ 133 pfo_ret__; \
134}) 134})
135 135
136/* 136/*
@@ -153,6 +153,84 @@ do { \
153#define percpu_or(var, val) percpu_to_op("or", per_cpu__##var, val) 153#define percpu_or(var, val) percpu_to_op("or", per_cpu__##var, val)
154#define percpu_xor(var, val) percpu_to_op("xor", per_cpu__##var, val) 154#define percpu_xor(var, val) percpu_to_op("xor", per_cpu__##var, val)
155 155
156#define __this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
157#define __this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
158#define __this_cpu_read_4(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
159
160#define __this_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val)
161#define __this_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val)
162#define __this_cpu_write_4(pcp, val) percpu_to_op("mov", (pcp), val)
163#define __this_cpu_add_1(pcp, val) percpu_to_op("add", (pcp), val)
164#define __this_cpu_add_2(pcp, val) percpu_to_op("add", (pcp), val)
165#define __this_cpu_add_4(pcp, val) percpu_to_op("add", (pcp), val)
166#define __this_cpu_and_1(pcp, val) percpu_to_op("and", (pcp), val)
167#define __this_cpu_and_2(pcp, val) percpu_to_op("and", (pcp), val)
168#define __this_cpu_and_4(pcp, val) percpu_to_op("and", (pcp), val)
169#define __this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val)
170#define __this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val)
171#define __this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val)
172#define __this_cpu_xor_1(pcp, val) percpu_to_op("xor", (pcp), val)
173#define __this_cpu_xor_2(pcp, val) percpu_to_op("xor", (pcp), val)
174#define __this_cpu_xor_4(pcp, val) percpu_to_op("xor", (pcp), val)
175
176#define this_cpu_read_1(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
177#define this_cpu_read_2(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
178#define this_cpu_read_4(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
179#define this_cpu_write_1(pcp, val) percpu_to_op("mov", (pcp), val)
180#define this_cpu_write_2(pcp, val) percpu_to_op("mov", (pcp), val)
181#define this_cpu_write_4(pcp, val) percpu_to_op("mov", (pcp), val)
182#define this_cpu_add_1(pcp, val) percpu_to_op("add", (pcp), val)
183#define this_cpu_add_2(pcp, val) percpu_to_op("add", (pcp), val)
184#define this_cpu_add_4(pcp, val) percpu_to_op("add", (pcp), val)
185#define this_cpu_and_1(pcp, val) percpu_to_op("and", (pcp), val)
186#define this_cpu_and_2(pcp, val) percpu_to_op("and", (pcp), val)
187#define this_cpu_and_4(pcp, val) percpu_to_op("and", (pcp), val)
188#define this_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val)
189#define this_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val)
190#define this_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val)
191#define this_cpu_xor_1(pcp, val) percpu_to_op("xor", (pcp), val)
192#define this_cpu_xor_2(pcp, val) percpu_to_op("xor", (pcp), val)
193#define this_cpu_xor_4(pcp, val) percpu_to_op("xor", (pcp), val)
194
195#define irqsafe_cpu_add_1(pcp, val) percpu_to_op("add", (pcp), val)
196#define irqsafe_cpu_add_2(pcp, val) percpu_to_op("add", (pcp), val)
197#define irqsafe_cpu_add_4(pcp, val) percpu_to_op("add", (pcp), val)
198#define irqsafe_cpu_and_1(pcp, val) percpu_to_op("and", (pcp), val)
199#define irqsafe_cpu_and_2(pcp, val) percpu_to_op("and", (pcp), val)
200#define irqsafe_cpu_and_4(pcp, val) percpu_to_op("and", (pcp), val)
201#define irqsafe_cpu_or_1(pcp, val) percpu_to_op("or", (pcp), val)
202#define irqsafe_cpu_or_2(pcp, val) percpu_to_op("or", (pcp), val)
203#define irqsafe_cpu_or_4(pcp, val) percpu_to_op("or", (pcp), val)
204#define irqsafe_cpu_xor_1(pcp, val) percpu_to_op("xor", (pcp), val)
205#define irqsafe_cpu_xor_2(pcp, val) percpu_to_op("xor", (pcp), val)
206#define irqsafe_cpu_xor_4(pcp, val) percpu_to_op("xor", (pcp), val)
207
208/*
209 * Per cpu atomic 64 bit operations are only available under 64 bit.
210 * 32 bit must fall back to generic operations.
211 */
212#ifdef CONFIG_X86_64
213#define __this_cpu_read_8(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
214#define __this_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val)
215#define __this_cpu_add_8(pcp, val) percpu_to_op("add", (pcp), val)
216#define __this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val)
217#define __this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val)
218#define __this_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val)
219
220#define this_cpu_read_8(pcp) percpu_from_op("mov", (pcp), "m"(pcp))
221#define this_cpu_write_8(pcp, val) percpu_to_op("mov", (pcp), val)
222#define this_cpu_add_8(pcp, val) percpu_to_op("add", (pcp), val)
223#define this_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val)
224#define this_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val)
225#define this_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val)
226
227#define irqsafe_cpu_add_8(pcp, val) percpu_to_op("add", (pcp), val)
228#define irqsafe_cpu_and_8(pcp, val) percpu_to_op("and", (pcp), val)
229#define irqsafe_cpu_or_8(pcp, val) percpu_to_op("or", (pcp), val)
230#define irqsafe_cpu_xor_8(pcp, val) percpu_to_op("xor", (pcp), val)
231
232#endif
233
156/* This is not atomic against other CPUs -- CPU preemption needs to be off */ 234/* This is not atomic against other CPUs -- CPU preemption needs to be off */
157#define x86_test_and_clear_bit_percpu(bit, var) \ 235#define x86_test_and_clear_bit_percpu(bit, var) \
158({ \ 236({ \
diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
index 9af9decb38c3..4a5a089e1c62 100644
--- a/arch/x86/include/asm/sys_ia32.h
+++ b/arch/x86/include/asm/sys_ia32.h
@@ -57,9 +57,6 @@ asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32);
57asmlinkage long sys32_personality(unsigned long); 57asmlinkage long sys32_personality(unsigned long);
58asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32); 58asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
59 59
60asmlinkage long sys32_mmap2(unsigned long, unsigned long, unsigned long,
61 unsigned long, unsigned long, unsigned long);
62
63struct oldold_utsname; 60struct oldold_utsname;
64struct old_utsname; 61struct old_utsname;
65asmlinkage long sys32_olduname(struct oldold_utsname __user *); 62asmlinkage long sys32_olduname(struct oldold_utsname __user *);
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 372b76edd63f..1bb6e395881c 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -55,8 +55,6 @@ struct sel_arg_struct;
55struct oldold_utsname; 55struct oldold_utsname;
56struct old_utsname; 56struct old_utsname;
57 57
58asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long,
59 unsigned long, unsigned long, unsigned long);
60asmlinkage int old_mmap(struct mmap_arg_struct __user *); 58asmlinkage int old_mmap(struct mmap_arg_struct __user *);
61asmlinkage int old_select(struct sel_arg_struct __user *); 59asmlinkage int old_select(struct sel_arg_struct __user *);
62asmlinkage int sys_ipc(uint, int, int, int, void __user *, long); 60asmlinkage int sys_ipc(uint, int, int, int, void __user *, long);
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index 022a84386de8..ecb544e65382 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -23,6 +23,7 @@ struct task_struct *__switch_to(struct task_struct *prev,
23struct tss_struct; 23struct tss_struct;
24void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p, 24void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
25 struct tss_struct *tss); 25 struct tss_struct *tss);
26extern void show_regs_common(void);
26 27
27#ifdef CONFIG_X86_32 28#ifdef CONFIG_X86_32
28 29
diff --git a/arch/x86/include/asm/trampoline.h b/arch/x86/include/asm/trampoline.h
index 90f06c25221d..cb507bb05d79 100644
--- a/arch/x86/include/asm/trampoline.h
+++ b/arch/x86/include/asm/trampoline.h
@@ -16,7 +16,6 @@ extern unsigned long initial_code;
16extern unsigned long initial_gs; 16extern unsigned long initial_gs;
17 17
18#define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE) 18#define TRAMPOLINE_SIZE roundup(trampoline_end - trampoline_data, PAGE_SIZE)
19#define TRAMPOLINE_BASE 0x6000
20 19
21extern unsigned long setup_trampoline(void); 20extern unsigned long setup_trampoline(void);
22extern void __init reserve_trampoline_memory(void); 21extern void __init reserve_trampoline_memory(void);
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h
index d5b7e90c0edf..396ff4cc8ed4 100644
--- a/arch/x86/include/asm/xen/hypervisor.h
+++ b/arch/x86/include/asm/xen/hypervisor.h
@@ -37,31 +37,4 @@
37extern struct shared_info *HYPERVISOR_shared_info; 37extern struct shared_info *HYPERVISOR_shared_info;
38extern struct start_info *xen_start_info; 38extern struct start_info *xen_start_info;
39 39
40enum xen_domain_type {
41 XEN_NATIVE, /* running on bare hardware */
42 XEN_PV_DOMAIN, /* running in a PV domain */
43 XEN_HVM_DOMAIN, /* running in a Xen hvm domain */
44};
45
46#ifdef CONFIG_XEN
47extern enum xen_domain_type xen_domain_type;
48#else
49#define xen_domain_type XEN_NATIVE
50#endif
51
52#define xen_domain() (xen_domain_type != XEN_NATIVE)
53#define xen_pv_domain() (xen_domain() && \
54 xen_domain_type == XEN_PV_DOMAIN)
55#define xen_hvm_domain() (xen_domain() && \
56 xen_domain_type == XEN_HVM_DOMAIN)
57
58#ifdef CONFIG_XEN_DOM0
59#include <xen/interface/xen.h>
60
61#define xen_initial_domain() (xen_pv_domain() && \
62 xen_start_info->flags & SIF_INITDOMAIN)
63#else /* !CONFIG_XEN_DOM0 */
64#define xen_initial_domain() (0)
65#endif /* CONFIG_XEN_DOM0 */
66
67#endif /* _ASM_X86_XEN_HYPERVISOR_H */ 40#endif /* _ASM_X86_XEN_HYPERVISOR_H */
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 1c0fb4d4ad55..b990b5cc9541 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -166,6 +166,43 @@ static void iommu_uninit_device(struct device *dev)
166{ 166{
167 kfree(dev->archdata.iommu); 167 kfree(dev->archdata.iommu);
168} 168}
169
170void __init amd_iommu_uninit_devices(void)
171{
172 struct pci_dev *pdev = NULL;
173
174 for_each_pci_dev(pdev) {
175
176 if (!check_device(&pdev->dev))
177 continue;
178
179 iommu_uninit_device(&pdev->dev);
180 }
181}
182
183int __init amd_iommu_init_devices(void)
184{
185 struct pci_dev *pdev = NULL;
186 int ret = 0;
187
188 for_each_pci_dev(pdev) {
189
190 if (!check_device(&pdev->dev))
191 continue;
192
193 ret = iommu_init_device(&pdev->dev);
194 if (ret)
195 goto out_free;
196 }
197
198 return 0;
199
200out_free:
201
202 amd_iommu_uninit_devices();
203
204 return ret;
205}
169#ifdef CONFIG_AMD_IOMMU_STATS 206#ifdef CONFIG_AMD_IOMMU_STATS
170 207
171/* 208/*
@@ -1587,6 +1624,11 @@ static struct notifier_block device_nb = {
1587 .notifier_call = device_change_notifier, 1624 .notifier_call = device_change_notifier,
1588}; 1625};
1589 1626
1627void amd_iommu_init_notifier(void)
1628{
1629 bus_register_notifier(&pci_bus_type, &device_nb);
1630}
1631
1590/***************************************************************************** 1632/*****************************************************************************
1591 * 1633 *
1592 * The next functions belong to the dma_ops mapping/unmapping code. 1634 * The next functions belong to the dma_ops mapping/unmapping code.
@@ -2145,8 +2187,6 @@ static void prealloc_protection_domains(void)
2145 if (!check_device(&dev->dev)) 2187 if (!check_device(&dev->dev))
2146 continue; 2188 continue;
2147 2189
2148 iommu_init_device(&dev->dev);
2149
2150 /* Is there already any domain for it? */ 2190 /* Is there already any domain for it? */
2151 if (domain_for_device(&dev->dev)) 2191 if (domain_for_device(&dev->dev))
2152 continue; 2192 continue;
@@ -2215,8 +2255,6 @@ int __init amd_iommu_init_dma_ops(void)
2215 2255
2216 register_iommu(&amd_iommu_ops); 2256 register_iommu(&amd_iommu_ops);
2217 2257
2218 bus_register_notifier(&pci_bus_type, &device_nb);
2219
2220 amd_iommu_stats_init(); 2258 amd_iommu_stats_init();
2221 2259
2222 return 0; 2260 return 0;
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index 7ffc39965233..1dca9c34eaeb 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -1274,6 +1274,10 @@ static int __init amd_iommu_init(void)
1274 if (ret) 1274 if (ret)
1275 goto free; 1275 goto free;
1276 1276
1277 ret = amd_iommu_init_devices();
1278 if (ret)
1279 goto free;
1280
1277 if (iommu_pass_through) 1281 if (iommu_pass_through)
1278 ret = amd_iommu_init_passthrough(); 1282 ret = amd_iommu_init_passthrough();
1279 else 1283 else
@@ -1281,6 +1285,8 @@ static int __init amd_iommu_init(void)
1281 if (ret) 1285 if (ret)
1282 goto free; 1286 goto free;
1283 1287
1288 amd_iommu_init_notifier();
1289
1284 enable_iommus(); 1290 enable_iommus();
1285 1291
1286 if (iommu_pass_through) 1292 if (iommu_pass_through)
@@ -1296,6 +1302,9 @@ out:
1296 return ret; 1302 return ret;
1297 1303
1298free: 1304free:
1305
1306 amd_iommu_uninit_devices();
1307
1299 free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, 1308 free_pages((unsigned long)amd_iommu_pd_alloc_bitmap,
1300 get_order(MAX_DOMAIN_ID/8)); 1309 get_order(MAX_DOMAIN_ID/8));
1301 1310
@@ -1336,6 +1345,9 @@ void __init amd_iommu_detect(void)
1336 iommu_detected = 1; 1345 iommu_detected = 1;
1337 amd_iommu_detected = 1; 1346 amd_iommu_detected = 1;
1338 x86_init.iommu.iommu_init = amd_iommu_init; 1347 x86_init.iommu.iommu_init = amd_iommu_init;
1348
1349 /* Make sure ACS will be enabled */
1350 pci_request_acs();
1339 } 1351 }
1340} 1352}
1341 1353
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index e0dfb6856aa2..3704997e8b25 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -280,7 +280,8 @@ void __init early_gart_iommu_check(void)
280 * or BIOS forget to put that in reserved. 280 * or BIOS forget to put that in reserved.
281 * try to update e820 to make that region as reserved. 281 * try to update e820 to make that region as reserved.
282 */ 282 */
283 int i, fix, slot; 283 u32 agp_aper_base = 0, agp_aper_order = 0;
284 int i, fix, slot, valid_agp = 0;
284 u32 ctl; 285 u32 ctl;
285 u32 aper_size = 0, aper_order = 0, last_aper_order = 0; 286 u32 aper_size = 0, aper_order = 0, last_aper_order = 0;
286 u64 aper_base = 0, last_aper_base = 0; 287 u64 aper_base = 0, last_aper_base = 0;
@@ -290,6 +291,8 @@ void __init early_gart_iommu_check(void)
290 return; 291 return;
291 292
292 /* This is mostly duplicate of iommu_hole_init */ 293 /* This is mostly duplicate of iommu_hole_init */
294 agp_aper_base = search_agp_bridge(&agp_aper_order, &valid_agp);
295
293 fix = 0; 296 fix = 0;
294 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { 297 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
295 int bus; 298 int bus;
@@ -342,10 +345,10 @@ void __init early_gart_iommu_check(void)
342 } 345 }
343 } 346 }
344 347
345 if (!fix) 348 if (valid_agp)
346 return; 349 return;
347 350
348 /* different nodes have different setting, disable them all at first*/ 351 /* disable them all at first */
349 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { 352 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
350 int bus; 353 int bus;
351 int dev_base, dev_limit; 354 int dev_base, dev_limit;
@@ -458,8 +461,6 @@ out:
458 461
459 if (aper_alloc) { 462 if (aper_alloc) {
460 /* Got the aperture from the AGP bridge */ 463 /* Got the aperture from the AGP bridge */
461 } else if (!valid_agp) {
462 /* Do nothing */
463 } else if ((!no_iommu && max_pfn > MAX_DMA32_PFN) || 464 } else if ((!no_iommu && max_pfn > MAX_DMA32_PFN) ||
464 force_iommu || 465 force_iommu ||
465 valid_agp || 466 valid_agp ||
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index efb2b9cd132c..aa57c079c98f 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1341,7 +1341,7 @@ void enable_x2apic(void)
1341 1341
1342 rdmsr(MSR_IA32_APICBASE, msr, msr2); 1342 rdmsr(MSR_IA32_APICBASE, msr, msr2);
1343 if (!(msr & X2APIC_ENABLE)) { 1343 if (!(msr & X2APIC_ENABLE)) {
1344 pr_info("Enabling x2apic\n"); 1344 printk_once(KERN_INFO "Enabling x2apic\n");
1345 wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, 0); 1345 wrmsr(MSR_IA32_APICBASE, msr | X2APIC_ENABLE, 0);
1346 } 1346 }
1347} 1347}
diff --git a/arch/x86/kernel/apic/apic_noop.c b/arch/x86/kernel/apic/apic_noop.c
index d9acc3bee0f4..e31b9ffe25f5 100644
--- a/arch/x86/kernel/apic/apic_noop.c
+++ b/arch/x86/kernel/apic/apic_noop.c
@@ -127,7 +127,7 @@ static u32 noop_apic_read(u32 reg)
127 127
128static void noop_apic_write(u32 reg, u32 v) 128static void noop_apic_write(u32 reg, u32 v)
129{ 129{
130 WARN_ON_ONCE((cpu_has_apic || !disable_apic)); 130 WARN_ON_ONCE(cpu_has_apic && !disable_apic);
131} 131}
132 132
133struct apic apic_noop = { 133struct apic apic_noop = {
diff --git a/arch/x86/kernel/apic/es7000_32.c b/arch/x86/kernel/apic/es7000_32.c
index e85f8fb7f8e7..dd2b5f264643 100644
--- a/arch/x86/kernel/apic/es7000_32.c
+++ b/arch/x86/kernel/apic/es7000_32.c
@@ -27,6 +27,9 @@
27 * 27 *
28 * http://www.unisys.com 28 * http://www.unisys.com
29 */ 29 */
30
31#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
32
30#include <linux/notifier.h> 33#include <linux/notifier.h>
31#include <linux/spinlock.h> 34#include <linux/spinlock.h>
32#include <linux/cpumask.h> 35#include <linux/cpumask.h>
@@ -223,9 +226,9 @@ static int parse_unisys_oem(char *oemptr)
223 mip_addr = val; 226 mip_addr = val;
224 mip = (struct mip_reg *)val; 227 mip = (struct mip_reg *)val;
225 mip_reg = __va(mip); 228 mip_reg = __va(mip);
226 pr_debug("es7000_mipcfg: host_reg = 0x%lx \n", 229 pr_debug("host_reg = 0x%lx\n",
227 (unsigned long)host_reg); 230 (unsigned long)host_reg);
228 pr_debug("es7000_mipcfg: mip_reg = 0x%lx \n", 231 pr_debug("mip_reg = 0x%lx\n",
229 (unsigned long)mip_reg); 232 (unsigned long)mip_reg);
230 success++; 233 success++;
231 break; 234 break;
@@ -401,7 +404,7 @@ static void es7000_enable_apic_mode(void)
401 if (!es7000_plat) 404 if (!es7000_plat)
402 return; 405 return;
403 406
404 printk(KERN_INFO "ES7000: Enabling APIC mode.\n"); 407 pr_info("Enabling APIC mode.\n");
405 memset(&es7000_mip_reg, 0, sizeof(struct mip_reg)); 408 memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
406 es7000_mip_reg.off_0x00 = MIP_SW_APIC; 409 es7000_mip_reg.off_0x00 = MIP_SW_APIC;
407 es7000_mip_reg.off_0x38 = MIP_VALID; 410 es7000_mip_reg.off_0x38 = MIP_VALID;
@@ -514,8 +517,7 @@ static void es7000_setup_apic_routing(void)
514{ 517{
515 int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id()); 518 int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
516 519
517 printk(KERN_INFO 520 pr_info("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
518 "Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
519 (apic_version[apic] == 0x14) ? 521 (apic_version[apic] == 0x14) ?
520 "Physical Cluster" : "Logical Cluster", 522 "Physical Cluster" : "Logical Cluster",
521 nr_ioapics, cpumask_bits(es7000_target_cpus())[0]); 523 nr_ioapics, cpumask_bits(es7000_target_cpus())[0]);
diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index 6389432a9dbf..0159a69396cb 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -361,7 +361,7 @@ void stop_apic_nmi_watchdog(void *unused)
361 */ 361 */
362 362
363static DEFINE_PER_CPU(unsigned, last_irq_sum); 363static DEFINE_PER_CPU(unsigned, last_irq_sum);
364static DEFINE_PER_CPU(local_t, alert_counter); 364static DEFINE_PER_CPU(long, alert_counter);
365static DEFINE_PER_CPU(int, nmi_touch); 365static DEFINE_PER_CPU(int, nmi_touch);
366 366
367void touch_nmi_watchdog(void) 367void touch_nmi_watchdog(void)
@@ -438,8 +438,8 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
438 * Ayiee, looks like this CPU is stuck ... 438 * Ayiee, looks like this CPU is stuck ...
439 * wait a few IRQs (5 seconds) before doing the oops ... 439 * wait a few IRQs (5 seconds) before doing the oops ...
440 */ 440 */
441 local_inc(&__get_cpu_var(alert_counter)); 441 __this_cpu_inc(per_cpu_var(alert_counter));
442 if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz) 442 if (__this_cpu_read(per_cpu_var(alert_counter)) == 5 * nmi_hz)
443 /* 443 /*
444 * die_nmi will return ONLY if NOTIFY_STOP happens.. 444 * die_nmi will return ONLY if NOTIFY_STOP happens..
445 */ 445 */
@@ -447,7 +447,7 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
447 regs, panic_on_timeout); 447 regs, panic_on_timeout);
448 } else { 448 } else {
449 __get_cpu_var(last_irq_sum) = sum; 449 __get_cpu_var(last_irq_sum) = sum;
450 local_set(&__get_cpu_var(alert_counter), 0); 450 __this_cpu_write(per_cpu_var(alert_counter), 0);
451 } 451 }
452 452
453 /* see if the nmi watchdog went off */ 453 /* see if the nmi watchdog went off */
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/addon_cpuid_features.c
index c965e5212714..468489b57aae 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/addon_cpuid_features.c
@@ -74,6 +74,7 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
74 unsigned int eax, ebx, ecx, edx, sub_index; 74 unsigned int eax, ebx, ecx, edx, sub_index;
75 unsigned int ht_mask_width, core_plus_mask_width; 75 unsigned int ht_mask_width, core_plus_mask_width;
76 unsigned int core_select_mask, core_level_siblings; 76 unsigned int core_select_mask, core_level_siblings;
77 static bool printed;
77 78
78 if (c->cpuid_level < 0xb) 79 if (c->cpuid_level < 0xb)
79 return; 80 return;
@@ -127,12 +128,14 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
127 128
128 c->x86_max_cores = (core_level_siblings / smp_num_siblings); 129 c->x86_max_cores = (core_level_siblings / smp_num_siblings);
129 130
130 131 if (!printed) {
131 printk(KERN_INFO "CPU: Physical Processor ID: %d\n", 132 printk(KERN_INFO "CPU: Physical Processor ID: %d\n",
132 c->phys_proc_id); 133 c->phys_proc_id);
133 if (c->x86_max_cores > 1) 134 if (c->x86_max_cores > 1)
134 printk(KERN_INFO "CPU: Processor Core ID: %d\n", 135 printk(KERN_INFO "CPU: Processor Core ID: %d\n",
135 c->cpu_core_id); 136 c->cpu_core_id);
137 printed = 1;
138 }
136 return; 139 return;
137#endif 140#endif
138} 141}
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index 7128b3799cec..8dc3ea145c97 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -375,8 +375,6 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
375 node = nearby_node(apicid); 375 node = nearby_node(apicid);
376 } 376 }
377 numa_set_node(cpu, node); 377 numa_set_node(cpu, node);
378
379 printk(KERN_INFO "CPU %d/0x%x -> Node %d\n", cpu, apicid, node);
380#endif 378#endif
381} 379}
382 380
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index c1afa990a6c8..4868e4a951ee 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -427,6 +427,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
427#ifdef CONFIG_X86_HT 427#ifdef CONFIG_X86_HT
428 u32 eax, ebx, ecx, edx; 428 u32 eax, ebx, ecx, edx;
429 int index_msb, core_bits; 429 int index_msb, core_bits;
430 static bool printed;
430 431
431 if (!cpu_has(c, X86_FEATURE_HT)) 432 if (!cpu_has(c, X86_FEATURE_HT))
432 return; 433 return;
@@ -442,7 +443,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
442 smp_num_siblings = (ebx & 0xff0000) >> 16; 443 smp_num_siblings = (ebx & 0xff0000) >> 16;
443 444
444 if (smp_num_siblings == 1) { 445 if (smp_num_siblings == 1) {
445 printk(KERN_INFO "CPU: Hyper-Threading is disabled\n"); 446 printk_once(KERN_INFO "CPU0: Hyper-Threading is disabled\n");
446 goto out; 447 goto out;
447 } 448 }
448 449
@@ -469,11 +470,12 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
469 ((1 << core_bits) - 1); 470 ((1 << core_bits) - 1);
470 471
471out: 472out:
472 if ((c->x86_max_cores * smp_num_siblings) > 1) { 473 if (!printed && (c->x86_max_cores * smp_num_siblings) > 1) {
473 printk(KERN_INFO "CPU: Physical Processor ID: %d\n", 474 printk(KERN_INFO "CPU: Physical Processor ID: %d\n",
474 c->phys_proc_id); 475 c->phys_proc_id);
475 printk(KERN_INFO "CPU: Processor Core ID: %d\n", 476 printk(KERN_INFO "CPU: Processor Core ID: %d\n",
476 c->cpu_core_id); 477 c->cpu_core_id);
478 printed = 1;
477 } 479 }
478#endif 480#endif
479} 481}
@@ -1093,7 +1095,7 @@ static void clear_all_debug_regs(void)
1093 1095
1094void __cpuinit cpu_init(void) 1096void __cpuinit cpu_init(void)
1095{ 1097{
1096 struct orig_ist *orig_ist; 1098 struct orig_ist *oist;
1097 struct task_struct *me; 1099 struct task_struct *me;
1098 struct tss_struct *t; 1100 struct tss_struct *t;
1099 unsigned long v; 1101 unsigned long v;
@@ -1102,7 +1104,7 @@ void __cpuinit cpu_init(void)
1102 1104
1103 cpu = stack_smp_processor_id(); 1105 cpu = stack_smp_processor_id();
1104 t = &per_cpu(init_tss, cpu); 1106 t = &per_cpu(init_tss, cpu);
1105 orig_ist = &per_cpu(orig_ist, cpu); 1107 oist = &per_cpu(orig_ist, cpu);
1106 1108
1107#ifdef CONFIG_NUMA 1109#ifdef CONFIG_NUMA
1108 if (cpu != 0 && percpu_read(node_number) == 0 && 1110 if (cpu != 0 && percpu_read(node_number) == 0 &&
@@ -1115,7 +1117,7 @@ void __cpuinit cpu_init(void)
1115 if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) 1117 if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask))
1116 panic("CPU#%d already initialized!\n", cpu); 1118 panic("CPU#%d already initialized!\n", cpu);
1117 1119
1118 printk(KERN_INFO "Initializing CPU#%d\n", cpu); 1120 pr_debug("Initializing CPU#%d\n", cpu);
1119 1121
1120 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); 1122 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
1121 1123
@@ -1143,12 +1145,12 @@ void __cpuinit cpu_init(void)
1143 /* 1145 /*
1144 * set up and load the per-CPU TSS 1146 * set up and load the per-CPU TSS
1145 */ 1147 */
1146 if (!orig_ist->ist[0]) { 1148 if (!oist->ist[0]) {
1147 char *estacks = per_cpu(exception_stacks, cpu); 1149 char *estacks = per_cpu(exception_stacks, cpu);
1148 1150
1149 for (v = 0; v < N_EXCEPTION_STACKS; v++) { 1151 for (v = 0; v < N_EXCEPTION_STACKS; v++) {
1150 estacks += exception_stack_sizes[v]; 1152 estacks += exception_stack_sizes[v];
1151 orig_ist->ist[v] = t->x86_tss.ist[v] = 1153 oist->ist[v] = t->x86_tss.ist[v] =
1152 (unsigned long)estacks; 1154 (unsigned long)estacks;
1153 } 1155 }
1154 } 1156 }
diff --git a/arch/x86/kernel/cpu/cpu_debug.c b/arch/x86/kernel/cpu/cpu_debug.c
index dca325c03999..b368cd862997 100644
--- a/arch/x86/kernel/cpu/cpu_debug.c
+++ b/arch/x86/kernel/cpu/cpu_debug.c
@@ -30,9 +30,9 @@
30#include <asm/apic.h> 30#include <asm/apic.h>
31#include <asm/desc.h> 31#include <asm/desc.h>
32 32
33static DEFINE_PER_CPU(struct cpu_cpuX_base [CPU_REG_ALL_BIT], cpu_arr); 33static DEFINE_PER_CPU(struct cpu_cpuX_base [CPU_REG_ALL_BIT], cpud_arr);
34static DEFINE_PER_CPU(struct cpu_private * [MAX_CPU_FILES], priv_arr); 34static DEFINE_PER_CPU(struct cpu_private * [MAX_CPU_FILES], cpud_priv_arr);
35static DEFINE_PER_CPU(int, cpu_priv_count); 35static DEFINE_PER_CPU(int, cpud_priv_count);
36 36
37static DEFINE_MUTEX(cpu_debug_lock); 37static DEFINE_MUTEX(cpu_debug_lock);
38 38
@@ -531,7 +531,7 @@ static int cpu_create_file(unsigned cpu, unsigned type, unsigned reg,
531 531
532 /* Already intialized */ 532 /* Already intialized */
533 if (file == CPU_INDEX_BIT) 533 if (file == CPU_INDEX_BIT)
534 if (per_cpu(cpu_arr[type].init, cpu)) 534 if (per_cpu(cpud_arr[type].init, cpu))
535 return 0; 535 return 0;
536 536
537 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 537 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
@@ -543,8 +543,8 @@ static int cpu_create_file(unsigned cpu, unsigned type, unsigned reg,
543 priv->reg = reg; 543 priv->reg = reg;
544 priv->file = file; 544 priv->file = file;
545 mutex_lock(&cpu_debug_lock); 545 mutex_lock(&cpu_debug_lock);
546 per_cpu(priv_arr[type], cpu) = priv; 546 per_cpu(cpud_priv_arr[type], cpu) = priv;
547 per_cpu(cpu_priv_count, cpu)++; 547 per_cpu(cpud_priv_count, cpu)++;
548 mutex_unlock(&cpu_debug_lock); 548 mutex_unlock(&cpu_debug_lock);
549 549
550 if (file) 550 if (file)
@@ -552,10 +552,10 @@ static int cpu_create_file(unsigned cpu, unsigned type, unsigned reg,
552 dentry, (void *)priv, &cpu_fops); 552 dentry, (void *)priv, &cpu_fops);
553 else { 553 else {
554 debugfs_create_file(cpu_base[type].name, S_IRUGO, 554 debugfs_create_file(cpu_base[type].name, S_IRUGO,
555 per_cpu(cpu_arr[type].dentry, cpu), 555 per_cpu(cpud_arr[type].dentry, cpu),
556 (void *)priv, &cpu_fops); 556 (void *)priv, &cpu_fops);
557 mutex_lock(&cpu_debug_lock); 557 mutex_lock(&cpu_debug_lock);
558 per_cpu(cpu_arr[type].init, cpu) = 1; 558 per_cpu(cpud_arr[type].init, cpu) = 1;
559 mutex_unlock(&cpu_debug_lock); 559 mutex_unlock(&cpu_debug_lock);
560 } 560 }
561 561
@@ -615,7 +615,7 @@ static int cpu_init_allreg(unsigned cpu, struct dentry *dentry)
615 if (!is_typeflag_valid(cpu, cpu_base[type].flag)) 615 if (!is_typeflag_valid(cpu, cpu_base[type].flag))
616 continue; 616 continue;
617 cpu_dentry = debugfs_create_dir(cpu_base[type].name, dentry); 617 cpu_dentry = debugfs_create_dir(cpu_base[type].name, dentry);
618 per_cpu(cpu_arr[type].dentry, cpu) = cpu_dentry; 618 per_cpu(cpud_arr[type].dentry, cpu) = cpu_dentry;
619 619
620 if (type < CPU_TSS_BIT) 620 if (type < CPU_TSS_BIT)
621 err = cpu_init_msr(cpu, type, cpu_dentry); 621 err = cpu_init_msr(cpu, type, cpu_dentry);
@@ -647,11 +647,11 @@ static int cpu_init_cpu(void)
647 err = cpu_init_allreg(cpu, cpu_dentry); 647 err = cpu_init_allreg(cpu, cpu_dentry);
648 648
649 pr_info("cpu%d(%d) debug files %d\n", 649 pr_info("cpu%d(%d) debug files %d\n",
650 cpu, nr_cpu_ids, per_cpu(cpu_priv_count, cpu)); 650 cpu, nr_cpu_ids, per_cpu(cpud_priv_count, cpu));
651 if (per_cpu(cpu_priv_count, cpu) > MAX_CPU_FILES) { 651 if (per_cpu(cpud_priv_count, cpu) > MAX_CPU_FILES) {
652 pr_err("Register files count %d exceeds limit %d\n", 652 pr_err("Register files count %d exceeds limit %d\n",
653 per_cpu(cpu_priv_count, cpu), MAX_CPU_FILES); 653 per_cpu(cpud_priv_count, cpu), MAX_CPU_FILES);
654 per_cpu(cpu_priv_count, cpu) = MAX_CPU_FILES; 654 per_cpu(cpud_priv_count, cpu) = MAX_CPU_FILES;
655 err = -ENFILE; 655 err = -ENFILE;
656 } 656 }
657 if (err) 657 if (err)
@@ -676,8 +676,8 @@ static void __exit cpu_debug_exit(void)
676 debugfs_remove_recursive(cpu_debugfs_dir); 676 debugfs_remove_recursive(cpu_debugfs_dir);
677 677
678 for (cpu = 0; cpu < nr_cpu_ids; cpu++) 678 for (cpu = 0; cpu < nr_cpu_ids; cpu++)
679 for (i = 0; i < per_cpu(cpu_priv_count, cpu); i++) 679 for (i = 0; i < per_cpu(cpud_priv_count, cpu); i++)
680 kfree(per_cpu(priv_arr[i], cpu)); 680 kfree(per_cpu(cpud_priv_arr[i], cpu));
681} 681}
682 682
683module_init(cpu_debug_init); 683module_init(cpu_debug_init);
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 8b581d3905cb..f28decf8dde3 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -68,9 +68,9 @@ struct acpi_cpufreq_data {
68 unsigned int cpu_feature; 68 unsigned int cpu_feature;
69}; 69};
70 70
71static DEFINE_PER_CPU(struct acpi_cpufreq_data *, drv_data); 71static DEFINE_PER_CPU(struct acpi_cpufreq_data *, acfreq_data);
72 72
73static DEFINE_PER_CPU(struct aperfmperf, old_perf); 73static DEFINE_PER_CPU(struct aperfmperf, acfreq_old_perf);
74 74
75/* acpi_perf_data is a pointer to percpu data. */ 75/* acpi_perf_data is a pointer to percpu data. */
76static struct acpi_processor_performance *acpi_perf_data; 76static struct acpi_processor_performance *acpi_perf_data;
@@ -214,14 +214,14 @@ static u32 get_cur_val(const struct cpumask *mask)
214 if (unlikely(cpumask_empty(mask))) 214 if (unlikely(cpumask_empty(mask)))
215 return 0; 215 return 0;
216 216
217 switch (per_cpu(drv_data, cpumask_first(mask))->cpu_feature) { 217 switch (per_cpu(acfreq_data, cpumask_first(mask))->cpu_feature) {
218 case SYSTEM_INTEL_MSR_CAPABLE: 218 case SYSTEM_INTEL_MSR_CAPABLE:
219 cmd.type = SYSTEM_INTEL_MSR_CAPABLE; 219 cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
220 cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; 220 cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
221 break; 221 break;
222 case SYSTEM_IO_CAPABLE: 222 case SYSTEM_IO_CAPABLE:
223 cmd.type = SYSTEM_IO_CAPABLE; 223 cmd.type = SYSTEM_IO_CAPABLE;
224 perf = per_cpu(drv_data, cpumask_first(mask))->acpi_data; 224 perf = per_cpu(acfreq_data, cpumask_first(mask))->acpi_data;
225 cmd.addr.io.port = perf->control_register.address; 225 cmd.addr.io.port = perf->control_register.address;
226 cmd.addr.io.bit_width = perf->control_register.bit_width; 226 cmd.addr.io.bit_width = perf->control_register.bit_width;
227 break; 227 break;
@@ -268,8 +268,8 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,
268 if (smp_call_function_single(cpu, read_measured_perf_ctrs, &perf, 1)) 268 if (smp_call_function_single(cpu, read_measured_perf_ctrs, &perf, 1))
269 return 0; 269 return 0;
270 270
271 ratio = calc_aperfmperf_ratio(&per_cpu(old_perf, cpu), &perf); 271 ratio = calc_aperfmperf_ratio(&per_cpu(acfreq_old_perf, cpu), &perf);
272 per_cpu(old_perf, cpu) = perf; 272 per_cpu(acfreq_old_perf, cpu) = perf;
273 273
274 retval = (policy->cpuinfo.max_freq * ratio) >> APERFMPERF_SHIFT; 274 retval = (policy->cpuinfo.max_freq * ratio) >> APERFMPERF_SHIFT;
275 275
@@ -278,7 +278,7 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,
278 278
279static unsigned int get_cur_freq_on_cpu(unsigned int cpu) 279static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
280{ 280{
281 struct acpi_cpufreq_data *data = per_cpu(drv_data, cpu); 281 struct acpi_cpufreq_data *data = per_cpu(acfreq_data, cpu);
282 unsigned int freq; 282 unsigned int freq;
283 unsigned int cached_freq; 283 unsigned int cached_freq;
284 284
@@ -322,7 +322,7 @@ static unsigned int check_freqs(const struct cpumask *mask, unsigned int freq,
322static int acpi_cpufreq_target(struct cpufreq_policy *policy, 322static int acpi_cpufreq_target(struct cpufreq_policy *policy,
323 unsigned int target_freq, unsigned int relation) 323 unsigned int target_freq, unsigned int relation)
324{ 324{
325 struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 325 struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu);
326 struct acpi_processor_performance *perf; 326 struct acpi_processor_performance *perf;
327 struct cpufreq_freqs freqs; 327 struct cpufreq_freqs freqs;
328 struct drv_cmd cmd; 328 struct drv_cmd cmd;
@@ -416,7 +416,7 @@ out:
416 416
417static int acpi_cpufreq_verify(struct cpufreq_policy *policy) 417static int acpi_cpufreq_verify(struct cpufreq_policy *policy)
418{ 418{
419 struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 419 struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu);
420 420
421 dprintk("acpi_cpufreq_verify\n"); 421 dprintk("acpi_cpufreq_verify\n");
422 422
@@ -574,7 +574,7 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
574 return -ENOMEM; 574 return -ENOMEM;
575 575
576 data->acpi_data = per_cpu_ptr(acpi_perf_data, cpu); 576 data->acpi_data = per_cpu_ptr(acpi_perf_data, cpu);
577 per_cpu(drv_data, cpu) = data; 577 per_cpu(acfreq_data, cpu) = data;
578 578
579 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) 579 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC))
580 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; 580 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
@@ -725,20 +725,20 @@ err_unreg:
725 acpi_processor_unregister_performance(perf, cpu); 725 acpi_processor_unregister_performance(perf, cpu);
726err_free: 726err_free:
727 kfree(data); 727 kfree(data);
728 per_cpu(drv_data, cpu) = NULL; 728 per_cpu(acfreq_data, cpu) = NULL;
729 729
730 return result; 730 return result;
731} 731}
732 732
733static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy) 733static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
734{ 734{
735 struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 735 struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu);
736 736
737 dprintk("acpi_cpufreq_cpu_exit\n"); 737 dprintk("acpi_cpufreq_cpu_exit\n");
738 738
739 if (data) { 739 if (data) {
740 cpufreq_frequency_table_put_attr(policy->cpu); 740 cpufreq_frequency_table_put_attr(policy->cpu);
741 per_cpu(drv_data, policy->cpu) = NULL; 741 per_cpu(acfreq_data, policy->cpu) = NULL;
742 acpi_processor_unregister_performance(data->acpi_data, 742 acpi_processor_unregister_performance(data->acpi_data,
743 policy->cpu); 743 policy->cpu);
744 kfree(data); 744 kfree(data);
@@ -749,7 +749,7 @@ static int acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
749 749
750static int acpi_cpufreq_resume(struct cpufreq_policy *policy) 750static int acpi_cpufreq_resume(struct cpufreq_policy *policy)
751{ 751{
752 struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 752 struct acpi_cpufreq_data *data = per_cpu(acfreq_data, policy->cpu);
753 753
754 dprintk("acpi_cpufreq_resume\n"); 754 dprintk("acpi_cpufreq_resume\n");
755 755
@@ -764,14 +764,15 @@ static struct freq_attr *acpi_cpufreq_attr[] = {
764}; 764};
765 765
766static struct cpufreq_driver acpi_cpufreq_driver = { 766static struct cpufreq_driver acpi_cpufreq_driver = {
767 .verify = acpi_cpufreq_verify, 767 .verify = acpi_cpufreq_verify,
768 .target = acpi_cpufreq_target, 768 .target = acpi_cpufreq_target,
769 .init = acpi_cpufreq_cpu_init, 769 .bios_limit = acpi_processor_get_bios_limit,
770 .exit = acpi_cpufreq_cpu_exit, 770 .init = acpi_cpufreq_cpu_init,
771 .resume = acpi_cpufreq_resume, 771 .exit = acpi_cpufreq_cpu_exit,
772 .name = "acpi-cpufreq", 772 .resume = acpi_cpufreq_resume,
773 .owner = THIS_MODULE, 773 .name = "acpi-cpufreq",
774 .attr = acpi_cpufreq_attr, 774 .owner = THIS_MODULE,
775 .attr = acpi_cpufreq_attr,
775}; 776};
776 777
777static int __init acpi_cpufreq_init(void) 778static int __init acpi_cpufreq_init(void)
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
index f10dea409f40..cb01dac267d3 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k6.c
@@ -164,7 +164,7 @@ static int powernow_k6_cpu_init(struct cpufreq_policy *policy)
164 } 164 }
165 165
166 /* cpuinfo and default policy values */ 166 /* cpuinfo and default policy values */
167 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 167 policy->cpuinfo.transition_latency = 200000;
168 policy->cur = busfreq * max_multiplier; 168 policy->cur = busfreq * max_multiplier;
169 169
170 result = cpufreq_frequency_table_cpuinfo(policy, clock_ratio); 170 result = cpufreq_frequency_table_cpuinfo(policy, clock_ratio);
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
index d47c775eb0ab..9a97116f89e5 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
@@ -714,14 +714,17 @@ static struct freq_attr *powernow_table_attr[] = {
714}; 714};
715 715
716static struct cpufreq_driver powernow_driver = { 716static struct cpufreq_driver powernow_driver = {
717 .verify = powernow_verify, 717 .verify = powernow_verify,
718 .target = powernow_target, 718 .target = powernow_target,
719 .get = powernow_get, 719 .get = powernow_get,
720 .init = powernow_cpu_init, 720#ifdef CONFIG_X86_POWERNOW_K7_ACPI
721 .exit = powernow_cpu_exit, 721 .bios_limit = acpi_processor_get_bios_limit,
722 .name = "powernow-k7", 722#endif
723 .owner = THIS_MODULE, 723 .init = powernow_cpu_init,
724 .attr = powernow_table_attr, 724 .exit = powernow_cpu_exit,
725 .name = "powernow-k7",
726 .owner = THIS_MODULE,
727 .attr = powernow_table_attr,
725}; 728};
726 729
727static int __init powernow_init(void) 730static int __init powernow_init(void)
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 3f12dabeab52..a9df9441a9a2 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1118,7 +1118,7 @@ static int transition_frequency_pstate(struct powernow_k8_data *data,
1118static int powernowk8_target(struct cpufreq_policy *pol, 1118static int powernowk8_target(struct cpufreq_policy *pol,
1119 unsigned targfreq, unsigned relation) 1119 unsigned targfreq, unsigned relation)
1120{ 1120{
1121 cpumask_t oldmask; 1121 cpumask_var_t oldmask;
1122 struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu); 1122 struct powernow_k8_data *data = per_cpu(powernow_data, pol->cpu);
1123 u32 checkfid; 1123 u32 checkfid;
1124 u32 checkvid; 1124 u32 checkvid;
@@ -1131,9 +1131,13 @@ static int powernowk8_target(struct cpufreq_policy *pol,
1131 checkfid = data->currfid; 1131 checkfid = data->currfid;
1132 checkvid = data->currvid; 1132 checkvid = data->currvid;
1133 1133
1134 /* only run on specific CPU from here on */ 1134 /* only run on specific CPU from here on. */
1135 oldmask = current->cpus_allowed; 1135 /* This is poor form: use a workqueue or smp_call_function_single */
1136 set_cpus_allowed_ptr(current, &cpumask_of_cpu(pol->cpu)); 1136 if (!alloc_cpumask_var(&oldmask, GFP_KERNEL))
1137 return -ENOMEM;
1138
1139 cpumask_copy(oldmask, tsk_cpumask(current));
1140 set_cpus_allowed_ptr(current, cpumask_of(pol->cpu));
1137 1141
1138 if (smp_processor_id() != pol->cpu) { 1142 if (smp_processor_id() != pol->cpu) {
1139 printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu); 1143 printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
@@ -1193,7 +1197,8 @@ static int powernowk8_target(struct cpufreq_policy *pol,
1193 ret = 0; 1197 ret = 0;
1194 1198
1195err_out: 1199err_out:
1196 set_cpus_allowed_ptr(current, &oldmask); 1200 set_cpus_allowed_ptr(current, oldmask);
1201 free_cpumask_var(oldmask);
1197 return ret; 1202 return ret;
1198} 1203}
1199 1204
@@ -1393,14 +1398,15 @@ static struct freq_attr *powernow_k8_attr[] = {
1393}; 1398};
1394 1399
1395static struct cpufreq_driver cpufreq_amd64_driver = { 1400static struct cpufreq_driver cpufreq_amd64_driver = {
1396 .verify = powernowk8_verify, 1401 .verify = powernowk8_verify,
1397 .target = powernowk8_target, 1402 .target = powernowk8_target,
1398 .init = powernowk8_cpu_init, 1403 .bios_limit = acpi_processor_get_bios_limit,
1399 .exit = __devexit_p(powernowk8_cpu_exit), 1404 .init = powernowk8_cpu_init,
1400 .get = powernowk8_get, 1405 .exit = __devexit_p(powernowk8_cpu_exit),
1401 .name = "powernow-k8", 1406 .get = powernowk8_get,
1402 .owner = THIS_MODULE, 1407 .name = "powernow-k8",
1403 .attr = powernow_k8_attr, 1408 .owner = THIS_MODULE,
1409 .attr = powernow_k8_attr,
1404}; 1410};
1405 1411
1406/* driver entry point for init */ 1412/* driver entry point for init */
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
index 3ae5a7a3a500..2ce8e0b5cc54 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
@@ -39,7 +39,7 @@ static struct pci_dev *speedstep_chipset_dev;
39 39
40/* speedstep_processor 40/* speedstep_processor
41 */ 41 */
42static unsigned int speedstep_processor; 42static enum speedstep_processor speedstep_processor;
43 43
44static u32 pmbase; 44static u32 pmbase;
45 45
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
index f4c290b8482f..ad0083abfa23 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
@@ -34,7 +34,7 @@ static int relaxed_check;
34 * GET PROCESSOR CORE SPEED IN KHZ * 34 * GET PROCESSOR CORE SPEED IN KHZ *
35 *********************************************************************/ 35 *********************************************************************/
36 36
37static unsigned int pentium3_get_frequency(unsigned int processor) 37static unsigned int pentium3_get_frequency(enum speedstep_processor processor)
38{ 38{
39 /* See table 14 of p3_ds.pdf and table 22 of 29834003.pdf */ 39 /* See table 14 of p3_ds.pdf and table 22 of 29834003.pdf */
40 struct { 40 struct {
@@ -227,7 +227,7 @@ static unsigned int pentium4_get_frequency(void)
227 227
228 228
229/* Warning: may get called from smp_call_function_single. */ 229/* Warning: may get called from smp_call_function_single. */
230unsigned int speedstep_get_frequency(unsigned int processor) 230unsigned int speedstep_get_frequency(enum speedstep_processor processor)
231{ 231{
232 switch (processor) { 232 switch (processor) {
233 case SPEEDSTEP_CPU_PCORE: 233 case SPEEDSTEP_CPU_PCORE:
@@ -380,7 +380,7 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor);
380 * DETECT SPEEDSTEP SPEEDS * 380 * DETECT SPEEDSTEP SPEEDS *
381 *********************************************************************/ 381 *********************************************************************/
382 382
383unsigned int speedstep_get_freqs(unsigned int processor, 383unsigned int speedstep_get_freqs(enum speedstep_processor processor,
384 unsigned int *low_speed, 384 unsigned int *low_speed,
385 unsigned int *high_speed, 385 unsigned int *high_speed,
386 unsigned int *transition_latency, 386 unsigned int *transition_latency,
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.h b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.h
index 2b6c04e5a304..70d9cea1219d 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.h
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.h
@@ -11,18 +11,18 @@
11 11
12 12
13/* processors */ 13/* processors */
14 14enum speedstep_processor {
15#define SPEEDSTEP_CPU_PIII_C_EARLY 0x00000001 /* Coppermine core */ 15 SPEEDSTEP_CPU_PIII_C_EARLY = 0x00000001, /* Coppermine core */
16#define SPEEDSTEP_CPU_PIII_C 0x00000002 /* Coppermine core */ 16 SPEEDSTEP_CPU_PIII_C = 0x00000002, /* Coppermine core */
17#define SPEEDSTEP_CPU_PIII_T 0x00000003 /* Tualatin core */ 17 SPEEDSTEP_CPU_PIII_T = 0x00000003, /* Tualatin core */
18#define SPEEDSTEP_CPU_P4M 0x00000004 /* P4-M */ 18 SPEEDSTEP_CPU_P4M = 0x00000004, /* P4-M */
19
20/* the following processors are not speedstep-capable and are not auto-detected 19/* the following processors are not speedstep-capable and are not auto-detected
21 * in speedstep_detect_processor(). However, their speed can be detected using 20 * in speedstep_detect_processor(). However, their speed can be detected using
22 * the speedstep_get_frequency() call. */ 21 * the speedstep_get_frequency() call. */
23#define SPEEDSTEP_CPU_PM 0xFFFFFF03 /* Pentium M */ 22 SPEEDSTEP_CPU_PM = 0xFFFFFF03, /* Pentium M */
24#define SPEEDSTEP_CPU_P4D 0xFFFFFF04 /* desktop P4 */ 23 SPEEDSTEP_CPU_P4D = 0xFFFFFF04, /* desktop P4 */
25#define SPEEDSTEP_CPU_PCORE 0xFFFFFF05 /* Core */ 24 SPEEDSTEP_CPU_PCORE = 0xFFFFFF05, /* Core */
25};
26 26
27/* speedstep states -- only two of them */ 27/* speedstep states -- only two of them */
28 28
@@ -31,10 +31,10 @@
31 31
32 32
33/* detect a speedstep-capable processor */ 33/* detect a speedstep-capable processor */
34extern unsigned int speedstep_detect_processor (void); 34extern enum speedstep_processor speedstep_detect_processor(void);
35 35
36/* detect the current speed (in khz) of the processor */ 36/* detect the current speed (in khz) of the processor */
37extern unsigned int speedstep_get_frequency(unsigned int processor); 37extern unsigned int speedstep_get_frequency(enum speedstep_processor processor);
38 38
39 39
40/* detect the low and high speeds of the processor. The callback 40/* detect the low and high speeds of the processor. The callback
@@ -42,7 +42,7 @@ extern unsigned int speedstep_get_frequency(unsigned int processor);
42 * SPEEDSTEP_LOW; the second argument is zero so that no 42 * SPEEDSTEP_LOW; the second argument is zero so that no
43 * cpufreq_notify_transition calls are initiated. 43 * cpufreq_notify_transition calls are initiated.
44 */ 44 */
45extern unsigned int speedstep_get_freqs(unsigned int processor, 45extern unsigned int speedstep_get_freqs(enum speedstep_processor processor,
46 unsigned int *low_speed, 46 unsigned int *low_speed,
47 unsigned int *high_speed, 47 unsigned int *high_speed,
48 unsigned int *transition_latency, 48 unsigned int *transition_latency,
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
index befea088e4f5..04d73c114e49 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-smi.c
@@ -35,7 +35,7 @@ static int smi_cmd;
35static unsigned int smi_sig; 35static unsigned int smi_sig;
36 36
37/* info about the processor */ 37/* info about the processor */
38static unsigned int speedstep_processor; 38static enum speedstep_processor speedstep_processor;
39 39
40/* 40/*
41 * There are only two frequency states for each processor. Values 41 * There are only two frequency states for each processor. Values
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index c900b73f9224..9c31e8b09d2c 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -270,8 +270,6 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c)
270 node = cpu_to_node(cpu); 270 node = cpu_to_node(cpu);
271 } 271 }
272 numa_set_node(cpu, node); 272 numa_set_node(cpu, node);
273
274 printk(KERN_INFO "CPU %d/0x%x -> Node %d\n", cpu, apicid, node);
275#endif 273#endif
276} 274}
277 275
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 6c40f6b5b340..fc6c8ef92dcc 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -499,26 +499,27 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
499#ifdef CONFIG_SYSFS 499#ifdef CONFIG_SYSFS
500 500
501/* pointer to _cpuid4_info array (for each cache leaf) */ 501/* pointer to _cpuid4_info array (for each cache leaf) */
502static DEFINE_PER_CPU(struct _cpuid4_info *, cpuid4_info); 502static DEFINE_PER_CPU(struct _cpuid4_info *, ici_cpuid4_info);
503#define CPUID4_INFO_IDX(x, y) (&((per_cpu(cpuid4_info, x))[y])) 503#define CPUID4_INFO_IDX(x, y) (&((per_cpu(ici_cpuid4_info, x))[y]))
504 504
505#ifdef CONFIG_SMP 505#ifdef CONFIG_SMP
506static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index) 506static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
507{ 507{
508 struct _cpuid4_info *this_leaf, *sibling_leaf; 508 struct _cpuid4_info *this_leaf, *sibling_leaf;
509 unsigned long num_threads_sharing; 509 unsigned long num_threads_sharing;
510 int index_msb, i; 510 int index_msb, i, sibling;
511 struct cpuinfo_x86 *c = &cpu_data(cpu); 511 struct cpuinfo_x86 *c = &cpu_data(cpu);
512 512
513 if ((index == 3) && (c->x86_vendor == X86_VENDOR_AMD)) { 513 if ((index == 3) && (c->x86_vendor == X86_VENDOR_AMD)) {
514 struct cpuinfo_x86 *d; 514 for_each_cpu(i, c->llc_shared_map) {
515 for_each_online_cpu(i) { 515 if (!per_cpu(ici_cpuid4_info, i))
516 if (!per_cpu(cpuid4_info, i))
517 continue; 516 continue;
518 d = &cpu_data(i);
519 this_leaf = CPUID4_INFO_IDX(i, index); 517 this_leaf = CPUID4_INFO_IDX(i, index);
520 cpumask_copy(to_cpumask(this_leaf->shared_cpu_map), 518 for_each_cpu(sibling, c->llc_shared_map) {
521 d->llc_shared_map); 519 if (!cpu_online(sibling))
520 continue;
521 set_bit(sibling, this_leaf->shared_cpu_map);
522 }
522 } 523 }
523 return; 524 return;
524 } 525 }
@@ -535,7 +536,7 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
535 c->apicid >> index_msb) { 536 c->apicid >> index_msb) {
536 cpumask_set_cpu(i, 537 cpumask_set_cpu(i,
537 to_cpumask(this_leaf->shared_cpu_map)); 538 to_cpumask(this_leaf->shared_cpu_map));
538 if (i != cpu && per_cpu(cpuid4_info, i)) { 539 if (i != cpu && per_cpu(ici_cpuid4_info, i)) {
539 sibling_leaf = 540 sibling_leaf =
540 CPUID4_INFO_IDX(i, index); 541 CPUID4_INFO_IDX(i, index);
541 cpumask_set_cpu(cpu, to_cpumask( 542 cpumask_set_cpu(cpu, to_cpumask(
@@ -574,8 +575,8 @@ static void __cpuinit free_cache_attributes(unsigned int cpu)
574 for (i = 0; i < num_cache_leaves; i++) 575 for (i = 0; i < num_cache_leaves; i++)
575 cache_remove_shared_cpu_map(cpu, i); 576 cache_remove_shared_cpu_map(cpu, i);
576 577
577 kfree(per_cpu(cpuid4_info, cpu)); 578 kfree(per_cpu(ici_cpuid4_info, cpu));
578 per_cpu(cpuid4_info, cpu) = NULL; 579 per_cpu(ici_cpuid4_info, cpu) = NULL;
579} 580}
580 581
581static int 582static int
@@ -614,15 +615,15 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
614 if (num_cache_leaves == 0) 615 if (num_cache_leaves == 0)
615 return -ENOENT; 616 return -ENOENT;
616 617
617 per_cpu(cpuid4_info, cpu) = kzalloc( 618 per_cpu(ici_cpuid4_info, cpu) = kzalloc(
618 sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL); 619 sizeof(struct _cpuid4_info) * num_cache_leaves, GFP_KERNEL);
619 if (per_cpu(cpuid4_info, cpu) == NULL) 620 if (per_cpu(ici_cpuid4_info, cpu) == NULL)
620 return -ENOMEM; 621 return -ENOMEM;
621 622
622 smp_call_function_single(cpu, get_cpu_leaves, &retval, true); 623 smp_call_function_single(cpu, get_cpu_leaves, &retval, true);
623 if (retval) { 624 if (retval) {
624 kfree(per_cpu(cpuid4_info, cpu)); 625 kfree(per_cpu(ici_cpuid4_info, cpu));
625 per_cpu(cpuid4_info, cpu) = NULL; 626 per_cpu(ici_cpuid4_info, cpu) = NULL;
626 } 627 }
627 628
628 return retval; 629 return retval;
@@ -634,7 +635,7 @@ static int __cpuinit detect_cache_attributes(unsigned int cpu)
634extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */ 635extern struct sysdev_class cpu_sysdev_class; /* from drivers/base/cpu.c */
635 636
636/* pointer to kobject for cpuX/cache */ 637/* pointer to kobject for cpuX/cache */
637static DEFINE_PER_CPU(struct kobject *, cache_kobject); 638static DEFINE_PER_CPU(struct kobject *, ici_cache_kobject);
638 639
639struct _index_kobject { 640struct _index_kobject {
640 struct kobject kobj; 641 struct kobject kobj;
@@ -643,8 +644,8 @@ struct _index_kobject {
643}; 644};
644 645
645/* pointer to array of kobjects for cpuX/cache/indexY */ 646/* pointer to array of kobjects for cpuX/cache/indexY */
646static DEFINE_PER_CPU(struct _index_kobject *, index_kobject); 647static DEFINE_PER_CPU(struct _index_kobject *, ici_index_kobject);
647#define INDEX_KOBJECT_PTR(x, y) (&((per_cpu(index_kobject, x))[y])) 648#define INDEX_KOBJECT_PTR(x, y) (&((per_cpu(ici_index_kobject, x))[y]))
648 649
649#define show_one_plus(file_name, object, val) \ 650#define show_one_plus(file_name, object, val) \
650static ssize_t show_##file_name \ 651static ssize_t show_##file_name \
@@ -863,10 +864,10 @@ static struct kobj_type ktype_percpu_entry = {
863 864
864static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu) 865static void __cpuinit cpuid4_cache_sysfs_exit(unsigned int cpu)
865{ 866{
866 kfree(per_cpu(cache_kobject, cpu)); 867 kfree(per_cpu(ici_cache_kobject, cpu));
867 kfree(per_cpu(index_kobject, cpu)); 868 kfree(per_cpu(ici_index_kobject, cpu));
868 per_cpu(cache_kobject, cpu) = NULL; 869 per_cpu(ici_cache_kobject, cpu) = NULL;
869 per_cpu(index_kobject, cpu) = NULL; 870 per_cpu(ici_index_kobject, cpu) = NULL;
870 free_cache_attributes(cpu); 871 free_cache_attributes(cpu);
871} 872}
872 873
@@ -882,14 +883,14 @@ static int __cpuinit cpuid4_cache_sysfs_init(unsigned int cpu)
882 return err; 883 return err;
883 884
884 /* Allocate all required memory */ 885 /* Allocate all required memory */
885 per_cpu(cache_kobject, cpu) = 886 per_cpu(ici_cache_kobject, cpu) =
886 kzalloc(sizeof(struct kobject), GFP_KERNEL); 887 kzalloc(sizeof(struct kobject), GFP_KERNEL);
887 if (unlikely(per_cpu(cache_kobject, cpu) == NULL)) 888 if (unlikely(per_cpu(ici_cache_kobject, cpu) == NULL))
888 goto err_out; 889 goto err_out;
889 890
890 per_cpu(index_kobject, cpu) = kzalloc( 891 per_cpu(ici_index_kobject, cpu) = kzalloc(
891 sizeof(struct _index_kobject) * num_cache_leaves, GFP_KERNEL); 892 sizeof(struct _index_kobject) * num_cache_leaves, GFP_KERNEL);
892 if (unlikely(per_cpu(index_kobject, cpu) == NULL)) 893 if (unlikely(per_cpu(ici_index_kobject, cpu) == NULL))
893 goto err_out; 894 goto err_out;
894 895
895 return 0; 896 return 0;
@@ -913,7 +914,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
913 if (unlikely(retval < 0)) 914 if (unlikely(retval < 0))
914 return retval; 915 return retval;
915 916
916 retval = kobject_init_and_add(per_cpu(cache_kobject, cpu), 917 retval = kobject_init_and_add(per_cpu(ici_cache_kobject, cpu),
917 &ktype_percpu_entry, 918 &ktype_percpu_entry,
918 &sys_dev->kobj, "%s", "cache"); 919 &sys_dev->kobj, "%s", "cache");
919 if (retval < 0) { 920 if (retval < 0) {
@@ -927,12 +928,12 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
927 this_object->index = i; 928 this_object->index = i;
928 retval = kobject_init_and_add(&(this_object->kobj), 929 retval = kobject_init_and_add(&(this_object->kobj),
929 &ktype_cache, 930 &ktype_cache,
930 per_cpu(cache_kobject, cpu), 931 per_cpu(ici_cache_kobject, cpu),
931 "index%1lu", i); 932 "index%1lu", i);
932 if (unlikely(retval)) { 933 if (unlikely(retval)) {
933 for (j = 0; j < i; j++) 934 for (j = 0; j < i; j++)
934 kobject_put(&(INDEX_KOBJECT_PTR(cpu, j)->kobj)); 935 kobject_put(&(INDEX_KOBJECT_PTR(cpu, j)->kobj));
935 kobject_put(per_cpu(cache_kobject, cpu)); 936 kobject_put(per_cpu(ici_cache_kobject, cpu));
936 cpuid4_cache_sysfs_exit(cpu); 937 cpuid4_cache_sysfs_exit(cpu);
937 return retval; 938 return retval;
938 } 939 }
@@ -940,7 +941,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
940 } 941 }
941 cpumask_set_cpu(cpu, to_cpumask(cache_dev_map)); 942 cpumask_set_cpu(cpu, to_cpumask(cache_dev_map));
942 943
943 kobject_uevent(per_cpu(cache_kobject, cpu), KOBJ_ADD); 944 kobject_uevent(per_cpu(ici_cache_kobject, cpu), KOBJ_ADD);
944 return 0; 945 return 0;
945} 946}
946 947
@@ -949,7 +950,7 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
949 unsigned int cpu = sys_dev->id; 950 unsigned int cpu = sys_dev->id;
950 unsigned long i; 951 unsigned long i;
951 952
952 if (per_cpu(cpuid4_info, cpu) == NULL) 953 if (per_cpu(ici_cpuid4_info, cpu) == NULL)
953 return; 954 return;
954 if (!cpumask_test_cpu(cpu, to_cpumask(cache_dev_map))) 955 if (!cpumask_test_cpu(cpu, to_cpumask(cache_dev_map)))
955 return; 956 return;
@@ -957,7 +958,7 @@ static void __cpuinit cache_remove_dev(struct sys_device * sys_dev)
957 958
958 for (i = 0; i < num_cache_leaves; i++) 959 for (i = 0; i < num_cache_leaves; i++)
959 kobject_put(&(INDEX_KOBJECT_PTR(cpu, i)->kobj)); 960 kobject_put(&(INDEX_KOBJECT_PTR(cpu, i)->kobj));
960 kobject_put(per_cpu(cache_kobject, cpu)); 961 kobject_put(per_cpu(ici_cache_kobject, cpu));
961 cpuid4_cache_sysfs_exit(cpu); 962 cpuid4_cache_sysfs_exit(cpu);
962} 963}
963 964
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index d7ebf25d10ed..a8aacd4b513c 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -1388,13 +1388,14 @@ static void __mcheck_cpu_init_timer(void)
1388 struct timer_list *t = &__get_cpu_var(mce_timer); 1388 struct timer_list *t = &__get_cpu_var(mce_timer);
1389 int *n = &__get_cpu_var(mce_next_interval); 1389 int *n = &__get_cpu_var(mce_next_interval);
1390 1390
1391 setup_timer(t, mce_start_timer, smp_processor_id());
1392
1391 if (mce_ignore_ce) 1393 if (mce_ignore_ce)
1392 return; 1394 return;
1393 1395
1394 *n = check_interval * HZ; 1396 *n = check_interval * HZ;
1395 if (!*n) 1397 if (!*n)
1396 return; 1398 return;
1397 setup_timer(t, mce_start_timer, smp_processor_id());
1398 t->expires = round_jiffies(jiffies + *n); 1399 t->expires = round_jiffies(jiffies + *n);
1399 add_timer_on(t, smp_processor_id()); 1400 add_timer_on(t, smp_processor_id());
1400} 1401}
@@ -1928,7 +1929,7 @@ error2:
1928 sysdev_remove_file(&per_cpu(mce_dev, cpu), &mce_banks[j].attr); 1929 sysdev_remove_file(&per_cpu(mce_dev, cpu), &mce_banks[j].attr);
1929error: 1930error:
1930 while (--i >= 0) 1931 while (--i >= 0)
1931 sysdev_remove_file(&per_cpu(mce_dev, cpu), &mce_banks[i].attr); 1932 sysdev_remove_file(&per_cpu(mce_dev, cpu), mce_attrs[i]);
1932 1933
1933 sysdev_unregister(&per_cpu(mce_dev, cpu)); 1934 sysdev_unregister(&per_cpu(mce_dev, cpu));
1934 1935
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index 4fef985fc221..81c499eceb21 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -256,6 +256,16 @@ asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
256 ack_APIC_irq(); 256 ack_APIC_irq();
257} 257}
258 258
259/* Thermal monitoring depends on APIC, ACPI and clock modulation */
260static int intel_thermal_supported(struct cpuinfo_x86 *c)
261{
262 if (!cpu_has_apic)
263 return 0;
264 if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC))
265 return 0;
266 return 1;
267}
268
259void __init mcheck_intel_therm_init(void) 269void __init mcheck_intel_therm_init(void)
260{ 270{
261 /* 271 /*
@@ -263,8 +273,7 @@ void __init mcheck_intel_therm_init(void)
263 * LVT value on BSP and use that value to restore APs' thermal LVT 273 * LVT value on BSP and use that value to restore APs' thermal LVT
264 * entry BIOS programmed later 274 * entry BIOS programmed later
265 */ 275 */
266 if (cpu_has(&boot_cpu_data, X86_FEATURE_ACPI) && 276 if (intel_thermal_supported(&boot_cpu_data))
267 cpu_has(&boot_cpu_data, X86_FEATURE_ACC))
268 lvtthmr_init = apic_read(APIC_LVTTHMR); 277 lvtthmr_init = apic_read(APIC_LVTTHMR);
269} 278}
270 279
@@ -274,8 +283,7 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
274 int tm2 = 0; 283 int tm2 = 0;
275 u32 l, h; 284 u32 l, h;
276 285
277 /* Thermal monitoring depends on ACPI and clock modulation*/ 286 if (!intel_thermal_supported(c))
278 if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC))
279 return; 287 return;
280 288
281 /* 289 /*
@@ -339,8 +347,8 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
339 l = apic_read(APIC_LVTTHMR); 347 l = apic_read(APIC_LVTTHMR);
340 apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); 348 apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
341 349
342 printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n", 350 printk_once(KERN_INFO "CPU0: Thermal monitoring enabled (%s)\n",
343 cpu, tm2 ? "TM2" : "TM1"); 351 tm2 ? "TM2" : "TM1");
344 352
345 /* enable thermal throttle processing */ 353 /* enable thermal throttle processing */
346 atomic_set(&therm_throt_en, 1); 354 atomic_set(&therm_throt_en, 1);
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index ab1a8a89b984..45506d5dd8df 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1632,6 +1632,7 @@ static void intel_pmu_drain_bts_buffer(struct cpu_hw_events *cpuc)
1632 1632
1633 data.period = event->hw.last_period; 1633 data.period = event->hw.last_period;
1634 data.addr = 0; 1634 data.addr = 0;
1635 data.raw = NULL;
1635 regs.ip = 0; 1636 regs.ip = 0;
1636 1637
1637 /* 1638 /*
@@ -1749,6 +1750,7 @@ static int p6_pmu_handle_irq(struct pt_regs *regs)
1749 u64 val; 1750 u64 val;
1750 1751
1751 data.addr = 0; 1752 data.addr = 0;
1753 data.raw = NULL;
1752 1754
1753 cpuc = &__get_cpu_var(cpu_hw_events); 1755 cpuc = &__get_cpu_var(cpu_hw_events);
1754 1756
@@ -1794,6 +1796,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
1794 u64 ack, status; 1796 u64 ack, status;
1795 1797
1796 data.addr = 0; 1798 data.addr = 0;
1799 data.raw = NULL;
1797 1800
1798 cpuc = &__get_cpu_var(cpu_hw_events); 1801 cpuc = &__get_cpu_var(cpu_hw_events);
1799 1802
@@ -1857,6 +1860,7 @@ static int amd_pmu_handle_irq(struct pt_regs *regs)
1857 u64 val; 1860 u64 val;
1858 1861
1859 data.addr = 0; 1862 data.addr = 0;
1863 data.raw = NULL;
1860 1864
1861 cpuc = &__get_cpu_var(cpu_hw_events); 1865 cpuc = &__get_cpu_var(cpu_hw_events);
1862 1866
@@ -2062,12 +2066,6 @@ static __init int p6_pmu_init(void)
2062 2066
2063 x86_pmu = p6_pmu; 2067 x86_pmu = p6_pmu;
2064 2068
2065 if (!cpu_has_apic) {
2066 pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
2067 pr_info("no hardware sampling interrupt available.\n");
2068 x86_pmu.apic = 0;
2069 }
2070
2071 return 0; 2069 return 0;
2072} 2070}
2073 2071
@@ -2159,6 +2157,16 @@ static __init int amd_pmu_init(void)
2159 return 0; 2157 return 0;
2160} 2158}
2161 2159
2160static void __init pmu_check_apic(void)
2161{
2162 if (cpu_has_apic)
2163 return;
2164
2165 x86_pmu.apic = 0;
2166 pr_info("no APIC, boot with the \"lapic\" boot parameter to force-enable it.\n");
2167 pr_info("no hardware sampling interrupt available.\n");
2168}
2169
2162void __init init_hw_perf_events(void) 2170void __init init_hw_perf_events(void)
2163{ 2171{
2164 int err; 2172 int err;
@@ -2180,6 +2188,8 @@ void __init init_hw_perf_events(void)
2180 return; 2188 return;
2181 } 2189 }
2182 2190
2191 pmu_check_apic();
2192
2183 pr_cont("%s PMU driver.\n", x86_pmu.name); 2193 pr_cont("%s PMU driver.\n", x86_pmu.name);
2184 2194
2185 if (x86_pmu.num_events > X86_PMC_MAX_GENERIC) { 2195 if (x86_pmu.num_events > X86_PMC_MAX_GENERIC) {
@@ -2287,7 +2297,7 @@ void callchain_store(struct perf_callchain_entry *entry, u64 ip)
2287 2297
2288static DEFINE_PER_CPU(struct perf_callchain_entry, pmc_irq_entry); 2298static DEFINE_PER_CPU(struct perf_callchain_entry, pmc_irq_entry);
2289static DEFINE_PER_CPU(struct perf_callchain_entry, pmc_nmi_entry); 2299static DEFINE_PER_CPU(struct perf_callchain_entry, pmc_nmi_entry);
2290static DEFINE_PER_CPU(int, in_nmi_frame); 2300static DEFINE_PER_CPU(int, in_ignored_frame);
2291 2301
2292 2302
2293static void 2303static void
@@ -2303,8 +2313,9 @@ static void backtrace_warning(void *data, char *msg)
2303 2313
2304static int backtrace_stack(void *data, char *name) 2314static int backtrace_stack(void *data, char *name)
2305{ 2315{
2306 per_cpu(in_nmi_frame, smp_processor_id()) = 2316 per_cpu(in_ignored_frame, smp_processor_id()) =
2307 x86_is_stack_id(NMI_STACK, name); 2317 x86_is_stack_id(NMI_STACK, name) ||
2318 x86_is_stack_id(DEBUG_STACK, name);
2308 2319
2309 return 0; 2320 return 0;
2310} 2321}
@@ -2313,7 +2324,7 @@ static void backtrace_address(void *data, unsigned long addr, int reliable)
2313{ 2324{
2314 struct perf_callchain_entry *entry = data; 2325 struct perf_callchain_entry *entry = data;
2315 2326
2316 if (per_cpu(in_nmi_frame, smp_processor_id())) 2327 if (per_cpu(in_ignored_frame, smp_processor_id()))
2317 return; 2328 return;
2318 2329
2319 if (reliable) 2330 if (reliable)
diff --git a/arch/x86/kernel/ds.c b/arch/x86/kernel/ds.c
index ef42a038f1a6..1c47390dd0e5 100644
--- a/arch/x86/kernel/ds.c
+++ b/arch/x86/kernel/ds.c
@@ -265,13 +265,13 @@ struct ds_context {
265 int cpu; 265 int cpu;
266}; 266};
267 267
268static DEFINE_PER_CPU(struct ds_context *, cpu_context); 268static DEFINE_PER_CPU(struct ds_context *, cpu_ds_context);
269 269
270 270
271static struct ds_context *ds_get_context(struct task_struct *task, int cpu) 271static struct ds_context *ds_get_context(struct task_struct *task, int cpu)
272{ 272{
273 struct ds_context **p_context = 273 struct ds_context **p_context =
274 (task ? &task->thread.ds_ctx : &per_cpu(cpu_context, cpu)); 274 (task ? &task->thread.ds_ctx : &per_cpu(cpu_ds_context, cpu));
275 struct ds_context *context = NULL; 275 struct ds_context *context = NULL;
276 struct ds_context *new_context = NULL; 276 struct ds_context *new_context = NULL;
277 277
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 8e740934bd1f..b13af53883aa 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -103,6 +103,35 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
103 return NULL; 103 return NULL;
104} 104}
105 105
106static inline int
107in_irq_stack(unsigned long *stack, unsigned long *irq_stack,
108 unsigned long *irq_stack_end)
109{
110 return (stack >= irq_stack && stack < irq_stack_end);
111}
112
113/*
114 * We are returning from the irq stack and go to the previous one.
115 * If the previous stack is also in the irq stack, then bp in the first
116 * frame of the irq stack points to the previous, interrupted one.
117 * Otherwise we have another level of indirection: We first save
118 * the bp of the previous stack, then we switch the stack to the irq one
119 * and save a new bp that links to the previous one.
120 * (See save_args())
121 */
122static inline unsigned long
123fixup_bp_irq_link(unsigned long bp, unsigned long *stack,
124 unsigned long *irq_stack, unsigned long *irq_stack_end)
125{
126#ifdef CONFIG_FRAME_POINTER
127 struct stack_frame *frame = (struct stack_frame *)bp;
128
129 if (!in_irq_stack(stack, irq_stack, irq_stack_end))
130 return (unsigned long)frame->next_frame;
131#endif
132 return bp;
133}
134
106/* 135/*
107 * x86-64 can have up to three kernel stacks: 136 * x86-64 can have up to three kernel stacks:
108 * process stack 137 * process stack
@@ -175,7 +204,7 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
175 irq_stack = irq_stack_end - 204 irq_stack = irq_stack_end -
176 (IRQ_STACK_SIZE - 64) / sizeof(*irq_stack); 205 (IRQ_STACK_SIZE - 64) / sizeof(*irq_stack);
177 206
178 if (stack >= irq_stack && stack < irq_stack_end) { 207 if (in_irq_stack(stack, irq_stack, irq_stack_end)) {
179 if (ops->stack(data, "IRQ") < 0) 208 if (ops->stack(data, "IRQ") < 0)
180 break; 209 break;
181 bp = print_context_stack(tinfo, stack, bp, 210 bp = print_context_stack(tinfo, stack, bp,
@@ -186,6 +215,8 @@ void dump_trace(struct task_struct *task, struct pt_regs *regs,
186 * pointer (index -1 to end) in the IRQ stack: 215 * pointer (index -1 to end) in the IRQ stack:
187 */ 216 */
188 stack = (unsigned long *) (irq_stack_end[-1]); 217 stack = (unsigned long *) (irq_stack_end[-1]);
218 bp = fixup_bp_irq_link(bp, stack, irq_stack,
219 irq_stack_end);
189 irq_stack_end = NULL; 220 irq_stack_end = NULL;
190 ops->stack(data, "EOI"); 221 ops->stack(data, "EOI");
191 continue; 222 continue;
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index d17d482a04f4..f50447d961c0 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -732,7 +732,16 @@ struct early_res {
732 char overlap_ok; 732 char overlap_ok;
733}; 733};
734static struct early_res early_res[MAX_EARLY_RES] __initdata = { 734static struct early_res early_res[MAX_EARLY_RES] __initdata = {
735 { 0, PAGE_SIZE, "BIOS data page" }, /* BIOS data page */ 735 { 0, PAGE_SIZE, "BIOS data page", 1 }, /* BIOS data page */
736#ifdef CONFIG_X86_32
737 /*
738 * But first pinch a few for the stack/trampoline stuff
739 * FIXME: Don't need the extra page at 4K, but need to fix
740 * trampoline before removing it. (see the GDT stuff)
741 */
742 { PAGE_SIZE, PAGE_SIZE, "EX TRAMPOLINE", 1 },
743#endif
744
736 {} 745 {}
737}; 746};
738 747
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 63bca794c8f9..673f693fb451 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1076,10 +1076,10 @@ ENTRY(\sym)
1076 TRACE_IRQS_OFF 1076 TRACE_IRQS_OFF
1077 movq %rsp,%rdi /* pt_regs pointer */ 1077 movq %rsp,%rdi /* pt_regs pointer */
1078 xorl %esi,%esi /* no error code */ 1078 xorl %esi,%esi /* no error code */
1079 PER_CPU(init_tss, %rbp) 1079 PER_CPU(init_tss, %r12)
1080 subq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp) 1080 subq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%r12)
1081 call \do_sym 1081 call \do_sym
1082 addq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%rbp) 1082 addq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%r12)
1083 jmp paranoid_exit /* %ebx: no swapgs flag */ 1083 jmp paranoid_exit /* %ebx: no swapgs flag */
1084 CFI_ENDPROC 1084 CFI_ENDPROC
1085END(\sym) 1085END(\sym)
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 4f8e2507e8f3..5051b94c9069 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -29,8 +29,6 @@ static void __init i386_default_early_setup(void)
29 29
30void __init i386_start_kernel(void) 30void __init i386_start_kernel(void)
31{ 31{
32 reserve_trampoline_memory();
33
34 reserve_early(__pa_symbol(&_text), __pa_symbol(&__bss_stop), "TEXT DATA BSS"); 32 reserve_early(__pa_symbol(&_text), __pa_symbol(&__bss_stop), "TEXT DATA BSS");
35 33
36#ifdef CONFIG_BLK_DEV_INITRD 34#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 0b06cd778fd9..b5a9896ca1e7 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -98,8 +98,6 @@ void __init x86_64_start_reservations(char *real_mode_data)
98{ 98{
99 copy_bootdata(__va(real_mode_data)); 99 copy_bootdata(__va(real_mode_data));
100 100
101 reserve_trampoline_memory();
102
103 reserve_early(__pa_symbol(&_text), __pa_symbol(&__bss_stop), "TEXT DATA BSS"); 101 reserve_early(__pa_symbol(&_text), __pa_symbol(&__bss_stop), "TEXT DATA BSS");
104 102
105#ifdef CONFIG_BLK_DEV_INITRD 103#ifdef CONFIG_BLK_DEV_INITRD
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index d42f65ac4927..05d5fec64a94 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -362,8 +362,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp,
362 return ret; 362 return ret;
363 } 363 }
364 364
365 if (bp->callback) 365 ret = arch_store_info(bp);
366 ret = arch_store_info(bp);
367 366
368 if (ret < 0) 367 if (ret < 0)
369 return ret; 368 return ret;
@@ -519,7 +518,7 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
519 break; 518 break;
520 } 519 }
521 520
522 (bp->callback)(bp, args->regs); 521 perf_bp_event(bp, args->regs);
523 522
524 rcu_read_unlock(); 523 rcu_read_unlock();
525 } 524 }
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 20a5b3689463..dd74fe7273b1 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -86,9 +86,15 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
86 gdb_regs[GDB_DS] = regs->ds; 86 gdb_regs[GDB_DS] = regs->ds;
87 gdb_regs[GDB_ES] = regs->es; 87 gdb_regs[GDB_ES] = regs->es;
88 gdb_regs[GDB_CS] = regs->cs; 88 gdb_regs[GDB_CS] = regs->cs;
89 gdb_regs[GDB_SS] = __KERNEL_DS;
90 gdb_regs[GDB_FS] = 0xFFFF; 89 gdb_regs[GDB_FS] = 0xFFFF;
91 gdb_regs[GDB_GS] = 0xFFFF; 90 gdb_regs[GDB_GS] = 0xFFFF;
91 if (user_mode_vm(regs)) {
92 gdb_regs[GDB_SS] = regs->ss;
93 gdb_regs[GDB_SP] = regs->sp;
94 } else {
95 gdb_regs[GDB_SS] = __KERNEL_DS;
96 gdb_regs[GDB_SP] = kernel_stack_pointer(regs);
97 }
92#else 98#else
93 gdb_regs[GDB_R8] = regs->r8; 99 gdb_regs[GDB_R8] = regs->r8;
94 gdb_regs[GDB_R9] = regs->r9; 100 gdb_regs[GDB_R9] = regs->r9;
@@ -101,8 +107,8 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
101 gdb_regs32[GDB_PS] = regs->flags; 107 gdb_regs32[GDB_PS] = regs->flags;
102 gdb_regs32[GDB_CS] = regs->cs; 108 gdb_regs32[GDB_CS] = regs->cs;
103 gdb_regs32[GDB_SS] = regs->ss; 109 gdb_regs32[GDB_SS] = regs->ss;
104#endif
105 gdb_regs[GDB_SP] = kernel_stack_pointer(regs); 110 gdb_regs[GDB_SP] = kernel_stack_pointer(regs);
111#endif
106} 112}
107 113
108/** 114/**
@@ -220,8 +226,7 @@ static void kgdb_correct_hw_break(void)
220 dr7 |= ((breakinfo[breakno].len << 2) | 226 dr7 |= ((breakinfo[breakno].len << 2) |
221 breakinfo[breakno].type) << 227 breakinfo[breakno].type) <<
222 ((breakno << 2) + 16); 228 ((breakno << 2) + 16);
223 if (breakno >= 0 && breakno <= 3) 229 set_debugreg(breakinfo[breakno].addr, breakno);
224 set_debugreg(breakinfo[breakno].addr, breakno);
225 230
226 } else { 231 } else {
227 if ((dr7 & breakbit) && !breakinfo[breakno].enabled) { 232 if ((dr7 & breakbit) && !breakinfo[breakno].enabled) {
@@ -395,7 +400,6 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
395 /* set the trace bit if we're stepping */ 400 /* set the trace bit if we're stepping */
396 if (remcomInBuffer[0] == 's') { 401 if (remcomInBuffer[0] == 's') {
397 linux_regs->flags |= X86_EFLAGS_TF; 402 linux_regs->flags |= X86_EFLAGS_TF;
398 kgdb_single_step = 1;
399 atomic_set(&kgdb_cpu_doing_single_step, 403 atomic_set(&kgdb_cpu_doing_single_step,
400 raw_smp_processor_id()); 404 raw_smp_processor_id());
401 } 405 }
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 63123d902103..37542b67c57e 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -13,6 +13,9 @@
13 * Licensed under the terms of the GNU General Public 13 * Licensed under the terms of the GNU General Public
14 * License version 2. See file COPYING for details. 14 * License version 2. See file COPYING for details.
15 */ 15 */
16
17#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
18
16#include <linux/firmware.h> 19#include <linux/firmware.h>
17#include <linux/pci_ids.h> 20#include <linux/pci_ids.h>
18#include <linux/uaccess.h> 21#include <linux/uaccess.h>
@@ -81,7 +84,7 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
81 84
82 memset(csig, 0, sizeof(*csig)); 85 memset(csig, 0, sizeof(*csig));
83 rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy); 86 rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy);
84 pr_info("microcode: CPU%d: patch_level=0x%x\n", cpu, csig->rev); 87 pr_info("CPU%d: patch_level=0x%x\n", cpu, csig->rev);
85 return 0; 88 return 0;
86} 89}
87 90
@@ -111,8 +114,8 @@ static int get_matching_microcode(int cpu, void *mc, int rev)
111 114
112 /* ucode might be chipset specific -- currently we don't support this */ 115 /* ucode might be chipset specific -- currently we don't support this */
113 if (mc_header->nb_dev_id || mc_header->sb_dev_id) { 116 if (mc_header->nb_dev_id || mc_header->sb_dev_id) {
114 pr_err(KERN_ERR "microcode: CPU%d: loading of chipset " 117 pr_err("CPU%d: loading of chipset specific code not yet supported\n",
115 "specific code not yet supported\n", cpu); 118 cpu);
116 return 0; 119 return 0;
117 } 120 }
118 121
@@ -141,12 +144,12 @@ static int apply_microcode_amd(int cpu)
141 144
142 /* check current patch id and patch's id for match */ 145 /* check current patch id and patch's id for match */
143 if (rev != mc_amd->hdr.patch_id) { 146 if (rev != mc_amd->hdr.patch_id) {
144 pr_err("microcode: CPU%d: update failed " 147 pr_err("CPU%d: update failed (for patch_level=0x%x)\n",
145 "(for patch_level=0x%x)\n", cpu, mc_amd->hdr.patch_id); 148 cpu, mc_amd->hdr.patch_id);
146 return -1; 149 return -1;
147 } 150 }
148 151
149 pr_info("microcode: CPU%d: updated (new patch_level=0x%x)\n", cpu, rev); 152 pr_info("CPU%d: updated (new patch_level=0x%x)\n", cpu, rev);
150 uci->cpu_sig.rev = rev; 153 uci->cpu_sig.rev = rev;
151 154
152 return 0; 155 return 0;
@@ -169,15 +172,14 @@ get_next_ucode(const u8 *buf, unsigned int size, unsigned int *mc_size)
169 return NULL; 172 return NULL;
170 173
171 if (section_hdr[0] != UCODE_UCODE_TYPE) { 174 if (section_hdr[0] != UCODE_UCODE_TYPE) {
172 pr_err("microcode: error: invalid type field in " 175 pr_err("error: invalid type field in container file section header\n");
173 "container file section header\n");
174 return NULL; 176 return NULL;
175 } 177 }
176 178
177 total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8)); 179 total_size = (unsigned long) (section_hdr[4] + (section_hdr[5] << 8));
178 180
179 if (total_size > size || total_size > UCODE_MAX_SIZE) { 181 if (total_size > size || total_size > UCODE_MAX_SIZE) {
180 pr_err("microcode: error: size mismatch\n"); 182 pr_err("error: size mismatch\n");
181 return NULL; 183 return NULL;
182 } 184 }
183 185
@@ -206,14 +208,13 @@ static int install_equiv_cpu_table(const u8 *buf)
206 size = buf_pos[2]; 208 size = buf_pos[2];
207 209
208 if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) { 210 if (buf_pos[1] != UCODE_EQUIV_CPU_TABLE_TYPE || !size) {
209 pr_err("microcode: error: invalid type field in " 211 pr_err("error: invalid type field in container file section header\n");
210 "container file section header\n");
211 return 0; 212 return 0;
212 } 213 }
213 214
214 equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size); 215 equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size);
215 if (!equiv_cpu_table) { 216 if (!equiv_cpu_table) {
216 pr_err("microcode: failed to allocate equivalent CPU table\n"); 217 pr_err("failed to allocate equivalent CPU table\n");
217 return 0; 218 return 0;
218 } 219 }
219 220
@@ -246,7 +247,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
246 247
247 offset = install_equiv_cpu_table(ucode_ptr); 248 offset = install_equiv_cpu_table(ucode_ptr);
248 if (!offset) { 249 if (!offset) {
249 pr_err("microcode: failed to create equivalent cpu table\n"); 250 pr_err("failed to create equivalent cpu table\n");
250 return UCODE_ERROR; 251 return UCODE_ERROR;
251 } 252 }
252 253
@@ -277,8 +278,7 @@ generic_load_microcode(int cpu, const u8 *data, size_t size)
277 if (!leftover) { 278 if (!leftover) {
278 vfree(uci->mc); 279 vfree(uci->mc);
279 uci->mc = new_mc; 280 uci->mc = new_mc;
280 pr_debug("microcode: CPU%d found a matching microcode " 281 pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n",
281 "update with version 0x%x (current=0x%x)\n",
282 cpu, new_rev, uci->cpu_sig.rev); 282 cpu, new_rev, uci->cpu_sig.rev);
283 } else { 283 } else {
284 vfree(new_mc); 284 vfree(new_mc);
@@ -300,7 +300,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
300 return UCODE_NFOUND; 300 return UCODE_NFOUND;
301 301
302 if (*(u32 *)firmware->data != UCODE_MAGIC) { 302 if (*(u32 *)firmware->data != UCODE_MAGIC) {
303 pr_err("microcode: invalid UCODE_MAGIC (0x%08x)\n", 303 pr_err("invalid UCODE_MAGIC (0x%08x)\n",
304 *(u32 *)firmware->data); 304 *(u32 *)firmware->data);
305 return UCODE_ERROR; 305 return UCODE_ERROR;
306 } 306 }
@@ -313,8 +313,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
313static enum ucode_state 313static enum ucode_state
314request_microcode_user(int cpu, const void __user *buf, size_t size) 314request_microcode_user(int cpu, const void __user *buf, size_t size)
315{ 315{
316 pr_info("microcode: AMD microcode update via " 316 pr_info("AMD microcode update via /dev/cpu/microcode not supported\n");
317 "/dev/cpu/microcode not supported\n");
318 return UCODE_ERROR; 317 return UCODE_ERROR;
319} 318}
320 319
@@ -334,14 +333,13 @@ void init_microcode_amd(struct device *device)
334 WARN_ON(c->x86_vendor != X86_VENDOR_AMD); 333 WARN_ON(c->x86_vendor != X86_VENDOR_AMD);
335 334
336 if (c->x86 < 0x10) { 335 if (c->x86 < 0x10) {
337 pr_warning("microcode: AMD CPU family 0x%x not supported\n", 336 pr_warning("AMD CPU family 0x%x not supported\n", c->x86);
338 c->x86);
339 return; 337 return;
340 } 338 }
341 supported_cpu = 1; 339 supported_cpu = 1;
342 340
343 if (request_firmware(&firmware, fw_name, device)) 341 if (request_firmware(&firmware, fw_name, device))
344 pr_err("microcode: failed to load file %s\n", fw_name); 342 pr_err("failed to load file %s\n", fw_name);
345} 343}
346 344
347void fini_microcode_amd(void) 345void fini_microcode_amd(void)
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index e68aae397869..844c02c65fcb 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -70,6 +70,9 @@
70 * Fix sigmatch() macro to handle old CPUs with pf == 0. 70 * Fix sigmatch() macro to handle old CPUs with pf == 0.
71 * Thanks to Stuart Swales for pointing out this bug. 71 * Thanks to Stuart Swales for pointing out this bug.
72 */ 72 */
73
74#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
75
73#include <linux/platform_device.h> 76#include <linux/platform_device.h>
74#include <linux/miscdevice.h> 77#include <linux/miscdevice.h>
75#include <linux/capability.h> 78#include <linux/capability.h>
@@ -209,7 +212,7 @@ static ssize_t microcode_write(struct file *file, const char __user *buf,
209 ssize_t ret = -EINVAL; 212 ssize_t ret = -EINVAL;
210 213
211 if ((len >> PAGE_SHIFT) > totalram_pages) { 214 if ((len >> PAGE_SHIFT) > totalram_pages) {
212 pr_err("microcode: too much data (max %ld pages)\n", totalram_pages); 215 pr_err("too much data (max %ld pages)\n", totalram_pages);
213 return ret; 216 return ret;
214 } 217 }
215 218
@@ -244,7 +247,7 @@ static int __init microcode_dev_init(void)
244 247
245 error = misc_register(&microcode_dev); 248 error = misc_register(&microcode_dev);
246 if (error) { 249 if (error) {
247 pr_err("microcode: can't misc_register on minor=%d\n", MICROCODE_MINOR); 250 pr_err("can't misc_register on minor=%d\n", MICROCODE_MINOR);
248 return error; 251 return error;
249 } 252 }
250 253
@@ -359,7 +362,7 @@ static enum ucode_state microcode_resume_cpu(int cpu)
359 if (!uci->mc) 362 if (!uci->mc)
360 return UCODE_NFOUND; 363 return UCODE_NFOUND;
361 364
362 pr_debug("microcode: CPU%d updated upon resume\n", cpu); 365 pr_debug("CPU%d updated upon resume\n", cpu);
363 apply_microcode_on_target(cpu); 366 apply_microcode_on_target(cpu);
364 367
365 return UCODE_OK; 368 return UCODE_OK;
@@ -379,7 +382,7 @@ static enum ucode_state microcode_init_cpu(int cpu)
379 ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev); 382 ustate = microcode_ops->request_microcode_fw(cpu, &microcode_pdev->dev);
380 383
381 if (ustate == UCODE_OK) { 384 if (ustate == UCODE_OK) {
382 pr_debug("microcode: CPU%d updated upon init\n", cpu); 385 pr_debug("CPU%d updated upon init\n", cpu);
383 apply_microcode_on_target(cpu); 386 apply_microcode_on_target(cpu);
384 } 387 }
385 388
@@ -406,7 +409,7 @@ static int mc_sysdev_add(struct sys_device *sys_dev)
406 if (!cpu_online(cpu)) 409 if (!cpu_online(cpu))
407 return 0; 410 return 0;
408 411
409 pr_debug("microcode: CPU%d added\n", cpu); 412 pr_debug("CPU%d added\n", cpu);
410 413
411 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group); 414 err = sysfs_create_group(&sys_dev->kobj, &mc_attr_group);
412 if (err) 415 if (err)
@@ -425,7 +428,7 @@ static int mc_sysdev_remove(struct sys_device *sys_dev)
425 if (!cpu_online(cpu)) 428 if (!cpu_online(cpu))
426 return 0; 429 return 0;
427 430
428 pr_debug("microcode: CPU%d removed\n", cpu); 431 pr_debug("CPU%d removed\n", cpu);
429 microcode_fini_cpu(cpu); 432 microcode_fini_cpu(cpu);
430 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 433 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
431 return 0; 434 return 0;
@@ -473,15 +476,15 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
473 microcode_update_cpu(cpu); 476 microcode_update_cpu(cpu);
474 case CPU_DOWN_FAILED: 477 case CPU_DOWN_FAILED:
475 case CPU_DOWN_FAILED_FROZEN: 478 case CPU_DOWN_FAILED_FROZEN:
476 pr_debug("microcode: CPU%d added\n", cpu); 479 pr_debug("CPU%d added\n", cpu);
477 if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group)) 480 if (sysfs_create_group(&sys_dev->kobj, &mc_attr_group))
478 pr_err("microcode: Failed to create group for CPU%d\n", cpu); 481 pr_err("Failed to create group for CPU%d\n", cpu);
479 break; 482 break;
480 case CPU_DOWN_PREPARE: 483 case CPU_DOWN_PREPARE:
481 case CPU_DOWN_PREPARE_FROZEN: 484 case CPU_DOWN_PREPARE_FROZEN:
482 /* Suspend is in progress, only remove the interface */ 485 /* Suspend is in progress, only remove the interface */
483 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 486 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
484 pr_debug("microcode: CPU%d removed\n", cpu); 487 pr_debug("CPU%d removed\n", cpu);
485 break; 488 break;
486 case CPU_DEAD: 489 case CPU_DEAD:
487 case CPU_UP_CANCELED_FROZEN: 490 case CPU_UP_CANCELED_FROZEN:
@@ -507,7 +510,7 @@ static int __init microcode_init(void)
507 microcode_ops = init_amd_microcode(); 510 microcode_ops = init_amd_microcode();
508 511
509 if (!microcode_ops) { 512 if (!microcode_ops) {
510 pr_err("microcode: no support for this CPU vendor\n"); 513 pr_err("no support for this CPU vendor\n");
511 return -ENODEV; 514 return -ENODEV;
512 } 515 }
513 516
@@ -541,8 +544,7 @@ static int __init microcode_init(void)
541 register_hotcpu_notifier(&mc_cpu_notifier); 544 register_hotcpu_notifier(&mc_cpu_notifier);
542 545
543 pr_info("Microcode Update Driver: v" MICROCODE_VERSION 546 pr_info("Microcode Update Driver: v" MICROCODE_VERSION
544 " <tigran@aivazian.fsnet.co.uk>," 547 " <tigran@aivazian.fsnet.co.uk>, Peter Oruba\n");
545 " Peter Oruba\n");
546 548
547 return 0; 549 return 0;
548} 550}
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
index 0d334ddd0a96..ebd193e476ca 100644
--- a/arch/x86/kernel/microcode_intel.c
+++ b/arch/x86/kernel/microcode_intel.c
@@ -70,6 +70,9 @@
70 * Fix sigmatch() macro to handle old CPUs with pf == 0. 70 * Fix sigmatch() macro to handle old CPUs with pf == 0.
71 * Thanks to Stuart Swales for pointing out this bug. 71 * Thanks to Stuart Swales for pointing out this bug.
72 */ 72 */
73
74#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
75
73#include <linux/firmware.h> 76#include <linux/firmware.h>
74#include <linux/uaccess.h> 77#include <linux/uaccess.h>
75#include <linux/kernel.h> 78#include <linux/kernel.h>
@@ -146,8 +149,7 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
146 149
147 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 || 150 if (c->x86_vendor != X86_VENDOR_INTEL || c->x86 < 6 ||
148 cpu_has(c, X86_FEATURE_IA64)) { 151 cpu_has(c, X86_FEATURE_IA64)) {
149 printk(KERN_ERR "microcode: CPU%d not a capable Intel " 152 pr_err("CPU%d not a capable Intel processor\n", cpu_num);
150 "processor\n", cpu_num);
151 return -1; 153 return -1;
152 } 154 }
153 155
@@ -165,8 +167,8 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
165 /* get the current revision from MSR 0x8B */ 167 /* get the current revision from MSR 0x8B */
166 rdmsr(MSR_IA32_UCODE_REV, val[0], csig->rev); 168 rdmsr(MSR_IA32_UCODE_REV, val[0], csig->rev);
167 169
168 printk(KERN_INFO "microcode: CPU%d sig=0x%x, pf=0x%x, revision=0x%x\n", 170 pr_info("CPU%d sig=0x%x, pf=0x%x, revision=0x%x\n",
169 cpu_num, csig->sig, csig->pf, csig->rev); 171 cpu_num, csig->sig, csig->pf, csig->rev);
170 172
171 return 0; 173 return 0;
172} 174}
@@ -194,28 +196,24 @@ static int microcode_sanity_check(void *mc)
194 data_size = get_datasize(mc_header); 196 data_size = get_datasize(mc_header);
195 197
196 if (data_size + MC_HEADER_SIZE > total_size) { 198 if (data_size + MC_HEADER_SIZE > total_size) {
197 printk(KERN_ERR "microcode: error! " 199 pr_err("error! Bad data size in microcode data file\n");
198 "Bad data size in microcode data file\n");
199 return -EINVAL; 200 return -EINVAL;
200 } 201 }
201 202
202 if (mc_header->ldrver != 1 || mc_header->hdrver != 1) { 203 if (mc_header->ldrver != 1 || mc_header->hdrver != 1) {
203 printk(KERN_ERR "microcode: error! " 204 pr_err("error! Unknown microcode update format\n");
204 "Unknown microcode update format\n");
205 return -EINVAL; 205 return -EINVAL;
206 } 206 }
207 ext_table_size = total_size - (MC_HEADER_SIZE + data_size); 207 ext_table_size = total_size - (MC_HEADER_SIZE + data_size);
208 if (ext_table_size) { 208 if (ext_table_size) {
209 if ((ext_table_size < EXT_HEADER_SIZE) 209 if ((ext_table_size < EXT_HEADER_SIZE)
210 || ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) { 210 || ((ext_table_size - EXT_HEADER_SIZE) % EXT_SIGNATURE_SIZE)) {
211 printk(KERN_ERR "microcode: error! " 211 pr_err("error! Small exttable size in microcode data file\n");
212 "Small exttable size in microcode data file\n");
213 return -EINVAL; 212 return -EINVAL;
214 } 213 }
215 ext_header = mc + MC_HEADER_SIZE + data_size; 214 ext_header = mc + MC_HEADER_SIZE + data_size;
216 if (ext_table_size != exttable_size(ext_header)) { 215 if (ext_table_size != exttable_size(ext_header)) {
217 printk(KERN_ERR "microcode: error! " 216 pr_err("error! Bad exttable size in microcode data file\n");
218 "Bad exttable size in microcode data file\n");
219 return -EFAULT; 217 return -EFAULT;
220 } 218 }
221 ext_sigcount = ext_header->count; 219 ext_sigcount = ext_header->count;
@@ -230,8 +228,7 @@ static int microcode_sanity_check(void *mc)
230 while (i--) 228 while (i--)
231 ext_table_sum += ext_tablep[i]; 229 ext_table_sum += ext_tablep[i];
232 if (ext_table_sum) { 230 if (ext_table_sum) {
233 printk(KERN_WARNING "microcode: aborting, " 231 pr_warning("aborting, bad extended signature table checksum\n");
234 "bad extended signature table checksum\n");
235 return -EINVAL; 232 return -EINVAL;
236 } 233 }
237 } 234 }
@@ -242,7 +239,7 @@ static int microcode_sanity_check(void *mc)
242 while (i--) 239 while (i--)
243 orig_sum += ((int *)mc)[i]; 240 orig_sum += ((int *)mc)[i];
244 if (orig_sum) { 241 if (orig_sum) {
245 printk(KERN_ERR "microcode: aborting, bad checksum\n"); 242 pr_err("aborting, bad checksum\n");
246 return -EINVAL; 243 return -EINVAL;
247 } 244 }
248 if (!ext_table_size) 245 if (!ext_table_size)
@@ -255,7 +252,7 @@ static int microcode_sanity_check(void *mc)
255 - (mc_header->sig + mc_header->pf + mc_header->cksum) 252 - (mc_header->sig + mc_header->pf + mc_header->cksum)
256 + (ext_sig->sig + ext_sig->pf + ext_sig->cksum); 253 + (ext_sig->sig + ext_sig->pf + ext_sig->cksum);
257 if (sum) { 254 if (sum) {
258 printk(KERN_ERR "microcode: aborting, bad checksum\n"); 255 pr_err("aborting, bad checksum\n");
259 return -EINVAL; 256 return -EINVAL;
260 } 257 }
261 } 258 }
@@ -327,13 +324,11 @@ static int apply_microcode(int cpu)
327 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); 324 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
328 325
329 if (val[1] != mc_intel->hdr.rev) { 326 if (val[1] != mc_intel->hdr.rev) {
330 printk(KERN_ERR "microcode: CPU%d update " 327 pr_err("CPU%d update to revision 0x%x failed\n",
331 "to revision 0x%x failed\n", 328 cpu_num, mc_intel->hdr.rev);
332 cpu_num, mc_intel->hdr.rev);
333 return -1; 329 return -1;
334 } 330 }
335 printk(KERN_INFO "microcode: CPU%d updated to revision " 331 pr_info("CPU%d updated to revision 0x%x, date = %04x-%02x-%02x \n",
336 "0x%x, date = %04x-%02x-%02x \n",
337 cpu_num, val[1], 332 cpu_num, val[1],
338 mc_intel->hdr.date & 0xffff, 333 mc_intel->hdr.date & 0xffff,
339 mc_intel->hdr.date >> 24, 334 mc_intel->hdr.date >> 24,
@@ -362,8 +357,7 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
362 357
363 mc_size = get_totalsize(&mc_header); 358 mc_size = get_totalsize(&mc_header);
364 if (!mc_size || mc_size > leftover) { 359 if (!mc_size || mc_size > leftover) {
365 printk(KERN_ERR "microcode: error!" 360 pr_err("error! Bad data in microcode data file\n");
366 "Bad data in microcode data file\n");
367 break; 361 break;
368 } 362 }
369 363
@@ -405,9 +399,8 @@ static enum ucode_state generic_load_microcode(int cpu, void *data, size_t size,
405 vfree(uci->mc); 399 vfree(uci->mc);
406 uci->mc = (struct microcode_intel *)new_mc; 400 uci->mc = (struct microcode_intel *)new_mc;
407 401
408 pr_debug("microcode: CPU%d found a matching microcode update with" 402 pr_debug("CPU%d found a matching microcode update with version 0x%x (current=0x%x)\n",
409 " version 0x%x (current=0x%x)\n", 403 cpu, new_rev, uci->cpu_sig.rev);
410 cpu, new_rev, uci->cpu_sig.rev);
411out: 404out:
412 return state; 405 return state;
413} 406}
@@ -429,7 +422,7 @@ static enum ucode_state request_microcode_fw(int cpu, struct device *device)
429 c->x86, c->x86_model, c->x86_mask); 422 c->x86, c->x86_model, c->x86_mask);
430 423
431 if (request_firmware(&firmware, name, device)) { 424 if (request_firmware(&firmware, name, device)) {
432 pr_debug("microcode: data file %s load failed\n", name); 425 pr_debug("data file %s load failed\n", name);
433 return UCODE_NFOUND; 426 return UCODE_NFOUND;
434 } 427 }
435 428
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 35a57c963df9..40b54ceb68b5 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -945,9 +945,6 @@ void __init early_reserve_e820_mpc_new(void)
945{ 945{
946 if (enable_update_mptable && alloc_mptable) { 946 if (enable_update_mptable && alloc_mptable) {
947 u64 startt = 0; 947 u64 startt = 0;
948#ifdef CONFIG_X86_TRAMPOLINE
949 startt = TRAMPOLINE_BASE;
950#endif
951 mpc_new_phys = early_reserve_e820(startt, mpc_new_length, 4); 948 mpc_new_phys = early_reserve_e820(startt, mpc_new_length, 4);
952 } 949 }
953} 950}
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index afcc58b69c7c..fcc2f2bfa39c 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -120,11 +120,14 @@ static void __init dma32_free_bootmem(void)
120 120
121void __init pci_iommu_alloc(void) 121void __init pci_iommu_alloc(void)
122{ 122{
123 int use_swiotlb;
124
125 use_swiotlb = pci_swiotlb_init();
123#ifdef CONFIG_X86_64 126#ifdef CONFIG_X86_64
124 /* free the range so iommu could get some range less than 4G */ 127 /* free the range so iommu could get some range less than 4G */
125 dma32_free_bootmem(); 128 dma32_free_bootmem();
126#endif 129#endif
127 if (pci_swiotlb_init()) 130 if (use_swiotlb)
128 return; 131 return;
129 132
130 gart_iommu_hole_init(); 133 gart_iommu_hole_init();
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index e6a0d402f171..56c0e730d3fe 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -710,7 +710,8 @@ static void gart_iommu_shutdown(void)
710 struct pci_dev *dev; 710 struct pci_dev *dev;
711 int i; 711 int i;
712 712
713 if (no_agp) 713 /* don't shutdown it if there is AGP installed */
714 if (!no_agp)
714 return; 715 return;
715 716
716 for (i = 0; i < num_k8_northbridges; i++) { 717 for (i = 0; i < num_k8_northbridges; i++) {
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 5e2ba634ea15..7a7bd4e3ec49 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -10,6 +10,8 @@
10#include <linux/clockchips.h> 10#include <linux/clockchips.h>
11#include <linux/random.h> 11#include <linux/random.h>
12#include <linux/user-return-notifier.h> 12#include <linux/user-return-notifier.h>
13#include <linux/dmi.h>
14#include <linux/utsname.h>
13#include <trace/events/power.h> 15#include <trace/events/power.h>
14#include <linux/hw_breakpoint.h> 16#include <linux/hw_breakpoint.h>
15#include <asm/system.h> 17#include <asm/system.h>
@@ -90,6 +92,25 @@ void exit_thread(void)
90 } 92 }
91} 93}
92 94
95void show_regs_common(void)
96{
97 const char *board, *product;
98
99 board = dmi_get_system_info(DMI_BOARD_NAME);
100 if (!board)
101 board = "";
102 product = dmi_get_system_info(DMI_PRODUCT_NAME);
103 if (!product)
104 product = "";
105
106 printk("\n");
107 printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s %s/%s\n",
108 current->pid, current->comm, print_tainted(),
109 init_utsname()->release,
110 (int)strcspn(init_utsname()->version, " "),
111 init_utsname()->version, board, product);
112}
113
93void flush_thread(void) 114void flush_thread(void)
94{ 115{
95 struct task_struct *tsk = current; 116 struct task_struct *tsk = current;
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 075580b35682..120b88797a75 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -23,7 +23,6 @@
23#include <linux/vmalloc.h> 23#include <linux/vmalloc.h>
24#include <linux/user.h> 24#include <linux/user.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/utsname.h>
27#include <linux/delay.h> 26#include <linux/delay.h>
28#include <linux/reboot.h> 27#include <linux/reboot.h>
29#include <linux/init.h> 28#include <linux/init.h>
@@ -35,7 +34,6 @@
35#include <linux/tick.h> 34#include <linux/tick.h>
36#include <linux/percpu.h> 35#include <linux/percpu.h>
37#include <linux/prctl.h> 36#include <linux/prctl.h>
38#include <linux/dmi.h>
39#include <linux/ftrace.h> 37#include <linux/ftrace.h>
40#include <linux/uaccess.h> 38#include <linux/uaccess.h>
41#include <linux/io.h> 39#include <linux/io.h>
@@ -128,7 +126,6 @@ void __show_regs(struct pt_regs *regs, int all)
128 unsigned long d0, d1, d2, d3, d6, d7; 126 unsigned long d0, d1, d2, d3, d6, d7;
129 unsigned long sp; 127 unsigned long sp;
130 unsigned short ss, gs; 128 unsigned short ss, gs;
131 const char *board;
132 129
133 if (user_mode_vm(regs)) { 130 if (user_mode_vm(regs)) {
134 sp = regs->sp; 131 sp = regs->sp;
@@ -140,16 +137,7 @@ void __show_regs(struct pt_regs *regs, int all)
140 savesegment(gs, gs); 137 savesegment(gs, gs);
141 } 138 }
142 139
143 printk("\n"); 140 show_regs_common();
144
145 board = dmi_get_system_info(DMI_PRODUCT_NAME);
146 if (!board)
147 board = "";
148 printk("Pid: %d, comm: %s %s (%s %.*s) %s\n",
149 task_pid_nr(current), current->comm,
150 print_tainted(), init_utsname()->release,
151 (int)strcspn(init_utsname()->version, " "),
152 init_utsname()->version, board);
153 141
154 printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n", 142 printk("EIP: %04x:[<%08lx>] EFLAGS: %08lx CPU: %d\n",
155 (u16)regs->cs, regs->ip, regs->flags, 143 (u16)regs->cs, regs->ip, regs->flags,
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index c95c8f4e790a..e5ab0cd0ef36 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -26,7 +26,6 @@
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/user.h> 27#include <linux/user.h>
28#include <linux/interrupt.h> 28#include <linux/interrupt.h>
29#include <linux/utsname.h>
30#include <linux/delay.h> 29#include <linux/delay.h>
31#include <linux/module.h> 30#include <linux/module.h>
32#include <linux/ptrace.h> 31#include <linux/ptrace.h>
@@ -38,7 +37,6 @@
38#include <linux/uaccess.h> 37#include <linux/uaccess.h>
39#include <linux/io.h> 38#include <linux/io.h>
40#include <linux/ftrace.h> 39#include <linux/ftrace.h>
41#include <linux/dmi.h>
42 40
43#include <asm/pgtable.h> 41#include <asm/pgtable.h>
44#include <asm/system.h> 42#include <asm/system.h>
@@ -163,18 +161,8 @@ void __show_regs(struct pt_regs *regs, int all)
163 unsigned long d0, d1, d2, d3, d6, d7; 161 unsigned long d0, d1, d2, d3, d6, d7;
164 unsigned int fsindex, gsindex; 162 unsigned int fsindex, gsindex;
165 unsigned int ds, cs, es; 163 unsigned int ds, cs, es;
166 const char *board; 164
167 165 show_regs_common();
168 printk("\n");
169 print_modules();
170 board = dmi_get_system_info(DMI_PRODUCT_NAME);
171 if (!board)
172 board = "";
173 printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s %s\n",
174 current->pid, current->comm, print_tainted(),
175 init_utsname()->release,
176 (int)strcspn(init_utsname()->version, " "),
177 init_utsname()->version, board);
178 printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip); 166 printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
179 printk_address(regs->ip, 1); 167 printk_address(regs->ip, 1);
180 printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss, 168 printk(KERN_INFO "RSP: %04lx:%016lx EFLAGS: %08lx\n", regs->ss,
diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
index 04d182a7cfdb..7079ddaf0731 100644
--- a/arch/x86/kernel/ptrace.c
+++ b/arch/x86/kernel/ptrace.c
@@ -555,7 +555,9 @@ static int genregs_set(struct task_struct *target,
555 return ret; 555 return ret;
556} 556}
557 557
558static void ptrace_triggered(struct perf_event *bp, void *data) 558static void ptrace_triggered(struct perf_event *bp, int nmi,
559 struct perf_sample_data *data,
560 struct pt_regs *regs)
559{ 561{
560 int i; 562 int i;
561 struct thread_struct *thread = &(current->thread); 563 struct thread_struct *thread = &(current->thread);
@@ -593,13 +595,13 @@ static unsigned long ptrace_get_dr7(struct perf_event *bp[])
593 return dr7; 595 return dr7;
594} 596}
595 597
596static struct perf_event * 598static int
597ptrace_modify_breakpoint(struct perf_event *bp, int len, int type, 599ptrace_modify_breakpoint(struct perf_event *bp, int len, int type,
598 struct task_struct *tsk, int disabled) 600 struct task_struct *tsk, int disabled)
599{ 601{
600 int err; 602 int err;
601 int gen_len, gen_type; 603 int gen_len, gen_type;
602 DEFINE_BREAKPOINT_ATTR(attr); 604 struct perf_event_attr attr;
603 605
604 /* 606 /*
605 * We shoud have at least an inactive breakpoint at this 607 * We shoud have at least an inactive breakpoint at this
@@ -607,18 +609,18 @@ ptrace_modify_breakpoint(struct perf_event *bp, int len, int type,
607 * written the address register first 609 * written the address register first
608 */ 610 */
609 if (!bp) 611 if (!bp)
610 return ERR_PTR(-EINVAL); 612 return -EINVAL;
611 613
612 err = arch_bp_generic_fields(len, type, &gen_len, &gen_type); 614 err = arch_bp_generic_fields(len, type, &gen_len, &gen_type);
613 if (err) 615 if (err)
614 return ERR_PTR(err); 616 return err;
615 617
616 attr = bp->attr; 618 attr = bp->attr;
617 attr.bp_len = gen_len; 619 attr.bp_len = gen_len;
618 attr.bp_type = gen_type; 620 attr.bp_type = gen_type;
619 attr.disabled = disabled; 621 attr.disabled = disabled;
620 622
621 return modify_user_hw_breakpoint(bp, &attr, bp->callback, tsk); 623 return modify_user_hw_breakpoint(bp, &attr);
622} 624}
623 625
624/* 626/*
@@ -656,28 +658,17 @@ restore:
656 if (!second_pass) 658 if (!second_pass)
657 continue; 659 continue;
658 660
659 thread->ptrace_bps[i] = NULL; 661 rc = ptrace_modify_breakpoint(bp, len, type,
660 bp = ptrace_modify_breakpoint(bp, len, type,
661 tsk, 1); 662 tsk, 1);
662 if (IS_ERR(bp)) { 663 if (rc)
663 rc = PTR_ERR(bp);
664 thread->ptrace_bps[i] = NULL;
665 break; 664 break;
666 }
667 thread->ptrace_bps[i] = bp;
668 } 665 }
669 continue; 666 continue;
670 } 667 }
671 668
672 bp = ptrace_modify_breakpoint(bp, len, type, tsk, 0); 669 rc = ptrace_modify_breakpoint(bp, len, type, tsk, 0);
673 670 if (rc)
674 /* Incorrect bp, or we have a bug in bp API */
675 if (IS_ERR(bp)) {
676 rc = PTR_ERR(bp);
677 thread->ptrace_bps[i] = NULL;
678 break; 671 break;
679 }
680 thread->ptrace_bps[i] = bp;
681 } 672 }
682 /* 673 /*
683 * Make a second pass to free the remaining unused breakpoints 674 * Make a second pass to free the remaining unused breakpoints
@@ -721,9 +712,10 @@ static int ptrace_set_breakpoint_addr(struct task_struct *tsk, int nr,
721{ 712{
722 struct perf_event *bp; 713 struct perf_event *bp;
723 struct thread_struct *t = &tsk->thread; 714 struct thread_struct *t = &tsk->thread;
724 DEFINE_BREAKPOINT_ATTR(attr); 715 struct perf_event_attr attr;
725 716
726 if (!t->ptrace_bps[nr]) { 717 if (!t->ptrace_bps[nr]) {
718 hw_breakpoint_init(&attr);
727 /* 719 /*
728 * Put stub len and type to register (reserve) an inactive but 720 * Put stub len and type to register (reserve) an inactive but
729 * correct bp 721 * correct bp
@@ -734,26 +726,32 @@ static int ptrace_set_breakpoint_addr(struct task_struct *tsk, int nr,
734 attr.disabled = 1; 726 attr.disabled = 1;
735 727
736 bp = register_user_hw_breakpoint(&attr, ptrace_triggered, tsk); 728 bp = register_user_hw_breakpoint(&attr, ptrace_triggered, tsk);
729
730 /*
731 * CHECKME: the previous code returned -EIO if the addr wasn't
732 * a valid task virtual addr. The new one will return -EINVAL in
733 * this case.
734 * -EINVAL may be what we want for in-kernel breakpoints users,
735 * but -EIO looks better for ptrace, since we refuse a register
736 * writing for the user. And anyway this is the previous
737 * behaviour.
738 */
739 if (IS_ERR(bp))
740 return PTR_ERR(bp);
741
742 t->ptrace_bps[nr] = bp;
737 } else { 743 } else {
744 int err;
745
738 bp = t->ptrace_bps[nr]; 746 bp = t->ptrace_bps[nr];
739 t->ptrace_bps[nr] = NULL;
740 747
741 attr = bp->attr; 748 attr = bp->attr;
742 attr.bp_addr = addr; 749 attr.bp_addr = addr;
743 bp = modify_user_hw_breakpoint(bp, &attr, bp->callback, tsk); 750 err = modify_user_hw_breakpoint(bp, &attr);
751 if (err)
752 return err;
744 } 753 }
745 /*
746 * CHECKME: the previous code returned -EIO if the addr wasn't a
747 * valid task virtual addr. The new one will return -EINVAL in this
748 * case.
749 * -EINVAL may be what we want for in-kernel breakpoints users, but
750 * -EIO looks better for ptrace, since we refuse a register writing
751 * for the user. And anyway this is the previous behaviour.
752 */
753 if (IS_ERR(bp))
754 return PTR_ERR(bp);
755 754
756 t->ptrace_bps[nr] = bp;
757 755
758 return 0; 756 return 0;
759} 757}
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 2b97fc5b124e..1545bc0c9845 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -259,6 +259,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
259 DMI_MATCH(DMI_PRODUCT_NAME, "SBC-FITPC2"), 259 DMI_MATCH(DMI_PRODUCT_NAME, "SBC-FITPC2"),
260 }, 260 },
261 }, 261 },
262 { /* Handle problems with rebooting on ASUS P4S800 */
263 .callback = set_bios_reboot,
264 .ident = "ASUS P4S800",
265 .matches = {
266 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
267 DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
268 },
269 },
262 { } 270 { }
263}; 271};
264 272
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 946a311a25c9..f7b8b9894b22 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -73,6 +73,7 @@
73 73
74#include <asm/mtrr.h> 74#include <asm/mtrr.h>
75#include <asm/apic.h> 75#include <asm/apic.h>
76#include <asm/trampoline.h>
76#include <asm/e820.h> 77#include <asm/e820.h>
77#include <asm/mpspec.h> 78#include <asm/mpspec.h>
78#include <asm/setup.h> 79#include <asm/setup.h>
@@ -875,6 +876,13 @@ void __init setup_arch(char **cmdline_p)
875 876
876 reserve_brk(); 877 reserve_brk();
877 878
879 /*
880 * Find and reserve possible boot-time SMP configuration:
881 */
882 find_smp_config();
883
884 reserve_trampoline_memory();
885
878#ifdef CONFIG_ACPI_SLEEP 886#ifdef CONFIG_ACPI_SLEEP
879 /* 887 /*
880 * Reserve low memory region for sleep support. 888 * Reserve low memory region for sleep support.
@@ -921,11 +929,6 @@ void __init setup_arch(char **cmdline_p)
921 929
922 early_acpi_boot_init(); 930 early_acpi_boot_init();
923 931
924 /*
925 * Find and reserve possible boot-time SMP configuration:
926 */
927 find_smp_config();
928
929#ifdef CONFIG_ACPI_NUMA 932#ifdef CONFIG_ACPI_NUMA
930 /* 933 /*
931 * Parse SRAT to discover nodes. 934 * Parse SRAT to discover nodes.
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index d559af913e1f..35abcb8b00e9 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -1,3 +1,5 @@
1#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2
1#include <linux/kernel.h> 3#include <linux/kernel.h>
2#include <linux/module.h> 4#include <linux/module.h>
3#include <linux/init.h> 5#include <linux/init.h>
@@ -20,9 +22,9 @@
20#include <asm/stackprotector.h> 22#include <asm/stackprotector.h>
21 23
22#ifdef CONFIG_DEBUG_PER_CPU_MAPS 24#ifdef CONFIG_DEBUG_PER_CPU_MAPS
23# define DBG(x...) printk(KERN_DEBUG x) 25# define DBG(fmt, ...) pr_dbg(fmt, ##__VA_ARGS__)
24#else 26#else
25# define DBG(x...) 27# define DBG(fmt, ...) do { if (0) pr_dbg(fmt, ##__VA_ARGS__); } while (0)
26#endif 28#endif
27 29
28DEFINE_PER_CPU(int, cpu_number); 30DEFINE_PER_CPU(int, cpu_number);
@@ -116,8 +118,8 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, unsigned long size,
116 } else { 118 } else {
117 ptr = __alloc_bootmem_node_nopanic(NODE_DATA(node), 119 ptr = __alloc_bootmem_node_nopanic(NODE_DATA(node),
118 size, align, goal); 120 size, align, goal);
119 pr_debug("per cpu data for cpu%d %lu bytes on node%d at " 121 pr_debug("per cpu data for cpu%d %lu bytes on node%d at %016lx\n",
120 "%016lx\n", cpu, size, node, __pa(ptr)); 122 cpu, size, node, __pa(ptr));
121 } 123 }
122 return ptr; 124 return ptr;
123#else 125#else
@@ -198,8 +200,7 @@ void __init setup_per_cpu_areas(void)
198 pcpu_cpu_distance, 200 pcpu_cpu_distance,
199 pcpu_fc_alloc, pcpu_fc_free); 201 pcpu_fc_alloc, pcpu_fc_free);
200 if (rc < 0) 202 if (rc < 0)
201 pr_warning("PERCPU: %s allocator failed (%d), " 203 pr_warning("%s allocator failed (%d), falling back to page size\n",
202 "falling back to page size\n",
203 pcpu_fc_names[pcpu_chosen_fc], rc); 204 pcpu_fc_names[pcpu_chosen_fc], rc);
204 } 205 }
205 if (rc < 0) 206 if (rc < 0)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 324f2a44c221..678d0b8c26f3 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -671,6 +671,26 @@ static void __cpuinit do_fork_idle(struct work_struct *work)
671 complete(&c_idle->done); 671 complete(&c_idle->done);
672} 672}
673 673
674/* reduce the number of lines printed when booting a large cpu count system */
675static void __cpuinit announce_cpu(int cpu, int apicid)
676{
677 static int current_node = -1;
678 int node = cpu_to_node(cpu);
679
680 if (system_state == SYSTEM_BOOTING) {
681 if (node != current_node) {
682 if (current_node > (-1))
683 pr_cont(" Ok.\n");
684 current_node = node;
685 pr_info("Booting Node %3d, Processors ", node);
686 }
687 pr_cont(" #%d%s", cpu, cpu == (nr_cpu_ids - 1) ? " Ok.\n" : "");
688 return;
689 } else
690 pr_info("Booting Node %d Processor %d APIC 0x%x\n",
691 node, cpu, apicid);
692}
693
674/* 694/*
675 * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad 695 * NOTE - on most systems this is a PHYSICAL apic ID, but on multiquad
676 * (ie clustered apic addressing mode), this is a LOGICAL apic ID. 696 * (ie clustered apic addressing mode), this is a LOGICAL apic ID.
@@ -687,7 +707,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
687 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done), 707 .done = COMPLETION_INITIALIZER_ONSTACK(c_idle.done),
688 }; 708 };
689 709
690 INIT_WORK(&c_idle.work, do_fork_idle); 710 INIT_WORK_ON_STACK(&c_idle.work, do_fork_idle);
691 711
692 alternatives_smp_switch(1); 712 alternatives_smp_switch(1);
693 713
@@ -713,6 +733,7 @@ static int __cpuinit do_boot_cpu(int apicid, int cpu)
713 733
714 if (IS_ERR(c_idle.idle)) { 734 if (IS_ERR(c_idle.idle)) {
715 printk("failed fork for CPU %d\n", cpu); 735 printk("failed fork for CPU %d\n", cpu);
736 destroy_work_on_stack(&c_idle.work);
716 return PTR_ERR(c_idle.idle); 737 return PTR_ERR(c_idle.idle);
717 } 738 }
718 739
@@ -736,9 +757,8 @@ do_rest:
736 /* start_ip had better be page-aligned! */ 757 /* start_ip had better be page-aligned! */
737 start_ip = setup_trampoline(); 758 start_ip = setup_trampoline();
738 759
739 /* So we see what's up */ 760 /* So we see what's up */
740 printk(KERN_INFO "Booting processor %d APIC 0x%x ip 0x%lx\n", 761 announce_cpu(cpu, apicid);
741 cpu, apicid, start_ip);
742 762
743 /* 763 /*
744 * This grunge runs the startup process for 764 * This grunge runs the startup process for
@@ -787,21 +807,17 @@ do_rest:
787 udelay(100); 807 udelay(100);
788 } 808 }
789 809
790 if (cpumask_test_cpu(cpu, cpu_callin_mask)) { 810 if (cpumask_test_cpu(cpu, cpu_callin_mask))
791 /* number CPUs logically, starting from 1 (BSP is 0) */ 811 pr_debug("CPU%d: has booted.\n", cpu);
792 pr_debug("OK.\n"); 812 else {
793 printk(KERN_INFO "CPU%d: ", cpu);
794 print_cpu_info(&cpu_data(cpu));
795 pr_debug("CPU has booted.\n");
796 } else {
797 boot_error = 1; 813 boot_error = 1;
798 if (*((volatile unsigned char *)trampoline_base) 814 if (*((volatile unsigned char *)trampoline_base)
799 == 0xA5) 815 == 0xA5)
800 /* trampoline started but...? */ 816 /* trampoline started but...? */
801 printk(KERN_ERR "Stuck ??\n"); 817 pr_err("CPU%d: Stuck ??\n", cpu);
802 else 818 else
803 /* trampoline code not run */ 819 /* trampoline code not run */
804 printk(KERN_ERR "Not responding.\n"); 820 pr_err("CPU%d: Not responding.\n", cpu);
805 if (apic->inquire_remote_apic) 821 if (apic->inquire_remote_apic)
806 apic->inquire_remote_apic(apicid); 822 apic->inquire_remote_apic(apicid);
807 } 823 }
@@ -831,6 +847,7 @@ do_rest:
831 smpboot_restore_warm_reset_vector(); 847 smpboot_restore_warm_reset_vector();
832 } 848 }
833 849
850 destroy_work_on_stack(&c_idle.work);
834 return boot_error; 851 return boot_error;
835} 852}
836 853
@@ -1291,14 +1308,16 @@ void native_cpu_die(unsigned int cpu)
1291 for (i = 0; i < 10; i++) { 1308 for (i = 0; i < 10; i++) {
1292 /* They ack this in play_dead by setting CPU_DEAD */ 1309 /* They ack this in play_dead by setting CPU_DEAD */
1293 if (per_cpu(cpu_state, cpu) == CPU_DEAD) { 1310 if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
1294 printk(KERN_INFO "CPU %d is now offline\n", cpu); 1311 if (system_state == SYSTEM_RUNNING)
1312 pr_info("CPU %u is now offline\n", cpu);
1313
1295 if (1 == num_online_cpus()) 1314 if (1 == num_online_cpus())
1296 alternatives_smp_switch(0); 1315 alternatives_smp_switch(0);
1297 return; 1316 return;
1298 } 1317 }
1299 msleep(100); 1318 msleep(100);
1300 } 1319 }
1301 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1320 pr_err("CPU %u didn't die...\n", cpu);
1302} 1321}
1303 1322
1304void play_dead_common(void) 1323void play_dead_common(void)
diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
index 1884a8d12bfa..dee1ff7cba58 100644
--- a/arch/x86/kernel/sys_i386_32.c
+++ b/arch/x86/kernel/sys_i386_32.c
@@ -24,31 +24,6 @@
24 24
25#include <asm/syscalls.h> 25#include <asm/syscalls.h>
26 26
27asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
28 unsigned long prot, unsigned long flags,
29 unsigned long fd, unsigned long pgoff)
30{
31 int error = -EBADF;
32 struct file *file = NULL;
33 struct mm_struct *mm = current->mm;
34
35 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
36 if (!(flags & MAP_ANONYMOUS)) {
37 file = fget(fd);
38 if (!file)
39 goto out;
40 }
41
42 down_write(&mm->mmap_sem);
43 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
44 up_write(&mm->mmap_sem);
45
46 if (file)
47 fput(file);
48out:
49 return error;
50}
51
52/* 27/*
53 * Perform the select(nd, in, out, ex, tv) and mmap() system 28 * Perform the select(nd, in, out, ex, tv) and mmap() system
54 * calls. Linux/i386 didn't use to be able to handle more than 29 * calls. Linux/i386 didn't use to be able to handle more than
@@ -77,7 +52,7 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
77 if (a.offset & ~PAGE_MASK) 52 if (a.offset & ~PAGE_MASK)
78 goto out; 53 goto out;
79 54
80 err = sys_mmap2(a.addr, a.len, a.prot, a.flags, 55 err = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags,
81 a.fd, a.offset >> PAGE_SHIFT); 56 a.fd, a.offset >> PAGE_SHIFT);
82out: 57out:
83 return err; 58 return err;
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index 45e00eb09c3a..8aa2057efd12 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -23,26 +23,11 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
23 unsigned long, fd, unsigned long, off) 23 unsigned long, fd, unsigned long, off)
24{ 24{
25 long error; 25 long error;
26 struct file *file;
27
28 error = -EINVAL; 26 error = -EINVAL;
29 if (off & ~PAGE_MASK) 27 if (off & ~PAGE_MASK)
30 goto out; 28 goto out;
31 29
32 error = -EBADF; 30 error = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
33 file = NULL;
34 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
35 if (!(flags & MAP_ANONYMOUS)) {
36 file = fget(fd);
37 if (!file)
38 goto out;
39 }
40 down_write(&current->mm->mmap_sem);
41 error = do_mmap_pgoff(file, addr, len, prot, flags, off >> PAGE_SHIFT);
42 up_write(&current->mm->mmap_sem);
43
44 if (file)
45 fput(file);
46out: 31out:
47 return error; 32 return error;
48} 33}
diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
index 70c2125d55b9..15228b5d3eb7 100644
--- a/arch/x86/kernel/syscall_table_32.S
+++ b/arch/x86/kernel/syscall_table_32.S
@@ -191,7 +191,7 @@ ENTRY(sys_call_table)
191 .long sys_ni_syscall /* reserved for streams2 */ 191 .long sys_ni_syscall /* reserved for streams2 */
192 .long ptregs_vfork /* 190 */ 192 .long ptregs_vfork /* 190 */
193 .long sys_getrlimit 193 .long sys_getrlimit
194 .long sys_mmap2 194 .long sys_mmap_pgoff
195 .long sys_truncate64 195 .long sys_truncate64
196 .long sys_ftruncate64 196 .long sys_ftruncate64
197 .long sys_stat64 /* 195 */ 197 .long sys_stat64 /* 195 */
diff --git a/arch/x86/kernel/trampoline.c b/arch/x86/kernel/trampoline.c
index cd022121cab6..c652ef62742d 100644
--- a/arch/x86/kernel/trampoline.c
+++ b/arch/x86/kernel/trampoline.c
@@ -12,21 +12,19 @@
12#endif 12#endif
13 13
14/* ready for x86_64 and x86 */ 14/* ready for x86_64 and x86 */
15unsigned char *__trampinitdata trampoline_base = __va(TRAMPOLINE_BASE); 15unsigned char *__trampinitdata trampoline_base;
16 16
17void __init reserve_trampoline_memory(void) 17void __init reserve_trampoline_memory(void)
18{ 18{
19#ifdef CONFIG_X86_32 19 unsigned long mem;
20 /* 20
21 * But first pinch a few for the stack/trampoline stuff
22 * FIXME: Don't need the extra page at 4K, but need to fix
23 * trampoline before removing it. (see the GDT stuff)
24 */
25 reserve_early(PAGE_SIZE, PAGE_SIZE + PAGE_SIZE, "EX TRAMPOLINE");
26#endif
27 /* Has to be in very low memory so we can execute real-mode AP code. */ 21 /* Has to be in very low memory so we can execute real-mode AP code. */
28 reserve_early(TRAMPOLINE_BASE, TRAMPOLINE_BASE + TRAMPOLINE_SIZE, 22 mem = find_e820_area(0, 1<<20, TRAMPOLINE_SIZE, PAGE_SIZE);
29 "TRAMPOLINE"); 23 if (mem == -1L)
24 panic("Cannot allocate trampoline\n");
25
26 trampoline_base = __va(mem);
27 reserve_early(mem, mem + TRAMPOLINE_SIZE, "TRAMPOLINE");
30} 28}
31 29
32/* 30/*
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index fab7440c9bb2..296aba49472a 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -29,6 +29,8 @@
29 * Based on QEMU and Xen. 29 * Based on QEMU and Xen.
30 */ 30 */
31 31
32#define pr_fmt(fmt) "pit: " fmt
33
32#include <linux/kvm_host.h> 34#include <linux/kvm_host.h>
33 35
34#include "irq.h" 36#include "irq.h"
@@ -262,7 +264,7 @@ void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu)
262 264
263static void destroy_pit_timer(struct kvm_timer *pt) 265static void destroy_pit_timer(struct kvm_timer *pt)
264{ 266{
265 pr_debug("pit: execute del timer!\n"); 267 pr_debug("execute del timer!\n");
266 hrtimer_cancel(&pt->timer); 268 hrtimer_cancel(&pt->timer);
267} 269}
268 270
@@ -284,7 +286,7 @@ static void create_pit_timer(struct kvm_kpit_state *ps, u32 val, int is_period)
284 286
285 interval = muldiv64(val, NSEC_PER_SEC, KVM_PIT_FREQ); 287 interval = muldiv64(val, NSEC_PER_SEC, KVM_PIT_FREQ);
286 288
287 pr_debug("pit: create pit timer, interval is %llu nsec\n", interval); 289 pr_debug("create pit timer, interval is %llu nsec\n", interval);
288 290
289 /* TODO The new value only affected after the retriggered */ 291 /* TODO The new value only affected after the retriggered */
290 hrtimer_cancel(&pt->timer); 292 hrtimer_cancel(&pt->timer);
@@ -309,7 +311,7 @@ static void pit_load_count(struct kvm *kvm, int channel, u32 val)
309 311
310 WARN_ON(!mutex_is_locked(&ps->lock)); 312 WARN_ON(!mutex_is_locked(&ps->lock));
311 313
312 pr_debug("pit: load_count val is %d, channel is %d\n", val, channel); 314 pr_debug("load_count val is %d, channel is %d\n", val, channel);
313 315
314 /* 316 /*
315 * The largest possible initial count is 0; this is equivalent 317 * The largest possible initial count is 0; this is equivalent
@@ -395,8 +397,8 @@ static int pit_ioport_write(struct kvm_io_device *this,
395 mutex_lock(&pit_state->lock); 397 mutex_lock(&pit_state->lock);
396 398
397 if (val != 0) 399 if (val != 0)
398 pr_debug("pit: write addr is 0x%x, len is %d, val is 0x%x\n", 400 pr_debug("write addr is 0x%x, len is %d, val is 0x%x\n",
399 (unsigned int)addr, len, val); 401 (unsigned int)addr, len, val);
400 402
401 if (addr == 3) { 403 if (addr == 3) {
402 channel = val >> 6; 404 channel = val >> 6;
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 3de0b37ec038..1d9b33843c80 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -316,7 +316,7 @@ static void svm_hardware_disable(void *garbage)
316static int svm_hardware_enable(void *garbage) 316static int svm_hardware_enable(void *garbage)
317{ 317{
318 318
319 struct svm_cpu_data *svm_data; 319 struct svm_cpu_data *sd;
320 uint64_t efer; 320 uint64_t efer;
321 struct descriptor_table gdt_descr; 321 struct descriptor_table gdt_descr;
322 struct desc_struct *gdt; 322 struct desc_struct *gdt;
@@ -331,63 +331,61 @@ static int svm_hardware_enable(void *garbage)
331 me); 331 me);
332 return -EINVAL; 332 return -EINVAL;
333 } 333 }
334 svm_data = per_cpu(svm_data, me); 334 sd = per_cpu(svm_data, me);
335 335
336 if (!svm_data) { 336 if (!sd) {
337 printk(KERN_ERR "svm_hardware_enable: svm_data is NULL on %d\n", 337 printk(KERN_ERR "svm_hardware_enable: svm_data is NULL on %d\n",
338 me); 338 me);
339 return -EINVAL; 339 return -EINVAL;
340 } 340 }
341 341
342 svm_data->asid_generation = 1; 342 sd->asid_generation = 1;
343 svm_data->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1; 343 sd->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1;
344 svm_data->next_asid = svm_data->max_asid + 1; 344 sd->next_asid = sd->max_asid + 1;
345 345
346 kvm_get_gdt(&gdt_descr); 346 kvm_get_gdt(&gdt_descr);
347 gdt = (struct desc_struct *)gdt_descr.base; 347 gdt = (struct desc_struct *)gdt_descr.base;
348 svm_data->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS); 348 sd->tss_desc = (struct kvm_ldttss_desc *)(gdt + GDT_ENTRY_TSS);
349 349
350 wrmsrl(MSR_EFER, efer | EFER_SVME); 350 wrmsrl(MSR_EFER, efer | EFER_SVME);
351 351
352 wrmsrl(MSR_VM_HSAVE_PA, 352 wrmsrl(MSR_VM_HSAVE_PA, page_to_pfn(sd->save_area) << PAGE_SHIFT);
353 page_to_pfn(svm_data->save_area) << PAGE_SHIFT);
354 353
355 return 0; 354 return 0;
356} 355}
357 356
358static void svm_cpu_uninit(int cpu) 357static void svm_cpu_uninit(int cpu)
359{ 358{
360 struct svm_cpu_data *svm_data 359 struct svm_cpu_data *sd = per_cpu(svm_data, raw_smp_processor_id());
361 = per_cpu(svm_data, raw_smp_processor_id());
362 360
363 if (!svm_data) 361 if (!sd)
364 return; 362 return;
365 363
366 per_cpu(svm_data, raw_smp_processor_id()) = NULL; 364 per_cpu(svm_data, raw_smp_processor_id()) = NULL;
367 __free_page(svm_data->save_area); 365 __free_page(sd->save_area);
368 kfree(svm_data); 366 kfree(sd);
369} 367}
370 368
371static int svm_cpu_init(int cpu) 369static int svm_cpu_init(int cpu)
372{ 370{
373 struct svm_cpu_data *svm_data; 371 struct svm_cpu_data *sd;
374 int r; 372 int r;
375 373
376 svm_data = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL); 374 sd = kzalloc(sizeof(struct svm_cpu_data), GFP_KERNEL);
377 if (!svm_data) 375 if (!sd)
378 return -ENOMEM; 376 return -ENOMEM;
379 svm_data->cpu = cpu; 377 sd->cpu = cpu;
380 svm_data->save_area = alloc_page(GFP_KERNEL); 378 sd->save_area = alloc_page(GFP_KERNEL);
381 r = -ENOMEM; 379 r = -ENOMEM;
382 if (!svm_data->save_area) 380 if (!sd->save_area)
383 goto err_1; 381 goto err_1;
384 382
385 per_cpu(svm_data, cpu) = svm_data; 383 per_cpu(svm_data, cpu) = sd;
386 384
387 return 0; 385 return 0;
388 386
389err_1: 387err_1:
390 kfree(svm_data); 388 kfree(sd);
391 return r; 389 return r;
392 390
393} 391}
@@ -1092,16 +1090,16 @@ static void save_host_msrs(struct kvm_vcpu *vcpu)
1092#endif 1090#endif
1093} 1091}
1094 1092
1095static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *svm_data) 1093static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd)
1096{ 1094{
1097 if (svm_data->next_asid > svm_data->max_asid) { 1095 if (sd->next_asid > sd->max_asid) {
1098 ++svm_data->asid_generation; 1096 ++sd->asid_generation;
1099 svm_data->next_asid = 1; 1097 sd->next_asid = 1;
1100 svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; 1098 svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID;
1101 } 1099 }
1102 1100
1103 svm->asid_generation = svm_data->asid_generation; 1101 svm->asid_generation = sd->asid_generation;
1104 svm->vmcb->control.asid = svm_data->next_asid++; 1102 svm->vmcb->control.asid = sd->next_asid++;
1105} 1103}
1106 1104
1107static unsigned long svm_get_dr(struct kvm_vcpu *vcpu, int dr) 1105static unsigned long svm_get_dr(struct kvm_vcpu *vcpu, int dr)
@@ -2429,8 +2427,8 @@ static void reload_tss(struct kvm_vcpu *vcpu)
2429{ 2427{
2430 int cpu = raw_smp_processor_id(); 2428 int cpu = raw_smp_processor_id();
2431 2429
2432 struct svm_cpu_data *svm_data = per_cpu(svm_data, cpu); 2430 struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
2433 svm_data->tss_desc->type = 9; /* available 32/64-bit TSS */ 2431 sd->tss_desc->type = 9; /* available 32/64-bit TSS */
2434 load_TR_desc(); 2432 load_TR_desc();
2435} 2433}
2436 2434
@@ -2438,12 +2436,12 @@ static void pre_svm_run(struct vcpu_svm *svm)
2438{ 2436{
2439 int cpu = raw_smp_processor_id(); 2437 int cpu = raw_smp_processor_id();
2440 2438
2441 struct svm_cpu_data *svm_data = per_cpu(svm_data, cpu); 2439 struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
2442 2440
2443 svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; 2441 svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING;
2444 /* FIXME: handle wraparound of asid_generation */ 2442 /* FIXME: handle wraparound of asid_generation */
2445 if (svm->asid_generation != svm_data->asid_generation) 2443 if (svm->asid_generation != sd->asid_generation)
2446 new_asid(svm, svm_data); 2444 new_asid(svm, sd);
2447} 2445}
2448 2446
2449static void svm_inject_nmi(struct kvm_vcpu *vcpu) 2447static void svm_inject_nmi(struct kvm_vcpu *vcpu)
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index a2d6472895fb..45b20e486c2f 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -5,7 +5,7 @@
5inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk 5inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk
6inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt 6inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt
7quiet_cmd_inat_tables = GEN $@ 7quiet_cmd_inat_tables = GEN $@
8 cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ 8 cmd_inat_tables = $(AWK) -f $(inat_tables_script) $(inat_tables_maps) > $@ || rm -f $@
9 9
10$(obj)/inat-tables.c: $(inat_tables_script) $(inat_tables_maps) 10$(obj)/inat-tables.c: $(inat_tables_script) $(inat_tables_maps)
11 $(call cmd,inat_tables) 11 $(call cmd,inat_tables)
@@ -20,7 +20,7 @@ lib-y := delay.o
20lib-y += thunk_$(BITS).o 20lib-y += thunk_$(BITS).o
21lib-y += usercopy_$(BITS).o getuser.o putuser.o 21lib-y += usercopy_$(BITS).o getuser.o putuser.o
22lib-y += memcpy_$(BITS).o 22lib-y += memcpy_$(BITS).o
23lib-y += insn.o inat.o 23lib-$(CONFIG_KPROBES) += insn.o inat.o
24 24
25obj-y += msr-reg.o msr-reg-export.o 25obj-y += msr-reg.o msr-reg-export.o
26 26
diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
index 41628b104b9e..872834177937 100644
--- a/arch/x86/lib/msr.c
+++ b/arch/x86/lib/msr.c
@@ -7,7 +7,6 @@ struct msr_info {
7 u32 msr_no; 7 u32 msr_no;
8 struct msr reg; 8 struct msr reg;
9 struct msr *msrs; 9 struct msr *msrs;
10 int off;
11 int err; 10 int err;
12}; 11};
13 12
@@ -18,7 +17,7 @@ static void __rdmsr_on_cpu(void *info)
18 int this_cpu = raw_smp_processor_id(); 17 int this_cpu = raw_smp_processor_id();
19 18
20 if (rv->msrs) 19 if (rv->msrs)
21 reg = &rv->msrs[this_cpu - rv->off]; 20 reg = per_cpu_ptr(rv->msrs, this_cpu);
22 else 21 else
23 reg = &rv->reg; 22 reg = &rv->reg;
24 23
@@ -32,7 +31,7 @@ static void __wrmsr_on_cpu(void *info)
32 int this_cpu = raw_smp_processor_id(); 31 int this_cpu = raw_smp_processor_id();
33 32
34 if (rv->msrs) 33 if (rv->msrs)
35 reg = &rv->msrs[this_cpu - rv->off]; 34 reg = per_cpu_ptr(rv->msrs, this_cpu);
36 else 35 else
37 reg = &rv->reg; 36 reg = &rv->reg;
38 37
@@ -80,7 +79,6 @@ static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
80 79
81 memset(&rv, 0, sizeof(rv)); 80 memset(&rv, 0, sizeof(rv));
82 81
83 rv.off = cpumask_first(mask);
84 rv.msrs = msrs; 82 rv.msrs = msrs;
85 rv.msr_no = msr_no; 83 rv.msr_no = msr_no;
86 84
@@ -120,6 +118,26 @@ void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
120} 118}
121EXPORT_SYMBOL(wrmsr_on_cpus); 119EXPORT_SYMBOL(wrmsr_on_cpus);
122 120
121struct msr *msrs_alloc(void)
122{
123 struct msr *msrs = NULL;
124
125 msrs = alloc_percpu(struct msr);
126 if (!msrs) {
127 pr_warning("%s: error allocating msrs\n", __func__);
128 return NULL;
129 }
130
131 return msrs;
132}
133EXPORT_SYMBOL(msrs_alloc);
134
135void msrs_free(struct msr *msrs)
136{
137 free_percpu(msrs);
138}
139EXPORT_SYMBOL(msrs_free);
140
123/* These "safe" variants are slower and should be used when the target MSR 141/* These "safe" variants are slower and should be used when the target MSR
124 may not actually exist. */ 142 may not actually exist. */
125static void __rdmsr_safe_on_cpu(void *info) 143static void __rdmsr_safe_on_cpu(void *info)
diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
index 07bcc309cfda..c0f6198565eb 100644
--- a/arch/x86/mm/kmmio.c
+++ b/arch/x86/mm/kmmio.c
@@ -5,6 +5,8 @@
5 * 2008 Pekka Paalanen <pq@iki.fi> 5 * 2008 Pekka Paalanen <pq@iki.fi>
6 */ 6 */
7 7
8#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9
8#include <linux/list.h> 10#include <linux/list.h>
9#include <linux/rculist.h> 11#include <linux/rculist.h>
10#include <linux/spinlock.h> 12#include <linux/spinlock.h>
@@ -136,7 +138,7 @@ static int clear_page_presence(struct kmmio_fault_page *f, bool clear)
136 pte_t *pte = lookup_address(f->page, &level); 138 pte_t *pte = lookup_address(f->page, &level);
137 139
138 if (!pte) { 140 if (!pte) {
139 pr_err("kmmio: no pte for page 0x%08lx\n", f->page); 141 pr_err("no pte for page 0x%08lx\n", f->page);
140 return -1; 142 return -1;
141 } 143 }
142 144
@@ -148,7 +150,7 @@ static int clear_page_presence(struct kmmio_fault_page *f, bool clear)
148 clear_pte_presence(pte, clear, &f->old_presence); 150 clear_pte_presence(pte, clear, &f->old_presence);
149 break; 151 break;
150 default: 152 default:
151 pr_err("kmmio: unexpected page level 0x%x.\n", level); 153 pr_err("unexpected page level 0x%x.\n", level);
152 return -1; 154 return -1;
153 } 155 }
154 156
@@ -170,13 +172,14 @@ static int clear_page_presence(struct kmmio_fault_page *f, bool clear)
170static int arm_kmmio_fault_page(struct kmmio_fault_page *f) 172static int arm_kmmio_fault_page(struct kmmio_fault_page *f)
171{ 173{
172 int ret; 174 int ret;
173 WARN_ONCE(f->armed, KERN_ERR "kmmio page already armed.\n"); 175 WARN_ONCE(f->armed, KERN_ERR pr_fmt("kmmio page already armed.\n"));
174 if (f->armed) { 176 if (f->armed) {
175 pr_warning("kmmio double-arm: page 0x%08lx, ref %d, old %d\n", 177 pr_warning("double-arm: page 0x%08lx, ref %d, old %d\n",
176 f->page, f->count, !!f->old_presence); 178 f->page, f->count, !!f->old_presence);
177 } 179 }
178 ret = clear_page_presence(f, true); 180 ret = clear_page_presence(f, true);
179 WARN_ONCE(ret < 0, KERN_ERR "kmmio arming 0x%08lx failed.\n", f->page); 181 WARN_ONCE(ret < 0, KERN_ERR pr_fmt("arming 0x%08lx failed.\n"),
182 f->page);
180 f->armed = true; 183 f->armed = true;
181 return ret; 184 return ret;
182} 185}
@@ -240,24 +243,21 @@ int kmmio_handler(struct pt_regs *regs, unsigned long addr)
240 * condition needs handling by do_page_fault(), the 243 * condition needs handling by do_page_fault(), the
241 * page really not being present is the most common. 244 * page really not being present is the most common.
242 */ 245 */
243 pr_debug("kmmio: secondary hit for 0x%08lx CPU %d.\n", 246 pr_debug("secondary hit for 0x%08lx CPU %d.\n",
244 addr, smp_processor_id()); 247 addr, smp_processor_id());
245 248
246 if (!faultpage->old_presence) 249 if (!faultpage->old_presence)
247 pr_info("kmmio: unexpected secondary hit for " 250 pr_info("unexpected secondary hit for address 0x%08lx on CPU %d.\n",
248 "address 0x%08lx on CPU %d.\n", addr, 251 addr, smp_processor_id());
249 smp_processor_id());
250 } else { 252 } else {
251 /* 253 /*
252 * Prevent overwriting already in-flight context. 254 * Prevent overwriting already in-flight context.
253 * This should not happen, let's hope disarming at 255 * This should not happen, let's hope disarming at
254 * least prevents a panic. 256 * least prevents a panic.
255 */ 257 */
256 pr_emerg("kmmio: recursive probe hit on CPU %d, " 258 pr_emerg("recursive probe hit on CPU %d, for address 0x%08lx. Ignoring.\n",
257 "for address 0x%08lx. Ignoring.\n", 259 smp_processor_id(), addr);
258 smp_processor_id(), addr); 260 pr_emerg("previous hit was at 0x%08lx.\n", ctx->addr);
259 pr_emerg("kmmio: previous hit was at 0x%08lx.\n",
260 ctx->addr);
261 disarm_kmmio_fault_page(faultpage); 261 disarm_kmmio_fault_page(faultpage);
262 } 262 }
263 goto no_kmmio_ctx; 263 goto no_kmmio_ctx;
@@ -316,8 +316,8 @@ static int post_kmmio_handler(unsigned long condition, struct pt_regs *regs)
316 * something external causing them (f.e. using a debugger while 316 * something external causing them (f.e. using a debugger while
317 * mmio tracing enabled), or erroneous behaviour 317 * mmio tracing enabled), or erroneous behaviour
318 */ 318 */
319 pr_warning("kmmio: unexpected debug trap on CPU %d.\n", 319 pr_warning("unexpected debug trap on CPU %d.\n",
320 smp_processor_id()); 320 smp_processor_id());
321 goto out; 321 goto out;
322 } 322 }
323 323
@@ -425,7 +425,7 @@ int register_kmmio_probe(struct kmmio_probe *p)
425 list_add_rcu(&p->list, &kmmio_probes); 425 list_add_rcu(&p->list, &kmmio_probes);
426 while (size < size_lim) { 426 while (size < size_lim) {
427 if (add_kmmio_fault_page(p->addr + size)) 427 if (add_kmmio_fault_page(p->addr + size))
428 pr_err("kmmio: Unable to set page fault.\n"); 428 pr_err("Unable to set page fault.\n");
429 size += PAGE_SIZE; 429 size += PAGE_SIZE;
430 } 430 }
431out: 431out:
@@ -490,7 +490,7 @@ static void remove_kmmio_fault_pages(struct rcu_head *head)
490 * 2. remove_kmmio_fault_pages() 490 * 2. remove_kmmio_fault_pages()
491 * Remove the pages from kmmio_page_table. 491 * Remove the pages from kmmio_page_table.
492 * 3. rcu_free_kmmio_fault_pages() 492 * 3. rcu_free_kmmio_fault_pages()
493 * Actally free the kmmio_fault_page structs as with RCU. 493 * Actually free the kmmio_fault_page structs as with RCU.
494 */ 494 */
495void unregister_kmmio_probe(struct kmmio_probe *p) 495void unregister_kmmio_probe(struct kmmio_probe *p)
496{ 496{
@@ -511,7 +511,7 @@ void unregister_kmmio_probe(struct kmmio_probe *p)
511 511
512 drelease = kmalloc(sizeof(*drelease), GFP_ATOMIC); 512 drelease = kmalloc(sizeof(*drelease), GFP_ATOMIC);
513 if (!drelease) { 513 if (!drelease) {
514 pr_crit("kmmio: leaking kmmio_fault_page objects.\n"); 514 pr_crit("leaking kmmio_fault_page objects.\n");
515 return; 515 return;
516 } 516 }
517 drelease->release_list = release_list; 517 drelease->release_list = release_list;
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 132772a8ec57..34a3291ca103 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -19,6 +19,9 @@
19 * 19 *
20 * Derived from the read-mod example from relay-examples by Tom Zanussi. 20 * Derived from the read-mod example from relay-examples by Tom Zanussi.
21 */ 21 */
22
23#define pr_fmt(fmt) "mmiotrace: " fmt
24
22#define DEBUG 1 25#define DEBUG 1
23 26
24#include <linux/module.h> 27#include <linux/module.h>
@@ -36,8 +39,6 @@
36 39
37#include "pf_in.h" 40#include "pf_in.h"
38 41
39#define NAME "mmiotrace: "
40
41struct trap_reason { 42struct trap_reason {
42 unsigned long addr; 43 unsigned long addr;
43 unsigned long ip; 44 unsigned long ip;
@@ -96,17 +97,18 @@ static void print_pte(unsigned long address)
96 pte_t *pte = lookup_address(address, &level); 97 pte_t *pte = lookup_address(address, &level);
97 98
98 if (!pte) { 99 if (!pte) {
99 pr_err(NAME "Error in %s: no pte for page 0x%08lx\n", 100 pr_err("Error in %s: no pte for page 0x%08lx\n",
100 __func__, address); 101 __func__, address);
101 return; 102 return;
102 } 103 }
103 104
104 if (level == PG_LEVEL_2M) { 105 if (level == PG_LEVEL_2M) {
105 pr_emerg(NAME "4MB pages are not currently supported: " 106 pr_emerg("4MB pages are not currently supported: 0x%08lx\n",
106 "0x%08lx\n", address); 107 address);
107 BUG(); 108 BUG();
108 } 109 }
109 pr_info(NAME "pte for 0x%lx: 0x%llx 0x%llx\n", address, 110 pr_info("pte for 0x%lx: 0x%llx 0x%llx\n",
111 address,
110 (unsigned long long)pte_val(*pte), 112 (unsigned long long)pte_val(*pte),
111 (unsigned long long)pte_val(*pte) & _PAGE_PRESENT); 113 (unsigned long long)pte_val(*pte) & _PAGE_PRESENT);
112} 114}
@@ -118,22 +120,21 @@ static void print_pte(unsigned long address)
118static void die_kmmio_nesting_error(struct pt_regs *regs, unsigned long addr) 120static void die_kmmio_nesting_error(struct pt_regs *regs, unsigned long addr)
119{ 121{
120 const struct trap_reason *my_reason = &get_cpu_var(pf_reason); 122 const struct trap_reason *my_reason = &get_cpu_var(pf_reason);
121 pr_emerg(NAME "unexpected fault for address: 0x%08lx, " 123 pr_emerg("unexpected fault for address: 0x%08lx, last fault for address: 0x%08lx\n",
122 "last fault for address: 0x%08lx\n", 124 addr, my_reason->addr);
123 addr, my_reason->addr);
124 print_pte(addr); 125 print_pte(addr);
125 print_symbol(KERN_EMERG "faulting IP is at %s\n", regs->ip); 126 print_symbol(KERN_EMERG "faulting IP is at %s\n", regs->ip);
126 print_symbol(KERN_EMERG "last faulting IP was at %s\n", my_reason->ip); 127 print_symbol(KERN_EMERG "last faulting IP was at %s\n", my_reason->ip);
127#ifdef __i386__ 128#ifdef __i386__
128 pr_emerg("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", 129 pr_emerg("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
129 regs->ax, regs->bx, regs->cx, regs->dx); 130 regs->ax, regs->bx, regs->cx, regs->dx);
130 pr_emerg("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", 131 pr_emerg("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
131 regs->si, regs->di, regs->bp, regs->sp); 132 regs->si, regs->di, regs->bp, regs->sp);
132#else 133#else
133 pr_emerg("rax: %016lx rcx: %016lx rdx: %016lx\n", 134 pr_emerg("rax: %016lx rcx: %016lx rdx: %016lx\n",
134 regs->ax, regs->cx, regs->dx); 135 regs->ax, regs->cx, regs->dx);
135 pr_emerg("rsi: %016lx rdi: %016lx rbp: %016lx rsp: %016lx\n", 136 pr_emerg("rsi: %016lx rdi: %016lx rbp: %016lx rsp: %016lx\n",
136 regs->si, regs->di, regs->bp, regs->sp); 137 regs->si, regs->di, regs->bp, regs->sp);
137#endif 138#endif
138 put_cpu_var(pf_reason); 139 put_cpu_var(pf_reason);
139 BUG(); 140 BUG();
@@ -213,7 +214,7 @@ static void post(struct kmmio_probe *p, unsigned long condition,
213 /* this should always return the active_trace count to 0 */ 214 /* this should always return the active_trace count to 0 */
214 my_reason->active_traces--; 215 my_reason->active_traces--;
215 if (my_reason->active_traces) { 216 if (my_reason->active_traces) {
216 pr_emerg(NAME "unexpected post handler"); 217 pr_emerg("unexpected post handler");
217 BUG(); 218 BUG();
218 } 219 }
219 220
@@ -244,7 +245,7 @@ static void ioremap_trace_core(resource_size_t offset, unsigned long size,
244 }; 245 };
245 246
246 if (!trace) { 247 if (!trace) {
247 pr_err(NAME "kmalloc failed in ioremap\n"); 248 pr_err("kmalloc failed in ioremap\n");
248 return; 249 return;
249 } 250 }
250 251
@@ -282,8 +283,8 @@ void mmiotrace_ioremap(resource_size_t offset, unsigned long size,
282 if (!is_enabled()) /* recheck and proper locking in *_core() */ 283 if (!is_enabled()) /* recheck and proper locking in *_core() */
283 return; 284 return;
284 285
285 pr_debug(NAME "ioremap_*(0x%llx, 0x%lx) = %p\n", 286 pr_debug("ioremap_*(0x%llx, 0x%lx) = %p\n",
286 (unsigned long long)offset, size, addr); 287 (unsigned long long)offset, size, addr);
287 if ((filter_offset) && (offset != filter_offset)) 288 if ((filter_offset) && (offset != filter_offset))
288 return; 289 return;
289 ioremap_trace_core(offset, size, addr); 290 ioremap_trace_core(offset, size, addr);
@@ -301,7 +302,7 @@ static void iounmap_trace_core(volatile void __iomem *addr)
301 struct remap_trace *tmp; 302 struct remap_trace *tmp;
302 struct remap_trace *found_trace = NULL; 303 struct remap_trace *found_trace = NULL;
303 304
304 pr_debug(NAME "Unmapping %p.\n", addr); 305 pr_debug("Unmapping %p.\n", addr);
305 306
306 spin_lock_irq(&trace_lock); 307 spin_lock_irq(&trace_lock);
307 if (!is_enabled()) 308 if (!is_enabled())
@@ -363,9 +364,8 @@ static void clear_trace_list(void)
363 * Caller also ensures is_enabled() cannot change. 364 * Caller also ensures is_enabled() cannot change.
364 */ 365 */
365 list_for_each_entry(trace, &trace_list, list) { 366 list_for_each_entry(trace, &trace_list, list) {
366 pr_notice(NAME "purging non-iounmapped " 367 pr_notice("purging non-iounmapped trace @0x%08lx, size 0x%lx.\n",
367 "trace @0x%08lx, size 0x%lx.\n", 368 trace->probe.addr, trace->probe.len);
368 trace->probe.addr, trace->probe.len);
369 if (!nommiotrace) 369 if (!nommiotrace)
370 unregister_kmmio_probe(&trace->probe); 370 unregister_kmmio_probe(&trace->probe);
371 } 371 }
@@ -387,7 +387,7 @@ static void enter_uniprocessor(void)
387 387
388 if (downed_cpus == NULL && 388 if (downed_cpus == NULL &&
389 !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) { 389 !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
390 pr_notice(NAME "Failed to allocate mask\n"); 390 pr_notice("Failed to allocate mask\n");
391 goto out; 391 goto out;
392 } 392 }
393 393
@@ -395,20 +395,19 @@ static void enter_uniprocessor(void)
395 cpumask_copy(downed_cpus, cpu_online_mask); 395 cpumask_copy(downed_cpus, cpu_online_mask);
396 cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus); 396 cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
397 if (num_online_cpus() > 1) 397 if (num_online_cpus() > 1)
398 pr_notice(NAME "Disabling non-boot CPUs...\n"); 398 pr_notice("Disabling non-boot CPUs...\n");
399 put_online_cpus(); 399 put_online_cpus();
400 400
401 for_each_cpu(cpu, downed_cpus) { 401 for_each_cpu(cpu, downed_cpus) {
402 err = cpu_down(cpu); 402 err = cpu_down(cpu);
403 if (!err) 403 if (!err)
404 pr_info(NAME "CPU%d is down.\n", cpu); 404 pr_info("CPU%d is down.\n", cpu);
405 else 405 else
406 pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err); 406 pr_err("Error taking CPU%d down: %d\n", cpu, err);
407 } 407 }
408out: 408out:
409 if (num_online_cpus() > 1) 409 if (num_online_cpus() > 1)
410 pr_warning(NAME "multiple CPUs still online, " 410 pr_warning("multiple CPUs still online, may miss events.\n");
411 "may miss events.\n");
412} 411}
413 412
414/* __ref because leave_uniprocessor calls cpu_up which is __cpuinit, 413/* __ref because leave_uniprocessor calls cpu_up which is __cpuinit,
@@ -420,13 +419,13 @@ static void __ref leave_uniprocessor(void)
420 419
421 if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0) 420 if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
422 return; 421 return;
423 pr_notice(NAME "Re-enabling CPUs...\n"); 422 pr_notice("Re-enabling CPUs...\n");
424 for_each_cpu(cpu, downed_cpus) { 423 for_each_cpu(cpu, downed_cpus) {
425 err = cpu_up(cpu); 424 err = cpu_up(cpu);
426 if (!err) 425 if (!err)
427 pr_info(NAME "enabled CPU%d.\n", cpu); 426 pr_info("enabled CPU%d.\n", cpu);
428 else 427 else
429 pr_err(NAME "cannot re-enable CPU%d: %d\n", cpu, err); 428 pr_err("cannot re-enable CPU%d: %d\n", cpu, err);
430 } 429 }
431} 430}
432 431
@@ -434,8 +433,8 @@ static void __ref leave_uniprocessor(void)
434static void enter_uniprocessor(void) 433static void enter_uniprocessor(void)
435{ 434{
436 if (num_online_cpus() > 1) 435 if (num_online_cpus() > 1)
437 pr_warning(NAME "multiple CPUs are online, may miss events. " 436 pr_warning("multiple CPUs are online, may miss events. "
438 "Suggest booting with maxcpus=1 kernel argument.\n"); 437 "Suggest booting with maxcpus=1 kernel argument.\n");
439} 438}
440 439
441static void leave_uniprocessor(void) 440static void leave_uniprocessor(void)
@@ -450,13 +449,13 @@ void enable_mmiotrace(void)
450 goto out; 449 goto out;
451 450
452 if (nommiotrace) 451 if (nommiotrace)
453 pr_info(NAME "MMIO tracing disabled.\n"); 452 pr_info("MMIO tracing disabled.\n");
454 kmmio_init(); 453 kmmio_init();
455 enter_uniprocessor(); 454 enter_uniprocessor();
456 spin_lock_irq(&trace_lock); 455 spin_lock_irq(&trace_lock);
457 atomic_inc(&mmiotrace_enabled); 456 atomic_inc(&mmiotrace_enabled);
458 spin_unlock_irq(&trace_lock); 457 spin_unlock_irq(&trace_lock);
459 pr_info(NAME "enabled.\n"); 458 pr_info("enabled.\n");
460out: 459out:
461 mutex_unlock(&mmiotrace_mutex); 460 mutex_unlock(&mmiotrace_mutex);
462} 461}
@@ -475,7 +474,7 @@ void disable_mmiotrace(void)
475 clear_trace_list(); /* guarantees: no more kmmio callbacks */ 474 clear_trace_list(); /* guarantees: no more kmmio callbacks */
476 leave_uniprocessor(); 475 leave_uniprocessor();
477 kmmio_cleanup(); 476 kmmio_cleanup();
478 pr_info(NAME "disabled.\n"); 477 pr_info("disabled.\n");
479out: 478out:
480 mutex_unlock(&mmiotrace_mutex); 479 mutex_unlock(&mmiotrace_mutex);
481} 480}
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 66b55d6e69ed..ae9648eb1c7f 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -704,9 +704,8 @@ int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,
704 if (!range_is_allowed(pfn, size)) 704 if (!range_is_allowed(pfn, size))
705 return 0; 705 return 0;
706 706
707 if (file->f_flags & O_SYNC) { 707 if (file->f_flags & O_DSYNC)
708 flags = _PAGE_CACHE_UC_MINUS; 708 flags = _PAGE_CACHE_UC_MINUS;
709 }
710 709
711#ifdef CONFIG_X86_32 710#ifdef CONFIG_X86_32
712 /* 711 /*
diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index d49202e740ea..564b008a51c7 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -15,3 +15,8 @@ obj-$(CONFIG_X86_NUMAQ) += numaq_32.o
15 15
16obj-y += common.o early.o 16obj-y += common.o early.o
17obj-y += amd_bus.o 17obj-y += amd_bus.o
18obj-$(CONFIG_X86_64) += bus_numa.o intel_bus.o
19
20ifeq ($(CONFIG_PCI_DEBUG),y)
21EXTRA_CFLAGS += -DDEBUG
22endif
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 1014eb4bfc37..959e548a7039 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -7,6 +7,7 @@
7#include <asm/pci_x86.h> 7#include <asm/pci_x86.h>
8 8
9struct pci_root_info { 9struct pci_root_info {
10 struct acpi_device *bridge;
10 char *name; 11 char *name;
11 unsigned int res_num; 12 unsigned int res_num;
12 struct resource *res; 13 struct resource *res;
@@ -58,6 +59,30 @@ bus_has_transparent_bridge(struct pci_bus *bus)
58 return false; 59 return false;
59} 60}
60 61
62static void
63align_resource(struct acpi_device *bridge, struct resource *res)
64{
65 int align = (res->flags & IORESOURCE_MEM) ? 16 : 4;
66
67 /*
68 * Host bridge windows are not BARs, but the decoders on the PCI side
69 * that claim this address space have starting alignment and length
70 * constraints, so fix any obvious BIOS goofs.
71 */
72 if (!IS_ALIGNED(res->start, align)) {
73 dev_printk(KERN_DEBUG, &bridge->dev,
74 "host bridge window %pR invalid; "
75 "aligning start to %d-byte boundary\n", res, align);
76 res->start &= ~(align - 1);
77 }
78 if (!IS_ALIGNED(res->end + 1, align)) {
79 dev_printk(KERN_DEBUG, &bridge->dev,
80 "host bridge window %pR invalid; "
81 "aligning end to %d-byte boundary\n", res, align);
82 res->end = ALIGN(res->end, align) - 1;
83 }
84}
85
61static acpi_status 86static acpi_status
62setup_resource(struct acpi_resource *acpi_res, void *data) 87setup_resource(struct acpi_resource *acpi_res, void *data)
63{ 88{
@@ -91,11 +116,12 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
91 start = addr.minimum + addr.translation_offset; 116 start = addr.minimum + addr.translation_offset;
92 end = start + addr.address_length - 1; 117 end = start + addr.address_length - 1;
93 if (info->res_num >= max_root_bus_resources) { 118 if (info->res_num >= max_root_bus_resources) {
94 printk(KERN_WARNING "PCI: Failed to allocate 0x%lx-0x%lx " 119 if (pci_probe & PCI_USE__CRS)
95 "from %s for %s due to _CRS returning more than " 120 printk(KERN_WARNING "PCI: Failed to allocate "
96 "%d resource descriptors\n", (unsigned long) start, 121 "0x%lx-0x%lx from %s for %s due to _CRS "
97 (unsigned long) end, root->name, info->name, 122 "returning more than %d resource descriptors\n",
98 max_root_bus_resources); 123 (unsigned long) start, (unsigned long) end,
124 root->name, info->name, max_root_bus_resources);
99 return AE_OK; 125 return AE_OK;
100 } 126 }
101 127
@@ -105,14 +131,28 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
105 res->start = start; 131 res->start = start;
106 res->end = end; 132 res->end = end;
107 res->child = NULL; 133 res->child = NULL;
134 align_resource(info->bridge, res);
135
136 if (!(pci_probe & PCI_USE__CRS)) {
137 dev_printk(KERN_DEBUG, &info->bridge->dev,
138 "host bridge window %pR (ignored)\n", res);
139 return AE_OK;
140 }
108 141
109 if (insert_resource(root, res)) { 142 if (insert_resource(root, res)) {
110 printk(KERN_ERR "PCI: Failed to allocate 0x%lx-0x%lx " 143 dev_err(&info->bridge->dev,
111 "from %s for %s\n", (unsigned long) res->start, 144 "can't allocate host bridge window %pR\n", res);
112 (unsigned long) res->end, root->name, info->name);
113 } else { 145 } else {
114 info->bus->resource[info->res_num] = res; 146 info->bus->resource[info->res_num] = res;
115 info->res_num++; 147 info->res_num++;
148 if (addr.translation_offset)
149 dev_info(&info->bridge->dev, "host bridge window %pR "
150 "(PCI address [%#llx-%#llx])\n",
151 res, res->start - addr.translation_offset,
152 res->end - addr.translation_offset);
153 else
154 dev_info(&info->bridge->dev,
155 "host bridge window %pR\n", res);
116 } 156 }
117 return AE_OK; 157 return AE_OK;
118} 158}
@@ -124,6 +164,12 @@ get_current_resources(struct acpi_device *device, int busnum,
124 struct pci_root_info info; 164 struct pci_root_info info;
125 size_t size; 165 size_t size;
126 166
167 if (!(pci_probe & PCI_USE__CRS))
168 dev_info(&device->dev,
169 "ignoring host bridge windows from ACPI; "
170 "boot with \"pci=use_crs\" to use them\n");
171
172 info.bridge = device;
127 info.bus = bus; 173 info.bus = bus;
128 info.res_num = 0; 174 info.res_num = 0;
129 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource, 175 acpi_walk_resources(device->handle, METHOD_NAME__CRS, count_resource,
@@ -163,8 +209,9 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
163#endif 209#endif
164 210
165 if (domain && !pci_domains_supported) { 211 if (domain && !pci_domains_supported) {
166 printk(KERN_WARNING "PCI: Multiple domains not supported " 212 printk(KERN_WARNING "pci_bus %04x:%02x: "
167 "(dom %d, bus %d)\n", domain, busnum); 213 "ignored (multiple domains not supported)\n",
214 domain, busnum);
168 return NULL; 215 return NULL;
169 } 216 }
170 217
@@ -188,7 +235,8 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
188 */ 235 */
189 sd = kzalloc(sizeof(*sd), GFP_KERNEL); 236 sd = kzalloc(sizeof(*sd), GFP_KERNEL);
190 if (!sd) { 237 if (!sd) {
191 printk(KERN_ERR "PCI: OOM, not probing PCI bus %02x\n", busnum); 238 printk(KERN_WARNING "pci_bus %04x:%02x: "
239 "ignored (out of memory)\n", domain, busnum);
192 return NULL; 240 return NULL;
193 } 241 }
194 242
@@ -209,9 +257,7 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do
209 } else { 257 } else {
210 bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); 258 bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd);
211 if (bus) { 259 if (bus) {
212 if (pci_probe & PCI_USE__CRS) 260 get_current_resources(device, busnum, domain, bus);
213 get_current_resources(device, busnum, domain,
214 bus);
215 bus->subordinate = pci_scan_child_bus(bus); 261 bus->subordinate = pci_scan_child_bus(bus);
216 } 262 }
217 } 263 }
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index 572ee9782f2a..95ecbd495955 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -6,10 +6,10 @@
6 6
7#ifdef CONFIG_X86_64 7#ifdef CONFIG_X86_64
8#include <asm/pci-direct.h> 8#include <asm/pci-direct.h>
9#include <asm/mpspec.h>
10#include <linux/cpumask.h>
11#endif 9#endif
12 10
11#include "bus_numa.h"
12
13/* 13/*
14 * This discovers the pcibus <-> node mapping on AMD K8. 14 * This discovers the pcibus <-> node mapping on AMD K8.
15 * also get peer root bus resource for io,mmio 15 * also get peer root bus resource for io,mmio
@@ -17,67 +17,6 @@
17 17
18#ifdef CONFIG_X86_64 18#ifdef CONFIG_X86_64
19 19
20/*
21 * sub bus (transparent) will use entres from 3 to store extra from root,
22 * so need to make sure have enought slot there, increase PCI_BUS_NUM_RESOURCES?
23 */
24#define RES_NUM 16
25struct pci_root_info {
26 char name[12];
27 unsigned int res_num;
28 struct resource res[RES_NUM];
29 int bus_min;
30 int bus_max;
31 int node;
32 int link;
33};
34
35/* 4 at this time, it may become to 32 */
36#define PCI_ROOT_NR 4
37static int pci_root_num;
38static struct pci_root_info pci_root_info[PCI_ROOT_NR];
39
40void x86_pci_root_bus_res_quirks(struct pci_bus *b)
41{
42 int i;
43 int j;
44 struct pci_root_info *info;
45
46 /* don't go for it if _CRS is used already */
47 if (b->resource[0] != &ioport_resource ||
48 b->resource[1] != &iomem_resource)
49 return;
50
51 /* if only one root bus, don't need to anything */
52 if (pci_root_num < 2)
53 return;
54
55 for (i = 0; i < pci_root_num; i++) {
56 if (pci_root_info[i].bus_min == b->number)
57 break;
58 }
59
60 if (i == pci_root_num)
61 return;
62
63 printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n",
64 b->number);
65
66 info = &pci_root_info[i];
67 for (j = 0; j < info->res_num; j++) {
68 struct resource *res;
69 struct resource *root;
70
71 res = &info->res[j];
72 b->resource[j] = res;
73 if (res->flags & IORESOURCE_IO)
74 root = &ioport_resource;
75 else
76 root = &iomem_resource;
77 insert_resource(root, res);
78 }
79}
80
81#define RANGE_NUM 16 20#define RANGE_NUM 16
82 21
83struct res_range { 22struct res_range {
@@ -130,52 +69,6 @@ static void __init update_range(struct res_range *range, size_t start,
130 } 69 }
131} 70}
132 71
133static void __init update_res(struct pci_root_info *info, size_t start,
134 size_t end, unsigned long flags, int merge)
135{
136 int i;
137 struct resource *res;
138
139 if (!merge)
140 goto addit;
141
142 /* try to merge it with old one */
143 for (i = 0; i < info->res_num; i++) {
144 size_t final_start, final_end;
145 size_t common_start, common_end;
146
147 res = &info->res[i];
148 if (res->flags != flags)
149 continue;
150
151 common_start = max((size_t)res->start, start);
152 common_end = min((size_t)res->end, end);
153 if (common_start > common_end + 1)
154 continue;
155
156 final_start = min((size_t)res->start, start);
157 final_end = max((size_t)res->end, end);
158
159 res->start = final_start;
160 res->end = final_end;
161 return;
162 }
163
164addit:
165
166 /* need to add that */
167 if (info->res_num >= RES_NUM)
168 return;
169
170 res = &info->res[info->res_num];
171 res->name = info->name;
172 res->flags = flags;
173 res->start = start;
174 res->end = end;
175 res->child = NULL;
176 info->res_num++;
177}
178
179struct pci_hostbridge_probe { 72struct pci_hostbridge_probe {
180 u32 bus; 73 u32 bus;
181 u32 slot; 74 u32 slot;
@@ -230,7 +123,6 @@ static int __init early_fill_mp_bus_info(void)
230 int j; 123 int j;
231 unsigned bus; 124 unsigned bus;
232 unsigned slot; 125 unsigned slot;
233 int found;
234 int node; 126 int node;
235 int link; 127 int link;
236 int def_node; 128 int def_node;
@@ -247,7 +139,7 @@ static int __init early_fill_mp_bus_info(void)
247 if (!early_pci_allowed()) 139 if (!early_pci_allowed())
248 return -1; 140 return -1;
249 141
250 found = 0; 142 found_all_numa_early = 0;
251 for (i = 0; i < ARRAY_SIZE(pci_probes); i++) { 143 for (i = 0; i < ARRAY_SIZE(pci_probes); i++) {
252 u32 id; 144 u32 id;
253 u16 device; 145 u16 device;
@@ -261,12 +153,12 @@ static int __init early_fill_mp_bus_info(void)
261 device = (id>>16) & 0xffff; 153 device = (id>>16) & 0xffff;
262 if (pci_probes[i].vendor == vendor && 154 if (pci_probes[i].vendor == vendor &&
263 pci_probes[i].device == device) { 155 pci_probes[i].device == device) {
264 found = 1; 156 found_all_numa_early = 1;
265 break; 157 break;
266 } 158 }
267 } 159 }
268 160
269 if (!found) 161 if (!found_all_numa_early)
270 return 0; 162 return 0;
271 163
272 pci_root_num = 0; 164 pci_root_num = 0;
@@ -488,7 +380,7 @@ static int __init early_fill_mp_bus_info(void)
488 info = &pci_root_info[i]; 380 info = &pci_root_info[i];
489 res_num = info->res_num; 381 res_num = info->res_num;
490 busnum = info->bus_min; 382 busnum = info->bus_min;
491 printk(KERN_DEBUG "bus: [%02x,%02x] on node %x link %x\n", 383 printk(KERN_DEBUG "bus: [%02x, %02x] on node %x link %x\n",
492 info->bus_min, info->bus_max, info->node, info->link); 384 info->bus_min, info->bus_max, info->node, info->link);
493 for (j = 0; j < res_num; j++) { 385 for (j = 0; j < res_num; j++) {
494 res = &info->res[j]; 386 res = &info->res[j];
diff --git a/arch/x86/pci/bus_numa.c b/arch/x86/pci/bus_numa.c
new file mode 100644
index 000000000000..145df00e0387
--- /dev/null
+++ b/arch/x86/pci/bus_numa.c
@@ -0,0 +1,101 @@
1#include <linux/init.h>
2#include <linux/pci.h>
3
4#include "bus_numa.h"
5
6int pci_root_num;
7struct pci_root_info pci_root_info[PCI_ROOT_NR];
8int found_all_numa_early;
9
10void x86_pci_root_bus_res_quirks(struct pci_bus *b)
11{
12 int i;
13 int j;
14 struct pci_root_info *info;
15
16 /* don't go for it if _CRS is used already */
17 if (b->resource[0] != &ioport_resource ||
18 b->resource[1] != &iomem_resource)
19 return;
20
21 if (!pci_root_num)
22 return;
23
24 /* for amd, if only one root bus, don't need to do anything */
25 if (pci_root_num < 2 && found_all_numa_early)
26 return;
27
28 for (i = 0; i < pci_root_num; i++) {
29 if (pci_root_info[i].bus_min == b->number)
30 break;
31 }
32
33 if (i == pci_root_num)
34 return;
35
36 printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n",
37 b->number);
38
39 info = &pci_root_info[i];
40 for (j = 0; j < info->res_num; j++) {
41 struct resource *res;
42 struct resource *root;
43
44 res = &info->res[j];
45 b->resource[j] = res;
46 if (res->flags & IORESOURCE_IO)
47 root = &ioport_resource;
48 else
49 root = &iomem_resource;
50 insert_resource(root, res);
51 }
52}
53
54void __init update_res(struct pci_root_info *info, size_t start,
55 size_t end, unsigned long flags, int merge)
56{
57 int i;
58 struct resource *res;
59
60 if (start > end)
61 return;
62
63 if (!merge)
64 goto addit;
65
66 /* try to merge it with old one */
67 for (i = 0; i < info->res_num; i++) {
68 size_t final_start, final_end;
69 size_t common_start, common_end;
70
71 res = &info->res[i];
72 if (res->flags != flags)
73 continue;
74
75 common_start = max((size_t)res->start, start);
76 common_end = min((size_t)res->end, end);
77 if (common_start > common_end + 1)
78 continue;
79
80 final_start = min((size_t)res->start, start);
81 final_end = max((size_t)res->end, end);
82
83 res->start = final_start;
84 res->end = final_end;
85 return;
86 }
87
88addit:
89
90 /* need to add that */
91 if (info->res_num >= RES_NUM)
92 return;
93
94 res = &info->res[info->res_num];
95 res->name = info->name;
96 res->flags = flags;
97 res->start = start;
98 res->end = end;
99 res->child = NULL;
100 info->res_num++;
101}
diff --git a/arch/x86/pci/bus_numa.h b/arch/x86/pci/bus_numa.h
new file mode 100644
index 000000000000..adbc23fe82ac
--- /dev/null
+++ b/arch/x86/pci/bus_numa.h
@@ -0,0 +1,27 @@
1#ifdef CONFIG_X86_64
2
3/*
4 * sub bus (transparent) will use entres from 3 to store extra from
5 * root, so need to make sure we have enough slot there, Should we
6 * increase PCI_BUS_NUM_RESOURCES?
7 */
8#define RES_NUM 16
9struct pci_root_info {
10 char name[12];
11 unsigned int res_num;
12 struct resource res[RES_NUM];
13 int bus_min;
14 int bus_max;
15 int node;
16 int link;
17};
18
19/* 4 at this time, it may become to 32 */
20#define PCI_ROOT_NR 4
21extern int pci_root_num;
22extern struct pci_root_info pci_root_info[PCI_ROOT_NR];
23extern int found_all_numa_early;
24
25extern void update_res(struct pci_root_info *info, size_t start,
26 size_t end, unsigned long flags, int merge);
27#endif
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 1331fcf26143..d2552c68e94d 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -410,8 +410,6 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
410 return bus; 410 return bus;
411} 411}
412 412
413extern u8 pci_cache_line_size;
414
415int __init pcibios_init(void) 413int __init pcibios_init(void)
416{ 414{
417 struct cpuinfo_x86 *c = &boot_cpu_data; 415 struct cpuinfo_x86 *c = &boot_cpu_data;
@@ -422,15 +420,19 @@ int __init pcibios_init(void)
422 } 420 }
423 421
424 /* 422 /*
425 * Assume PCI cacheline size of 32 bytes for all x86s except K7/K8 423 * Set PCI cacheline size to that of the CPU if the CPU has reported it.
426 * and P4. It's also good for 386/486s (which actually have 16) 424 * (For older CPUs that don't support cpuid, we se it to 32 bytes
425 * It's also good for 386/486s (which actually have 16)
427 * as quite a few PCI devices do not support smaller values. 426 * as quite a few PCI devices do not support smaller values.
428 */ 427 */
429 pci_cache_line_size = 32 >> 2; 428 if (c->x86_clflush_size > 0) {
430 if (c->x86 >= 6 && c->x86_vendor == X86_VENDOR_AMD) 429 pci_dfl_cache_line_size = c->x86_clflush_size >> 2;
431 pci_cache_line_size = 64 >> 2; /* K7 & K8 */ 430 printk(KERN_DEBUG "PCI: pci_cache_line_size set to %d bytes\n",
432 else if (c->x86 > 6 && c->x86_vendor == X86_VENDOR_INTEL) 431 pci_dfl_cache_line_size << 2);
433 pci_cache_line_size = 128 >> 2; /* P4 */ 432 } else {
433 pci_dfl_cache_line_size = 32 >> 2;
434 printk(KERN_DEBUG "PCI: Unknown cacheline size. Setting to 32 bytes\n");
435 }
434 436
435 pcibios_resource_survey(); 437 pcibios_resource_survey();
436 438
diff --git a/arch/x86/pci/early.c b/arch/x86/pci/early.c
index aaf26ae58cd5..d1067d539bee 100644
--- a/arch/x86/pci/early.c
+++ b/arch/x86/pci/early.c
@@ -12,8 +12,6 @@ u32 read_pci_config(u8 bus, u8 slot, u8 func, u8 offset)
12 u32 v; 12 u32 v;
13 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 13 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
14 v = inl(0xcfc); 14 v = inl(0xcfc);
15 if (v != 0xffffffff)
16 pr_debug("%x reading 4 from %x: %x\n", slot, offset, v);
17 return v; 15 return v;
18} 16}
19 17
@@ -22,7 +20,6 @@ u8 read_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset)
22 u8 v; 20 u8 v;
23 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 21 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
24 v = inb(0xcfc + (offset&3)); 22 v = inb(0xcfc + (offset&3));
25 pr_debug("%x reading 1 from %x: %x\n", slot, offset, v);
26 return v; 23 return v;
27} 24}
28 25
@@ -31,28 +28,24 @@ u16 read_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset)
31 u16 v; 28 u16 v;
32 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 29 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
33 v = inw(0xcfc + (offset&2)); 30 v = inw(0xcfc + (offset&2));
34 pr_debug("%x reading 2 from %x: %x\n", slot, offset, v);
35 return v; 31 return v;
36} 32}
37 33
38void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset, 34void write_pci_config(u8 bus, u8 slot, u8 func, u8 offset,
39 u32 val) 35 u32 val)
40{ 36{
41 pr_debug("%x writing to %x: %x\n", slot, offset, val);
42 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 37 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
43 outl(val, 0xcfc); 38 outl(val, 0xcfc);
44} 39}
45 40
46void write_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset, u8 val) 41void write_pci_config_byte(u8 bus, u8 slot, u8 func, u8 offset, u8 val)
47{ 42{
48 pr_debug("%x writing to %x: %x\n", slot, offset, val);
49 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 43 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
50 outb(val, 0xcfc + (offset&3)); 44 outb(val, 0xcfc + (offset&3));
51} 45}
52 46
53void write_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset, u16 val) 47void write_pci_config_16(u8 bus, u8 slot, u8 func, u8 offset, u16 val)
54{ 48{
55 pr_debug("%x writing to %x: %x\n", slot, offset, val);
56 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8); 49 outl(0x80000000 | (bus<<16) | (slot<<11) | (func<<8) | offset, 0xcf8);
57 outw(val, 0xcfc + (offset&2)); 50 outw(val, 0xcfc + (offset&2));
58} 51}
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index b22d13b0c71d..5dc9e8c63fcd 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -129,7 +129,9 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
129 continue; 129 continue;
130 if (!r->start || 130 if (!r->start ||
131 pci_claim_resource(dev, idx) < 0) { 131 pci_claim_resource(dev, idx) < 0) {
132 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); 132 dev_info(&dev->dev,
133 "can't reserve window %pR\n",
134 r);
133 /* 135 /*
134 * Something is wrong with the region. 136 * Something is wrong with the region.
135 * Invalidate the resource to prevent 137 * Invalidate the resource to prevent
@@ -144,16 +146,29 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
144 } 146 }
145} 147}
146 148
149struct pci_check_idx_range {
150 int start;
151 int end;
152};
153
147static void __init pcibios_allocate_resources(int pass) 154static void __init pcibios_allocate_resources(int pass)
148{ 155{
149 struct pci_dev *dev = NULL; 156 struct pci_dev *dev = NULL;
150 int idx, disabled; 157 int idx, disabled, i;
151 u16 command; 158 u16 command;
152 struct resource *r; 159 struct resource *r;
153 160
161 struct pci_check_idx_range idx_range[] = {
162 { PCI_STD_RESOURCES, PCI_STD_RESOURCE_END },
163#ifdef CONFIG_PCI_IOV
164 { PCI_IOV_RESOURCES, PCI_IOV_RESOURCE_END },
165#endif
166 };
167
154 for_each_pci_dev(dev) { 168 for_each_pci_dev(dev) {
155 pci_read_config_word(dev, PCI_COMMAND, &command); 169 pci_read_config_word(dev, PCI_COMMAND, &command);
156 for (idx = 0; idx < PCI_ROM_RESOURCE; idx++) { 170 for (i = 0; i < ARRAY_SIZE(idx_range); i++)
171 for (idx = idx_range[i].start; idx <= idx_range[i].end; idx++) {
157 r = &dev->resource[idx]; 172 r = &dev->resource[idx];
158 if (r->parent) /* Already allocated */ 173 if (r->parent) /* Already allocated */
159 continue; 174 continue;
@@ -164,12 +179,12 @@ static void __init pcibios_allocate_resources(int pass)
164 else 179 else
165 disabled = !(command & PCI_COMMAND_MEMORY); 180 disabled = !(command & PCI_COMMAND_MEMORY);
166 if (pass == disabled) { 181 if (pass == disabled) {
167 dev_dbg(&dev->dev, "resource %#08llx-%#08llx (f=%lx, d=%d, p=%d)\n", 182 dev_dbg(&dev->dev,
168 (unsigned long long) r->start, 183 "BAR %d: reserving %pr (d=%d, p=%d)\n",
169 (unsigned long long) r->end, 184 idx, r, disabled, pass);
170 r->flags, disabled, pass);
171 if (pci_claim_resource(dev, idx) < 0) { 185 if (pci_claim_resource(dev, idx) < 0) {
172 dev_info(&dev->dev, "BAR %d: can't allocate resource\n", idx); 186 dev_info(&dev->dev,
187 "can't reserve %pR\n", r);
173 /* We'll assign a new address later */ 188 /* We'll assign a new address later */
174 r->end -= r->start; 189 r->end -= r->start;
175 r->start = 0; 190 r->start = 0;
@@ -182,7 +197,7 @@ static void __init pcibios_allocate_resources(int pass)
182 /* Turn the ROM off, leave the resource region, 197 /* Turn the ROM off, leave the resource region,
183 * but keep it unregistered. */ 198 * but keep it unregistered. */
184 u32 reg; 199 u32 reg;
185 dev_dbg(&dev->dev, "disabling ROM\n"); 200 dev_dbg(&dev->dev, "disabling ROM %pR\n", r);
186 r->flags &= ~IORESOURCE_ROM_ENABLE; 201 r->flags &= ~IORESOURCE_ROM_ENABLE;
187 pci_read_config_dword(dev, 202 pci_read_config_dword(dev,
188 dev->rom_base_reg, &reg); 203 dev->rom_base_reg, &reg);
@@ -282,6 +297,15 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
282 return -EINVAL; 297 return -EINVAL;
283 298
284 prot = pgprot_val(vma->vm_page_prot); 299 prot = pgprot_val(vma->vm_page_prot);
300
301 /*
302 * Return error if pat is not enabled and write_combine is requested.
303 * Caller can followup with UC MINUS request and add a WC mtrr if there
304 * is a free mtrr slot.
305 */
306 if (!pat_enabled && write_combine)
307 return -EINVAL;
308
285 if (pat_enabled && write_combine) 309 if (pat_enabled && write_combine)
286 prot |= _PAGE_CACHE_WC; 310 prot |= _PAGE_CACHE_WC;
287 else if (pat_enabled || boot_cpu_data.x86 > 3) 311 else if (pat_enabled || boot_cpu_data.x86 > 3)
diff --git a/arch/x86/pci/intel_bus.c b/arch/x86/pci/intel_bus.c
new file mode 100644
index 000000000000..b7a55dc55d13
--- /dev/null
+++ b/arch/x86/pci/intel_bus.c
@@ -0,0 +1,90 @@
1/*
2 * to read io range from IOH pci conf, need to do it after mmconfig is there
3 */
4
5#include <linux/delay.h>
6#include <linux/dmi.h>
7#include <linux/pci.h>
8#include <linux/init.h>
9#include <asm/pci_x86.h>
10
11#include "bus_numa.h"
12
13static inline void print_ioh_resources(struct pci_root_info *info)
14{
15 int res_num;
16 int busnum;
17 int i;
18
19 printk(KERN_DEBUG "IOH bus: [%02x, %02x]\n",
20 info->bus_min, info->bus_max);
21 res_num = info->res_num;
22 busnum = info->bus_min;
23 for (i = 0; i < res_num; i++) {
24 struct resource *res;
25
26 res = &info->res[i];
27 printk(KERN_DEBUG "IOH bus: %02x index %x %s: [%llx, %llx]\n",
28 busnum, i,
29 (res->flags & IORESOURCE_IO) ? "io port" :
30 "mmio",
31 res->start, res->end);
32 }
33}
34
35#define IOH_LIO 0x108
36#define IOH_LMMIOL 0x10c
37#define IOH_LMMIOH 0x110
38#define IOH_LMMIOH_BASEU 0x114
39#define IOH_LMMIOH_LIMITU 0x118
40#define IOH_LCFGBUS 0x11c
41
42static void __devinit pci_root_bus_res(struct pci_dev *dev)
43{
44 u16 word;
45 u32 dword;
46 struct pci_root_info *info;
47 u16 io_base, io_end;
48 u32 mmiol_base, mmiol_end;
49 u64 mmioh_base, mmioh_end;
50 int bus_base, bus_end;
51
52 if (pci_root_num >= PCI_ROOT_NR) {
53 printk(KERN_DEBUG "intel_bus.c: PCI_ROOT_NR is too small\n");
54 return;
55 }
56
57 info = &pci_root_info[pci_root_num];
58 pci_root_num++;
59
60 pci_read_config_word(dev, IOH_LCFGBUS, &word);
61 bus_base = (word & 0xff);
62 bus_end = (word & 0xff00) >> 8;
63 sprintf(info->name, "PCI Bus #%02x", bus_base);
64 info->bus_min = bus_base;
65 info->bus_max = bus_end;
66
67 pci_read_config_word(dev, IOH_LIO, &word);
68 io_base = (word & 0xf0) << (12 - 4);
69 io_end = (word & 0xf000) | 0xfff;
70 update_res(info, io_base, io_end, IORESOURCE_IO, 0);
71
72 pci_read_config_dword(dev, IOH_LMMIOL, &dword);
73 mmiol_base = (dword & 0xff00) << (24 - 8);
74 mmiol_end = (dword & 0xff000000) | 0xffffff;
75 update_res(info, mmiol_base, mmiol_end, IORESOURCE_MEM, 0);
76
77 pci_read_config_dword(dev, IOH_LMMIOH, &dword);
78 mmioh_base = ((u64)(dword & 0xfc00)) << (26 - 10);
79 mmioh_end = ((u64)(dword & 0xfc000000) | 0x3ffffff);
80 pci_read_config_dword(dev, IOH_LMMIOH_BASEU, &dword);
81 mmioh_base |= ((u64)(dword & 0x7ffff)) << 32;
82 pci_read_config_dword(dev, IOH_LMMIOH_LIMITU, &dword);
83 mmioh_end |= ((u64)(dword & 0x7ffff)) << 32;
84 update_res(info, mmioh_base, mmioh_end, IORESOURCE_MEM, 0);
85
86 print_ioh_resources(info);
87}
88
89/* intel IOH */
90DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x342e, pci_root_bus_res);
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 602c172d3bd5..b19d1e54201e 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -15,48 +15,98 @@
15#include <linux/acpi.h> 15#include <linux/acpi.h>
16#include <linux/sfi_acpi.h> 16#include <linux/sfi_acpi.h>
17#include <linux/bitmap.h> 17#include <linux/bitmap.h>
18#include <linux/sort.h> 18#include <linux/dmi.h>
19#include <asm/e820.h> 19#include <asm/e820.h>
20#include <asm/pci_x86.h> 20#include <asm/pci_x86.h>
21#include <asm/acpi.h> 21#include <asm/acpi.h>
22 22
23#define PREFIX "PCI: " 23#define PREFIX "PCI: "
24 24
25/* aperture is up to 256MB but BIOS may reserve less */
26#define MMCONFIG_APER_MIN (2 * 1024*1024)
27#define MMCONFIG_APER_MAX (256 * 1024*1024)
28
29/* Indicate if the mmcfg resources have been placed into the resource table. */ 25/* Indicate if the mmcfg resources have been placed into the resource table. */
30static int __initdata pci_mmcfg_resources_inserted; 26static int __initdata pci_mmcfg_resources_inserted;
31 27
32static __init int extend_mmcfg(int num) 28LIST_HEAD(pci_mmcfg_list);
29
30static __init void pci_mmconfig_remove(struct pci_mmcfg_region *cfg)
33{ 31{
34 struct acpi_mcfg_allocation *new; 32 if (cfg->res.parent)
35 int new_num = pci_mmcfg_config_num + num; 33 release_resource(&cfg->res);
34 list_del(&cfg->list);
35 kfree(cfg);
36}
36 37
37 new = kzalloc(sizeof(pci_mmcfg_config[0]) * new_num, GFP_KERNEL); 38static __init void free_all_mmcfg(void)
38 if (!new) 39{
39 return -1; 40 struct pci_mmcfg_region *cfg, *tmp;
40 41
41 if (pci_mmcfg_config) { 42 pci_mmcfg_arch_free();
42 memcpy(new, pci_mmcfg_config, 43 list_for_each_entry_safe(cfg, tmp, &pci_mmcfg_list, list)
43 sizeof(pci_mmcfg_config[0]) * new_num); 44 pci_mmconfig_remove(cfg);
44 kfree(pci_mmcfg_config); 45}
46
47static __init void list_add_sorted(struct pci_mmcfg_region *new)
48{
49 struct pci_mmcfg_region *cfg;
50
51 /* keep list sorted by segment and starting bus number */
52 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
53 if (cfg->segment > new->segment ||
54 (cfg->segment == new->segment &&
55 cfg->start_bus >= new->start_bus)) {
56 list_add_tail(&new->list, &cfg->list);
57 return;
58 }
45 } 59 }
46 pci_mmcfg_config = new; 60 list_add_tail(&new->list, &pci_mmcfg_list);
61}
47 62
48 return 0; 63static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start,
64 int end, u64 addr)
65{
66 struct pci_mmcfg_region *new;
67 int num_buses;
68 struct resource *res;
69
70 if (addr == 0)
71 return NULL;
72
73 new = kzalloc(sizeof(*new), GFP_KERNEL);
74 if (!new)
75 return NULL;
76
77 new->address = addr;
78 new->segment = segment;
79 new->start_bus = start;
80 new->end_bus = end;
81
82 list_add_sorted(new);
83
84 num_buses = end - start + 1;
85 res = &new->res;
86 res->start = addr + PCI_MMCFG_BUS_OFFSET(start);
87 res->end = addr + PCI_MMCFG_BUS_OFFSET(num_buses) - 1;
88 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
89 snprintf(new->name, PCI_MMCFG_RESOURCE_NAME_LEN,
90 "PCI MMCONFIG %04x [bus %02x-%02x]", segment, start, end);
91 res->name = new->name;
92
93 printk(KERN_INFO PREFIX "MMCONFIG for domain %04x [bus %02x-%02x] at "
94 "%pR (base %#lx)\n", segment, start, end, &new->res,
95 (unsigned long) addr);
96
97 return new;
49} 98}
50 99
51static __init void fill_one_mmcfg(u64 addr, int segment, int start, int end) 100struct pci_mmcfg_region *pci_mmconfig_lookup(int segment, int bus)
52{ 101{
53 int i = pci_mmcfg_config_num; 102 struct pci_mmcfg_region *cfg;
54 103
55 pci_mmcfg_config_num++; 104 list_for_each_entry(cfg, &pci_mmcfg_list, list)
56 pci_mmcfg_config[i].address = addr; 105 if (cfg->segment == segment &&
57 pci_mmcfg_config[i].pci_segment = segment; 106 cfg->start_bus <= bus && bus <= cfg->end_bus)
58 pci_mmcfg_config[i].start_bus_number = start; 107 return cfg;
59 pci_mmcfg_config[i].end_bus_number = end; 108
109 return NULL;
60} 110}
61 111
62static const char __init *pci_mmcfg_e7520(void) 112static const char __init *pci_mmcfg_e7520(void)
@@ -68,11 +118,9 @@ static const char __init *pci_mmcfg_e7520(void)
68 if (win == 0x0000 || win == 0xf000) 118 if (win == 0x0000 || win == 0xf000)
69 return NULL; 119 return NULL;
70 120
71 if (extend_mmcfg(1) == -1) 121 if (pci_mmconfig_add(0, 0, 255, win << 16) == NULL)
72 return NULL; 122 return NULL;
73 123
74 fill_one_mmcfg(win << 16, 0, 0, 255);
75
76 return "Intel Corporation E7520 Memory Controller Hub"; 124 return "Intel Corporation E7520 Memory Controller Hub";
77} 125}
78 126
@@ -114,11 +162,9 @@ static const char __init *pci_mmcfg_intel_945(void)
114 if ((pciexbar & mask) >= 0xf0000000U) 162 if ((pciexbar & mask) >= 0xf0000000U)
115 return NULL; 163 return NULL;
116 164
117 if (extend_mmcfg(1) == -1) 165 if (pci_mmconfig_add(0, 0, (len >> 20) - 1, pciexbar & mask) == NULL)
118 return NULL; 166 return NULL;
119 167
120 fill_one_mmcfg(pciexbar & mask, 0, 0, (len >> 20) - 1);
121
122 return "Intel Corporation 945G/GZ/P/PL Express Memory Controller Hub"; 168 return "Intel Corporation 945G/GZ/P/PL Express Memory Controller Hub";
123} 169}
124 170
@@ -127,7 +173,7 @@ static const char __init *pci_mmcfg_amd_fam10h(void)
127 u32 low, high, address; 173 u32 low, high, address;
128 u64 base, msr; 174 u64 base, msr;
129 int i; 175 int i;
130 unsigned segnbits = 0, busnbits; 176 unsigned segnbits = 0, busnbits, end_bus;
131 177
132 if (!(pci_probe & PCI_CHECK_ENABLE_AMD_MMCONF)) 178 if (!(pci_probe & PCI_CHECK_ENABLE_AMD_MMCONF))
133 return NULL; 179 return NULL;
@@ -161,11 +207,13 @@ static const char __init *pci_mmcfg_amd_fam10h(void)
161 busnbits = 8; 207 busnbits = 8;
162 } 208 }
163 209
164 if (extend_mmcfg(1 << segnbits) == -1) 210 end_bus = (1 << busnbits) - 1;
165 return NULL;
166
167 for (i = 0; i < (1 << segnbits); i++) 211 for (i = 0; i < (1 << segnbits); i++)
168 fill_one_mmcfg(base + (1<<28) * i, i, 0, (1 << busnbits) - 1); 212 if (pci_mmconfig_add(i, 0, end_bus,
213 base + (1<<28) * i) == NULL) {
214 free_all_mmcfg();
215 return NULL;
216 }
169 217
170 return "AMD Family 10h NB"; 218 return "AMD Family 10h NB";
171} 219}
@@ -190,7 +238,7 @@ static const char __init *pci_mmcfg_nvidia_mcp55(void)
190 /* 238 /*
191 * do check if amd fam10h already took over 239 * do check if amd fam10h already took over
192 */ 240 */
193 if (!acpi_disabled || pci_mmcfg_config_num || mcp55_checked) 241 if (!acpi_disabled || !list_empty(&pci_mmcfg_list) || mcp55_checked)
194 return NULL; 242 return NULL;
195 243
196 mcp55_checked = true; 244 mcp55_checked = true;
@@ -213,16 +261,14 @@ static const char __init *pci_mmcfg_nvidia_mcp55(void)
213 if (!(extcfg & extcfg_enable_mask)) 261 if (!(extcfg & extcfg_enable_mask))
214 continue; 262 continue;
215 263
216 if (extend_mmcfg(1) == -1)
217 continue;
218
219 size_index = (extcfg & extcfg_size_mask) >> extcfg_size_shift; 264 size_index = (extcfg & extcfg_size_mask) >> extcfg_size_shift;
220 base = extcfg & extcfg_base_mask[size_index]; 265 base = extcfg & extcfg_base_mask[size_index];
221 /* base could > 4G */ 266 /* base could > 4G */
222 base <<= extcfg_base_lshift; 267 base <<= extcfg_base_lshift;
223 start = (extcfg & extcfg_start_mask) >> extcfg_start_shift; 268 start = (extcfg & extcfg_start_mask) >> extcfg_start_shift;
224 end = start + extcfg_sizebus[size_index] - 1; 269 end = start + extcfg_sizebus[size_index] - 1;
225 fill_one_mmcfg(base, 0, start, end); 270 if (pci_mmconfig_add(0, start, end, base) == NULL)
271 continue;
226 mcp55_mmconf_found++; 272 mcp55_mmconf_found++;
227 } 273 }
228 274
@@ -253,45 +299,27 @@ static struct pci_mmcfg_hostbridge_probe pci_mmcfg_probes[] __initdata = {
253 0x0369, pci_mmcfg_nvidia_mcp55 }, 299 0x0369, pci_mmcfg_nvidia_mcp55 },
254}; 300};
255 301
256static int __init cmp_mmcfg(const void *x1, const void *x2)
257{
258 const typeof(pci_mmcfg_config[0]) *m1 = x1;
259 const typeof(pci_mmcfg_config[0]) *m2 = x2;
260 int start1, start2;
261
262 start1 = m1->start_bus_number;
263 start2 = m2->start_bus_number;
264
265 return start1 - start2;
266}
267
268static void __init pci_mmcfg_check_end_bus_number(void) 302static void __init pci_mmcfg_check_end_bus_number(void)
269{ 303{
270 int i; 304 struct pci_mmcfg_region *cfg, *cfgx;
271 typeof(pci_mmcfg_config[0]) *cfg, *cfgx;
272
273 /* sort them at first */
274 sort(pci_mmcfg_config, pci_mmcfg_config_num,
275 sizeof(pci_mmcfg_config[0]), cmp_mmcfg, NULL);
276 305
277 /* last one*/ 306 /* last one*/
278 if (pci_mmcfg_config_num > 0) { 307 cfg = list_entry(pci_mmcfg_list.prev, typeof(*cfg), list);
279 i = pci_mmcfg_config_num - 1; 308 if (cfg)
280 cfg = &pci_mmcfg_config[i]; 309 if (cfg->end_bus < cfg->start_bus)
281 if (cfg->end_bus_number < cfg->start_bus_number) 310 cfg->end_bus = 255;
282 cfg->end_bus_number = 255;
283 }
284 311
285 /* don't overlap please */ 312 if (list_is_singular(&pci_mmcfg_list))
286 for (i = 0; i < pci_mmcfg_config_num - 1; i++) { 313 return;
287 cfg = &pci_mmcfg_config[i];
288 cfgx = &pci_mmcfg_config[i+1];
289 314
290 if (cfg->end_bus_number < cfg->start_bus_number) 315 /* don't overlap please */
291 cfg->end_bus_number = 255; 316 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
317 if (cfg->end_bus < cfg->start_bus)
318 cfg->end_bus = 255;
292 319
293 if (cfg->end_bus_number >= cfgx->start_bus_number) 320 cfgx = list_entry(cfg->list.next, typeof(*cfg), list);
294 cfg->end_bus_number = cfgx->start_bus_number - 1; 321 if (cfg != cfgx && cfg->end_bus >= cfgx->start_bus)
322 cfg->end_bus = cfgx->start_bus - 1;
295 } 323 }
296} 324}
297 325
@@ -306,8 +334,7 @@ static int __init pci_mmcfg_check_hostbridge(void)
306 if (!raw_pci_ops) 334 if (!raw_pci_ops)
307 return 0; 335 return 0;
308 336
309 pci_mmcfg_config_num = 0; 337 free_all_mmcfg();
310 pci_mmcfg_config = NULL;
311 338
312 for (i = 0; i < ARRAY_SIZE(pci_mmcfg_probes); i++) { 339 for (i = 0; i < ARRAY_SIZE(pci_mmcfg_probes); i++) {
313 bus = pci_mmcfg_probes[i].bus; 340 bus = pci_mmcfg_probes[i].bus;
@@ -322,45 +349,22 @@ static int __init pci_mmcfg_check_hostbridge(void)
322 name = pci_mmcfg_probes[i].probe(); 349 name = pci_mmcfg_probes[i].probe();
323 350
324 if (name) 351 if (name)
325 printk(KERN_INFO "PCI: Found %s with MMCONFIG support.\n", 352 printk(KERN_INFO PREFIX "%s with MMCONFIG support\n",
326 name); 353 name);
327 } 354 }
328 355
329 /* some end_bus_number is crazy, fix it */ 356 /* some end_bus_number is crazy, fix it */
330 pci_mmcfg_check_end_bus_number(); 357 pci_mmcfg_check_end_bus_number();
331 358
332 return pci_mmcfg_config_num != 0; 359 return !list_empty(&pci_mmcfg_list);
333} 360}
334 361
335static void __init pci_mmcfg_insert_resources(void) 362static void __init pci_mmcfg_insert_resources(void)
336{ 363{
337#define PCI_MMCFG_RESOURCE_NAME_LEN 24 364 struct pci_mmcfg_region *cfg;
338 int i;
339 struct resource *res;
340 char *names;
341 unsigned num_buses;
342
343 res = kcalloc(PCI_MMCFG_RESOURCE_NAME_LEN + sizeof(*res),
344 pci_mmcfg_config_num, GFP_KERNEL);
345 if (!res) {
346 printk(KERN_ERR "PCI: Unable to allocate MMCONFIG resources\n");
347 return;
348 }
349 365
350 names = (void *)&res[pci_mmcfg_config_num]; 366 list_for_each_entry(cfg, &pci_mmcfg_list, list)
351 for (i = 0; i < pci_mmcfg_config_num; i++, res++) { 367 insert_resource(&iomem_resource, &cfg->res);
352 struct acpi_mcfg_allocation *cfg = &pci_mmcfg_config[i];
353 num_buses = cfg->end_bus_number - cfg->start_bus_number + 1;
354 res->name = names;
355 snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN,
356 "PCI MMCONFIG %u [%02x-%02x]", cfg->pci_segment,
357 cfg->start_bus_number, cfg->end_bus_number);
358 res->start = cfg->address + (cfg->start_bus_number << 20);
359 res->end = res->start + (num_buses << 20) - 1;
360 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
361 insert_resource(&iomem_resource, res);
362 names += PCI_MMCFG_RESOURCE_NAME_LEN;
363 }
364 368
365 /* Mark that the resources have been inserted. */ 369 /* Mark that the resources have been inserted. */
366 pci_mmcfg_resources_inserted = 1; 370 pci_mmcfg_resources_inserted = 1;
@@ -437,11 +441,12 @@ static int __init is_acpi_reserved(u64 start, u64 end, unsigned not_used)
437typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type); 441typedef int (*check_reserved_t)(u64 start, u64 end, unsigned type);
438 442
439static int __init is_mmconf_reserved(check_reserved_t is_reserved, 443static int __init is_mmconf_reserved(check_reserved_t is_reserved,
440 u64 addr, u64 size, int i, 444 struct pci_mmcfg_region *cfg, int with_e820)
441 typeof(pci_mmcfg_config[0]) *cfg, int with_e820)
442{ 445{
446 u64 addr = cfg->res.start;
447 u64 size = resource_size(&cfg->res);
443 u64 old_size = size; 448 u64 old_size = size;
444 int valid = 0; 449 int valid = 0, num_buses;
445 450
446 while (!is_reserved(addr, addr + size, E820_RESERVED)) { 451 while (!is_reserved(addr, addr + size, E820_RESERVED)) {
447 size >>= 1; 452 size >>= 1;
@@ -450,19 +455,25 @@ static int __init is_mmconf_reserved(check_reserved_t is_reserved,
450 } 455 }
451 456
452 if (size >= (16UL<<20) || size == old_size) { 457 if (size >= (16UL<<20) || size == old_size) {
453 printk(KERN_NOTICE 458 printk(KERN_INFO PREFIX "MMCONFIG at %pR reserved in %s\n",
454 "PCI: MCFG area at %Lx reserved in %s\n", 459 &cfg->res,
455 addr, with_e820?"E820":"ACPI motherboard resources"); 460 with_e820 ? "E820" : "ACPI motherboard resources");
456 valid = 1; 461 valid = 1;
457 462
458 if (old_size != size) { 463 if (old_size != size) {
459 /* update end_bus_number */ 464 /* update end_bus */
460 cfg->end_bus_number = cfg->start_bus_number + ((size>>20) - 1); 465 cfg->end_bus = cfg->start_bus + ((size>>20) - 1);
461 printk(KERN_NOTICE "PCI: updated MCFG configuration %d: base %lx " 466 num_buses = cfg->end_bus - cfg->start_bus + 1;
462 "segment %hu buses %u - %u\n", 467 cfg->res.end = cfg->res.start +
463 i, (unsigned long)cfg->address, cfg->pci_segment, 468 PCI_MMCFG_BUS_OFFSET(num_buses) - 1;
464 (unsigned int)cfg->start_bus_number, 469 snprintf(cfg->name, PCI_MMCFG_RESOURCE_NAME_LEN,
465 (unsigned int)cfg->end_bus_number); 470 "PCI MMCONFIG %04x [bus %02x-%02x]",
471 cfg->segment, cfg->start_bus, cfg->end_bus);
472 printk(KERN_INFO PREFIX
473 "MMCONFIG for %04x [bus%02x-%02x] "
474 "at %pR (base %#lx) (size reduced!)\n",
475 cfg->segment, cfg->start_bus, cfg->end_bus,
476 &cfg->res, (unsigned long) cfg->address);
466 } 477 }
467 } 478 }
468 479
@@ -471,45 +482,26 @@ static int __init is_mmconf_reserved(check_reserved_t is_reserved,
471 482
472static void __init pci_mmcfg_reject_broken(int early) 483static void __init pci_mmcfg_reject_broken(int early)
473{ 484{
474 typeof(pci_mmcfg_config[0]) *cfg; 485 struct pci_mmcfg_region *cfg;
475 int i;
476 486
477 if ((pci_mmcfg_config_num == 0) || 487 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
478 (pci_mmcfg_config == NULL) ||
479 (pci_mmcfg_config[0].address == 0))
480 return;
481
482 for (i = 0; i < pci_mmcfg_config_num; i++) {
483 int valid = 0; 488 int valid = 0;
484 u64 addr, size;
485
486 cfg = &pci_mmcfg_config[i];
487 addr = cfg->start_bus_number;
488 addr <<= 20;
489 addr += cfg->address;
490 size = cfg->end_bus_number + 1 - cfg->start_bus_number;
491 size <<= 20;
492 printk(KERN_NOTICE "PCI: MCFG configuration %d: base %lx "
493 "segment %hu buses %u - %u\n",
494 i, (unsigned long)cfg->address, cfg->pci_segment,
495 (unsigned int)cfg->start_bus_number,
496 (unsigned int)cfg->end_bus_number);
497 489
498 if (!early && !acpi_disabled) 490 if (!early && !acpi_disabled)
499 valid = is_mmconf_reserved(is_acpi_reserved, addr, size, i, cfg, 0); 491 valid = is_mmconf_reserved(is_acpi_reserved, cfg, 0);
500 492
501 if (valid) 493 if (valid)
502 continue; 494 continue;
503 495
504 if (!early) 496 if (!early)
505 printk(KERN_ERR "PCI: BIOS Bug: MCFG area at %Lx is not" 497 printk(KERN_ERR FW_BUG PREFIX
506 " reserved in ACPI motherboard resources\n", 498 "MMCONFIG at %pR not reserved in "
507 cfg->address); 499 "ACPI motherboard resources\n", &cfg->res);
508 500
509 /* Don't try to do this check unless configuration 501 /* Don't try to do this check unless configuration
510 type 1 is available. how about type 2 ?*/ 502 type 1 is available. how about type 2 ?*/
511 if (raw_pci_ops) 503 if (raw_pci_ops)
512 valid = is_mmconf_reserved(e820_all_mapped, addr, size, i, cfg, 1); 504 valid = is_mmconf_reserved(e820_all_mapped, cfg, 1);
513 505
514 if (!valid) 506 if (!valid)
515 goto reject; 507 goto reject;
@@ -518,34 +510,41 @@ static void __init pci_mmcfg_reject_broken(int early)
518 return; 510 return;
519 511
520reject: 512reject:
521 printk(KERN_INFO "PCI: Not using MMCONFIG.\n"); 513 printk(KERN_INFO PREFIX "not using MMCONFIG\n");
522 pci_mmcfg_arch_free(); 514 free_all_mmcfg();
523 kfree(pci_mmcfg_config);
524 pci_mmcfg_config = NULL;
525 pci_mmcfg_config_num = 0;
526} 515}
527 516
528static int __initdata known_bridge; 517static int __initdata known_bridge;
529 518
530static int acpi_mcfg_64bit_base_addr __initdata = FALSE; 519static int __init acpi_mcfg_check_entry(struct acpi_table_mcfg *mcfg,
520 struct acpi_mcfg_allocation *cfg)
521{
522 int year;
531 523
532/* The physical address of the MMCONFIG aperture. Set from ACPI tables. */ 524 if (cfg->address < 0xFFFFFFFF)
533struct acpi_mcfg_allocation *pci_mmcfg_config; 525 return 0;
534int pci_mmcfg_config_num;
535 526
536static int __init acpi_mcfg_oem_check(struct acpi_table_mcfg *mcfg)
537{
538 if (!strcmp(mcfg->header.oem_id, "SGI")) 527 if (!strcmp(mcfg->header.oem_id, "SGI"))
539 acpi_mcfg_64bit_base_addr = TRUE; 528 return 0;
540 529
541 return 0; 530 if (mcfg->header.revision >= 1) {
531 if (dmi_get_date(DMI_BIOS_DATE, &year, NULL, NULL) &&
532 year >= 2010)
533 return 0;
534 }
535
536 printk(KERN_ERR PREFIX "MCFG region for %04x [bus %02x-%02x] at %#llx "
537 "is above 4GB, ignored\n", cfg->pci_segment,
538 cfg->start_bus_number, cfg->end_bus_number, cfg->address);
539 return -EINVAL;
542} 540}
543 541
544static int __init pci_parse_mcfg(struct acpi_table_header *header) 542static int __init pci_parse_mcfg(struct acpi_table_header *header)
545{ 543{
546 struct acpi_table_mcfg *mcfg; 544 struct acpi_table_mcfg *mcfg;
545 struct acpi_mcfg_allocation *cfg_table, *cfg;
547 unsigned long i; 546 unsigned long i;
548 int config_size; 547 int entries;
549 548
550 if (!header) 549 if (!header)
551 return -EINVAL; 550 return -EINVAL;
@@ -553,38 +552,33 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
553 mcfg = (struct acpi_table_mcfg *)header; 552 mcfg = (struct acpi_table_mcfg *)header;
554 553
555 /* how many config structures do we have */ 554 /* how many config structures do we have */
556 pci_mmcfg_config_num = 0; 555 free_all_mmcfg();
556 entries = 0;
557 i = header->length - sizeof(struct acpi_table_mcfg); 557 i = header->length - sizeof(struct acpi_table_mcfg);
558 while (i >= sizeof(struct acpi_mcfg_allocation)) { 558 while (i >= sizeof(struct acpi_mcfg_allocation)) {
559 ++pci_mmcfg_config_num; 559 entries++;
560 i -= sizeof(struct acpi_mcfg_allocation); 560 i -= sizeof(struct acpi_mcfg_allocation);
561 }; 561 };
562 if (pci_mmcfg_config_num == 0) { 562 if (entries == 0) {
563 printk(KERN_ERR PREFIX "MMCONFIG has no entries\n"); 563 printk(KERN_ERR PREFIX "MMCONFIG has no entries\n");
564 return -ENODEV; 564 return -ENODEV;
565 } 565 }
566 566
567 config_size = pci_mmcfg_config_num * sizeof(*pci_mmcfg_config); 567 cfg_table = (struct acpi_mcfg_allocation *) &mcfg[1];
568 pci_mmcfg_config = kmalloc(config_size, GFP_KERNEL); 568 for (i = 0; i < entries; i++) {
569 if (!pci_mmcfg_config) { 569 cfg = &cfg_table[i];
570 printk(KERN_WARNING PREFIX 570 if (acpi_mcfg_check_entry(mcfg, cfg)) {
571 "No memory for MCFG config tables\n"); 571 free_all_mmcfg();
572 return -ENOMEM;
573 }
574
575 memcpy(pci_mmcfg_config, &mcfg[1], config_size);
576
577 acpi_mcfg_oem_check(mcfg);
578
579 for (i = 0; i < pci_mmcfg_config_num; ++i) {
580 if ((pci_mmcfg_config[i].address > 0xFFFFFFFF) &&
581 !acpi_mcfg_64bit_base_addr) {
582 printk(KERN_ERR PREFIX
583 "MMCONFIG not in low 4GB of memory\n");
584 kfree(pci_mmcfg_config);
585 pci_mmcfg_config_num = 0;
586 return -ENODEV; 572 return -ENODEV;
587 } 573 }
574
575 if (pci_mmconfig_add(cfg->pci_segment, cfg->start_bus_number,
576 cfg->end_bus_number, cfg->address) == NULL) {
577 printk(KERN_WARNING PREFIX
578 "no memory for MCFG entries\n");
579 free_all_mmcfg();
580 return -ENOMEM;
581 }
588 } 582 }
589 583
590 return 0; 584 return 0;
@@ -614,9 +608,7 @@ static void __init __pci_mmcfg_init(int early)
614 608
615 pci_mmcfg_reject_broken(early); 609 pci_mmcfg_reject_broken(early);
616 610
617 if ((pci_mmcfg_config_num == 0) || 611 if (list_empty(&pci_mmcfg_list))
618 (pci_mmcfg_config == NULL) ||
619 (pci_mmcfg_config[0].address == 0))
620 return; 612 return;
621 613
622 if (pci_mmcfg_arch_init()) 614 if (pci_mmcfg_arch_init())
@@ -648,9 +640,7 @@ static int __init pci_mmcfg_late_insert_resources(void)
648 */ 640 */
649 if ((pci_mmcfg_resources_inserted == 1) || 641 if ((pci_mmcfg_resources_inserted == 1) ||
650 (pci_probe & PCI_PROBE_MMCONF) == 0 || 642 (pci_probe & PCI_PROBE_MMCONF) == 0 ||
651 (pci_mmcfg_config_num == 0) || 643 list_empty(&pci_mmcfg_list))
652 (pci_mmcfg_config == NULL) ||
653 (pci_mmcfg_config[0].address == 0))
654 return 1; 644 return 1;
655 645
656 /* 646 /*
diff --git a/arch/x86/pci/mmconfig_32.c b/arch/x86/pci/mmconfig_32.c
index f10a7e94a84c..90d5fd476ed4 100644
--- a/arch/x86/pci/mmconfig_32.c
+++ b/arch/x86/pci/mmconfig_32.c
@@ -27,18 +27,10 @@ static int mmcfg_last_accessed_cpu;
27 */ 27 */
28static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn) 28static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
29{ 29{
30 struct acpi_mcfg_allocation *cfg; 30 struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus);
31 int cfg_num;
32
33 for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) {
34 cfg = &pci_mmcfg_config[cfg_num];
35 if (cfg->pci_segment == seg &&
36 (cfg->start_bus_number <= bus) &&
37 (cfg->end_bus_number >= bus))
38 return cfg->address;
39 }
40 31
41 /* Fall back to type 0 */ 32 if (cfg)
33 return cfg->address;
42 return 0; 34 return 0;
43} 35}
44 36
@@ -47,7 +39,7 @@ static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
47 */ 39 */
48static void pci_exp_set_dev_base(unsigned int base, int bus, int devfn) 40static void pci_exp_set_dev_base(unsigned int base, int bus, int devfn)
49{ 41{
50 u32 dev_base = base | (bus << 20) | (devfn << 12); 42 u32 dev_base = base | PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12);
51 int cpu = smp_processor_id(); 43 int cpu = smp_processor_id();
52 if (dev_base != mmcfg_last_accessed_device || 44 if (dev_base != mmcfg_last_accessed_device ||
53 cpu != mmcfg_last_accessed_cpu) { 45 cpu != mmcfg_last_accessed_cpu) {
diff --git a/arch/x86/pci/mmconfig_64.c b/arch/x86/pci/mmconfig_64.c
index 94349f8b2f96..e783841bd1d7 100644
--- a/arch/x86/pci/mmconfig_64.c
+++ b/arch/x86/pci/mmconfig_64.c
@@ -12,38 +12,15 @@
12#include <asm/e820.h> 12#include <asm/e820.h>
13#include <asm/pci_x86.h> 13#include <asm/pci_x86.h>
14 14
15/* Static virtual mapping of the MMCONFIG aperture */ 15#define PREFIX "PCI: "
16struct mmcfg_virt {
17 struct acpi_mcfg_allocation *cfg;
18 char __iomem *virt;
19};
20static struct mmcfg_virt *pci_mmcfg_virt;
21
22static char __iomem *get_virt(unsigned int seg, unsigned bus)
23{
24 struct acpi_mcfg_allocation *cfg;
25 int cfg_num;
26
27 for (cfg_num = 0; cfg_num < pci_mmcfg_config_num; cfg_num++) {
28 cfg = pci_mmcfg_virt[cfg_num].cfg;
29 if (cfg->pci_segment == seg &&
30 (cfg->start_bus_number <= bus) &&
31 (cfg->end_bus_number >= bus))
32 return pci_mmcfg_virt[cfg_num].virt;
33 }
34
35 /* Fall back to type 0 */
36 return NULL;
37}
38 16
39static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) 17static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
40{ 18{
41 char __iomem *addr; 19 struct pci_mmcfg_region *cfg = pci_mmconfig_lookup(seg, bus);
42 20
43 addr = get_virt(seg, bus); 21 if (cfg && cfg->virt)
44 if (!addr) 22 return cfg->virt + (PCI_MMCFG_BUS_OFFSET(bus) | (devfn << 12));
45 return NULL; 23 return NULL;
46 return addr + ((bus << 20) | (devfn << 12));
47} 24}
48 25
49static int pci_mmcfg_read(unsigned int seg, unsigned int bus, 26static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
@@ -109,42 +86,30 @@ static struct pci_raw_ops pci_mmcfg = {
109 .write = pci_mmcfg_write, 86 .write = pci_mmcfg_write,
110}; 87};
111 88
112static void __iomem * __init mcfg_ioremap(struct acpi_mcfg_allocation *cfg) 89static void __iomem * __init mcfg_ioremap(struct pci_mmcfg_region *cfg)
113{ 90{
114 void __iomem *addr; 91 void __iomem *addr;
115 u64 start, size; 92 u64 start, size;
93 int num_buses;
116 94
117 start = cfg->start_bus_number; 95 start = cfg->address + PCI_MMCFG_BUS_OFFSET(cfg->start_bus);
118 start <<= 20; 96 num_buses = cfg->end_bus - cfg->start_bus + 1;
119 start += cfg->address; 97 size = PCI_MMCFG_BUS_OFFSET(num_buses);
120 size = cfg->end_bus_number + 1 - cfg->start_bus_number;
121 size <<= 20;
122 addr = ioremap_nocache(start, size); 98 addr = ioremap_nocache(start, size);
123 if (addr) { 99 if (addr)
124 printk(KERN_INFO "PCI: Using MMCONFIG at %Lx - %Lx\n", 100 addr -= PCI_MMCFG_BUS_OFFSET(cfg->start_bus);
125 start, start + size - 1);
126 addr -= cfg->start_bus_number << 20;
127 }
128 return addr; 101 return addr;
129} 102}
130 103
131int __init pci_mmcfg_arch_init(void) 104int __init pci_mmcfg_arch_init(void)
132{ 105{
133 int i; 106 struct pci_mmcfg_region *cfg;
134 pci_mmcfg_virt = kzalloc(sizeof(*pci_mmcfg_virt) *
135 pci_mmcfg_config_num, GFP_KERNEL);
136 if (pci_mmcfg_virt == NULL) {
137 printk(KERN_ERR "PCI: Can not allocate memory for mmconfig structures\n");
138 return 0;
139 }
140 107
141 for (i = 0; i < pci_mmcfg_config_num; ++i) { 108 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
142 pci_mmcfg_virt[i].cfg = &pci_mmcfg_config[i]; 109 cfg->virt = mcfg_ioremap(cfg);
143 pci_mmcfg_virt[i].virt = mcfg_ioremap(&pci_mmcfg_config[i]); 110 if (!cfg->virt) {
144 if (!pci_mmcfg_virt[i].virt) { 111 printk(KERN_ERR PREFIX "can't map MMCONFIG at %pR\n",
145 printk(KERN_ERR "PCI: Cannot map mmconfig aperture for " 112 &cfg->res);
146 "segment %d\n",
147 pci_mmcfg_config[i].pci_segment);
148 pci_mmcfg_arch_free(); 113 pci_mmcfg_arch_free();
149 return 0; 114 return 0;
150 } 115 }
@@ -155,19 +120,12 @@ int __init pci_mmcfg_arch_init(void)
155 120
156void __init pci_mmcfg_arch_free(void) 121void __init pci_mmcfg_arch_free(void)
157{ 122{
158 int i; 123 struct pci_mmcfg_region *cfg;
159
160 if (pci_mmcfg_virt == NULL)
161 return;
162 124
163 for (i = 0; i < pci_mmcfg_config_num; ++i) { 125 list_for_each_entry(cfg, &pci_mmcfg_list, list) {
164 if (pci_mmcfg_virt[i].virt) { 126 if (cfg->virt) {
165 iounmap(pci_mmcfg_virt[i].virt + (pci_mmcfg_virt[i].cfg->start_bus_number << 20)); 127 iounmap(cfg->virt + PCI_MMCFG_BUS_OFFSET(cfg->start_bus));
166 pci_mmcfg_virt[i].virt = NULL; 128 cfg->virt = NULL;
167 pci_mmcfg_virt[i].cfg = NULL;
168 } 129 }
169 } 130 }
170
171 kfree(pci_mmcfg_virt);
172 pci_mmcfg_virt = NULL;
173} 131}
diff --git a/arch/x86/tools/test_get_len.c b/arch/x86/tools/test_get_len.c
index d8214dc03fa7..bee8d6ac2691 100644
--- a/arch/x86/tools/test_get_len.c
+++ b/arch/x86/tools/test_get_len.c
@@ -113,7 +113,7 @@ int main(int argc, char **argv)
113 char line[BUFSIZE], sym[BUFSIZE] = "<unknown>"; 113 char line[BUFSIZE], sym[BUFSIZE] = "<unknown>";
114 unsigned char insn_buf[16]; 114 unsigned char insn_buf[16];
115 struct insn insn; 115 struct insn insn;
116 int insns = 0, c; 116 int insns = 0;
117 int warnings = 0; 117 int warnings = 0;
118 118
119 parse_args(argc, argv); 119 parse_args(argc, argv);
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index c462cea8ef09..2b26dd5930c6 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -27,7 +27,9 @@
27#include <linux/page-flags.h> 27#include <linux/page-flags.h>
28#include <linux/highmem.h> 28#include <linux/highmem.h>
29#include <linux/console.h> 29#include <linux/console.h>
30#include <linux/pci.h>
30 31
32#include <xen/xen.h>
31#include <xen/interface/xen.h> 33#include <xen/interface/xen.h>
32#include <xen/interface/version.h> 34#include <xen/interface/version.h>
33#include <xen/interface/physdev.h> 35#include <xen/interface/physdev.h>
@@ -138,24 +140,23 @@ static void xen_vcpu_setup(int cpu)
138 */ 140 */
139void xen_vcpu_restore(void) 141void xen_vcpu_restore(void)
140{ 142{
141 if (have_vcpu_info_placement) { 143 int cpu;
142 int cpu;
143 144
144 for_each_online_cpu(cpu) { 145 for_each_online_cpu(cpu) {
145 bool other_cpu = (cpu != smp_processor_id()); 146 bool other_cpu = (cpu != smp_processor_id());
146 147
147 if (other_cpu && 148 if (other_cpu &&
148 HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL)) 149 HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL))
149 BUG(); 150 BUG();
150 151
151 xen_vcpu_setup(cpu); 152 xen_setup_runstate_info(cpu);
152 153
153 if (other_cpu && 154 if (have_vcpu_info_placement)
154 HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL)) 155 xen_vcpu_setup(cpu);
155 BUG();
156 }
157 156
158 BUG_ON(!have_vcpu_info_placement); 157 if (other_cpu &&
158 HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL))
159 BUG();
159 } 160 }
160} 161}
161 162
@@ -1176,10 +1177,16 @@ asmlinkage void __init xen_start_kernel(void)
1176 add_preferred_console("xenboot", 0, NULL); 1177 add_preferred_console("xenboot", 0, NULL);
1177 add_preferred_console("tty", 0, NULL); 1178 add_preferred_console("tty", 0, NULL);
1178 add_preferred_console("hvc", 0, NULL); 1179 add_preferred_console("hvc", 0, NULL);
1180 } else {
1181 /* Make sure ACS will be enabled */
1182 pci_request_acs();
1179 } 1183 }
1184
1180 1185
1181 xen_raw_console_write("about to get started...\n"); 1186 xen_raw_console_write("about to get started...\n");
1182 1187
1188 xen_setup_runstate_info(0);
1189
1183 /* Start the world */ 1190 /* Start the world */
1184#ifdef CONFIG_X86_32 1191#ifdef CONFIG_X86_32
1185 i386_start_kernel(); 1192 i386_start_kernel();
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 3bf7b1d250ce..bf4cd6bfe959 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -185,7 +185,7 @@ static inline unsigned p2m_index(unsigned long pfn)
185} 185}
186 186
187/* Build the parallel p2m_top_mfn structures */ 187/* Build the parallel p2m_top_mfn structures */
188static void __init xen_build_mfn_list_list(void) 188void xen_build_mfn_list_list(void)
189{ 189{
190 unsigned pfn, idx; 190 unsigned pfn, idx;
191 191
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 738da0cb0d8b..563d20504988 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -35,10 +35,10 @@
35 35
36cpumask_var_t xen_cpu_initialized_map; 36cpumask_var_t xen_cpu_initialized_map;
37 37
38static DEFINE_PER_CPU(int, resched_irq); 38static DEFINE_PER_CPU(int, xen_resched_irq);
39static DEFINE_PER_CPU(int, callfunc_irq); 39static DEFINE_PER_CPU(int, xen_callfunc_irq);
40static DEFINE_PER_CPU(int, callfuncsingle_irq); 40static DEFINE_PER_CPU(int, xen_callfuncsingle_irq);
41static DEFINE_PER_CPU(int, debug_irq) = -1; 41static DEFINE_PER_CPU(int, xen_debug_irq) = -1;
42 42
43static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id); 43static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id);
44static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id); 44static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
@@ -103,7 +103,7 @@ static int xen_smp_intr_init(unsigned int cpu)
103 NULL); 103 NULL);
104 if (rc < 0) 104 if (rc < 0)
105 goto fail; 105 goto fail;
106 per_cpu(resched_irq, cpu) = rc; 106 per_cpu(xen_resched_irq, cpu) = rc;
107 107
108 callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu); 108 callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu);
109 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR, 109 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR,
@@ -114,7 +114,7 @@ static int xen_smp_intr_init(unsigned int cpu)
114 NULL); 114 NULL);
115 if (rc < 0) 115 if (rc < 0)
116 goto fail; 116 goto fail;
117 per_cpu(callfunc_irq, cpu) = rc; 117 per_cpu(xen_callfunc_irq, cpu) = rc;
118 118
119 debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu); 119 debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
120 rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt, 120 rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu, xen_debug_interrupt,
@@ -122,7 +122,7 @@ static int xen_smp_intr_init(unsigned int cpu)
122 debug_name, NULL); 122 debug_name, NULL);
123 if (rc < 0) 123 if (rc < 0)
124 goto fail; 124 goto fail;
125 per_cpu(debug_irq, cpu) = rc; 125 per_cpu(xen_debug_irq, cpu) = rc;
126 126
127 callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu); 127 callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
128 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR, 128 rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
@@ -133,19 +133,20 @@ static int xen_smp_intr_init(unsigned int cpu)
133 NULL); 133 NULL);
134 if (rc < 0) 134 if (rc < 0)
135 goto fail; 135 goto fail;
136 per_cpu(callfuncsingle_irq, cpu) = rc; 136 per_cpu(xen_callfuncsingle_irq, cpu) = rc;
137 137
138 return 0; 138 return 0;
139 139
140 fail: 140 fail:
141 if (per_cpu(resched_irq, cpu) >= 0) 141 if (per_cpu(xen_resched_irq, cpu) >= 0)
142 unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL); 142 unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
143 if (per_cpu(callfunc_irq, cpu) >= 0) 143 if (per_cpu(xen_callfunc_irq, cpu) >= 0)
144 unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL); 144 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
145 if (per_cpu(debug_irq, cpu) >= 0) 145 if (per_cpu(xen_debug_irq, cpu) >= 0)
146 unbind_from_irqhandler(per_cpu(debug_irq, cpu), NULL); 146 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
147 if (per_cpu(callfuncsingle_irq, cpu) >= 0) 147 if (per_cpu(xen_callfuncsingle_irq, cpu) >= 0)
148 unbind_from_irqhandler(per_cpu(callfuncsingle_irq, cpu), NULL); 148 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu),
149 NULL);
149 150
150 return rc; 151 return rc;
151} 152}
@@ -295,6 +296,7 @@ static int __cpuinit xen_cpu_up(unsigned int cpu)
295 (unsigned long)task_stack_page(idle) - 296 (unsigned long)task_stack_page(idle) -
296 KERNEL_STACK_OFFSET + THREAD_SIZE; 297 KERNEL_STACK_OFFSET + THREAD_SIZE;
297#endif 298#endif
299 xen_setup_runstate_info(cpu);
298 xen_setup_timer(cpu); 300 xen_setup_timer(cpu);
299 xen_init_lock_cpu(cpu); 301 xen_init_lock_cpu(cpu);
300 302
@@ -348,10 +350,10 @@ static void xen_cpu_die(unsigned int cpu)
348 current->state = TASK_UNINTERRUPTIBLE; 350 current->state = TASK_UNINTERRUPTIBLE;
349 schedule_timeout(HZ/10); 351 schedule_timeout(HZ/10);
350 } 352 }
351 unbind_from_irqhandler(per_cpu(resched_irq, cpu), NULL); 353 unbind_from_irqhandler(per_cpu(xen_resched_irq, cpu), NULL);
352 unbind_from_irqhandler(per_cpu(callfunc_irq, cpu), NULL); 354 unbind_from_irqhandler(per_cpu(xen_callfunc_irq, cpu), NULL);
353 unbind_from_irqhandler(per_cpu(debug_irq, cpu), NULL); 355 unbind_from_irqhandler(per_cpu(xen_debug_irq, cpu), NULL);
354 unbind_from_irqhandler(per_cpu(callfuncsingle_irq, cpu), NULL); 356 unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu), NULL);
355 xen_uninit_lock_cpu(cpu); 357 xen_uninit_lock_cpu(cpu);
356 xen_teardown_timer(cpu); 358 xen_teardown_timer(cpu);
357 359
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index 95be7b434724..987267f79bf5 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -1,4 +1,5 @@
1#include <linux/types.h> 1#include <linux/types.h>
2#include <linux/clockchips.h>
2 3
3#include <xen/interface/xen.h> 4#include <xen/interface/xen.h>
4#include <xen/grant_table.h> 5#include <xen/grant_table.h>
@@ -27,6 +28,8 @@ void xen_pre_suspend(void)
27 28
28void xen_post_suspend(int suspend_cancelled) 29void xen_post_suspend(int suspend_cancelled)
29{ 30{
31 xen_build_mfn_list_list();
32
30 xen_setup_shared_info(); 33 xen_setup_shared_info();
31 34
32 if (suspend_cancelled) { 35 if (suspend_cancelled) {
@@ -44,7 +47,19 @@ void xen_post_suspend(int suspend_cancelled)
44 47
45} 48}
46 49
50static void xen_vcpu_notify_restore(void *data)
51{
52 unsigned long reason = (unsigned long)data;
53
54 /* Boot processor notified via generic timekeeping_resume() */
55 if ( smp_processor_id() == 0)
56 return;
57
58 clockevents_notify(reason, NULL);
59}
60
47void xen_arch_resume(void) 61void xen_arch_resume(void)
48{ 62{
49 /* nothing */ 63 smp_call_function(xen_vcpu_notify_restore,
64 (void *)CLOCK_EVT_NOTIFY_RESUME, 1);
50} 65}
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 0a5aa44299a5..0d3f07cd1b5f 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -31,14 +31,14 @@
31#define NS_PER_TICK (1000000000LL / HZ) 31#define NS_PER_TICK (1000000000LL / HZ)
32 32
33/* runstate info updated by Xen */ 33/* runstate info updated by Xen */
34static DEFINE_PER_CPU(struct vcpu_runstate_info, runstate); 34static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate);
35 35
36/* snapshots of runstate info */ 36/* snapshots of runstate info */
37static DEFINE_PER_CPU(struct vcpu_runstate_info, runstate_snapshot); 37static DEFINE_PER_CPU(struct vcpu_runstate_info, xen_runstate_snapshot);
38 38
39/* unused ns of stolen and blocked time */ 39/* unused ns of stolen and blocked time */
40static DEFINE_PER_CPU(u64, residual_stolen); 40static DEFINE_PER_CPU(u64, xen_residual_stolen);
41static DEFINE_PER_CPU(u64, residual_blocked); 41static DEFINE_PER_CPU(u64, xen_residual_blocked);
42 42
43/* return an consistent snapshot of 64-bit time/counter value */ 43/* return an consistent snapshot of 64-bit time/counter value */
44static u64 get64(const u64 *p) 44static u64 get64(const u64 *p)
@@ -79,7 +79,7 @@ static void get_runstate_snapshot(struct vcpu_runstate_info *res)
79 79
80 BUG_ON(preemptible()); 80 BUG_ON(preemptible());
81 81
82 state = &__get_cpu_var(runstate); 82 state = &__get_cpu_var(xen_runstate);
83 83
84 /* 84 /*
85 * The runstate info is always updated by the hypervisor on 85 * The runstate info is always updated by the hypervisor on
@@ -97,14 +97,14 @@ static void get_runstate_snapshot(struct vcpu_runstate_info *res)
97/* return true when a vcpu could run but has no real cpu to run on */ 97/* return true when a vcpu could run but has no real cpu to run on */
98bool xen_vcpu_stolen(int vcpu) 98bool xen_vcpu_stolen(int vcpu)
99{ 99{
100 return per_cpu(runstate, vcpu).state == RUNSTATE_runnable; 100 return per_cpu(xen_runstate, vcpu).state == RUNSTATE_runnable;
101} 101}
102 102
103static void setup_runstate_info(int cpu) 103void xen_setup_runstate_info(int cpu)
104{ 104{
105 struct vcpu_register_runstate_memory_area area; 105 struct vcpu_register_runstate_memory_area area;
106 106
107 area.addr.v = &per_cpu(runstate, cpu); 107 area.addr.v = &per_cpu(xen_runstate, cpu);
108 108
109 if (HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area, 109 if (HYPERVISOR_vcpu_op(VCPUOP_register_runstate_memory_area,
110 cpu, &area)) 110 cpu, &area))
@@ -122,7 +122,7 @@ static void do_stolen_accounting(void)
122 122
123 WARN_ON(state.state != RUNSTATE_running); 123 WARN_ON(state.state != RUNSTATE_running);
124 124
125 snap = &__get_cpu_var(runstate_snapshot); 125 snap = &__get_cpu_var(xen_runstate_snapshot);
126 126
127 /* work out how much time the VCPU has not been runn*ing* */ 127 /* work out how much time the VCPU has not been runn*ing* */
128 blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked]; 128 blocked = state.time[RUNSTATE_blocked] - snap->time[RUNSTATE_blocked];
@@ -133,24 +133,24 @@ static void do_stolen_accounting(void)
133 133
134 /* Add the appropriate number of ticks of stolen time, 134 /* Add the appropriate number of ticks of stolen time,
135 including any left-overs from last time. */ 135 including any left-overs from last time. */
136 stolen = runnable + offline + __get_cpu_var(residual_stolen); 136 stolen = runnable + offline + __get_cpu_var(xen_residual_stolen);
137 137
138 if (stolen < 0) 138 if (stolen < 0)
139 stolen = 0; 139 stolen = 0;
140 140
141 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen); 141 ticks = iter_div_u64_rem(stolen, NS_PER_TICK, &stolen);
142 __get_cpu_var(residual_stolen) = stolen; 142 __get_cpu_var(xen_residual_stolen) = stolen;
143 account_steal_ticks(ticks); 143 account_steal_ticks(ticks);
144 144
145 /* Add the appropriate number of ticks of blocked time, 145 /* Add the appropriate number of ticks of blocked time,
146 including any left-overs from last time. */ 146 including any left-overs from last time. */
147 blocked += __get_cpu_var(residual_blocked); 147 blocked += __get_cpu_var(xen_residual_blocked);
148 148
149 if (blocked < 0) 149 if (blocked < 0)
150 blocked = 0; 150 blocked = 0;
151 151
152 ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked); 152 ticks = iter_div_u64_rem(blocked, NS_PER_TICK, &blocked);
153 __get_cpu_var(residual_blocked) = blocked; 153 __get_cpu_var(xen_residual_blocked) = blocked;
154 account_idle_ticks(ticks); 154 account_idle_ticks(ticks);
155} 155}
156 156
@@ -434,7 +434,7 @@ void xen_setup_timer(int cpu)
434 name = "<timer kasprintf failed>"; 434 name = "<timer kasprintf failed>";
435 435
436 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt, 436 irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
437 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING, 437 IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER,
438 name, NULL); 438 name, NULL);
439 439
440 evt = &per_cpu(xen_clock_events, cpu); 440 evt = &per_cpu(xen_clock_events, cpu);
@@ -442,8 +442,6 @@ void xen_setup_timer(int cpu)
442 442
443 evt->cpumask = cpumask_of(cpu); 443 evt->cpumask = cpumask_of(cpu);
444 evt->irq = irq; 444 evt->irq = irq;
445
446 setup_runstate_info(cpu);
447} 445}
448 446
449void xen_teardown_timer(int cpu) 447void xen_teardown_timer(int cpu)
@@ -494,6 +492,7 @@ __init void xen_time_init(void)
494 492
495 setup_force_cpu_cap(X86_FEATURE_TSC); 493 setup_force_cpu_cap(X86_FEATURE_TSC);
496 494
495 xen_setup_runstate_info(cpu);
497 xen_setup_timer(cpu); 496 xen_setup_timer(cpu);
498 xen_setup_cpu_clockevents(); 497 xen_setup_cpu_clockevents();
499} 498}
diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
index 02f496a8dbaa..53adefda4275 100644
--- a/arch/x86/xen/xen-asm_64.S
+++ b/arch/x86/xen/xen-asm_64.S
@@ -96,7 +96,7 @@ ENTRY(xen_sysret32)
96 pushq $__USER32_CS 96 pushq $__USER32_CS
97 pushq %rcx 97 pushq %rcx
98 98
99 pushq $VGCF_in_syscall 99 pushq $0
1001: jmp hypercall_iret 1001: jmp hypercall_iret
101ENDPATCH(xen_sysret32) 101ENDPATCH(xen_sysret32)
102RELOC(xen_sysret32, 1b+1) 102RELOC(xen_sysret32, 1b+1)
@@ -151,7 +151,7 @@ ENTRY(xen_syscall32_target)
151ENTRY(xen_sysenter_target) 151ENTRY(xen_sysenter_target)
152 lea 16(%rsp), %rsp /* strip %rcx, %r11 */ 152 lea 16(%rsp), %rsp /* strip %rcx, %r11 */
153 mov $-ENOSYS, %rax 153 mov $-ENOSYS, %rax
154 pushq $VGCF_in_syscall 154 pushq $0
155 jmp hypercall_iret 155 jmp hypercall_iret
156ENDPROC(xen_syscall32_target) 156ENDPROC(xen_syscall32_target)
157ENDPROC(xen_sysenter_target) 157ENDPROC(xen_sysenter_target)
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index 355fa6b99c9c..f9153a300bce 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -25,6 +25,7 @@ extern struct shared_info *HYPERVISOR_shared_info;
25 25
26void xen_setup_mfn_list_list(void); 26void xen_setup_mfn_list_list(void);
27void xen_setup_shared_info(void); 27void xen_setup_shared_info(void);
28void xen_build_mfn_list_list(void);
28void xen_setup_machphys_mapping(void); 29void xen_setup_machphys_mapping(void);
29pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn); 30pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn);
30void xen_ident_map_ISA(void); 31void xen_ident_map_ISA(void);
@@ -41,6 +42,7 @@ void __init xen_build_dynamic_phys_to_machine(void);
41 42
42void xen_init_irq_ops(void); 43void xen_init_irq_ops(void);
43void xen_setup_timer(int cpu); 44void xen_setup_timer(int cpu);
45void xen_setup_runstate_info(int cpu);
44void xen_teardown_timer(int cpu); 46void xen_teardown_timer(int cpu);
45cycle_t xen_clocksource_read(void); 47cycle_t xen_clocksource_read(void);
46void xen_setup_cpu_clockevents(void); 48void xen_setup_cpu_clockevents(void);
diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h
index 05cebf8f62b1..4352dbe1186a 100644
--- a/arch/xtensa/include/asm/syscall.h
+++ b/arch/xtensa/include/asm/syscall.h
@@ -13,8 +13,6 @@ struct sigaction;
13asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*); 13asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*);
14asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*); 14asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*);
15asmlinkage long xtensa_pipe(int __user *); 15asmlinkage long xtensa_pipe(int __user *);
16asmlinkage long xtensa_mmap2(unsigned long, unsigned long, unsigned long,
17 unsigned long, unsigned long, unsigned long);
18asmlinkage long xtensa_ptrace(long, long, long, long); 16asmlinkage long xtensa_ptrace(long, long, long, long);
19asmlinkage long xtensa_sigreturn(struct pt_regs*); 17asmlinkage long xtensa_sigreturn(struct pt_regs*);
20asmlinkage long xtensa_rt_sigreturn(struct pt_regs*); 18asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
index 4e55dc763021..fbf318b3af3e 100644
--- a/arch/xtensa/include/asm/unistd.h
+++ b/arch/xtensa/include/asm/unistd.h
@@ -189,7 +189,7 @@ __SYSCALL( 79, sys_fremovexattr, 2)
189/* File Map / Shared Memory Operations */ 189/* File Map / Shared Memory Operations */
190 190
191#define __NR_mmap2 80 191#define __NR_mmap2 80
192__SYSCALL( 80, xtensa_mmap2, 6) 192__SYSCALL( 80, sys_mmap_pgoff, 6)
193#define __NR_munmap 81 193#define __NR_munmap 81
194__SYSCALL( 81, sys_munmap, 2) 194__SYSCALL( 81, sys_munmap, 2)
195#define __NR_mprotect 82 195#define __NR_mprotect 82
diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c
index ac15ecbdf919..1e67bab775c1 100644
--- a/arch/xtensa/kernel/syscall.c
+++ b/arch/xtensa/kernel/syscall.c
@@ -57,31 +57,6 @@ asmlinkage long xtensa_pipe(int __user *userfds)
57 return error; 57 return error;
58} 58}
59 59
60
61asmlinkage long xtensa_mmap2(unsigned long addr, unsigned long len,
62 unsigned long prot, unsigned long flags,
63 unsigned long fd, unsigned long pgoff)
64{
65 int error = -EBADF;
66 struct file * file = NULL;
67
68 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
69 if (!(flags & MAP_ANONYMOUS)) {
70 file = fget(fd);
71 if (!file)
72 goto out;
73 }
74
75 down_write(&current->mm->mmap_sem);
76 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
77 up_write(&current->mm->mmap_sem);
78
79 if (file)
80 fput(file);
81out:
82 return error;
83}
84
85asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) 60asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
86{ 61{
87 unsigned long ret; 62 unsigned long ret;
diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index 4c559cf7da2d..e60a1f57022f 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -196,7 +196,7 @@ static const struct file_operations rs_proc_fops = {
196 .release = single_release, 196 .release = single_release,
197}; 197};
198 198
199static struct tty_operations serial_ops = { 199static const struct tty_operations serial_ops = {
200 .open = rs_open, 200 .open = rs_open,
201 .close = rs_close, 201 .close = rs_close,
202 .write = rs_write, 202 .write = rs_write,