aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig4
-rw-r--r--arch/arm/Kconfig47
-rw-r--r--arch/arm/common/gic.c28
-rw-r--r--arch/arm/configs/mx51_defconfig1
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h13
-rw-r--r--arch/arm/include/asm/hardware/it8152.h2
-rw-r--r--arch/arm/include/asm/kgdb.h5
-rw-r--r--arch/arm/include/asm/memblock.h7
-rw-r--r--arch/arm/include/asm/outercache.h24
-rw-r--r--arch/arm/kernel/hw_breakpoint.c3
-rw-r--r--arch/arm/kernel/kgdb.c2
-rw-r--r--arch/arm/kernel/machine_kexec.c3
-rw-r--r--arch/arm/kernel/perf_event.c2
-rw-r--r--arch/arm/kernel/stacktrace.c2
-rw-r--r--arch/arm/kernel/traps.c5
-rw-r--r--arch/arm/kernel/unwind.c2
-rw-r--r--arch/arm/kernel/vmlinux.lds.S1
-rw-r--r--arch/arm/mach-ep93xx/include/mach/dma.h111
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c38
-rw-r--r--arch/arm/mach-ixp2000/core.c2
-rw-r--r--arch/arm/mach-kirkwood/common.c7
-rw-r--r--arch/arm/mach-kirkwood/d2net_v2-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.c14
-rw-r--r--arch/arm/mach-kirkwood/lacie_v2-common.h2
-rw-r--r--arch/arm/mach-kirkwood/mpp.c4
-rw-r--r--arch/arm/mach-kirkwood/netspace_v2-setup.c6
-rw-r--r--arch/arm/mach-kirkwood/netxbig_v2-setup.c4
-rw-r--r--arch/arm/mach-kirkwood/ts41x-setup.c14
-rw-r--r--arch/arm/mach-mmp/include/mach/cputype.h3
-rw-r--r--arch/arm/mach-msm/Kconfig9
-rw-r--r--arch/arm/mach-msm/board-halibut.c1
-rw-r--r--arch/arm/mach-msm/include/mach/debug-macro.S15
-rw-r--r--arch/arm/mach-msm/iommu_dev.c22
-rw-r--r--arch/arm/mach-msm/timer.c2
-rw-r--r--arch/arm/mach-mv78xx0/mpp.c4
-rw-r--r--arch/arm/mach-mx25/Kconfig1
-rw-r--r--arch/arm/mach-mx25/mach-mx25_3ds.c10
-rw-r--r--arch/arm/mach-mx3/Kconfig2
-rw-r--r--arch/arm/mach-mx3/devices.c16
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c38
-rw-r--r--arch/arm/mach-mx3/mach-mx35_3ds.c16
-rw-r--r--arch/arm/mach-mx3/mach-pcm037.c2
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c1
-rw-r--r--arch/arm/mach-mx3/mx31moboard-smartbot.c1
-rw-r--r--arch/arm/mach-mx5/Kconfig2
-rw-r--r--arch/arm/mach-mx5/Makefile1
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c49
-rw-r--r--arch/arm/mach-mx5/clock-mx51.c22
-rw-r--r--arch/arm/mach-mx5/cpu_op-mx51.c29
-rw-r--r--arch/arm/mach-mx5/cpu_op-mx51.h14
-rw-r--r--arch/arm/mach-mx5/devices-imx51.h2
-rw-r--r--arch/arm/mach-omap1/devices.c5
-rw-r--r--arch/arm/mach-omap1/include/mach/camera.h2
-rw-r--r--arch/arm/mach-omap2/Makefile4
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c7
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c3
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c15
-rw-r--r--arch/arm/mach-omap2/dsp.c85
-rw-r--r--arch/arm/mach-omap2/omap4-common.c13
-rw-r--r--arch/arm/mach-orion5x/mpp.c4
-rw-r--r--arch/arm/mach-orion5x/ts78xx-setup.c2
-rw-r--r--arch/arm/mach-pxa/cm-x2xx.c2
-rw-r--r--arch/arm/mach-pxa/em-x270.c1
-rw-r--r--arch/arm/mach-pxa/ezx.c2
-rw-r--r--arch/arm/mach-pxa/mioa701.c1
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c2
-rw-r--r--arch/arm/mach-pxa/saar.c2
-rw-r--r--arch/arm/mach-s3c2410/h1940-bluetooth.c13
-rw-r--r--arch/arm/mach-s3c2410/include/mach/gpio.h10
-rw-r--r--arch/arm/mach-s3c2410/include/mach/h1940-latch.h57
-rw-r--r--arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c169
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c3
-rw-r--r--arch/arm/mach-s3c2416/Kconfig6
-rw-r--r--arch/arm/mach-s3c2416/Makefile2
-rw-r--r--arch/arm/mach-s3c2416/irq.c2
-rw-r--r--arch/arm/mach-s3c2416/pm.c84
-rw-r--r--arch/arm/mach-s3c2416/s3c2416.c3
-rw-r--r--arch/arm/mach-s3c2440/Kconfig7
-rw-r--r--arch/arm/mach-s3c2440/mach-rx1950.c218
-rw-r--r--arch/arm/mach-s3c2440/s3c244x.c3
-rw-r--r--arch/arm/mach-s3c2443/s3c2443.c3
-rw-r--r--arch/arm/mach-s3c24a0/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s3c64xx/Kconfig24
-rw-r--r--arch/arm/mach-s3c64xx/Makefile1
-rw-r--r--arch/arm/mach-s3c64xx/dev-audio.c63
-rw-r--r--arch/arm/mach-s3c64xx/gpiolib.c8
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s3c64xx/mach-mini6410.c357
-rw-r--r--arch/arm/mach-s3c64xx/mach-real6410.c198
-rw-r--r--arch/arm/mach-s3c64xx/setup-fb-24bpp.c13
-rw-r--r--arch/arm/mach-s3c64xx/setup-ide.c11
-rw-r--r--arch/arm/mach-s3c64xx/setup-keypad.c16
-rw-r--r--arch/arm/mach-s3c64xx/setup-sdhci-gpio.c41
-rw-r--r--arch/arm/mach-s5p6442/Kconfig1
-rw-r--r--arch/arm/mach-s5p6442/clock.c28
-rw-r--r--arch/arm/mach-s5p6442/dev-audio.c30
-rw-r--r--arch/arm/mach-s5p6442/dev-spi.c6
-rw-r--r--arch/arm/mach-s5p6442/dma.c2
-rw-r--r--arch/arm/mach-s5p6442/include/mach/regs-clock.h1
-rw-r--r--arch/arm/mach-s5p6442/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s5p64x0/Kconfig2
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6440.c19
-rw-r--r--arch/arm/mach-s5p64x0/clock-s5p6450.c19
-rw-r--r--arch/arm/mach-s5p64x0/clock.c18
-rw-r--r--arch/arm/mach-s5p64x0/dev-audio.c26
-rw-r--r--arch/arm/mach-s5p64x0/dev-spi.c38
-rw-r--r--arch/arm/mach-s5p64x0/dma.c2
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/regs-clock.h2
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s5p64x0/setup-i2c0.c12
-rw-r--r--arch/arm/mach-s5p64x0/setup-i2c1.c12
-rw-r--r--arch/arm/mach-s5pc100/Kconfig1
-rw-r--r--arch/arm/mach-s5pc100/Makefile2
-rw-r--r--arch/arm/mach-s5pc100/clock.c174
-rw-r--r--arch/arm/mach-s5pc100/dev-audio.c86
-rw-r--r--arch/arm/mach-s5pc100/dev-spi.c22
-rw-r--r--arch/arm/mach-s5pc100/dma.c4
-rw-r--r--arch/arm/mach-s5pc100/gpiolib.c216
-rw-r--r--arch/arm/mach-s5pc100/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-s5pc100/include/mach/irqs.h13
-rw-r--r--arch/arm/mach-s5pc100/include/mach/map.h2
-rw-r--r--arch/arm/mach-s5pc100/include/mach/regs-gpio.h49
-rw-r--r--arch/arm/mach-s5pc100/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s5pc100/irq-gpio.c266
-rw-r--r--arch/arm/mach-s5pc100/mach-smdkc100.c4
-rw-r--r--arch/arm/mach-s5pc100/setup-fb-24bpp.c30
-rw-r--r--arch/arm/mach-s5pc100/setup-i2c0.c6
-rw-r--r--arch/arm/mach-s5pc100/setup-i2c1.c6
-rw-r--r--arch/arm/mach-s5pc100/setup-ide.c41
-rw-r--r--arch/arm/mach-s5pc100/setup-keypad.c15
-rw-r--r--arch/arm/mach-s5pc100/setup-sdhci-gpio.c35
-rw-r--r--arch/arm/mach-s5pv210/Kconfig37
-rw-r--r--arch/arm/mach-s5pv210/Makefile3
-rw-r--r--arch/arm/mach-s5pv210/clock.c207
-rw-r--r--arch/arm/mach-s5pv210/cpu.c15
-rw-r--r--arch/arm/mach-s5pv210/cpufreq.c484
-rw-r--r--arch/arm/mach-s5pv210/dev-audio.c86
-rw-r--r--arch/arm/mach-s5pv210/dev-spi.c19
-rw-r--r--arch/arm/mach-s5pv210/dma.c4
-rw-r--r--arch/arm/mach-s5pv210/gpiolib.c14
-rw-r--r--arch/arm/mach-s5pv210/include/mach/irqs.h12
-rw-r--r--arch/arm/mach-s5pv210/include/mach/map.h12
-rw-r--r--arch/arm/mach-s5pv210/include/mach/pm-core.h43
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-clock.h39
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-gpio.h7
-rw-r--r--arch/arm/mach-s5pv210/include/mach/regs-sys.h19
-rw-r--r--arch/arm/mach-s5pv210/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s5pv210/mach-aquila.c169
-rw-r--r--arch/arm/mach-s5pv210/mach-goni.c381
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkc110.c4
-rw-r--r--arch/arm/mach-s5pv210/mach-smdkv210.c4
-rw-r--r--arch/arm/mach-s5pv210/mach-torbreck.c131
-rw-r--r--arch/arm/mach-s5pv210/pm.c166
-rw-r--r--arch/arm/mach-s5pv210/setup-fb-24bpp.c34
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c0.c6
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c1.c6
-rw-r--r--arch/arm/mach-s5pv210/setup-i2c2.c6
-rw-r--r--arch/arm/mach-s5pv210/setup-ide.c49
-rw-r--r--arch/arm/mach-s5pv210/setup-keypad.c14
-rw-r--r--arch/arm/mach-s5pv210/setup-sdhci-gpio.c57
-rw-r--r--arch/arm/mach-s5pv210/sleep.S170
-rw-r--r--arch/arm/mach-s5pv310/Kconfig95
-rw-r--r--arch/arm/mach-s5pv310/Makefile10
-rw-r--r--arch/arm/mach-s5pv310/clock.c635
-rw-r--r--arch/arm/mach-s5pv310/cpu.c47
-rw-r--r--arch/arm/mach-s5pv310/gpiolib.c304
-rw-r--r--arch/arm/mach-s5pv310/hotplug.c144
-rw-r--r--arch/arm/mach-s5pv310/include/mach/irqs.h44
-rw-r--r--arch/arm/mach-s5pv310/include/mach/map.h19
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-clock.h32
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-gpio.h42
-rw-r--r--arch/arm/mach-s5pv310/include/mach/regs-srom.h50
-rw-r--r--arch/arm/mach-s5pv310/include/mach/vmalloc.h2
-rw-r--r--arch/arm/mach-s5pv310/irq-combiner.c6
-rw-r--r--arch/arm/mach-s5pv310/irq-eint.c228
-rw-r--r--arch/arm/mach-s5pv310/mach-smdkc210.c202
-rw-r--r--arch/arm/mach-s5pv310/mach-smdkv310.c121
-rw-r--r--arch/arm/mach-s5pv310/mach-universal_c210.c81
-rw-r--r--arch/arm/mach-s5pv310/setup-i2c0.c6
-rw-r--r--arch/arm/mach-s5pv310/setup-i2c1.c6
-rw-r--r--arch/arm/mach-s5pv310/setup-i2c2.c6
-rw-r--r--arch/arm/mach-s5pv310/setup-i2c3.c23
-rw-r--r--arch/arm/mach-s5pv310/setup-i2c4.c23
-rw-r--r--arch/arm/mach-s5pv310/setup-i2c5.c23
-rw-r--r--arch/arm/mach-s5pv310/setup-i2c6.c23
-rw-r--r--arch/arm/mach-s5pv310/setup-i2c7.c23
-rw-r--r--arch/arm/mach-s5pv310/setup-sdhci-gpio.c152
-rw-r--r--arch/arm/mach-s5pv310/setup-sdhci.c69
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1100.c5
-rw-r--r--arch/arm/mach-shmobile/Kconfig2
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c387
-rw-r--r--arch/arm/mach-shmobile/clock-sh7367.c2
-rw-r--r--arch/arm/mach-shmobile/clock-sh7372.c180
-rw-r--r--arch/arm/mach-shmobile/clock-sh7377.c2
-rw-r--r--arch/arm/mach-shmobile/include/mach/gpio.h4
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h12
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c30
-rw-r--r--arch/arm/mach-shmobile/pfc-sh7372.c8
-rw-r--r--arch/arm/mach-shmobile/setup-sh7367.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c94
-rw-r--r--arch/arm/mach-shmobile/setup-sh7377.c1
-rw-r--r--arch/arm/mach-u300/clock.c6
-rw-r--r--arch/arm/mach-u300/core.c47
-rw-r--r--arch/arm/mach-u300/include/mach/u300-regs.h2
-rw-r--r--arch/arm/mach-u300/spi.c2
-rw-r--r--arch/arm/mach-ux500/cpu.c45
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c2
-rw-r--r--arch/arm/mm/Kconfig8
-rw-r--r--arch/arm/mm/cache-fa.S12
-rw-r--r--arch/arm/mm/cache-l2x0.c78
-rw-r--r--arch/arm/mm/cache-v3.S10
-rw-r--r--arch/arm/mm/cache-v4.S10
-rw-r--r--arch/arm/mm/cache-v4wb.S12
-rw-r--r--arch/arm/mm/cache-v4wt.S12
-rw-r--r--arch/arm/mm/dma-mapping.c2
-rw-r--r--arch/arm/mm/fault-armv.c28
-rw-r--r--arch/arm/mm/init.c155
-rw-r--r--arch/arm/mm/mmu.c73
-rw-r--r--arch/arm/mm/proc-arm1020.S15
-rw-r--r--arch/arm/mm/proc-arm1020e.S15
-rw-r--r--arch/arm/mm/proc-arm1022.S15
-rw-r--r--arch/arm/mm/proc-arm1026.S15
-rw-r--r--arch/arm/mm/proc-arm920.S12
-rw-r--r--arch/arm/mm/proc-arm922.S12
-rw-r--r--arch/arm/mm/proc-arm925.S12
-rw-r--r--arch/arm/mm/proc-arm926.S12
-rw-r--r--arch/arm/mm/proc-arm940.S12
-rw-r--r--arch/arm/mm/proc-arm946.S12
-rw-r--r--arch/arm/mm/proc-feroceon.S13
-rw-r--r--arch/arm/mm/proc-xsc3.S12
-rw-r--r--arch/arm/mm/proc-xscale.S12
-rw-r--r--arch/arm/plat-mxc/Makefile1
-rw-r--r--arch/arm/plat-mxc/cpufreq.c206
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig6
-rw-r--r--arch/arm/plat-mxc/devices/Makefile1
-rw-r--r--arch/arm/plat-mxc/devices/platform-gpio_keys.c27
-rw-r--r--arch/arm/plat-mxc/gpio.c32
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx51.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h1
-rw-r--r--arch/arm/plat-mxc/include/mach/mx35.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc.h13
-rw-r--r--arch/arm/plat-omap/common.c2
-rw-r--r--arch/arm/plat-omap/devices.c72
-rw-r--r--arch/arm/plat-omap/dma.c2
-rw-r--r--arch/arm/plat-omap/include/plat/dsp.h31
-rw-r--r--arch/arm/plat-orion/include/plat/pcie.h3
-rw-r--r--arch/arm/plat-orion/pcie.c5
-rw-r--r--arch/arm/plat-pxa/include/plat/pxa3xx_nand.h18
-rw-r--r--arch/arm/plat-pxa/include/plat/sdhci.h32
-rw-r--r--arch/arm/plat-s3c24xx/Kconfig1
-rw-r--r--arch/arm/plat-s3c24xx/common-smdk.c2
-rw-r--r--arch/arm/plat-s3c24xx/gpiolib.c10
-rw-r--r--arch/arm/plat-s5p/Kconfig5
-rw-r--r--arch/arm/plat-s5p/Makefile3
-rw-r--r--arch/arm/plat-s5p/clock.c29
-rw-r--r--arch/arm/plat-s5p/include/plat/irqs.h18
-rw-r--r--arch/arm/plat-s5p/include/plat/map-s5p.h40
-rw-r--r--arch/arm/plat-s5p/include/plat/s5p-clock.h4
-rw-r--r--arch/arm/plat-s5p/irq-eint.c10
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c237
-rw-r--r--arch/arm/plat-s5p/irq-pm.c93
-rw-r--r--arch/arm/plat-s5p/pm.c52
-rw-r--r--arch/arm/plat-samsung/Kconfig25
-rw-r--r--arch/arm/plat-samsung/Makefile5
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc.c8
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc1.c8
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc2.c8
-rw-r--r--arch/arm/plat-samsung/dev-hsmmc3.c12
-rw-r--r--arch/arm/plat-samsung/dev-i2c2.c4
-rw-r--r--arch/arm/plat-samsung/dev-i2c3.c68
-rw-r--r--arch/arm/plat-samsung/dev-i2c4.c68
-rw-r--r--arch/arm/plat-samsung/dev-i2c5.c68
-rw-r--r--arch/arm/plat-samsung/dev-i2c6.c68
-rw-r--r--arch/arm/plat-samsung/dev-i2c7.c68
-rw-r--r--arch/arm/plat-samsung/gpio-config.c50
-rw-r--r--arch/arm/plat-samsung/gpio.c8
-rw-r--r--arch/arm/plat-samsung/include/plat/audio.h9
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h7
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h6
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-cfg.h56
-rw-r--r--arch/arm/plat-samsung/include/plat/gpio-core.h15
-rw-r--r--arch/arm/plat-samsung/include/plat/iic.h10
-rw-r--r--arch/arm/plat-samsung/include/plat/map-base.h4
-rw-r--r--arch/arm/plat-samsung/include/plat/nand-core.h28
-rw-r--r--arch/arm/plat-samsung/include/plat/sdhci.h64
-rw-r--r--arch/arm/plat-samsung/pm-gpio.c4
-rw-r--r--arch/arm/plat-samsung/s3c-pl330.c34
-rw-r--r--arch/avr32/Kconfig7
-rw-r--r--arch/blackfin/Kconfig7
-rw-r--r--arch/blackfin/kernel/kgdb.c3
-rw-r--r--arch/cris/Kconfig7
-rw-r--r--arch/frv/Kconfig6
-rw-r--r--arch/h8300/Kconfig7
-rw-r--r--arch/ia64/Kconfig7
-rw-r--r--arch/ia64/kernel/perfmon.c9
-rw-r--r--arch/m32r/Kconfig7
-rw-r--r--arch/m68k/Kconfig6
-rw-r--r--arch/m68k/include/asm/irqflags.h2
-rw-r--r--arch/m68k/include/asm/machdep.h1
-rw-r--r--arch/m68knommu/Kconfig7
-rw-r--r--arch/microblaze/Kconfig5
-rw-r--r--arch/mips/Kconfig81
-rw-r--r--arch/mips/Kconfig.debug9
-rw-r--r--arch/mips/Makefile4
-rw-r--r--arch/mips/ar7/gpio.c243
-rw-r--r--arch/mips/ar7/platform.c56
-rw-r--r--arch/mips/ar7/prom.c2
-rw-r--r--arch/mips/ar7/setup.c14
-rw-r--r--arch/mips/bcm63xx/cpu.c30
-rw-r--r--arch/mips/cavium-octeon/Kconfig23
-rw-r--r--arch/mips/cavium-octeon/csrc-octeon.c34
-rw-r--r--arch/mips/cavium-octeon/dma-octeon.c581
-rw-r--r--arch/mips/cavium-octeon/executive/cvmx-l2c.c810
-rw-r--r--arch/mips/cavium-octeon/octeon-platform.c112
-rw-r--r--arch/mips/cavium-octeon/serial.c2
-rw-r--r--arch/mips/cavium-octeon/setup.c120
-rw-r--r--arch/mips/include/asm/atomic.h208
-rw-r--r--arch/mips/include/asm/bitops.h270
-rw-r--r--arch/mips/include/asm/bootinfo.h12
-rw-r--r--arch/mips/include/asm/cmpxchg.h7
-rw-r--r--arch/mips/include/asm/cpu.h26
-rw-r--r--arch/mips/include/asm/device.h15
-rw-r--r--arch/mips/include/asm/dma-mapping.h96
-rw-r--r--arch/mips/include/asm/dma.h3
-rw-r--r--arch/mips/include/asm/local.h2
-rw-r--r--arch/mips/include/asm/mach-ar7/ar7.h47
-rw-r--r--arch/mips/include/asm/mach-ar7/gpio.h3
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h97
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h8
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h24
-rw-r--r--arch/mips/include/asm/mach-ip27/dma-coherence.h5
-rw-r--r--arch/mips/include/asm/mach-ip32/dma-coherence.h5
-rw-r--r--arch/mips/include/asm/mach-jazz/dma-coherence.h9
-rw-r--r--arch/mips/include/asm/mipsregs.h51
-rw-r--r--arch/mips/include/asm/octeon/cvmx-agl-defs.h616
-rw-r--r--arch/mips/include/asm/octeon/cvmx-asm.h11
-rw-r--r--arch/mips/include/asm/octeon/cvmx-ciu-defs.h857
-rw-r--r--arch/mips/include/asm/octeon/cvmx-gpio-defs.h74
-rw-r--r--arch/mips/include/asm/octeon/cvmx-iob-defs.h242
-rw-r--r--arch/mips/include/asm/octeon/cvmx-ipd-defs.h314
-rw-r--r--arch/mips/include/asm/octeon/cvmx-l2c-defs.h738
-rw-r--r--arch/mips/include/asm/octeon/cvmx-l2c.h225
-rw-r--r--arch/mips/include/asm/octeon/cvmx-l2d-defs.h38
-rw-r--r--arch/mips/include/asm/octeon/cvmx-l2t-defs.h5
-rw-r--r--arch/mips/include/asm/octeon/cvmx-led-defs.h41
-rw-r--r--arch/mips/include/asm/octeon/cvmx-mio-defs.h807
-rw-r--r--arch/mips/include/asm/octeon/cvmx-mixx-defs.h200
-rw-r--r--arch/mips/include/asm/octeon/cvmx-npei-defs.h681
-rw-r--r--arch/mips/include/asm/octeon/cvmx-npi-defs.h362
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pci-defs.h265
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pciercx-defs.h435
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pescx-defs.h50
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pexp-defs.h378
-rw-r--r--arch/mips/include/asm/octeon/cvmx-pow-defs.h157
-rw-r--r--arch/mips/include/asm/octeon/cvmx-rnm-defs.h67
-rw-r--r--arch/mips/include/asm/octeon/cvmx-smix-defs.h46
-rw-r--r--arch/mips/include/asm/octeon/cvmx-uctlx-defs.h261
-rw-r--r--arch/mips/include/asm/octeon/octeon-model.h36
-rw-r--r--arch/mips/include/asm/octeon/octeon.h1
-rw-r--r--arch/mips/include/asm/octeon/pci-octeon.h10
-rw-r--r--arch/mips/include/asm/perf_event.h25
-rw-r--r--arch/mips/include/asm/pgtable-64.h4
-rw-r--r--arch/mips/include/asm/processor.h40
-rw-r--r--arch/mips/include/asm/system.h52
-rw-r--r--arch/mips/include/asm/thread_info.h2
-rw-r--r--arch/mips/include/asm/uaccess.h4
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/cpu-probe.c82
-rw-r--r--arch/mips/kernel/irq.c24
-rw-r--r--arch/mips/kernel/perf_event.c601
-rw-r--r--arch/mips/kernel/perf_event_mipsxx.c1052
-rw-r--r--arch/mips/kernel/setup.c1
-rw-r--r--arch/mips/kernel/traps.c31
-rw-r--r--arch/mips/kernel/unaligned.c7
-rw-r--r--arch/mips/loongson/Kconfig2
-rw-r--r--arch/mips/math-emu/cp1emu.c3
-rw-r--r--arch/mips/mm/c-octeon.c16
-rw-r--r--arch/mips/mm/c-r4k.c21
-rw-r--r--arch/mips/mm/dma-default.c165
-rw-r--r--arch/mips/mm/fault.c11
-rw-r--r--arch/mips/mm/sc-mips.c34
-rw-r--r--arch/mips/mm/tlbex.c11
-rw-r--r--arch/mips/mm/uasm.c20
-rw-r--r--arch/mips/pci/pci-octeon.c60
-rw-r--r--arch/mips/pci/pcie-octeon.c5
-rw-r--r--arch/mn10300/Kconfig9
-rw-r--r--arch/parisc/Kconfig11
-rw-r--r--arch/parisc/include/asm/cache.h2
-rw-r--r--arch/parisc/include/asm/cacheflush.h8
-rw-r--r--arch/parisc/include/asm/irq.h2
-rw-r--r--arch/parisc/include/asm/unistd.h3
-rw-r--r--arch/parisc/kernel/irq.c41
-rw-r--r--arch/parisc/kernel/pdc_cons.c141
-rw-r--r--arch/parisc/kernel/syscall_table.S1
-rw-r--r--arch/parisc/kernel/unaligned.c3
-rw-r--r--arch/parisc/kernel/unwind.c5
-rw-r--r--arch/parisc/math-emu/Makefile2
-rw-r--r--arch/powerpc/Kconfig13
-rw-r--r--arch/powerpc/include/asm/fsl_lbc.h34
-rw-r--r--arch/powerpc/include/asm/kgdb.h1
-rw-r--r--arch/powerpc/kernel/kgdb.c188
-rw-r--r--arch/powerpc/kernel/kvm.c2
-rw-r--r--arch/powerpc/kvm/booke_interrupts.S2
-rw-r--r--arch/powerpc/kvm/e500.c2
-rw-r--r--arch/powerpc/kvm/powerpc.c1
-rw-r--r--arch/powerpc/kvm/timing.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c10
-rw-r--r--arch/powerpc/sysdev/fsl_lbc.c244
-rw-r--r--arch/s390/Kconfig68
-rw-r--r--arch/s390/hypfs/hypfs_diag.c19
-rw-r--r--arch/s390/hypfs/inode.c8
-rw-r--r--arch/s390/include/asm/dasd.h40
-rw-r--r--arch/s390/kernel/asm-offsets.c6
-rw-r--r--arch/s390/kernel/early.c2
-rw-r--r--arch/s390/kernel/entry.S1
-rw-r--r--arch/s390/kernel/entry64.S1
-rw-r--r--arch/s390/kernel/kprobes.c9
-rw-r--r--arch/s390/kernel/setup.c3
-rw-r--r--arch/s390/kernel/sysinfo.c2
-rw-r--r--arch/s390/kernel/topology.c6
-rw-r--r--arch/s390/kernel/vdso32/clock_getres.S6
-rw-r--r--arch/s390/kernel/vdso32/clock_gettime.S4
-rw-r--r--arch/s390/kernel/vdso64/clock_getres.S6
-rw-r--r--arch/s390/kernel/vdso64/clock_gettime.S4
-rw-r--r--arch/score/Kconfig5
-rw-r--r--arch/sh/Kconfig22
-rw-r--r--arch/sh/Makefile3
-rw-r--r--arch/sh/boards/Kconfig7
-rw-r--r--arch/sh/boards/Makefile2
-rw-r--r--arch/sh/boards/board-edosk7705.c78
-rw-r--r--arch/sh/boards/board-secureedge5410.c (renamed from arch/sh/boards/mach-snapgear/setup.c)38
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c30
-rw-r--r--arch/sh/boards/mach-cayman/irq.c16
-rw-r--r--arch/sh/boards/mach-dreamcast/irq.c17
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c64
-rw-r--r--arch/sh/boards/mach-edosk7705/Makefile5
-rw-r--r--arch/sh/boards/mach-edosk7705/io.c71
-rw-r--r--arch/sh/boards/mach-edosk7705/setup.c36
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c30
-rw-r--r--arch/sh/boards/mach-landisk/irq.c15
-rw-r--r--arch/sh/boards/mach-microdev/io.c246
-rw-r--r--arch/sh/boards/mach-microdev/irq.c30
-rw-r--r--arch/sh/boards/mach-microdev/setup.c23
-rw-r--r--arch/sh/boards/mach-migor/setup.c60
-rw-r--r--arch/sh/boards/mach-se/7206/Makefile2
-rw-r--r--arch/sh/boards/mach-se/7206/io.c104
-rw-r--r--arch/sh/boards/mach-se/7206/irq.c24
-rw-r--r--arch/sh/boards/mach-se/7206/setup.c15
-rw-r--r--arch/sh/boards/mach-se/7343/irq.c15
-rw-r--r--arch/sh/boards/mach-se/770x/Makefile2
-rw-r--r--arch/sh/boards/mach-se/770x/io.c156
-rw-r--r--arch/sh/boards/mach-se/770x/setup.c22
-rw-r--r--arch/sh/boards/mach-se/7722/irq.c15
-rw-r--r--arch/sh/boards/mach-se/7724/irq.c13
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c55
-rw-r--r--arch/sh/boards/mach-se/7751/Makefile2
-rw-r--r--arch/sh/boards/mach-se/7751/io.c119
-rw-r--r--arch/sh/boards/mach-se/7751/setup.c18
-rw-r--r--arch/sh/boards/mach-snapgear/Makefile5
-rw-r--r--arch/sh/boards/mach-snapgear/io.c121
-rw-r--r--arch/sh/boards/mach-systemh/Makefile13
-rw-r--r--arch/sh/boards/mach-systemh/io.c158
-rw-r--r--arch/sh/boards/mach-systemh/irq.c76
-rw-r--r--arch/sh/boards/mach-systemh/setup.c57
-rw-r--r--arch/sh/boards/mach-x3proto/gpio.c7
-rw-r--r--arch/sh/cchips/hd6446x/hd64461.c19
-rw-r--r--arch/sh/configs/secureedge5410_defconfig (renamed from arch/sh/configs/snapgear_defconfig)0
-rw-r--r--arch/sh/configs/systemh_defconfig28
-rw-r--r--arch/sh/include/asm/addrspace.h8
-rw-r--r--arch/sh/include/asm/pgtable.h14
-rw-r--r--arch/sh/include/asm/pgtable_32.h2
-rw-r--r--arch/sh/include/asm/pgtable_64.h9
-rw-r--r--arch/sh/include/asm/processor.h1
-rw-r--r--arch/sh/include/asm/system.h4
-rw-r--r--arch/sh/include/asm/system_32.h36
-rw-r--r--arch/sh/include/asm/system_64.h3
-rw-r--r--arch/sh/include/asm/uncached.h40
-rw-r--r--arch/sh/include/mach-common/mach/edosk7705.h7
-rw-r--r--arch/sh/include/mach-common/mach/microdev.h9
-rw-r--r--arch/sh/include/mach-common/mach/secureedge5410.h (renamed from arch/sh/include/mach-common/mach/snapgear.h)22
-rw-r--r--arch/sh/include/mach-common/mach/systemh7751.h71
-rw-r--r--arch/sh/kernel/cpu/init.c2
-rw-r--r--arch/sh/kernel/cpu/irq/imask.c14
-rw-r--r--arch/sh/kernel/cpu/irq/intc-sh5.c49
-rw-r--r--arch/sh/kernel/cpu/irq/ipr.c29
-rw-r--r--arch/sh/kernel/cpu/sh4/perf_event.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c6
-rw-r--r--arch/sh/kernel/cpu/sh4a/perf_event.c2
-rw-r--r--arch/sh/kernel/irq.c37
-rw-r--r--arch/sh/kernel/irq_64.c16
-rw-r--r--arch/sh/kernel/setup.c4
-rw-r--r--arch/sh/mm/Kconfig2
-rw-r--r--arch/sh/mm/Makefile2
-rw-r--r--arch/sh/mm/consistent.c15
-rw-r--r--arch/sh/mm/gup.c273
-rw-r--r--arch/sh/mm/uncached.c2
-rw-r--r--arch/sh/oprofile/Makefile2
-rw-r--r--arch/sh/oprofile/backtrace.c2
-rw-r--r--arch/sh/oprofile/common.c35
-rw-r--r--arch/sh/tools/mach-types1
-rw-r--r--arch/sparc/Kconfig9
-rw-r--r--arch/sparc/include/asm/jump_label.h1
-rw-r--r--arch/sparc/kernel/irq_32.c4
-rw-r--r--arch/sparc/kernel/leon_smp.c4
-rw-r--r--arch/sparc/kernel/rtrap_32.S6
-rw-r--r--arch/sparc/kernel/rtrap_64.S36
-rw-r--r--arch/sparc/mm/fault_32.c12
-rw-r--r--arch/tile/Kconfig2
-rw-r--r--arch/tile/include/asm/highmem.h1
-rw-r--r--arch/tile/include/asm/kmap_types.h34
-rw-r--r--arch/tile/include/asm/pgtable.h6
-rw-r--r--arch/tile/include/asm/stat.h3
-rw-r--r--arch/tile/include/asm/unistd.h1
-rw-r--r--arch/tile/kernel/compat.c10
-rw-r--r--arch/tile/kernel/early_printk.c2
-rw-r--r--arch/tile/kernel/hardwall.c6
-rw-r--r--arch/tile/kernel/irq.c4
-rw-r--r--arch/tile/kernel/machine_kexec.c6
-rw-r--r--arch/tile/kernel/messaging.c2
-rw-r--r--arch/tile/kernel/ptrace.c39
-rw-r--r--arch/tile/kernel/reboot.c6
-rw-r--r--arch/tile/kernel/setup.c8
-rw-r--r--arch/tile/kernel/signal.c9
-rw-r--r--arch/tile/kernel/smp.c2
-rw-r--r--arch/tile/kernel/time.c8
-rw-r--r--arch/tile/lib/memcpy_tile64.c11
-rw-r--r--arch/tile/mm/highmem.c2
-rw-r--r--arch/tile/mm/init.c8
-rw-r--r--arch/tile/mm/pgtable.c4
-rw-r--r--arch/um/Kconfig.common2
-rw-r--r--arch/um/include/asm/ptrace-generic.h4
-rw-r--r--arch/um/kernel/ptrace.c2
-rw-r--r--arch/x86/Kbuild1
-rw-r--r--arch/x86/Kconfig8
-rw-r--r--arch/x86/include/asm/acpi.h3
-rw-r--r--arch/x86/include/asm/apic.h10
-rw-r--r--arch/x86/include/asm/io.h13
-rw-r--r--arch/x86/include/asm/io_apic.h1
-rw-r--r--arch/x86/include/asm/paravirt.h10
-rw-r--r--arch/x86/include/asm/pci.h33
-rw-r--r--arch/x86/include/asm/pci_x86.h1
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h21
-rw-r--r--arch/x86/include/asm/uv/uv_mmrs.h189
-rw-r--r--arch/x86/include/asm/x86_init.h9
-rw-r--r--arch/x86/include/asm/xen/pci.h65
-rw-r--r--arch/x86/kernel/Makefile12
-rw-r--r--arch/x86/kernel/acpi/boot.c60
-rw-r--r--arch/x86/kernel/alternative.c2
-rw-r--r--arch/x86/kernel/apic/apic.c1
-rw-r--r--arch/x86/kernel/apic/hw_nmi.c7
-rw-r--r--arch/x86/kernel/apic/io_apic.c11
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c36
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c4
-rw-r--r--arch/x86/kernel/irq_32.c9
-rw-r--r--arch/x86/kernel/kgdb.c3
-rw-r--r--arch/x86/kernel/microcode_amd.c2
-rw-r--r--arch/x86/kernel/mmconf-fam10h_64.c7
-rw-r--r--arch/x86/kernel/pvclock.c38
-rw-r--r--arch/x86/kernel/setup.c2
-rw-r--r--arch/x86/kernel/x86_init.c7
-rw-r--r--arch/x86/kvm/mmu.c9
-rw-r--r--arch/x86/kvm/x86.c16
-rw-r--r--arch/x86/mm/numa_64.c7
-rw-r--r--arch/x86/mm/tlb.c2
-rw-r--r--arch/x86/pci/Makefile1
-rw-r--r--arch/x86/pci/acpi.c103
-rw-r--r--arch/x86/pci/common.c17
-rw-r--r--arch/x86/pci/i386.c19
-rw-r--r--arch/x86/pci/irq.c11
-rw-r--r--arch/x86/pci/mmconfig-shared.c4
-rw-r--r--arch/x86/pci/xen.c416
-rw-r--r--arch/x86/platform/Makefile8
-rw-r--r--arch/x86/platform/efi/Makefile1
-rw-r--r--arch/x86/platform/efi/efi.c (renamed from arch/x86/kernel/efi.c)0
-rw-r--r--arch/x86/platform/efi/efi_32.c (renamed from arch/x86/kernel/efi_32.c)0
-rw-r--r--arch/x86/platform/efi/efi_64.c (renamed from arch/x86/kernel/efi_64.c)0
-rw-r--r--arch/x86/platform/efi/efi_stub_32.S (renamed from arch/x86/kernel/efi_stub_32.S)0
-rw-r--r--arch/x86/platform/efi/efi_stub_64.S (renamed from arch/x86/kernel/efi_stub_64.S)0
-rw-r--r--arch/x86/platform/mrst/Makefile1
-rw-r--r--arch/x86/platform/mrst/mrst.c (renamed from arch/x86/kernel/mrst.c)0
-rw-r--r--arch/x86/platform/olpc/Makefile3
-rw-r--r--arch/x86/platform/olpc/olpc-xo1.c (renamed from arch/x86/kernel/olpc-xo1.c)0
-rw-r--r--arch/x86/platform/olpc/olpc.c (renamed from arch/x86/kernel/olpc.c)0
-rw-r--r--arch/x86/platform/olpc/olpc_ofw.c (renamed from arch/x86/kernel/olpc_ofw.c)0
-rw-r--r--arch/x86/platform/scx200/Makefile2
-rw-r--r--arch/x86/platform/scx200/scx200_32.c (renamed from arch/x86/kernel/scx200_32.c)0
-rw-r--r--arch/x86/platform/sfi/Makefile1
-rw-r--r--arch/x86/platform/sfi/sfi.c (renamed from arch/x86/kernel/sfi.c)0
-rw-r--r--arch/x86/platform/uv/Makefile1
-rw-r--r--arch/x86/platform/uv/bios_uv.c (renamed from arch/x86/kernel/bios_uv.c)0
-rw-r--r--arch/x86/platform/uv/tlb_uv.c (renamed from arch/x86/kernel/tlb_uv.c)13
-rw-r--r--arch/x86/platform/uv/uv_irq.c (renamed from arch/x86/kernel/uv_irq.c)0
-rw-r--r--arch/x86/platform/uv/uv_sysfs.c (renamed from arch/x86/kernel/uv_sysfs.c)0
-rw-r--r--arch/x86/platform/uv/uv_time.c (renamed from arch/x86/kernel/uv_time.c)0
-rw-r--r--arch/x86/platform/visws/Makefile1
-rw-r--r--arch/x86/platform/visws/visws_quirks.c (renamed from arch/x86/kernel/visws_quirks.c)0
-rw-r--r--arch/x86/xen/Kconfig10
-rw-r--r--arch/x86/xen/enlighten.c5
-rw-r--r--arch/x86/xen/mmu.c49
-rw-r--r--arch/x86/xen/pci-swiotlb-xen.c4
-rw-r--r--arch/x86/xen/setup.c19
-rw-r--r--arch/x86/xen/smp.c26
-rw-r--r--arch/xtensa/Kconfig5
606 files changed, 20390 insertions, 7918 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 28f93a6c0fde..943fe6930f77 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -1,7 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5config ALPHA 1config ALPHA
6 bool 2 bool
7 default y 3 default y
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bf7273f3dc64..db524e75c4a2 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "Linux Kernel Configuration"
7
8config ARM 1config ARM
9 bool 2 bool
10 default y 3 default y
@@ -13,7 +6,7 @@ config ARM
13 select HAVE_MEMBLOCK 6 select HAVE_MEMBLOCK
14 select RTC_LIB 7 select RTC_LIB
15 select SYS_SUPPORTS_APM_EMULATION 8 select SYS_SUPPORTS_APM_EMULATION
16 select GENERIC_ATOMIC64 if (!CPU_32v6K) 9 select GENERIC_ATOMIC64 if (!CPU_32v6K || !AEABI)
17 select HAVE_OPROFILE if (HAVE_PERF_EVENTS) 10 select HAVE_OPROFILE if (HAVE_PERF_EVENTS)
18 select HAVE_ARCH_KGDB 11 select HAVE_ARCH_KGDB
19 select HAVE_KPROBES if (!XIP_KERNEL) 12 select HAVE_KPROBES if (!XIP_KERNEL)
@@ -653,7 +646,7 @@ config ARCH_S3C2410
653 select ARCH_HAS_CPUFREQ 646 select ARCH_HAS_CPUFREQ
654 select HAVE_CLK 647 select HAVE_CLK
655 select ARCH_USES_GETTIMEOFFSET 648 select ARCH_USES_GETTIMEOFFSET
656 select HAVE_S3C2410_I2C 649 select HAVE_S3C2410_I2C if I2C
657 help 650 help
658 Samsung S3C2410X CPU based systems, such as the Simtec Electronics 651 Samsung S3C2410X CPU based systems, such as the Simtec Electronics
659 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or 652 BAST (<http://www.simtec.co.uk/products/EB110ITX/>), the IPAQ 1940 or
@@ -683,8 +676,8 @@ config ARCH_S3C64XX
683 select S3C_DEV_NAND 676 select S3C_DEV_NAND
684 select USB_ARCH_HAS_OHCI 677 select USB_ARCH_HAS_OHCI
685 select SAMSUNG_GPIOLIB_4BIT 678 select SAMSUNG_GPIOLIB_4BIT
686 select HAVE_S3C2410_I2C 679 select HAVE_S3C2410_I2C if I2C
687 select HAVE_S3C2410_WATCHDOG 680 select HAVE_S3C2410_WATCHDOG if WATCHDOG
688 help 681 help
689 Samsung S3C64XX series based systems 682 Samsung S3C64XX series based systems
690 683
@@ -693,10 +686,10 @@ config ARCH_S5P64X0
693 select CPU_V6 686 select CPU_V6
694 select GENERIC_GPIO 687 select GENERIC_GPIO
695 select HAVE_CLK 688 select HAVE_CLK
696 select HAVE_S3C2410_WATCHDOG 689 select HAVE_S3C2410_WATCHDOG if WATCHDOG
697 select ARCH_USES_GETTIMEOFFSET 690 select ARCH_USES_GETTIMEOFFSET
698 select HAVE_S3C2410_I2C 691 select HAVE_S3C2410_I2C if I2C
699 select HAVE_S3C_RTC 692 select HAVE_S3C_RTC if RTC_CLASS
700 help 693 help
701 Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440, 694 Samsung S5P64X0 CPU based systems, such as the Samsung SMDK6440,
702 SMDK6450. 695 SMDK6450.
@@ -707,7 +700,7 @@ config ARCH_S5P6442
707 select GENERIC_GPIO 700 select GENERIC_GPIO
708 select HAVE_CLK 701 select HAVE_CLK
709 select ARCH_USES_GETTIMEOFFSET 702 select ARCH_USES_GETTIMEOFFSET
710 select HAVE_S3C2410_WATCHDOG 703 select HAVE_S3C2410_WATCHDOG if WATCHDOG
711 help 704 help
712 Samsung S5P6442 CPU based systems 705 Samsung S5P6442 CPU based systems
713 706
@@ -718,31 +711,37 @@ config ARCH_S5PC100
718 select CPU_V7 711 select CPU_V7
719 select ARM_L1_CACHE_SHIFT_6 712 select ARM_L1_CACHE_SHIFT_6
720 select ARCH_USES_GETTIMEOFFSET 713 select ARCH_USES_GETTIMEOFFSET
721 select HAVE_S3C2410_I2C 714 select HAVE_S3C2410_I2C if I2C
722 select HAVE_S3C_RTC 715 select HAVE_S3C_RTC if RTC_CLASS
723 select HAVE_S3C2410_WATCHDOG 716 select HAVE_S3C2410_WATCHDOG if WATCHDOG
724 help 717 help
725 Samsung S5PC100 series based systems 718 Samsung S5PC100 series based systems
726 719
727config ARCH_S5PV210 720config ARCH_S5PV210
728 bool "Samsung S5PV210/S5PC110" 721 bool "Samsung S5PV210/S5PC110"
729 select CPU_V7 722 select CPU_V7
723 select ARCH_SPARSEMEM_ENABLE
730 select GENERIC_GPIO 724 select GENERIC_GPIO
731 select HAVE_CLK 725 select HAVE_CLK
732 select ARM_L1_CACHE_SHIFT_6 726 select ARM_L1_CACHE_SHIFT_6
727 select ARCH_HAS_CPUFREQ
733 select ARCH_USES_GETTIMEOFFSET 728 select ARCH_USES_GETTIMEOFFSET
734 select HAVE_S3C2410_I2C 729 select HAVE_S3C2410_I2C if I2C
735 select HAVE_S3C_RTC 730 select HAVE_S3C_RTC if RTC_CLASS
736 select HAVE_S3C2410_WATCHDOG 731 select HAVE_S3C2410_WATCHDOG if WATCHDOG
737 help 732 help
738 Samsung S5PV210/S5PC110 series based systems 733 Samsung S5PV210/S5PC110 series based systems
739 734
740config ARCH_S5PV310 735config ARCH_S5PV310
741 bool "Samsung S5PV310/S5PC210" 736 bool "Samsung S5PV310/S5PC210"
742 select CPU_V7 737 select CPU_V7
738 select ARCH_SPARSEMEM_ENABLE
743 select GENERIC_GPIO 739 select GENERIC_GPIO
744 select HAVE_CLK 740 select HAVE_CLK
745 select GENERIC_CLOCKEVENTS 741 select GENERIC_CLOCKEVENTS
742 select HAVE_S3C_RTC if RTC_CLASS
743 select HAVE_S3C2410_I2C if I2C
744 select HAVE_S3C2410_WATCHDOG if WATCHDOG
746 help 745 help
747 Samsung S5PV310 series based systems 746 Samsung S5PV310 series based systems
748 747
@@ -1669,6 +1668,12 @@ if ARCH_HAS_CPUFREQ
1669 1668
1670source "drivers/cpufreq/Kconfig" 1669source "drivers/cpufreq/Kconfig"
1671 1670
1671config CPU_FREQ_IMX
1672 tristate "CPUfreq driver for i.MX CPUs"
1673 depends on ARCH_MXC && CPU_FREQ
1674 help
1675 This enables the CPUfreq driver for i.MX CPUs.
1676
1672config CPU_FREQ_SA1100 1677config CPU_FREQ_SA1100
1673 bool 1678 bool
1674 1679
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index ada6359160eb..772f95f1aecd 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -251,15 +251,16 @@ void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,
251 writel(cpumask, base + GIC_DIST_TARGET + i * 4 / 4); 251 writel(cpumask, base + GIC_DIST_TARGET + i * 4 / 4);
252 252
253 /* 253 /*
254 * Set priority on all interrupts. 254 * Set priority on all global interrupts.
255 */ 255 */
256 for (i = 0; i < max_irq; i += 4) 256 for (i = 32; i < max_irq; i += 4)
257 writel(0xa0a0a0a0, base + GIC_DIST_PRI + i * 4 / 4); 257 writel(0xa0a0a0a0, base + GIC_DIST_PRI + i * 4 / 4);
258 258
259 /* 259 /*
260 * Disable all interrupts. 260 * Disable all interrupts. Leave the PPI and SGIs alone
261 * as these enables are banked registers.
261 */ 262 */
262 for (i = 0; i < max_irq; i += 32) 263 for (i = 32; i < max_irq; i += 32)
263 writel(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32); 264 writel(0xffffffff, base + GIC_DIST_ENABLE_CLEAR + i * 4 / 32);
264 265
265 /* 266 /*
@@ -277,11 +278,30 @@ void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,
277 278
278void __cpuinit gic_cpu_init(unsigned int gic_nr, void __iomem *base) 279void __cpuinit gic_cpu_init(unsigned int gic_nr, void __iomem *base)
279{ 280{
281 void __iomem *dist_base;
282 int i;
283
280 if (gic_nr >= MAX_GIC_NR) 284 if (gic_nr >= MAX_GIC_NR)
281 BUG(); 285 BUG();
282 286
287 dist_base = gic_data[gic_nr].dist_base;
288 BUG_ON(!dist_base);
289
283 gic_data[gic_nr].cpu_base = base; 290 gic_data[gic_nr].cpu_base = base;
284 291
292 /*
293 * Deal with the banked PPI and SGI interrupts - disable all
294 * PPI interrupts, ensure all SGI interrupts are enabled.
295 */
296 writel(0xffff0000, dist_base + GIC_DIST_ENABLE_CLEAR);
297 writel(0x0000ffff, dist_base + GIC_DIST_ENABLE_SET);
298
299 /*
300 * Set priority on PPI and SGI interrupts
301 */
302 for (i = 0; i < 32; i += 4)
303 writel(0xa0a0a0a0, dist_base + GIC_DIST_PRI + i * 4 / 4);
304
285 writel(0xf0, base + GIC_CPU_PRIMASK); 305 writel(0xf0, base + GIC_CPU_PRIMASK);
286 writel(1, base + GIC_CPU_CTRL); 306 writel(1, base + GIC_CPU_CTRL);
287} 307}
diff --git a/arch/arm/configs/mx51_defconfig b/arch/arm/configs/mx51_defconfig
index 163cfee7644c..5c7a87260fab 100644
--- a/arch/arm/configs/mx51_defconfig
+++ b/arch/arm/configs/mx51_defconfig
@@ -82,6 +82,7 @@ CONFIG_FEC=y
82CONFIG_INPUT_FF_MEMLESS=m 82CONFIG_INPUT_FF_MEMLESS=m
83# CONFIG_INPUT_MOUSEDEV_PSAUX is not set 83# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
84CONFIG_INPUT_EVDEV=y 84CONFIG_INPUT_EVDEV=y
85CONFIG_KEYBOARD_GPIO=y
85CONFIG_INPUT_EVBUG=m 86CONFIG_INPUT_EVBUG=m
86CONFIG_MOUSE_PS2=m 87CONFIG_MOUSE_PS2=m
87CONFIG_MOUSE_PS2_ELANTECH=y 88CONFIG_MOUSE_PS2_ELANTECH=y
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 6bcba48800fe..cc42d5fdee17 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -21,9 +21,6 @@
21#define __ASM_ARM_HARDWARE_L2X0_H 21#define __ASM_ARM_HARDWARE_L2X0_H
22 22
23#define L2X0_CACHE_ID 0x000 23#define L2X0_CACHE_ID 0x000
24#define L2X0_CACHE_ID_PART_MASK (0xf << 6)
25#define L2X0_CACHE_ID_PART_L210 (1 << 6)
26#define L2X0_CACHE_ID_PART_L310 (3 << 6)
27#define L2X0_CACHE_TYPE 0x004 24#define L2X0_CACHE_TYPE 0x004
28#define L2X0_CTRL 0x100 25#define L2X0_CTRL 0x100
29#define L2X0_AUX_CTRL 0x104 26#define L2X0_AUX_CTRL 0x104
@@ -53,6 +50,16 @@
53#define L2X0_LINE_DATA 0xF10 50#define L2X0_LINE_DATA 0xF10
54#define L2X0_LINE_TAG 0xF30 51#define L2X0_LINE_TAG 0xF30
55#define L2X0_DEBUG_CTRL 0xF40 52#define L2X0_DEBUG_CTRL 0xF40
53#define L2X0_PREFETCH_CTRL 0xF60
54#define L2X0_POWER_CTRL 0xF80
55#define L2X0_DYNAMIC_CLK_GATING_EN (1 << 1)
56#define L2X0_STNDBY_MODE_EN (1 << 0)
57
58/* Registers shifts and masks */
59#define L2X0_CACHE_ID_PART_MASK (0xf << 6)
60#define L2X0_CACHE_ID_PART_L210 (1 << 6)
61#define L2X0_CACHE_ID_PART_L310 (3 << 6)
62#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x3 << 17)
56 63
57#ifndef __ASSEMBLY__ 64#ifndef __ASSEMBLY__
58extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask); 65extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h
index 6700c7fc7ebd..21fa272301f8 100644
--- a/arch/arm/include/asm/hardware/it8152.h
+++ b/arch/arm/include/asm/hardware/it8152.h
@@ -75,7 +75,7 @@ extern unsigned long it8152_base_address;
75 IT8152_PD_IRQ(1) USB (USBR) 75 IT8152_PD_IRQ(1) USB (USBR)
76 IT8152_PD_IRQ(0) Audio controller (ACR) 76 IT8152_PD_IRQ(0) Audio controller (ACR)
77 */ 77 */
78#define IT8152_IRQ(x) (IRQ_BOARD_END + (x)) 78#define IT8152_IRQ(x) (IRQ_BOARD_START + (x))
79 79
80/* IRQ-sources in 3 groups - local devices, LPC (serial), and external PCI */ 80/* IRQ-sources in 3 groups - local devices, LPC (serial), and external PCI */
81#define IT8152_LD_IRQ_COUNT 9 81#define IT8152_LD_IRQ_COUNT 9
diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h
index 08265993227f..48066ce9ea34 100644
--- a/arch/arm/include/asm/kgdb.h
+++ b/arch/arm/include/asm/kgdb.h
@@ -70,7 +70,8 @@ extern int kgdb_fault_expected;
70#define _GP_REGS 16 70#define _GP_REGS 16
71#define _FP_REGS 8 71#define _FP_REGS 8
72#define _EXTRA_REGS 2 72#define _EXTRA_REGS 2
73#define DBG_MAX_REG_NUM (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS) 73#define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS)
74#define DBG_MAX_REG_NUM (_GP_REGS + _FP_REGS + _EXTRA_REGS)
74 75
75#define KGDB_MAX_NO_CPUS 1 76#define KGDB_MAX_NO_CPUS 1
76#define BUFMAX 400 77#define BUFMAX 400
@@ -93,7 +94,7 @@ extern int kgdb_fault_expected;
93#define _SPT 13 94#define _SPT 13
94#define _LR 14 95#define _LR 14
95#define _PC 15 96#define _PC 15
96#define _CPSR (DBG_MAX_REG_NUM - 1) 97#define _CPSR (GDB_MAX_REGS - 1)
97 98
98/* 99/*
99 * So that we can denote the end of a frame for tracing, 100 * So that we can denote the end of a frame for tracing,
diff --git a/arch/arm/include/asm/memblock.h b/arch/arm/include/asm/memblock.h
index fdbc43b2e6c0..b8da2e415e4e 100644
--- a/arch/arm/include/asm/memblock.h
+++ b/arch/arm/include/asm/memblock.h
@@ -1,13 +1,6 @@
1#ifndef _ASM_ARM_MEMBLOCK_H 1#ifndef _ASM_ARM_MEMBLOCK_H
2#define _ASM_ARM_MEMBLOCK_H 2#define _ASM_ARM_MEMBLOCK_H
3 3
4#ifdef CONFIG_MMU
5extern phys_addr_t lowmem_end_addr;
6#define MEMBLOCK_REAL_LIMIT lowmem_end_addr
7#else
8#define MEMBLOCK_REAL_LIMIT 0
9#endif
10
11struct meminfo; 4struct meminfo;
12struct machine_desc; 5struct machine_desc;
13 6
diff --git a/arch/arm/include/asm/outercache.h b/arch/arm/include/asm/outercache.h
index 25f76bae57ab..fc1900925275 100644
--- a/arch/arm/include/asm/outercache.h
+++ b/arch/arm/include/asm/outercache.h
@@ -25,6 +25,9 @@ struct outer_cache_fns {
25 void (*inv_range)(unsigned long, unsigned long); 25 void (*inv_range)(unsigned long, unsigned long);
26 void (*clean_range)(unsigned long, unsigned long); 26 void (*clean_range)(unsigned long, unsigned long);
27 void (*flush_range)(unsigned long, unsigned long); 27 void (*flush_range)(unsigned long, unsigned long);
28 void (*flush_all)(void);
29 void (*inv_all)(void);
30 void (*disable)(void);
28#ifdef CONFIG_OUTER_CACHE_SYNC 31#ifdef CONFIG_OUTER_CACHE_SYNC
29 void (*sync)(void); 32 void (*sync)(void);
30#endif 33#endif
@@ -50,6 +53,24 @@ static inline void outer_flush_range(unsigned long start, unsigned long end)
50 outer_cache.flush_range(start, end); 53 outer_cache.flush_range(start, end);
51} 54}
52 55
56static inline void outer_flush_all(void)
57{
58 if (outer_cache.flush_all)
59 outer_cache.flush_all();
60}
61
62static inline void outer_inv_all(void)
63{
64 if (outer_cache.inv_all)
65 outer_cache.inv_all();
66}
67
68static inline void outer_disable(void)
69{
70 if (outer_cache.disable)
71 outer_cache.disable();
72}
73
53#else 74#else
54 75
55static inline void outer_inv_range(unsigned long start, unsigned long end) 76static inline void outer_inv_range(unsigned long start, unsigned long end)
@@ -58,6 +79,9 @@ static inline void outer_clean_range(unsigned long start, unsigned long end)
58{ } 79{ }
59static inline void outer_flush_range(unsigned long start, unsigned long end) 80static inline void outer_flush_range(unsigned long start, unsigned long end)
60{ } 81{ }
82static inline void outer_flush_all(void) { }
83static inline void outer_inv_all(void) { }
84static inline void outer_disable(void) { }
61 85
62#endif 86#endif
63 87
diff --git a/arch/arm/kernel/hw_breakpoint.c b/arch/arm/kernel/hw_breakpoint.c
index 54593b0c241b..21e3a4ab3b8c 100644
--- a/arch/arm/kernel/hw_breakpoint.c
+++ b/arch/arm/kernel/hw_breakpoint.c
@@ -748,8 +748,7 @@ static int hw_breakpoint_pending(unsigned long addr, unsigned int fsr,
748 breakpoint_handler(addr, regs); 748 breakpoint_handler(addr, regs);
749 break; 749 break;
750 case ARM_ENTRY_ASYNC_WATCHPOINT: 750 case ARM_ENTRY_ASYNC_WATCHPOINT:
751 WARN_ON("Asynchronous watchpoint exception taken. " 751 WARN(1, "Asynchronous watchpoint exception taken. Debugging results may be unreliable\n");
752 "Debugging results may be unreliable");
753 case ARM_ENTRY_SYNC_WATCHPOINT: 752 case ARM_ENTRY_SYNC_WATCHPOINT:
754 watchpoint_handler(addr, regs); 753 watchpoint_handler(addr, regs);
755 break; 754 break;
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c
index d6e8b4d2e60d..778c2f7024ff 100644
--- a/arch/arm/kernel/kgdb.c
+++ b/arch/arm/kernel/kgdb.c
@@ -79,7 +79,7 @@ sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *task)
79 return; 79 return;
80 80
81 /* Initialize to zero */ 81 /* Initialize to zero */
82 for (regno = 0; regno < DBG_MAX_REG_NUM; regno++) 82 for (regno = 0; regno < GDB_MAX_REGS; regno++)
83 gdb_regs[regno] = 0; 83 gdb_regs[regno] = 0;
84 84
85 /* Otherwise, we have only some registers from switch_to() */ 85 /* Otherwise, we have only some registers from switch_to() */
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 1fc74cbd1a19..3a8fd5140d7a 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -78,7 +78,10 @@ void machine_kexec(struct kimage *image)
78 local_fiq_disable(); 78 local_fiq_disable();
79 setup_mm_for_reboot(0); /* mode is not used, so just pass 0*/ 79 setup_mm_for_reboot(0); /* mode is not used, so just pass 0*/
80 flush_cache_all(); 80 flush_cache_all();
81 outer_flush_all();
82 outer_disable();
81 cpu_proc_fin(); 83 cpu_proc_fin();
84 outer_inv_all();
82 flush_cache_all(); 85 flush_cache_all();
83 cpu_reset(reboot_code_buffer_phys); 86 cpu_reset(reboot_code_buffer_phys);
84} 87}
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index 49643b1467e6..07a50357492a 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -1749,7 +1749,7 @@ static inline int armv7_pmnc_has_overflowed(unsigned long pmnc)
1749static inline int armv7_pmnc_counter_has_overflowed(unsigned long pmnc, 1749static inline int armv7_pmnc_counter_has_overflowed(unsigned long pmnc,
1750 enum armv7_counters counter) 1750 enum armv7_counters counter)
1751{ 1751{
1752 int ret; 1752 int ret = 0;
1753 1753
1754 if (counter == ARMV7_CYCLE_COUNTER) 1754 if (counter == ARMV7_CYCLE_COUNTER)
1755 ret = pmnc & ARMV7_FLAG_C; 1755 ret = pmnc & ARMV7_FLAG_C;
diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c
index 20b7411e47fd..c2e112e1a05f 100644
--- a/arch/arm/kernel/stacktrace.c
+++ b/arch/arm/kernel/stacktrace.c
@@ -28,7 +28,7 @@ int notrace unwind_frame(struct stackframe *frame)
28 28
29 /* only go to a higher address on the stack */ 29 /* only go to a higher address on the stack */
30 low = frame->sp; 30 low = frame->sp;
31 high = ALIGN(low, THREAD_SIZE) + THREAD_SIZE; 31 high = ALIGN(low, THREAD_SIZE);
32 32
33 /* check current frame pointer is within bounds */ 33 /* check current frame pointer is within bounds */
34 if (fp < (low + 12) || fp + 4 >= high) 34 if (fp < (low + 12) || fp + 4 >= high)
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index cda78d59aa31..446aee97436f 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -53,10 +53,7 @@ static void dump_mem(const char *, const char *, unsigned long, unsigned long);
53void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame) 53void dump_backtrace_entry(unsigned long where, unsigned long from, unsigned long frame)
54{ 54{
55#ifdef CONFIG_KALLSYMS 55#ifdef CONFIG_KALLSYMS
56 char sym1[KSYM_SYMBOL_LEN], sym2[KSYM_SYMBOL_LEN]; 56 printk("[<%08lx>] (%pS) from [<%08lx>] (%pS)\n", where, (void *)where, from, (void *)from);
57 sprint_symbol(sym1, where);
58 sprint_symbol(sym2, from);
59 printk("[<%08lx>] (%s) from [<%08lx>] (%s)\n", where, sym1, from, sym2);
60#else 57#else
61 printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from); 58 printk("Function entered at [<%08lx>] from [<%08lx>]\n", where, from);
62#endif 59#endif
diff --git a/arch/arm/kernel/unwind.c b/arch/arm/kernel/unwind.c
index 2a161765f6d5..d2cb0b3c9872 100644
--- a/arch/arm/kernel/unwind.c
+++ b/arch/arm/kernel/unwind.c
@@ -279,7 +279,7 @@ int unwind_frame(struct stackframe *frame)
279 279
280 /* only go to a higher address on the stack */ 280 /* only go to a higher address on the stack */
281 low = frame->sp; 281 low = frame->sp;
282 high = ALIGN(low, THREAD_SIZE) + THREAD_SIZE; 282 high = ALIGN(low, THREAD_SIZE);
283 283
284 pr_debug("%s(pc = %08lx lr = %08lx sp = %08lx)\n", __func__, 284 pr_debug("%s(pc = %08lx lr = %08lx sp = %08lx)\n", __func__,
285 frame->pc, frame->lr, frame->sp); 285 frame->pc, frame->lr, frame->sp);
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 1953e3d21abf..cead8893b46b 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -113,6 +113,7 @@ SECTIONS
113 *(.rodata.*) 113 *(.rodata.*)
114 *(.glue_7) 114 *(.glue_7)
115 *(.glue_7t) 115 *(.glue_7t)
116 . = ALIGN(4);
116 *(.got) /* Global offset table */ 117 *(.got) /* Global offset table */
117 ARM_CPU_KEEP(PROC_INFO) 118 ARM_CPU_KEEP(PROC_INFO)
118 } 119 }
diff --git a/arch/arm/mach-ep93xx/include/mach/dma.h b/arch/arm/mach-ep93xx/include/mach/dma.h
index 3a5961d3f3b1..5e31b2b25da9 100644
--- a/arch/arm/mach-ep93xx/include/mach/dma.h
+++ b/arch/arm/mach-ep93xx/include/mach/dma.h
@@ -1,5 +1,13 @@
1/* 1/**
2 * arch/arm/mach-ep93xx/include/mach/dma.h 2 * DOC: EP93xx DMA M2P memory to peripheral and peripheral to memory engine
3 *
4 * The EP93xx DMA M2P subsystem handles DMA transfers between memory and
5 * peripherals. DMA M2P channels are available for audio, UARTs and IrDA.
6 * See chapter 10 of the EP93xx users guide for full details on the DMA M2P
7 * engine.
8 *
9 * See sound/soc/ep93xx/ep93xx-pcm.c for an example use of the DMA M2P code.
10 *
3 */ 11 */
4 12
5#ifndef __ASM_ARCH_DMA_H 13#ifndef __ASM_ARCH_DMA_H
@@ -8,12 +16,34 @@
8#include <linux/list.h> 16#include <linux/list.h>
9#include <linux/types.h> 17#include <linux/types.h>
10 18
19/**
20 * struct ep93xx_dma_buffer - Information about a buffer to be transferred
21 * using the DMA M2P engine
22 *
23 * @list: Entry in DMA buffer list
24 * @bus_addr: Physical address of the buffer
25 * @size: Size of the buffer in bytes
26 */
11struct ep93xx_dma_buffer { 27struct ep93xx_dma_buffer {
12 struct list_head list; 28 struct list_head list;
13 u32 bus_addr; 29 u32 bus_addr;
14 u16 size; 30 u16 size;
15}; 31};
16 32
33/**
34 * struct ep93xx_dma_m2p_client - Information about a DMA M2P client
35 *
36 * @name: Unique name for this client
37 * @flags: Client flags
38 * @cookie: User data to pass to callback functions
39 * @buffer_started: Non NULL function to call when a transfer is started.
40 * The arguments are the user data cookie and the DMA
41 * buffer which is starting.
42 * @buffer_finished: Non NULL function to call when a transfer is completed.
43 * The arguments are the user data cookie, the DMA buffer
44 * which has completed, and a boolean flag indicating if
45 * the transfer had an error.
46 */
17struct ep93xx_dma_m2p_client { 47struct ep93xx_dma_m2p_client {
18 char *name; 48 char *name;
19 u8 flags; 49 u8 flags;
@@ -24,10 +54,11 @@ struct ep93xx_dma_m2p_client {
24 struct ep93xx_dma_buffer *buf, 54 struct ep93xx_dma_buffer *buf,
25 int bytes, int error); 55 int bytes, int error);
26 56
27 /* Internal to the DMA code. */ 57 /* private: Internal use only */
28 void *channel; 58 void *channel;
29}; 59};
30 60
61/* DMA M2P ports */
31#define EP93XX_DMA_M2P_PORT_I2S1 0x00 62#define EP93XX_DMA_M2P_PORT_I2S1 0x00
32#define EP93XX_DMA_M2P_PORT_I2S2 0x01 63#define EP93XX_DMA_M2P_PORT_I2S2 0x01
33#define EP93XX_DMA_M2P_PORT_AAC1 0x02 64#define EP93XX_DMA_M2P_PORT_AAC1 0x02
@@ -39,18 +70,80 @@ struct ep93xx_dma_m2p_client {
39#define EP93XX_DMA_M2P_PORT_UART3 0x08 70#define EP93XX_DMA_M2P_PORT_UART3 0x08
40#define EP93XX_DMA_M2P_PORT_IRDA 0x09 71#define EP93XX_DMA_M2P_PORT_IRDA 0x09
41#define EP93XX_DMA_M2P_PORT_MASK 0x0f 72#define EP93XX_DMA_M2P_PORT_MASK 0x0f
42#define EP93XX_DMA_M2P_TX 0x00
43#define EP93XX_DMA_M2P_RX 0x10
44#define EP93XX_DMA_M2P_ABORT_ON_ERROR 0x20
45#define EP93XX_DMA_M2P_IGNORE_ERROR 0x40
46#define EP93XX_DMA_M2P_ERROR_MASK 0x60
47 73
48int ep93xx_dma_m2p_client_register(struct ep93xx_dma_m2p_client *m2p); 74/* DMA M2P client flags */
75#define EP93XX_DMA_M2P_TX 0x00 /* Memory to peripheral */
76#define EP93XX_DMA_M2P_RX 0x10 /* Peripheral to memory */
77
78/*
79 * DMA M2P client error handling flags. See the EP93xx users guide
80 * documentation on the DMA M2P CONTROL register for more details
81 */
82#define EP93XX_DMA_M2P_ABORT_ON_ERROR 0x20 /* Abort on peripheral error */
83#define EP93XX_DMA_M2P_IGNORE_ERROR 0x40 /* Ignore peripheral errors */
84#define EP93XX_DMA_M2P_ERROR_MASK 0x60 /* Mask of error bits */
85
86/**
87 * ep93xx_dma_m2p_client_register - Register a client with the DMA M2P
88 * subsystem
89 *
90 * @m2p: Client information to register
91 * returns 0 on success
92 *
93 * The DMA M2P subsystem allocates a channel and an interrupt line for the DMA
94 * client
95 */
96int ep93xx_dma_m2p_client_register(struct ep93xx_dma_m2p_client *m2p);
97
98/**
99 * ep93xx_dma_m2p_client_unregister - Unregister a client from the DMA M2P
100 * subsystem
101 *
102 * @m2p: Client to unregister
103 *
104 * Any transfers currently in progress will be completed in hardware, but
105 * ignored in software.
106 */
49void ep93xx_dma_m2p_client_unregister(struct ep93xx_dma_m2p_client *m2p); 107void ep93xx_dma_m2p_client_unregister(struct ep93xx_dma_m2p_client *m2p);
108
109/**
110 * ep93xx_dma_m2p_submit - Submit a DMA M2P transfer
111 *
112 * @m2p: DMA Client to submit the transfer on
113 * @buf: DMA Buffer to submit
114 *
115 * If the current or next transfer positions are free on the M2P client then
116 * the transfer is started immediately. If not, the transfer is added to the
117 * list of pending transfers. This function must not be called from the
118 * buffer_finished callback for an M2P channel.
119 *
120 */
50void ep93xx_dma_m2p_submit(struct ep93xx_dma_m2p_client *m2p, 121void ep93xx_dma_m2p_submit(struct ep93xx_dma_m2p_client *m2p,
51 struct ep93xx_dma_buffer *buf); 122 struct ep93xx_dma_buffer *buf);
123
124/**
125 * ep93xx_dma_m2p_submit_recursive - Put a DMA transfer on the pending list
126 * for an M2P channel
127 *
128 * @m2p: DMA Client to submit the transfer on
129 * @buf: DMA Buffer to submit
130 *
131 * This function must only be called from the buffer_finished callback for an
132 * M2P channel. It is commonly used to add the next transfer in a chained list
133 * of DMA transfers.
134 */
52void ep93xx_dma_m2p_submit_recursive(struct ep93xx_dma_m2p_client *m2p, 135void ep93xx_dma_m2p_submit_recursive(struct ep93xx_dma_m2p_client *m2p,
53 struct ep93xx_dma_buffer *buf); 136 struct ep93xx_dma_buffer *buf);
137
138/**
139 * ep93xx_dma_m2p_flush - Flush all pending transfers on a DMA M2P client
140 *
141 * @m2p: DMA client to flush transfers on
142 *
143 * Any transfers currently in progress will be completed in hardware, but
144 * ignored in software.
145 *
146 */
54void ep93xx_dma_m2p_flush(struct ep93xx_dma_m2p_client *m2p); 147void ep93xx_dma_m2p_flush(struct ep93xx_dma_m2p_client *m2p);
55 148
56#endif /* __ASM_ARCH_DMA_H */ 149#endif /* __ASM_ARCH_DMA_H */
diff --git a/arch/arm/mach-imx/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index b8bbd31aa850..84a5ba03f1ba 100644
--- a/arch/arm/mach-imx/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -23,16 +23,20 @@
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/input/matrix_keypad.h> 25#include <linux/input/matrix_keypad.h>
26#include <linux/irq.h>
26#include <asm/mach-types.h> 27#include <asm/mach-types.h>
27#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
28#include <asm/mach/time.h> 29#include <asm/mach/time.h>
29#include <mach/hardware.h> 30#include <mach/hardware.h>
30#include <mach/common.h> 31#include <mach/common.h>
31#include <mach/iomux-mx27.h> 32#include <mach/iomux-mx27.h>
33#include <mach/mmc.h>
32 34
33#include "devices-imx27.h" 35#include "devices-imx27.h"
34#include "devices.h" 36#include "devices.h"
35 37
38#define SD1_EN_GPIO (GPIO_PORTB + 25)
39
36static const int mx27pdk_pins[] __initconst = { 40static const int mx27pdk_pins[] __initconst = {
37 /* UART1 */ 41 /* UART1 */
38 PE12_PF_UART1_TXD, 42 PE12_PF_UART1_TXD,
@@ -58,6 +62,14 @@ static const int mx27pdk_pins[] __initconst = {
58 PD15_AOUT_FEC_COL, 62 PD15_AOUT_FEC_COL,
59 PD16_AIN_FEC_TX_ER, 63 PD16_AIN_FEC_TX_ER,
60 PF23_AIN_FEC_TX_EN, 64 PF23_AIN_FEC_TX_EN,
65 /* SDHC1 */
66 PE18_PF_SD1_D0,
67 PE19_PF_SD1_D1,
68 PE20_PF_SD1_D2,
69 PE21_PF_SD1_D3,
70 PE22_PF_SD1_CMD,
71 PE23_PF_SD1_CLK,
72 SD1_EN_GPIO | GPIO_GPIO | GPIO_OUT,
61}; 73};
62 74
63static const struct imxuart_platform_data uart_pdata __initconst = { 75static const struct imxuart_platform_data uart_pdata __initconst = {
@@ -85,13 +97,39 @@ static struct matrix_keymap_data mx27_3ds_keymap_data = {
85 .keymap_size = ARRAY_SIZE(mx27_3ds_keymap), 97 .keymap_size = ARRAY_SIZE(mx27_3ds_keymap),
86}; 98};
87 99
100static int mx27_3ds_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
101 void *data)
102{
103 return request_irq(IRQ_GPIOB(26), detect_irq, IRQF_TRIGGER_FALLING |
104 IRQF_TRIGGER_RISING, "sdhc1-card-detect", data);
105}
106
107static void mx27_3ds_sdhc1_exit(struct device *dev, void *data)
108{
109 free_irq(IRQ_GPIOB(26), data);
110}
111
112static struct imxmmc_platform_data sdhc1_pdata = {
113 .init = mx27_3ds_sdhc1_init,
114 .exit = mx27_3ds_sdhc1_exit,
115};
116
117static void mx27_3ds_sdhc1_enable_level_translator(void)
118{
119 /* Turn on TXB0108 OE pin */
120 gpio_request(SD1_EN_GPIO, "sd1_enable");
121 gpio_direction_output(SD1_EN_GPIO, 1);
122}
123
88static void __init mx27pdk_init(void) 124static void __init mx27pdk_init(void)
89{ 125{
90 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), 126 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
91 "mx27pdk"); 127 "mx27pdk");
128 mx27_3ds_sdhc1_enable_level_translator();
92 imx27_add_imx_uart0(&uart_pdata); 129 imx27_add_imx_uart0(&uart_pdata);
93 imx27_add_fec(NULL); 130 imx27_add_fec(NULL);
94 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data); 131 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
132 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
95} 133}
96 134
97static void __init mx27pdk_timer_init(void) 135static void __init mx27pdk_timer_init(void)
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index babb22597163..e24e3d05397f 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -197,7 +197,7 @@ unsigned long ixp2000_gettimeoffset (void)
197 return offset / ticks_per_usec; 197 return offset / ticks_per_usec;
198} 198}
199 199
200static int ixp2000_timer_interrupt(int irq, void *dev_id) 200static irqreturn_t ixp2000_timer_interrupt(int irq, void *dev_id)
201{ 201{
202 /* clear timer 1 */ 202 /* clear timer 1 */
203 ixp2000_reg_wrb(IXP2000_T1_CLR, 1); 203 ixp2000_reg_wrb(IXP2000_T1_CLR, 1);
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 51ff23b72d3a..3688123b5ad8 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -854,10 +854,9 @@ int __init kirkwood_find_tclk(void)
854 854
855 kirkwood_pcie_id(&dev, &rev); 855 kirkwood_pcie_id(&dev, &rev);
856 856
857 if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || 857 if (dev == MV88F6281_DEV_ID || dev == MV88F6282_DEV_ID)
858 rev == MV88F6281_REV_A1)) || 858 if (((readl(SAMPLE_AT_RESET) >> 21) & 1) == 0)
859 (dev == MV88F6282_DEV_ID)) 859 return 200000000;
860 return 200000000;
861 860
862 return 166666667; 861 return 166666667;
863} 862}
diff --git a/arch/arm/mach-kirkwood/d2net_v2-setup.c b/arch/arm/mach-kirkwood/d2net_v2-setup.c
index 4aa86e4a152c..a31c9499ab36 100644
--- a/arch/arm/mach-kirkwood/d2net_v2-setup.c
+++ b/arch/arm/mach-kirkwood/d2net_v2-setup.c
@@ -225,5 +225,5 @@ MACHINE_START(D2NET_V2, "LaCie d2 Network v2")
225 .init_machine = d2net_v2_init, 225 .init_machine = d2net_v2_init,
226 .map_io = kirkwood_map_io, 226 .map_io = kirkwood_map_io,
227 .init_irq = kirkwood_init_irq, 227 .init_irq = kirkwood_init_irq,
228 .timer = &lacie_v2_timer, 228 .timer = &kirkwood_timer,
229MACHINE_END 229MACHINE_END
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.c b/arch/arm/mach-kirkwood/lacie_v2-common.c
index d3ea1b6c8a02..285edab776e9 100644
--- a/arch/arm/mach-kirkwood/lacie_v2-common.c
+++ b/arch/arm/mach-kirkwood/lacie_v2-common.c
@@ -111,17 +111,3 @@ void __init lacie_v2_hdd_power_init(int hdd_num)
111 pr_err("Failed to power up HDD%d\n", i + 1); 111 pr_err("Failed to power up HDD%d\n", i + 1);
112 } 112 }
113} 113}
114
115/*****************************************************************************
116 * Timer
117 ****************************************************************************/
118
119static void lacie_v2_timer_init(void)
120{
121 kirkwood_tclk = 166666667;
122 orion_time_init(IRQ_KIRKWOOD_BRIDGE, kirkwood_tclk);
123}
124
125struct sys_timer lacie_v2_timer = {
126 .init = lacie_v2_timer_init,
127};
diff --git a/arch/arm/mach-kirkwood/lacie_v2-common.h b/arch/arm/mach-kirkwood/lacie_v2-common.h
index af521315b87b..fc64f578536e 100644
--- a/arch/arm/mach-kirkwood/lacie_v2-common.h
+++ b/arch/arm/mach-kirkwood/lacie_v2-common.h
@@ -13,6 +13,4 @@ void lacie_v2_register_flash(void);
13void lacie_v2_register_i2c_devices(void); 13void lacie_v2_register_i2c_devices(void);
14void lacie_v2_hdd_power_init(int hdd_num); 14void lacie_v2_hdd_power_init(int hdd_num);
15 15
16extern struct sys_timer lacie_v2_timer;
17
18#endif 16#endif
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index 065187d177c6..27901f702feb 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -59,7 +59,7 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list)
59 } 59 }
60 printk("\n"); 60 printk("\n");
61 61
62 while (*mpp_list) { 62 for ( ; *mpp_list; mpp_list++) {
63 unsigned int num = MPP_NUM(*mpp_list); 63 unsigned int num = MPP_NUM(*mpp_list);
64 unsigned int sel = MPP_SEL(*mpp_list); 64 unsigned int sel = MPP_SEL(*mpp_list);
65 int shift, gpio_mode; 65 int shift, gpio_mode;
@@ -88,8 +88,6 @@ void __init kirkwood_mpp_conf(unsigned int *mpp_list)
88 if (sel != 0) 88 if (sel != 0)
89 gpio_mode = 0; 89 gpio_mode = 0;
90 orion_gpio_set_valid(num, gpio_mode); 90 orion_gpio_set_valid(num, gpio_mode);
91
92 mpp_list++;
93 } 91 }
94 92
95 printk(KERN_DEBUG " final MPP regs:"); 93 printk(KERN_DEBUG " final MPP regs:");
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c
index 5ea66f1f4178..65ee21fd2f3b 100644
--- a/arch/arm/mach-kirkwood/netspace_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c
@@ -262,7 +262,7 @@ MACHINE_START(NETSPACE_V2, "LaCie Network Space v2")
262 .init_machine = netspace_v2_init, 262 .init_machine = netspace_v2_init,
263 .map_io = kirkwood_map_io, 263 .map_io = kirkwood_map_io,
264 .init_irq = kirkwood_init_irq, 264 .init_irq = kirkwood_init_irq,
265 .timer = &lacie_v2_timer, 265 .timer = &kirkwood_timer,
266MACHINE_END 266MACHINE_END
267#endif 267#endif
268 268
@@ -272,7 +272,7 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2")
272 .init_machine = netspace_v2_init, 272 .init_machine = netspace_v2_init,
273 .map_io = kirkwood_map_io, 273 .map_io = kirkwood_map_io,
274 .init_irq = kirkwood_init_irq, 274 .init_irq = kirkwood_init_irq,
275 .timer = &lacie_v2_timer, 275 .timer = &kirkwood_timer,
276MACHINE_END 276MACHINE_END
277#endif 277#endif
278 278
@@ -282,6 +282,6 @@ MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2")
282 .init_machine = netspace_v2_init, 282 .init_machine = netspace_v2_init,
283 .map_io = kirkwood_map_io, 283 .map_io = kirkwood_map_io,
284 .init_irq = kirkwood_init_irq, 284 .init_irq = kirkwood_init_irq,
285 .timer = &lacie_v2_timer, 285 .timer = &kirkwood_timer,
286MACHINE_END 286MACHINE_END
287#endif 287#endif
diff --git a/arch/arm/mach-kirkwood/netxbig_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
index a1b45d501aef..93afd3c8bfd8 100644
--- a/arch/arm/mach-kirkwood/netxbig_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
@@ -403,7 +403,7 @@ MACHINE_START(NET2BIG_V2, "LaCie 2Big Network v2")
403 .init_machine = netxbig_v2_init, 403 .init_machine = netxbig_v2_init,
404 .map_io = kirkwood_map_io, 404 .map_io = kirkwood_map_io,
405 .init_irq = kirkwood_init_irq, 405 .init_irq = kirkwood_init_irq,
406 .timer = &lacie_v2_timer, 406 .timer = &kirkwood_timer,
407MACHINE_END 407MACHINE_END
408#endif 408#endif
409 409
@@ -413,6 +413,6 @@ MACHINE_START(NET5BIG_V2, "LaCie 5Big Network v2")
413 .init_machine = netxbig_v2_init, 413 .init_machine = netxbig_v2_init,
414 .map_io = kirkwood_map_io, 414 .map_io = kirkwood_map_io,
415 .init_irq = kirkwood_init_irq, 415 .init_irq = kirkwood_init_irq,
416 .timer = &lacie_v2_timer, 416 .timer = &kirkwood_timer,
417MACHINE_END 417MACHINE_END
418#endif 418#endif
diff --git a/arch/arm/mach-kirkwood/ts41x-setup.c b/arch/arm/mach-kirkwood/ts41x-setup.c
index 8be09a0ce4ac..3587a281d993 100644
--- a/arch/arm/mach-kirkwood/ts41x-setup.c
+++ b/arch/arm/mach-kirkwood/ts41x-setup.c
@@ -27,6 +27,10 @@
27#include "mpp.h" 27#include "mpp.h"
28#include "tsx1x-common.h" 28#include "tsx1x-common.h"
29 29
30/* for the PCIe reset workaround */
31#include <plat/pcie.h>
32
33
30#define QNAP_TS41X_JUMPER_JP1 45 34#define QNAP_TS41X_JUMPER_JP1 45
31 35
32static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = { 36static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = {
@@ -140,8 +144,16 @@ static void __init qnap_ts41x_init(void)
140 144
141static int __init ts41x_pci_init(void) 145static int __init ts41x_pci_init(void)
142{ 146{
143 if (machine_is_ts41x()) 147 if (machine_is_ts41x()) {
148 /*
149 * Without this explicit reset, the PCIe SATA controller
150 * (Marvell 88sx7042/sata_mv) is known to stop working
151 * after a few minutes.
152 */
153 orion_pcie_reset((void __iomem *)PCIE_VIRT_BASE);
154
144 kirkwood_pcie_init(KW_PCIE0); 155 kirkwood_pcie_init(KW_PCIE0);
156 }
145 157
146 return 0; 158 return 0;
147} 159}
diff --git a/arch/arm/mach-mmp/include/mach/cputype.h b/arch/arm/mach-mmp/include/mach/cputype.h
index f43a68b213f1..8a3b56dfd35d 100644
--- a/arch/arm/mach-mmp/include/mach/cputype.h
+++ b/arch/arm/mach-mmp/include/mach/cputype.h
@@ -46,7 +46,8 @@ static inline int cpu_is_pxa910(void)
46#ifdef CONFIG_CPU_MMP2 46#ifdef CONFIG_CPU_MMP2
47static inline int cpu_is_mmp2(void) 47static inline int cpu_is_mmp2(void)
48{ 48{
49 return (((cpu_readid_id() >> 8) & 0xff) == 0x58); 49 return (((read_cpuid_id() >> 8) & 0xff) == 0x58);
50}
50#else 51#else
51#define cpu_is_mmp2() (0) 52#define cpu_is_mmp2() (0)
52#endif 53#endif
diff --git a/arch/arm/mach-msm/Kconfig b/arch/arm/mach-msm/Kconfig
index 3115a29dec4e..dbbcfeb919db 100644
--- a/arch/arm/mach-msm/Kconfig
+++ b/arch/arm/mach-msm/Kconfig
@@ -6,6 +6,7 @@ choice
6 6
7config ARCH_MSM7X00A 7config ARCH_MSM7X00A
8 bool "MSM7x00A / MSM7x01A" 8 bool "MSM7x00A / MSM7x01A"
9 select MACH_TROUT if !MACH_HALIBUT
9 select ARCH_MSM_ARM11 10 select ARCH_MSM_ARM11
10 select MSM_SMD 11 select MSM_SMD
11 select MSM_SMD_PKG3 12 select MSM_SMD_PKG3
@@ -15,34 +16,34 @@ config ARCH_MSM7X00A
15 16
16config ARCH_MSM7X30 17config ARCH_MSM7X30
17 bool "MSM7x30" 18 bool "MSM7x30"
19 select MACH_MSM7X30_SURF # if !
18 select ARCH_MSM_SCORPION 20 select ARCH_MSM_SCORPION
19 select MSM_SMD 21 select MSM_SMD
20 select MSM_VIC 22 select MSM_VIC
21 select CPU_V7 23 select CPU_V7
22 select MSM_REMOTE_SPINLOCK_DEKKERS
23 select MSM_GPIOMUX 24 select MSM_GPIOMUX
24 select MSM_PROC_COMM 25 select MSM_PROC_COMM
25 select HAS_MSM_DEBUG_UART_PHYS 26 select HAS_MSM_DEBUG_UART_PHYS
26 27
27config ARCH_QSD8X50 28config ARCH_QSD8X50
28 bool "QSD8X50" 29 bool "QSD8X50"
30 select MACH_QSD8X50_SURF if !MACH_QSD8X50A_ST1_5
29 select ARCH_MSM_SCORPION 31 select ARCH_MSM_SCORPION
30 select MSM_SMD 32 select MSM_SMD
31 select MSM_VIC 33 select MSM_VIC
32 select CPU_V7 34 select CPU_V7
33 select MSM_REMOTE_SPINLOCK_LDREX
34 select MSM_GPIOMUX 35 select MSM_GPIOMUX
35 select MSM_PROC_COMM 36 select MSM_PROC_COMM
36 select HAS_MSM_DEBUG_UART_PHYS 37 select HAS_MSM_DEBUG_UART_PHYS
37 38
38config ARCH_MSM8X60 39config ARCH_MSM8X60
39 bool "MSM8X60" 40 bool "MSM8X60"
41 select MACH_MSM8X60_SURF if (!MACH_MSM8X60_RUMI3 && !MACH_MSM8X60_SIM \
42 && !MACH_MSM8X60_FFA)
40 select ARM_GIC 43 select ARM_GIC
41 select CPU_V7 44 select CPU_V7
42 select MSM_V2_TLMM 45 select MSM_V2_TLMM
43 select MSM_GPIOMUX 46 select MSM_GPIOMUX
44 select MACH_MSM8X60_SURF if (!MACH_MSM8X60_RUMI3 && !MACH_MSM8X60_SIM \
45 && !MACH_MSM8X60_FFA)
46 47
47endchoice 48endchoice
48 49
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 59edecbe126c..75dabb16c802 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -83,7 +83,6 @@ static void __init halibut_fixup(struct machine_desc *desc, struct tag *tags,
83{ 83{
84 mi->nr_banks=1; 84 mi->nr_banks=1;
85 mi->bank[0].start = PHYS_OFFSET; 85 mi->bank[0].start = PHYS_OFFSET;
86 mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
87 mi->bank[0].size = (101*1024*1024); 86 mi->bank[0].size = (101*1024*1024);
88} 87}
89 88
diff --git a/arch/arm/mach-msm/include/mach/debug-macro.S b/arch/arm/mach-msm/include/mach/debug-macro.S
index fbd5d90dcc8c..646b99ebc773 100644
--- a/arch/arm/mach-msm/include/mach/debug-macro.S
+++ b/arch/arm/mach-msm/include/mach/debug-macro.S
@@ -19,7 +19,7 @@
19#include <mach/hardware.h> 19#include <mach/hardware.h>
20#include <mach/msm_iomap.h> 20#include <mach/msm_iomap.h>
21 21
22#ifdef CONFIG_HAS_MSM_DEBUG_UART_PHYS 22#if defined(CONFIG_HAS_MSM_DEBUG_UART_PHYS) && !defined(CONFIG_MSM_DEBUG_UART_NONE)
23 .macro addruart, rp, rv 23 .macro addruart, rp, rv
24 ldr \rp, =MSM_DEBUG_UART_PHYS 24 ldr \rp, =MSM_DEBUG_UART_PHYS
25 ldr \rv, =MSM_DEBUG_UART_BASE 25 ldr \rv, =MSM_DEBUG_UART_BASE
@@ -36,7 +36,18 @@
36 tst \rd, #0x04 36 tst \rd, #0x04
37 beq 1001b 37 beq 1001b
38 .endm 38 .endm
39#else
40 .macro addruart, rp, rv
41 mov \rv, #0xff000000
42 orr \rv, \rv, #0x00f00000
43 .endm
39 44
40 .macro busyuart,rd,rx 45 .macro senduart,rd,rx
46 .endm
47
48 .macro waituart,rd,rx
41 .endm 49 .endm
42#endif 50#endif
51
52 .macro busyuart,rd,rx
53 .endm
diff --git a/arch/arm/mach-msm/iommu_dev.c b/arch/arm/mach-msm/iommu_dev.c
index c33ae786c41f..9019cee2907b 100644
--- a/arch/arm/mach-msm/iommu_dev.c
+++ b/arch/arm/mach-msm/iommu_dev.c
@@ -128,7 +128,7 @@ static void msm_iommu_reset(void __iomem *base)
128 128
129static int msm_iommu_probe(struct platform_device *pdev) 129static int msm_iommu_probe(struct platform_device *pdev)
130{ 130{
131 struct resource *r; 131 struct resource *r, *r2;
132 struct clk *iommu_clk; 132 struct clk *iommu_clk;
133 struct msm_iommu_drvdata *drvdata; 133 struct msm_iommu_drvdata *drvdata;
134 struct msm_iommu_dev *iommu_dev = pdev->dev.platform_data; 134 struct msm_iommu_dev *iommu_dev = pdev->dev.platform_data;
@@ -183,27 +183,27 @@ static int msm_iommu_probe(struct platform_device *pdev)
183 183
184 len = r->end - r->start + 1; 184 len = r->end - r->start + 1;
185 185
186 r = request_mem_region(r->start, len, r->name); 186 r2 = request_mem_region(r->start, len, r->name);
187 if (!r) { 187 if (!r2) {
188 pr_err("Could not request memory region: " 188 pr_err("Could not request memory region: "
189 "start=%p, len=%d\n", (void *) r->start, len); 189 "start=%p, len=%d\n", (void *) r->start, len);
190 ret = -EBUSY; 190 ret = -EBUSY;
191 goto fail; 191 goto fail;
192 } 192 }
193 193
194 regs_base = ioremap(r->start, len); 194 regs_base = ioremap(r2->start, len);
195 195
196 if (!regs_base) { 196 if (!regs_base) {
197 pr_err("Could not ioremap: start=%p, len=%d\n", 197 pr_err("Could not ioremap: start=%p, len=%d\n",
198 (void *) r->start, len); 198 (void *) r2->start, len);
199 ret = -EBUSY; 199 ret = -EBUSY;
200 goto fail; 200 goto fail_mem;
201 } 201 }
202 202
203 irq = platform_get_irq_byname(pdev, "secure_irq"); 203 irq = platform_get_irq_byname(pdev, "secure_irq");
204 if (irq < 0) { 204 if (irq < 0) {
205 ret = -ENODEV; 205 ret = -ENODEV;
206 goto fail; 206 goto fail_io;
207 } 207 }
208 208
209 mb(); 209 mb();
@@ -211,14 +211,14 @@ static int msm_iommu_probe(struct platform_device *pdev)
211 if (GET_IDR(regs_base) == 0) { 211 if (GET_IDR(regs_base) == 0) {
212 pr_err("Invalid IDR value detected\n"); 212 pr_err("Invalid IDR value detected\n");
213 ret = -ENODEV; 213 ret = -ENODEV;
214 goto fail; 214 goto fail_io;
215 } 215 }
216 216
217 ret = request_irq(irq, msm_iommu_fault_handler, 0, 217 ret = request_irq(irq, msm_iommu_fault_handler, 0,
218 "msm_iommu_secure_irpt_handler", drvdata); 218 "msm_iommu_secure_irpt_handler", drvdata);
219 if (ret) { 219 if (ret) {
220 pr_err("Request IRQ %d failed with ret=%d\n", irq, ret); 220 pr_err("Request IRQ %d failed with ret=%d\n", irq, ret);
221 goto fail; 221 goto fail_io;
222 } 222 }
223 223
224 msm_iommu_reset(regs_base); 224 msm_iommu_reset(regs_base);
@@ -237,6 +237,10 @@ static int msm_iommu_probe(struct platform_device *pdev)
237 237
238 return 0; 238 return 0;
239 239
240fail_io:
241 iounmap(regs_base);
242fail_mem:
243 release_mem_region(r->start, len);
240fail: 244fail:
241 kfree(drvdata); 245 kfree(drvdata);
242 return ret; 246 return ret;
diff --git a/arch/arm/mach-msm/timer.c b/arch/arm/mach-msm/timer.c
index 7689848ec680..950100f19d07 100644
--- a/arch/arm/mach-msm/timer.c
+++ b/arch/arm/mach-msm/timer.c
@@ -137,7 +137,7 @@ static struct msm_clock msm_clocks[] = {
137 .rating = 200, 137 .rating = 200,
138 .read = msm_gpt_read, 138 .read = msm_gpt_read,
139 .mask = CLOCKSOURCE_MASK(32), 139 .mask = CLOCKSOURCE_MASK(32),
140 .shift = 24, 140 .shift = 17,
141 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 141 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
142 }, 142 },
143 .irq = { 143 .irq = {
diff --git a/arch/arm/mach-mv78xx0/mpp.c b/arch/arm/mach-mv78xx0/mpp.c
index 354ac514eb89..84db2dfc475c 100644
--- a/arch/arm/mach-mv78xx0/mpp.c
+++ b/arch/arm/mach-mv78xx0/mpp.c
@@ -54,7 +54,7 @@ void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
54 } 54 }
55 printk("\n"); 55 printk("\n");
56 56
57 while (*mpp_list) { 57 for ( ; *mpp_list; mpp_list++) {
58 unsigned int num = MPP_NUM(*mpp_list); 58 unsigned int num = MPP_NUM(*mpp_list);
59 unsigned int sel = MPP_SEL(*mpp_list); 59 unsigned int sel = MPP_SEL(*mpp_list);
60 int shift, gpio_mode; 60 int shift, gpio_mode;
@@ -83,8 +83,6 @@ void __init mv78xx0_mpp_conf(unsigned int *mpp_list)
83 if (sel != 0) 83 if (sel != 0)
84 gpio_mode = 0; 84 gpio_mode = 0;
85 orion_gpio_set_valid(num, gpio_mode); 85 orion_gpio_set_valid(num, gpio_mode);
86
87 mpp_list++;
88 } 86 }
89 87
90 printk(KERN_DEBUG " final MPP regs:"); 88 printk(KERN_DEBUG " final MPP regs:");
diff --git a/arch/arm/mach-mx25/Kconfig b/arch/arm/mach-mx25/Kconfig
index aa57e35ce3cd..38ca09a5df9d 100644
--- a/arch/arm/mach-mx25/Kconfig
+++ b/arch/arm/mach-mx25/Kconfig
@@ -6,6 +6,7 @@ config MACH_MX25_3DS
6 bool "Support MX25PDK (3DS) Platform" 6 bool "Support MX25PDK (3DS) Platform"
7 select IMX_HAVE_PLATFORM_IMX_UART 7 select IMX_HAVE_PLATFORM_IMX_UART
8 select IMX_HAVE_PLATFORM_MXC_NAND 8 select IMX_HAVE_PLATFORM_MXC_NAND
9 select IMX_HAVE_PLATFORM_ESDHC
9 10
10config MACH_EUKREA_CPUIMX25 11config MACH_EUKREA_CPUIMX25
11 bool "Support Eukrea CPUIMX25 Platform" 12 bool "Support Eukrea CPUIMX25 Platform"
diff --git a/arch/arm/mach-mx25/mach-mx25_3ds.c b/arch/arm/mach-mx25/mach-mx25_3ds.c
index 80805107a73e..f8be1eb0c062 100644
--- a/arch/arm/mach-mx25/mach-mx25_3ds.c
+++ b/arch/arm/mach-mx25/mach-mx25_3ds.c
@@ -96,6 +96,14 @@ static struct pad_desc mx25pdk_pads[] = {
96 MX25_PAD_KPP_COL1__KPP_COL1, 96 MX25_PAD_KPP_COL1__KPP_COL1,
97 MX25_PAD_KPP_COL2__KPP_COL2, 97 MX25_PAD_KPP_COL2__KPP_COL2,
98 MX25_PAD_KPP_COL3__KPP_COL3, 98 MX25_PAD_KPP_COL3__KPP_COL3,
99
100 /* SD1 */
101 MX25_PAD_SD1_CMD__SD1_CMD,
102 MX25_PAD_SD1_CLK__SD1_CLK,
103 MX25_PAD_SD1_DATA0__SD1_DATA0,
104 MX25_PAD_SD1_DATA1__SD1_DATA1,
105 MX25_PAD_SD1_DATA2__SD1_DATA2,
106 MX25_PAD_SD1_DATA3__SD1_DATA3,
99}; 107};
100 108
101static const struct fec_platform_data mx25_fec_pdata __initconst = { 109static const struct fec_platform_data mx25_fec_pdata __initconst = {
@@ -193,6 +201,8 @@ static void __init mx25pdk_init(void)
193 mx25pdk_fec_reset(); 201 mx25pdk_fec_reset();
194 imx25_add_fec(&mx25_fec_pdata); 202 imx25_add_fec(&mx25_fec_pdata);
195 mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data); 203 mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data);
204
205 imx25_add_esdhc(0, NULL);
196} 206}
197 207
198static void __init mx25pdk_timer_init(void) 208static void __init mx25pdk_timer_init(void)
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 096fd33f8ab9..5000ac1f93e3 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -143,8 +143,10 @@ config MACH_ARMADILLO5X0
143config MACH_MX35_3DS 143config MACH_MX35_3DS
144 bool "Support MX35PDK platform" 144 bool "Support MX35PDK platform"
145 select ARCH_MX35 145 select ARCH_MX35
146 select MXC_DEBUG_BOARD
146 select IMX_HAVE_PLATFORM_IMX_UART 147 select IMX_HAVE_PLATFORM_IMX_UART
147 select IMX_HAVE_PLATFORM_MXC_NAND 148 select IMX_HAVE_PLATFORM_MXC_NAND
149 select IMX_HAVE_PLATFORM_ESDHC
148 default n 150 default n
149 help 151 help
150 Include support for MX35PDK platform. This includes specific 152 Include support for MX35PDK platform. This includes specific
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index f4dff11aaee7..d4da9496089a 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -72,24 +72,24 @@ struct platform_device mxc_w1_master_device = {
72#ifdef CONFIG_ARCH_MX31 72#ifdef CONFIG_ARCH_MX31
73static struct resource mxcsdhc0_resources[] = { 73static struct resource mxcsdhc0_resources[] = {
74 { 74 {
75 .start = MMC_SDHC1_BASE_ADDR, 75 .start = MX31_MMC_SDHC1_BASE_ADDR,
76 .end = MMC_SDHC1_BASE_ADDR + SZ_16K - 1, 76 .end = MX31_MMC_SDHC1_BASE_ADDR + SZ_16K - 1,
77 .flags = IORESOURCE_MEM, 77 .flags = IORESOURCE_MEM,
78 }, { 78 }, {
79 .start = MXC_INT_MMC_SDHC1, 79 .start = MX31_INT_MMC_SDHC1,
80 .end = MXC_INT_MMC_SDHC1, 80 .end = MX31_INT_MMC_SDHC1,
81 .flags = IORESOURCE_IRQ, 81 .flags = IORESOURCE_IRQ,
82 }, 82 },
83}; 83};
84 84
85static struct resource mxcsdhc1_resources[] = { 85static struct resource mxcsdhc1_resources[] = {
86 { 86 {
87 .start = MMC_SDHC2_BASE_ADDR, 87 .start = MX31_MMC_SDHC2_BASE_ADDR,
88 .end = MMC_SDHC2_BASE_ADDR + SZ_16K - 1, 88 .end = MX31_MMC_SDHC2_BASE_ADDR + SZ_16K - 1,
89 .flags = IORESOURCE_MEM, 89 .flags = IORESOURCE_MEM,
90 }, { 90 }, {
91 .start = MXC_INT_MMC_SDHC2, 91 .start = MX31_INT_MMC_SDHC2,
92 .end = MXC_INT_MMC_SDHC2, 92 .end = MX31_INT_MMC_SDHC2,
93 .flags = IORESOURCE_IRQ, 93 .flags = IORESOURCE_IRQ,
94 }, 94 },
95}; 95};
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index 5c1d0e86c91e..0ad9e7821082 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -38,39 +38,9 @@
38#include "devices-imx31.h" 38#include "devices-imx31.h"
39#include "devices.h" 39#include "devices.h"
40 40
41/* Definitions for components on the Debug board */
42
43/* Base address of CPLD controller on the Debug board */
44#define DEBUG_BASE_ADDRESS CS5_IO_ADDRESS(MX3x_CS5_BASE_ADDR)
45
46/* LAN9217 ethernet base address */
47#define LAN9217_BASE_ADDR MX3x_CS5_BASE_ADDR
48
49/* CPLD config and interrupt base address */
50#define CPLD_ADDR (DEBUG_BASE_ADDRESS + 0x20000)
51
52/* status, interrupt */
53#define CPLD_INT_STATUS_REG (CPLD_ADDR + 0x10)
54#define CPLD_INT_MASK_REG (CPLD_ADDR + 0x38)
55#define CPLD_INT_RESET_REG (CPLD_ADDR + 0x20)
56/* magic word for debug CPLD */
57#define CPLD_MAGIC_NUMBER1_REG (CPLD_ADDR + 0x40)
58#define CPLD_MAGIC_NUMBER2_REG (CPLD_ADDR + 0x48)
59/* CPLD code version */
60#define CPLD_CODE_VER_REG (CPLD_ADDR + 0x50)
61/* magic word for debug CPLD */
62#define CPLD_MAGIC_NUMBER3_REG (CPLD_ADDR + 0x58)
63
64/* CPLD IRQ line for external uart, external ethernet etc */ 41/* CPLD IRQ line for external uart, external ethernet etc */
65#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1) 42#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1)
66 43
67#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
68#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
69
70#define EXPIO_INT_ENET (MXC_EXP_IO_BASE + 0)
71
72#define MXC_MAX_EXP_IO_LINES 16
73
74/* 44/*
75 * This file contains the board-specific initialization routines. 45 * This file contains the board-specific initialization routines.
76 */ 46 */
@@ -272,7 +242,7 @@ static void __init mxc_board_init(void)
272 imx31_add_imx_uart0(&uart_pdata); 242 imx31_add_imx_uart0(&uart_pdata);
273 imx31_add_mxc_nand(&mx31_3ds_nand_board_info); 243 imx31_add_mxc_nand(&mx31_3ds_nand_board_info);
274 244
275 imx31_add_spi_imx0(&spi1_pdata); 245 imx31_add_spi_imx1(&spi1_pdata);
276 spi_register_board_info(mx31_3ds_spi_devs, 246 spi_register_board_info(mx31_3ds_spi_devs,
277 ARRAY_SIZE(mx31_3ds_spi_devs)); 247 ARRAY_SIZE(mx31_3ds_spi_devs));
278 248
@@ -281,9 +251,9 @@ static void __init mxc_board_init(void)
281 mx31_3ds_usbotg_init(); 251 mx31_3ds_usbotg_init();
282 mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata); 252 mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata);
283 253
284 if (!mxc_expio_init(CS5_BASE_ADDR, EXPIO_PARENT_INT)) 254 if (mxc_expio_init(MX31_CS5_BASE_ADDR, EXPIO_PARENT_INT))
285 printk(KERN_WARNING "Init of the debugboard failed, all " 255 printk(KERN_WARNING "Init of the debug board failed, all "
286 "devices on the board are unusable.\n"); 256 "devices on the debug board are unusable.\n");
287} 257}
288 258
289static void __init mx31_3ds_timer_init(void) 259static void __init mx31_3ds_timer_init(void)
diff --git a/arch/arm/mach-mx3/mach-mx35_3ds.c b/arch/arm/mach-mx3/mach-mx35_3ds.c
index 05f628d90725..b66a75aa2e88 100644
--- a/arch/arm/mach-mx3/mach-mx35_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx35_3ds.c
@@ -38,11 +38,15 @@
38#include <mach/hardware.h> 38#include <mach/hardware.h>
39#include <mach/common.h> 39#include <mach/common.h>
40#include <mach/iomux-mx35.h> 40#include <mach/iomux-mx35.h>
41#include <mach/irqs.h>
42#include <mach/3ds_debugboard.h>
41#include <mach/mxc_ehci.h> 43#include <mach/mxc_ehci.h>
42 44
43#include "devices-imx35.h" 45#include "devices-imx35.h"
44#include "devices.h" 46#include "devices.h"
45 47
48#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 1)
49
46static const struct imxuart_platform_data uart_pdata __initconst = { 50static const struct imxuart_platform_data uart_pdata __initconst = {
47 .flags = IMXUART_HAVE_RTSCTS, 51 .flags = IMXUART_HAVE_RTSCTS,
48}; 52};
@@ -108,6 +112,13 @@ static struct pad_desc mx35pdk_pads[] = {
108 /* USBH1 */ 112 /* USBH1 */
109 MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR, 113 MX35_PAD_I2C2_CLK__USB_TOP_USBH2_PWR,
110 MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC, 114 MX35_PAD_I2C2_DAT__USB_TOP_USBH2_OC,
115 /* SDCARD */
116 MX35_PAD_SD1_CMD__ESDHC1_CMD,
117 MX35_PAD_SD1_CLK__ESDHC1_CLK,
118 MX35_PAD_SD1_DATA0__ESDHC1_DAT0,
119 MX35_PAD_SD1_DATA1__ESDHC1_DAT1,
120 MX35_PAD_SD1_DATA2__ESDHC1_DAT2,
121 MX35_PAD_SD1_DATA3__ESDHC1_DAT3,
111}; 122};
112 123
113/* OTG config */ 124/* OTG config */
@@ -140,6 +151,11 @@ static void __init mxc_board_init(void)
140 mxc_register_device(&mxc_usbh1, &usb_host_pdata); 151 mxc_register_device(&mxc_usbh1, &usb_host_pdata);
141 152
142 imx35_add_mxc_nand(&mx35pdk_nand_board_info); 153 imx35_add_mxc_nand(&mx35pdk_nand_board_info);
154 imx35_add_esdhc(0, NULL);
155
156 if (mxc_expio_init(MX35_CS5_BASE_ADDR, EXPIO_PARENT_INT))
157 pr_warn("Init of the debugboard failed, all "
158 "devices on the debugboard are unusable.\n");
143} 159}
144 160
145static void __init mx35pdk_timer_init(void) 161static void __init mx35pdk_timer_init(void)
diff --git a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
index 86e86c1300d5..2ff3f661a48e 100644
--- a/arch/arm/mach-mx3/mach-pcm037.c
+++ b/arch/arm/mach-mx3/mach-pcm037.c
@@ -311,7 +311,6 @@ static struct soc_camera_link iclink_mt9v022 = {
311 .bus_id = 0, /* Must match with the camera ID */ 311 .bus_id = 0, /* Must match with the camera ID */
312 .board_info = &pcm037_i2c_camera[1], 312 .board_info = &pcm037_i2c_camera[1],
313 .i2c_adapter_id = 2, 313 .i2c_adapter_id = 2,
314 .module_name = "mt9v022",
315}; 314};
316 315
317static struct soc_camera_link iclink_mt9t031 = { 316static struct soc_camera_link iclink_mt9t031 = {
@@ -319,7 +318,6 @@ static struct soc_camera_link iclink_mt9t031 = {
319 .power = pcm037_camera_power, 318 .power = pcm037_camera_power,
320 .board_info = &pcm037_i2c_camera[0], 319 .board_info = &pcm037_i2c_camera[0],
321 .i2c_adapter_id = 2, 320 .i2c_adapter_id = 2,
322 .module_name = "mt9t031",
323}; 321};
324 322
325static struct i2c_board_info pcm037_i2c_devices[] = { 323static struct i2c_board_info pcm037_i2c_devices[] = {
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 0551eb39d97e..18069cb7d068 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -179,7 +179,6 @@ static struct soc_camera_link base_iclink = {
179 .reset = marxbot_basecam_reset, 179 .reset = marxbot_basecam_reset,
180 .board_info = &marxbot_i2c_devices[0], 180 .board_info = &marxbot_i2c_devices[0],
181 .i2c_adapter_id = 0, 181 .i2c_adapter_id = 0,
182 .module_name = "mt9t031",
183}; 182};
184 183
185static struct platform_device marxbot_camera[] = { 184static struct platform_device marxbot_camera[] = {
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
index 417757e78c65..04760a53005a 100644
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -88,7 +88,6 @@ static struct soc_camera_link base_iclink = {
88 .reset = smartbot_cam_reset, 88 .reset = smartbot_cam_reset,
89 .board_info = &smartbot_i2c_devices[0], 89 .board_info = &smartbot_i2c_devices[0],
90 .i2c_adapter_id = 0, 90 .i2c_adapter_id = 0,
91 .module_name = "mt9t031",
92}; 91};
93 92
94static struct platform_device smartbot_camera[] = { 93static struct platform_device smartbot_camera[] = {
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index a2df9ac37996..3ec910a7a182 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -6,6 +6,7 @@ config ARCH_MX51
6 select MXC_TZIC 6 select MXC_TZIC
7 select ARCH_MXC_IOMUX_V3 7 select ARCH_MXC_IOMUX_V3
8 select ARCH_MXC_AUDMUX_V2 8 select ARCH_MXC_AUDMUX_V2
9 select ARCH_HAS_CPUFREQ
9 10
10comment "MX5 platforms:" 11comment "MX5 platforms:"
11 12
@@ -13,6 +14,7 @@ config MACH_MX51_BABBAGE
13 bool "Support MX51 BABBAGE platforms" 14 bool "Support MX51 BABBAGE platforms"
14 select IMX_HAVE_PLATFORM_IMX_I2C 15 select IMX_HAVE_PLATFORM_IMX_I2C
15 select IMX_HAVE_PLATFORM_IMX_UART 16 select IMX_HAVE_PLATFORM_IMX_UART
17 select IMX_HAVE_PLATFORM_ESDHC
16 help 18 help
17 Include support for MX51 Babbage platform, also known as MX51EVK in 19 Include support for MX51 Babbage platform, also known as MX51EVK in
18 u-boot. This includes specific configurations for the board and its 20 u-boot. This includes specific configurations for the board and its
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index 1769c161a60d..462f177eddfe 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -5,6 +5,7 @@
5# Object file lists. 5# Object file lists.
6obj-y := cpu.o mm.o clock-mx51.o devices.o 6obj-y := cpu.o mm.o clock-mx51.o devices.o
7 7
8obj-$(CONFIG_CPU_FREQ_IMX) += cpu_op-mx51.o
8obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o 9obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
9obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o 10obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o
10obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o 11obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index 0821fe9b3b27..acbe30df2e69 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com> 3 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
4 * 4 *
5 * The code contained herein is licensed under the GNU General Public 5 * The code contained herein is licensed under the GNU General Public
@@ -18,6 +18,8 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/fsl_devices.h> 19#include <linux/fsl_devices.h>
20#include <linux/fec.h> 20#include <linux/fec.h>
21#include <linux/gpio_keys.h>
22#include <linux/input.h>
21 23
22#include <mach/common.h> 24#include <mach/common.h>
23#include <mach/hardware.h> 25#include <mach/hardware.h>
@@ -32,11 +34,13 @@
32 34
33#include "devices-imx51.h" 35#include "devices-imx51.h"
34#include "devices.h" 36#include "devices.h"
37#include "cpu_op-mx51.h"
35 38
36#define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */ 39#define BABBAGE_USB_HUB_RESET (0*32 + 7) /* GPIO_1_7 */
37#define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */ 40#define BABBAGE_USBH1_STP (0*32 + 27) /* GPIO_1_27 */
38#define BABBAGE_PHY_RESET (1*32 + 5) /* GPIO_2_5 */ 41#define BABBAGE_PHY_RESET (1*32 + 5) /* GPIO_2_5 */
39#define BABBAGE_FEC_PHY_RESET (1*32 + 14) /* GPIO_2_14 */ 42#define BABBAGE_FEC_PHY_RESET (1*32 + 14) /* GPIO_2_14 */
43#define BABBAGE_POWER_KEY (1*32 + 21) /* GPIO_2_21 */
40 44
41/* USB_CTRL_1 */ 45/* USB_CTRL_1 */
42#define MX51_USB_CTRL_1_OFFSET 0x10 46#define MX51_USB_CTRL_1_OFFSET 0x10
@@ -46,6 +50,21 @@
46#define MX51_USB_PLL_DIV_19_2_MHZ 0x01 50#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
47#define MX51_USB_PLL_DIV_24_MHZ 0x02 51#define MX51_USB_PLL_DIV_24_MHZ 0x02
48 52
53static struct gpio_keys_button babbage_buttons[] = {
54 {
55 .gpio = BABBAGE_POWER_KEY,
56 .code = BTN_0,
57 .desc = "PWR",
58 .active_low = 1,
59 .wakeup = 1,
60 },
61};
62
63static const struct gpio_keys_platform_data imx_button_data __initconst = {
64 .buttons = babbage_buttons,
65 .nbuttons = ARRAY_SIZE(babbage_buttons),
66};
67
49static struct pad_desc mx51babbage_pads[] = { 68static struct pad_desc mx51babbage_pads[] = {
50 /* UART1 */ 69 /* UART1 */
51 MX51_PAD_UART1_RXD__UART1_RXD, 70 MX51_PAD_UART1_RXD__UART1_RXD,
@@ -112,6 +131,22 @@ static struct pad_desc mx51babbage_pads[] = {
112 131
113 /* FEC PHY reset line */ 132 /* FEC PHY reset line */
114 MX51_PAD_EIM_A20__GPIO_2_14, 133 MX51_PAD_EIM_A20__GPIO_2_14,
134
135 /* SD 1 */
136 MX51_PAD_SD1_CMD__SD1_CMD,
137 MX51_PAD_SD1_CLK__SD1_CLK,
138 MX51_PAD_SD1_DATA0__SD1_DATA0,
139 MX51_PAD_SD1_DATA1__SD1_DATA1,
140 MX51_PAD_SD1_DATA2__SD1_DATA2,
141 MX51_PAD_SD1_DATA3__SD1_DATA3,
142
143 /* SD 2 */
144 MX51_PAD_SD2_CMD__SD2_CMD,
145 MX51_PAD_SD2_CLK__SD2_CLK,
146 MX51_PAD_SD2_DATA0__SD2_DATA0,
147 MX51_PAD_SD2_DATA1__SD2_DATA1,
148 MX51_PAD_SD2_DATA2__SD2_DATA2,
149 MX51_PAD_SD2_DATA3__SD2_DATA3,
115}; 150};
116 151
117/* Serial ports */ 152/* Serial ports */
@@ -281,13 +316,22 @@ __setup("otg_mode=", babbage_otg_mode);
281static void __init mxc_board_init(void) 316static void __init mxc_board_init(void)
282{ 317{
283 struct pad_desc usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP; 318 struct pad_desc usbh1stp = MX51_PAD_USBH1_STP__USBH1_STP;
319 struct pad_desc power_key = MX51_PAD_EIM_A27__GPIO_2_21;
284 320
321#if defined(CONFIG_CPU_FREQ_IMX)
322 get_cpu_op = mx51_get_cpu_op;
323#endif
285 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads, 324 mxc_iomux_v3_setup_multiple_pads(mx51babbage_pads,
286 ARRAY_SIZE(mx51babbage_pads)); 325 ARRAY_SIZE(mx51babbage_pads));
287 mxc_init_imx_uart(); 326 mxc_init_imx_uart();
288 babbage_fec_reset(); 327 babbage_fec_reset();
289 imx51_add_fec(NULL); 328 imx51_add_fec(NULL);
290 329
330 /* Set the PAD settings for the pwr key. */
331 power_key.pad_ctrl = MX51_GPIO_PAD_CTRL_2;
332 mxc_iomux_v3_setup_pad(&power_key);
333 imx51_add_gpio_keys(&imx_button_data);
334
291 imx51_add_imx_i2c(0, &babbage_i2c_data); 335 imx51_add_imx_i2c(0, &babbage_i2c_data);
292 imx51_add_imx_i2c(1, &babbage_i2c_data); 336 imx51_add_imx_i2c(1, &babbage_i2c_data);
293 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data); 337 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data);
@@ -304,6 +348,9 @@ static void __init mxc_board_init(void)
304 /* setback USBH1_STP to be function */ 348 /* setback USBH1_STP to be function */
305 mxc_iomux_v3_setup_pad(&usbh1stp); 349 mxc_iomux_v3_setup_pad(&usbh1stp);
306 babbage_usbhub_reset(); 350 babbage_usbhub_reset();
351
352 imx51_add_esdhc(0, NULL);
353 imx51_add_esdhc(1, NULL);
307} 354}
308 355
309static void __init mx51_babbage_timer_init(void) 356static void __init mx51_babbage_timer_init(void)
diff --git a/arch/arm/mach-mx5/clock-mx51.c b/arch/arm/mach-mx5/clock-mx51.c
index f2aae92cf0e2..8ac36d882927 100644
--- a/arch/arm/mach-mx5/clock-mx51.c
+++ b/arch/arm/mach-mx5/clock-mx51.c
@@ -362,7 +362,7 @@ static int _clk_lp_apm_set_parent(struct clk *clk, struct clk *parent)
362 return 0; 362 return 0;
363} 363}
364 364
365static unsigned long clk_arm_get_rate(struct clk *clk) 365static unsigned long clk_cpu_get_rate(struct clk *clk)
366{ 366{
367 u32 cacrr, div; 367 u32 cacrr, div;
368 unsigned long parent_rate; 368 unsigned long parent_rate;
@@ -374,6 +374,22 @@ static unsigned long clk_arm_get_rate(struct clk *clk)
374 return parent_rate / div; 374 return parent_rate / div;
375} 375}
376 376
377static int clk_cpu_set_rate(struct clk *clk, unsigned long rate)
378{
379 u32 reg, cpu_podf;
380 unsigned long parent_rate;
381
382 parent_rate = clk_get_rate(clk->parent);
383 cpu_podf = parent_rate / rate - 1;
384 /* use post divider to change freq */
385 reg = __raw_readl(MXC_CCM_CACRR);
386 reg &= ~MXC_CCM_CACRR_ARM_PODF_MASK;
387 reg |= cpu_podf << MXC_CCM_CACRR_ARM_PODF_OFFSET;
388 __raw_writel(reg, MXC_CCM_CACRR);
389
390 return 0;
391}
392
377static int _clk_periph_apm_set_parent(struct clk *clk, struct clk *parent) 393static int _clk_periph_apm_set_parent(struct clk *clk, struct clk *parent)
378{ 394{
379 u32 reg, mux; 395 u32 reg, mux;
@@ -736,7 +752,8 @@ static struct clk periph_apm_clk = {
736 752
737static struct clk cpu_clk = { 753static struct clk cpu_clk = {
738 .parent = &pll1_sw_clk, 754 .parent = &pll1_sw_clk,
739 .get_rate = clk_arm_get_rate, 755 .get_rate = clk_cpu_get_rate,
756 .set_rate = clk_cpu_set_rate,
740}; 757};
741 758
742static struct clk ahb_clk = { 759static struct clk ahb_clk = {
@@ -1064,6 +1081,7 @@ static struct clk_lookup lookups[] = {
1064 _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk) 1081 _REGISTER_CLOCK("imx51-cspi.0", NULL, cspi_clk)
1065 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk) 1082 _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
1066 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk) 1083 _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
1084 _REGISTER_CLOCK(NULL, "cpu_clk", cpu_clk)
1067}; 1085};
1068 1086
1069static void clk_tree_init(void) 1087static void clk_tree_init(void)
diff --git a/arch/arm/mach-mx5/cpu_op-mx51.c b/arch/arm/mach-mx5/cpu_op-mx51.c
new file mode 100644
index 000000000000..9d34c3d4c024
--- /dev/null
+++ b/arch/arm/mach-mx5/cpu_op-mx51.c
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14#include <linux/types.h>
15#include <mach/hardware.h>
16#include <linux/kernel.h>
17
18static struct cpu_op mx51_cpu_op[] = {
19 {
20 .cpu_rate = 160000000,},
21 {
22 .cpu_rate = 800000000,},
23};
24
25struct cpu_op *mx51_get_cpu_op(int *op)
26{
27 *op = ARRAY_SIZE(mx51_cpu_op);
28 return mx51_cpu_op;
29}
diff --git a/arch/arm/mach-mx5/cpu_op-mx51.h b/arch/arm/mach-mx5/cpu_op-mx51.h
new file mode 100644
index 000000000000..97477fecb469
--- /dev/null
+++ b/arch/arm/mach-mx5/cpu_op-mx51.h
@@ -0,0 +1,14 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14extern struct cpu_op *mx51_get_cpu_op(int *op);
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h
index 5cc910e60538..8c50cb5d05f5 100644
--- a/arch/arm/mach-mx5/devices-imx51.h
+++ b/arch/arm/mach-mx5/devices-imx51.h
@@ -13,6 +13,8 @@ extern const struct imx_fec_data imx51_fec_data __initconst;
13#define imx51_add_fec(pdata) \ 13#define imx51_add_fec(pdata) \
14 imx_add_fec(&imx51_fec_data, pdata) 14 imx_add_fec(&imx51_fec_data, pdata)
15 15
16#define imx51_add_gpio_keys(pdata) imx_add_gpio_keys(pdata)
17
16extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst; 18extern const struct imx_imx_i2c_data imx51_imx_i2c_data[] __initconst;
17#define imx51_add_imx_i2c(id, pdata) \ 19#define imx51_add_imx_i2c(id, pdata) \
18 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata) 20 imx_add_imx_i2c(&imx51_imx_i2c_data[id], pdata)
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index ea0d80a89da7..e7f9ee63dce5 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -321,10 +321,9 @@ static struct platform_device omap_wdt_device = {
321static int __init omap_init_wdt(void) 321static int __init omap_init_wdt(void)
322{ 322{
323 if (!cpu_is_omap16xx()) 323 if (!cpu_is_omap16xx())
324 return; 324 return -ENODEV;
325 325
326 platform_device_register(&omap_wdt_device); 326 return platform_device_register(&omap_wdt_device);
327 return 0;
328} 327}
329subsys_initcall(omap_init_wdt); 328subsys_initcall(omap_init_wdt);
330#endif 329#endif
diff --git a/arch/arm/mach-omap1/include/mach/camera.h b/arch/arm/mach-omap1/include/mach/camera.h
index fd54b452eb22..847d00f0bb0a 100644
--- a/arch/arm/mach-omap1/include/mach/camera.h
+++ b/arch/arm/mach-omap1/include/mach/camera.h
@@ -1,6 +1,8 @@
1#ifndef __ASM_ARCH_CAMERA_H_ 1#ifndef __ASM_ARCH_CAMERA_H_
2#define __ASM_ARCH_CAMERA_H_ 2#define __ASM_ARCH_CAMERA_H_
3 3
4#include <media/omap1_camera.h>
5
4void omap1_camera_init(void *); 6void omap1_camera_init(void *);
5 7
6static inline void omap1_set_camera_info(struct omap1_cam_platform_data *info) 8static inline void omap1_set_camera_info(struct omap1_cam_platform_data *info)
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index 7352412e4917..60e51bcf53bd 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -108,6 +108,10 @@ obj-y += $(iommu-m) $(iommu-y)
108i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o 108i2c-omap-$(CONFIG_I2C_OMAP) := i2c.o
109obj-y += $(i2c-omap-m) $(i2c-omap-y) 109obj-y += $(i2c-omap-m) $(i2c-omap-y)
110 110
111ifneq ($(CONFIG_TIDSPBRIDGE),)
112obj-y += dsp.o
113endif
114
111# Specific board support 115# Specific board support
112obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o 116obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
113obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o 117obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 69a4ae971e41..df5a425a49d1 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -269,9 +269,14 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev)
269 struct omap_mmc_platform_data *pdata = dev->platform_data; 269 struct omap_mmc_platform_data *pdata = dev->platform_data;
270 270
271 /* Setting MMC1 Card detect Irq */ 271 /* Setting MMC1 Card detect Irq */
272 if (pdev->id == 0) 272 if (pdev->id == 0) {
273 ret = twl6030_mmc_card_detect_config();
274 if (ret)
275 pr_err("Failed configuring MMC1 card detect\n");
273 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE + 276 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE +
274 MMCDETECT_INTR_OFFSET; 277 MMCDETECT_INTR_OFFSET;
278 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
279 }
275 return ret; 280 return ret;
276} 281}
277 282
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 067f4379c87f..53ac762518bd 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -242,9 +242,6 @@ static int devkit8000_twl_gpio_setup(struct device *dev,
242 mmc[0].gpio_cd = gpio + 0; 242 mmc[0].gpio_cd = gpio + 0;
243 omap2_hsmmc_init(mmc); 243 omap2_hsmmc_init(mmc);
244 244
245 /* link regulators to MMC adapters */
246 devkit8000_vmmc1_supply.dev = mmc[0].dev;
247
248 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ 245 /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */
249 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 246 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
250 247
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 702f2a63f2c1..1ecd0a6cefb7 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -160,10 +160,19 @@ static int omap4_twl6030_hsmmc_late_init(struct device *dev)
160 struct platform_device, dev); 160 struct platform_device, dev);
161 struct omap_mmc_platform_data *pdata = dev->platform_data; 161 struct omap_mmc_platform_data *pdata = dev->platform_data;
162 162
163 if (!pdata) {
164 dev_err(dev, "%s: NULL platform data\n", __func__);
165 return -EINVAL;
166 }
163 /* Setting MMC1 Card detect Irq */ 167 /* Setting MMC1 Card detect Irq */
164 if (pdev->id == 0) 168 if (pdev->id == 0) {
165 pdata->slots[0].card_detect_irq = TWL6030_IRQ_BASE + 169 ret = twl6030_mmc_card_detect_config();
166 MMCDETECT_INTR_OFFSET; 170 if (ret)
171 dev_err(dev, "%s: Error card detect config(%d)\n",
172 __func__, ret);
173 else
174 pdata->slots[0].card_detect = twl6030_mmc_card_detect;
175 }
167 return ret; 176 return ret;
168} 177}
169 178
diff --git a/arch/arm/mach-omap2/dsp.c b/arch/arm/mach-omap2/dsp.c
new file mode 100644
index 000000000000..6feeeae6c21b
--- /dev/null
+++ b/arch/arm/mach-omap2/dsp.c
@@ -0,0 +1,85 @@
1/*
2 * TI's OMAP DSP platform device registration
3 *
4 * Copyright (C) 2005-2006 Texas Instruments, Inc.
5 * Copyright (C) 2009 Nokia Corporation
6 *
7 * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/platform_device.h>
15#include "prm.h"
16#include "cm.h"
17#ifdef CONFIG_BRIDGE_DVFS
18#include <plat/omap-pm.h>
19#endif
20
21#include <plat/dsp.h>
22
23extern phys_addr_t omap_dsp_get_mempool_base(void);
24
25static struct platform_device *omap_dsp_pdev;
26
27static struct omap_dsp_platform_data omap_dsp_pdata __initdata = {
28#ifdef CONFIG_BRIDGE_DVFS
29 .dsp_set_min_opp = omap_pm_dsp_set_min_opp,
30 .dsp_get_opp = omap_pm_dsp_get_opp,
31 .cpu_set_freq = omap_pm_cpu_set_freq,
32 .cpu_get_freq = omap_pm_cpu_get_freq,
33#endif
34 .dsp_prm_read = prm_read_mod_reg,
35 .dsp_prm_write = prm_write_mod_reg,
36 .dsp_prm_rmw_bits = prm_rmw_mod_reg_bits,
37 .dsp_cm_read = cm_read_mod_reg,
38 .dsp_cm_write = cm_write_mod_reg,
39 .dsp_cm_rmw_bits = cm_rmw_mod_reg_bits,
40};
41
42static int __init omap_dsp_init(void)
43{
44 struct platform_device *pdev;
45 int err = -ENOMEM;
46 struct omap_dsp_platform_data *pdata = &omap_dsp_pdata;
47
48 pdata->phys_mempool_base = omap_dsp_get_mempool_base();
49
50 if (pdata->phys_mempool_base) {
51 pdata->phys_mempool_size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
52 pr_info("%s: %x bytes @ %x\n", __func__,
53 pdata->phys_mempool_size, pdata->phys_mempool_base);
54 }
55
56 pdev = platform_device_alloc("omap-dsp", -1);
57 if (!pdev)
58 goto err_out;
59
60 err = platform_device_add_data(pdev, pdata, sizeof(*pdata));
61 if (err)
62 goto err_out;
63
64 err = platform_device_add(pdev);
65 if (err)
66 goto err_out;
67
68 omap_dsp_pdev = pdev;
69 return 0;
70
71err_out:
72 platform_device_put(pdev);
73 return err;
74}
75module_init(omap_dsp_init);
76
77static void __exit omap_dsp_exit(void)
78{
79 platform_device_unregister(omap_dsp_pdev);
80}
81module_exit(omap_dsp_exit);
82
83MODULE_AUTHOR("Hiroshi DOYU");
84MODULE_DESCRIPTION("TI's OMAP DSP platform device registration");
85MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 923f9f5f91ce..2f895553e6a8 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -44,6 +44,13 @@ void __init gic_init_irq(void)
44} 44}
45 45
46#ifdef CONFIG_CACHE_L2X0 46#ifdef CONFIG_CACHE_L2X0
47
48static void omap4_l2x0_disable(void)
49{
50 /* Disable PL310 L2 Cache controller */
51 omap_smc1(0x102, 0x0);
52}
53
47static int __init omap_l2_cache_init(void) 54static int __init omap_l2_cache_init(void)
48{ 55{
49 /* 56 /*
@@ -70,6 +77,12 @@ static int __init omap_l2_cache_init(void)
70 else 77 else
71 l2x0_init(l2cache_base, 0x0e070000, 0xc0000fff); 78 l2x0_init(l2cache_base, 0x0e070000, 0xc0000fff);
72 79
80 /*
81 * Override default outer_cache.disable with a OMAP4
82 * specific one
83 */
84 outer_cache.disable = omap4_l2x0_disable;
85
73 return 0; 86 return 0;
74} 87}
75early_initcall(omap_l2_cache_init); 88early_initcall(omap_l2_cache_init);
diff --git a/arch/arm/mach-orion5x/mpp.c b/arch/arm/mach-orion5x/mpp.c
index bc4c3b9aaf83..db485d3b8144 100644
--- a/arch/arm/mach-orion5x/mpp.c
+++ b/arch/arm/mach-orion5x/mpp.c
@@ -127,7 +127,7 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
127 /* Initialize gpiolib. */ 127 /* Initialize gpiolib. */
128 orion_gpio_init(); 128 orion_gpio_init();
129 129
130 while (mode->mpp >= 0) { 130 for ( ; mode->mpp >= 0; mode++) {
131 u32 *reg; 131 u32 *reg;
132 int num_type; 132 int num_type;
133 int shift; 133 int shift;
@@ -160,8 +160,6 @@ void __init orion5x_mpp_conf(struct orion5x_mpp_mode *mode)
160 orion_gpio_set_unused(mode->mpp); 160 orion_gpio_set_unused(mode->mpp);
161 161
162 orion_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO)); 162 orion_gpio_set_valid(mode->mpp, !!(mode->type == MPP_GPIO));
163
164 mode++;
165 } 163 }
166 164
167 writel(mpp_0_7_ctrl, MPP_0_7_CTRL); 165 writel(mpp_0_7_ctrl, MPP_0_7_CTRL);
diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index 16f1bd5324be..c1c1cd04bdde 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -239,7 +239,7 @@ static struct platform_nand_data ts78xx_ts_nand_data = {
239static struct resource ts78xx_ts_nand_resources = { 239static struct resource ts78xx_ts_nand_resources = {
240 .start = TS_NAND_DATA, 240 .start = TS_NAND_DATA,
241 .end = TS_NAND_DATA + 4, 241 .end = TS_NAND_DATA + 4,
242 .flags = IORESOURCE_IO, 242 .flags = IORESOURCE_MEM,
243}; 243};
244 244
245static struct platform_device ts78xx_ts_nand_device = { 245static struct platform_device ts78xx_ts_nand_device = {
diff --git a/arch/arm/mach-pxa/cm-x2xx.c b/arch/arm/mach-pxa/cm-x2xx.c
index ac5598ce9724..d34b99febeb9 100644
--- a/arch/arm/mach-pxa/cm-x2xx.c
+++ b/arch/arm/mach-pxa/cm-x2xx.c
@@ -476,8 +476,6 @@ static void __init cmx2xx_init(void)
476 476
477static void __init cmx2xx_init_irq(void) 477static void __init cmx2xx_init_irq(void)
478{ 478{
479 pxa27x_init_irq();
480
481 if (cpu_is_pxa25x()) { 479 if (cpu_is_pxa25x()) {
482 pxa25x_init_irq(); 480 pxa25x_init_irq();
483 cmx2xx_pci_init_irq(CMX255_GPIO_IT8152_IRQ); 481 cmx2xx_pci_init_irq(CMX255_GPIO_IT8152_IRQ);
diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
index ab48bb81b570..ed0dbfdb22ed 100644
--- a/arch/arm/mach-pxa/em-x270.c
+++ b/arch/arm/mach-pxa/em-x270.c
@@ -1015,7 +1015,6 @@ static struct soc_camera_link iclink = {
1015 .power = em_x270_sensor_power, 1015 .power = em_x270_sensor_power,
1016 .board_info = &em_x270_i2c_cam_info[0], 1016 .board_info = &em_x270_i2c_cam_info[0],
1017 .i2c_adapter_id = 0, 1017 .i2c_adapter_id = 0,
1018 .module_name = "mt9m111",
1019}; 1018};
1020 1019
1021static struct platform_device em_x270_camera = { 1020static struct platform_device em_x270_camera = {
diff --git a/arch/arm/mach-pxa/ezx.c b/arch/arm/mach-pxa/ezx.c
index 80a9352d43f3..142c711f4cda 100644
--- a/arch/arm/mach-pxa/ezx.c
+++ b/arch/arm/mach-pxa/ezx.c
@@ -755,7 +755,6 @@ static struct soc_camera_link a780_iclink = {
755 .flags = SOCAM_SENSOR_INVERT_PCLK, 755 .flags = SOCAM_SENSOR_INVERT_PCLK,
756 .i2c_adapter_id = 0, 756 .i2c_adapter_id = 0,
757 .board_info = &a780_camera_i2c_board_info, 757 .board_info = &a780_camera_i2c_board_info,
758 .module_name = "mt9m111",
759 .power = a780_camera_power, 758 .power = a780_camera_power,
760 .reset = a780_camera_reset, 759 .reset = a780_camera_reset,
761}; 760};
@@ -1024,7 +1023,6 @@ static struct soc_camera_link a910_iclink = {
1024 .bus_id = 0, 1023 .bus_id = 0,
1025 .i2c_adapter_id = 0, 1024 .i2c_adapter_id = 0,
1026 .board_info = &a910_camera_i2c_board_info, 1025 .board_info = &a910_camera_i2c_board_info,
1027 .module_name = "mt9m111",
1028 .power = a910_camera_power, 1026 .power = a910_camera_power,
1029 .reset = a910_camera_reset, 1027 .reset = a910_camera_reset,
1030}; 1028};
diff --git a/arch/arm/mach-pxa/mioa701.c b/arch/arm/mach-pxa/mioa701.c
index 0c31fabfc7fd..f5fb915e1315 100644
--- a/arch/arm/mach-pxa/mioa701.c
+++ b/arch/arm/mach-pxa/mioa701.c
@@ -711,7 +711,6 @@ static struct soc_camera_link iclink = {
711 .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */ 711 .bus_id = 0, /* Match id in pxa27x_device_camera in device.c */
712 .board_info = &mioa701_i2c_devices[0], 712 .board_info = &mioa701_i2c_devices[0],
713 .i2c_adapter_id = 0, 713 .i2c_adapter_id = 0,
714 .module_name = "mt9m111",
715}; 714};
716 715
717struct i2c_pxa_platform_data i2c_pdata = { 716struct i2c_pxa_platform_data i2c_pdata = {
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index f56ae1008759..f33647a8e0b7 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -453,7 +453,6 @@ static struct soc_camera_link iclink[] = {
453 .query_bus_param = pcm990_camera_query_bus_param, 453 .query_bus_param = pcm990_camera_query_bus_param,
454 .set_bus_param = pcm990_camera_set_bus_param, 454 .set_bus_param = pcm990_camera_set_bus_param,
455 .free_bus = pcm990_camera_free_bus, 455 .free_bus = pcm990_camera_free_bus,
456 .module_name = "mt9v022",
457 }, { 456 }, {
458 .bus_id = 0, /* Must match with the camera ID */ 457 .bus_id = 0, /* Must match with the camera ID */
459 .board_info = &pcm990_camera_i2c[1], 458 .board_info = &pcm990_camera_i2c[1],
@@ -461,7 +460,6 @@ static struct soc_camera_link iclink[] = {
461 .query_bus_param = pcm990_camera_query_bus_param, 460 .query_bus_param = pcm990_camera_query_bus_param,
462 .set_bus_param = pcm990_camera_set_bus_param, 461 .set_bus_param = pcm990_camera_set_bus_param,
463 .free_bus = pcm990_camera_free_bus, 462 .free_bus = pcm990_camera_free_bus,
464 .module_name = "mt9m001",
465 }, 463 },
466}; 464};
467 465
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index 4b521e045d75..ffa50e633ee6 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -116,7 +116,7 @@ static struct platform_device smc91x_device = {
116 }, 116 },
117}; 117};
118 118
119#if defined(CONFIG_FB_PXA) || (CONFIG_FB_PXA_MODULE) 119#if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
120static uint16_t lcd_power_on[] = { 120static uint16_t lcd_power_on[] = {
121 /* single frame */ 121 /* single frame */
122 SMART_CMD_NOOP, 122 SMART_CMD_NOOP,
diff --git a/arch/arm/mach-s3c2410/h1940-bluetooth.c b/arch/arm/mach-s3c2410/h1940-bluetooth.c
index 8cdeb14af592..8aa2f1902a94 100644
--- a/arch/arm/mach-s3c2410/h1940-bluetooth.c
+++ b/arch/arm/mach-s3c2410/h1940-bluetooth.c
@@ -30,7 +30,7 @@ static void h1940bt_enable(int on)
30{ 30{
31 if (on) { 31 if (on) {
32 /* Power on the chip */ 32 /* Power on the chip */
33 h1940_latch_control(0, H1940_LATCH_BLUETOOTH_POWER); 33 gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 1);
34 /* Reset the chip */ 34 /* Reset the chip */
35 mdelay(10); 35 mdelay(10);
36 36
@@ -43,7 +43,7 @@ static void h1940bt_enable(int on)
43 mdelay(10); 43 mdelay(10);
44 gpio_set_value(S3C2410_GPH(1), 0); 44 gpio_set_value(S3C2410_GPH(1), 0);
45 mdelay(10); 45 mdelay(10);
46 h1940_latch_control(H1940_LATCH_BLUETOOTH_POWER, 0); 46 gpio_set_value(H1940_LATCH_BLUETOOTH_POWER, 0);
47 } 47 }
48} 48}
49 49
@@ -64,7 +64,14 @@ static int __devinit h1940bt_probe(struct platform_device *pdev)
64 64
65 ret = gpio_request(S3C2410_GPH(1), dev_name(&pdev->dev)); 65 ret = gpio_request(S3C2410_GPH(1), dev_name(&pdev->dev));
66 if (ret) { 66 if (ret) {
67 dev_err(&pdev->dev, "could not get GPH1\n");\ 67 dev_err(&pdev->dev, "could not get GPH1\n");
68 return ret;
69 }
70
71 ret = gpio_request(H1940_LATCH_BLUETOOTH_POWER, dev_name(&pdev->dev));
72 if (ret) {
73 gpio_free(S3C2410_GPH(1));
74 dev_err(&pdev->dev, "could not get BT_POWER\n");
68 return ret; 75 return ret;
69 } 76 }
70 77
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c2410/include/mach/gpio.h
index b649bf2ccd5c..f7f6b07df30e 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/gpio.h
@@ -22,6 +22,8 @@
22 22
23#ifdef CONFIG_CPU_S3C244X 23#ifdef CONFIG_CPU_S3C244X
24#define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA) 24#define ARCH_NR_GPIOS (32 * 9 + CONFIG_S3C24XX_GPIO_EXTRA)
25#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
26#define ARCH_NR_GPIOS (32 * 12 + CONFIG_S3C24XX_GPIO_EXTRA)
25#else 27#else
26#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) 28#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA)
27#endif 29#endif
@@ -30,8 +32,10 @@
30#include <mach/gpio-nrs.h> 32#include <mach/gpio-nrs.h>
31#include <mach/gpio-fns.h> 33#include <mach/gpio-fns.h>
32 34
33#ifdef CONFIG_CPU_S3C24XX 35#ifdef CONFIG_CPU_S3C244X
34#define S3C_GPIO_END (S3C2410_GPIO_BANKJ + 32) 36#define S3C_GPIO_END (S3C2410_GPJ(0) + 32)
37#elif defined(CONFIG_CPU_S3C2443) || defined(CONFIG_CPU_S3C2416)
38#define S3C_GPIO_END (S3C2410_GPM(0) + 32)
35#else 39#else
36#define S3C_GPIO_END (S3C2410_GPIO_BANKH + 32) 40#define S3C_GPIO_END (S3C2410_GPH(0) + 32)
37#endif 41#endif
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index d8a832729a8a..97e42bfce81e 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -14,51 +14,30 @@
14#ifndef __ASM_ARCH_H1940_LATCH_H 14#ifndef __ASM_ARCH_H1940_LATCH_H
15#define __ASM_ARCH_H1940_LATCH_H 15#define __ASM_ARCH_H1940_LATCH_H
16 16
17#include <mach/gpio.h>
17 18
18#ifndef __ASSEMBLY__ 19#define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x))
19#define H1940_LATCH ((void __force __iomem *)0xF8000000)
20#else
21#define H1940_LATCH 0xF8000000
22#endif
23
24#define H1940_PA_LATCH (S3C2410_CS2)
25 20
26/* SD layer latch */ 21/* SD layer latch */
27 22
28#define H1940_LATCH_SDQ1 (1<<16) 23#define H1940_LATCH_LCD_P0 H1940_LATCH_GPIO(0)
29#define H1940_LATCH_LCD_P1 (1<<17) 24#define H1940_LATCH_LCD_P1 H1940_LATCH_GPIO(1)
30#define H1940_LATCH_LCD_P2 (1<<18) 25#define H1940_LATCH_LCD_P2 H1940_LATCH_GPIO(2)
31#define H1940_LATCH_LCD_P3 (1<<19) 26#define H1940_LATCH_LCD_P3 H1940_LATCH_GPIO(3)
32#define H1940_LATCH_MAX1698_nSHUTDOWN (1<<20) /* LCD backlight */ 27#define H1940_LATCH_MAX1698_nSHUTDOWN H1940_LATCH_GPIO(4)
33#define H1940_LATCH_LED_RED (1<<21) 28#define H1940_LATCH_LED_RED H1940_LATCH_GPIO(5)
34#define H1940_LATCH_SDQ7 (1<<22) 29#define H1940_LATCH_SDQ7 H1940_LATCH_GPIO(6)
35#define H1940_LATCH_USB_DP (1<<23) 30#define H1940_LATCH_USB_DP H1940_LATCH_GPIO(7)
36 31
37/* CPU layer latch */ 32/* CPU layer latch */
38 33
39#define H1940_LATCH_UDA_POWER (1<<24) 34#define H1940_LATCH_UDA_POWER H1940_LATCH_GPIO(8)
40#define H1940_LATCH_AUDIO_POWER (1<<25) 35#define H1940_LATCH_AUDIO_POWER H1940_LATCH_GPIO(9)
41#define H1940_LATCH_SM803_ENABLE (1<<26) 36#define H1940_LATCH_SM803_ENABLE H1940_LATCH_GPIO(10)
42#define H1940_LATCH_LCD_P4 (1<<27) 37#define H1940_LATCH_LCD_P4 H1940_LATCH_GPIO(11)
43#define H1940_LATCH_CPUQ5 (1<<28) /* untraced */ 38#define H1940_LATCH_SD_POWER H1940_LATCH_GPIO(12)
44#define H1940_LATCH_BLUETOOTH_POWER (1<<29) /* active high */ 39#define H1940_LATCH_BLUETOOTH_POWER H1940_LATCH_GPIO(13)
45#define H1940_LATCH_LED_GREEN (1<<30) 40#define H1940_LATCH_LED_GREEN H1940_LATCH_GPIO(14)
46#define H1940_LATCH_LED_FLASH (1<<31) 41#define H1940_LATCH_LED_FLASH H1940_LATCH_GPIO(15)
47
48/* default settings */
49
50#define H1940_LATCH_DEFAULT \
51 H1940_LATCH_LCD_P4 | \
52 H1940_LATCH_SM803_ENABLE | \
53 H1940_LATCH_SDQ1 | \
54 H1940_LATCH_LCD_P1 | \
55 H1940_LATCH_LCD_P2 | \
56 H1940_LATCH_LCD_P3 | \
57 H1940_LATCH_MAX1698_nSHUTDOWN | \
58 H1940_LATCH_CPUQ5
59
60/* control functions */
61
62extern void h1940_latch_control(unsigned int clear, unsigned int set);
63 42
64#endif /* __ASM_ARCH_H1940_LATCH_H */ 43#endif /* __ASM_ARCH_H1940_LATCH_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
index 08ab9dfb6ae6..101aeea22310 100644
--- a/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
+++ b/arch/arm/mach-s3c2410/include/mach/regs-s3c2443-clock.h
@@ -118,6 +118,8 @@
118#define S3C2443_SCLKCON_UARTCLK (1<<8) 118#define S3C2443_SCLKCON_UARTCLK (1<<8)
119#define S3C2443_SCLKCON_USBHOST (1<<1) 119#define S3C2443_SCLKCON_USBHOST (1<<1)
120 120
121#define S3C2443_PWRCFG_SLEEP (1<<15)
122
121#include <asm/div64.h> 123#include <asm/div64.h>
122 124
123static inline unsigned int 125static inline unsigned int
diff --git a/arch/arm/mach-s3c2410/include/mach/vmalloc.h b/arch/arm/mach-s3c2410/include/mach/vmalloc.h
index 54297eb0bf5e..7a311e8dddba 100644
--- a/arch/arm/mach-s3c2410/include/mach/vmalloc.h
+++ b/arch/arm/mach-s3c2410/include/mach/vmalloc.h
@@ -15,6 +15,6 @@
15#ifndef __ASM_ARCH_VMALLOC_H 15#ifndef __ASM_ARCH_VMALLOC_H
16#define __ASM_ARCH_VMALLOC_H 16#define __ASM_ARCH_VMALLOC_H
17 17
18#define VMALLOC_END 0xE0000000UL 18#define VMALLOC_END 0xF6000000UL
19 19
20#endif /* __ASM_ARCH_VMALLOC_H */ 20#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 98c5c9e81ee9..d7ada8c7e41f 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -24,6 +24,7 @@
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/gpio.h> 25#include <linux/gpio.h>
26#include <linux/pwm_backlight.h> 26#include <linux/pwm_backlight.h>
27#include <linux/i2c.h>
27#include <video/platform_lcd.h> 28#include <video/platform_lcd.h>
28 29
29#include <linux/mmc/host.h> 30#include <linux/mmc/host.h>
@@ -59,6 +60,14 @@
59#include <plat/mci.h> 60#include <plat/mci.h>
60#include <plat/ts.h> 61#include <plat/ts.h>
61 62
63#include <sound/uda1380.h>
64
65#define H1940_LATCH ((void __force __iomem *)0xF8000000)
66
67#define H1940_PA_LATCH S3C2410_CS2
68
69#define H1940_LATCH_BIT(x) (1 << ((x) + 16 - S3C_GPIO_END))
70
62static struct map_desc h1940_iodesc[] __initdata = { 71static struct map_desc h1940_iodesc[] __initdata = {
63 [0] = { 72 [0] = {
64 .virtual = (unsigned long)H1940_LATCH, 73 .virtual = (unsigned long)H1940_LATCH,
@@ -100,9 +109,9 @@ static struct s3c2410_uartcfg h1940_uartcfgs[] __initdata = {
100 109
101/* Board control latch control */ 110/* Board control latch control */
102 111
103static unsigned int latch_state = H1940_LATCH_DEFAULT; 112static unsigned int latch_state;
104 113
105void h1940_latch_control(unsigned int clear, unsigned int set) 114static void h1940_latch_control(unsigned int clear, unsigned int set)
106{ 115{
107 unsigned long flags; 116 unsigned long flags;
108 117
@@ -116,7 +125,42 @@ void h1940_latch_control(unsigned int clear, unsigned int set)
116 local_irq_restore(flags); 125 local_irq_restore(flags);
117} 126}
118 127
119EXPORT_SYMBOL_GPL(h1940_latch_control); 128static inline int h1940_gpiolib_to_latch(int offset)
129{
130 return 1 << (offset + 16);
131}
132
133static void h1940_gpiolib_latch_set(struct gpio_chip *chip,
134 unsigned offset, int value)
135{
136 int latch_bit = h1940_gpiolib_to_latch(offset);
137
138 h1940_latch_control(value ? 0 : latch_bit,
139 value ? latch_bit : 0);
140}
141
142static int h1940_gpiolib_latch_output(struct gpio_chip *chip,
143 unsigned offset, int value)
144{
145 h1940_gpiolib_latch_set(chip, offset, value);
146 return 0;
147}
148
149static int h1940_gpiolib_latch_get(struct gpio_chip *chip,
150 unsigned offset)
151{
152 return (latch_state >> (offset + 16)) & 1;
153}
154
155struct gpio_chip h1940_latch_gpiochip = {
156 .base = H1940_LATCH_GPIO(0),
157 .owner = THIS_MODULE,
158 .label = "H1940_LATCH",
159 .ngpio = 16,
160 .direction_output = h1940_gpiolib_latch_output,
161 .set = h1940_gpiolib_latch_set,
162 .get = h1940_gpiolib_latch_get,
163};
120 164
121static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd) 165static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd)
122{ 166{
@@ -125,10 +169,10 @@ static void h1940_udc_pullup(enum s3c2410_udc_cmd_e cmd)
125 switch (cmd) 169 switch (cmd)
126 { 170 {
127 case S3C2410_UDC_P_ENABLE : 171 case S3C2410_UDC_P_ENABLE :
128 h1940_latch_control(0, H1940_LATCH_USB_DP); 172 gpio_set_value(H1940_LATCH_USB_DP, 1);
129 break; 173 break;
130 case S3C2410_UDC_P_DISABLE : 174 case S3C2410_UDC_P_DISABLE :
131 h1940_latch_control(H1940_LATCH_USB_DP, 0); 175 gpio_set_value(H1940_LATCH_USB_DP, 0);
132 break; 176 break;
133 case S3C2410_UDC_P_RESET : 177 case S3C2410_UDC_P_RESET :
134 break; 178 break;
@@ -199,10 +243,25 @@ static struct platform_device h1940_device_bluetooth = {
199 .id = -1, 243 .id = -1,
200}; 244};
201 245
246static void h1940_set_mmc_power(unsigned char power_mode, unsigned short vdd)
247{
248 switch (power_mode) {
249 case MMC_POWER_OFF:
250 gpio_set_value(H1940_LATCH_SD_POWER, 0);
251 break;
252 case MMC_POWER_UP:
253 case MMC_POWER_ON:
254 gpio_set_value(H1940_LATCH_SD_POWER, 1);
255 break;
256 default:
257 break;
258 };
259}
260
202static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = { 261static struct s3c24xx_mci_pdata h1940_mmc_cfg __initdata = {
203 .gpio_detect = S3C2410_GPF(5), 262 .gpio_detect = S3C2410_GPF(5),
204 .gpio_wprotect = S3C2410_GPH(8), 263 .gpio_wprotect = S3C2410_GPH(8),
205 .set_power = NULL, 264 .set_power = h1940_set_mmc_power,
206 .ocr_avail = MMC_VDD_32_33, 265 .ocr_avail = MMC_VDD_32_33,
207}; 266};
208 267
@@ -213,15 +272,32 @@ static int h1940_backlight_init(struct device *dev)
213 gpio_direction_output(S3C2410_GPB(0), 0); 272 gpio_direction_output(S3C2410_GPB(0), 0);
214 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE); 273 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
215 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0); 274 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
275 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
216 276
217 return 0; 277 return 0;
218} 278}
219 279
280static int h1940_backlight_notify(struct device *dev, int brightness)
281{
282 if (!brightness) {
283 gpio_direction_output(S3C2410_GPB(0), 1);
284 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
285 } else {
286 gpio_direction_output(S3C2410_GPB(0), 0);
287 s3c_gpio_setpull(S3C2410_GPB(0), S3C_GPIO_PULL_NONE);
288 s3c_gpio_cfgpin(S3C2410_GPB(0), S3C2410_GPB0_TOUT0);
289 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 1);
290 }
291 return brightness;
292}
293
220static void h1940_backlight_exit(struct device *dev) 294static void h1940_backlight_exit(struct device *dev)
221{ 295{
222 gpio_direction_output(S3C2410_GPB(0), 1); 296 gpio_direction_output(S3C2410_GPB(0), 1);
297 gpio_set_value(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
223} 298}
224 299
300
225static struct platform_pwm_backlight_data backlight_data = { 301static struct platform_pwm_backlight_data backlight_data = {
226 .pwm_id = 0, 302 .pwm_id = 0,
227 .max_brightness = 100, 303 .max_brightness = 100,
@@ -229,6 +305,7 @@ static struct platform_pwm_backlight_data backlight_data = {
229 /* tcnt = 0x31 */ 305 /* tcnt = 0x31 */
230 .pwm_period_ns = 36296, 306 .pwm_period_ns = 36296,
231 .init = h1940_backlight_init, 307 .init = h1940_backlight_init,
308 .notify = h1940_backlight_notify,
232 .exit = h1940_backlight_exit, 309 .exit = h1940_backlight_exit,
233}; 310};
234 311
@@ -247,19 +324,37 @@ static void h1940_lcd_power_set(struct plat_lcd_data *pd,
247 int value; 324 int value;
248 325
249 if (!power) { 326 if (!power) {
250 /* set to 3ec */ 327 gpio_set_value(S3C2410_GPC(0), 0);
251 gpio_direction_output(S3C2410_GPC(0), 0);
252 /* wait for 3ac */ 328 /* wait for 3ac */
253 do { 329 do {
254 value = gpio_get_value(S3C2410_GPC(6)); 330 value = gpio_get_value(S3C2410_GPC(6));
255 } while (value); 331 } while (value);
256 /* set to 38c */ 332
257 gpio_direction_output(S3C2410_GPC(5), 0); 333 gpio_set_value(H1940_LATCH_LCD_P2, 0);
334 gpio_set_value(H1940_LATCH_LCD_P3, 0);
335 gpio_set_value(H1940_LATCH_LCD_P4, 0);
336
337 gpio_direction_output(S3C2410_GPC(1), 0);
338 gpio_direction_output(S3C2410_GPC(4), 0);
339
340 gpio_set_value(H1940_LATCH_LCD_P1, 0);
341 gpio_set_value(H1940_LATCH_LCD_P0, 0);
342
343 gpio_set_value(S3C2410_GPC(5), 0);
344
258 } else { 345 } else {
259 /* Set to 3ac */ 346 gpio_set_value(H1940_LATCH_LCD_P0, 1);
260 gpio_direction_output(S3C2410_GPC(5), 1); 347 gpio_set_value(H1940_LATCH_LCD_P1, 1);
261 /* Set to 3ad */ 348
262 gpio_direction_output(S3C2410_GPC(0), 1); 349 s3c_gpio_cfgpin(S3C2410_GPC(1), S3C_GPIO_SFN(2));
350 s3c_gpio_cfgpin(S3C2410_GPC(4), S3C_GPIO_SFN(2));
351
352 gpio_set_value(S3C2410_GPC(5), 1);
353 gpio_set_value(S3C2410_GPC(0), 1);
354
355 gpio_set_value(H1940_LATCH_LCD_P3, 1);
356 gpio_set_value(H1940_LATCH_LCD_P2, 1);
357 gpio_set_value(H1940_LATCH_LCD_P4, 1);
263 } 358 }
264} 359}
265 360
@@ -273,12 +368,26 @@ static struct platform_device h1940_lcd_powerdev = {
273 .dev.platform_data = &h1940_lcd_power_data, 368 .dev.platform_data = &h1940_lcd_power_data,
274}; 369};
275 370
371static struct uda1380_platform_data uda1380_info = {
372 .gpio_power = H1940_LATCH_UDA_POWER,
373 .gpio_reset = S3C2410_GPA(12),
374 .dac_clk = UDA1380_DAC_CLK_SYSCLK,
375};
376
377static struct i2c_board_info h1940_i2c_devices[] = {
378 {
379 I2C_BOARD_INFO("uda1380", 0x1a),
380 .platform_data = &uda1380_info,
381 },
382};
383
276static struct platform_device *h1940_devices[] __initdata = { 384static struct platform_device *h1940_devices[] __initdata = {
277 &s3c_device_ohci, 385 &s3c_device_ohci,
278 &s3c_device_lcd, 386 &s3c_device_lcd,
279 &s3c_device_wdt, 387 &s3c_device_wdt,
280 &s3c_device_i2c0, 388 &s3c_device_i2c0,
281 &s3c_device_iis, 389 &s3c_device_iis,
390 &s3c_device_pcm,
282 &s3c_device_usbgadget, 391 &s3c_device_usbgadget,
283 &h1940_device_leds, 392 &h1940_device_leds,
284 &h1940_device_bluetooth, 393 &h1940_device_bluetooth,
@@ -303,6 +412,10 @@ static void __init h1940_map_io(void)
303 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024); 412 memcpy(phys_to_virt(H1940_SUSPEND_RESUMEAT), h1940_pm_return, 1024);
304#endif 413#endif
305 s3c_pm_init(); 414 s3c_pm_init();
415
416 /* Add latch gpio chip, set latch initial value */
417 h1940_latch_control(0, 0);
418 WARN_ON(gpiochip_add(&h1940_latch_gpiochip));
306} 419}
307 420
308/* H1940 and RX3715 need to reserve this for suspend */ 421/* H1940 and RX3715 need to reserve this for suspend */
@@ -340,12 +453,38 @@ static void __init h1940_init(void)
340 writel(tmp, S3C2410_UPLLCON); 453 writel(tmp, S3C2410_UPLLCON);
341 454
342 gpio_request(S3C2410_GPC(0), "LCD power"); 455 gpio_request(S3C2410_GPC(0), "LCD power");
456 gpio_request(S3C2410_GPC(1), "LCD power");
457 gpio_request(S3C2410_GPC(4), "LCD power");
343 gpio_request(S3C2410_GPC(5), "LCD power"); 458 gpio_request(S3C2410_GPC(5), "LCD power");
344 gpio_request(S3C2410_GPC(6), "LCD power"); 459 gpio_request(S3C2410_GPC(6), "LCD power");
345 460 gpio_request(H1940_LATCH_LCD_P0, "LCD power");
461 gpio_request(H1940_LATCH_LCD_P1, "LCD power");
462 gpio_request(H1940_LATCH_LCD_P2, "LCD power");
463 gpio_request(H1940_LATCH_LCD_P3, "LCD power");
464 gpio_request(H1940_LATCH_LCD_P4, "LCD power");
465 gpio_request(H1940_LATCH_MAX1698_nSHUTDOWN, "LCD power");
466 gpio_direction_output(S3C2410_GPC(0), 0);
467 gpio_direction_output(S3C2410_GPC(1), 0);
468 gpio_direction_output(S3C2410_GPC(4), 0);
469 gpio_direction_output(S3C2410_GPC(5), 0);
346 gpio_direction_input(S3C2410_GPC(6)); 470 gpio_direction_input(S3C2410_GPC(6));
471 gpio_direction_output(H1940_LATCH_LCD_P0, 0);
472 gpio_direction_output(H1940_LATCH_LCD_P1, 0);
473 gpio_direction_output(H1940_LATCH_LCD_P2, 0);
474 gpio_direction_output(H1940_LATCH_LCD_P3, 0);
475 gpio_direction_output(H1940_LATCH_LCD_P4, 0);
476 gpio_direction_output(H1940_LATCH_MAX1698_nSHUTDOWN, 0);
477
478 gpio_request(H1940_LATCH_USB_DP, "USB pullup");
479 gpio_direction_output(H1940_LATCH_USB_DP, 0);
480
481 gpio_request(H1940_LATCH_SD_POWER, "SD power");
482 gpio_direction_output(H1940_LATCH_SD_POWER, 0);
347 483
348 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices)); 484 platform_add_devices(h1940_devices, ARRAY_SIZE(h1940_devices));
485
486 i2c_register_board_info(0, h1940_i2c_devices,
487 ARRAY_SIZE(h1940_i2c_devices));
349} 488}
350 489
351MACHINE_START(H1940, "IPAQ-H1940") 490MACHINE_START(H1940, "IPAQ-H1940")
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index bef39f77729d..4c6df51ddf33 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -51,6 +51,7 @@
51#include <plat/clock.h> 51#include <plat/clock.h>
52#include <plat/pm.h> 52#include <plat/pm.h>
53#include <plat/pll.h> 53#include <plat/pll.h>
54#include <plat/nand-core.h>
54 55
55#ifndef CONFIG_CPU_S3C2412_ONLY 56#ifndef CONFIG_CPU_S3C2412_ONLY
56void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO; 57void __iomem *s3c24xx_va_gpio2 = S3C24XX_VA_GPIO;
@@ -92,7 +93,7 @@ void __init s3c2412_init_uarts(struct s3c2410_uartcfg *cfg, int no)
92 /* rename devices that are s3c2412/s3c2413 specific */ 93 /* rename devices that are s3c2412/s3c2413 specific */
93 s3c_device_sdi.name = "s3c2412-sdi"; 94 s3c_device_sdi.name = "s3c2412-sdi";
94 s3c_device_lcd.name = "s3c2412-lcd"; 95 s3c_device_lcd.name = "s3c2412-lcd";
95 s3c_device_nand.name = "s3c2412-nand"; 96 s3c_nand_setname("s3c2412-nand");
96 97
97 /* alter IRQ of SDI controller */ 98 /* alter IRQ of SDI controller */
98 99
diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig
index 657e4fe17f39..87b9c9f003bd 100644
--- a/arch/arm/mach-s3c2416/Kconfig
+++ b/arch/arm/mach-s3c2416/Kconfig
@@ -25,6 +25,11 @@ config S3C2416_DMA
25 help 25 help
26 Internal config node for S3C2416 DMA support 26 Internal config node for S3C2416 DMA support
27 27
28config S3C2416_PM
29 bool
30 help
31 Internal config node to apply S3C2416 power management
32
28menu "S3C2416 Machines" 33menu "S3C2416 Machines"
29 34
30config MACH_SMDK2416 35config MACH_SMDK2416
@@ -33,6 +38,7 @@ config MACH_SMDK2416
33 select S3C_DEV_FB 38 select S3C_DEV_FB
34 select S3C_DEV_HSMMC 39 select S3C_DEV_HSMMC
35 select S3C_DEV_HSMMC1 40 select S3C_DEV_HSMMC1
41 select S3C2416_PM if PM
36 help 42 help
37 Say Y here if you are using an SMDK2416 43 Say Y here if you are using an SMDK2416
38 44
diff --git a/arch/arm/mach-s3c2416/Makefile b/arch/arm/mach-s3c2416/Makefile
index 6c12c7bf40ad..ef038d62ffdb 100644
--- a/arch/arm/mach-s3c2416/Makefile
+++ b/arch/arm/mach-s3c2416/Makefile
@@ -11,7 +11,7 @@ obj- :=
11 11
12obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock.o 12obj-$(CONFIG_CPU_S3C2416) += s3c2416.o clock.o
13obj-$(CONFIG_CPU_S3C2416) += irq.o 13obj-$(CONFIG_CPU_S3C2416) += irq.o
14 14obj-$(CONFIG_S3C2416_PM) += pm.o
15#obj-$(CONFIG_S3C2416_DMA) += dma.o 15#obj-$(CONFIG_S3C2416_DMA) += dma.o
16 16
17# Machine support 17# Machine support
diff --git a/arch/arm/mach-s3c2416/irq.c b/arch/arm/mach-s3c2416/irq.c
index 89f521d59d06..084d121f368c 100644
--- a/arch/arm/mach-s3c2416/irq.c
+++ b/arch/arm/mach-s3c2416/irq.c
@@ -243,6 +243,8 @@ static int __init s3c2416_irq_add(struct sys_device *sysdev)
243 243
244static struct sysdev_driver s3c2416_irq_driver = { 244static struct sysdev_driver s3c2416_irq_driver = {
245 .add = s3c2416_irq_add, 245 .add = s3c2416_irq_add,
246 .suspend = s3c24xx_irq_suspend,
247 .resume = s3c24xx_irq_resume,
246}; 248};
247 249
248static int __init s3c2416_irq_init(void) 250static int __init s3c2416_irq_init(void)
diff --git a/arch/arm/mach-s3c2416/pm.c b/arch/arm/mach-s3c2416/pm.c
new file mode 100644
index 000000000000..4a04205b04d5
--- /dev/null
+++ b/arch/arm/mach-s3c2416/pm.c
@@ -0,0 +1,84 @@
1/* linux/arch/arm/mach-s3c2416/pm.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S3C2416 - PM support (Based on Ben Dooks' S3C2412 PM support)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/sysdev.h>
14#include <linux/io.h>
15
16#include <asm/cacheflush.h>
17
18#include <mach/regs-power.h>
19#include <mach/regs-s3c2443-clock.h>
20
21#include <plat/cpu.h>
22#include <plat/pm.h>
23
24extern void s3c2412_sleep_enter(void);
25
26static void s3c2416_cpu_suspend(void)
27{
28 flush_cache_all();
29
30 /* enable wakeup sources regardless of battery state */
31 __raw_writel(S3C2443_PWRCFG_SLEEP, S3C2443_PWRCFG);
32
33 /* set the mode as sleep, 2BED represents "Go to BED" */
34 __raw_writel(0x2BED, S3C2443_PWRMODE);
35
36 s3c2412_sleep_enter();
37}
38
39static void s3c2416_pm_prepare(void)
40{
41 /*
42 * write the magic value u-boot uses to check for resume into
43 * the INFORM0 register, and ensure INFORM1 is set to the
44 * correct address to resume from.
45 */
46 __raw_writel(0x2BED, S3C2412_INFORM0);
47 __raw_writel(virt_to_phys(s3c_cpu_resume), S3C2412_INFORM1);
48}
49
50static int s3c2416_pm_add(struct sys_device *sysdev)
51{
52 pm_cpu_prep = s3c2416_pm_prepare;
53 pm_cpu_sleep = s3c2416_cpu_suspend;
54
55 return 0;
56}
57
58static int s3c2416_pm_suspend(struct sys_device *dev, pm_message_t state)
59{
60 return 0;
61}
62
63static int s3c2416_pm_resume(struct sys_device *dev)
64{
65 /* unset the return-from-sleep amd inform flags */
66 __raw_writel(0x0, S3C2443_PWRMODE);
67 __raw_writel(0x0, S3C2412_INFORM0);
68 __raw_writel(0x0, S3C2412_INFORM1);
69
70 return 0;
71}
72
73static struct sysdev_driver s3c2416_pm_driver = {
74 .add = s3c2416_pm_add,
75 .suspend = s3c2416_pm_suspend,
76 .resume = s3c2416_pm_resume,
77};
78
79static __init int s3c2416_pm_init(void)
80{
81 return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver);
82}
83
84arch_initcall(s3c2416_pm_init);
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index bc30245e133b..63f39cdc0972 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -56,6 +56,7 @@
56 56
57#include <plat/iic-core.h> 57#include <plat/iic-core.h>
58#include <plat/fb-core.h> 58#include <plat/fb-core.h>
59#include <plat/nand-core.h>
59 60
60static struct map_desc s3c2416_iodesc[] __initdata = { 61static struct map_desc s3c2416_iodesc[] __initdata = {
61 IODESC_ENT(WATCHDOG), 62 IODESC_ENT(WATCHDOG),
@@ -100,7 +101,7 @@ void __init s3c2416_init_uarts(struct s3c2410_uartcfg *cfg, int no)
100{ 101{
101 s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no); 102 s3c24xx_init_uartdevs("s3c2440-uart", s3c2410_uart_resources, cfg, no);
102 103
103 s3c_device_nand.name = "s3c2416-nand"; 104 s3c_nand_setname("s3c2412-nand");
104} 105}
105 106
106/* s3c2416_map_io 107/* s3c2416_map_io
diff --git a/arch/arm/mach-s3c2440/Kconfig b/arch/arm/mach-s3c2440/Kconfig
index cd8e7de388f0..ff024a6c0f85 100644
--- a/arch/arm/mach-s3c2440/Kconfig
+++ b/arch/arm/mach-s3c2440/Kconfig
@@ -4,7 +4,6 @@
4 4
5config CPU_S3C2440 5config CPU_S3C2440
6 bool 6 bool
7 depends on ARCH_S3C2410
8 select CPU_ARM920T 7 select CPU_ARM920T
9 select S3C_GPIO_PULL_UP 8 select S3C_GPIO_PULL_UP
10 select S3C2410_CLOCK 9 select S3C2410_CLOCK
@@ -18,7 +17,6 @@ config CPU_S3C2440
18 17
19config CPU_S3C2442 18config CPU_S3C2442
20 bool 19 bool
21 depends on ARCH_S3C2410
22 select CPU_ARM920T 20 select CPU_ARM920T
23 select S3C2410_CLOCK 21 select S3C2410_CLOCK
24 select S3C2410_GPIO 22 select S3C2410_GPIO
@@ -30,7 +28,7 @@ config CPU_S3C2442
30 28
31config CPU_S3C244X 29config CPU_S3C244X
32 bool 30 bool
33 depends on ARCH_S3C2410 && (CPU_S3C2440 || CPU_S3C2442) 31 depends on CPU_S3C2440 || CPU_S3C2442
34 help 32 help
35 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems. 33 Support for S3C2440 and S3C2442 Samsung Mobile CPU based systems.
36 34
@@ -72,7 +70,7 @@ config S3C2440_PLL_16934400
72 70
73config S3C2440_DMA 71config S3C2440_DMA
74 bool 72 bool
75 depends on ARCH_S3C2410 && CPU_S3C24405B 73 depends on CPU_S3C2440
76 help 74 help
77 Support for S3C2440 specific DMA code5A 75 Support for S3C2440 specific DMA code5A
78 76
@@ -181,7 +179,6 @@ config MACH_MINI2440
181 select CPU_S3C2440 179 select CPU_S3C2440
182 select EEPROM_AT24 180 select EEPROM_AT24
183 select LEDS_TRIGGER_BACKLIGHT 181 select LEDS_TRIGGER_BACKLIGHT
184 select SND_S3C24XX_SOC_S3C24XX_UDA134X
185 select S3C_DEV_NAND 182 select S3C_DEV_NAND
186 select S3C_DEV_USB_HOST 183 select S3C_DEV_USB_HOST
187 help 184 help
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index 32019bd9db3b..e0622bbb6dfa 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -25,8 +25,12 @@
25#include <linux/input.h> 25#include <linux/input.h>
26#include <linux/gpio_keys.h> 26#include <linux/gpio_keys.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/pda_power.h>
28#include <linux/pwm_backlight.h> 29#include <linux/pwm_backlight.h>
29#include <linux/pwm.h> 30#include <linux/pwm.h>
31#include <linux/s3c_adc_battery.h>
32#include <linux/leds.h>
33#include <linux/i2c.h>
30 34
31#include <linux/mtd/mtd.h> 35#include <linux/mtd/mtd.h>
32#include <linux/mtd/partitions.h> 36#include <linux/mtd/partitions.h>
@@ -55,6 +59,8 @@
55#include <plat/irq.h> 59#include <plat/irq.h>
56#include <plat/ts.h> 60#include <plat/ts.h>
57 61
62#include <sound/uda1380.h>
63
58#define LCD_PWM_PERIOD 192960 64#define LCD_PWM_PERIOD 192960
59#define LCD_PWM_DUTY 127353 65#define LCD_PWM_DUTY 127353
60 66
@@ -127,6 +133,193 @@ static struct s3c2410fb_display rx1950_display = {
127 133
128}; 134};
129 135
136static int power_supply_init(struct device *dev)
137{
138 return gpio_request(S3C2410_GPF(2), "cable plugged");
139}
140
141static int rx1950_is_ac_online(void)
142{
143 return !gpio_get_value(S3C2410_GPF(2));
144}
145
146static void power_supply_exit(struct device *dev)
147{
148 gpio_free(S3C2410_GPF(2));
149}
150
151static char *rx1950_supplicants[] = {
152 "main-battery"
153};
154
155static struct pda_power_pdata power_supply_info = {
156 .init = power_supply_init,
157 .is_ac_online = rx1950_is_ac_online,
158 .exit = power_supply_exit,
159 .supplied_to = rx1950_supplicants,
160 .num_supplicants = ARRAY_SIZE(rx1950_supplicants),
161};
162
163static struct resource power_supply_resources[] = {
164 [0] = {
165 .name = "ac",
166 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE |
167 IORESOURCE_IRQ_HIGHEDGE,
168 .start = IRQ_EINT2,
169 .end = IRQ_EINT2,
170 },
171};
172
173static struct platform_device power_supply = {
174 .name = "pda-power",
175 .id = -1,
176 .dev = {
177 .platform_data =
178 &power_supply_info,
179 },
180 .resource = power_supply_resources,
181 .num_resources = ARRAY_SIZE(power_supply_resources),
182};
183
184static const struct s3c_adc_bat_thresh bat_lut_noac[] = {
185 { .volt = 4100, .cur = 156, .level = 100},
186 { .volt = 4050, .cur = 156, .level = 95},
187 { .volt = 4025, .cur = 141, .level = 90},
188 { .volt = 3995, .cur = 144, .level = 85},
189 { .volt = 3957, .cur = 162, .level = 80},
190 { .volt = 3931, .cur = 147, .level = 75},
191 { .volt = 3902, .cur = 147, .level = 70},
192 { .volt = 3863, .cur = 153, .level = 65},
193 { .volt = 3838, .cur = 150, .level = 60},
194 { .volt = 3800, .cur = 153, .level = 55},
195 { .volt = 3765, .cur = 153, .level = 50},
196 { .volt = 3748, .cur = 172, .level = 45},
197 { .volt = 3740, .cur = 153, .level = 40},
198 { .volt = 3714, .cur = 175, .level = 35},
199 { .volt = 3710, .cur = 156, .level = 30},
200 { .volt = 3963, .cur = 156, .level = 25},
201 { .volt = 3672, .cur = 178, .level = 20},
202 { .volt = 3651, .cur = 178, .level = 15},
203 { .volt = 3629, .cur = 178, .level = 10},
204 { .volt = 3612, .cur = 162, .level = 5},
205 { .volt = 3605, .cur = 162, .level = 0},
206};
207
208static const struct s3c_adc_bat_thresh bat_lut_acin[] = {
209 { .volt = 4200, .cur = 0, .level = 100},
210 { .volt = 4190, .cur = 0, .level = 99},
211 { .volt = 4178, .cur = 0, .level = 95},
212 { .volt = 4110, .cur = 0, .level = 70},
213 { .volt = 4076, .cur = 0, .level = 65},
214 { .volt = 4046, .cur = 0, .level = 60},
215 { .volt = 4021, .cur = 0, .level = 55},
216 { .volt = 3999, .cur = 0, .level = 50},
217 { .volt = 3982, .cur = 0, .level = 45},
218 { .volt = 3965, .cur = 0, .level = 40},
219 { .volt = 3957, .cur = 0, .level = 35},
220 { .volt = 3948, .cur = 0, .level = 30},
221 { .volt = 3936, .cur = 0, .level = 25},
222 { .volt = 3927, .cur = 0, .level = 20},
223 { .volt = 3906, .cur = 0, .level = 15},
224 { .volt = 3880, .cur = 0, .level = 10},
225 { .volt = 3829, .cur = 0, .level = 5},
226 { .volt = 3820, .cur = 0, .level = 0},
227};
228
229int rx1950_bat_init(void)
230{
231 int ret;
232
233 ret = gpio_request(S3C2410_GPJ(2), "rx1950-charger-enable-1");
234 if (ret)
235 goto err_gpio1;
236 ret = gpio_request(S3C2410_GPJ(3), "rx1950-charger-enable-2");
237 if (ret)
238 goto err_gpio2;
239
240 return 0;
241
242err_gpio2:
243 gpio_free(S3C2410_GPJ(2));
244err_gpio1:
245 return ret;
246}
247
248void rx1950_bat_exit(void)
249{
250 gpio_free(S3C2410_GPJ(2));
251 gpio_free(S3C2410_GPJ(3));
252}
253
254void rx1950_enable_charger(void)
255{
256 gpio_direction_output(S3C2410_GPJ(2), 1);
257 gpio_direction_output(S3C2410_GPJ(3), 1);
258}
259
260void rx1950_disable_charger(void)
261{
262 gpio_direction_output(S3C2410_GPJ(2), 0);
263 gpio_direction_output(S3C2410_GPJ(3), 0);
264}
265
266static struct gpio_led rx1950_leds_desc[] = {
267 {
268 .name = "Green",
269 .default_trigger = "main-battery-charging-or-full",
270 .gpio = S3C2410_GPA(6),
271 },
272 {
273 .name = "Red",
274 .default_trigger = "main-battery-full",
275 .gpio = S3C2410_GPA(7),
276 },
277 {
278 .name = "Blue",
279 .default_trigger = "rx1950-acx-mem",
280 .gpio = S3C2410_GPA(11),
281 },
282};
283
284static struct gpio_led_platform_data rx1950_leds_pdata = {
285 .num_leds = ARRAY_SIZE(rx1950_leds_desc),
286 .leds = rx1950_leds_desc,
287};
288
289static struct platform_device rx1950_leds = {
290 .name = "leds-gpio",
291 .id = -1,
292 .dev = {
293 .platform_data = &rx1950_leds_pdata,
294 },
295};
296
297static struct s3c_adc_bat_pdata rx1950_bat_cfg = {
298 .init = rx1950_bat_init,
299 .exit = rx1950_bat_exit,
300 .enable_charger = rx1950_enable_charger,
301 .disable_charger = rx1950_disable_charger,
302 .gpio_charge_finished = S3C2410_GPF(3),
303 .lut_noac = bat_lut_noac,
304 .lut_noac_cnt = ARRAY_SIZE(bat_lut_noac),
305 .lut_acin = bat_lut_acin,
306 .lut_acin_cnt = ARRAY_SIZE(bat_lut_acin),
307 .volt_channel = 0,
308 .current_channel = 1,
309 .volt_mult = 4235,
310 .current_mult = 2900,
311 .internal_impedance = 200,
312};
313
314static struct platform_device rx1950_battery = {
315 .name = "s3c-adc-battery",
316 .id = -1,
317 .dev = {
318 .parent = &s3c_device_adc.dev,
319 .platform_data = &rx1950_bat_cfg,
320 },
321};
322
130static struct s3c2410fb_mach_info rx1950_lcd_cfg = { 323static struct s3c2410fb_mach_info rx1950_lcd_cfg = {
131 .displays = &rx1950_display, 324 .displays = &rx1950_display,
132 .num_displays = 1, 325 .num_displays = 1,
@@ -481,11 +674,17 @@ static struct platform_device rx1950_device_gpiokeys = {
481 .dev.platform_data = &rx1950_gpio_keys_data, 674 .dev.platform_data = &rx1950_gpio_keys_data,
482}; 675};
483 676
484static struct s3c2410_platform_i2c rx1950_i2c_data = { 677static struct uda1380_platform_data uda1380_info = {
485 .flags = 0, 678 .gpio_power = S3C2410_GPJ(0),
486 .slave_addr = 0x42, 679 .gpio_reset = S3C2410_GPD(0),
487 .frequency = 400 * 1000, 680 .dac_clk = UDA1380_DAC_CLK_SYSCLK,
488 .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON, 681};
682
683static struct i2c_board_info rx1950_i2c_devices[] = {
684 {
685 I2C_BOARD_INFO("uda1380", 0x1a),
686 .platform_data = &uda1380_info,
687 },
489}; 688};
490 689
491static struct platform_device *rx1950_devices[] __initdata = { 690static struct platform_device *rx1950_devices[] __initdata = {
@@ -493,6 +692,7 @@ static struct platform_device *rx1950_devices[] __initdata = {
493 &s3c_device_wdt, 692 &s3c_device_wdt,
494 &s3c_device_i2c0, 693 &s3c_device_i2c0,
495 &s3c_device_iis, 694 &s3c_device_iis,
695 &s3c_device_pcm,
496 &s3c_device_usbgadget, 696 &s3c_device_usbgadget,
497 &s3c_device_rtc, 697 &s3c_device_rtc,
498 &s3c_device_nand, 698 &s3c_device_nand,
@@ -503,6 +703,9 @@ static struct platform_device *rx1950_devices[] __initdata = {
503 &s3c_device_timer[1], 703 &s3c_device_timer[1],
504 &rx1950_backlight, 704 &rx1950_backlight,
505 &rx1950_device_gpiokeys, 705 &rx1950_device_gpiokeys,
706 &power_supply,
707 &rx1950_battery,
708 &rx1950_leds,
506}; 709};
507 710
508static struct clk *rx1950_clocks[] __initdata = { 711static struct clk *rx1950_clocks[] __initdata = {
@@ -538,7 +741,7 @@ static void __init rx1950_init_machine(void)
538 s3c24xx_udc_set_platdata(&rx1950_udc_cfg); 741 s3c24xx_udc_set_platdata(&rx1950_udc_cfg);
539 s3c24xx_ts_set_platdata(&rx1950_ts_cfg); 742 s3c24xx_ts_set_platdata(&rx1950_ts_cfg);
540 s3c24xx_mci_set_platdata(&rx1950_mmc_cfg); 743 s3c24xx_mci_set_platdata(&rx1950_mmc_cfg);
541 s3c_i2c0_set_platdata(&rx1950_i2c_data); 744 s3c_i2c0_set_platdata(NULL);
542 s3c_nand_set_platdata(&rx1950_nand_info); 745 s3c_nand_set_platdata(&rx1950_nand_info);
543 746
544 /* Turn off suspend on both USB ports, and switch the 747 /* Turn off suspend on both USB ports, and switch the
@@ -569,6 +772,9 @@ static void __init rx1950_init_machine(void)
569 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power")); 772 WARN_ON(gpio_request(S3C2410_GPB(1), "LCD power"));
570 773
571 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); 774 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
775
776 i2c_register_board_info(0, rx1950_i2c_devices,
777 ARRAY_SIZE(rx1950_i2c_devices));
572} 778}
573 779
574/* H1940 and RX3715 need to reserve this for suspend */ 780/* H1940 and RX3715 need to reserve this for suspend */
diff --git a/arch/arm/mach-s3c2440/s3c244x.c b/arch/arm/mach-s3c2440/s3c244x.c
index 5e4a97e76533..90c1707b9c95 100644
--- a/arch/arm/mach-s3c2440/s3c244x.c
+++ b/arch/arm/mach-s3c2440/s3c244x.c
@@ -44,6 +44,7 @@
44#include <plat/cpu.h> 44#include <plat/cpu.h>
45#include <plat/pm.h> 45#include <plat/pm.h>
46#include <plat/pll.h> 46#include <plat/pll.h>
47#include <plat/nand-core.h>
47 48
48static struct map_desc s3c244x_iodesc[] __initdata = { 49static struct map_desc s3c244x_iodesc[] __initdata = {
49 IODESC_ENT(CLKPWR), 50 IODESC_ENT(CLKPWR),
@@ -68,7 +69,7 @@ void __init s3c244x_map_io(void)
68 69
69 s3c_device_sdi.name = "s3c2440-sdi"; 70 s3c_device_sdi.name = "s3c2440-sdi";
70 s3c_device_i2c0.name = "s3c2440-i2c"; 71 s3c_device_i2c0.name = "s3c2440-i2c";
71 s3c_device_nand.name = "s3c2440-nand"; 72 s3c_nand_setname("s3c2440-nand");
72 s3c_device_ts.name = "s3c2440-ts"; 73 s3c_device_ts.name = "s3c2440-ts";
73 s3c_device_usbgadget.name = "s3c2440-usbgadget"; 74 s3c_device_usbgadget.name = "s3c2440-usbgadget";
74} 75}
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index 839b6b2ced74..33d18dd1ebd5 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -36,6 +36,7 @@
36#include <plat/devs.h> 36#include <plat/devs.h>
37#include <plat/cpu.h> 37#include <plat/cpu.h>
38#include <plat/fb-core.h> 38#include <plat/fb-core.h>
39#include <plat/nand-core.h>
39 40
40static struct map_desc s3c2443_iodesc[] __initdata = { 41static struct map_desc s3c2443_iodesc[] __initdata = {
41 IODESC_ENT(WATCHDOG), 42 IODESC_ENT(WATCHDOG),
@@ -62,7 +63,7 @@ int __init s3c2443_init(void)
62 63
63 s3c24xx_reset_hook = s3c2443_hard_reset; 64 s3c24xx_reset_hook = s3c2443_hard_reset;
64 65
65 s3c_device_nand.name = "s3c2412-nand"; 66 s3c_nand_setname("s3c2412-nand");
66 s3c_fb_setname("s3c2443-fb"); 67 s3c_fb_setname("s3c2443-fb");
67 68
68 /* change WDT IRQ number */ 69 /* change WDT IRQ number */
diff --git a/arch/arm/mach-s3c24a0/include/mach/vmalloc.h b/arch/arm/mach-s3c24a0/include/mach/vmalloc.h
index 914656820794..6480b15277f3 100644
--- a/arch/arm/mach-s3c24a0/include/mach/vmalloc.h
+++ b/arch/arm/mach-s3c24a0/include/mach/vmalloc.h
@@ -12,6 +12,6 @@
12#ifndef __ASM_ARCH_VMALLOC_H 12#ifndef __ASM_ARCH_VMALLOC_H
13#define __ASM_ARCH_VMALLOC_H 13#define __ASM_ARCH_VMALLOC_H
14 14
15#define VMALLOC_END (0xe0000000UL) 15#define VMALLOC_END 0xF6000000UL
16 16
17#endif /* __ASM_ARCH_VMALLOC_H */ 17#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s3c64xx/Kconfig b/arch/arm/mach-s3c64xx/Kconfig
index 1e4d78af7d84..579d2f0f4dd0 100644
--- a/arch/arm/mach-s3c64xx/Kconfig
+++ b/arch/arm/mach-s3c64xx/Kconfig
@@ -98,12 +98,33 @@ config MACH_ANW6410
98 help 98 help
99 Machine support for the A&W6410 99 Machine support for the A&W6410
100 100
101config MACH_MINI6410
102 bool "MINI6410"
103 select CPU_S3C6410
104 select S3C_DEV_HSMMC
105 select S3C_DEV_HSMMC1
106 select S3C64XX_SETUP_SDHCI
107 select S3C_DEV_USB_HOST
108 select S3C_DEV_NAND
109 select S3C_DEV_FB
110 select S3C64XX_SETUP_FB_24BPP
111 select SAMSUNG_DEV_ADC
112 select SAMSUNG_DEV_TS
113 help
114 Machine support for the FriendlyARM MINI6410
115
101config MACH_REAL6410 116config MACH_REAL6410
102 bool "REAL6410" 117 bool "REAL6410"
103 select CPU_S3C6410 118 select CPU_S3C6410
104 select S3C_DEV_HSMMC 119 select S3C_DEV_HSMMC
105 select S3C_DEV_HSMMC1 120 select S3C_DEV_HSMMC1
106 select S3C64XX_SETUP_SDHCI 121 select S3C64XX_SETUP_SDHCI
122 select S3C_DEV_FB
123 select S3C64XX_SETUP_FB_24BPP
124 select S3C_DEV_NAND
125 select SAMSUNG_DEV_ADC
126 select SAMSUNG_DEV_TS
127 select S3C_DEV_USB_HOST
107 help 128 help
108 Machine support for the CoreWind REAL6410 129 Machine support for the CoreWind REAL6410
109 130
@@ -122,7 +143,7 @@ config MACH_SMDK6410
122 select S3C_DEV_USB_HSOTG 143 select S3C_DEV_USB_HSOTG
123 select S3C_DEV_WDT 144 select S3C_DEV_WDT
124 select SAMSUNG_DEV_KEYPAD 145 select SAMSUNG_DEV_KEYPAD
125 select HAVE_S3C2410_WATCHDOG 146 select HAVE_S3C2410_WATCHDOG if WATCHDOG
126 select S3C64XX_SETUP_SDHCI 147 select S3C64XX_SETUP_SDHCI
127 select S3C64XX_SETUP_I2C1 148 select S3C64XX_SETUP_I2C1
128 select S3C64XX_SETUP_IDE 149 select S3C64XX_SETUP_IDE
@@ -185,6 +206,7 @@ config SMDK6410_WM1192_EV1
185 select REGULATOR_WM831X 206 select REGULATOR_WM831X
186 select S3C24XX_GPIO_EXTRA64 207 select S3C24XX_GPIO_EXTRA64
187 select MFD_WM831X 208 select MFD_WM831X
209 select MFD_WM831X_I2C
188 help 210 help
189 The Wolfson Microelectronics 1192-EV1 is a WM831x based PMIC 211 The Wolfson Microelectronics 1192-EV1 is a WM831x based PMIC
190 daughtercard for the Samsung SMDK6410 reference platform. 212 daughtercard for the Samsung SMDK6410 reference platform.
diff --git a/arch/arm/mach-s3c64xx/Makefile b/arch/arm/mach-s3c64xx/Makefile
index 90221a2e0c55..4657363f0674 100644
--- a/arch/arm/mach-s3c64xx/Makefile
+++ b/arch/arm/mach-s3c64xx/Makefile
@@ -53,6 +53,7 @@ obj-$(CONFIG_MACH_ANW6410) += mach-anw6410.o
53obj-$(CONFIG_MACH_SMDK6400) += mach-smdk6400.o 53obj-$(CONFIG_MACH_SMDK6400) += mach-smdk6400.o
54obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o 54obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o
55obj-$(CONFIG_MACH_REAL6410) += mach-real6410.o 55obj-$(CONFIG_MACH_REAL6410) += mach-real6410.o
56obj-$(CONFIG_MACH_MINI6410) += mach-mini6410.o
56obj-$(CONFIG_MACH_NCP) += mach-ncp.o 57obj-$(CONFIG_MACH_NCP) += mach-ncp.o
57obj-$(CONFIG_MACH_HMT) += mach-hmt.o 58obj-$(CONFIG_MACH_HMT) += mach-hmt.o
58obj-$(CONFIG_MACH_SMARTQ) += mach-smartq.o 59obj-$(CONFIG_MACH_SMARTQ) += mach-smartq.o
diff --git a/arch/arm/mach-s3c64xx/dev-audio.c b/arch/arm/mach-s3c64xx/dev-audio.c
index 3838335f125b..76426a32c013 100644
--- a/arch/arm/mach-s3c64xx/dev-audio.c
+++ b/arch/arm/mach-s3c64xx/dev-audio.c
@@ -22,27 +22,16 @@
22#include <plat/audio.h> 22#include <plat/audio.h>
23#include <plat/gpio-cfg.h> 23#include <plat/gpio-cfg.h>
24 24
25#include <mach/gpio-bank-c.h>
26#include <mach/gpio-bank-d.h>
27#include <mach/gpio-bank-e.h>
28#include <mach/gpio-bank-h.h>
29
30static int s3c64xx_i2sv3_cfg_gpio(struct platform_device *pdev) 25static int s3c64xx_i2sv3_cfg_gpio(struct platform_device *pdev)
31{ 26{
27 unsigned int base;
28
32 switch (pdev->id) { 29 switch (pdev->id) {
33 case 0: 30 case 0:
34 s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_I2S0_CLK); 31 base = S3C64XX_GPD(0);
35 s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_I2S0_CDCLK);
36 s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_I2S0_LRCLK);
37 s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_I2S0_DI);
38 s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_I2S0_D0);
39 break; 32 break;
40 case 1: 33 case 1:
41 s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_I2S1_CLK); 34 base = S3C64XX_GPE(0);
42 s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_I2S1_CDCLK);
43 s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_I2S1_LRCLK);
44 s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_I2S1_DI);
45 s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_I2S1_D0);
46 break; 35 break;
47 default: 36 default:
48 printk(KERN_DEBUG "Invalid I2S Controller number: %d\n", 37 printk(KERN_DEBUG "Invalid I2S Controller number: %d\n",
@@ -50,18 +39,17 @@ static int s3c64xx_i2sv3_cfg_gpio(struct platform_device *pdev)
50 return -EINVAL; 39 return -EINVAL;
51 } 40 }
52 41
42 s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(3));
43
53 return 0; 44 return 0;
54} 45}
55 46
56static int s3c64xx_i2sv4_cfg_gpio(struct platform_device *pdev) 47static int s3c64xx_i2sv4_cfg_gpio(struct platform_device *pdev)
57{ 48{
58 s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C64XX_GPC4_I2S_V40_DO0); 49 s3c_gpio_cfgpin(S3C64XX_GPC(4), S3C_GPIO_SFN(5));
59 s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C64XX_GPC5_I2S_V40_DO1); 50 s3c_gpio_cfgpin(S3C64XX_GPC(5), S3C_GPIO_SFN(5));
60 s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C64XX_GPC7_I2S_V40_DO2); 51 s3c_gpio_cfgpin(S3C64XX_GPC(7), S3C_GPIO_SFN(5));
61 s3c_gpio_cfgpin(S3C64XX_GPH(6), S3C64XX_GPH6_I2S_V40_BCLK); 52 s3c_gpio_cfgpin_range(S3C64XX_GPH(6), 4, S3C_GPIO_SFN(5));
62 s3c_gpio_cfgpin(S3C64XX_GPH(7), S3C64XX_GPH7_I2S_V40_CDCLK);
63 s3c_gpio_cfgpin(S3C64XX_GPH(8), S3C64XX_GPH8_I2S_V40_LRCLK);
64 s3c_gpio_cfgpin(S3C64XX_GPH(9), S3C64XX_GPH9_I2S_V40_DI);
65 53
66 return 0; 54 return 0;
67} 55}
@@ -170,20 +158,14 @@ EXPORT_SYMBOL(s3c64xx_device_iisv4);
170 158
171static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev) 159static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
172{ 160{
161 unsigned int base;
162
173 switch (pdev->id) { 163 switch (pdev->id) {
174 case 0: 164 case 0:
175 s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_PCM0_SCLK); 165 base = S3C64XX_GPD(0);
176 s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_PCM0_EXTCLK);
177 s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_PCM0_FSYNC);
178 s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_PCM0_SIN);
179 s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_PCM0_SOUT);
180 break; 166 break;
181 case 1: 167 case 1:
182 s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_PCM1_SCLK); 168 base = S3C64XX_GPE(0);
183 s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_PCM1_EXTCLK);
184 s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_PCM1_FSYNC);
185 s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_PCM1_SIN);
186 s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_PCM1_SOUT);
187 break; 169 break;
188 default: 170 default:
189 printk(KERN_DEBUG "Invalid PCM Controller number: %d\n", 171 printk(KERN_DEBUG "Invalid PCM Controller number: %d\n",
@@ -191,6 +173,7 @@ static int s3c64xx_pcm_cfg_gpio(struct platform_device *pdev)
191 return -EINVAL; 173 return -EINVAL;
192 } 174 }
193 175
176 s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(2));
194 return 0; 177 return 0;
195} 178}
196 179
@@ -264,24 +247,12 @@ EXPORT_SYMBOL(s3c64xx_device_pcm1);
264 247
265static int s3c64xx_ac97_cfg_gpd(struct platform_device *pdev) 248static int s3c64xx_ac97_cfg_gpd(struct platform_device *pdev)
266{ 249{
267 s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_AC97_BITCLK); 250 return s3c_gpio_cfgpin_range(S3C64XX_GPD(0), 5, S3C_GPIO_SFN(4));
268 s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_AC97_nRESET);
269 s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_AC97_SYNC);
270 s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_AC97_SDI);
271 s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_AC97_SDO);
272
273 return 0;
274} 251}
275 252
276static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev) 253static int s3c64xx_ac97_cfg_gpe(struct platform_device *pdev)
277{ 254{
278 s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_AC97_BITCLK); 255 return s3c_gpio_cfgpin_range(S3C64XX_GPE(0), 5, S3C_GPIO_SFN(4));
279 s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_AC97_nRESET);
280 s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_AC97_SYNC);
281 s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_AC97_SDI);
282 s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_AC97_SDO);
283
284 return 0;
285} 256}
286 257
287static struct resource s3c64xx_ac97_resource[] = { 258static struct resource s3c64xx_ac97_resource[] = {
diff --git a/arch/arm/mach-s3c64xx/gpiolib.c b/arch/arm/mach-s3c64xx/gpiolib.c
index 300dee4a667b..fd99a82e82c4 100644
--- a/arch/arm/mach-s3c64xx/gpiolib.c
+++ b/arch/arm/mach-s3c64xx/gpiolib.c
@@ -195,11 +195,6 @@ static struct s3c_gpio_cfg gpio_2bit_cfg_eint11 = {
195 .get_pull = s3c_gpio_getpull_updown, 195 .get_pull = s3c_gpio_getpull_updown,
196}; 196};
197 197
198int s3c64xx_gpio2int_gpn(struct gpio_chip *chip, unsigned pin)
199{
200 return IRQ_EINT(0) + pin;
201}
202
203static struct s3c_gpio_chip gpio_2bit[] = { 198static struct s3c_gpio_chip gpio_2bit[] = {
204 { 199 {
205 .base = S3C64XX_GPF_BASE, 200 .base = S3C64XX_GPF_BASE,
@@ -227,12 +222,13 @@ static struct s3c_gpio_chip gpio_2bit[] = {
227 }, 222 },
228 }, { 223 }, {
229 .base = S3C64XX_GPN_BASE, 224 .base = S3C64XX_GPN_BASE,
225 .irq_base = IRQ_EINT(0),
230 .config = &gpio_2bit_cfg_eint10, 226 .config = &gpio_2bit_cfg_eint10,
231 .chip = { 227 .chip = {
232 .base = S3C64XX_GPN(0), 228 .base = S3C64XX_GPN(0),
233 .ngpio = S3C64XX_GPIO_N_NR, 229 .ngpio = S3C64XX_GPIO_N_NR,
234 .label = "GPN", 230 .label = "GPN",
235 .to_irq = s3c64xx_gpio2int_gpn, 231 .to_irq = samsung_gpiolib_to_irq,
236 }, 232 },
237 }, { 233 }, {
238 .base = S3C64XX_GPO_BASE, 234 .base = S3C64XX_GPO_BASE,
diff --git a/arch/arm/mach-s3c64xx/include/mach/vmalloc.h b/arch/arm/mach-s3c64xx/include/mach/vmalloc.h
index bc0e91389864..23f75e556a30 100644
--- a/arch/arm/mach-s3c64xx/include/mach/vmalloc.h
+++ b/arch/arm/mach-s3c64xx/include/mach/vmalloc.h
@@ -15,6 +15,6 @@
15#ifndef __ASM_ARCH_VMALLOC_H 15#ifndef __ASM_ARCH_VMALLOC_H
16#define __ASM_ARCH_VMALLOC_H 16#define __ASM_ARCH_VMALLOC_H
17 17
18#define VMALLOC_END 0xE0000000UL 18#define VMALLOC_END 0xF6000000UL
19 19
20#endif /* __ASM_ARCH_VMALLOC_H */ 20#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s3c64xx/mach-mini6410.c b/arch/arm/mach-s3c64xx/mach-mini6410.c
new file mode 100644
index 000000000000..249c62956471
--- /dev/null
+++ b/arch/arm/mach-s3c64xx/mach-mini6410.c
@@ -0,0 +1,357 @@
1/* linux/arch/arm/mach-s3c64xx/mach-mini6410.c
2 *
3 * Copyright 2010 Darius Augulis <augulis.darius@gmail.com>
4 * Copyright 2008 Openmoko, Inc.
5 * Copyright 2008 Simtec Electronics
6 * Ben Dooks <ben@simtec.co.uk>
7 * http://armlinux.simtec.co.uk/
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
15#include <linux/init.h>
16#include <linux/interrupt.h>
17#include <linux/fb.h>
18#include <linux/gpio.h>
19#include <linux/kernel.h>
20#include <linux/list.h>
21#include <linux/dm9000.h>
22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h>
24#include <linux/serial_core.h>
25#include <linux/types.h>
26
27#include <asm/mach-types.h>
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30
31#include <mach/map.h>
32#include <mach/regs-fb.h>
33#include <mach/regs-gpio.h>
34#include <mach/regs-modem.h>
35#include <mach/regs-srom.h>
36#include <mach/s3c6410.h>
37
38#include <plat/adc.h>
39#include <plat/cpu.h>
40#include <plat/devs.h>
41#include <plat/fb.h>
42#include <plat/nand.h>
43#include <plat/regs-serial.h>
44#include <plat/ts.h>
45
46#include <video/platform_lcd.h>
47
48#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
49#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
50#define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE)
51
52static struct s3c2410_uartcfg mini6410_uartcfgs[] __initdata = {
53 [0] = {
54 .hwport = 0,
55 .flags = 0,
56 .ucon = UCON,
57 .ulcon = ULCON,
58 .ufcon = UFCON,
59 },
60 [1] = {
61 .hwport = 1,
62 .flags = 0,
63 .ucon = UCON,
64 .ulcon = ULCON,
65 .ufcon = UFCON,
66 },
67 [2] = {
68 .hwport = 2,
69 .flags = 0,
70 .ucon = UCON,
71 .ulcon = ULCON,
72 .ufcon = UFCON,
73 },
74 [3] = {
75 .hwport = 3,
76 .flags = 0,
77 .ucon = UCON,
78 .ulcon = ULCON,
79 .ufcon = UFCON,
80 },
81};
82
83/* DM9000AEP 10/100 ethernet controller */
84
85static struct resource mini6410_dm9k_resource[] = {
86 [0] = {
87 .start = S3C64XX_PA_XM0CSN1,
88 .end = S3C64XX_PA_XM0CSN1 + 1,
89 .flags = IORESOURCE_MEM
90 },
91 [1] = {
92 .start = S3C64XX_PA_XM0CSN1 + 4,
93 .end = S3C64XX_PA_XM0CSN1 + 5,
94 .flags = IORESOURCE_MEM
95 },
96 [2] = {
97 .start = S3C_EINT(7),
98 .end = S3C_EINT(7),
99 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL
100 }
101};
102
103static struct dm9000_plat_data mini6410_dm9k_pdata = {
104 .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
105};
106
107static struct platform_device mini6410_device_eth = {
108 .name = "dm9000",
109 .id = -1,
110 .num_resources = ARRAY_SIZE(mini6410_dm9k_resource),
111 .resource = mini6410_dm9k_resource,
112 .dev = {
113 .platform_data = &mini6410_dm9k_pdata,
114 },
115};
116
117static struct mtd_partition mini6410_nand_part[] = {
118 [0] = {
119 .name = "uboot",
120 .size = SZ_1M,
121 .offset = 0,
122 },
123 [1] = {
124 .name = "kernel",
125 .size = SZ_2M,
126 .offset = SZ_1M,
127 },
128 [2] = {
129 .name = "rootfs",
130 .size = MTDPART_SIZ_FULL,
131 .offset = SZ_1M + SZ_2M,
132 },
133};
134
135static struct s3c2410_nand_set mini6410_nand_sets[] = {
136 [0] = {
137 .name = "nand",
138 .nr_chips = 1,
139 .nr_partitions = ARRAY_SIZE(mini6410_nand_part),
140 .partitions = mini6410_nand_part,
141 },
142};
143
144static struct s3c2410_platform_nand mini6410_nand_info = {
145 .tacls = 25,
146 .twrph0 = 55,
147 .twrph1 = 40,
148 .nr_sets = ARRAY_SIZE(mini6410_nand_sets),
149 .sets = mini6410_nand_sets,
150};
151
152static struct s3c_fb_pd_win mini6410_fb_win[] = {
153 {
154 .win_mode = { /* 4.3" 480x272 */
155 .left_margin = 3,
156 .right_margin = 2,
157 .upper_margin = 1,
158 .lower_margin = 1,
159 .hsync_len = 40,
160 .vsync_len = 1,
161 .xres = 480,
162 .yres = 272,
163 },
164 .max_bpp = 32,
165 .default_bpp = 16,
166 }, {
167 .win_mode = { /* 7.0" 800x480 */
168 .left_margin = 8,
169 .right_margin = 13,
170 .upper_margin = 7,
171 .lower_margin = 5,
172 .hsync_len = 3,
173 .vsync_len = 1,
174 .xres = 800,
175 .yres = 480,
176 },
177 .max_bpp = 32,
178 .default_bpp = 16,
179 },
180};
181
182static struct s3c_fb_platdata mini6410_lcd_pdata __initdata = {
183 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
184 .win[0] = &mini6410_fb_win[0],
185 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
186 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
187};
188
189static void mini6410_lcd_power_set(struct plat_lcd_data *pd,
190 unsigned int power)
191{
192 if (power)
193 gpio_direction_output(S3C64XX_GPE(0), 1);
194 else
195 gpio_direction_output(S3C64XX_GPE(0), 0);
196}
197
198static struct plat_lcd_data mini6410_lcd_power_data = {
199 .set_power = mini6410_lcd_power_set,
200};
201
202static struct platform_device mini6410_lcd_powerdev = {
203 .name = "platform-lcd",
204 .dev.parent = &s3c_device_fb.dev,
205 .dev.platform_data = &mini6410_lcd_power_data,
206};
207
208static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
209 .delay = 10000,
210 .presc = 49,
211 .oversampling_shift = 2,
212};
213
214static struct platform_device *mini6410_devices[] __initdata = {
215 &mini6410_device_eth,
216 &s3c_device_hsmmc0,
217 &s3c_device_hsmmc1,
218 &s3c_device_ohci,
219 &s3c_device_nand,
220 &s3c_device_fb,
221 &mini6410_lcd_powerdev,
222 &s3c_device_adc,
223 &s3c_device_ts,
224};
225
226static void __init mini6410_map_io(void)
227{
228 u32 tmp;
229
230 s3c64xx_init_io(NULL, 0);
231 s3c24xx_init_clocks(12000000);
232 s3c24xx_init_uarts(mini6410_uartcfgs, ARRAY_SIZE(mini6410_uartcfgs));
233
234 /* set the LCD type */
235 tmp = __raw_readl(S3C64XX_SPCON);
236 tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
237 tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
238 __raw_writel(tmp, S3C64XX_SPCON);
239
240 /* remove the LCD bypass */
241 tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
242 tmp &= ~MIFPCON_LCD_BYPASS;
243 __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
244}
245
246/*
247 * mini6410_features string
248 *
249 * 0-9 LCD configuration
250 *
251 */
252static char mini6410_features_str[12] __initdata = "0";
253
254static int __init mini6410_features_setup(char *str)
255{
256 if (str)
257 strlcpy(mini6410_features_str, str,
258 sizeof(mini6410_features_str));
259 return 1;
260}
261
262__setup("mini6410=", mini6410_features_setup);
263
264#define FEATURE_SCREEN (1 << 0)
265
266struct mini6410_features_t {
267 int done;
268 int lcd_index;
269};
270
271static void mini6410_parse_features(
272 struct mini6410_features_t *features,
273 const char *features_str)
274{
275 const char *fp = features_str;
276
277 features->done = 0;
278 features->lcd_index = 0;
279
280 while (*fp) {
281 char f = *fp++;
282
283 switch (f) {
284 case '0'...'9': /* tft screen */
285 if (features->done & FEATURE_SCREEN) {
286 printk(KERN_INFO "MINI6410: '%c' ignored, "
287 "screen type already set\n", f);
288 } else {
289 int li = f - '0';
290 if (li >= ARRAY_SIZE(mini6410_fb_win))
291 printk(KERN_INFO "MINI6410: '%c' out "
292 "of range LCD mode\n", f);
293 else {
294 features->lcd_index = li;
295 }
296 }
297 features->done |= FEATURE_SCREEN;
298 break;
299 }
300 }
301}
302
303static void __init mini6410_machine_init(void)
304{
305 u32 cs1;
306 struct mini6410_features_t features = { 0 };
307
308 printk(KERN_INFO "MINI6410: Option string mini6410=%s\n",
309 mini6410_features_str);
310
311 /* Parse the feature string */
312 mini6410_parse_features(&features, mini6410_features_str);
313
314 mini6410_lcd_pdata.win[0] = &mini6410_fb_win[features.lcd_index];
315
316 printk(KERN_INFO "MINI6410: selected LCD display is %dx%d\n",
317 mini6410_lcd_pdata.win[0]->win_mode.xres,
318 mini6410_lcd_pdata.win[0]->win_mode.yres);
319
320 s3c_nand_set_platdata(&mini6410_nand_info);
321 s3c_fb_set_platdata(&mini6410_lcd_pdata);
322 s3c24xx_ts_set_platdata(&s3c_ts_platform);
323
324 /* configure nCS1 width to 16 bits */
325
326 cs1 = __raw_readl(S3C64XX_SROM_BW) &
327 ~(S3C64XX_SROM_BW__CS_MASK << S3C64XX_SROM_BW__NCS1__SHIFT);
328 cs1 |= ((1 << S3C64XX_SROM_BW__DATAWIDTH__SHIFT) |
329 (1 << S3C64XX_SROM_BW__WAITENABLE__SHIFT) |
330 (1 << S3C64XX_SROM_BW__BYTEENABLE__SHIFT)) <<
331 S3C64XX_SROM_BW__NCS1__SHIFT;
332 __raw_writel(cs1, S3C64XX_SROM_BW);
333
334 /* set timing for nCS1 suitable for ethernet chip */
335
336 __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) |
337 (6 << S3C64XX_SROM_BCX__TACP__SHIFT) |
338 (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) |
339 (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) |
340 (13 << S3C64XX_SROM_BCX__TACC__SHIFT) |
341 (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
342 (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
343
344 gpio_request(S3C64XX_GPF(15), "LCD power");
345 gpio_request(S3C64XX_GPE(0), "LCD power");
346
347 platform_add_devices(mini6410_devices, ARRAY_SIZE(mini6410_devices));
348}
349
350MACHINE_START(MINI6410, "MINI6410")
351 /* Maintainer: Darius Augulis <augulis.darius@gmail.com> */
352 .boot_params = S3C64XX_PA_SDRAM + 0x100,
353 .init_irq = s3c6410_init_irq,
354 .map_io = mini6410_map_io,
355 .init_machine = mini6410_machine_init,
356 .timer = &s3c24xx_timer,
357MACHINE_END
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c
index 4b4475da8ec6..f9ef9b5c5f5a 100644
--- a/arch/arm/mach-s3c64xx/mach-real6410.c
+++ b/arch/arm/mach-s3c64xx/mach-real6410.c
@@ -12,23 +12,39 @@
12 * 12 *
13*/ 13*/
14 14
15#include <linux/kernel.h> 15#include <linux/init.h>
16#include <linux/types.h>
17#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/fb.h>
18#include <linux/gpio.h>
19#include <linux/kernel.h>
18#include <linux/list.h> 20#include <linux/list.h>
19#include <linux/init.h>
20#include <linux/dm9000.h> 21#include <linux/dm9000.h>
21#include <linux/serial_core.h> 22#include <linux/mtd/mtd.h>
23#include <linux/mtd/partitions.h>
22#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/serial_core.h>
26#include <linux/types.h>
27
23#include <asm/mach-types.h> 28#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 30#include <asm/mach/map.h>
31
26#include <mach/map.h> 32#include <mach/map.h>
27#include <mach/s3c6410.h> 33#include <mach/regs-fb.h>
34#include <mach/regs-gpio.h>
35#include <mach/regs-modem.h>
28#include <mach/regs-srom.h> 36#include <mach/regs-srom.h>
37#include <mach/s3c6410.h>
38
39#include <plat/adc.h>
29#include <plat/cpu.h> 40#include <plat/cpu.h>
30#include <plat/devs.h> 41#include <plat/devs.h>
42#include <plat/fb.h>
43#include <plat/nand.h>
31#include <plat/regs-serial.h> 44#include <plat/regs-serial.h>
45#include <plat/ts.h>
46
47#include <video/platform_lcd.h>
32 48
33#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) 49#define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK)
34#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) 50#define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB)
@@ -99,22 +115,192 @@ static struct platform_device real6410_device_eth = {
99 }, 115 },
100}; 116};
101 117
118static struct s3c_fb_pd_win real6410_fb_win[] = {
119 {
120 .win_mode = { /* 4.3" 480x272 */
121 .left_margin = 3,
122 .right_margin = 2,
123 .upper_margin = 1,
124 .lower_margin = 1,
125 .hsync_len = 40,
126 .vsync_len = 1,
127 .xres = 480,
128 .yres = 272,
129 },
130 .max_bpp = 32,
131 .default_bpp = 16,
132 }, {
133 .win_mode = { /* 7.0" 800x480 */
134 .left_margin = 8,
135 .right_margin = 13,
136 .upper_margin = 7,
137 .lower_margin = 5,
138 .hsync_len = 3,
139 .vsync_len = 1,
140 .xres = 800,
141 .yres = 480,
142 },
143 .max_bpp = 32,
144 .default_bpp = 16,
145 },
146};
147
148static struct s3c_fb_platdata real6410_lcd_pdata __initdata = {
149 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
150 .win[0] = &real6410_fb_win[0],
151 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
152 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
153};
154
155static struct mtd_partition real6410_nand_part[] = {
156 [0] = {
157 .name = "uboot",
158 .size = SZ_1M,
159 .offset = 0,
160 },
161 [1] = {
162 .name = "kernel",
163 .size = SZ_2M,
164 .offset = SZ_1M,
165 },
166 [2] = {
167 .name = "rootfs",
168 .size = MTDPART_SIZ_FULL,
169 .offset = SZ_1M + SZ_2M,
170 },
171};
172
173static struct s3c2410_nand_set real6410_nand_sets[] = {
174 [0] = {
175 .name = "nand",
176 .nr_chips = 1,
177 .nr_partitions = ARRAY_SIZE(real6410_nand_part),
178 .partitions = real6410_nand_part,
179 },
180};
181
182static struct s3c2410_platform_nand real6410_nand_info = {
183 .tacls = 25,
184 .twrph0 = 55,
185 .twrph1 = 40,
186 .nr_sets = ARRAY_SIZE(real6410_nand_sets),
187 .sets = real6410_nand_sets,
188};
189
102static struct platform_device *real6410_devices[] __initdata = { 190static struct platform_device *real6410_devices[] __initdata = {
103 &real6410_device_eth, 191 &real6410_device_eth,
104 &s3c_device_hsmmc0, 192 &s3c_device_hsmmc0,
105 &s3c_device_hsmmc1, 193 &s3c_device_hsmmc1,
194 &s3c_device_fb,
195 &s3c_device_nand,
196 &s3c_device_adc,
197 &s3c_device_ts,
198 &s3c_device_ohci,
199};
200
201static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
202 .delay = 10000,
203 .presc = 49,
204 .oversampling_shift = 2,
106}; 205};
107 206
108static void __init real6410_map_io(void) 207static void __init real6410_map_io(void)
109{ 208{
209 u32 tmp;
210
110 s3c64xx_init_io(NULL, 0); 211 s3c64xx_init_io(NULL, 0);
111 s3c24xx_init_clocks(12000000); 212 s3c24xx_init_clocks(12000000);
112 s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs)); 213 s3c24xx_init_uarts(real6410_uartcfgs, ARRAY_SIZE(real6410_uartcfgs));
214
215 /* set the LCD type */
216 tmp = __raw_readl(S3C64XX_SPCON);
217 tmp &= ~S3C64XX_SPCON_LCD_SEL_MASK;
218 tmp |= S3C64XX_SPCON_LCD_SEL_RGB;
219 __raw_writel(tmp, S3C64XX_SPCON);
220
221 /* remove the LCD bypass */
222 tmp = __raw_readl(S3C64XX_MODEM_MIFPCON);
223 tmp &= ~MIFPCON_LCD_BYPASS;
224 __raw_writel(tmp, S3C64XX_MODEM_MIFPCON);
225}
226
227/*
228 * real6410_features string
229 *
230 * 0-9 LCD configuration
231 *
232 */
233static char real6410_features_str[12] __initdata = "0";
234
235static int __init real6410_features_setup(char *str)
236{
237 if (str)
238 strlcpy(real6410_features_str, str,
239 sizeof(real6410_features_str));
240 return 1;
241}
242
243__setup("real6410=", real6410_features_setup);
244
245#define FEATURE_SCREEN (1 << 0)
246
247struct real6410_features_t {
248 int done;
249 int lcd_index;
250};
251
252static void real6410_parse_features(
253 struct real6410_features_t *features,
254 const char *features_str)
255{
256 const char *fp = features_str;
257
258 features->done = 0;
259 features->lcd_index = 0;
260
261 while (*fp) {
262 char f = *fp++;
263
264 switch (f) {
265 case '0'...'9': /* tft screen */
266 if (features->done & FEATURE_SCREEN) {
267 printk(KERN_INFO "REAL6410: '%c' ignored, "
268 "screen type already set\n", f);
269 } else {
270 int li = f - '0';
271 if (li >= ARRAY_SIZE(real6410_fb_win))
272 printk(KERN_INFO "REAL6410: '%c' out "
273 "of range LCD mode\n", f);
274 else {
275 features->lcd_index = li;
276 }
277 }
278 features->done |= FEATURE_SCREEN;
279 break;
280 }
281 }
113} 282}
114 283
115static void __init real6410_machine_init(void) 284static void __init real6410_machine_init(void)
116{ 285{
117 u32 cs1; 286 u32 cs1;
287 struct real6410_features_t features = { 0 };
288
289 printk(KERN_INFO "REAL6410: Option string real6410=%s\n",
290 real6410_features_str);
291
292 /* Parse the feature string */
293 real6410_parse_features(&features, real6410_features_str);
294
295 real6410_lcd_pdata.win[0] = &real6410_fb_win[features.lcd_index];
296
297 printk(KERN_INFO "REAL6410: selected LCD display is %dx%d\n",
298 real6410_lcd_pdata.win[0]->win_mode.xres,
299 real6410_lcd_pdata.win[0]->win_mode.yres);
300
301 s3c_fb_set_platdata(&real6410_lcd_pdata);
302 s3c_nand_set_platdata(&real6410_nand_info);
303 s3c24xx_ts_set_platdata(&s3c_ts_platform);
118 304
119 /* configure nCS1 width to 16 bits */ 305 /* configure nCS1 width to 16 bits */
120 306
@@ -136,6 +322,8 @@ static void __init real6410_machine_init(void)
136 (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | 322 (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) |
137 (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); 323 (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1);
138 324
325 gpio_request(S3C64XX_GPF(15), "LCD power");
326
139 platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices)); 327 platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices));
140} 328}
141 329
diff --git a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
index 000736877df2..8f3091182f9c 100644
--- a/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
+++ b/arch/arm/mach-s3c64xx/setup-fb-24bpp.c
@@ -23,15 +23,6 @@
23 23
24extern void s3c64xx_fb_gpio_setup_24bpp(void) 24extern void s3c64xx_fb_gpio_setup_24bpp(void)
25{ 25{
26 unsigned int gpio; 26 s3c_gpio_cfgrange_nopull(S3C64XX_GPI(0), 16, S3C_GPIO_SFN(2));
27 27 s3c_gpio_cfgrange_nopull(S3C64XX_GPJ(0), 12, S3C_GPIO_SFN(2));
28 for (gpio = S3C64XX_GPI(0); gpio <= S3C64XX_GPI(15); gpio++) {
29 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
30 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
31 }
32
33 for (gpio = S3C64XX_GPJ(0); gpio <= S3C64XX_GPJ(11); gpio++) {
34 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
35 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
36 }
37} 28}
diff --git a/arch/arm/mach-s3c64xx/setup-ide.c b/arch/arm/mach-s3c64xx/setup-ide.c
index c12c315f33bc..41b425602d88 100644
--- a/arch/arm/mach-s3c64xx/setup-ide.c
+++ b/arch/arm/mach-s3c64xx/setup-ide.c
@@ -17,11 +17,11 @@
17#include <mach/map.h> 17#include <mach/map.h>
18#include <mach/regs-clock.h> 18#include <mach/regs-clock.h>
19#include <plat/gpio-cfg.h> 19#include <plat/gpio-cfg.h>
20#include <plat/ata.h>
20 21
21void s3c64xx_ide_setup_gpio(void) 22void s3c64xx_ide_setup_gpio(void)
22{ 23{
23 u32 reg; 24 u32 reg;
24 u32 gpio = 0;
25 25
26 reg = readl(S3C_MEM_SYS_CFG) & (~0x3f); 26 reg = readl(S3C_MEM_SYS_CFG) & (~0x3f);
27 27
@@ -32,15 +32,12 @@ void s3c64xx_ide_setup_gpio(void)
32 s3c_gpio_cfgpin(S3C64XX_GPB(4), S3C_GPIO_SFN(4)); 32 s3c_gpio_cfgpin(S3C64XX_GPB(4), S3C_GPIO_SFN(4));
33 33
34 /* Set XhiDATA[15:0] pins as CF Data[15:0] */ 34 /* Set XhiDATA[15:0] pins as CF Data[15:0] */
35 for (gpio = S3C64XX_GPK(0); gpio <= S3C64XX_GPK(15); gpio++) 35 s3c_gpio_cfgpin_range(S3C64XX_GPK(0), 16, S3C_GPIO_SFN(5));
36 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(5));
37 36
38 /* Set XhiADDR[2:0] pins as CF ADDR[2:0] */ 37 /* Set XhiADDR[2:0] pins as CF ADDR[2:0] */
39 for (gpio = S3C64XX_GPL(0); gpio <= S3C64XX_GPL(2); gpio++) 38 s3c_gpio_cfgpin_range(S3C64XX_GPL(0), 3, S3C_GPIO_SFN(6));
40 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(6));
41 39
42 /* Set Xhi ctrl pins as CF ctrl pins(IORDY, IOWR, IORD, CE[0:1]) */ 40 /* Set Xhi ctrl pins as CF ctrl pins(IORDY, IOWR, IORD, CE[0:1]) */
43 s3c_gpio_cfgpin(S3C64XX_GPM(5), S3C_GPIO_SFN(1)); 41 s3c_gpio_cfgpin(S3C64XX_GPM(5), S3C_GPIO_SFN(1));
44 for (gpio = S3C64XX_GPM(0); gpio <= S3C64XX_GPM(4); gpio++) 42 s3c_gpio_cfgpin_range(S3C64XX_GPM(0), 5, S3C_GPIO_SFN(6));
45 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(6));
46} 43}
diff --git a/arch/arm/mach-s3c64xx/setup-keypad.c b/arch/arm/mach-s3c64xx/setup-keypad.c
index abc34e4e1a93..f8ed0d22db70 100644
--- a/arch/arm/mach-s3c64xx/setup-keypad.c
+++ b/arch/arm/mach-s3c64xx/setup-keypad.c
@@ -12,23 +12,13 @@
12 12
13#include <linux/gpio.h> 13#include <linux/gpio.h>
14#include <plat/gpio-cfg.h> 14#include <plat/gpio-cfg.h>
15#include <plat/keypad.h>
15 16
16void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) 17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
17{ 18{
18 unsigned int gpio;
19 unsigned int end;
20
21 /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */ 19 /* Set all the necessary GPK pins to special-function 3: KP_ROW[x] */
22 end = S3C64XX_GPK(8 + rows); 20 s3c_gpio_cfgrange_nopull(S3C64XX_GPK(8), 8 + rows, S3C_GPIO_SFN(3));
23 for (gpio = S3C64XX_GPK(8); gpio < end; gpio++) {
24 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
25 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
26 }
27 21
28 /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */ 22 /* Set all the necessary GPL pins to special-function 3: KP_COL[x] */
29 end = S3C64XX_GPL(0 + cols); 23 s3c_gpio_cfgrange_nopull(S3C64XX_GPL(0), cols, S3C_GPIO_SFN(3));
30 for (gpio = S3C64XX_GPL(0); gpio < end; gpio++) {
31 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
32 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
33 }
34} 24}
diff --git a/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c b/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c
index 322359591374..6eac071afae2 100644
--- a/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s3c64xx/setup-sdhci-gpio.c
@@ -24,16 +24,9 @@
24void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 24void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
25{ 25{
26 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 26 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
27 unsigned int gpio;
28 unsigned int end;
29 27
30 end = S3C64XX_GPG(2 + width); 28 /* Set all the necessary GPG pins to special-function 2 */
31 29 s3c_gpio_cfgrange_nopull(S3C64XX_GPG(0), 2 + width, S3C_GPIO_SFN(2));
32 /* Set all the necessary GPG pins to special-function 0 */
33 for (gpio = S3C64XX_GPG(0); gpio < end; gpio++) {
34 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
35 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
36 }
37 30
38 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { 31 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
39 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); 32 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
@@ -44,16 +37,9 @@ void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
44void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) 37void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
45{ 38{
46 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 39 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
47 unsigned int gpio;
48 unsigned int end;
49 40
50 end = S3C64XX_GPH(2 + width); 41 /* Set all the necessary GPH pins to special-function 2 */
51 42 s3c_gpio_cfgrange_nopull(S3C64XX_GPH(0), 2 + width, S3C_GPIO_SFN(2));
52 /* Set all the necessary GPG pins to special-function 0 */
53 for (gpio = S3C64XX_GPH(0); gpio < end; gpio++) {
54 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
55 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
56 }
57 43
58 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { 44 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
59 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP); 45 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
@@ -63,20 +49,9 @@ void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
63 49
64void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) 50void s3c64xx_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
65{ 51{
66 unsigned int gpio; 52 /* Set all the necessary GPH pins to special-function 3 */
67 unsigned int end; 53 s3c_gpio_cfgrange_nopull(S3C64XX_GPH(6), width, S3C_GPIO_SFN(3));
68 54
69 end = S3C64XX_GPH(6 + width); 55 /* Set all the necessary GPC pins to special-function 3 */
70 56 s3c_gpio_cfgrange_nopull(S3C64XX_GPC(4), 2, S3C_GPIO_SFN(3));
71 /* Set all the necessary GPH pins to special-function 1 */
72 for (gpio = S3C64XX_GPH(6); gpio < end; gpio++) {
73 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
74 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
75 }
76
77 /* Set all the necessary GPC pins to special-function 1 */
78 for (gpio = S3C64XX_GPC(4); gpio < S3C64XX_GPC(6); gpio++) {
79 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
80 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
81 }
82} 57}
diff --git a/arch/arm/mach-s5p6442/Kconfig b/arch/arm/mach-s5p6442/Kconfig
index 0fda0a5df968..33569e4007c4 100644
--- a/arch/arm/mach-s5p6442/Kconfig
+++ b/arch/arm/mach-s5p6442/Kconfig
@@ -11,7 +11,6 @@ if ARCH_S5P6442
11 11
12config CPU_S5P6442 12config CPU_S5P6442
13 bool 13 bool
14 select PLAT_S5P
15 select S3C_PL330_DMA 14 select S3C_PL330_DMA
16 help 15 help
17 Enable S5P6442 CPU support 16 Enable S5P6442 CPU support
diff --git a/arch/arm/mach-s5p6442/clock.c b/arch/arm/mach-s5p6442/clock.c
index dcd20f17212a..16d6e7e61b50 100644
--- a/arch/arm/mach-s5p6442/clock.c
+++ b/arch/arm/mach-s5p6442/clock.c
@@ -192,6 +192,11 @@ static struct clk clk_pclkd1 = {
192 .parent = &clk_hclkd1, 192 .parent = &clk_hclkd1,
193}; 193};
194 194
195int s5p6442_clk_ip0_ctrl(struct clk *clk, int enable)
196{
197 return s5p_gatectrl(S5P_CLKGATE_IP0, clk, enable);
198}
199
195int s5p6442_clk_ip3_ctrl(struct clk *clk, int enable) 200int s5p6442_clk_ip3_ctrl(struct clk *clk, int enable)
196{ 201{
197 return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable); 202 return s5p_gatectrl(S5P_CLKGATE_IP3, clk, enable);
@@ -335,6 +340,16 @@ void __init_or_cpufreq s5p6442_setup_clocks(void)
335 clk_pclkd1.rate = pclkd1; 340 clk_pclkd1.rate = pclkd1;
336} 341}
337 342
343static struct clk init_clocks_disable[] = {
344 {
345 .name = "pdma",
346 .id = -1,
347 .parent = &clk_pclkd1,
348 .enable = s5p6442_clk_ip0_ctrl,
349 .ctrlbit = (1 << 3),
350 },
351};
352
338static struct clk init_clocks[] = { 353static struct clk init_clocks[] = {
339 { 354 {
340 .name = "systimer", 355 .name = "systimer",
@@ -393,10 +408,23 @@ static struct clk *clks[] __initdata = {
393 408
394void __init s5p6442_register_clocks(void) 409void __init s5p6442_register_clocks(void)
395{ 410{
411 struct clk *clkptr;
412 int i, ret;
413
396 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks)); 414 s3c24xx_register_clocks(clks, ARRAY_SIZE(clks));
397 415
398 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs)); 416 s3c_register_clksrc(clksrcs, ARRAY_SIZE(clksrcs));
399 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks)); 417 s3c_register_clocks(init_clocks, ARRAY_SIZE(init_clocks));
400 418
419 clkptr = init_clocks_disable;
420 for (i = 0; i < ARRAY_SIZE(init_clocks_disable); i++, clkptr++) {
421 ret = s3c24xx_register_clock(clkptr);
422 if (ret < 0) {
423 printk(KERN_ERR "Fail to register clock %s (%d)\n",
424 clkptr->name, ret);
425 } else
426 (clkptr->enable)(clkptr, 0);
427 }
428
401 s3c_pwmclk_init(); 429 s3c_pwmclk_init();
402} 430}
diff --git a/arch/arm/mach-s5p6442/dev-audio.c b/arch/arm/mach-s5p6442/dev-audio.c
index 7a4e34720b7b..3462197ff352 100644
--- a/arch/arm/mach-s5p6442/dev-audio.c
+++ b/arch/arm/mach-s5p6442/dev-audio.c
@@ -21,22 +21,16 @@
21 21
22static int s5p6442_cfg_i2s(struct platform_device *pdev) 22static int s5p6442_cfg_i2s(struct platform_device *pdev)
23{ 23{
24 unsigned int base;
25
24 /* configure GPIO for i2s port */ 26 /* configure GPIO for i2s port */
25 switch (pdev->id) { 27 switch (pdev->id) {
26 case 1: 28 case 1:
27 s3c_gpio_cfgpin(S5P6442_GPC1(0), S3C_GPIO_SFN(2)); 29 base = S5P6442_GPC1(0);
28 s3c_gpio_cfgpin(S5P6442_GPC1(1), S3C_GPIO_SFN(2));
29 s3c_gpio_cfgpin(S5P6442_GPC1(2), S3C_GPIO_SFN(2));
30 s3c_gpio_cfgpin(S5P6442_GPC1(3), S3C_GPIO_SFN(2));
31 s3c_gpio_cfgpin(S5P6442_GPC1(4), S3C_GPIO_SFN(2));
32 break; 30 break;
33 31
34 case -1: 32 case -1:
35 s3c_gpio_cfgpin(S5P6442_GPC0(0), S3C_GPIO_SFN(2)); 33 base = S5P6442_GPC0(0);
36 s3c_gpio_cfgpin(S5P6442_GPC0(1), S3C_GPIO_SFN(2));
37 s3c_gpio_cfgpin(S5P6442_GPC0(2), S3C_GPIO_SFN(2));
38 s3c_gpio_cfgpin(S5P6442_GPC0(3), S3C_GPIO_SFN(2));
39 s3c_gpio_cfgpin(S5P6442_GPC0(4), S3C_GPIO_SFN(2));
40 break; 34 break;
41 35
42 default: 36 default:
@@ -44,6 +38,7 @@ static int s5p6442_cfg_i2s(struct platform_device *pdev)
44 return -EINVAL; 38 return -EINVAL;
45 } 39 }
46 40
41 s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(2));
47 return 0; 42 return 0;
48} 43}
49 44
@@ -111,21 +106,15 @@ struct platform_device s5p6442_device_iis1 = {
111 106
112static int s5p6442_pcm_cfg_gpio(struct platform_device *pdev) 107static int s5p6442_pcm_cfg_gpio(struct platform_device *pdev)
113{ 108{
109 unsigned int base;
110
114 switch (pdev->id) { 111 switch (pdev->id) {
115 case 0: 112 case 0:
116 s3c_gpio_cfgpin(S5P6442_GPC0(0), S3C_GPIO_SFN(3)); 113 base = S5P6442_GPC0(0);
117 s3c_gpio_cfgpin(S5P6442_GPC0(1), S3C_GPIO_SFN(3));
118 s3c_gpio_cfgpin(S5P6442_GPC0(2), S3C_GPIO_SFN(3));
119 s3c_gpio_cfgpin(S5P6442_GPC0(3), S3C_GPIO_SFN(3));
120 s3c_gpio_cfgpin(S5P6442_GPC0(4), S3C_GPIO_SFN(3));
121 break; 114 break;
122 115
123 case 1: 116 case 1:
124 s3c_gpio_cfgpin(S5P6442_GPC1(0), S3C_GPIO_SFN(3)); 117 base = S5P6442_GPC1(0);
125 s3c_gpio_cfgpin(S5P6442_GPC1(1), S3C_GPIO_SFN(3));
126 s3c_gpio_cfgpin(S5P6442_GPC1(2), S3C_GPIO_SFN(3));
127 s3c_gpio_cfgpin(S5P6442_GPC1(3), S3C_GPIO_SFN(3));
128 s3c_gpio_cfgpin(S5P6442_GPC1(4), S3C_GPIO_SFN(3));
129 break; 118 break;
130 119
131 default: 120 default:
@@ -133,6 +122,7 @@ static int s5p6442_pcm_cfg_gpio(struct platform_device *pdev)
133 return -EINVAL; 122 return -EINVAL;
134 } 123 }
135 124
125 s3c_gpio_cfgpin_range(base, 5, S3C_GPIO_SFN(3));
136 return 0; 126 return 0;
137} 127}
138 128
diff --git a/arch/arm/mach-s5p6442/dev-spi.c b/arch/arm/mach-s5p6442/dev-spi.c
index e894651a88bd..cce8c2470709 100644
--- a/arch/arm/mach-s5p6442/dev-spi.c
+++ b/arch/arm/mach-s5p6442/dev-spi.c
@@ -38,11 +38,9 @@ static int s5p6442_spi_cfg_gpio(struct platform_device *pdev)
38 switch (pdev->id) { 38 switch (pdev->id) {
39 case 0: 39 case 0:
40 s3c_gpio_cfgpin(S5P6442_GPB(0), S3C_GPIO_SFN(2)); 40 s3c_gpio_cfgpin(S5P6442_GPB(0), S3C_GPIO_SFN(2));
41 s3c_gpio_cfgpin(S5P6442_GPB(2), S3C_GPIO_SFN(2));
42 s3c_gpio_cfgpin(S5P6442_GPB(3), S3C_GPIO_SFN(2));
43 s3c_gpio_setpull(S5P6442_GPB(0), S3C_GPIO_PULL_UP); 41 s3c_gpio_setpull(S5P6442_GPB(0), S3C_GPIO_PULL_UP);
44 s3c_gpio_setpull(S5P6442_GPB(2), S3C_GPIO_PULL_UP); 42 s3c_gpio_cfgall_range(S5P6442_GPB(2), 2,
45 s3c_gpio_setpull(S5P6442_GPB(3), S3C_GPIO_PULL_UP); 43 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
46 break; 44 break;
47 45
48 default: 46 default:
diff --git a/arch/arm/mach-s5p6442/dma.c b/arch/arm/mach-s5p6442/dma.c
index ad4f8704b93d..7dfb13654f8a 100644
--- a/arch/arm/mach-s5p6442/dma.c
+++ b/arch/arm/mach-s5p6442/dma.c
@@ -82,7 +82,7 @@ static struct s3c_pl330_platdata s5p6442_pdma_pdata = {
82 82
83static struct platform_device s5p6442_device_pdma = { 83static struct platform_device s5p6442_device_pdma = {
84 .name = "s3c-pl330", 84 .name = "s3c-pl330",
85 .id = 1, 85 .id = -1,
86 .num_resources = ARRAY_SIZE(s5p6442_pdma_resource), 86 .num_resources = ARRAY_SIZE(s5p6442_pdma_resource),
87 .resource = s5p6442_pdma_resource, 87 .resource = s5p6442_pdma_resource,
88 .dev = { 88 .dev = {
diff --git a/arch/arm/mach-s5p6442/include/mach/regs-clock.h b/arch/arm/mach-s5p6442/include/mach/regs-clock.h
index d8360b5d4ece..00828a336991 100644
--- a/arch/arm/mach-s5p6442/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5p6442/include/mach/regs-clock.h
@@ -46,6 +46,7 @@
46#define S5P_CLK_DIV5 S5P_CLKREG(0x314) 46#define S5P_CLK_DIV5 S5P_CLKREG(0x314)
47#define S5P_CLK_DIV6 S5P_CLKREG(0x318) 47#define S5P_CLK_DIV6 S5P_CLKREG(0x318)
48 48
49#define S5P_CLKGATE_IP0 S5P_CLKREG(0x460)
49#define S5P_CLKGATE_IP3 S5P_CLKREG(0x46C) 50#define S5P_CLKGATE_IP3 S5P_CLKREG(0x46C)
50 51
51/* CLK_OUT */ 52/* CLK_OUT */
diff --git a/arch/arm/mach-s5p6442/include/mach/vmalloc.h b/arch/arm/mach-s5p6442/include/mach/vmalloc.h
index f5c83f02c18e..4aa55e55ac47 100644
--- a/arch/arm/mach-s5p6442/include/mach/vmalloc.h
+++ b/arch/arm/mach-s5p6442/include/mach/vmalloc.h
@@ -12,6 +12,6 @@
12#ifndef __ASM_ARCH_VMALLOC_H 12#ifndef __ASM_ARCH_VMALLOC_H
13#define __ASM_ARCH_VMALLOC_H 13#define __ASM_ARCH_VMALLOC_H
14 14
15#define VMALLOC_END 0xE0000000UL 15#define VMALLOC_END 0xF6000000UL
16 16
17#endif /* __ASM_ARCH_VMALLOC_H */ 17#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s5p64x0/Kconfig b/arch/arm/mach-s5p64x0/Kconfig
index fbcae9352022..164d2783d381 100644
--- a/arch/arm/mach-s5p64x0/Kconfig
+++ b/arch/arm/mach-s5p64x0/Kconfig
@@ -9,14 +9,12 @@ if ARCH_S5P64X0
9 9
10config CPU_S5P6440 10config CPU_S5P6440
11 bool 11 bool
12 select PLAT_S5P
13 select S3C_PL330_DMA 12 select S3C_PL330_DMA
14 help 13 help
15 Enable S5P6440 CPU support 14 Enable S5P6440 CPU support
16 15
17config CPU_S5P6450 16config CPU_S5P6450
18 bool 17 bool
19 select PLAT_S5P
20 select S3C_PL330_DMA 18 select S3C_PL330_DMA
21 help 19 help
22 Enable S5P6450 CPU support 20 Enable S5P6450 CPU support
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6440.c b/arch/arm/mach-s5p64x0/clock-s5p6440.c
index f93dcd8b4d6a..e4883dc1c8d7 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6440.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6440.c
@@ -79,13 +79,16 @@ static int s5p6440_epll_set_rate(struct clk *clk, unsigned long rate)
79 __raw_writel(epll_con, S5P64X0_EPLL_CON); 79 __raw_writel(epll_con, S5P64X0_EPLL_CON);
80 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K); 80 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
81 81
82 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
83 clk->rate, rate);
84
82 clk->rate = rate; 85 clk->rate = rate;
83 86
84 return 0; 87 return 0;
85} 88}
86 89
87static struct clk_ops s5p6440_epll_ops = { 90static struct clk_ops s5p6440_epll_ops = {
88 .get_rate = s5p64x0_epll_get_rate, 91 .get_rate = s5p_epll_get_rate,
89 .set_rate = s5p6440_epll_set_rate, 92 .set_rate = s5p6440_epll_set_rate,
90}; 93};
91 94
@@ -150,6 +153,12 @@ static struct clk init_clocks_disable[] = {
150 .enable = s5p64x0_hclk0_ctrl, 153 .enable = s5p64x0_hclk0_ctrl,
151 .ctrlbit = (1 << 8), 154 .ctrlbit = (1 << 8),
152 }, { 155 }, {
156 .name = "pdma",
157 .id = -1,
158 .parent = &clk_hclk_low.clk,
159 .enable = s5p64x0_hclk0_ctrl,
160 .ctrlbit = (1 << 12),
161 }, {
153 .name = "hsmmc", 162 .name = "hsmmc",
154 .id = 0, 163 .id = 0,
155 .parent = &clk_hclk_low.clk, 164 .parent = &clk_hclk_low.clk,
@@ -331,12 +340,6 @@ static struct clk init_clocks[] = {
331 .enable = s5p64x0_hclk0_ctrl, 340 .enable = s5p64x0_hclk0_ctrl,
332 .ctrlbit = (1 << 21), 341 .ctrlbit = (1 << 21),
333 }, { 342 }, {
334 .name = "dma",
335 .id = -1,
336 .parent = &clk_hclk_low.clk,
337 .enable = s5p64x0_hclk0_ctrl,
338 .ctrlbit = (1 << 12),
339 }, {
340 .name = "uart", 343 .name = "uart",
341 .id = 0, 344 .id = 0,
342 .parent = &clk_pclk_low.clk, 345 .parent = &clk_pclk_low.clk,
@@ -548,7 +551,7 @@ void __init_or_cpufreq s5p6440_setup_clocks(void)
548 551
549 /* Set S5P6440 functions for clk_fout_epll */ 552 /* Set S5P6440 functions for clk_fout_epll */
550 553
551 clk_fout_epll.enable = s5p64x0_epll_enable; 554 clk_fout_epll.enable = s5p_epll_enable;
552 clk_fout_epll.ops = &s5p6440_epll_ops; 555 clk_fout_epll.ops = &s5p6440_epll_ops;
553 556
554 clk_48m.enable = s5p64x0_clk48m_ctrl; 557 clk_48m.enable = s5p64x0_clk48m_ctrl;
diff --git a/arch/arm/mach-s5p64x0/clock-s5p6450.c b/arch/arm/mach-s5p64x0/clock-s5p6450.c
index f9afb05b217c..7dbf3c968f53 100644
--- a/arch/arm/mach-s5p64x0/clock-s5p6450.c
+++ b/arch/arm/mach-s5p64x0/clock-s5p6450.c
@@ -80,13 +80,16 @@ static int s5p6450_epll_set_rate(struct clk *clk, unsigned long rate)
80 __raw_writel(epll_con, S5P64X0_EPLL_CON); 80 __raw_writel(epll_con, S5P64X0_EPLL_CON);
81 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K); 81 __raw_writel(epll_con_k, S5P64X0_EPLL_CON_K);
82 82
83 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
84 clk->rate, rate);
85
83 clk->rate = rate; 86 clk->rate = rate;
84 87
85 return 0; 88 return 0;
86} 89}
87 90
88static struct clk_ops s5p6450_epll_ops = { 91static struct clk_ops s5p6450_epll_ops = {
89 .get_rate = s5p64x0_epll_get_rate, 92 .get_rate = s5p_epll_get_rate,
90 .set_rate = s5p6450_epll_set_rate, 93 .set_rate = s5p6450_epll_set_rate,
91}; 94};
92 95
@@ -186,6 +189,12 @@ static struct clk init_clocks_disable[] = {
186 .enable = s5p64x0_hclk0_ctrl, 189 .enable = s5p64x0_hclk0_ctrl,
187 .ctrlbit = (1 << 3), 190 .ctrlbit = (1 << 3),
188 }, { 191 }, {
192 .name = "pdma",
193 .id = -1,
194 .parent = &clk_hclk_low.clk,
195 .enable = s5p64x0_hclk0_ctrl,
196 .ctrlbit = (1 << 12),
197 }, {
189 .name = "hsmmc", 198 .name = "hsmmc",
190 .id = 0, 199 .id = 0,
191 .parent = &clk_hclk_low.clk, 200 .parent = &clk_hclk_low.clk,
@@ -283,12 +292,6 @@ static struct clk init_clocks[] = {
283 .enable = s5p64x0_hclk0_ctrl, 292 .enable = s5p64x0_hclk0_ctrl,
284 .ctrlbit = (1 << 21), 293 .ctrlbit = (1 << 21),
285 }, { 294 }, {
286 .name = "dma",
287 .id = -1,
288 .parent = &clk_hclk_low.clk,
289 .enable = s5p64x0_hclk0_ctrl,
290 .ctrlbit = (1 << 12),
291 }, {
292 .name = "uart", 295 .name = "uart",
293 .id = 0, 296 .id = 0,
294 .parent = &clk_pclk_low.clk, 297 .parent = &clk_pclk_low.clk,
@@ -581,7 +584,7 @@ void __init_or_cpufreq s5p6450_setup_clocks(void)
581 584
582 /* Set S5P6450 functions for clk_fout_epll */ 585 /* Set S5P6450 functions for clk_fout_epll */
583 586
584 clk_fout_epll.enable = s5p64x0_epll_enable; 587 clk_fout_epll.enable = s5p_epll_enable;
585 clk_fout_epll.ops = &s5p6450_epll_ops; 588 clk_fout_epll.ops = &s5p6450_epll_ops;
586 589
587 clk_48m.enable = s5p64x0_clk48m_ctrl; 590 clk_48m.enable = s5p64x0_clk48m_ctrl;
diff --git a/arch/arm/mach-s5p64x0/clock.c b/arch/arm/mach-s5p64x0/clock.c
index 523ba8039ac2..b52c6e2f37a6 100644
--- a/arch/arm/mach-s5p64x0/clock.c
+++ b/arch/arm/mach-s5p64x0/clock.c
@@ -73,24 +73,6 @@ static const u32 clock_table[][3] = {
73 {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P64X0_CLKDIV0_HCLK_SHIFT)}, 73 {L2 * 1000, (3 << ARM_DIV_RATIO_SHIFT), (0 << S5P64X0_CLKDIV0_HCLK_SHIFT)},
74}; 74};
75 75
76int s5p64x0_epll_enable(struct clk *clk, int enable)
77{
78 unsigned int ctrlbit = clk->ctrlbit;
79 unsigned int epll_con = __raw_readl(S5P64X0_EPLL_CON) & ~ctrlbit;
80
81 if (enable)
82 __raw_writel(epll_con | ctrlbit, S5P64X0_EPLL_CON);
83 else
84 __raw_writel(epll_con, S5P64X0_EPLL_CON);
85
86 return 0;
87}
88
89unsigned long s5p64x0_epll_get_rate(struct clk *clk)
90{
91 return clk->rate;
92}
93
94unsigned long s5p64x0_armclk_get_rate(struct clk *clk) 76unsigned long s5p64x0_armclk_get_rate(struct clk *clk)
95{ 77{
96 unsigned long rate = clk_get_rate(clk->parent); 78 unsigned long rate = clk_get_rate(clk->parent);
diff --git a/arch/arm/mach-s5p64x0/dev-audio.c b/arch/arm/mach-s5p64x0/dev-audio.c
index fa097bd68ca4..396bacc0a39a 100644
--- a/arch/arm/mach-s5p64x0/dev-audio.c
+++ b/arch/arm/mach-s5p64x0/dev-audio.c
@@ -24,13 +24,8 @@ static int s5p6440_cfg_i2s(struct platform_device *pdev)
24 /* configure GPIO for i2s port */ 24 /* configure GPIO for i2s port */
25 switch (pdev->id) { 25 switch (pdev->id) {
26 case -1: 26 case -1:
27 s3c_gpio_cfgpin(S5P6440_GPR(4), S3C_GPIO_SFN(5)); 27 s3c_gpio_cfgpin_range(S5P6440_GPR(4), 5, S3C_GPIO_SFN(5));
28 s3c_gpio_cfgpin(S5P6440_GPR(5), S3C_GPIO_SFN(5)); 28 s3c_gpio_cfgpin_range(S5P6440_GPR(13), 2, S3C_GPIO_SFN(5));
29 s3c_gpio_cfgpin(S5P6440_GPR(6), S3C_GPIO_SFN(5));
30 s3c_gpio_cfgpin(S5P6440_GPR(7), S3C_GPIO_SFN(5));
31 s3c_gpio_cfgpin(S5P6440_GPR(8), S3C_GPIO_SFN(5));
32 s3c_gpio_cfgpin(S5P6440_GPR(13), S3C_GPIO_SFN(5));
33 s3c_gpio_cfgpin(S5P6440_GPR(14), S3C_GPIO_SFN(5));
34 break; 29 break;
35 30
36 default: 31 default:
@@ -47,13 +42,9 @@ static int s5p6450_cfg_i2s(struct platform_device *pdev)
47 switch (pdev->id) { 42 switch (pdev->id) {
48 case -1: 43 case -1:
49 s3c_gpio_cfgpin(S5P6450_GPB(4), S3C_GPIO_SFN(5)); 44 s3c_gpio_cfgpin(S5P6450_GPB(4), S3C_GPIO_SFN(5));
50 s3c_gpio_cfgpin(S5P6450_GPR(4), S3C_GPIO_SFN(5)); 45 s3c_gpio_cfgpin_range(S5P6450_GPR(4), 5, S3C_GPIO_SFN(5));
51 s3c_gpio_cfgpin(S5P6450_GPR(5), S3C_GPIO_SFN(5)); 46 s3c_gpio_cfgpin_range(S5P6450_GPR(13), 2, S3C_GPIO_SFN(5));
52 s3c_gpio_cfgpin(S5P6450_GPR(6), S3C_GPIO_SFN(5)); 47
53 s3c_gpio_cfgpin(S5P6450_GPR(7), S3C_GPIO_SFN(5));
54 s3c_gpio_cfgpin(S5P6450_GPR(8), S3C_GPIO_SFN(5));
55 s3c_gpio_cfgpin(S5P6450_GPR(13), S3C_GPIO_SFN(5));
56 s3c_gpio_cfgpin(S5P6450_GPR(14), S3C_GPIO_SFN(5));
57 break; 48 break;
58 49
59 default: 50 default:
@@ -116,11 +107,8 @@ static int s5p6440_pcm_cfg_gpio(struct platform_device *pdev)
116{ 107{
117 switch (pdev->id) { 108 switch (pdev->id) {
118 case 0: 109 case 0:
119 s3c_gpio_cfgpin(S5P6440_GPR(7), S3C_GPIO_SFN(2)); 110 s3c_gpio_cfgpin_range(S5P6440_GPR(6), 3, S3C_GPIO_SFN(2));
120 s3c_gpio_cfgpin(S5P6440_GPR(13), S3C_GPIO_SFN(2)); 111 s3c_gpio_cfgpin_range(S5P6440_GPR(13), 2, S3C_GPIO_SFN(2));
121 s3c_gpio_cfgpin(S5P6440_GPR(14), S3C_GPIO_SFN(2));
122 s3c_gpio_cfgpin(S5P6440_GPR(8), S3C_GPIO_SFN(2));
123 s3c_gpio_cfgpin(S5P6440_GPR(6), S3C_GPIO_SFN(2));
124 break; 112 break;
125 113
126 default: 114 default:
diff --git a/arch/arm/mach-s5p64x0/dev-spi.c b/arch/arm/mach-s5p64x0/dev-spi.c
index 5b69ec4c8af3..e78ee18c76e3 100644
--- a/arch/arm/mach-s5p64x0/dev-spi.c
+++ b/arch/arm/mach-s5p64x0/dev-spi.c
@@ -39,23 +39,15 @@ static char *s5p64x0_spi_src_clks[] = {
39 */ 39 */
40static int s5p6440_spi_cfg_gpio(struct platform_device *pdev) 40static int s5p6440_spi_cfg_gpio(struct platform_device *pdev)
41{ 41{
42 unsigned int base;
43
42 switch (pdev->id) { 44 switch (pdev->id) {
43 case 0: 45 case 0:
44 s3c_gpio_cfgpin(S5P6440_GPC(0), S3C_GPIO_SFN(2)); 46 base = S5P6440_GPC(0);
45 s3c_gpio_cfgpin(S5P6440_GPC(1), S3C_GPIO_SFN(2));
46 s3c_gpio_cfgpin(S5P6440_GPC(2), S3C_GPIO_SFN(2));
47 s3c_gpio_setpull(S5P6440_GPC(0), S3C_GPIO_PULL_UP);
48 s3c_gpio_setpull(S5P6440_GPC(1), S3C_GPIO_PULL_UP);
49 s3c_gpio_setpull(S5P6440_GPC(2), S3C_GPIO_PULL_UP);
50 break; 47 break;
51 48
52 case 1: 49 case 1:
53 s3c_gpio_cfgpin(S5P6440_GPC(4), S3C_GPIO_SFN(2)); 50 base = S5P6440_GPC(4);
54 s3c_gpio_cfgpin(S5P6440_GPC(5), S3C_GPIO_SFN(2));
55 s3c_gpio_cfgpin(S5P6440_GPC(6), S3C_GPIO_SFN(2));
56 s3c_gpio_setpull(S5P6440_GPC(4), S3C_GPIO_PULL_UP);
57 s3c_gpio_setpull(S5P6440_GPC(5), S3C_GPIO_PULL_UP);
58 s3c_gpio_setpull(S5P6440_GPC(6), S3C_GPIO_PULL_UP);
59 break; 51 break;
60 52
61 default: 53 default:
@@ -63,28 +55,23 @@ static int s5p6440_spi_cfg_gpio(struct platform_device *pdev)
63 return -EINVAL; 55 return -EINVAL;
64 } 56 }
65 57
58 s3c_gpio_cfgall_range(base, 3,
59 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
60
66 return 0; 61 return 0;
67} 62}
68 63
69static int s5p6450_spi_cfg_gpio(struct platform_device *pdev) 64static int s5p6450_spi_cfg_gpio(struct platform_device *pdev)
70{ 65{
66 unsigned int base;
67
71 switch (pdev->id) { 68 switch (pdev->id) {
72 case 0: 69 case 0:
73 s3c_gpio_cfgpin(S5P6450_GPC(0), S3C_GPIO_SFN(2)); 70 base = S5P6450_GPC(0);
74 s3c_gpio_cfgpin(S5P6450_GPC(1), S3C_GPIO_SFN(2));
75 s3c_gpio_cfgpin(S5P6450_GPC(2), S3C_GPIO_SFN(2));
76 s3c_gpio_setpull(S5P6450_GPC(0), S3C_GPIO_PULL_UP);
77 s3c_gpio_setpull(S5P6450_GPC(1), S3C_GPIO_PULL_UP);
78 s3c_gpio_setpull(S5P6450_GPC(2), S3C_GPIO_PULL_UP);
79 break; 71 break;
80 72
81 case 1: 73 case 1:
82 s3c_gpio_cfgpin(S5P6450_GPC(4), S3C_GPIO_SFN(2)); 74 base = S5P6450_GPC(4);
83 s3c_gpio_cfgpin(S5P6450_GPC(5), S3C_GPIO_SFN(2));
84 s3c_gpio_cfgpin(S5P6450_GPC(6), S3C_GPIO_SFN(2));
85 s3c_gpio_setpull(S5P6450_GPC(4), S3C_GPIO_PULL_UP);
86 s3c_gpio_setpull(S5P6450_GPC(5), S3C_GPIO_PULL_UP);
87 s3c_gpio_setpull(S5P6450_GPC(6), S3C_GPIO_PULL_UP);
88 break; 75 break;
89 76
90 default: 77 default:
@@ -92,6 +79,9 @@ static int s5p6450_spi_cfg_gpio(struct platform_device *pdev)
92 return -EINVAL; 79 return -EINVAL;
93 } 80 }
94 81
82 s3c_gpio_cfgall_range(base, 3,
83 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
84
95 return 0; 85 return 0;
96} 86}
97 87
diff --git a/arch/arm/mach-s5p64x0/dma.c b/arch/arm/mach-s5p64x0/dma.c
index 29a8c2410049..d7ad944b3475 100644
--- a/arch/arm/mach-s5p64x0/dma.c
+++ b/arch/arm/mach-s5p64x0/dma.c
@@ -122,7 +122,7 @@ static struct s3c_pl330_platdata s5p6450_pdma_pdata = {
122 122
123static struct platform_device s5p64x0_device_pdma = { 123static struct platform_device s5p64x0_device_pdma = {
124 .name = "s3c-pl330", 124 .name = "s3c-pl330",
125 .id = 0, 125 .id = -1,
126 .num_resources = ARRAY_SIZE(s5p64x0_pdma_resource), 126 .num_resources = ARRAY_SIZE(s5p64x0_pdma_resource),
127 .resource = s5p64x0_pdma_resource, 127 .resource = s5p64x0_pdma_resource,
128 .dev = { 128 .dev = {
diff --git a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h b/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
index 58e1bc813804..a133f22fa155 100644
--- a/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5p64x0/include/mach/regs-clock.h
@@ -60,4 +60,6 @@
60#define ARM_DIV_RATIO_SHIFT 0 60#define ARM_DIV_RATIO_SHIFT 0
61#define ARM_DIV_MASK (0xF << ARM_DIV_RATIO_SHIFT) 61#define ARM_DIV_MASK (0xF << ARM_DIV_RATIO_SHIFT)
62 62
63#define S5P_EPLL_CON S5P64X0_EPLL_CON
64
63#endif /* __ASM_ARCH_REGS_CLOCK_H */ 65#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s5p64x0/include/mach/vmalloc.h b/arch/arm/mach-s5p64x0/include/mach/vmalloc.h
index 97a9df38f1cf..38dcc71a03cc 100644
--- a/arch/arm/mach-s5p64x0/include/mach/vmalloc.h
+++ b/arch/arm/mach-s5p64x0/include/mach/vmalloc.h
@@ -15,6 +15,6 @@
15#ifndef __ASM_ARCH_VMALLOC_H 15#ifndef __ASM_ARCH_VMALLOC_H
16#define __ASM_ARCH_VMALLOC_H 16#define __ASM_ARCH_VMALLOC_H
17 17
18#define VMALLOC_END 0xE0000000UL 18#define VMALLOC_END 0xF6000000UL
19 19
20#endif /* __ASM_ARCH_VMALLOC_H */ 20#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s5p64x0/setup-i2c0.c b/arch/arm/mach-s5p64x0/setup-i2c0.c
index dc4cc65a5019..46b463917c54 100644
--- a/arch/arm/mach-s5p64x0/setup-i2c0.c
+++ b/arch/arm/mach-s5p64x0/setup-i2c0.c
@@ -25,18 +25,14 @@ struct platform_device; /* don't need the contents */
25 25
26void s5p6440_i2c0_cfg_gpio(struct platform_device *dev) 26void s5p6440_i2c0_cfg_gpio(struct platform_device *dev)
27{ 27{
28 s3c_gpio_cfgpin(S5P6440_GPB(5), S3C_GPIO_SFN(2)); 28 s3c_gpio_cfgall_range(S5P6440_GPB(5), 2,
29 s3c_gpio_setpull(S5P6440_GPB(5), S3C_GPIO_PULL_UP); 29 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
30 s3c_gpio_cfgpin(S5P6440_GPB(6), S3C_GPIO_SFN(2));
31 s3c_gpio_setpull(S5P6440_GPB(6), S3C_GPIO_PULL_UP);
32} 30}
33 31
34void s5p6450_i2c0_cfg_gpio(struct platform_device *dev) 32void s5p6450_i2c0_cfg_gpio(struct platform_device *dev)
35{ 33{
36 s3c_gpio_cfgpin(S5P6450_GPB(5), S3C_GPIO_SFN(2)); 34 s3c_gpio_cfgall_range(S5P6450_GPB(5), 2,
37 s3c_gpio_setpull(S5P6450_GPB(5), S3C_GPIO_PULL_UP); 35 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
38 s3c_gpio_cfgpin(S5P6450_GPB(6), S3C_GPIO_SFN(2));
39 s3c_gpio_setpull(S5P6450_GPB(6), S3C_GPIO_PULL_UP);
40} 36}
41 37
42void s3c_i2c0_cfg_gpio(struct platform_device *dev) { } 38void s3c_i2c0_cfg_gpio(struct platform_device *dev) { }
diff --git a/arch/arm/mach-s5p64x0/setup-i2c1.c b/arch/arm/mach-s5p64x0/setup-i2c1.c
index 2edd7912f8e4..6ad3b986021c 100644
--- a/arch/arm/mach-s5p64x0/setup-i2c1.c
+++ b/arch/arm/mach-s5p64x0/setup-i2c1.c
@@ -25,18 +25,14 @@ struct platform_device; /* don't need the contents */
25 25
26void s5p6440_i2c1_cfg_gpio(struct platform_device *dev) 26void s5p6440_i2c1_cfg_gpio(struct platform_device *dev)
27{ 27{
28 s3c_gpio_cfgpin(S5P6440_GPR(9), S3C_GPIO_SFN(6)); 28 s3c_gpio_cfgall_range(S5P6440_GPR(9), 2,
29 s3c_gpio_setpull(S5P6440_GPR(9), S3C_GPIO_PULL_UP); 29 S3C_GPIO_SFN(6), S3C_GPIO_PULL_UP);
30 s3c_gpio_cfgpin(S5P6440_GPR(10), S3C_GPIO_SFN(6));
31 s3c_gpio_setpull(S5P6440_GPR(10), S3C_GPIO_PULL_UP);
32} 30}
33 31
34void s5p6450_i2c1_cfg_gpio(struct platform_device *dev) 32void s5p6450_i2c1_cfg_gpio(struct platform_device *dev)
35{ 33{
36 s3c_gpio_cfgpin(S5P6450_GPR(9), S3C_GPIO_SFN(6)); 34 s3c_gpio_cfgall_range(S5P6450_GPR(9), 2,
37 s3c_gpio_setpull(S5P6450_GPR(9), S3C_GPIO_PULL_UP); 35 S3C_GPIO_SFN(6), S3C_GPIO_PULL_UP);
38 s3c_gpio_cfgpin(S5P6450_GPR(10), S3C_GPIO_SFN(6));
39 s3c_gpio_setpull(S5P6450_GPR(10), S3C_GPIO_PULL_UP);
40} 36}
41 37
42void s3c_i2c1_cfg_gpio(struct platform_device *dev) { } 38void s3c_i2c1_cfg_gpio(struct platform_device *dev) { }
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig
index 77ae4bfb74ba..b8fbf2fcba6f 100644
--- a/arch/arm/mach-s5pc100/Kconfig
+++ b/arch/arm/mach-s5pc100/Kconfig
@@ -9,7 +9,6 @@ if ARCH_S5PC100
9 9
10config CPU_S5PC100 10config CPU_S5PC100
11 bool 11 bool
12 select PLAT_S5P
13 select S5P_EXT_INT 12 select S5P_EXT_INT
14 select S3C_PL330_DMA 13 select S3C_PL330_DMA
15 help 14 help
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile
index a021ed1fb4b6..eecab57d2e5d 100644
--- a/arch/arm/mach-s5pc100/Makefile
+++ b/arch/arm/mach-s5pc100/Makefile
@@ -11,7 +11,7 @@ obj- :=
11 11
12# Core support for S5PC100 system 12# Core support for S5PC100 system
13 13
14obj-$(CONFIG_CPU_S5PC100) += cpu.o init.o clock.o gpiolib.o irq-gpio.o 14obj-$(CONFIG_CPU_S5PC100) += cpu.o init.o clock.o gpiolib.o
15obj-$(CONFIG_CPU_S5PC100) += setup-i2c0.o 15obj-$(CONFIG_CPU_S5PC100) += setup-i2c0.o
16obj-$(CONFIG_CPU_S5PC100) += dma.o 16obj-$(CONFIG_CPU_S5PC100) += dma.o
17 17
diff --git a/arch/arm/mach-s5pc100/clock.c b/arch/arm/mach-s5pc100/clock.c
index 084abd13b0a5..2d4a761a5163 100644
--- a/arch/arm/mach-s5pc100/clock.c
+++ b/arch/arm/mach-s5pc100/clock.c
@@ -273,24 +273,6 @@ static struct clksrc_clk clk_div_hdmi = {
273 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 28, .size = 4 }, 273 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 28, .size = 4 },
274}; 274};
275 275
276static int s5pc100_epll_enable(struct clk *clk, int enable)
277{
278 unsigned int ctrlbit = clk->ctrlbit;
279 unsigned int epll_con = __raw_readl(S5P_EPLL_CON) & ~ctrlbit;
280
281 if (enable)
282 __raw_writel(epll_con | ctrlbit, S5P_EPLL_CON);
283 else
284 __raw_writel(epll_con, S5P_EPLL_CON);
285
286 return 0;
287}
288
289static unsigned long s5pc100_epll_get_rate(struct clk *clk)
290{
291 return clk->rate;
292}
293
294static u32 epll_div[][4] = { 276static u32 epll_div[][4] = {
295 { 32750000, 131, 3, 4 }, 277 { 32750000, 131, 3, 4 },
296 { 32768000, 131, 3, 4 }, 278 { 32768000, 131, 3, 4 },
@@ -341,13 +323,16 @@ static int s5pc100_epll_set_rate(struct clk *clk, unsigned long rate)
341 323
342 __raw_writel(epll_con, S5P_EPLL_CON); 324 __raw_writel(epll_con, S5P_EPLL_CON);
343 325
326 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
327 clk->rate, rate);
328
344 clk->rate = rate; 329 clk->rate = rate;
345 330
346 return 0; 331 return 0;
347} 332}
348 333
349static struct clk_ops s5pc100_epll_ops = { 334static struct clk_ops s5pc100_epll_ops = {
350 .get_rate = s5pc100_epll_get_rate, 335 .get_rate = s5p_epll_get_rate,
351 .set_rate = s5pc100_epll_set_rate, 336 .set_rate = s5pc100_epll_set_rate,
352}; 337};
353 338
@@ -691,55 +676,55 @@ static struct clk init_clocks_disable[] = {
691 }, { 676 }, {
692 .name = "iis", 677 .name = "iis",
693 .id = 0, 678 .id = 0,
694 .parent = &clk_div_d1_bus.clk, 679 .parent = &clk_div_pclkd1.clk,
695 .enable = s5pc100_d1_5_ctrl, 680 .enable = s5pc100_d1_5_ctrl,
696 .ctrlbit = (1 << 0), 681 .ctrlbit = (1 << 0),
697 }, { 682 }, {
698 .name = "iis", 683 .name = "iis",
699 .id = 1, 684 .id = 1,
700 .parent = &clk_div_d1_bus.clk, 685 .parent = &clk_div_pclkd1.clk,
701 .enable = s5pc100_d1_5_ctrl, 686 .enable = s5pc100_d1_5_ctrl,
702 .ctrlbit = (1 << 1), 687 .ctrlbit = (1 << 1),
703 }, { 688 }, {
704 .name = "iis", 689 .name = "iis",
705 .id = 2, 690 .id = 2,
706 .parent = &clk_div_d1_bus.clk, 691 .parent = &clk_div_pclkd1.clk,
707 .enable = s5pc100_d1_5_ctrl, 692 .enable = s5pc100_d1_5_ctrl,
708 .ctrlbit = (1 << 2), 693 .ctrlbit = (1 << 2),
709 }, { 694 }, {
710 .name = "ac97", 695 .name = "ac97",
711 .id = -1, 696 .id = -1,
712 .parent = &clk_div_d1_bus.clk, 697 .parent = &clk_div_pclkd1.clk,
713 .enable = s5pc100_d1_5_ctrl, 698 .enable = s5pc100_d1_5_ctrl,
714 .ctrlbit = (1 << 3), 699 .ctrlbit = (1 << 3),
715 }, { 700 }, {
716 .name = "pcm", 701 .name = "pcm",
717 .id = 0, 702 .id = 0,
718 .parent = &clk_div_d1_bus.clk, 703 .parent = &clk_div_pclkd1.clk,
719 .enable = s5pc100_d1_5_ctrl, 704 .enable = s5pc100_d1_5_ctrl,
720 .ctrlbit = (1 << 4), 705 .ctrlbit = (1 << 4),
721 }, { 706 }, {
722 .name = "pcm", 707 .name = "pcm",
723 .id = 1, 708 .id = 1,
724 .parent = &clk_div_d1_bus.clk, 709 .parent = &clk_div_pclkd1.clk,
725 .enable = s5pc100_d1_5_ctrl, 710 .enable = s5pc100_d1_5_ctrl,
726 .ctrlbit = (1 << 5), 711 .ctrlbit = (1 << 5),
727 }, { 712 }, {
728 .name = "spdif", 713 .name = "spdif",
729 .id = -1, 714 .id = -1,
730 .parent = &clk_div_d1_bus.clk, 715 .parent = &clk_div_pclkd1.clk,
731 .enable = s5pc100_d1_5_ctrl, 716 .enable = s5pc100_d1_5_ctrl,
732 .ctrlbit = (1 << 6), 717 .ctrlbit = (1 << 6),
733 }, { 718 }, {
734 .name = "adc", 719 .name = "adc",
735 .id = -1, 720 .id = -1,
736 .parent = &clk_div_d1_bus.clk, 721 .parent = &clk_div_pclkd1.clk,
737 .enable = s5pc100_d1_5_ctrl, 722 .enable = s5pc100_d1_5_ctrl,
738 .ctrlbit = (1 << 7), 723 .ctrlbit = (1 << 7),
739 }, { 724 }, {
740 .name = "keypad", 725 .name = "keypad",
741 .id = -1, 726 .id = -1,
742 .parent = &clk_div_d1_bus.clk, 727 .parent = &clk_div_pclkd1.clk,
743 .enable = s5pc100_d1_5_ctrl, 728 .enable = s5pc100_d1_5_ctrl,
744 .ctrlbit = (1 << 8), 729 .ctrlbit = (1 << 8),
745 }, { 730 }, {
@@ -848,6 +833,18 @@ struct clksrc_sources clk_src_group3 = {
848 .nr_sources = ARRAY_SIZE(clk_src_group3_list), 833 .nr_sources = ARRAY_SIZE(clk_src_group3_list),
849}; 834};
850 835
836static struct clksrc_clk clk_sclk_audio0 = {
837 .clk = {
838 .name = "sclk_audio",
839 .id = 0,
840 .ctrlbit = (1 << 8),
841 .enable = s5pc100_sclk1_ctrl,
842 },
843 .sources = &clk_src_group3,
844 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 3 },
845 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 },
846};
847
851static struct clk *clk_src_group4_list[] = { 848static struct clk *clk_src_group4_list[] = {
852 [0] = &clk_mout_epll.clk, 849 [0] = &clk_mout_epll.clk,
853 [1] = &clk_div_mpll.clk, 850 [1] = &clk_div_mpll.clk,
@@ -862,6 +859,18 @@ struct clksrc_sources clk_src_group4 = {
862 .nr_sources = ARRAY_SIZE(clk_src_group4_list), 859 .nr_sources = ARRAY_SIZE(clk_src_group4_list),
863}; 860};
864 861
862static struct clksrc_clk clk_sclk_audio1 = {
863 .clk = {
864 .name = "sclk_audio",
865 .id = 1,
866 .ctrlbit = (1 << 9),
867 .enable = s5pc100_sclk1_ctrl,
868 },
869 .sources = &clk_src_group4,
870 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 3 },
871 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
872};
873
865static struct clk *clk_src_group5_list[] = { 874static struct clk *clk_src_group5_list[] = {
866 [0] = &clk_mout_epll.clk, 875 [0] = &clk_mout_epll.clk,
867 [1] = &clk_div_mpll.clk, 876 [1] = &clk_div_mpll.clk,
@@ -875,6 +884,18 @@ struct clksrc_sources clk_src_group5 = {
875 .nr_sources = ARRAY_SIZE(clk_src_group5_list), 884 .nr_sources = ARRAY_SIZE(clk_src_group5_list),
876}; 885};
877 886
887static struct clksrc_clk clk_sclk_audio2 = {
888 .clk = {
889 .name = "sclk_audio",
890 .id = 2,
891 .ctrlbit = (1 << 10),
892 .enable = s5pc100_sclk1_ctrl,
893 },
894 .sources = &clk_src_group5,
895 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 3 },
896 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 },
897};
898
878static struct clk *clk_src_group6_list[] = { 899static struct clk *clk_src_group6_list[] = {
879 [0] = &s5p_clk_27m, 900 [0] = &s5p_clk_27m,
880 [1] = &clk_vclk54m, 901 [1] = &clk_vclk54m,
@@ -944,6 +965,64 @@ struct clksrc_sources clk_src_pwi = {
944 .nr_sources = ARRAY_SIZE(clk_src_pwi_list), 965 .nr_sources = ARRAY_SIZE(clk_src_pwi_list),
945}; 966};
946 967
968static struct clk *clk_sclk_spdif_list[] = {
969 [0] = &clk_sclk_audio0.clk,
970 [1] = &clk_sclk_audio1.clk,
971 [2] = &clk_sclk_audio2.clk,
972};
973
974struct clksrc_sources clk_src_sclk_spdif = {
975 .sources = clk_sclk_spdif_list,
976 .nr_sources = ARRAY_SIZE(clk_sclk_spdif_list),
977};
978
979static int s5pc100_spdif_set_rate(struct clk *clk, unsigned long rate)
980{
981 struct clk *pclk;
982 int ret;
983
984 pclk = clk_get_parent(clk);
985 if (IS_ERR(pclk))
986 return -EINVAL;
987
988 ret = pclk->ops->set_rate(pclk, rate);
989 clk_put(pclk);
990
991 return ret;
992}
993
994static unsigned long s5pc100_spdif_get_rate(struct clk *clk)
995{
996 struct clk *pclk;
997 int rate;
998
999 pclk = clk_get_parent(clk);
1000 if (IS_ERR(pclk))
1001 return -EINVAL;
1002
1003 rate = pclk->ops->get_rate(clk);
1004 clk_put(pclk);
1005
1006 return rate;
1007}
1008
1009static struct clk_ops s5pc100_sclk_spdif_ops = {
1010 .set_rate = s5pc100_spdif_set_rate,
1011 .get_rate = s5pc100_spdif_get_rate,
1012};
1013
1014static struct clksrc_clk clk_sclk_spdif = {
1015 .clk = {
1016 .name = "sclk_spdif",
1017 .id = -1,
1018 .ctrlbit = (1 << 11),
1019 .enable = s5pc100_sclk1_ctrl,
1020 .ops = &s5pc100_sclk_spdif_ops,
1021 },
1022 .sources = &clk_src_sclk_spdif,
1023 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 24, .size = 2 },
1024};
1025
947static struct clksrc_clk clksrcs[] = { 1026static struct clksrc_clk clksrcs[] = {
948 { 1027 {
949 .clk = { 1028 .clk = {
@@ -1001,39 +1080,6 @@ static struct clksrc_clk clksrcs[] = {
1001 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 28, .size = 2 }, 1080 .reg_src = { .reg = S5P_CLK_SRC2, .shift = 28, .size = 2 },
1002 }, { 1081 }, {
1003 .clk = { 1082 .clk = {
1004 .name = "sclk_audio",
1005 .id = 0,
1006 .ctrlbit = (1 << 8),
1007 .enable = s5pc100_sclk1_ctrl,
1008
1009 },
1010 .sources = &clk_src_group3,
1011 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 12, .size = 3 },
1012 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 12, .size = 4 },
1013 }, {
1014 .clk = {
1015 .name = "sclk_audio",
1016 .id = 1,
1017 .ctrlbit = (1 << 9),
1018 .enable = s5pc100_sclk1_ctrl,
1019
1020 },
1021 .sources = &clk_src_group4,
1022 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 16, .size = 3 },
1023 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 16, .size = 4 },
1024 }, {
1025 .clk = {
1026 .name = "sclk_audio",
1027 .id = 2,
1028 .ctrlbit = (1 << 10),
1029 .enable = s5pc100_sclk1_ctrl,
1030
1031 },
1032 .sources = &clk_src_group5,
1033 .reg_src = { .reg = S5P_CLK_SRC3, .shift = 20, .size = 3 },
1034 .reg_div = { .reg = S5P_CLK_DIV4, .shift = 20, .size = 4 },
1035 }, {
1036 .clk = {
1037 .name = "sclk_lcd", 1083 .name = "sclk_lcd",
1038 .id = -1, 1084 .id = -1,
1039 .ctrlbit = (1 << 0), 1085 .ctrlbit = (1 << 0),
@@ -1179,6 +1225,10 @@ static struct clksrc_clk *sysclks[] = {
1179 &clk_div_pclkd1, 1225 &clk_div_pclkd1,
1180 &clk_div_cam, 1226 &clk_div_cam,
1181 &clk_div_hdmi, 1227 &clk_div_hdmi,
1228 &clk_sclk_audio0,
1229 &clk_sclk_audio1,
1230 &clk_sclk_audio2,
1231 &clk_sclk_spdif,
1182}; 1232};
1183 1233
1184void __init_or_cpufreq s5pc100_setup_clocks(void) 1234void __init_or_cpufreq s5pc100_setup_clocks(void)
@@ -1196,7 +1246,7 @@ void __init_or_cpufreq s5pc100_setup_clocks(void)
1196 unsigned int ptr; 1246 unsigned int ptr;
1197 1247
1198 /* Set S5PC100 functions for clk_fout_epll */ 1248 /* Set S5PC100 functions for clk_fout_epll */
1199 clk_fout_epll.enable = s5pc100_epll_enable; 1249 clk_fout_epll.enable = s5p_epll_enable;
1200 clk_fout_epll.ops = &s5pc100_epll_ops; 1250 clk_fout_epll.ops = &s5pc100_epll_ops;
1201 1251
1202 printk(KERN_DEBUG "%s: registering clocks\n", __func__); 1252 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
diff --git a/arch/arm/mach-s5pc100/dev-audio.c b/arch/arm/mach-s5pc100/dev-audio.c
index a699ed6acc23..564e195ec493 100644
--- a/arch/arm/mach-s5pc100/dev-audio.c
+++ b/arch/arm/mach-s5pc100/dev-audio.c
@@ -24,19 +24,11 @@ static int s5pc100_cfg_i2s(struct platform_device *pdev)
24 /* configure GPIO for i2s port */ 24 /* configure GPIO for i2s port */
25 switch (pdev->id) { 25 switch (pdev->id) {
26 case 1: 26 case 1:
27 s3c_gpio_cfgpin(S5PC100_GPC(0), S3C_GPIO_SFN(2)); 27 s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(2));
28 s3c_gpio_cfgpin(S5PC100_GPC(1), S3C_GPIO_SFN(2));
29 s3c_gpio_cfgpin(S5PC100_GPC(2), S3C_GPIO_SFN(2));
30 s3c_gpio_cfgpin(S5PC100_GPC(3), S3C_GPIO_SFN(2));
31 s3c_gpio_cfgpin(S5PC100_GPC(4), S3C_GPIO_SFN(2));
32 break; 28 break;
33 29
34 case 2: 30 case 2:
35 s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(4)); 31 s3c_gpio_cfgpin_range(S5PC100_GPG3(0), 5, S3C_GPIO_SFN(4));
36 s3c_gpio_cfgpin(S5PC100_GPG3(1), S3C_GPIO_SFN(4));
37 s3c_gpio_cfgpin(S5PC100_GPG3(2), S3C_GPIO_SFN(4));
38 s3c_gpio_cfgpin(S5PC100_GPG3(3), S3C_GPIO_SFN(4));
39 s3c_gpio_cfgpin(S5PC100_GPG3(4), S3C_GPIO_SFN(4));
40 break; 32 break;
41 33
42 case -1: /* Dedicated pins */ 34 case -1: /* Dedicated pins */
@@ -144,19 +136,11 @@ static int s5pc100_pcm_cfg_gpio(struct platform_device *pdev)
144{ 136{
145 switch (pdev->id) { 137 switch (pdev->id) {
146 case 0: 138 case 0:
147 s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(5)); 139 s3c_gpio_cfgpin_range(S5PC100_GPG3(0), 5, S3C_GPIO_SFN(5));
148 s3c_gpio_cfgpin(S5PC100_GPG3(1), S3C_GPIO_SFN(5));
149 s3c_gpio_cfgpin(S5PC100_GPG3(2), S3C_GPIO_SFN(5));
150 s3c_gpio_cfgpin(S5PC100_GPG3(3), S3C_GPIO_SFN(5));
151 s3c_gpio_cfgpin(S5PC100_GPG3(4), S3C_GPIO_SFN(5));
152 break; 140 break;
153 141
154 case 1: 142 case 1:
155 s3c_gpio_cfgpin(S5PC100_GPC(0), S3C_GPIO_SFN(3)); 143 s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(3));
156 s3c_gpio_cfgpin(S5PC100_GPC(1), S3C_GPIO_SFN(3));
157 s3c_gpio_cfgpin(S5PC100_GPC(2), S3C_GPIO_SFN(3));
158 s3c_gpio_cfgpin(S5PC100_GPC(3), S3C_GPIO_SFN(3));
159 s3c_gpio_cfgpin(S5PC100_GPC(4), S3C_GPIO_SFN(3));
160 break; 144 break;
161 145
162 default: 146 default:
@@ -231,13 +215,7 @@ struct platform_device s5pc100_device_pcm1 = {
231 215
232static int s5pc100_ac97_cfg_gpio(struct platform_device *pdev) 216static int s5pc100_ac97_cfg_gpio(struct platform_device *pdev)
233{ 217{
234 s3c_gpio_cfgpin(S5PC100_GPC(0), S3C_GPIO_SFN(4)); 218 return s3c_gpio_cfgpin_range(S5PC100_GPC(0), 5, S3C_GPIO_SFN(4));
235 s3c_gpio_cfgpin(S5PC100_GPC(1), S3C_GPIO_SFN(4));
236 s3c_gpio_cfgpin(S5PC100_GPC(2), S3C_GPIO_SFN(4));
237 s3c_gpio_cfgpin(S5PC100_GPC(3), S3C_GPIO_SFN(4));
238 s3c_gpio_cfgpin(S5PC100_GPC(4), S3C_GPIO_SFN(4));
239
240 return 0;
241} 219}
242 220
243static struct resource s5pc100_ac97_resource[] = { 221static struct resource s5pc100_ac97_resource[] = {
@@ -285,3 +263,57 @@ struct platform_device s5pc100_device_ac97 = {
285 .coherent_dma_mask = DMA_BIT_MASK(32), 263 .coherent_dma_mask = DMA_BIT_MASK(32),
286 }, 264 },
287}; 265};
266
267/* S/PDIF Controller platform_device */
268static int s5pc100_spdif_cfg_gpd(struct platform_device *pdev)
269{
270 s3c_gpio_cfgpin_range(S5PC100_GPD(5), 2, S3C_GPIO_SFN(3));
271
272 return 0;
273}
274
275static int s5pc100_spdif_cfg_gpg3(struct platform_device *pdev)
276{
277 s3c_gpio_cfgpin_range(S5PC100_GPG3(5), 2, S3C_GPIO_SFN(3));
278
279 return 0;
280}
281
282static struct resource s5pc100_spdif_resource[] = {
283 [0] = {
284 .start = S5PC100_PA_SPDIF,
285 .end = S5PC100_PA_SPDIF + 0x100 - 1,
286 .flags = IORESOURCE_MEM,
287 },
288 [1] = {
289 .start = DMACH_SPDIF,
290 .end = DMACH_SPDIF,
291 .flags = IORESOURCE_DMA,
292 },
293};
294
295static struct s3c_audio_pdata s5p_spdif_pdata = {
296 .cfg_gpio = s5pc100_spdif_cfg_gpd,
297};
298
299static u64 s5pc100_spdif_dmamask = DMA_BIT_MASK(32);
300
301struct platform_device s5pc100_device_spdif = {
302 .name = "samsung-spdif",
303 .id = -1,
304 .num_resources = ARRAY_SIZE(s5pc100_spdif_resource),
305 .resource = s5pc100_spdif_resource,
306 .dev = {
307 .platform_data = &s5p_spdif_pdata,
308 .dma_mask = &s5pc100_spdif_dmamask,
309 .coherent_dma_mask = DMA_BIT_MASK(32),
310 },
311};
312
313void __init s5pc100_spdif_setup_gpio(int gpio)
314{
315 if (gpio == S5PC100_SPDIF_GPD)
316 s5p_spdif_pdata.cfg_gpio = s5pc100_spdif_cfg_gpd;
317 else
318 s5p_spdif_pdata.cfg_gpio = s5pc100_spdif_cfg_gpg3;
319}
diff --git a/arch/arm/mach-s5pc100/dev-spi.c b/arch/arm/mach-s5pc100/dev-spi.c
index a0ef7c302c16..57b19794d9bb 100644
--- a/arch/arm/mach-s5pc100/dev-spi.c
+++ b/arch/arm/mach-s5pc100/dev-spi.c
@@ -38,30 +38,20 @@ static int s5pc100_spi_cfg_gpio(struct platform_device *pdev)
38{ 38{
39 switch (pdev->id) { 39 switch (pdev->id) {
40 case 0: 40 case 0:
41 s3c_gpio_cfgpin(S5PC100_GPB(0), S3C_GPIO_SFN(2)); 41 s3c_gpio_cfgall_range(S5PC100_GPB(0), 3,
42 s3c_gpio_cfgpin(S5PC100_GPB(1), S3C_GPIO_SFN(2)); 42 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
43 s3c_gpio_cfgpin(S5PC100_GPB(2), S3C_GPIO_SFN(2));
44 s3c_gpio_setpull(S5PC100_GPB(0), S3C_GPIO_PULL_UP);
45 s3c_gpio_setpull(S5PC100_GPB(1), S3C_GPIO_PULL_UP);
46 s3c_gpio_setpull(S5PC100_GPB(2), S3C_GPIO_PULL_UP);
47 break; 43 break;
48 44
49 case 1: 45 case 1:
50 s3c_gpio_cfgpin(S5PC100_GPB(4), S3C_GPIO_SFN(2)); 46 s3c_gpio_cfgall_range(S5PC100_GPB(4), 3,
51 s3c_gpio_cfgpin(S5PC100_GPB(5), S3C_GPIO_SFN(2)); 47 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
52 s3c_gpio_cfgpin(S5PC100_GPB(6), S3C_GPIO_SFN(2));
53 s3c_gpio_setpull(S5PC100_GPB(4), S3C_GPIO_PULL_UP);
54 s3c_gpio_setpull(S5PC100_GPB(5), S3C_GPIO_PULL_UP);
55 s3c_gpio_setpull(S5PC100_GPB(6), S3C_GPIO_PULL_UP);
56 break; 48 break;
57 49
58 case 2: 50 case 2:
59 s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3)); 51 s3c_gpio_cfgpin(S5PC100_GPG3(0), S3C_GPIO_SFN(3));
60 s3c_gpio_cfgpin(S5PC100_GPG3(2), S3C_GPIO_SFN(3));
61 s3c_gpio_cfgpin(S5PC100_GPG3(3), S3C_GPIO_SFN(3));
62 s3c_gpio_setpull(S5PC100_GPG3(0), S3C_GPIO_PULL_UP); 52 s3c_gpio_setpull(S5PC100_GPG3(0), S3C_GPIO_PULL_UP);
63 s3c_gpio_setpull(S5PC100_GPG3(2), S3C_GPIO_PULL_UP); 53 s3c_gpio_cfgall_range(S5PC100_GPB(2), 2,
64 s3c_gpio_setpull(S5PC100_GPG3(3), S3C_GPIO_PULL_UP); 54 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
65 break; 55 break;
66 56
67 default: 57 default:
diff --git a/arch/arm/mach-s5pc100/dma.c b/arch/arm/mach-s5pc100/dma.c
index 0f5517571e2c..bf4cd0fb97c6 100644
--- a/arch/arm/mach-s5pc100/dma.c
+++ b/arch/arm/mach-s5pc100/dma.c
@@ -81,7 +81,7 @@ static struct s3c_pl330_platdata s5pc100_pdma0_pdata = {
81 81
82static struct platform_device s5pc100_device_pdma0 = { 82static struct platform_device s5pc100_device_pdma0 = {
83 .name = "s3c-pl330", 83 .name = "s3c-pl330",
84 .id = 1, 84 .id = 0,
85 .num_resources = ARRAY_SIZE(s5pc100_pdma0_resource), 85 .num_resources = ARRAY_SIZE(s5pc100_pdma0_resource),
86 .resource = s5pc100_pdma0_resource, 86 .resource = s5pc100_pdma0_resource,
87 .dev = { 87 .dev = {
@@ -143,7 +143,7 @@ static struct s3c_pl330_platdata s5pc100_pdma1_pdata = {
143 143
144static struct platform_device s5pc100_device_pdma1 = { 144static struct platform_device s5pc100_device_pdma1 = {
145 .name = "s3c-pl330", 145 .name = "s3c-pl330",
146 .id = 2, 146 .id = 1,
147 .num_resources = ARRAY_SIZE(s5pc100_pdma1_resource), 147 .num_resources = ARRAY_SIZE(s5pc100_pdma1_resource),
148 .resource = s5pc100_pdma1_resource, 148 .resource = s5pc100_pdma1_resource,
149 .dev = { 149 .dev = {
diff --git a/arch/arm/mach-s5pc100/gpiolib.c b/arch/arm/mach-s5pc100/gpiolib.c
index 0fab7f2cd8bf..20856eb7dd51 100644
--- a/arch/arm/mach-s5pc100/gpiolib.c
+++ b/arch/arm/mach-s5pc100/gpiolib.c
@@ -1,5 +1,7 @@
1/* 1/* linux/arch/arm/mach-s5pc100/gpiolib.c
2 * arch/arm/plat-s5pc100/gpiolib.c 2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
3 * 5 *
4 * Copyright 2009 Samsung Electronics Co 6 * Copyright 2009 Samsung Electronics Co
5 * Kyungmin Park <kyungmin.park@samsung.com> 7 * Kyungmin Park <kyungmin.park@samsung.com>
@@ -61,30 +63,6 @@
61 * L3 8 4Bit None 63 * L3 8 4Bit None
62 */ 64 */
63 65
64static int s5pc100_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset)
65{
66 return S3C_IRQ_GPIO(chip->base + offset);
67}
68
69static int s5pc100_gpiolib_to_eint(struct gpio_chip *chip, unsigned int offset)
70{
71 int base;
72
73 base = chip->base - S5PC100_GPH0(0);
74 if (base == 0)
75 return IRQ_EINT(offset);
76 base = chip->base - S5PC100_GPH1(0);
77 if (base == 0)
78 return IRQ_EINT(8 + offset);
79 base = chip->base - S5PC100_GPH2(0);
80 if (base == 0)
81 return IRQ_EINT(16 + offset);
82 base = chip->base - S5PC100_GPH3(0);
83 if (base == 0)
84 return IRQ_EINT(24 + offset);
85 return -EINVAL;
86}
87
88static struct s3c_gpio_cfg gpio_cfg = { 66static struct s3c_gpio_cfg gpio_cfg = {
89 .set_config = s3c_gpio_setcfg_s3c64xx_4bit, 67 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
90 .set_pull = s3c_gpio_setpull_updown, 68 .set_pull = s3c_gpio_setpull_updown,
@@ -104,209 +82,150 @@ static struct s3c_gpio_cfg gpio_cfg_noint = {
104 .get_pull = s3c_gpio_getpull_updown, 82 .get_pull = s3c_gpio_getpull_updown,
105}; 83};
106 84
85/*
86 * GPIO bank's base address given the index of the bank in the
87 * list of all gpio banks.
88 */
89#define S5PC100_BANK_BASE(bank_nr) (S5P_VA_GPIO + ((bank_nr) * 0x20))
90
91/*
92 * Following are the gpio banks in S5PC100.
93 *
94 * The 'config' member when left to NULL, is initialized to the default
95 * structure gpio_cfg in the init function below.
96 *
97 * The 'base' member is also initialized in the init function below.
98 * Note: The initialization of 'base' member of s3c_gpio_chip structure
99 * uses the above macro and depends on the banks being listed in order here.
100 */
107static struct s3c_gpio_chip s5pc100_gpio_chips[] = { 101static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
108 { 102 {
109 .base = S5PC100_GPA0_BASE,
110 .config = &gpio_cfg,
111 .chip = { 103 .chip = {
112 .base = S5PC100_GPA0(0), 104 .base = S5PC100_GPA0(0),
113 .ngpio = S5PC100_GPIO_A0_NR, 105 .ngpio = S5PC100_GPIO_A0_NR,
114 .label = "GPA0", 106 .label = "GPA0",
115 }, 107 },
116 }, { 108 }, {
117 .base = S5PC100_GPA1_BASE,
118 .config = &gpio_cfg,
119 .chip = { 109 .chip = {
120 .base = S5PC100_GPA1(0), 110 .base = S5PC100_GPA1(0),
121 .ngpio = S5PC100_GPIO_A1_NR, 111 .ngpio = S5PC100_GPIO_A1_NR,
122 .label = "GPA1", 112 .label = "GPA1",
123 }, 113 },
124 }, { 114 }, {
125 .base = S5PC100_GPB_BASE,
126 .config = &gpio_cfg,
127 .chip = { 115 .chip = {
128 .base = S5PC100_GPB(0), 116 .base = S5PC100_GPB(0),
129 .ngpio = S5PC100_GPIO_B_NR, 117 .ngpio = S5PC100_GPIO_B_NR,
130 .label = "GPB", 118 .label = "GPB",
131 }, 119 },
132 }, { 120 }, {
133 .base = S5PC100_GPC_BASE,
134 .config = &gpio_cfg,
135 .chip = { 121 .chip = {
136 .base = S5PC100_GPC(0), 122 .base = S5PC100_GPC(0),
137 .ngpio = S5PC100_GPIO_C_NR, 123 .ngpio = S5PC100_GPIO_C_NR,
138 .label = "GPC", 124 .label = "GPC",
139 }, 125 },
140 }, { 126 }, {
141 .base = S5PC100_GPD_BASE,
142 .config = &gpio_cfg,
143 .chip = { 127 .chip = {
144 .base = S5PC100_GPD(0), 128 .base = S5PC100_GPD(0),
145 .ngpio = S5PC100_GPIO_D_NR, 129 .ngpio = S5PC100_GPIO_D_NR,
146 .label = "GPD", 130 .label = "GPD",
147 }, 131 },
148 }, { 132 }, {
149 .base = S5PC100_GPE0_BASE,
150 .config = &gpio_cfg,
151 .chip = { 133 .chip = {
152 .base = S5PC100_GPE0(0), 134 .base = S5PC100_GPE0(0),
153 .ngpio = S5PC100_GPIO_E0_NR, 135 .ngpio = S5PC100_GPIO_E0_NR,
154 .label = "GPE0", 136 .label = "GPE0",
155 }, 137 },
156 }, { 138 }, {
157 .base = S5PC100_GPE1_BASE,
158 .config = &gpio_cfg,
159 .chip = { 139 .chip = {
160 .base = S5PC100_GPE1(0), 140 .base = S5PC100_GPE1(0),
161 .ngpio = S5PC100_GPIO_E1_NR, 141 .ngpio = S5PC100_GPIO_E1_NR,
162 .label = "GPE1", 142 .label = "GPE1",
163 }, 143 },
164 }, { 144 }, {
165 .base = S5PC100_GPF0_BASE,
166 .config = &gpio_cfg,
167 .chip = { 145 .chip = {
168 .base = S5PC100_GPF0(0), 146 .base = S5PC100_GPF0(0),
169 .ngpio = S5PC100_GPIO_F0_NR, 147 .ngpio = S5PC100_GPIO_F0_NR,
170 .label = "GPF0", 148 .label = "GPF0",
171 }, 149 },
172 }, { 150 }, {
173 .base = S5PC100_GPF1_BASE,
174 .config = &gpio_cfg,
175 .chip = { 151 .chip = {
176 .base = S5PC100_GPF1(0), 152 .base = S5PC100_GPF1(0),
177 .ngpio = S5PC100_GPIO_F1_NR, 153 .ngpio = S5PC100_GPIO_F1_NR,
178 .label = "GPF1", 154 .label = "GPF1",
179 }, 155 },
180 }, { 156 }, {
181 .base = S5PC100_GPF2_BASE,
182 .config = &gpio_cfg,
183 .chip = { 157 .chip = {
184 .base = S5PC100_GPF2(0), 158 .base = S5PC100_GPF2(0),
185 .ngpio = S5PC100_GPIO_F2_NR, 159 .ngpio = S5PC100_GPIO_F2_NR,
186 .label = "GPF2", 160 .label = "GPF2",
187 }, 161 },
188 }, { 162 }, {
189 .base = S5PC100_GPF3_BASE,
190 .config = &gpio_cfg,
191 .chip = { 163 .chip = {
192 .base = S5PC100_GPF3(0), 164 .base = S5PC100_GPF3(0),
193 .ngpio = S5PC100_GPIO_F3_NR, 165 .ngpio = S5PC100_GPIO_F3_NR,
194 .label = "GPF3", 166 .label = "GPF3",
195 }, 167 },
196 }, { 168 }, {
197 .base = S5PC100_GPG0_BASE,
198 .config = &gpio_cfg,
199 .chip = { 169 .chip = {
200 .base = S5PC100_GPG0(0), 170 .base = S5PC100_GPG0(0),
201 .ngpio = S5PC100_GPIO_G0_NR, 171 .ngpio = S5PC100_GPIO_G0_NR,
202 .label = "GPG0", 172 .label = "GPG0",
203 }, 173 },
204 }, { 174 }, {
205 .base = S5PC100_GPG1_BASE,
206 .config = &gpio_cfg,
207 .chip = { 175 .chip = {
208 .base = S5PC100_GPG1(0), 176 .base = S5PC100_GPG1(0),
209 .ngpio = S5PC100_GPIO_G1_NR, 177 .ngpio = S5PC100_GPIO_G1_NR,
210 .label = "GPG1", 178 .label = "GPG1",
211 }, 179 },
212 }, { 180 }, {
213 .base = S5PC100_GPG2_BASE,
214 .config = &gpio_cfg,
215 .chip = { 181 .chip = {
216 .base = S5PC100_GPG2(0), 182 .base = S5PC100_GPG2(0),
217 .ngpio = S5PC100_GPIO_G2_NR, 183 .ngpio = S5PC100_GPIO_G2_NR,
218 .label = "GPG2", 184 .label = "GPG2",
219 }, 185 },
220 }, { 186 }, {
221 .base = S5PC100_GPG3_BASE,
222 .config = &gpio_cfg,
223 .chip = { 187 .chip = {
224 .base = S5PC100_GPG3(0), 188 .base = S5PC100_GPG3(0),
225 .ngpio = S5PC100_GPIO_G3_NR, 189 .ngpio = S5PC100_GPIO_G3_NR,
226 .label = "GPG3", 190 .label = "GPG3",
227 }, 191 },
228 }, { 192 }, {
229 .base = S5PC100_GPH0_BASE,
230 .config = &gpio_cfg_eint,
231 .chip = {
232 .base = S5PC100_GPH0(0),
233 .ngpio = S5PC100_GPIO_H0_NR,
234 .label = "GPH0",
235 },
236 }, {
237 .base = S5PC100_GPH1_BASE,
238 .config = &gpio_cfg_eint,
239 .chip = {
240 .base = S5PC100_GPH1(0),
241 .ngpio = S5PC100_GPIO_H1_NR,
242 .label = "GPH1",
243 },
244 }, {
245 .base = S5PC100_GPH2_BASE,
246 .config = &gpio_cfg_eint,
247 .chip = {
248 .base = S5PC100_GPH2(0),
249 .ngpio = S5PC100_GPIO_H2_NR,
250 .label = "GPH2",
251 },
252 }, {
253 .base = S5PC100_GPH3_BASE,
254 .config = &gpio_cfg_eint,
255 .chip = {
256 .base = S5PC100_GPH3(0),
257 .ngpio = S5PC100_GPIO_H3_NR,
258 .label = "GPH3",
259 },
260 }, {
261 .base = S5PC100_GPI_BASE,
262 .config = &gpio_cfg,
263 .chip = { 193 .chip = {
264 .base = S5PC100_GPI(0), 194 .base = S5PC100_GPI(0),
265 .ngpio = S5PC100_GPIO_I_NR, 195 .ngpio = S5PC100_GPIO_I_NR,
266 .label = "GPI", 196 .label = "GPI",
267 }, 197 },
268 }, { 198 }, {
269 .base = S5PC100_GPJ0_BASE,
270 .config = &gpio_cfg,
271 .chip = { 199 .chip = {
272 .base = S5PC100_GPJ0(0), 200 .base = S5PC100_GPJ0(0),
273 .ngpio = S5PC100_GPIO_J0_NR, 201 .ngpio = S5PC100_GPIO_J0_NR,
274 .label = "GPJ0", 202 .label = "GPJ0",
275 }, 203 },
276 }, { 204 }, {
277 .base = S5PC100_GPJ1_BASE,
278 .config = &gpio_cfg,
279 .chip = { 205 .chip = {
280 .base = S5PC100_GPJ1(0), 206 .base = S5PC100_GPJ1(0),
281 .ngpio = S5PC100_GPIO_J1_NR, 207 .ngpio = S5PC100_GPIO_J1_NR,
282 .label = "GPJ1", 208 .label = "GPJ1",
283 }, 209 },
284 }, { 210 }, {
285 .base = S5PC100_GPJ2_BASE,
286 .config = &gpio_cfg,
287 .chip = { 211 .chip = {
288 .base = S5PC100_GPJ2(0), 212 .base = S5PC100_GPJ2(0),
289 .ngpio = S5PC100_GPIO_J2_NR, 213 .ngpio = S5PC100_GPIO_J2_NR,
290 .label = "GPJ2", 214 .label = "GPJ2",
291 }, 215 },
292 }, { 216 }, {
293 .base = S5PC100_GPJ3_BASE,
294 .config = &gpio_cfg,
295 .chip = { 217 .chip = {
296 .base = S5PC100_GPJ3(0), 218 .base = S5PC100_GPJ3(0),
297 .ngpio = S5PC100_GPIO_J3_NR, 219 .ngpio = S5PC100_GPIO_J3_NR,
298 .label = "GPJ3", 220 .label = "GPJ3",
299 }, 221 },
300 }, { 222 }, {
301 .base = S5PC100_GPJ4_BASE,
302 .config = &gpio_cfg,
303 .chip = { 223 .chip = {
304 .base = S5PC100_GPJ4(0), 224 .base = S5PC100_GPJ4(0),
305 .ngpio = S5PC100_GPIO_J4_NR, 225 .ngpio = S5PC100_GPIO_J4_NR,
306 .label = "GPJ4", 226 .label = "GPJ4",
307 }, 227 },
308 }, { 228 }, {
309 .base = S5PC100_GPK0_BASE,
310 .config = &gpio_cfg_noint, 229 .config = &gpio_cfg_noint,
311 .chip = { 230 .chip = {
312 .base = S5PC100_GPK0(0), 231 .base = S5PC100_GPK0(0),
@@ -314,7 +233,6 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
314 .label = "GPK0", 233 .label = "GPK0",
315 }, 234 },
316 }, { 235 }, {
317 .base = S5PC100_GPK1_BASE,
318 .config = &gpio_cfg_noint, 236 .config = &gpio_cfg_noint,
319 .chip = { 237 .chip = {
320 .base = S5PC100_GPK1(0), 238 .base = S5PC100_GPK1(0),
@@ -322,7 +240,6 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
322 .label = "GPK1", 240 .label = "GPK1",
323 }, 241 },
324 }, { 242 }, {
325 .base = S5PC100_GPK2_BASE,
326 .config = &gpio_cfg_noint, 243 .config = &gpio_cfg_noint,
327 .chip = { 244 .chip = {
328 .base = S5PC100_GPK2(0), 245 .base = S5PC100_GPK2(0),
@@ -330,7 +247,6 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
330 .label = "GPK2", 247 .label = "GPK2",
331 }, 248 },
332 }, { 249 }, {
333 .base = S5PC100_GPK3_BASE,
334 .config = &gpio_cfg_noint, 250 .config = &gpio_cfg_noint,
335 .chip = { 251 .chip = {
336 .base = S5PC100_GPK3(0), 252 .base = S5PC100_GPK3(0),
@@ -338,7 +254,6 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
338 .label = "GPK3", 254 .label = "GPK3",
339 }, 255 },
340 }, { 256 }, {
341 .base = S5PC100_GPL0_BASE,
342 .config = &gpio_cfg_noint, 257 .config = &gpio_cfg_noint,
343 .chip = { 258 .chip = {
344 .base = S5PC100_GPL0(0), 259 .base = S5PC100_GPL0(0),
@@ -346,7 +261,6 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
346 .label = "GPL0", 261 .label = "GPL0",
347 }, 262 },
348 }, { 263 }, {
349 .base = S5PC100_GPL1_BASE,
350 .config = &gpio_cfg_noint, 264 .config = &gpio_cfg_noint,
351 .chip = { 265 .chip = {
352 .base = S5PC100_GPL1(0), 266 .base = S5PC100_GPL1(0),
@@ -354,7 +268,6 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
354 .label = "GPL1", 268 .label = "GPL1",
355 }, 269 },
356 }, { 270 }, {
357 .base = S5PC100_GPL2_BASE,
358 .config = &gpio_cfg_noint, 271 .config = &gpio_cfg_noint,
359 .chip = { 272 .chip = {
360 .base = S5PC100_GPL2(0), 273 .base = S5PC100_GPL2(0),
@@ -362,7 +275,6 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
362 .label = "GPL2", 275 .label = "GPL2",
363 }, 276 },
364 }, { 277 }, {
365 .base = S5PC100_GPL3_BASE,
366 .config = &gpio_cfg_noint, 278 .config = &gpio_cfg_noint,
367 .chip = { 279 .chip = {
368 .base = S5PC100_GPL3(0), 280 .base = S5PC100_GPL3(0),
@@ -370,56 +282,72 @@ static struct s3c_gpio_chip s5pc100_gpio_chips[] = {
370 .label = "GPL3", 282 .label = "GPL3",
371 }, 283 },
372 }, { 284 }, {
373 .base = S5PC100_GPL4_BASE,
374 .config = &gpio_cfg_noint, 285 .config = &gpio_cfg_noint,
375 .chip = { 286 .chip = {
376 .base = S5PC100_GPL4(0), 287 .base = S5PC100_GPL4(0),
377 .ngpio = S5PC100_GPIO_L4_NR, 288 .ngpio = S5PC100_GPIO_L4_NR,
378 .label = "GPL4", 289 .label = "GPL4",
379 }, 290 },
291 }, {
292 .base = (S5P_VA_GPIO + 0xC00),
293 .config = &gpio_cfg_eint,
294 .irq_base = IRQ_EINT(0),
295 .chip = {
296 .base = S5PC100_GPH0(0),
297 .ngpio = S5PC100_GPIO_H0_NR,
298 .label = "GPH0",
299 .to_irq = samsung_gpiolib_to_irq,
300 },
301 }, {
302 .base = (S5P_VA_GPIO + 0xC20),
303 .config = &gpio_cfg_eint,
304 .irq_base = IRQ_EINT(8),
305 .chip = {
306 .base = S5PC100_GPH1(0),
307 .ngpio = S5PC100_GPIO_H1_NR,
308 .label = "GPH1",
309 .to_irq = samsung_gpiolib_to_irq,
310 },
311 }, {
312 .base = (S5P_VA_GPIO + 0xC40),
313 .config = &gpio_cfg_eint,
314 .irq_base = IRQ_EINT(16),
315 .chip = {
316 .base = S5PC100_GPH2(0),
317 .ngpio = S5PC100_GPIO_H2_NR,
318 .label = "GPH2",
319 .to_irq = samsung_gpiolib_to_irq,
320 },
321 }, {
322 .base = (S5P_VA_GPIO + 0xC60),
323 .config = &gpio_cfg_eint,
324 .irq_base = IRQ_EINT(24),
325 .chip = {
326 .base = S5PC100_GPH3(0),
327 .ngpio = S5PC100_GPIO_H3_NR,
328 .label = "GPH3",
329 .to_irq = samsung_gpiolib_to_irq,
330 },
380 }, 331 },
381}; 332};
382 333
383/* FIXME move from irq-gpio.c */ 334static __init int s5pc100_gpiolib_init(void)
384extern struct irq_chip s5pc100_gpioint;
385extern void s5pc100_irq_gpioint_handler(unsigned int irq, struct irq_desc *desc);
386
387static __init void s5pc100_gpiolib_link(struct s3c_gpio_chip *chip)
388{ 335{
389 /* Interrupt */ 336 struct s3c_gpio_chip *chip = s5pc100_gpio_chips;
390 if (chip->config == &gpio_cfg) { 337 int nr_chips = ARRAY_SIZE(s5pc100_gpio_chips);
391 int i, irq; 338 int gpioint_group = 0;
392 339 int i;
393 chip->chip.to_irq = s5pc100_gpiolib_to_irq;
394 340
395 for (i = 0; i < chip->chip.ngpio; i++) { 341 for (i = 0; i < nr_chips; i++, chip++) {
396 irq = S3C_IRQ_GPIO_BASE + chip->chip.base + i; 342 if (chip->config == NULL) {
397 set_irq_chip(irq, &s5pc100_gpioint); 343 chip->config = &gpio_cfg;
398 set_irq_data(irq, &chip->chip); 344 chip->group = gpioint_group++;
399 set_irq_handler(irq, handle_level_irq);
400 set_irq_flags(irq, IRQF_VALID);
401 } 345 }
402 } else if (chip->config == &gpio_cfg_eint) { 346 if (chip->base == NULL)
403 chip->chip.to_irq = s5pc100_gpiolib_to_eint; 347 chip->base = S5PC100_BANK_BASE(i);
404 } 348 }
405}
406
407static __init int s5pc100_gpiolib_init(void)
408{
409 struct s3c_gpio_chip *chip;
410 int nr_chips;
411
412 chip = s5pc100_gpio_chips;
413 nr_chips = ARRAY_SIZE(s5pc100_gpio_chips);
414
415 for (; nr_chips > 0; nr_chips--, chip++)
416 s5pc100_gpiolib_link(chip);
417
418 samsung_gpiolib_add_4bit_chips(s5pc100_gpio_chips,
419 ARRAY_SIZE(s5pc100_gpio_chips));
420 349
421 /* Interrupt */ 350 samsung_gpiolib_add_4bit_chips(s5pc100_gpio_chips, nr_chips);
422 set_irq_chained_handler(IRQ_GPIOINT, s5pc100_irq_gpioint_handler);
423 351
424 return 0; 352 return 0;
425} 353}
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio.h b/arch/arm/mach-s5pc100/include/mach/gpio.h
index 71ae1f52df1d..29a8a12d9b4f 100644
--- a/arch/arm/mach-s5pc100/include/mach/gpio.h
+++ b/arch/arm/mach-s5pc100/include/mach/gpio.h
@@ -146,13 +146,6 @@ enum s5p_gpio_number {
146/* define the number of gpios we need to the one after the MP04() range */ 146/* define the number of gpios we need to the one after the MP04() range */
147#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1) 147#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1)
148 148
149#define EINT_MODE S3C_GPIO_SFN(0x2)
150
151#define EINT_GPIO_0(x) S5PC100_GPH0(x)
152#define EINT_GPIO_1(x) S5PC100_GPH1(x)
153#define EINT_GPIO_2(x) S5PC100_GPH2(x)
154#define EINT_GPIO_3(x) S5PC100_GPH3(x)
155
156#include <asm-generic/gpio.h> 149#include <asm-generic/gpio.h>
157 150
158#endif /* __ASM_ARCH_GPIO_H */ 151#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pc100/include/mach/irqs.h b/arch/arm/mach-s5pc100/include/mach/irqs.h
index 06513e647242..d2eb4757381f 100644
--- a/arch/arm/mach-s5pc100/include/mach/irqs.h
+++ b/arch/arm/mach-s5pc100/include/mach/irqs.h
@@ -48,8 +48,8 @@
48#define IRQ_SPI1 S5P_IRQ_VIC1(16) 48#define IRQ_SPI1 S5P_IRQ_VIC1(16)
49#define IRQ_SPI2 S5P_IRQ_VIC1(17) 49#define IRQ_SPI2 S5P_IRQ_VIC1(17)
50#define IRQ_IRDA S5P_IRQ_VIC1(18) 50#define IRQ_IRDA S5P_IRQ_VIC1(18)
51#define IRQ_CAN0 S5P_IRQ_VIC1(19) 51#define IRQ_IIC2 S5P_IRQ_VIC1(19)
52#define IRQ_CAN1 S5P_IRQ_VIC1(20) 52#define IRQ_IIC3 S5P_IRQ_VIC1(20)
53#define IRQ_HSIRX S5P_IRQ_VIC1(21) 53#define IRQ_HSIRX S5P_IRQ_VIC1(21)
54#define IRQ_HSITX S5P_IRQ_VIC1(22) 54#define IRQ_HSITX S5P_IRQ_VIC1(22)
55#define IRQ_UHOST S5P_IRQ_VIC1(23) 55#define IRQ_UHOST S5P_IRQ_VIC1(23)
@@ -100,11 +100,12 @@
100#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0)) 100#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
101#define S5P_EINT_BASE2 (IRQ_VIC_END + 1) 101#define S5P_EINT_BASE2 (IRQ_VIC_END + 1)
102 102
103#define S3C_IRQ_GPIO_BASE (IRQ_EINT(31) + 1) 103/* GPIO interrupt */
104#define S3C_IRQ_GPIO(x) (S3C_IRQ_GPIO_BASE + (x)) 104#define S5P_GPIOINT_BASE (IRQ_EINT(31) + 1)
105#define S5P_GPIOINT_GROUP_MAXNR 21
105 106
106/* Until MP04 Groups -> 40 (exactly 39) Groups * 8 ~= 320 GPIOs */ 107/* Set the default NR_IRQS */
107#define NR_IRQS (S3C_IRQ_GPIO(320) + 1) 108#define NR_IRQS (IRQ_EINT(31) + S5P_GPIOINT_COUNT + 1)
108 109
109/* Compatibility */ 110/* Compatibility */
110#define IRQ_LCD_FIFO IRQ_LCD0 111#define IRQ_LCD_FIFO IRQ_LCD0
diff --git a/arch/arm/mach-s5pc100/include/mach/map.h b/arch/arm/mach-s5pc100/include/mach/map.h
index 8751ef4a6804..32e9cab5c864 100644
--- a/arch/arm/mach-s5pc100/include/mach/map.h
+++ b/arch/arm/mach-s5pc100/include/mach/map.h
@@ -110,6 +110,8 @@
110#define S5PC100_PA_PCM0 0xF2400000 110#define S5PC100_PA_PCM0 0xF2400000
111#define S5PC100_PA_PCM1 0xF2500000 111#define S5PC100_PA_PCM1 0xF2500000
112 112
113#define S5PC100_PA_SPDIF 0xF2600000
114
113#define S5PC100_PA_TSADC (0xF3000000) 115#define S5PC100_PA_TSADC (0xF3000000)
114 116
115/* KEYPAD */ 117/* KEYPAD */
diff --git a/arch/arm/mach-s5pc100/include/mach/regs-gpio.h b/arch/arm/mach-s5pc100/include/mach/regs-gpio.h
index dd6295e1251d..0bf73209ec7b 100644
--- a/arch/arm/mach-s5pc100/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s5pc100/include/mach/regs-gpio.h
@@ -11,43 +11,6 @@
11 11
12#include <mach/map.h> 12#include <mach/map.h>
13 13
14/* S5PC100 */
15#define S5PC100_GPIO_BASE S5P_VA_GPIO
16#define S5PC100_GPA0_BASE (S5PC100_GPIO_BASE + 0x0000)
17#define S5PC100_GPA1_BASE (S5PC100_GPIO_BASE + 0x0020)
18#define S5PC100_GPB_BASE (S5PC100_GPIO_BASE + 0x0040)
19#define S5PC100_GPC_BASE (S5PC100_GPIO_BASE + 0x0060)
20#define S5PC100_GPD_BASE (S5PC100_GPIO_BASE + 0x0080)
21#define S5PC100_GPE0_BASE (S5PC100_GPIO_BASE + 0x00A0)
22#define S5PC100_GPE1_BASE (S5PC100_GPIO_BASE + 0x00C0)
23#define S5PC100_GPF0_BASE (S5PC100_GPIO_BASE + 0x00E0)
24#define S5PC100_GPF1_BASE (S5PC100_GPIO_BASE + 0x0100)
25#define S5PC100_GPF2_BASE (S5PC100_GPIO_BASE + 0x0120)
26#define S5PC100_GPF3_BASE (S5PC100_GPIO_BASE + 0x0140)
27#define S5PC100_GPG0_BASE (S5PC100_GPIO_BASE + 0x0160)
28#define S5PC100_GPG1_BASE (S5PC100_GPIO_BASE + 0x0180)
29#define S5PC100_GPG2_BASE (S5PC100_GPIO_BASE + 0x01A0)
30#define S5PC100_GPG3_BASE (S5PC100_GPIO_BASE + 0x01C0)
31#define S5PC100_GPH0_BASE (S5PC100_GPIO_BASE + 0x0C00)
32#define S5PC100_GPH1_BASE (S5PC100_GPIO_BASE + 0x0C20)
33#define S5PC100_GPH2_BASE (S5PC100_GPIO_BASE + 0x0C40)
34#define S5PC100_GPH3_BASE (S5PC100_GPIO_BASE + 0x0C60)
35#define S5PC100_GPI_BASE (S5PC100_GPIO_BASE + 0x01E0)
36#define S5PC100_GPJ0_BASE (S5PC100_GPIO_BASE + 0x0200)
37#define S5PC100_GPJ1_BASE (S5PC100_GPIO_BASE + 0x0220)
38#define S5PC100_GPJ2_BASE (S5PC100_GPIO_BASE + 0x0240)
39#define S5PC100_GPJ3_BASE (S5PC100_GPIO_BASE + 0x0260)
40#define S5PC100_GPJ4_BASE (S5PC100_GPIO_BASE + 0x0280)
41#define S5PC100_GPK0_BASE (S5PC100_GPIO_BASE + 0x02A0)
42#define S5PC100_GPK1_BASE (S5PC100_GPIO_BASE + 0x02C0)
43#define S5PC100_GPK2_BASE (S5PC100_GPIO_BASE + 0x02E0)
44#define S5PC100_GPK3_BASE (S5PC100_GPIO_BASE + 0x0300)
45#define S5PC100_GPL0_BASE (S5PC100_GPIO_BASE + 0x0320)
46#define S5PC100_GPL1_BASE (S5PC100_GPIO_BASE + 0x0340)
47#define S5PC100_GPL2_BASE (S5PC100_GPIO_BASE + 0x0360)
48#define S5PC100_GPL3_BASE (S5PC100_GPIO_BASE + 0x0380)
49#define S5PC100_GPL4_BASE (S5PC100_GPIO_BASE + 0x03A0)
50
51#define S5PC100EINT30CON (S5P_VA_GPIO + 0xE00) 14#define S5PC100EINT30CON (S5P_VA_GPIO + 0xE00)
52#define S5P_EINT_CON(x) (S5PC100EINT30CON + ((x) * 0x4)) 15#define S5P_EINT_CON(x) (S5PC100EINT30CON + ((x) * 0x4))
53 16
@@ -64,12 +27,12 @@
64 27
65#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7)) 28#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
66 29
67/* values for S5P_EXTINT0 */ 30#define EINT_MODE S3C_GPIO_SFN(0x2)
68#define S5P_EXTINT_LOWLEV (0x00) 31
69#define S5P_EXTINT_HILEV (0x01) 32#define EINT_GPIO_0(x) S5PC100_GPH0(x)
70#define S5P_EXTINT_FALLEDGE (0x02) 33#define EINT_GPIO_1(x) S5PC100_GPH1(x)
71#define S5P_EXTINT_RISEEDGE (0x03) 34#define EINT_GPIO_2(x) S5PC100_GPH2(x)
72#define S5P_EXTINT_BOTHEDGE (0x04) 35#define EINT_GPIO_3(x) S5PC100_GPH3(x)
73 36
74#endif /* __ASM_MACH_S5PC100_REGS_GPIO_H */ 37#endif /* __ASM_MACH_S5PC100_REGS_GPIO_H */
75 38
diff --git a/arch/arm/mach-s5pc100/include/mach/vmalloc.h b/arch/arm/mach-s5pc100/include/mach/vmalloc.h
index be9df79903ed..44c8e5726d9d 100644
--- a/arch/arm/mach-s5pc100/include/mach/vmalloc.h
+++ b/arch/arm/mach-s5pc100/include/mach/vmalloc.h
@@ -12,6 +12,6 @@
12#ifndef __ASM_ARCH_VMALLOC_H 12#ifndef __ASM_ARCH_VMALLOC_H
13#define __ASM_ARCH_VMALLOC_H 13#define __ASM_ARCH_VMALLOC_H
14 14
15#define VMALLOC_END (0xe0000000UL) 15#define VMALLOC_END 0xF6000000UL
16 16
17#endif /* __ASM_ARCH_VMALLOC_H */ 17#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s5pc100/irq-gpio.c b/arch/arm/mach-s5pc100/irq-gpio.c
deleted file mode 100644
index 2bf86c18bc73..000000000000
--- a/arch/arm/mach-s5pc100/irq-gpio.c
+++ /dev/null
@@ -1,266 +0,0 @@
1/*
2 * arch/arm/mach-s5pc100/irq-gpio.c
3 *
4 * Copyright (C) 2009 Samsung Electronics
5 *
6 * S5PC100 - Interrupt handling for IRQ_GPIO${group}(x)
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/interrupt.h>
15#include <linux/irq.h>
16#include <linux/io.h>
17#include <linux/gpio.h>
18
19#include <mach/map.h>
20#include <plat/gpio-cfg.h>
21
22#define S5P_GPIOREG(x) (S5P_VA_GPIO + (x))
23
24#define CON_OFFSET 0x700
25#define MASK_OFFSET 0x900
26#define PEND_OFFSET 0xA00
27#define CON_OFFSET_2 0xE00
28#define MASK_OFFSET_2 0xF00
29#define PEND_OFFSET_2 0xF40
30
31#define GPIOINT_LEVEL_LOW 0x0
32#define GPIOINT_LEVEL_HIGH 0x1
33#define GPIOINT_EDGE_FALLING 0x2
34#define GPIOINT_EDGE_RISING 0x3
35#define GPIOINT_EDGE_BOTH 0x4
36
37static int group_to_con_offset(int group)
38{
39 return group << 2;
40}
41
42static int group_to_mask_offset(int group)
43{
44 return group << 2;
45}
46
47static int group_to_pend_offset(int group)
48{
49 return group << 2;
50}
51
52static int s5pc100_get_start(unsigned int group)
53{
54 switch (group) {
55 case 0: return S5PC100_GPIO_A0_START;
56 case 1: return S5PC100_GPIO_A1_START;
57 case 2: return S5PC100_GPIO_B_START;
58 case 3: return S5PC100_GPIO_C_START;
59 case 4: return S5PC100_GPIO_D_START;
60 case 5: return S5PC100_GPIO_E0_START;
61 case 6: return S5PC100_GPIO_E1_START;
62 case 7: return S5PC100_GPIO_F0_START;
63 case 8: return S5PC100_GPIO_F1_START;
64 case 9: return S5PC100_GPIO_F2_START;
65 case 10: return S5PC100_GPIO_F3_START;
66 case 11: return S5PC100_GPIO_G0_START;
67 case 12: return S5PC100_GPIO_G1_START;
68 case 13: return S5PC100_GPIO_G2_START;
69 case 14: return S5PC100_GPIO_G3_START;
70 case 15: return S5PC100_GPIO_I_START;
71 case 16: return S5PC100_GPIO_J0_START;
72 case 17: return S5PC100_GPIO_J1_START;
73 case 18: return S5PC100_GPIO_J2_START;
74 case 19: return S5PC100_GPIO_J3_START;
75 case 20: return S5PC100_GPIO_J4_START;
76 default:
77 BUG();
78 }
79
80 return -EINVAL;
81}
82
83static int s5pc100_get_group(unsigned int irq)
84{
85 irq -= S3C_IRQ_GPIO(0);
86
87 switch (irq) {
88 case S5PC100_GPIO_A0_START ... S5PC100_GPIO_A1_START - 1:
89 return 0;
90 case S5PC100_GPIO_A1_START ... S5PC100_GPIO_B_START - 1:
91 return 1;
92 case S5PC100_GPIO_B_START ... S5PC100_GPIO_C_START - 1:
93 return 2;
94 case S5PC100_GPIO_C_START ... S5PC100_GPIO_D_START - 1:
95 return 3;
96 case S5PC100_GPIO_D_START ... S5PC100_GPIO_E0_START - 1:
97 return 4;
98 case S5PC100_GPIO_E0_START ... S5PC100_GPIO_E1_START - 1:
99 return 5;
100 case S5PC100_GPIO_E1_START ... S5PC100_GPIO_F0_START - 1:
101 return 6;
102 case S5PC100_GPIO_F0_START ... S5PC100_GPIO_F1_START - 1:
103 return 7;
104 case S5PC100_GPIO_F1_START ... S5PC100_GPIO_F2_START - 1:
105 return 8;
106 case S5PC100_GPIO_F2_START ... S5PC100_GPIO_F3_START - 1:
107 return 9;
108 case S5PC100_GPIO_F3_START ... S5PC100_GPIO_G0_START - 1:
109 return 10;
110 case S5PC100_GPIO_G0_START ... S5PC100_GPIO_G1_START - 1:
111 return 11;
112 case S5PC100_GPIO_G1_START ... S5PC100_GPIO_G2_START - 1:
113 return 12;
114 case S5PC100_GPIO_G2_START ... S5PC100_GPIO_G3_START - 1:
115 return 13;
116 case S5PC100_GPIO_G3_START ... S5PC100_GPIO_H0_START - 1:
117 return 14;
118 case S5PC100_GPIO_I_START ... S5PC100_GPIO_J0_START - 1:
119 return 15;
120 case S5PC100_GPIO_J0_START ... S5PC100_GPIO_J1_START - 1:
121 return 16;
122 case S5PC100_GPIO_J1_START ... S5PC100_GPIO_J2_START - 1:
123 return 17;
124 case S5PC100_GPIO_J2_START ... S5PC100_GPIO_J3_START - 1:
125 return 18;
126 case S5PC100_GPIO_J3_START ... S5PC100_GPIO_J4_START - 1:
127 return 19;
128 case S5PC100_GPIO_J4_START ... S5PC100_GPIO_K0_START - 1:
129 return 20;
130 default:
131 BUG();
132 }
133
134 return -EINVAL;
135}
136
137static int s5pc100_get_offset(unsigned int irq)
138{
139 struct gpio_chip *chip = get_irq_data(irq);
140 return irq - S3C_IRQ_GPIO(chip->base);
141}
142
143static void s5pc100_gpioint_ack(unsigned int irq)
144{
145 int group, offset, pend_offset;
146 unsigned int value;
147
148 group = s5pc100_get_group(irq);
149 offset = s5pc100_get_offset(irq);
150 pend_offset = group_to_pend_offset(group);
151
152 value = __raw_readl(S5P_GPIOREG(PEND_OFFSET) + pend_offset);
153 value |= 1 << offset;
154 __raw_writel(value, S5P_GPIOREG(PEND_OFFSET) + pend_offset);
155}
156
157static void s5pc100_gpioint_mask(unsigned int irq)
158{
159 int group, offset, mask_offset;
160 unsigned int value;
161
162 group = s5pc100_get_group(irq);
163 offset = s5pc100_get_offset(irq);
164 mask_offset = group_to_mask_offset(group);
165
166 value = __raw_readl(S5P_GPIOREG(MASK_OFFSET) + mask_offset);
167 value |= 1 << offset;
168 __raw_writel(value, S5P_GPIOREG(MASK_OFFSET) + mask_offset);
169}
170
171static void s5pc100_gpioint_unmask(unsigned int irq)
172{
173 int group, offset, mask_offset;
174 unsigned int value;
175
176 group = s5pc100_get_group(irq);
177 offset = s5pc100_get_offset(irq);
178 mask_offset = group_to_mask_offset(group);
179
180 value = __raw_readl(S5P_GPIOREG(MASK_OFFSET) + mask_offset);
181 value &= ~(1 << offset);
182 __raw_writel(value, S5P_GPIOREG(MASK_OFFSET) + mask_offset);
183}
184
185static void s5pc100_gpioint_mask_ack(unsigned int irq)
186{
187 s5pc100_gpioint_mask(irq);
188 s5pc100_gpioint_ack(irq);
189}
190
191static int s5pc100_gpioint_set_type(unsigned int irq, unsigned int type)
192{
193 int group, offset, con_offset;
194 unsigned int value;
195
196 group = s5pc100_get_group(irq);
197 offset = s5pc100_get_offset(irq);
198 con_offset = group_to_con_offset(group);
199
200 switch (type) {
201 case IRQ_TYPE_NONE:
202 printk(KERN_WARNING "No irq type\n");
203 return -EINVAL;
204 case IRQ_TYPE_EDGE_RISING:
205 type = GPIOINT_EDGE_RISING;
206 break;
207 case IRQ_TYPE_EDGE_FALLING:
208 type = GPIOINT_EDGE_FALLING;
209 break;
210 case IRQ_TYPE_EDGE_BOTH:
211 type = GPIOINT_EDGE_BOTH;
212 break;
213 case IRQ_TYPE_LEVEL_HIGH:
214 type = GPIOINT_LEVEL_HIGH;
215 break;
216 case IRQ_TYPE_LEVEL_LOW:
217 type = GPIOINT_LEVEL_LOW;
218 break;
219 default:
220 BUG();
221 }
222
223
224 value = __raw_readl(S5P_GPIOREG(CON_OFFSET) + con_offset);
225 value &= ~(0xf << (offset * 0x4));
226 value |= (type << (offset * 0x4));
227 __raw_writel(value, S5P_GPIOREG(CON_OFFSET) + con_offset);
228
229 return 0;
230}
231
232struct irq_chip s5pc100_gpioint = {
233 .name = "GPIO",
234 .ack = s5pc100_gpioint_ack,
235 .mask = s5pc100_gpioint_mask,
236 .mask_ack = s5pc100_gpioint_mask_ack,
237 .unmask = s5pc100_gpioint_unmask,
238 .set_type = s5pc100_gpioint_set_type,
239};
240
241void s5pc100_irq_gpioint_handler(unsigned int irq, struct irq_desc *desc)
242{
243 int group, offset, pend_offset, mask_offset;
244 int real_irq, group_end;
245 unsigned int pend, mask;
246
247 group_end = 21;
248
249 for (group = 0; group < group_end; group++) {
250 pend_offset = group_to_pend_offset(group);
251 pend = __raw_readl(S5P_GPIOREG(PEND_OFFSET) + pend_offset);
252 if (!pend)
253 continue;
254
255 mask_offset = group_to_mask_offset(group);
256 mask = __raw_readl(S5P_GPIOREG(MASK_OFFSET) + mask_offset);
257 pend &= ~mask;
258
259 for (offset = 0; offset < 8; offset++) {
260 if (pend & (1 << offset)) {
261 real_irq = s5pc100_get_start(group) + offset;
262 generic_handle_irq(S3C_IRQ_GPIO(real_irq));
263 }
264 }
265 }
266}
diff --git a/arch/arm/mach-s5pc100/mach-smdkc100.c b/arch/arm/mach-s5pc100/mach-smdkc100.c
index 880fb075092c..18b405d514d6 100644
--- a/arch/arm/mach-s5pc100/mach-smdkc100.c
+++ b/arch/arm/mach-s5pc100/mach-smdkc100.c
@@ -47,6 +47,7 @@
47#include <plat/adc.h> 47#include <plat/adc.h>
48#include <plat/keypad.h> 48#include <plat/keypad.h>
49#include <plat/ts.h> 49#include <plat/ts.h>
50#include <plat/audio.h>
50 51
51/* Following are default values for UCON, ULCON and UFCON UART registers */ 52/* Following are default values for UCON, ULCON and UFCON UART registers */
52#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 53#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -196,6 +197,7 @@ static struct platform_device *smdkc100_devices[] __initdata = {
196 &s5p_device_fimc0, 197 &s5p_device_fimc0,
197 &s5p_device_fimc1, 198 &s5p_device_fimc1,
198 &s5p_device_fimc2, 199 &s5p_device_fimc2,
200 &s5pc100_device_spdif,
199}; 201};
200 202
201static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { 203static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
@@ -226,6 +228,8 @@ static void __init smdkc100_machine_init(void)
226 228
227 samsung_keypad_set_platdata(&smdkc100_keypad_data); 229 samsung_keypad_set_platdata(&smdkc100_keypad_data);
228 230
231 s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD);
232
229 /* LCD init */ 233 /* LCD init */
230 gpio_request(S5PC100_GPD(0), "GPD"); 234 gpio_request(S5PC100_GPD(0), "GPD");
231 gpio_request(S5PC100_GPH0(6), "GPH0"); 235 gpio_request(S5PC100_GPH0(6), "GPH0");
diff --git a/arch/arm/mach-s5pc100/setup-fb-24bpp.c b/arch/arm/mach-s5pc100/setup-fb-24bpp.c
index 6eba6cb8e2f4..d31c0f3fe222 100644
--- a/arch/arm/mach-s5pc100/setup-fb-24bpp.c
+++ b/arch/arm/mach-s5pc100/setup-fb-24bpp.c
@@ -22,27 +22,15 @@
22 22
23#define DISR_OFFSET 0x7008 23#define DISR_OFFSET 0x7008
24 24
25void s5pc100_fb_gpio_setup_24bpp(void) 25static void s5pc100_fb_setgpios(unsigned int base, unsigned int nr)
26{ 26{
27 unsigned int gpio = 0; 27 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(2));
28 28}
29 for (gpio = S5PC100_GPF0(0); gpio <= S5PC100_GPF0(7); gpio++) {
30 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
31 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
32 }
33
34 for (gpio = S5PC100_GPF1(0); gpio <= S5PC100_GPF1(7); gpio++) {
35 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
36 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
37 }
38
39 for (gpio = S5PC100_GPF2(0); gpio <= S5PC100_GPF2(7); gpio++) {
40 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
41 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
42 }
43 29
44 for (gpio = S5PC100_GPF3(0); gpio <= S5PC100_GPF3(3); gpio++) { 30void s5pc100_fb_gpio_setup_24bpp(void)
45 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); 31{
46 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); 32 s5pc100_fb_setgpios(S5PC100_GPF0(0), 8);
47 } 33 s5pc100_fb_setgpios(S5PC100_GPF1(0), 8);
34 s5pc100_fb_setgpios(S5PC100_GPF2(0), 8);
35 s5pc100_fb_setgpios(S5PC100_GPF3(0), 4);
48} 36}
diff --git a/arch/arm/mach-s5pc100/setup-i2c0.c b/arch/arm/mach-s5pc100/setup-i2c0.c
index dd3174e6ecc5..eaef7a3bda49 100644
--- a/arch/arm/mach-s5pc100/setup-i2c0.c
+++ b/arch/arm/mach-s5pc100/setup-i2c0.c
@@ -23,8 +23,6 @@ struct platform_device; /* don't need the contents */
23 23
24void s3c_i2c0_cfg_gpio(struct platform_device *dev) 24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
25{ 25{
26 s3c_gpio_cfgpin(S5PC100_GPD(3), S3C_GPIO_SFN(2)); 26 s3c_gpio_cfgall_range(S5PC100_GPD(3), 2,
27 s3c_gpio_setpull(S5PC100_GPD(3), S3C_GPIO_PULL_UP); 27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5PC100_GPD(4), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5PC100_GPD(4), S3C_GPIO_PULL_UP);
30} 28}
diff --git a/arch/arm/mach-s5pc100/setup-i2c1.c b/arch/arm/mach-s5pc100/setup-i2c1.c
index d1fec26b69ee..aaff74a90dee 100644
--- a/arch/arm/mach-s5pc100/setup-i2c1.c
+++ b/arch/arm/mach-s5pc100/setup-i2c1.c
@@ -23,8 +23,6 @@ struct platform_device; /* don't need the contents */
23 23
24void s3c_i2c1_cfg_gpio(struct platform_device *dev) 24void s3c_i2c1_cfg_gpio(struct platform_device *dev)
25{ 25{
26 s3c_gpio_cfgpin(S5PC100_GPD(5), S3C_GPIO_SFN(2)); 26 s3c_gpio_cfgall_range(S5PC100_GPD(5), 2,
27 s3c_gpio_setpull(S5PC100_GPD(5), S3C_GPIO_PULL_UP); 27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5PC100_GPD(6), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5PC100_GPD(6), S3C_GPIO_PULL_UP);
30} 28}
diff --git a/arch/arm/mach-s5pc100/setup-ide.c b/arch/arm/mach-s5pc100/setup-ide.c
index 83575671fb59..223aae044466 100644
--- a/arch/arm/mach-s5pc100/setup-ide.c
+++ b/arch/arm/mach-s5pc100/setup-ide.c
@@ -17,52 +17,39 @@
17#include <mach/regs-clock.h> 17#include <mach/regs-clock.h>
18#include <plat/gpio-cfg.h> 18#include <plat/gpio-cfg.h>
19 19
20static void s5pc100_ide_cfg_gpios(unsigned int base, unsigned int nr)
21{
22 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(4));
23
24 for (; nr > 0; nr--, base++)
25 s5p_gpio_set_drvstr(base, S5P_GPIO_DRVSTR_LV4);
26}
27
20void s5pc100_ide_setup_gpio(void) 28void s5pc100_ide_setup_gpio(void)
21{ 29{
22 u32 reg; 30 u32 reg;
23 u32 gpio = 0;
24 31
25 /* Independent CF interface, CF chip select configuration */ 32 /* Independent CF interface, CF chip select configuration */
26 reg = readl(S5PC100_MEM_SYS_CFG) & (~0x3f); 33 reg = readl(S5PC100_MEM_SYS_CFG) & (~0x3f);
27 writel(reg | MEM_SYS_CFG_EBI_FIX_PRI_CFCON, S5PC100_MEM_SYS_CFG); 34 writel(reg | MEM_SYS_CFG_EBI_FIX_PRI_CFCON, S5PC100_MEM_SYS_CFG);
28 35
29 /* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, CF_DMACK */ 36 /* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, CF_DMACK */
30 for (gpio = S5PC100_GPJ0(0); gpio <= S5PC100_GPJ0(7); gpio++) { 37 s5pc100_ide_cfg_gpios(S5PC100_GPJ0(0), 8);
31 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
32 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
33 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
34 }
35 38
36 /*CF_Data[0 - 7] */ 39 /*CF_Data[0 - 7] */
37 for (gpio = S5PC100_GPJ2(0); gpio <= S5PC100_GPJ2(7); gpio++) { 40 s5pc100_ide_cfg_gpios(S5PC100_GPJ2(0), 8);
38 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
39 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
40 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
41 }
42 41
43 /* CF_Data[8 - 15] */ 42 /* CF_Data[8 - 15] */
44 for (gpio = S5PC100_GPJ3(0); gpio <= S5PC100_GPJ3(7); gpio++) { 43 s5pc100_ide_cfg_gpios(S5PC100_GPJ3(0), 8);
45 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
46 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
47 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
48 }
49 44
50 /* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */ 45 /* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */
51 for (gpio = S5PC100_GPJ4(0); gpio <= S5PC100_GPJ4(3); gpio++) { 46 s5pc100_ide_cfg_gpios(S5PC100_GPJ4(0), 4);
52 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
53 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
54 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
55 }
56 47
57 /* EBI_OE, EBI_WE */ 48 /* EBI_OE, EBI_WE */
58 for (gpio = S5PC100_GPK0(6); gpio <= S5PC100_GPK0(7); gpio++) 49 s3c_gpio_cfgpin_range(S5PC100_GPK0(6), 2, S3C_GPIO_SFN(0));
59 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0));
60 50
61 /* CF_OE, CF_WE */ 51 /* CF_OE, CF_WE */
62 for (gpio = S5PC100_GPK1(6); gpio <= S5PC100_GPK1(7); gpio++) { 52 s3c_gpio_cfgrange_nopull(S5PC100_GPK1(6), 8, S3C_GPIO_SFN(2));
63 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
64 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
65 }
66 53
67 /* CF_CD */ 54 /* CF_CD */
68 s3c_gpio_cfgpin(S5PC100_GPK3(5), S3C_GPIO_SFN(2)); 55 s3c_gpio_cfgpin(S5PC100_GPK3(5), S3C_GPIO_SFN(2));
diff --git a/arch/arm/mach-s5pc100/setup-keypad.c b/arch/arm/mach-s5pc100/setup-keypad.c
index d0837a72a58e..ada377f0c206 100644
--- a/arch/arm/mach-s5pc100/setup-keypad.c
+++ b/arch/arm/mach-s5pc100/setup-keypad.c
@@ -15,20 +15,9 @@
15 15
16void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) 16void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
17{ 17{
18 unsigned int gpio;
19 unsigned int end;
20
21 /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */ 18 /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
22 end = S5PC100_GPH3(rows); 19 s3c_gpio_cfgrange_nopull(S5PC100_GPH3(0), rows, S3C_GPIO_SFN(3));
23 for (gpio = S5PC100_GPH3(0); gpio < end; gpio++) {
24 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
25 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
26 }
27 20
28 /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */ 21 /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
29 end = S5PC100_GPH2(cols); 22 s3c_gpio_cfgrange_nopull(S5PC100_GPH2(0), cols, S3C_GPIO_SFN(3));
30 for (gpio = S5PC100_GPH2(0); gpio < end; gpio++) {
31 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
32 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
33 }
34} 23}
diff --git a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
index dc7208c639ea..03c02d04c68c 100644
--- a/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s5pc100/setup-sdhci-gpio.c
@@ -25,8 +25,6 @@
25void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 25void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
26{ 26{
27 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 27 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
28 unsigned int gpio;
29 unsigned int end;
30 unsigned int num; 28 unsigned int num;
31 29
32 num = width; 30 num = width;
@@ -34,20 +32,11 @@ void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
34 if (width == 8) 32 if (width == 8)
35 num = width - 2; 33 num = width - 2;
36 34
37 end = S5PC100_GPG0(2 + num);
38
39 /* Set all the necessary GPG0/GPG1 pins to special-function 0 */ 35 /* Set all the necessary GPG0/GPG1 pins to special-function 0 */
40 for (gpio = S5PC100_GPG0(0); gpio < end; gpio++) { 36 s3c_gpio_cfgrange_nopull(S5PC100_GPG0(0), 2 + num, S3C_GPIO_SFN(2));
41 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
42 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
43 }
44 37
45 if (width == 8) { 38 if (width == 8)
46 for (gpio = S5PC100_GPG1(0); gpio <= S5PC100_GPG1(1); gpio++) { 39 s3c_gpio_cfgrange_nopull(S5PC100_GPG1(0), 2, S3C_GPIO_SFN(2));
47 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
48 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
49 }
50 }
51 40
52 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { 41 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
53 s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP); 42 s3c_gpio_setpull(S5PC100_GPG1(2), S3C_GPIO_PULL_UP);
@@ -58,16 +47,9 @@ void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
58void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) 47void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
59{ 48{
60 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 49 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
61 unsigned int gpio;
62 unsigned int end;
63
64 end = S5PC100_GPG2(2 + width);
65 50
66 /* Set all the necessary GPG2 pins to special-function 2 */ 51 /* Set all the necessary GPG2 pins to special-function 2 */
67 for (gpio = S5PC100_GPG2(0); gpio < end; gpio++) { 52 s3c_gpio_cfgrange_nopull(S5PC100_GPG2(0), 2 + width, S3C_GPIO_SFN(2));
68 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
69 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
70 }
71 53
72 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { 54 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
73 s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP); 55 s3c_gpio_setpull(S5PC100_GPG2(6), S3C_GPIO_PULL_UP);
@@ -78,16 +60,9 @@ void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
78void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) 60void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
79{ 61{
80 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 62 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
81 unsigned int gpio;
82 unsigned int end;
83
84 end = S5PC100_GPG3(2 + width);
85 63
86 /* Set all the necessary GPG3 pins to special-function 2 */ 64 /* Set all the necessary GPG3 pins to special-function 2 */
87 for (gpio = S5PC100_GPG3(0); gpio < end; gpio++) { 65 s3c_gpio_cfgrange_nopull(S5PC100_GPG3(0), 2 + width, S3C_GPIO_SFN(2));
88 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
89 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
90 }
91 66
92 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { 67 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
93 s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP); 68 s3c_gpio_setpull(S5PC100_GPG3(6), S3C_GPIO_PULL_UP);
diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig
index 5315fec3db86..862f239a0fdb 100644
--- a/arch/arm/mach-s5pv210/Kconfig
+++ b/arch/arm/mach-s5pv210/Kconfig
@@ -11,9 +11,9 @@ if ARCH_S5PV210
11 11
12config CPU_S5PV210 12config CPU_S5PV210
13 bool 13 bool
14 select PLAT_S5P
15 select S3C_PL330_DMA 14 select S3C_PL330_DMA
16 select S5P_EXT_INT 15 select S5P_EXT_INT
16 select S5PV210_PM if PM
17 help 17 help
18 Enable S5PV210 CPU support 18 Enable S5PV210 CPU support
19 19
@@ -58,7 +58,6 @@ menu "S5PC110 Machines"
58config MACH_AQUILA 58config MACH_AQUILA
59 bool "Aquila" 59 bool "Aquila"
60 select CPU_S5PV210 60 select CPU_S5PV210
61 select ARCH_SPARSEMEM_ENABLE
62 select S3C_DEV_FB 61 select S3C_DEV_FB
63 select S5P_DEV_FIMC0 62 select S5P_DEV_FIMC0
64 select S5P_DEV_FIMC1 63 select S5P_DEV_FIMC1
@@ -75,7 +74,7 @@ config MACH_AQUILA
75config MACH_GONI 74config MACH_GONI
76 bool "GONI" 75 bool "GONI"
77 select CPU_S5PV210 76 select CPU_S5PV210
78 select ARCH_SPARSEMEM_ENABLE 77 select S5P_GPIO_INT
79 select S3C_DEV_FB 78 select S3C_DEV_FB
80 select S5P_DEV_FIMC0 79 select S5P_DEV_FIMC0
81 select S5P_DEV_FIMC1 80 select S5P_DEV_FIMC1
@@ -83,8 +82,15 @@ config MACH_GONI
83 select S3C_DEV_HSMMC 82 select S3C_DEV_HSMMC
84 select S3C_DEV_HSMMC1 83 select S3C_DEV_HSMMC1
85 select S3C_DEV_HSMMC2 84 select S3C_DEV_HSMMC2
85 select S3C_DEV_I2C1
86 select S3C_DEV_I2C2
87 select S3C_DEV_USB_HSOTG
86 select S5P_DEV_ONENAND 88 select S5P_DEV_ONENAND
89 select SAMSUNG_DEV_KEYPAD
87 select S5PV210_SETUP_FB_24BPP 90 select S5PV210_SETUP_FB_24BPP
91 select S5PV210_SETUP_I2C1
92 select S5PV210_SETUP_I2C2
93 select S5PV210_SETUP_KEYPAD
88 select S5PV210_SETUP_SDHCI 94 select S5PV210_SETUP_SDHCI
89 help 95 help
90 Machine support for Samsung GONI board 96 Machine support for Samsung GONI board
@@ -93,7 +99,6 @@ config MACH_GONI
93config MACH_SMDKC110 99config MACH_SMDKC110
94 bool "SMDKC110" 100 bool "SMDKC110"
95 select CPU_S5PV210 101 select CPU_S5PV210
96 select ARCH_SPARSEMEM_ENABLE
97 select S3C_DEV_I2C1 102 select S3C_DEV_I2C1
98 select S3C_DEV_I2C2 103 select S3C_DEV_I2C2
99 select S3C_DEV_RTC 104 select S3C_DEV_RTC
@@ -113,7 +118,6 @@ menu "S5PV210 Machines"
113config MACH_SMDKV210 118config MACH_SMDKV210
114 bool "SMDKV210" 119 bool "SMDKV210"
115 select CPU_S5PV210 120 select CPU_S5PV210
116 select ARCH_SPARSEMEM_ENABLE
117 select S3C_DEV_HSMMC 121 select S3C_DEV_HSMMC
118 select S3C_DEV_HSMMC1 122 select S3C_DEV_HSMMC1
119 select S3C_DEV_HSMMC2 123 select S3C_DEV_HSMMC2
@@ -134,6 +138,29 @@ config MACH_SMDKV210
134 help 138 help
135 Machine support for Samsung SMDKV210 139 Machine support for Samsung SMDKV210
136 140
141config MACH_TORBRECK
142 bool "Torbreck"
143 select CPU_S5PV210
144 select ARCH_SPARSEMEM_ENABLE
145 select S3C_DEV_HSMMC
146 select S3C_DEV_HSMMC1
147 select S3C_DEV_HSMMC2
148 select S3C_DEV_HSMMC3
149 select S3C_DEV_I2C1
150 select S3C_DEV_I2C2
151 select S3C_DEV_RTC
152 select S3C_DEV_WDT
153 select S5PV210_SETUP_I2C1
154 select S5PV210_SETUP_I2C2
155 select S5PV210_SETUP_SDHCI
156 help
157 Machine support for aESOP Torbreck
158
137endmenu 159endmenu
138 160
161config S5PV210_PM
162 bool
163 help
164 Power Management code common to S5PV210
165
139endif 166endif
diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile
index 704548912408..ff1a0db57a2f 100644
--- a/arch/arm/mach-s5pv210/Makefile
+++ b/arch/arm/mach-s5pv210/Makefile
@@ -14,6 +14,8 @@ obj- :=
14 14
15obj-$(CONFIG_CPU_S5PV210) += cpu.o init.o clock.o dma.o gpiolib.o 15obj-$(CONFIG_CPU_S5PV210) += cpu.o init.o clock.o dma.o gpiolib.o
16obj-$(CONFIG_CPU_S5PV210) += setup-i2c0.o 16obj-$(CONFIG_CPU_S5PV210) += setup-i2c0.o
17obj-$(CONFIG_S5PV210_PM) += pm.o sleep.o
18obj-$(CONFIG_CPU_FREQ) += cpufreq.o
17 19
18# machine support 20# machine support
19 21
@@ -21,6 +23,7 @@ obj-$(CONFIG_MACH_AQUILA) += mach-aquila.o
21obj-$(CONFIG_MACH_SMDKV210) += mach-smdkv210.o 23obj-$(CONFIG_MACH_SMDKV210) += mach-smdkv210.o
22obj-$(CONFIG_MACH_SMDKC110) += mach-smdkc110.o 24obj-$(CONFIG_MACH_SMDKC110) += mach-smdkc110.o
23obj-$(CONFIG_MACH_GONI) += mach-goni.o 25obj-$(CONFIG_MACH_GONI) += mach-goni.o
26obj-$(CONFIG_MACH_TORBRECK) += mach-torbreck.o
24 27
25# device support 28# device support
26 29
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index d562670e1b0b..019c3a69b0e4 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -31,6 +31,8 @@
31#include <plat/clock-clksrc.h> 31#include <plat/clock-clksrc.h>
32#include <plat/s5pv210.h> 32#include <plat/s5pv210.h>
33 33
34static unsigned long xtal;
35
34static struct clksrc_clk clk_mout_apll = { 36static struct clksrc_clk clk_mout_apll = {
35 .clk = { 37 .clk = {
36 .name = "mout_apll", 38 .name = "mout_apll",
@@ -259,6 +261,36 @@ static struct clksrc_clk clk_sclk_vpll = {
259 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 }, 261 .reg_src = { .reg = S5P_CLK_SRC0, .shift = 12, .size = 1 },
260}; 262};
261 263
264static struct clk *clkset_moutdmc0src_list[] = {
265 [0] = &clk_sclk_a2m.clk,
266 [1] = &clk_mout_mpll.clk,
267 [2] = NULL,
268 [3] = NULL,
269};
270
271static struct clksrc_sources clkset_moutdmc0src = {
272 .sources = clkset_moutdmc0src_list,
273 .nr_sources = ARRAY_SIZE(clkset_moutdmc0src_list),
274};
275
276static struct clksrc_clk clk_mout_dmc0 = {
277 .clk = {
278 .name = "mout_dmc0",
279 .id = -1,
280 },
281 .sources = &clkset_moutdmc0src,
282 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 24, .size = 2 },
283};
284
285static struct clksrc_clk clk_sclk_dmc0 = {
286 .clk = {
287 .name = "sclk_dmc0",
288 .id = -1,
289 .parent = &clk_mout_dmc0.clk,
290 },
291 .reg_div = { .reg = S5P_CLK_DIV6, .shift = 28, .size = 4 },
292};
293
262static unsigned long s5pv210_clk_imem_get_rate(struct clk *clk) 294static unsigned long s5pv210_clk_imem_get_rate(struct clk *clk)
263{ 295{
264 return clk_get_rate(clk->parent) / 2; 296 return clk_get_rate(clk->parent) / 2;
@@ -268,8 +300,29 @@ static struct clk_ops clk_hclk_imem_ops = {
268 .get_rate = s5pv210_clk_imem_get_rate, 300 .get_rate = s5pv210_clk_imem_get_rate,
269}; 301};
270 302
303static unsigned long s5pv210_clk_fout_apll_get_rate(struct clk *clk)
304{
305 return s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508);
306}
307
308static struct clk_ops clk_fout_apll_ops = {
309 .get_rate = s5pv210_clk_fout_apll_get_rate,
310};
311
271static struct clk init_clocks_disable[] = { 312static struct clk init_clocks_disable[] = {
272 { 313 {
314 .name = "pdma",
315 .id = 0,
316 .parent = &clk_hclk_psys.clk,
317 .enable = s5pv210_clk_ip0_ctrl,
318 .ctrlbit = (1 << 3),
319 }, {
320 .name = "pdma",
321 .id = 1,
322 .parent = &clk_hclk_psys.clk,
323 .enable = s5pv210_clk_ip0_ctrl,
324 .ctrlbit = (1 << 4),
325 }, {
273 .name = "rot", 326 .name = "rot",
274 .id = -1, 327 .id = -1,
275 .parent = &clk_hclk_dsys.clk, 328 .parent = &clk_hclk_dsys.clk,
@@ -431,6 +484,12 @@ static struct clk init_clocks_disable[] = {
431 .parent = &clk_p, 484 .parent = &clk_p,
432 .enable = s5pv210_clk_ip3_ctrl, 485 .enable = s5pv210_clk_ip3_ctrl,
433 .ctrlbit = (1 << 6), 486 .ctrlbit = (1 << 6),
487 }, {
488 .name = "spdif",
489 .id = -1,
490 .parent = &clk_p,
491 .enable = s5pv210_clk_ip3_ctrl,
492 .ctrlbit = (1 << 0),
434 }, 493 },
435}; 494};
436 495
@@ -660,6 +719,53 @@ static struct clksrc_sources clkset_sclk_spdif = {
660 .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list), 719 .nr_sources = ARRAY_SIZE(clkset_sclk_spdif_list),
661}; 720};
662 721
722static int s5pv210_spdif_set_rate(struct clk *clk, unsigned long rate)
723{
724 struct clk *pclk;
725 int ret;
726
727 pclk = clk_get_parent(clk);
728 if (IS_ERR(pclk))
729 return -EINVAL;
730
731 ret = pclk->ops->set_rate(pclk, rate);
732 clk_put(pclk);
733
734 return ret;
735}
736
737static unsigned long s5pv210_spdif_get_rate(struct clk *clk)
738{
739 struct clk *pclk;
740 int rate;
741
742 pclk = clk_get_parent(clk);
743 if (IS_ERR(pclk))
744 return -EINVAL;
745
746 rate = pclk->ops->get_rate(clk);
747 clk_put(pclk);
748
749 return rate;
750}
751
752static struct clk_ops s5pv210_sclk_spdif_ops = {
753 .set_rate = s5pv210_spdif_set_rate,
754 .get_rate = s5pv210_spdif_get_rate,
755};
756
757static struct clksrc_clk clk_sclk_spdif = {
758 .clk = {
759 .name = "sclk_spdif",
760 .id = -1,
761 .enable = s5pv210_clk_mask0_ctrl,
762 .ctrlbit = (1 << 27),
763 .ops = &s5pv210_sclk_spdif_ops,
764 },
765 .sources = &clkset_sclk_spdif,
766 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 },
767};
768
663static struct clk *clkset_group2_list[] = { 769static struct clk *clkset_group2_list[] = {
664 [0] = &clk_ext_xtal_mux, 770 [0] = &clk_ext_xtal_mux,
665 [1] = &clk_xusbxti, 771 [1] = &clk_xusbxti,
@@ -744,15 +850,6 @@ static struct clksrc_clk clksrcs[] = {
744 .sources = &clkset_sclk_mixer, 850 .sources = &clkset_sclk_mixer,
745 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 1 }, 851 .reg_src = { .reg = S5P_CLK_SRC1, .shift = 4, .size = 1 },
746 }, { 852 }, {
747 .clk = {
748 .name = "sclk_spdif",
749 .id = -1,
750 .enable = s5pv210_clk_mask0_ctrl,
751 .ctrlbit = (1 << 27),
752 },
753 .sources = &clkset_sclk_spdif,
754 .reg_src = { .reg = S5P_CLK_SRC6, .shift = 12, .size = 2 },
755 }, {
756 .clk = { 853 .clk = {
757 .name = "sclk_fimc", 854 .name = "sclk_fimc",
758 .id = 0, 855 .id = 0,
@@ -953,12 +1050,93 @@ static struct clksrc_clk *sysclks[] = {
953 &clk_sclk_dac, 1050 &clk_sclk_dac,
954 &clk_sclk_pixel, 1051 &clk_sclk_pixel,
955 &clk_sclk_hdmi, 1052 &clk_sclk_hdmi,
1053 &clk_mout_dmc0,
1054 &clk_sclk_dmc0,
1055 &clk_sclk_audio0,
1056 &clk_sclk_audio1,
1057 &clk_sclk_audio2,
1058 &clk_sclk_spdif,
1059};
1060
1061static u32 epll_div[][6] = {
1062 { 48000000, 0, 48, 3, 3, 0 },
1063 { 96000000, 0, 48, 3, 2, 0 },
1064 { 144000000, 1, 72, 3, 2, 0 },
1065 { 192000000, 0, 48, 3, 1, 0 },
1066 { 288000000, 1, 72, 3, 1, 0 },
1067 { 32750000, 1, 65, 3, 4, 35127 },
1068 { 32768000, 1, 65, 3, 4, 35127 },
1069 { 45158400, 0, 45, 3, 3, 10355 },
1070 { 45000000, 0, 45, 3, 3, 10355 },
1071 { 45158000, 0, 45, 3, 3, 10355 },
1072 { 49125000, 0, 49, 3, 3, 9961 },
1073 { 49152000, 0, 49, 3, 3, 9961 },
1074 { 67737600, 1, 67, 3, 3, 48366 },
1075 { 67738000, 1, 67, 3, 3, 48366 },
1076 { 73800000, 1, 73, 3, 3, 47710 },
1077 { 73728000, 1, 73, 3, 3, 47710 },
1078 { 36000000, 1, 32, 3, 4, 0 },
1079 { 60000000, 1, 60, 3, 3, 0 },
1080 { 72000000, 1, 72, 3, 3, 0 },
1081 { 80000000, 1, 80, 3, 3, 0 },
1082 { 84000000, 0, 42, 3, 2, 0 },
1083 { 50000000, 0, 50, 3, 3, 0 },
1084};
1085
1086static int s5pv210_epll_set_rate(struct clk *clk, unsigned long rate)
1087{
1088 unsigned int epll_con, epll_con_k;
1089 unsigned int i;
1090
1091 /* Return if nothing changed */
1092 if (clk->rate == rate)
1093 return 0;
1094
1095 epll_con = __raw_readl(S5P_EPLL_CON);
1096 epll_con_k = __raw_readl(S5P_EPLL_CON1);
1097
1098 epll_con_k &= ~PLL46XX_KDIV_MASK;
1099 epll_con &= ~(1 << 27 |
1100 PLL46XX_MDIV_MASK << PLL46XX_MDIV_SHIFT |
1101 PLL46XX_PDIV_MASK << PLL46XX_PDIV_SHIFT |
1102 PLL46XX_SDIV_MASK << PLL46XX_SDIV_SHIFT);
1103
1104 for (i = 0; i < ARRAY_SIZE(epll_div); i++) {
1105 if (epll_div[i][0] == rate) {
1106 epll_con_k |= epll_div[i][5] << 0;
1107 epll_con |= (epll_div[i][1] << 27 |
1108 epll_div[i][2] << PLL46XX_MDIV_SHIFT |
1109 epll_div[i][3] << PLL46XX_PDIV_SHIFT |
1110 epll_div[i][4] << PLL46XX_SDIV_SHIFT);
1111 break;
1112 }
1113 }
1114
1115 if (i == ARRAY_SIZE(epll_div)) {
1116 printk(KERN_ERR "%s: Invalid Clock EPLL Frequency\n",
1117 __func__);
1118 return -EINVAL;
1119 }
1120
1121 __raw_writel(epll_con, S5P_EPLL_CON);
1122 __raw_writel(epll_con_k, S5P_EPLL_CON1);
1123
1124 printk(KERN_WARNING "EPLL Rate changes from %lu to %lu\n",
1125 clk->rate, rate);
1126
1127 clk->rate = rate;
1128
1129 return 0;
1130}
1131
1132static struct clk_ops s5pv210_epll_ops = {
1133 .set_rate = s5pv210_epll_set_rate,
1134 .get_rate = s5p_epll_get_rate,
956}; 1135};
957 1136
958void __init_or_cpufreq s5pv210_setup_clocks(void) 1137void __init_or_cpufreq s5pv210_setup_clocks(void)
959{ 1138{
960 struct clk *xtal_clk; 1139 struct clk *xtal_clk;
961 unsigned long xtal;
962 unsigned long vpllsrc; 1140 unsigned long vpllsrc;
963 unsigned long armclk; 1141 unsigned long armclk;
964 unsigned long hclk_msys; 1142 unsigned long hclk_msys;
@@ -974,6 +1152,10 @@ void __init_or_cpufreq s5pv210_setup_clocks(void)
974 unsigned int ptr; 1152 unsigned int ptr;
975 u32 clkdiv0, clkdiv1; 1153 u32 clkdiv0, clkdiv1;
976 1154
1155 /* Set functions for clk_fout_epll */
1156 clk_fout_epll.enable = s5p_epll_enable;
1157 clk_fout_epll.ops = &s5pv210_epll_ops;
1158
977 printk(KERN_DEBUG "%s: registering clocks\n", __func__); 1159 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
978 1160
979 clkdiv0 = __raw_readl(S5P_CLK_DIV0); 1161 clkdiv0 = __raw_readl(S5P_CLK_DIV0);
@@ -992,11 +1174,12 @@ void __init_or_cpufreq s5pv210_setup_clocks(void)
992 1174
993 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508); 1175 apll = s5p_get_pll45xx(xtal, __raw_readl(S5P_APLL_CON), pll_4508);
994 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502); 1176 mpll = s5p_get_pll45xx(xtal, __raw_readl(S5P_MPLL_CON), pll_4502);
995 epll = s5p_get_pll45xx(xtal, __raw_readl(S5P_EPLL_CON), pll_4500); 1177 epll = s5p_get_pll46xx(xtal, __raw_readl(S5P_EPLL_CON),
1178 __raw_readl(S5P_EPLL_CON1), pll_4600);
996 vpllsrc = clk_get_rate(&clk_vpllsrc.clk); 1179 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
997 vpll = s5p_get_pll45xx(vpllsrc, __raw_readl(S5P_VPLL_CON), pll_4502); 1180 vpll = s5p_get_pll45xx(vpllsrc, __raw_readl(S5P_VPLL_CON), pll_4502);
998 1181
999 clk_fout_apll.rate = apll; 1182 clk_fout_apll.ops = &clk_fout_apll_ops;
1000 clk_fout_mpll.rate = mpll; 1183 clk_fout_mpll.rate = mpll;
1001 clk_fout_epll.rate = epll; 1184 clk_fout_epll.rate = epll;
1002 clk_fout_vpll.rate = vpll; 1185 clk_fout_vpll.rate = vpll;
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c
index 2f16bfc0a116..8eb480e201b0 100644
--- a/arch/arm/mach-s5pv210/cpu.c
+++ b/arch/arm/mach-s5pv210/cpu.c
@@ -85,6 +85,21 @@ static struct map_desc s5pv210_iodesc[] __initdata = {
85 .pfn = __phys_to_pfn(S5PV210_PA_SROMC), 85 .pfn = __phys_to_pfn(S5PV210_PA_SROMC),
86 .length = SZ_4K, 86 .length = SZ_4K,
87 .type = MT_DEVICE, 87 .type = MT_DEVICE,
88 }, {
89 .virtual = (unsigned long)S5P_VA_DMC0,
90 .pfn = __phys_to_pfn(S5PV210_PA_DMC0),
91 .length = SZ_4K,
92 .type = MT_DEVICE,
93 }, {
94 .virtual = (unsigned long)S5P_VA_DMC1,
95 .pfn = __phys_to_pfn(S5PV210_PA_DMC1),
96 .length = SZ_4K,
97 .type = MT_DEVICE,
98 }, {
99 .virtual = (unsigned long)S3C_VA_USB_HSPHY,
100 .pfn =__phys_to_pfn(S5PV210_PA_HSPHY),
101 .length = SZ_4K,
102 .type = MT_DEVICE,
88 } 103 }
89}; 104};
90 105
diff --git a/arch/arm/mach-s5pv210/cpufreq.c b/arch/arm/mach-s5pv210/cpufreq.c
new file mode 100644
index 000000000000..a6f22920a2c2
--- /dev/null
+++ b/arch/arm/mach-s5pv210/cpufreq.c
@@ -0,0 +1,484 @@
1/* linux/arch/arm/mach-s5pv210/cpufreq.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * CPU frequency scaling for S5PC110/S5PV210
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/types.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/err.h>
17#include <linux/clk.h>
18#include <linux/io.h>
19#include <linux/cpufreq.h>
20
21#include <mach/map.h>
22#include <mach/regs-clock.h>
23
24static struct clk *cpu_clk;
25static struct clk *dmc0_clk;
26static struct clk *dmc1_clk;
27static struct cpufreq_freqs freqs;
28
29/* APLL M,P,S values for 1G/800Mhz */
30#define APLL_VAL_1000 ((1 << 31) | (125 << 16) | (3 << 8) | 1)
31#define APLL_VAL_800 ((1 << 31) | (100 << 16) | (3 << 8) | 1)
32
33/*
34 * DRAM configurations to calculate refresh counter for changing
35 * frequency of memory.
36 */
37struct dram_conf {
38 unsigned long freq; /* HZ */
39 unsigned long refresh; /* DRAM refresh counter * 1000 */
40};
41
42/* DRAM configuration (DMC0 and DMC1) */
43static struct dram_conf s5pv210_dram_conf[2];
44
45enum perf_level {
46 L0, L1, L2, L3, L4,
47};
48
49enum s5pv210_mem_type {
50 LPDDR = 0x1,
51 LPDDR2 = 0x2,
52 DDR2 = 0x4,
53};
54
55enum s5pv210_dmc_port {
56 DMC0 = 0,
57 DMC1,
58};
59
60static struct cpufreq_frequency_table s5pv210_freq_table[] = {
61 {L0, 1000*1000},
62 {L1, 800*1000},
63 {L2, 400*1000},
64 {L3, 200*1000},
65 {L4, 100*1000},
66 {0, CPUFREQ_TABLE_END},
67};
68
69static u32 clkdiv_val[5][11] = {
70 /*
71 * Clock divider value for following
72 * { APLL, A2M, HCLK_MSYS, PCLK_MSYS,
73 * HCLK_DSYS, PCLK_DSYS, HCLK_PSYS, PCLK_PSYS,
74 * ONEDRAM, MFC, G3D }
75 */
76
77 /* L0 : [1000/200/100][166/83][133/66][200/200] */
78 {0, 4, 4, 1, 3, 1, 4, 1, 3, 0, 0},
79
80 /* L1 : [800/200/100][166/83][133/66][200/200] */
81 {0, 3, 3, 1, 3, 1, 4, 1, 3, 0, 0},
82
83 /* L2 : [400/200/100][166/83][133/66][200/200] */
84 {1, 3, 1, 1, 3, 1, 4, 1, 3, 0, 0},
85
86 /* L3 : [200/200/100][166/83][133/66][200/200] */
87 {3, 3, 1, 1, 3, 1, 4, 1, 3, 0, 0},
88
89 /* L4 : [100/100/100][83/83][66/66][100/100] */
90 {7, 7, 0, 0, 7, 0, 9, 0, 7, 0, 0},
91};
92
93/*
94 * This function set DRAM refresh counter
95 * accoriding to operating frequency of DRAM
96 * ch: DMC port number 0 or 1
97 * freq: Operating frequency of DRAM(KHz)
98 */
99static void s5pv210_set_refresh(enum s5pv210_dmc_port ch, unsigned long freq)
100{
101 unsigned long tmp, tmp1;
102 void __iomem *reg = NULL;
103
104 if (ch == DMC0)
105 reg = (S5P_VA_DMC0 + 0x30);
106 else if (ch == DMC1)
107 reg = (S5P_VA_DMC1 + 0x30);
108 else
109 printk(KERN_ERR "Cannot find DMC port\n");
110
111 /* Find current DRAM frequency */
112 tmp = s5pv210_dram_conf[ch].freq;
113
114 do_div(tmp, freq);
115
116 tmp1 = s5pv210_dram_conf[ch].refresh;
117
118 do_div(tmp1, tmp);
119
120 __raw_writel(tmp1, reg);
121}
122
123int s5pv210_verify_speed(struct cpufreq_policy *policy)
124{
125 if (policy->cpu)
126 return -EINVAL;
127
128 return cpufreq_frequency_table_verify(policy, s5pv210_freq_table);
129}
130
131unsigned int s5pv210_getspeed(unsigned int cpu)
132{
133 if (cpu)
134 return 0;
135
136 return clk_get_rate(cpu_clk) / 1000;
137}
138
139static int s5pv210_target(struct cpufreq_policy *policy,
140 unsigned int target_freq,
141 unsigned int relation)
142{
143 unsigned long reg;
144 unsigned int index, priv_index;
145 unsigned int pll_changing = 0;
146 unsigned int bus_speed_changing = 0;
147
148 freqs.old = s5pv210_getspeed(0);
149
150 if (cpufreq_frequency_table_target(policy, s5pv210_freq_table,
151 target_freq, relation, &index))
152 return -EINVAL;
153
154 freqs.new = s5pv210_freq_table[index].frequency;
155 freqs.cpu = 0;
156
157 if (freqs.new == freqs.old)
158 return 0;
159
160 /* Finding current running level index */
161 if (cpufreq_frequency_table_target(policy, s5pv210_freq_table,
162 freqs.old, relation, &priv_index))
163 return -EINVAL;
164
165 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
166
167 if (freqs.new > freqs.old) {
168 /* Voltage up: will be implemented */
169 }
170
171 /* Check if there need to change PLL */
172 if ((index == L0) || (priv_index == L0))
173 pll_changing = 1;
174
175 /* Check if there need to change System bus clock */
176 if ((index == L4) || (priv_index == L4))
177 bus_speed_changing = 1;
178
179 if (bus_speed_changing) {
180 /*
181 * Reconfigure DRAM refresh counter value for minimum
182 * temporary clock while changing divider.
183 * expected clock is 83Mhz : 7.8usec/(1/83Mhz) = 0x287
184 */
185 if (pll_changing)
186 s5pv210_set_refresh(DMC1, 83000);
187 else
188 s5pv210_set_refresh(DMC1, 100000);
189
190 s5pv210_set_refresh(DMC0, 83000);
191 }
192
193 /*
194 * APLL should be changed in this level
195 * APLL -> MPLL(for stable transition) -> APLL
196 * Some clock source's clock API are not prepared.
197 * Do not use clock API in below code.
198 */
199 if (pll_changing) {
200 /*
201 * 1. Temporary Change divider for MFC and G3D
202 * SCLKA2M(200/1=200)->(200/4=50)Mhz
203 */
204 reg = __raw_readl(S5P_CLK_DIV2);
205 reg &= ~(S5P_CLKDIV2_G3D_MASK | S5P_CLKDIV2_MFC_MASK);
206 reg |= (3 << S5P_CLKDIV2_G3D_SHIFT) |
207 (3 << S5P_CLKDIV2_MFC_SHIFT);
208 __raw_writel(reg, S5P_CLK_DIV2);
209
210 /* For MFC, G3D dividing */
211 do {
212 reg = __raw_readl(S5P_CLKDIV_STAT0);
213 } while (reg & ((1 << 16) | (1 << 17)));
214
215 /*
216 * 2. Change SCLKA2M(200Mhz)to SCLKMPLL in MFC_MUX, G3D MUX
217 * (200/4=50)->(667/4=166)Mhz
218 */
219 reg = __raw_readl(S5P_CLK_SRC2);
220 reg &= ~(S5P_CLKSRC2_G3D_MASK | S5P_CLKSRC2_MFC_MASK);
221 reg |= (1 << S5P_CLKSRC2_G3D_SHIFT) |
222 (1 << S5P_CLKSRC2_MFC_SHIFT);
223 __raw_writel(reg, S5P_CLK_SRC2);
224
225 do {
226 reg = __raw_readl(S5P_CLKMUX_STAT1);
227 } while (reg & ((1 << 7) | (1 << 3)));
228
229 /*
230 * 3. DMC1 refresh count for 133Mhz if (index == L4) is
231 * true refresh counter is already programed in upper
232 * code. 0x287@83Mhz
233 */
234 if (!bus_speed_changing)
235 s5pv210_set_refresh(DMC1, 133000);
236
237 /* 4. SCLKAPLL -> SCLKMPLL */
238 reg = __raw_readl(S5P_CLK_SRC0);
239 reg &= ~(S5P_CLKSRC0_MUX200_MASK);
240 reg |= (0x1 << S5P_CLKSRC0_MUX200_SHIFT);
241 __raw_writel(reg, S5P_CLK_SRC0);
242
243 do {
244 reg = __raw_readl(S5P_CLKMUX_STAT0);
245 } while (reg & (0x1 << 18));
246
247 }
248
249 /* Change divider */
250 reg = __raw_readl(S5P_CLK_DIV0);
251
252 reg &= ~(S5P_CLKDIV0_APLL_MASK | S5P_CLKDIV0_A2M_MASK |
253 S5P_CLKDIV0_HCLK200_MASK | S5P_CLKDIV0_PCLK100_MASK |
254 S5P_CLKDIV0_HCLK166_MASK | S5P_CLKDIV0_PCLK83_MASK |
255 S5P_CLKDIV0_HCLK133_MASK | S5P_CLKDIV0_PCLK66_MASK);
256
257 reg |= ((clkdiv_val[index][0] << S5P_CLKDIV0_APLL_SHIFT) |
258 (clkdiv_val[index][1] << S5P_CLKDIV0_A2M_SHIFT) |
259 (clkdiv_val[index][2] << S5P_CLKDIV0_HCLK200_SHIFT) |
260 (clkdiv_val[index][3] << S5P_CLKDIV0_PCLK100_SHIFT) |
261 (clkdiv_val[index][4] << S5P_CLKDIV0_HCLK166_SHIFT) |
262 (clkdiv_val[index][5] << S5P_CLKDIV0_PCLK83_SHIFT) |
263 (clkdiv_val[index][6] << S5P_CLKDIV0_HCLK133_SHIFT) |
264 (clkdiv_val[index][7] << S5P_CLKDIV0_PCLK66_SHIFT));
265
266 __raw_writel(reg, S5P_CLK_DIV0);
267
268 do {
269 reg = __raw_readl(S5P_CLKDIV_STAT0);
270 } while (reg & 0xff);
271
272 /* ARM MCS value changed */
273 reg = __raw_readl(S5P_ARM_MCS_CON);
274 reg &= ~0x3;
275 if (index >= L3)
276 reg |= 0x3;
277 else
278 reg |= 0x1;
279
280 __raw_writel(reg, S5P_ARM_MCS_CON);
281
282 if (pll_changing) {
283 /* 5. Set Lock time = 30us*24Mhz = 0x2cf */
284 __raw_writel(0x2cf, S5P_APLL_LOCK);
285
286 /*
287 * 6. Turn on APLL
288 * 6-1. Set PMS values
289 * 6-2. Wait untile the PLL is locked
290 */
291 if (index == L0)
292 __raw_writel(APLL_VAL_1000, S5P_APLL_CON);
293 else
294 __raw_writel(APLL_VAL_800, S5P_APLL_CON);
295
296 do {
297 reg = __raw_readl(S5P_APLL_CON);
298 } while (!(reg & (0x1 << 29)));
299
300 /*
301 * 7. Change souce clock from SCLKMPLL(667Mhz)
302 * to SCLKA2M(200Mhz) in MFC_MUX and G3D MUX
303 * (667/4=166)->(200/4=50)Mhz
304 */
305 reg = __raw_readl(S5P_CLK_SRC2);
306 reg &= ~(S5P_CLKSRC2_G3D_MASK | S5P_CLKSRC2_MFC_MASK);
307 reg |= (0 << S5P_CLKSRC2_G3D_SHIFT) |
308 (0 << S5P_CLKSRC2_MFC_SHIFT);
309 __raw_writel(reg, S5P_CLK_SRC2);
310
311 do {
312 reg = __raw_readl(S5P_CLKMUX_STAT1);
313 } while (reg & ((1 << 7) | (1 << 3)));
314
315 /*
316 * 8. Change divider for MFC and G3D
317 * (200/4=50)->(200/1=200)Mhz
318 */
319 reg = __raw_readl(S5P_CLK_DIV2);
320 reg &= ~(S5P_CLKDIV2_G3D_MASK | S5P_CLKDIV2_MFC_MASK);
321 reg |= (clkdiv_val[index][10] << S5P_CLKDIV2_G3D_SHIFT) |
322 (clkdiv_val[index][9] << S5P_CLKDIV2_MFC_SHIFT);
323 __raw_writel(reg, S5P_CLK_DIV2);
324
325 /* For MFC, G3D dividing */
326 do {
327 reg = __raw_readl(S5P_CLKDIV_STAT0);
328 } while (reg & ((1 << 16) | (1 << 17)));
329
330 /* 9. Change MPLL to APLL in MSYS_MUX */
331 reg = __raw_readl(S5P_CLK_SRC0);
332 reg &= ~(S5P_CLKSRC0_MUX200_MASK);
333 reg |= (0x0 << S5P_CLKSRC0_MUX200_SHIFT);
334 __raw_writel(reg, S5P_CLK_SRC0);
335
336 do {
337 reg = __raw_readl(S5P_CLKMUX_STAT0);
338 } while (reg & (0x1 << 18));
339
340 /*
341 * 10. DMC1 refresh counter
342 * L4 : DMC1 = 100Mhz 7.8us/(1/100) = 0x30c
343 * Others : DMC1 = 200Mhz 7.8us/(1/200) = 0x618
344 */
345 if (!bus_speed_changing)
346 s5pv210_set_refresh(DMC1, 200000);
347 }
348
349 /*
350 * L4 level need to change memory bus speed, hence onedram clock divier
351 * and memory refresh parameter should be changed
352 */
353 if (bus_speed_changing) {
354 reg = __raw_readl(S5P_CLK_DIV6);
355 reg &= ~S5P_CLKDIV6_ONEDRAM_MASK;
356 reg |= (clkdiv_val[index][8] << S5P_CLKDIV6_ONEDRAM_SHIFT);
357 __raw_writel(reg, S5P_CLK_DIV6);
358
359 do {
360 reg = __raw_readl(S5P_CLKDIV_STAT1);
361 } while (reg & (1 << 15));
362
363 /* Reconfigure DRAM refresh counter value */
364 if (index != L4) {
365 /*
366 * DMC0 : 166Mhz
367 * DMC1 : 200Mhz
368 */
369 s5pv210_set_refresh(DMC0, 166000);
370 s5pv210_set_refresh(DMC1, 200000);
371 } else {
372 /*
373 * DMC0 : 83Mhz
374 * DMC1 : 100Mhz
375 */
376 s5pv210_set_refresh(DMC0, 83000);
377 s5pv210_set_refresh(DMC1, 100000);
378 }
379 }
380
381 if (freqs.new < freqs.old) {
382 /* Voltage down: will be implemented */
383 }
384
385 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
386
387 printk(KERN_DEBUG "Perf changed[L%d]\n", index);
388
389 return 0;
390}
391
392#ifdef CONFIG_PM
393static int s5pv210_cpufreq_suspend(struct cpufreq_policy *policy,
394 pm_message_t pmsg)
395{
396 return 0;
397}
398
399static int s5pv210_cpufreq_resume(struct cpufreq_policy *policy)
400{
401 return 0;
402}
403#endif
404
405static int check_mem_type(void __iomem *dmc_reg)
406{
407 unsigned long val;
408
409 val = __raw_readl(dmc_reg + 0x4);
410 val = (val & (0xf << 8));
411
412 return val >> 8;
413}
414
415static int __init s5pv210_cpu_init(struct cpufreq_policy *policy)
416{
417 unsigned long mem_type;
418
419 cpu_clk = clk_get(NULL, "armclk");
420 if (IS_ERR(cpu_clk))
421 return PTR_ERR(cpu_clk);
422
423 dmc0_clk = clk_get(NULL, "sclk_dmc0");
424 if (IS_ERR(dmc0_clk)) {
425 clk_put(cpu_clk);
426 return PTR_ERR(dmc0_clk);
427 }
428
429 dmc1_clk = clk_get(NULL, "hclk_msys");
430 if (IS_ERR(dmc1_clk)) {
431 clk_put(dmc0_clk);
432 clk_put(cpu_clk);
433 return PTR_ERR(dmc1_clk);
434 }
435
436 if (policy->cpu != 0)
437 return -EINVAL;
438
439 /*
440 * check_mem_type : This driver only support LPDDR & LPDDR2.
441 * other memory type is not supported.
442 */
443 mem_type = check_mem_type(S5P_VA_DMC0);
444
445 if ((mem_type != LPDDR) && (mem_type != LPDDR2)) {
446 printk(KERN_ERR "CPUFreq doesn't support this memory type\n");
447 return -EINVAL;
448 }
449
450 /* Find current refresh counter and frequency each DMC */
451 s5pv210_dram_conf[0].refresh = (__raw_readl(S5P_VA_DMC0 + 0x30) * 1000);
452 s5pv210_dram_conf[0].freq = clk_get_rate(dmc0_clk);
453
454 s5pv210_dram_conf[1].refresh = (__raw_readl(S5P_VA_DMC1 + 0x30) * 1000);
455 s5pv210_dram_conf[1].freq = clk_get_rate(dmc1_clk);
456
457 policy->cur = policy->min = policy->max = s5pv210_getspeed(0);
458
459 cpufreq_frequency_table_get_attr(s5pv210_freq_table, policy->cpu);
460
461 policy->cpuinfo.transition_latency = 40000;
462
463 return cpufreq_frequency_table_cpuinfo(policy, s5pv210_freq_table);
464}
465
466static struct cpufreq_driver s5pv210_driver = {
467 .flags = CPUFREQ_STICKY,
468 .verify = s5pv210_verify_speed,
469 .target = s5pv210_target,
470 .get = s5pv210_getspeed,
471 .init = s5pv210_cpu_init,
472 .name = "s5pv210",
473#ifdef CONFIG_PM
474 .suspend = s5pv210_cpufreq_suspend,
475 .resume = s5pv210_cpufreq_resume,
476#endif
477};
478
479static int __init s5pv210_cpufreq_init(void)
480{
481 return cpufreq_register_driver(&s5pv210_driver);
482}
483
484late_initcall(s5pv210_cpufreq_init);
diff --git a/arch/arm/mach-s5pv210/dev-audio.c b/arch/arm/mach-s5pv210/dev-audio.c
index 21dc6cf955c3..1303fcb12b51 100644
--- a/arch/arm/mach-s5pv210/dev-audio.c
+++ b/arch/arm/mach-s5pv210/dev-audio.c
@@ -24,29 +24,15 @@ static int s5pv210_cfg_i2s(struct platform_device *pdev)
24 /* configure GPIO for i2s port */ 24 /* configure GPIO for i2s port */
25 switch (pdev->id) { 25 switch (pdev->id) {
26 case 1: 26 case 1:
27 s3c_gpio_cfgpin(S5PV210_GPC0(0), S3C_GPIO_SFN(2)); 27 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(2));
28 s3c_gpio_cfgpin(S5PV210_GPC0(1), S3C_GPIO_SFN(2));
29 s3c_gpio_cfgpin(S5PV210_GPC0(2), S3C_GPIO_SFN(2));
30 s3c_gpio_cfgpin(S5PV210_GPC0(3), S3C_GPIO_SFN(2));
31 s3c_gpio_cfgpin(S5PV210_GPC0(4), S3C_GPIO_SFN(2));
32 break; 28 break;
33 29
34 case 2: 30 case 2:
35 s3c_gpio_cfgpin(S5PV210_GPC1(0), S3C_GPIO_SFN(4)); 31 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(4));
36 s3c_gpio_cfgpin(S5PV210_GPC1(1), S3C_GPIO_SFN(4));
37 s3c_gpio_cfgpin(S5PV210_GPC1(2), S3C_GPIO_SFN(4));
38 s3c_gpio_cfgpin(S5PV210_GPC1(3), S3C_GPIO_SFN(4));
39 s3c_gpio_cfgpin(S5PV210_GPC1(4), S3C_GPIO_SFN(4));
40 break; 32 break;
41 33
42 case -1: 34 case -1:
43 s3c_gpio_cfgpin(S5PV210_GPI(0), S3C_GPIO_SFN(2)); 35 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 7, S3C_GPIO_SFN(2));
44 s3c_gpio_cfgpin(S5PV210_GPI(1), S3C_GPIO_SFN(2));
45 s3c_gpio_cfgpin(S5PV210_GPI(2), S3C_GPIO_SFN(2));
46 s3c_gpio_cfgpin(S5PV210_GPI(3), S3C_GPIO_SFN(2));
47 s3c_gpio_cfgpin(S5PV210_GPI(4), S3C_GPIO_SFN(2));
48 s3c_gpio_cfgpin(S5PV210_GPI(5), S3C_GPIO_SFN(2));
49 s3c_gpio_cfgpin(S5PV210_GPI(6), S3C_GPIO_SFN(2));
50 break; 36 break;
51 37
52 default: 38 default:
@@ -151,25 +137,13 @@ static int s5pv210_pcm_cfg_gpio(struct platform_device *pdev)
151{ 137{
152 switch (pdev->id) { 138 switch (pdev->id) {
153 case 0: 139 case 0:
154 s3c_gpio_cfgpin(S5PV210_GPI(0), S3C_GPIO_SFN(3)); 140 s3c_gpio_cfgpin_range(S5PV210_GPI(0), 5, S3C_GPIO_SFN(3));
155 s3c_gpio_cfgpin(S5PV210_GPI(1), S3C_GPIO_SFN(3));
156 s3c_gpio_cfgpin(S5PV210_GPI(2), S3C_GPIO_SFN(3));
157 s3c_gpio_cfgpin(S5PV210_GPI(3), S3C_GPIO_SFN(3));
158 s3c_gpio_cfgpin(S5PV210_GPI(4), S3C_GPIO_SFN(3));
159 break; 141 break;
160 case 1: 142 case 1:
161 s3c_gpio_cfgpin(S5PV210_GPC0(0), S3C_GPIO_SFN(3)); 143 s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(3));
162 s3c_gpio_cfgpin(S5PV210_GPC0(1), S3C_GPIO_SFN(3));
163 s3c_gpio_cfgpin(S5PV210_GPC0(2), S3C_GPIO_SFN(3));
164 s3c_gpio_cfgpin(S5PV210_GPC0(3), S3C_GPIO_SFN(3));
165 s3c_gpio_cfgpin(S5PV210_GPC0(4), S3C_GPIO_SFN(3));
166 break; 144 break;
167 case 2: 145 case 2:
168 s3c_gpio_cfgpin(S5PV210_GPC1(0), S3C_GPIO_SFN(2)); 146 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 5, S3C_GPIO_SFN(2));
169 s3c_gpio_cfgpin(S5PV210_GPC1(1), S3C_GPIO_SFN(2));
170 s3c_gpio_cfgpin(S5PV210_GPC1(2), S3C_GPIO_SFN(2));
171 s3c_gpio_cfgpin(S5PV210_GPC1(3), S3C_GPIO_SFN(2));
172 s3c_gpio_cfgpin(S5PV210_GPC1(4), S3C_GPIO_SFN(2));
173 break; 147 break;
174 default: 148 default:
175 printk(KERN_DEBUG "Invalid PCM Controller number!"); 149 printk(KERN_DEBUG "Invalid PCM Controller number!");
@@ -271,13 +245,7 @@ struct platform_device s5pv210_device_pcm2 = {
271 245
272static int s5pv210_ac97_cfg_gpio(struct platform_device *pdev) 246static int s5pv210_ac97_cfg_gpio(struct platform_device *pdev)
273{ 247{
274 s3c_gpio_cfgpin(S5PV210_GPC0(0), S3C_GPIO_SFN(4)); 248 return s3c_gpio_cfgpin_range(S5PV210_GPC0(0), 5, S3C_GPIO_SFN(4));
275 s3c_gpio_cfgpin(S5PV210_GPC0(1), S3C_GPIO_SFN(4));
276 s3c_gpio_cfgpin(S5PV210_GPC0(2), S3C_GPIO_SFN(4));
277 s3c_gpio_cfgpin(S5PV210_GPC0(3), S3C_GPIO_SFN(4));
278 s3c_gpio_cfgpin(S5PV210_GPC0(4), S3C_GPIO_SFN(4));
279
280 return 0;
281} 249}
282 250
283static struct resource s5pv210_ac97_resource[] = { 251static struct resource s5pv210_ac97_resource[] = {
@@ -325,3 +293,43 @@ struct platform_device s5pv210_device_ac97 = {
325 .coherent_dma_mask = DMA_BIT_MASK(32), 293 .coherent_dma_mask = DMA_BIT_MASK(32),
326 }, 294 },
327}; 295};
296
297/* S/PDIF Controller platform_device */
298
299static int s5pv210_spdif_cfg_gpio(struct platform_device *pdev)
300{
301 s3c_gpio_cfgpin_range(S5PV210_GPC1(0), 2, S3C_GPIO_SFN(3));
302
303 return 0;
304}
305
306static struct resource s5pv210_spdif_resource[] = {
307 [0] = {
308 .start = S5PV210_PA_SPDIF,
309 .end = S5PV210_PA_SPDIF + 0x100 - 1,
310 .flags = IORESOURCE_MEM,
311 },
312 [1] = {
313 .start = DMACH_SPDIF,
314 .end = DMACH_SPDIF,
315 .flags = IORESOURCE_DMA,
316 },
317};
318
319static struct s3c_audio_pdata samsung_spdif_pdata = {
320 .cfg_gpio = s5pv210_spdif_cfg_gpio,
321};
322
323static u64 s5pv210_spdif_dmamask = DMA_BIT_MASK(32);
324
325struct platform_device s5pv210_device_spdif = {
326 .name = "samsung-spdif",
327 .id = -1,
328 .num_resources = ARRAY_SIZE(s5pv210_spdif_resource),
329 .resource = s5pv210_spdif_resource,
330 .dev = {
331 .platform_data = &samsung_spdif_pdata,
332 .dma_mask = &s5pv210_spdif_dmamask,
333 .coherent_dma_mask = DMA_BIT_MASK(32),
334 },
335};
diff --git a/arch/arm/mach-s5pv210/dev-spi.c b/arch/arm/mach-s5pv210/dev-spi.c
index 826cdbc43e20..e3249a47e3b1 100644
--- a/arch/arm/mach-s5pv210/dev-spi.c
+++ b/arch/arm/mach-s5pv210/dev-spi.c
@@ -35,23 +35,15 @@ static char *spi_src_clks[] = {
35 */ 35 */
36static int s5pv210_spi_cfg_gpio(struct platform_device *pdev) 36static int s5pv210_spi_cfg_gpio(struct platform_device *pdev)
37{ 37{
38 unsigned int base;
39
38 switch (pdev->id) { 40 switch (pdev->id) {
39 case 0: 41 case 0:
40 s3c_gpio_cfgpin(S5PV210_GPB(0), S3C_GPIO_SFN(2)); 42 base = S5PV210_GPB(0);
41 s3c_gpio_cfgpin(S5PV210_GPB(1), S3C_GPIO_SFN(2));
42 s3c_gpio_cfgpin(S5PV210_GPB(2), S3C_GPIO_SFN(2));
43 s3c_gpio_setpull(S5PV210_GPB(0), S3C_GPIO_PULL_UP);
44 s3c_gpio_setpull(S5PV210_GPB(1), S3C_GPIO_PULL_UP);
45 s3c_gpio_setpull(S5PV210_GPB(2), S3C_GPIO_PULL_UP);
46 break; 43 break;
47 44
48 case 1: 45 case 1:
49 s3c_gpio_cfgpin(S5PV210_GPB(4), S3C_GPIO_SFN(2)); 46 base = S5PV210_GPB(4);
50 s3c_gpio_cfgpin(S5PV210_GPB(5), S3C_GPIO_SFN(2));
51 s3c_gpio_cfgpin(S5PV210_GPB(6), S3C_GPIO_SFN(2));
52 s3c_gpio_setpull(S5PV210_GPB(4), S3C_GPIO_PULL_UP);
53 s3c_gpio_setpull(S5PV210_GPB(5), S3C_GPIO_PULL_UP);
54 s3c_gpio_setpull(S5PV210_GPB(6), S3C_GPIO_PULL_UP);
55 break; 47 break;
56 48
57 default: 49 default:
@@ -59,6 +51,9 @@ static int s5pv210_spi_cfg_gpio(struct platform_device *pdev)
59 return -EINVAL; 51 return -EINVAL;
60 } 52 }
61 53
54 s3c_gpio_cfgall_range(base, 3,
55 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
56
62 return 0; 57 return 0;
63} 58}
64 59
diff --git a/arch/arm/mach-s5pv210/dma.c b/arch/arm/mach-s5pv210/dma.c
index 778ad5fe231a..497d3439a142 100644
--- a/arch/arm/mach-s5pv210/dma.c
+++ b/arch/arm/mach-s5pv210/dma.c
@@ -82,7 +82,7 @@ static struct s3c_pl330_platdata s5pv210_pdma0_pdata = {
82 82
83static struct platform_device s5pv210_device_pdma0 = { 83static struct platform_device s5pv210_device_pdma0 = {
84 .name = "s3c-pl330", 84 .name = "s3c-pl330",
85 .id = 1, 85 .id = 0,
86 .num_resources = ARRAY_SIZE(s5pv210_pdma0_resource), 86 .num_resources = ARRAY_SIZE(s5pv210_pdma0_resource),
87 .resource = s5pv210_pdma0_resource, 87 .resource = s5pv210_pdma0_resource,
88 .dev = { 88 .dev = {
@@ -144,7 +144,7 @@ static struct s3c_pl330_platdata s5pv210_pdma1_pdata = {
144 144
145static struct platform_device s5pv210_device_pdma1 = { 145static struct platform_device s5pv210_device_pdma1 = {
146 .name = "s3c-pl330", 146 .name = "s3c-pl330",
147 .id = 2, 147 .id = 1,
148 .num_resources = ARRAY_SIZE(s5pv210_pdma1_resource), 148 .num_resources = ARRAY_SIZE(s5pv210_pdma1_resource),
149 .resource = s5pv210_pdma1_resource, 149 .resource = s5pv210_pdma1_resource,
150 .dev = { 150 .dev = {
diff --git a/arch/arm/mach-s5pv210/gpiolib.c b/arch/arm/mach-s5pv210/gpiolib.c
index 0d459112d039..ab673effd767 100644
--- a/arch/arm/mach-s5pv210/gpiolib.c
+++ b/arch/arm/mach-s5pv210/gpiolib.c
@@ -150,6 +150,7 @@ static struct s3c_gpio_chip s5pv210_gpio_4bit[] = {
150 .label = "GPG3", 150 .label = "GPG3",
151 }, 151 },
152 }, { 152 }, {
153 .config = &gpio_cfg_noint,
153 .chip = { 154 .chip = {
154 .base = S5PV210_GPI(0), 155 .base = S5PV210_GPI(0),
155 .ngpio = S5PV210_GPIO_I_NR, 156 .ngpio = S5PV210_GPIO_I_NR,
@@ -223,34 +224,42 @@ static struct s3c_gpio_chip s5pv210_gpio_4bit[] = {
223 }, { 224 }, {
224 .base = (S5P_VA_GPIO + 0xC00), 225 .base = (S5P_VA_GPIO + 0xC00),
225 .config = &gpio_cfg_noint, 226 .config = &gpio_cfg_noint,
227 .irq_base = IRQ_EINT(0),
226 .chip = { 228 .chip = {
227 .base = S5PV210_GPH0(0), 229 .base = S5PV210_GPH0(0),
228 .ngpio = S5PV210_GPIO_H0_NR, 230 .ngpio = S5PV210_GPIO_H0_NR,
229 .label = "GPH0", 231 .label = "GPH0",
232 .to_irq = samsung_gpiolib_to_irq,
230 }, 233 },
231 }, { 234 }, {
232 .base = (S5P_VA_GPIO + 0xC20), 235 .base = (S5P_VA_GPIO + 0xC20),
233 .config = &gpio_cfg_noint, 236 .config = &gpio_cfg_noint,
237 .irq_base = IRQ_EINT(8),
234 .chip = { 238 .chip = {
235 .base = S5PV210_GPH1(0), 239 .base = S5PV210_GPH1(0),
236 .ngpio = S5PV210_GPIO_H1_NR, 240 .ngpio = S5PV210_GPIO_H1_NR,
237 .label = "GPH1", 241 .label = "GPH1",
242 .to_irq = samsung_gpiolib_to_irq,
238 }, 243 },
239 }, { 244 }, {
240 .base = (S5P_VA_GPIO + 0xC40), 245 .base = (S5P_VA_GPIO + 0xC40),
241 .config = &gpio_cfg_noint, 246 .config = &gpio_cfg_noint,
247 .irq_base = IRQ_EINT(16),
242 .chip = { 248 .chip = {
243 .base = S5PV210_GPH2(0), 249 .base = S5PV210_GPH2(0),
244 .ngpio = S5PV210_GPIO_H2_NR, 250 .ngpio = S5PV210_GPIO_H2_NR,
245 .label = "GPH2", 251 .label = "GPH2",
252 .to_irq = samsung_gpiolib_to_irq,
246 }, 253 },
247 }, { 254 }, {
248 .base = (S5P_VA_GPIO + 0xC60), 255 .base = (S5P_VA_GPIO + 0xC60),
249 .config = &gpio_cfg_noint, 256 .config = &gpio_cfg_noint,
257 .irq_base = IRQ_EINT(24),
250 .chip = { 258 .chip = {
251 .base = S5PV210_GPH3(0), 259 .base = S5PV210_GPH3(0),
252 .ngpio = S5PV210_GPIO_H3_NR, 260 .ngpio = S5PV210_GPIO_H3_NR,
253 .label = "GPH3", 261 .label = "GPH3",
262 .to_irq = samsung_gpiolib_to_irq,
254 }, 263 },
255 }, 264 },
256}; 265};
@@ -259,11 +268,14 @@ static __init int s5pv210_gpiolib_init(void)
259{ 268{
260 struct s3c_gpio_chip *chip = s5pv210_gpio_4bit; 269 struct s3c_gpio_chip *chip = s5pv210_gpio_4bit;
261 int nr_chips = ARRAY_SIZE(s5pv210_gpio_4bit); 270 int nr_chips = ARRAY_SIZE(s5pv210_gpio_4bit);
271 int gpioint_group = 0;
262 int i = 0; 272 int i = 0;
263 273
264 for (i = 0; i < nr_chips; i++, chip++) { 274 for (i = 0; i < nr_chips; i++, chip++) {
265 if (chip->config == NULL) 275 if (chip->config == NULL) {
266 chip->config = &gpio_cfg; 276 chip->config = &gpio_cfg;
277 chip->group = gpioint_group++;
278 }
267 if (chip->base == NULL) 279 if (chip->base == NULL)
268 chip->base = S5PV210_BANK_BASE(i); 280 chip->base = S5PV210_BANK_BASE(i);
269 } 281 }
diff --git a/arch/arm/mach-s5pv210/include/mach/irqs.h b/arch/arm/mach-s5pv210/include/mach/irqs.h
index e1c020e5a49b..119b95fdc3ce 100644
--- a/arch/arm/mach-s5pv210/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv210/include/mach/irqs.h
@@ -55,8 +55,8 @@
55#define IRQ_SPI1 S5P_IRQ_VIC1(16) 55#define IRQ_SPI1 S5P_IRQ_VIC1(16)
56#define IRQ_SPI2 S5P_IRQ_VIC1(17) 56#define IRQ_SPI2 S5P_IRQ_VIC1(17)
57#define IRQ_IRDA S5P_IRQ_VIC1(18) 57#define IRQ_IRDA S5P_IRQ_VIC1(18)
58#define IRQ_CAN0 S5P_IRQ_VIC1(19) 58#define IRQ_IIC2 S5P_IRQ_VIC1(19)
59#define IRQ_CAN1 S5P_IRQ_VIC1(20) 59#define IRQ_IIC3 S5P_IRQ_VIC1(20)
60#define IRQ_HSIRX S5P_IRQ_VIC1(21) 60#define IRQ_HSIRX S5P_IRQ_VIC1(21)
61#define IRQ_HSITX S5P_IRQ_VIC1(22) 61#define IRQ_HSITX S5P_IRQ_VIC1(22)
62#define IRQ_UHOST S5P_IRQ_VIC1(23) 62#define IRQ_UHOST S5P_IRQ_VIC1(23)
@@ -109,7 +109,7 @@
109 109
110#define IRQ_IPC S5P_IRQ_VIC3(0) 110#define IRQ_IPC S5P_IRQ_VIC3(0)
111#define IRQ_HOSTIF S5P_IRQ_VIC3(1) 111#define IRQ_HOSTIF S5P_IRQ_VIC3(1)
112#define IRQ_MMC3 S5P_IRQ_VIC3(2) 112#define IRQ_HSMMC3 S5P_IRQ_VIC3(2)
113#define IRQ_CEC S5P_IRQ_VIC3(3) 113#define IRQ_CEC S5P_IRQ_VIC3(3)
114#define IRQ_TSI S5P_IRQ_VIC3(4) 114#define IRQ_TSI S5P_IRQ_VIC3(4)
115#define IRQ_MDNIE0 S5P_IRQ_VIC3(5) 115#define IRQ_MDNIE0 S5P_IRQ_VIC3(5)
@@ -121,8 +121,12 @@
121#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0)) 121#define S5P_EINT_BASE1 (S5P_IRQ_VIC0(0))
122#define S5P_EINT_BASE2 (IRQ_VIC_END + 1) 122#define S5P_EINT_BASE2 (IRQ_VIC_END + 1)
123 123
124/* GPIO interrupt */
125#define S5P_GPIOINT_BASE (IRQ_EINT(31) + 1)
126#define S5P_GPIOINT_GROUP_MAXNR 22
127
124/* Set the default NR_IRQS */ 128/* Set the default NR_IRQS */
125#define NR_IRQS (IRQ_EINT(31) + 1) 129#define NR_IRQS (IRQ_EINT(31) + S5P_GPIOINT_COUNT + 1)
126 130
127/* Compatibility */ 131/* Compatibility */
128#define IRQ_LCD_FIFO IRQ_LCD0 132#define IRQ_LCD_FIFO IRQ_LCD0
diff --git a/arch/arm/mach-s5pv210/include/mach/map.h b/arch/arm/mach-s5pv210/include/mach/map.h
index bd9afd52466a..861d7fe11fc9 100644
--- a/arch/arm/mach-s5pv210/include/mach/map.h
+++ b/arch/arm/mach-s5pv210/include/mach/map.h
@@ -57,6 +57,8 @@
57 57
58#define S5P_SZ_UART SZ_256 58#define S5P_SZ_UART SZ_256
59 59
60#define S3C_VA_UARTx(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
61
60#define S5PV210_PA_SROMC (0xE8000000) 62#define S5PV210_PA_SROMC (0xE8000000)
61 63
62#define S5PV210_PA_CFCON (0xE8200000) 64#define S5PV210_PA_CFCON (0xE8200000)
@@ -73,6 +75,9 @@
73 75
74#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000)) 76#define S5PV210_PA_HSMMC(x) (0xEB000000 + ((x) * 0x100000))
75 77
78#define S5PV210_PA_HSOTG (0xEC000000)
79#define S5PV210_PA_HSPHY (0xEC100000)
80
76#define S5PV210_PA_VIC0 (0xF2000000) 81#define S5PV210_PA_VIC0 (0xF2000000)
77#define S5PV210_PA_VIC1 (0xF2100000) 82#define S5PV210_PA_VIC1 (0xF2100000)
78#define S5PV210_PA_VIC2 (0xF2200000) 83#define S5PV210_PA_VIC2 (0xF2200000)
@@ -81,6 +86,9 @@
81#define S5PV210_PA_SDRAM (0x20000000) 86#define S5PV210_PA_SDRAM (0x20000000)
82#define S5P_PA_SDRAM S5PV210_PA_SDRAM 87#define S5P_PA_SDRAM S5PV210_PA_SDRAM
83 88
89/* S/PDIF */
90#define S5PV210_PA_SPDIF 0xE1100000
91
84/* I2S */ 92/* I2S */
85#define S5PV210_PA_IIS0 0xEEE30000 93#define S5PV210_PA_IIS0 0xEEE30000
86#define S5PV210_PA_IIS1 0xE2100000 94#define S5PV210_PA_IIS1 0xE2100000
@@ -96,6 +104,9 @@
96 104
97#define S5PV210_PA_ADC (0xE1700000) 105#define S5PV210_PA_ADC (0xE1700000)
98 106
107#define S5PV210_PA_DMC0 (0xF0000000)
108#define S5PV210_PA_DMC1 (0xF1400000)
109
99/* compatibiltiy defines. */ 110/* compatibiltiy defines. */
100#define S3C_PA_UART S5PV210_PA_UART 111#define S3C_PA_UART S5PV210_PA_UART
101#define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0) 112#define S3C_PA_HSMMC0 S5PV210_PA_HSMMC(0)
@@ -108,6 +119,7 @@
108#define S3C_PA_FB S5PV210_PA_FB 119#define S3C_PA_FB S5PV210_PA_FB
109#define S3C_PA_RTC S5PV210_PA_RTC 120#define S3C_PA_RTC S5PV210_PA_RTC
110#define S3C_PA_WDT S5PV210_PA_WATCHDOG 121#define S3C_PA_WDT S5PV210_PA_WATCHDOG
122#define S3C_PA_USB_HSOTG S5PV210_PA_HSOTG
111#define S5P_PA_FIMC0 S5PV210_PA_FIMC0 123#define S5P_PA_FIMC0 S5PV210_PA_FIMC0
112#define S5P_PA_FIMC1 S5PV210_PA_FIMC1 124#define S5P_PA_FIMC1 S5PV210_PA_FIMC1
113#define S5P_PA_FIMC2 S5PV210_PA_FIMC2 125#define S5P_PA_FIMC2 S5PV210_PA_FIMC2
diff --git a/arch/arm/mach-s5pv210/include/mach/pm-core.h b/arch/arm/mach-s5pv210/include/mach/pm-core.h
new file mode 100644
index 000000000000..e8d394f8b057
--- /dev/null
+++ b/arch/arm/mach-s5pv210/include/mach/pm-core.h
@@ -0,0 +1,43 @@
1/* linux/arch/arm/mach-s5pv210/include/mach/pm-core.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Based on arch/arm/mach-s3c2410/include/mach/pm-core.h,
7 * Copyright 2008 Simtec Electronics
8 * Ben Dooks <ben@simtec.co.uk>
9 * http://armlinux.simtec.co.uk/
10 *
11 * S5PV210 - PM core support for arch/arm/plat-s5p/pm.c
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
18static inline void s3c_pm_debug_init_uart(void)
19{
20 /* nothing here yet */
21}
22
23static inline void s3c_pm_arch_prepare_irqs(void)
24{
25 __raw_writel(s3c_irqwake_intmask, S5P_WAKEUP_MASK);
26 __raw_writel(s3c_irqwake_eintmask, S5P_EINT_WAKEUP_MASK);
27}
28
29static inline void s3c_pm_arch_stop_clocks(void)
30{
31 /* nothing here yet */
32}
33
34static inline void s3c_pm_arch_show_resume_irqs(void)
35{
36 /* nothing here yet */
37}
38
39static inline void s3c_pm_arch_update_uart(void __iomem *regs,
40 struct pm_uart_save *save)
41{
42 /* nothing here yet */
43}
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-clock.h b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
index 499aef737476..ebaabe021af9 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-clock.h
@@ -25,6 +25,7 @@
25#define S5P_APLL_CON S5P_CLKREG(0x100) 25#define S5P_APLL_CON S5P_CLKREG(0x100)
26#define S5P_MPLL_CON S5P_CLKREG(0x108) 26#define S5P_MPLL_CON S5P_CLKREG(0x108)
27#define S5P_EPLL_CON S5P_CLKREG(0x110) 27#define S5P_EPLL_CON S5P_CLKREG(0x110)
28#define S5P_EPLL_CON1 S5P_CLKREG(0x114)
28#define S5P_VPLL_CON S5P_CLKREG(0x120) 29#define S5P_VPLL_CON S5P_CLKREG(0x120)
29 30
30#define S5P_CLK_SRC0 S5P_CLKREG(0x200) 31#define S5P_CLK_SRC0 S5P_CLKREG(0x200)
@@ -67,11 +68,28 @@
67#define S5P_CLKGATE_BUS1 S5P_CLKREG(0x488) 68#define S5P_CLKGATE_BUS1 S5P_CLKREG(0x488)
68#define S5P_CLK_OUT S5P_CLKREG(0x500) 69#define S5P_CLK_OUT S5P_CLKREG(0x500)
69 70
71/* DIV/MUX STATUS */
72#define S5P_CLKDIV_STAT0 S5P_CLKREG(0x1000)
73#define S5P_CLKDIV_STAT1 S5P_CLKREG(0x1004)
74#define S5P_CLKMUX_STAT0 S5P_CLKREG(0x1100)
75#define S5P_CLKMUX_STAT1 S5P_CLKREG(0x1104)
76
70/* CLKSRC0 */ 77/* CLKSRC0 */
71#define S5P_CLKSRC0_MUX200_MASK (0x1<<16) 78#define S5P_CLKSRC0_MUX200_SHIFT (16)
79#define S5P_CLKSRC0_MUX200_MASK (0x1 << S5P_CLKSRC0_MUX200_SHIFT)
72#define S5P_CLKSRC0_MUX166_MASK (0x1<<20) 80#define S5P_CLKSRC0_MUX166_MASK (0x1<<20)
73#define S5P_CLKSRC0_MUX133_MASK (0x1<<24) 81#define S5P_CLKSRC0_MUX133_MASK (0x1<<24)
74 82
83/* CLKSRC2 */
84#define S5P_CLKSRC2_G3D_SHIFT (0)
85#define S5P_CLKSRC2_G3D_MASK (0x3 << S5P_CLKSRC2_G3D_SHIFT)
86#define S5P_CLKSRC2_MFC_SHIFT (4)
87#define S5P_CLKSRC2_MFC_MASK (0x3 << S5P_CLKSRC2_MFC_SHIFT)
88
89/* CLKSRC6*/
90#define S5P_CLKSRC6_ONEDRAM_SHIFT (24)
91#define S5P_CLKSRC6_ONEDRAM_MASK (0x3 << S5P_CLKSRC6_ONEDRAM_SHIFT)
92
75/* CLKDIV0 */ 93/* CLKDIV0 */
76#define S5P_CLKDIV0_APLL_SHIFT (0) 94#define S5P_CLKDIV0_APLL_SHIFT (0)
77#define S5P_CLKDIV0_APLL_MASK (0x7 << S5P_CLKDIV0_APLL_SHIFT) 95#define S5P_CLKDIV0_APLL_MASK (0x7 << S5P_CLKDIV0_APLL_SHIFT)
@@ -90,12 +108,24 @@
90#define S5P_CLKDIV0_PCLK66_SHIFT (28) 108#define S5P_CLKDIV0_PCLK66_SHIFT (28)
91#define S5P_CLKDIV0_PCLK66_MASK (0x7 << S5P_CLKDIV0_PCLK66_SHIFT) 109#define S5P_CLKDIV0_PCLK66_MASK (0x7 << S5P_CLKDIV0_PCLK66_SHIFT)
92 110
111/* CLKDIV2 */
112#define S5P_CLKDIV2_G3D_SHIFT (0)
113#define S5P_CLKDIV2_G3D_MASK (0xF << S5P_CLKDIV2_G3D_SHIFT)
114#define S5P_CLKDIV2_MFC_SHIFT (4)
115#define S5P_CLKDIV2_MFC_MASK (0xF << S5P_CLKDIV2_MFC_SHIFT)
116
117/* CLKDIV6 */
118#define S5P_CLKDIV6_ONEDRAM_SHIFT (28)
119#define S5P_CLKDIV6_ONEDRAM_MASK (0xF << S5P_CLKDIV6_ONEDRAM_SHIFT)
120
93#define S5P_SWRESET S5P_CLKREG(0x2000) 121#define S5P_SWRESET S5P_CLKREG(0x2000)
94 122
123#define S5P_ARM_MCS_CON S5P_CLKREG(0x6100)
124
95/* Registers related to power management */ 125/* Registers related to power management */
96#define S5P_PWR_CFG S5P_CLKREG(0xC000) 126#define S5P_PWR_CFG S5P_CLKREG(0xC000)
97#define S5P_EINT_WAKEUP_MASK S5P_CLKREG(0xC004) 127#define S5P_EINT_WAKEUP_MASK S5P_CLKREG(0xC004)
98#define S5P_WAKEUP_MASK S5P_CLKREG(0xC008) 128#define S5P_WAKEUP_MASK S5P_CLKREG(0xC008)
99#define S5P_PWR_MODE S5P_CLKREG(0xC00C) 129#define S5P_PWR_MODE S5P_CLKREG(0xC00C)
100#define S5P_NORMAL_CFG S5P_CLKREG(0xC010) 130#define S5P_NORMAL_CFG S5P_CLKREG(0xC010)
101#define S5P_IDLE_CFG S5P_CLKREG(0xC020) 131#define S5P_IDLE_CFG S5P_CLKREG(0xC020)
@@ -159,8 +189,11 @@
159#define S5P_SLEEP_CFG_USBOSC_EN (1 << 1) 189#define S5P_SLEEP_CFG_USBOSC_EN (1 << 1)
160 190
161/* OTHERS Resgister */ 191/* OTHERS Resgister */
192#define S5P_OTHERS_RET_IO (1 << 31)
193#define S5P_OTHERS_RET_CF (1 << 30)
194#define S5P_OTHERS_RET_MMC (1 << 29)
195#define S5P_OTHERS_RET_UART (1 << 28)
162#define S5P_OTHERS_USB_SIG_MASK (1 << 16) 196#define S5P_OTHERS_USB_SIG_MASK (1 << 16)
163#define S5P_OTHERS_MIPI_DPHY_EN (1 << 28)
164 197
165/* MIPI */ 198/* MIPI */
166#define S5P_MIPI_DPHY_EN (3) 199#define S5P_MIPI_DPHY_EN (3)
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-gpio.h b/arch/arm/mach-s5pv210/include/mach/regs-gpio.h
index 49e029b4978a..de0c89976078 100644
--- a/arch/arm/mach-s5pv210/include/mach/regs-gpio.h
+++ b/arch/arm/mach-s5pv210/include/mach/regs-gpio.h
@@ -31,13 +31,6 @@
31 31
32#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7)) 32#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
33 33
34/* values for S5P_EXTINT0 */
35#define S5P_EXTINT_LOWLEV (0x00)
36#define S5P_EXTINT_HILEV (0x01)
37#define S5P_EXTINT_FALLEDGE (0x02)
38#define S5P_EXTINT_RISEEDGE (0x03)
39#define S5P_EXTINT_BOTHEDGE (0x04)
40
41#define EINT_MODE S3C_GPIO_SFN(0xf) 34#define EINT_MODE S3C_GPIO_SFN(0xf)
42 35
43#define EINT_GPIO_0(x) S5PV210_GPH0(x) 36#define EINT_GPIO_0(x) S5PV210_GPH0(x)
diff --git a/arch/arm/mach-s5pv210/include/mach/regs-sys.h b/arch/arm/mach-s5pv210/include/mach/regs-sys.h
new file mode 100644
index 000000000000..26691d39d0f4
--- /dev/null
+++ b/arch/arm/mach-s5pv210/include/mach/regs-sys.h
@@ -0,0 +1,19 @@
1/* arch/arm/mach-s5pv210/include/mach/regs-sys.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV210 - System registers definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#define S5PV210_USB_PHY_CON (S3C_VA_SYS + 0xE80C)
14#define S5PV210_USB_PHY0_EN (1 << 0)
15#define S5PV210_USB_PHY1_EN (1 << 1)
16
17/* compatibility defines for s3c-hsotg driver */
18#define S3C64XX_OTHERS S5PV210_USB_PHY_CON
19#define S3C64XX_OTHERS_USBMASK S5PV210_USB_PHY0_EN
diff --git a/arch/arm/mach-s5pv210/include/mach/vmalloc.h b/arch/arm/mach-s5pv210/include/mach/vmalloc.h
index df9a28808323..a6c659d68a5d 100644
--- a/arch/arm/mach-s5pv210/include/mach/vmalloc.h
+++ b/arch/arm/mach-s5pv210/include/mach/vmalloc.h
@@ -17,6 +17,6 @@
17#ifndef __ASM_ARCH_VMALLOC_H 17#ifndef __ASM_ARCH_VMALLOC_H
18#define __ASM_ARCH_VMALLOC_H __FILE__ 18#define __ASM_ARCH_VMALLOC_H __FILE__
19 19
20#define VMALLOC_END (0xE0000000UL) 20#define VMALLOC_END 0xF6000000UL
21 21
22#endif /* __ASM_ARCH_VMALLOC_H */ 22#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s5pv210/mach-aquila.c b/arch/arm/mach-s5pv210/mach-aquila.c
index 00883087363c..28677caf3613 100644
--- a/arch/arm/mach-s5pv210/mach-aquila.c
+++ b/arch/arm/mach-s5pv210/mach-aquila.c
@@ -16,6 +16,8 @@
16#include <linux/i2c.h> 16#include <linux/i2c.h>
17#include <linux/i2c-gpio.h> 17#include <linux/i2c-gpio.h>
18#include <linux/mfd/max8998.h> 18#include <linux/mfd/max8998.h>
19#include <linux/mfd/wm8994/pdata.h>
20#include <linux/regulator/fixed.h>
19#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
20#include <linux/input.h> 22#include <linux/input.h>
21#include <linux/gpio.h> 23#include <linux/gpio.h>
@@ -379,6 +381,119 @@ static struct max8998_platform_data aquila_max8998_pdata = {
379}; 381};
380#endif 382#endif
381 383
384static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
385 {
386 .dev_name = "5-001a",
387 .supply = "DBVDD",
388 }, {
389 .dev_name = "5-001a",
390 .supply = "AVDD2",
391 }, {
392 .dev_name = "5-001a",
393 .supply = "CPVDD",
394 },
395};
396
397static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
398 {
399 .dev_name = "5-001a",
400 .supply = "SPKVDD1",
401 }, {
402 .dev_name = "5-001a",
403 .supply = "SPKVDD2",
404 },
405};
406
407static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
408 .constraints = {
409 .always_on = 1,
410 },
411 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
412 .consumer_supplies = wm8994_fixed_voltage0_supplies,
413};
414
415static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
416 .constraints = {
417 .always_on = 1,
418 },
419 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
420 .consumer_supplies = wm8994_fixed_voltage1_supplies,
421};
422
423static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
424 .supply_name = "VCC_1.8V_PDA",
425 .microvolts = 1800000,
426 .gpio = -EINVAL,
427 .init_data = &wm8994_fixed_voltage0_init_data,
428};
429
430static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
431 .supply_name = "V_BAT",
432 .microvolts = 3700000,
433 .gpio = -EINVAL,
434 .init_data = &wm8994_fixed_voltage1_init_data,
435};
436
437static struct platform_device wm8994_fixed_voltage0 = {
438 .name = "reg-fixed-voltage",
439 .id = 0,
440 .dev = {
441 .platform_data = &wm8994_fixed_voltage0_config,
442 },
443};
444
445static struct platform_device wm8994_fixed_voltage1 = {
446 .name = "reg-fixed-voltage",
447 .id = 1,
448 .dev = {
449 .platform_data = &wm8994_fixed_voltage1_config,
450 },
451};
452
453static struct regulator_consumer_supply wm8994_avdd1_supply = {
454 .dev_name = "5-001a",
455 .supply = "AVDD1",
456};
457
458static struct regulator_consumer_supply wm8994_dcvdd_supply = {
459 .dev_name = "5-001a",
460 .supply = "DCVDD",
461};
462
463static struct regulator_init_data wm8994_ldo1_data = {
464 .constraints = {
465 .name = "AVDD1_3.0V",
466 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
467 },
468 .num_consumer_supplies = 1,
469 .consumer_supplies = &wm8994_avdd1_supply,
470};
471
472static struct regulator_init_data wm8994_ldo2_data = {
473 .constraints = {
474 .name = "DCVDD_1.0V",
475 },
476 .num_consumer_supplies = 1,
477 .consumer_supplies = &wm8994_dcvdd_supply,
478};
479
480static struct wm8994_pdata wm8994_platform_data = {
481 /* configure gpio1 function: 0x0001(Logic level input/output) */
482 .gpio_defaults[0] = 0x0001,
483 /* configure gpio3/4/5/7 function for AIF2 voice */
484 .gpio_defaults[2] = 0x8100,
485 .gpio_defaults[3] = 0x8100,
486 .gpio_defaults[4] = 0x8100,
487 .gpio_defaults[6] = 0x0100,
488 /* configure gpio8/9/10/11 function for AIF3 BT */
489 .gpio_defaults[7] = 0x8100,
490 .gpio_defaults[8] = 0x0100,
491 .gpio_defaults[9] = 0x0100,
492 .gpio_defaults[10] = 0x0100,
493 .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */
494 .ldo[1] = { 0, NULL, &wm8994_ldo2_data },
495};
496
382/* GPIO I2C PMIC */ 497/* GPIO I2C PMIC */
383#define AP_I2C_GPIO_PMIC_BUS_4 4 498#define AP_I2C_GPIO_PMIC_BUS_4 4
384static struct i2c_gpio_platform_data aquila_i2c_gpio_pmic_data = { 499static struct i2c_gpio_platform_data aquila_i2c_gpio_pmic_data = {
@@ -404,6 +519,29 @@ static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
404#endif 519#endif
405}; 520};
406 521
522/* GPIO I2C AP 1.8V */
523#define AP_I2C_GPIO_BUS_5 5
524static struct i2c_gpio_platform_data aquila_i2c_gpio5_data = {
525 .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */
526 .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */
527};
528
529static struct platform_device aquila_i2c_gpio5 = {
530 .name = "i2c-gpio",
531 .id = AP_I2C_GPIO_BUS_5,
532 .dev = {
533 .platform_data = &aquila_i2c_gpio5_data,
534 },
535};
536
537static struct i2c_board_info i2c_gpio5_devs[] __initdata = {
538 {
539 /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
540 I2C_BOARD_INFO("wm8994", 0x1a),
541 .platform_data = &wm8994_platform_data,
542 },
543};
544
407/* PMIC Power button */ 545/* PMIC Power button */
408static struct gpio_keys_button aquila_gpio_keys_table[] = { 546static struct gpio_keys_button aquila_gpio_keys_table[] = {
409 { 547 {
@@ -475,6 +613,7 @@ static void aquila_setup_sdhci(void)
475 613
476static struct platform_device *aquila_devices[] __initdata = { 614static struct platform_device *aquila_devices[] __initdata = {
477 &aquila_i2c_gpio_pmic, 615 &aquila_i2c_gpio_pmic,
616 &aquila_i2c_gpio5,
478 &aquila_device_gpiokeys, 617 &aquila_device_gpiokeys,
479 &s3c_device_fb, 618 &s3c_device_fb,
480 &s5p_device_onenand, 619 &s5p_device_onenand,
@@ -484,8 +623,33 @@ static struct platform_device *aquila_devices[] __initdata = {
484 &s5p_device_fimc0, 623 &s5p_device_fimc0,
485 &s5p_device_fimc1, 624 &s5p_device_fimc1,
486 &s5p_device_fimc2, 625 &s5p_device_fimc2,
626 &s5pv210_device_iis0,
627 &wm8994_fixed_voltage0,
628 &wm8994_fixed_voltage1,
487}; 629};
488 630
631static void __init aquila_sound_init(void)
632{
633 unsigned int gpio;
634
635 /* CODEC_XTAL_EN
636 *
637 * The Aquila board have a oscillator which provide main clock
638 * to WM8994 codec. The oscillator provide 24MHz clock to WM8994
639 * clock. Set gpio setting of "CODEC_XTAL_EN" to enable a oscillator.
640 * */
641 gpio = S5PV210_GPH3(2); /* XEINT_26 */
642 gpio_request(gpio, "CODEC_XTAL_EN");
643 s3c_gpio_cfgpin(gpio, S3C_GPIO_OUTPUT);
644 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
645
646 /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
647 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
648 * because it needs 24MHz clock to operate WM8994 codec.
649 */
650 __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
651}
652
489static void __init aquila_map_io(void) 653static void __init aquila_map_io(void)
490{ 654{
491 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 655 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -506,6 +670,11 @@ static void __init aquila_machine_init(void)
506 s3c_fimc_setname(1, "s5p-fimc"); 670 s3c_fimc_setname(1, "s5p-fimc");
507 s3c_fimc_setname(2, "s5p-fimc"); 671 s3c_fimc_setname(2, "s5p-fimc");
508 672
673 /* SOUND */
674 aquila_sound_init();
675 i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs,
676 ARRAY_SIZE(i2c_gpio5_devs));
677
509 /* FB */ 678 /* FB */
510 s3c_fb_set_platdata(&aquila_lcd_pdata); 679 s3c_fb_set_platdata(&aquila_lcd_pdata);
511 680
diff --git a/arch/arm/mach-s5pv210/mach-goni.c b/arch/arm/mach-s5pv210/mach-goni.c
index d9ecf57fc2a5..b1dcf964a768 100644
--- a/arch/arm/mach-s5pv210/mach-goni.c
+++ b/arch/arm/mach-s5pv210/mach-goni.c
@@ -15,7 +15,13 @@
15#include <linux/fb.h> 15#include <linux/fb.h>
16#include <linux/i2c.h> 16#include <linux/i2c.h>
17#include <linux/i2c-gpio.h> 17#include <linux/i2c-gpio.h>
18#include <linux/i2c/qt602240_ts.h>
18#include <linux/mfd/max8998.h> 19#include <linux/mfd/max8998.h>
20#include <linux/mfd/wm8994/pdata.h>
21#include <linux/regulator/fixed.h>
22#include <linux/spi/spi.h>
23#include <linux/spi/spi_gpio.h>
24#include <linux/lcd.h>
19#include <linux/gpio_keys.h> 25#include <linux/gpio_keys.h>
20#include <linux/input.h> 26#include <linux/input.h>
21#include <linux/gpio.h> 27#include <linux/gpio.h>
@@ -35,7 +41,10 @@
35#include <plat/devs.h> 41#include <plat/devs.h>
36#include <plat/cpu.h> 42#include <plat/cpu.h>
37#include <plat/fb.h> 43#include <plat/fb.h>
44#include <plat/iic.h>
45#include <plat/keypad.h>
38#include <plat/sdhci.h> 46#include <plat/sdhci.h>
47#include <plat/clock.h>
39 48
40/* Following are default values for UCON, ULCON and UFCON UART registers */ 49/* Following are default values for UCON, ULCON and UFCON UART registers */
41#define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 50#define GONI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -87,13 +96,12 @@ static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = {
87/* Frame Buffer */ 96/* Frame Buffer */
88static struct s3c_fb_pd_win goni_fb_win0 = { 97static struct s3c_fb_pd_win goni_fb_win0 = {
89 .win_mode = { 98 .win_mode = {
90 .pixclock = 1000000000000ULL / ((16+16+2+480)*(28+3+2+800)*55),
91 .left_margin = 16, 99 .left_margin = 16,
92 .right_margin = 16, 100 .right_margin = 16,
93 .upper_margin = 3, 101 .upper_margin = 2,
94 .lower_margin = 28, 102 .lower_margin = 28,
95 .hsync_len = 2, 103 .hsync_len = 2,
96 .vsync_len = 2, 104 .vsync_len = 1,
97 .xres = 480, 105 .xres = 480,
98 .yres = 800, 106 .yres = 800,
99 .refresh = 55, 107 .refresh = 55,
@@ -111,9 +119,160 @@ static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
111 .setup_gpio = s5pv210_fb_gpio_setup_24bpp, 119 .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
112}; 120};
113 121
122static int lcd_power_on(struct lcd_device *ld, int enable)
123{
124 return 1;
125}
126
127static int reset_lcd(struct lcd_device *ld)
128{
129 static unsigned int first = 1;
130 int reset_gpio = -1;
131
132 reset_gpio = S5PV210_MP05(5);
133
134 if (first) {
135 gpio_request(reset_gpio, "MLCD_RST");
136 first = 0;
137 }
138
139 gpio_direction_output(reset_gpio, 1);
140 return 1;
141}
142
143static struct lcd_platform_data goni_lcd_platform_data = {
144 .reset = reset_lcd,
145 .power_on = lcd_power_on,
146 .lcd_enabled = 0,
147 .reset_delay = 120, /* 120ms */
148 .power_on_delay = 25, /* 25ms */
149 .power_off_delay = 200, /* 200ms */
150};
151
152#define LCD_BUS_NUM 3
153static struct spi_board_info spi_board_info[] __initdata = {
154 {
155 .modalias = "s6e63m0",
156 .platform_data = &goni_lcd_platform_data,
157 .max_speed_hz = 1200000,
158 .bus_num = LCD_BUS_NUM,
159 .chip_select = 0,
160 .mode = SPI_MODE_3,
161 .controller_data = (void *)S5PV210_MP01(1), /* DISPLAY_CS */
162 },
163};
164
165static struct spi_gpio_platform_data lcd_spi_gpio_data = {
166 .sck = S5PV210_MP04(1), /* DISPLAY_CLK */
167 .mosi = S5PV210_MP04(3), /* DISPLAY_SI */
168 .miso = SPI_GPIO_NO_MISO,
169 .num_chipselect = 1,
170};
171
172static struct platform_device goni_spi_gpio = {
173 .name = "spi_gpio",
174 .id = LCD_BUS_NUM,
175 .dev = {
176 .parent = &s3c_device_fb.dev,
177 .platform_data = &lcd_spi_gpio_data,
178 },
179};
180
181/* KEYPAD */
182static uint32_t keymap[] __initdata = {
183 /* KEY(row, col, keycode) */
184 KEY(0, 1, KEY_MENU), /* Send */
185 KEY(0, 2, KEY_BACK), /* End */
186 KEY(1, 1, KEY_CONFIG), /* Half shot */
187 KEY(1, 2, KEY_VOLUMEUP),
188 KEY(2, 1, KEY_CAMERA), /* Full shot */
189 KEY(2, 2, KEY_VOLUMEDOWN),
190};
191
192static struct matrix_keymap_data keymap_data __initdata = {
193 .keymap = keymap,
194 .keymap_size = ARRAY_SIZE(keymap),
195};
196
197static struct samsung_keypad_platdata keypad_data __initdata = {
198 .keymap_data = &keymap_data,
199 .rows = 3,
200 .cols = 3,
201};
202
203/* Radio */
204static struct i2c_board_info i2c1_devs[] __initdata = {
205 {
206 I2C_BOARD_INFO("si470x", 0x10),
207 },
208};
209
210static void __init goni_radio_init(void)
211{
212 int gpio;
213
214 gpio = S5PV210_GPJ2(4); /* XMSMDATA_4 */
215 gpio_request(gpio, "FM_INT");
216 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
217 i2c1_devs[0].irq = gpio_to_irq(gpio);
218
219 gpio = S5PV210_GPJ2(5); /* XMSMDATA_5 */
220 gpio_request(gpio, "FM_RST");
221 gpio_direction_output(gpio, 1);
222}
223
224/* TSP */
225static struct qt602240_platform_data qt602240_platform_data = {
226 .x_line = 17,
227 .y_line = 11,
228 .x_size = 800,
229 .y_size = 480,
230 .blen = 0x21,
231 .threshold = 0x28,
232 .voltage = 2800000, /* 2.8V */
233 .orient = QT602240_DIAGONAL,
234};
235
236static struct s3c2410_platform_i2c i2c2_data __initdata = {
237 .flags = 0,
238 .bus_num = 2,
239 .slave_addr = 0x10,
240 .frequency = 400 * 1000,
241 .sda_delay = 100,
242};
243
244static struct i2c_board_info i2c2_devs[] __initdata = {
245 {
246 I2C_BOARD_INFO("qt602240_ts", 0x4a),
247 .platform_data = &qt602240_platform_data,
248 },
249};
250
251static void __init goni_tsp_init(void)
252{
253 int gpio;
254
255 gpio = S5PV210_GPJ1(3); /* XMSMADDR_11 */
256 gpio_request(gpio, "TSP_LDO_ON");
257 gpio_direction_output(gpio, 1);
258 gpio_export(gpio, 0);
259
260 gpio = S5PV210_GPJ0(5); /* XMSMADDR_5 */
261 gpio_request(gpio, "TSP_INT");
262
263 s5p_register_gpio_interrupt(gpio);
264 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
265 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
266 i2c2_devs[0].irq = gpio_to_irq(gpio);
267}
268
114/* MAX8998 regulators */ 269/* MAX8998 regulators */
115#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE) 270#if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
116 271
272static struct regulator_consumer_supply goni_ldo5_consumers[] = {
273 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
274};
275
117static struct regulator_init_data goni_ldo2_data = { 276static struct regulator_init_data goni_ldo2_data = {
118 .constraints = { 277 .constraints = {
119 .name = "VALIVE_1.1V", 278 .name = "VALIVE_1.1V",
@@ -153,6 +312,8 @@ static struct regulator_init_data goni_ldo5_data = {
153 .max_uV = 2800000, 312 .max_uV = 2800000,
154 .apply_uV = 1, 313 .apply_uV = 1,
155 }, 314 },
315 .num_consumer_supplies = ARRAY_SIZE(goni_ldo5_consumers),
316 .consumer_supplies = goni_ldo5_consumers,
156}; 317};
157 318
158static struct regulator_init_data goni_ldo6_data = { 319static struct regulator_init_data goni_ldo6_data = {
@@ -360,6 +521,119 @@ static struct max8998_platform_data goni_max8998_pdata = {
360}; 521};
361#endif 522#endif
362 523
524static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
525 {
526 .dev_name = "5-001a",
527 .supply = "DBVDD",
528 }, {
529 .dev_name = "5-001a",
530 .supply = "AVDD2",
531 }, {
532 .dev_name = "5-001a",
533 .supply = "CPVDD",
534 },
535};
536
537static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
538 {
539 .dev_name = "5-001a",
540 .supply = "SPKVDD1",
541 }, {
542 .dev_name = "5-001a",
543 .supply = "SPKVDD2",
544 },
545};
546
547static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
548 .constraints = {
549 .always_on = 1,
550 },
551 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
552 .consumer_supplies = wm8994_fixed_voltage0_supplies,
553};
554
555static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
556 .constraints = {
557 .always_on = 1,
558 },
559 .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
560 .consumer_supplies = wm8994_fixed_voltage1_supplies,
561};
562
563static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
564 .supply_name = "VCC_1.8V_PDA",
565 .microvolts = 1800000,
566 .gpio = -EINVAL,
567 .init_data = &wm8994_fixed_voltage0_init_data,
568};
569
570static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
571 .supply_name = "V_BAT",
572 .microvolts = 3700000,
573 .gpio = -EINVAL,
574 .init_data = &wm8994_fixed_voltage1_init_data,
575};
576
577static struct platform_device wm8994_fixed_voltage0 = {
578 .name = "reg-fixed-voltage",
579 .id = 0,
580 .dev = {
581 .platform_data = &wm8994_fixed_voltage0_config,
582 },
583};
584
585static struct platform_device wm8994_fixed_voltage1 = {
586 .name = "reg-fixed-voltage",
587 .id = 1,
588 .dev = {
589 .platform_data = &wm8994_fixed_voltage1_config,
590 },
591};
592
593static struct regulator_consumer_supply wm8994_avdd1_supply = {
594 .dev_name = "5-001a",
595 .supply = "AVDD1",
596};
597
598static struct regulator_consumer_supply wm8994_dcvdd_supply = {
599 .dev_name = "5-001a",
600 .supply = "DCVDD",
601};
602
603static struct regulator_init_data wm8994_ldo1_data = {
604 .constraints = {
605 .name = "AVDD1_3.0V",
606 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
607 },
608 .num_consumer_supplies = 1,
609 .consumer_supplies = &wm8994_avdd1_supply,
610};
611
612static struct regulator_init_data wm8994_ldo2_data = {
613 .constraints = {
614 .name = "DCVDD_1.0V",
615 },
616 .num_consumer_supplies = 1,
617 .consumer_supplies = &wm8994_dcvdd_supply,
618};
619
620static struct wm8994_pdata wm8994_platform_data = {
621 /* configure gpio1 function: 0x0001(Logic level input/output) */
622 .gpio_defaults[0] = 0x0001,
623 /* configure gpio3/4/5/7 function for AIF2 voice */
624 .gpio_defaults[2] = 0x8100,
625 .gpio_defaults[3] = 0x8100,
626 .gpio_defaults[4] = 0x8100,
627 .gpio_defaults[6] = 0x0100,
628 /* configure gpio8/9/10/11 function for AIF3 BT */
629 .gpio_defaults[7] = 0x8100,
630 .gpio_defaults[8] = 0x0100,
631 .gpio_defaults[9] = 0x0100,
632 .gpio_defaults[10] = 0x0100,
633 .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */
634 .ldo[1] = { 0, NULL, &wm8994_ldo2_data },
635};
636
363/* GPIO I2C PMIC */ 637/* GPIO I2C PMIC */
364#define AP_I2C_GPIO_PMIC_BUS_4 4 638#define AP_I2C_GPIO_PMIC_BUS_4 4
365static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = { 639static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
@@ -385,6 +659,29 @@ static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
385#endif 659#endif
386}; 660};
387 661
662/* GPIO I2C AP 1.8V */
663#define AP_I2C_GPIO_BUS_5 5
664static struct i2c_gpio_platform_data goni_i2c_gpio5_data = {
665 .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */
666 .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */
667};
668
669static struct platform_device goni_i2c_gpio5 = {
670 .name = "i2c-gpio",
671 .id = AP_I2C_GPIO_BUS_5,
672 .dev = {
673 .platform_data = &goni_i2c_gpio5_data,
674 },
675};
676
677static struct i2c_board_info i2c_gpio5_devs[] __initdata = {
678 {
679 /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
680 I2C_BOARD_INFO("wm8994", 0x1a),
681 .platform_data = &wm8994_platform_data,
682 },
683};
684
388/* PMIC Power button */ 685/* PMIC Power button */
389static struct gpio_keys_button goni_gpio_keys_table[] = { 686static struct gpio_keys_button goni_gpio_keys_table[] = {
390 { 687 {
@@ -444,11 +741,37 @@ static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata = {
444 .ext_cd_gpio_invert = 1, 741 .ext_cd_gpio_invert = 1,
445}; 742};
446 743
744static struct regulator_consumer_supply mmc2_supplies[] = {
745 REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
746};
747
748static struct regulator_init_data mmc2_fixed_voltage_init_data = {
749 .constraints = {
750 .name = "V_TF_2.8V",
751 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
752 },
753 .num_consumer_supplies = ARRAY_SIZE(mmc2_supplies),
754 .consumer_supplies = mmc2_supplies,
755};
756
757static struct fixed_voltage_config mmc2_fixed_voltage_config = {
758 .supply_name = "EXT_FLASH_EN",
759 .microvolts = 2800000,
760 .gpio = GONI_EXT_FLASH_EN,
761 .enable_high = true,
762 .init_data = &mmc2_fixed_voltage_init_data,
763};
764
765static struct platform_device mmc2_fixed_voltage = {
766 .name = "reg-fixed-voltage",
767 .id = 2,
768 .dev = {
769 .platform_data = &mmc2_fixed_voltage_config,
770 },
771};
772
447static void goni_setup_sdhci(void) 773static void goni_setup_sdhci(void)
448{ 774{
449 gpio_request(GONI_EXT_FLASH_EN, "FLASH_EN");
450 gpio_direction_output(GONI_EXT_FLASH_EN, 1);
451
452 s3c_sdhci0_set_platdata(&goni_hsmmc0_data); 775 s3c_sdhci0_set_platdata(&goni_hsmmc0_data);
453 s3c_sdhci1_set_platdata(&goni_hsmmc1_data); 776 s3c_sdhci1_set_platdata(&goni_hsmmc1_data);
454 s3c_sdhci2_set_platdata(&goni_hsmmc2_data); 777 s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
@@ -457,7 +780,10 @@ static void goni_setup_sdhci(void)
457static struct platform_device *goni_devices[] __initdata = { 780static struct platform_device *goni_devices[] __initdata = {
458 &s3c_device_fb, 781 &s3c_device_fb,
459 &s5p_device_onenand, 782 &s5p_device_onenand,
783 &goni_spi_gpio,
460 &goni_i2c_gpio_pmic, 784 &goni_i2c_gpio_pmic,
785 &goni_i2c_gpio5,
786 &mmc2_fixed_voltage,
461 &goni_device_gpiokeys, 787 &goni_device_gpiokeys,
462 &s5p_device_fimc0, 788 &s5p_device_fimc0,
463 &s5p_device_fimc1, 789 &s5p_device_fimc1,
@@ -465,8 +791,24 @@ static struct platform_device *goni_devices[] __initdata = {
465 &s3c_device_hsmmc0, 791 &s3c_device_hsmmc0,
466 &s3c_device_hsmmc1, 792 &s3c_device_hsmmc1,
467 &s3c_device_hsmmc2, 793 &s3c_device_hsmmc2,
794 &s5pv210_device_iis0,
795 &s3c_device_usb_hsotg,
796 &samsung_device_keypad,
797 &s3c_device_i2c1,
798 &s3c_device_i2c2,
799 &wm8994_fixed_voltage0,
800 &wm8994_fixed_voltage1,
468}; 801};
469 802
803static void __init goni_sound_init(void)
804{
805 /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
806 * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
807 * because it needs 24MHz clock to operate WM8994 codec.
808 */
809 __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
810}
811
470static void __init goni_map_io(void) 812static void __init goni_map_io(void)
471{ 813{
472 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 814 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -476,6 +818,20 @@ static void __init goni_map_io(void)
476 818
477static void __init goni_machine_init(void) 819static void __init goni_machine_init(void)
478{ 820{
821 /* Radio: call before I2C 1 registeration */
822 goni_radio_init();
823
824 /* I2C1 */
825 s3c_i2c1_set_platdata(NULL);
826 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
827
828 /* TSP: call before I2C 2 registeration */
829 goni_tsp_init();
830
831 /* I2C2 */
832 s3c_i2c2_set_platdata(&i2c2_data);
833 i2c_register_board_info(2, i2c2_devs, ARRAY_SIZE(i2c2_devs));
834
479 /* PMIC */ 835 /* PMIC */
480 goni_pmic_init(); 836 goni_pmic_init();
481 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs, 837 i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
@@ -483,9 +839,22 @@ static void __init goni_machine_init(void)
483 /* SDHCI */ 839 /* SDHCI */
484 goni_setup_sdhci(); 840 goni_setup_sdhci();
485 841
842 /* SOUND */
843 goni_sound_init();
844 i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs,
845 ARRAY_SIZE(i2c_gpio5_devs));
846
486 /* FB */ 847 /* FB */
487 s3c_fb_set_platdata(&goni_lcd_pdata); 848 s3c_fb_set_platdata(&goni_lcd_pdata);
488 849
850 /* SPI */
851 spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
852
853 /* KEYPAD */
854 samsung_keypad_set_platdata(&keypad_data);
855
856 clk_xusbxti.rate = 24000000;
857
489 platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices)); 858 platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
490} 859}
491 860
diff --git a/arch/arm/mach-s5pv210/mach-smdkc110.c b/arch/arm/mach-s5pv210/mach-smdkc110.c
index cea9bca79d88..0ad7924fe62e 100644
--- a/arch/arm/mach-s5pv210/mach-smdkc110.c
+++ b/arch/arm/mach-s5pv210/mach-smdkc110.c
@@ -28,6 +28,7 @@
28#include <plat/cpu.h> 28#include <plat/cpu.h>
29#include <plat/ata.h> 29#include <plat/ata.h>
30#include <plat/iic.h> 30#include <plat/iic.h>
31#include <plat/pm.h>
31 32
32/* Following are default values for UCON, ULCON and UFCON UART registers */ 33/* Following are default values for UCON, ULCON and UFCON UART registers */
33#define SMDKC110_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 34#define SMDKC110_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -81,6 +82,7 @@ static struct s3c_ide_platdata smdkc110_ide_pdata __initdata = {
81static struct platform_device *smdkc110_devices[] __initdata = { 82static struct platform_device *smdkc110_devices[] __initdata = {
82 &s5pv210_device_iis0, 83 &s5pv210_device_iis0,
83 &s5pv210_device_ac97, 84 &s5pv210_device_ac97,
85 &s5pv210_device_spdif,
84 &s3c_device_cfcon, 86 &s3c_device_cfcon,
85 &s3c_device_i2c0, 87 &s3c_device_i2c0,
86 &s3c_device_i2c1, 88 &s3c_device_i2c1,
@@ -110,6 +112,8 @@ static void __init smdkc110_map_io(void)
110 112
111static void __init smdkc110_machine_init(void) 113static void __init smdkc110_machine_init(void)
112{ 114{
115 s3c_pm_init();
116
113 s3c_i2c0_set_platdata(NULL); 117 s3c_i2c0_set_platdata(NULL);
114 s3c_i2c1_set_platdata(NULL); 118 s3c_i2c1_set_platdata(NULL);
115 s3c_i2c2_set_platdata(NULL); 119 s3c_i2c2_set_platdata(NULL);
diff --git a/arch/arm/mach-s5pv210/mach-smdkv210.c b/arch/arm/mach-s5pv210/mach-smdkv210.c
index 83189ae9da9a..bcd7a5d53401 100644
--- a/arch/arm/mach-s5pv210/mach-smdkv210.c
+++ b/arch/arm/mach-s5pv210/mach-smdkv210.c
@@ -31,6 +31,7 @@
31#include <plat/ata.h> 31#include <plat/ata.h>
32#include <plat/iic.h> 32#include <plat/iic.h>
33#include <plat/keypad.h> 33#include <plat/keypad.h>
34#include <plat/pm.h>
34 35
35/* Following are default values for UCON, ULCON and UFCON UART registers */ 36/* Following are default values for UCON, ULCON and UFCON UART registers */
36#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 37#define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -103,6 +104,7 @@ static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = {
103static struct platform_device *smdkv210_devices[] __initdata = { 104static struct platform_device *smdkv210_devices[] __initdata = {
104 &s5pv210_device_iis0, 105 &s5pv210_device_iis0,
105 &s5pv210_device_ac97, 106 &s5pv210_device_ac97,
107 &s5pv210_device_spdif,
106 &s3c_device_adc, 108 &s3c_device_adc,
107 &s3c_device_cfcon, 109 &s3c_device_cfcon,
108 &s3c_device_hsmmc0, 110 &s3c_device_hsmmc0,
@@ -145,6 +147,8 @@ static void __init smdkv210_map_io(void)
145 147
146static void __init smdkv210_machine_init(void) 148static void __init smdkv210_machine_init(void)
147{ 149{
150 s3c_pm_init();
151
148 samsung_keypad_set_platdata(&smdkv210_keypad_data); 152 samsung_keypad_set_platdata(&smdkv210_keypad_data);
149 s3c24xx_ts_set_platdata(&s3c_ts_platform); 153 s3c24xx_ts_set_platdata(&s3c_ts_platform);
150 154
diff --git a/arch/arm/mach-s5pv210/mach-torbreck.c b/arch/arm/mach-s5pv210/mach-torbreck.c
new file mode 100644
index 000000000000..043c938806b0
--- /dev/null
+++ b/arch/arm/mach-s5pv210/mach-torbreck.c
@@ -0,0 +1,131 @@
1/* linux/arch/arm/mach-s5pv210/mach-torbreck.c
2 *
3 * Copyright (c) 2010 aESOP Community
4 * http://www.aesop.or.kr/
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/types.h>
13#include <linux/i2c.h>
14#include <linux/init.h>
15#include <linux/serial_core.h>
16
17#include <asm/mach/arch.h>
18#include <asm/mach/map.h>
19#include <asm/setup.h>
20#include <asm/mach-types.h>
21
22#include <mach/map.h>
23#include <mach/regs-clock.h>
24
25#include <plat/regs-serial.h>
26#include <plat/s5pv210.h>
27#include <plat/devs.h>
28#include <plat/cpu.h>
29#include <plat/iic.h>
30
31/* Following are default values for UCON, ULCON and UFCON UART registers */
32#define TORBRECK_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
33 S3C2410_UCON_RXILEVEL | \
34 S3C2410_UCON_TXIRQMODE | \
35 S3C2410_UCON_RXIRQMODE | \
36 S3C2410_UCON_RXFIFO_TOI | \
37 S3C2443_UCON_RXERR_IRQEN)
38
39#define TORBRECK_ULCON_DEFAULT S3C2410_LCON_CS8
40
41#define TORBRECK_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
42 S5PV210_UFCON_TXTRIG4 | \
43 S5PV210_UFCON_RXTRIG4)
44
45static struct s3c2410_uartcfg torbreck_uartcfgs[] __initdata = {
46 [0] = {
47 .hwport = 0,
48 .flags = 0,
49 .ucon = TORBRECK_UCON_DEFAULT,
50 .ulcon = TORBRECK_ULCON_DEFAULT,
51 .ufcon = TORBRECK_UFCON_DEFAULT,
52 },
53 [1] = {
54 .hwport = 1,
55 .flags = 0,
56 .ucon = TORBRECK_UCON_DEFAULT,
57 .ulcon = TORBRECK_ULCON_DEFAULT,
58 .ufcon = TORBRECK_UFCON_DEFAULT,
59 },
60 [2] = {
61 .hwport = 2,
62 .flags = 0,
63 .ucon = TORBRECK_UCON_DEFAULT,
64 .ulcon = TORBRECK_ULCON_DEFAULT,
65 .ufcon = TORBRECK_UFCON_DEFAULT,
66 },
67 [3] = {
68 .hwport = 3,
69 .flags = 0,
70 .ucon = TORBRECK_UCON_DEFAULT,
71 .ulcon = TORBRECK_ULCON_DEFAULT,
72 .ufcon = TORBRECK_UFCON_DEFAULT,
73 },
74};
75
76static struct platform_device *torbreck_devices[] __initdata = {
77 &s5pv210_device_iis0,
78 &s3c_device_cfcon,
79 &s3c_device_hsmmc0,
80 &s3c_device_hsmmc1,
81 &s3c_device_hsmmc2,
82 &s3c_device_hsmmc3,
83 &s3c_device_i2c0,
84 &s3c_device_i2c1,
85 &s3c_device_i2c2,
86 &s3c_device_rtc,
87 &s3c_device_wdt,
88};
89
90static struct i2c_board_info torbreck_i2c_devs0[] __initdata = {
91 /* To Be Updated */
92};
93
94static struct i2c_board_info torbreck_i2c_devs1[] __initdata = {
95 /* To Be Updated */
96};
97
98static struct i2c_board_info torbreck_i2c_devs2[] __initdata = {
99 /* To Be Updated */
100};
101
102static void __init torbreck_map_io(void)
103{
104 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
105 s3c24xx_init_clocks(24000000);
106 s3c24xx_init_uarts(torbreck_uartcfgs, ARRAY_SIZE(torbreck_uartcfgs));
107}
108
109static void __init torbreck_machine_init(void)
110{
111 s3c_i2c0_set_platdata(NULL);
112 s3c_i2c1_set_platdata(NULL);
113 s3c_i2c2_set_platdata(NULL);
114 i2c_register_board_info(0, torbreck_i2c_devs0,
115 ARRAY_SIZE(torbreck_i2c_devs0));
116 i2c_register_board_info(1, torbreck_i2c_devs1,
117 ARRAY_SIZE(torbreck_i2c_devs1));
118 i2c_register_board_info(2, torbreck_i2c_devs2,
119 ARRAY_SIZE(torbreck_i2c_devs2));
120
121 platform_add_devices(torbreck_devices, ARRAY_SIZE(torbreck_devices));
122}
123
124MACHINE_START(TORBRECK, "TORBRECK")
125 /* Maintainer: Hyunchul Ko <ghcstop@gmail.com> */
126 .boot_params = S5P_PA_SDRAM + 0x100,
127 .init_irq = s5pv210_init_irq,
128 .map_io = torbreck_map_io,
129 .init_machine = torbreck_machine_init,
130 .timer = &s3c24xx_timer,
131MACHINE_END
diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c
new file mode 100644
index 000000000000..549d7924fd4c
--- /dev/null
+++ b/arch/arm/mach-s5pv210/pm.c
@@ -0,0 +1,166 @@
1/* linux/arch/arm/mach-s5pv210/pm.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV210 - Power Management support
7 *
8 * Based on arch/arm/mach-s3c2410/pm.c
9 * Copyright (c) 2006 Simtec Electronics
10 * Ben Dooks <ben@simtec.co.uk>
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/init.h>
18#include <linux/suspend.h>
19#include <linux/io.h>
20
21#include <plat/cpu.h>
22#include <plat/pm.h>
23#include <plat/regs-timer.h>
24
25#include <mach/regs-irq.h>
26#include <mach/regs-clock.h>
27
28static struct sleep_save s5pv210_core_save[] = {
29 /* Clock source */
30 SAVE_ITEM(S5P_CLK_SRC0),
31 SAVE_ITEM(S5P_CLK_SRC1),
32 SAVE_ITEM(S5P_CLK_SRC2),
33 SAVE_ITEM(S5P_CLK_SRC3),
34 SAVE_ITEM(S5P_CLK_SRC4),
35 SAVE_ITEM(S5P_CLK_SRC5),
36 SAVE_ITEM(S5P_CLK_SRC6),
37
38 /* Clock source Mask */
39 SAVE_ITEM(S5P_CLK_SRC_MASK0),
40 SAVE_ITEM(S5P_CLK_SRC_MASK1),
41
42 /* Clock Divider */
43 SAVE_ITEM(S5P_CLK_DIV0),
44 SAVE_ITEM(S5P_CLK_DIV1),
45 SAVE_ITEM(S5P_CLK_DIV2),
46 SAVE_ITEM(S5P_CLK_DIV3),
47 SAVE_ITEM(S5P_CLK_DIV4),
48 SAVE_ITEM(S5P_CLK_DIV5),
49 SAVE_ITEM(S5P_CLK_DIV6),
50 SAVE_ITEM(S5P_CLK_DIV7),
51
52 /* Clock Main Gate */
53 SAVE_ITEM(S5P_CLKGATE_MAIN0),
54 SAVE_ITEM(S5P_CLKGATE_MAIN1),
55 SAVE_ITEM(S5P_CLKGATE_MAIN2),
56
57 /* Clock source Peri Gate */
58 SAVE_ITEM(S5P_CLKGATE_PERI0),
59 SAVE_ITEM(S5P_CLKGATE_PERI1),
60
61 /* Clock source SCLK Gate */
62 SAVE_ITEM(S5P_CLKGATE_SCLK0),
63 SAVE_ITEM(S5P_CLKGATE_SCLK1),
64
65 /* Clock IP Clock gate */
66 SAVE_ITEM(S5P_CLKGATE_IP0),
67 SAVE_ITEM(S5P_CLKGATE_IP1),
68 SAVE_ITEM(S5P_CLKGATE_IP2),
69 SAVE_ITEM(S5P_CLKGATE_IP3),
70 SAVE_ITEM(S5P_CLKGATE_IP4),
71
72 /* Clock Blcok and Bus gate */
73 SAVE_ITEM(S5P_CLKGATE_BLOCK),
74 SAVE_ITEM(S5P_CLKGATE_BUS0),
75
76 /* Clock ETC */
77 SAVE_ITEM(S5P_CLK_OUT),
78 SAVE_ITEM(S5P_MDNIE_SEL),
79
80 /* PWM Register */
81 SAVE_ITEM(S3C2410_TCFG0),
82 SAVE_ITEM(S3C2410_TCFG1),
83 SAVE_ITEM(S3C64XX_TINT_CSTAT),
84 SAVE_ITEM(S3C2410_TCON),
85 SAVE_ITEM(S3C2410_TCNTB(0)),
86 SAVE_ITEM(S3C2410_TCMPB(0)),
87 SAVE_ITEM(S3C2410_TCNTO(0)),
88};
89
90void s5pv210_cpu_suspend(void)
91{
92 unsigned long tmp;
93
94 /* issue the standby signal into the pm unit. Note, we
95 * issue a write-buffer drain just in case */
96
97 tmp = 0;
98
99 asm("b 1f\n\t"
100 ".align 5\n\t"
101 "1:\n\t"
102 "mcr p15, 0, %0, c7, c10, 5\n\t"
103 "mcr p15, 0, %0, c7, c10, 4\n\t"
104 "wfi" : : "r" (tmp));
105
106 /* we should never get past here */
107 panic("sleep resumed to originator?");
108}
109
110static void s5pv210_pm_prepare(void)
111{
112 unsigned int tmp;
113
114 /* ensure at least INFORM0 has the resume address */
115 __raw_writel(virt_to_phys(s3c_cpu_resume), S5P_INFORM0);
116
117 tmp = __raw_readl(S5P_SLEEP_CFG);
118 tmp &= ~(S5P_SLEEP_CFG_OSC_EN | S5P_SLEEP_CFG_USBOSC_EN);
119 __raw_writel(tmp, S5P_SLEEP_CFG);
120
121 /* WFI for SLEEP mode configuration by SYSCON */
122 tmp = __raw_readl(S5P_PWR_CFG);
123 tmp &= S5P_CFG_WFI_CLEAN;
124 tmp |= S5P_CFG_WFI_SLEEP;
125 __raw_writel(tmp, S5P_PWR_CFG);
126
127 /* SYSCON interrupt handling disable */
128 tmp = __raw_readl(S5P_OTHERS);
129 tmp |= S5P_OTHER_SYSC_INTOFF;
130 __raw_writel(tmp, S5P_OTHERS);
131
132 s3c_pm_do_save(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save));
133}
134
135static int s5pv210_pm_add(struct sys_device *sysdev)
136{
137 pm_cpu_prep = s5pv210_pm_prepare;
138 pm_cpu_sleep = s5pv210_cpu_suspend;
139
140 return 0;
141}
142
143static int s5pv210_pm_resume(struct sys_device *dev)
144{
145 u32 tmp;
146
147 tmp = __raw_readl(S5P_OTHERS);
148 tmp |= (S5P_OTHERS_RET_IO | S5P_OTHERS_RET_CF |\
149 S5P_OTHERS_RET_MMC | S5P_OTHERS_RET_UART);
150 __raw_writel(tmp , S5P_OTHERS);
151
152 s3c_pm_do_restore_core(s5pv210_core_save, ARRAY_SIZE(s5pv210_core_save));
153
154 return 0;
155}
156
157static struct sysdev_driver s5pv210_pm_driver = {
158 .add = s5pv210_pm_add,
159 .resume = s5pv210_pm_resume,
160};
161
162static __init int s5pv210_pm_drvinit(void)
163{
164 return sysdev_driver_register(&s5pv210_sysclass, &s5pv210_pm_driver);
165}
166arch_initcall(s5pv210_pm_drvinit);
diff --git a/arch/arm/mach-s5pv210/setup-fb-24bpp.c b/arch/arm/mach-s5pv210/setup-fb-24bpp.c
index 928cf1f125fa..e932ebfac56d 100644
--- a/arch/arm/mach-s5pv210/setup-fb-24bpp.c
+++ b/arch/arm/mach-s5pv210/setup-fb-24bpp.c
@@ -21,33 +21,21 @@
21#include <mach/regs-clock.h> 21#include <mach/regs-clock.h>
22#include <plat/gpio-cfg.h> 22#include <plat/gpio-cfg.h>
23 23
24void s5pv210_fb_gpio_setup_24bpp(void) 24static void s5pv210_fb_cfg_gpios(unsigned int base, unsigned int nr)
25{ 25{
26 unsigned int gpio = 0; 26 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(2));
27
28 for (gpio = S5PV210_GPF0(0); gpio <= S5PV210_GPF0(7); gpio++) {
29 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
30 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
31 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
32 }
33 27
34 for (gpio = S5PV210_GPF1(0); gpio <= S5PV210_GPF1(7); gpio++) { 28 for (; nr > 0; nr--, base++)
35 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); 29 s5p_gpio_set_drvstr(base, S5P_GPIO_DRVSTR_LV4);
36 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); 30}
37 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
38 }
39 31
40 for (gpio = S5PV210_GPF2(0); gpio <= S5PV210_GPF2(7); gpio++) {
41 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
42 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
43 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
44 }
45 32
46 for (gpio = S5PV210_GPF3(0); gpio <= S5PV210_GPF3(3); gpio++) { 33void s5pv210_fb_gpio_setup_24bpp(void)
47 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); 34{
48 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); 35 s5pv210_fb_cfg_gpios(S5PV210_GPF0(0), 8);
49 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); 36 s5pv210_fb_cfg_gpios(S5PV210_GPF1(0), 8);
50 } 37 s5pv210_fb_cfg_gpios(S5PV210_GPF2(0), 8);
38 s5pv210_fb_cfg_gpios(S5PV210_GPF3(0), 4);
51 39
52 /* Set DISPLAY_CONTROL register for Display path selection. 40 /* Set DISPLAY_CONTROL register for Display path selection.
53 * 41 *
diff --git a/arch/arm/mach-s5pv210/setup-i2c0.c b/arch/arm/mach-s5pv210/setup-i2c0.c
index d38f7cb7e662..0f1cc3a1c1e8 100644
--- a/arch/arm/mach-s5pv210/setup-i2c0.c
+++ b/arch/arm/mach-s5pv210/setup-i2c0.c
@@ -23,8 +23,6 @@ struct platform_device; /* don't need the contents */
23 23
24void s3c_i2c0_cfg_gpio(struct platform_device *dev) 24void s3c_i2c0_cfg_gpio(struct platform_device *dev)
25{ 25{
26 s3c_gpio_cfgpin(S5PV210_GPD1(0), S3C_GPIO_SFN(2)); 26 s3c_gpio_cfgall_range(S5PV210_GPD1(0), 2,
27 s3c_gpio_setpull(S5PV210_GPD1(0), S3C_GPIO_PULL_UP); 27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5PV210_GPD1(1), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5PV210_GPD1(1), S3C_GPIO_PULL_UP);
30} 28}
diff --git a/arch/arm/mach-s5pv210/setup-i2c1.c b/arch/arm/mach-s5pv210/setup-i2c1.c
index 148bb7857d89..f61365a34c56 100644
--- a/arch/arm/mach-s5pv210/setup-i2c1.c
+++ b/arch/arm/mach-s5pv210/setup-i2c1.c
@@ -23,8 +23,6 @@ struct platform_device; /* don't need the contents */
23 23
24void s3c_i2c1_cfg_gpio(struct platform_device *dev) 24void s3c_i2c1_cfg_gpio(struct platform_device *dev)
25{ 25{
26 s3c_gpio_cfgpin(S5PV210_GPD1(2), S3C_GPIO_SFN(2)); 26 s3c_gpio_cfgall_range(S5PV210_GPD1(2), 2,
27 s3c_gpio_setpull(S5PV210_GPD1(2), S3C_GPIO_PULL_UP); 27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5PV210_GPD1(3), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5PV210_GPD1(3), S3C_GPIO_PULL_UP);
30} 28}
diff --git a/arch/arm/mach-s5pv210/setup-i2c2.c b/arch/arm/mach-s5pv210/setup-i2c2.c
index 2396cb8c373e..2f91b5cefbc6 100644
--- a/arch/arm/mach-s5pv210/setup-i2c2.c
+++ b/arch/arm/mach-s5pv210/setup-i2c2.c
@@ -23,8 +23,6 @@ struct platform_device; /* don't need the contents */
23 23
24void s3c_i2c2_cfg_gpio(struct platform_device *dev) 24void s3c_i2c2_cfg_gpio(struct platform_device *dev)
25{ 25{
26 s3c_gpio_cfgpin(S5PV210_GPD1(4), S3C_GPIO_SFN(2)); 26 s3c_gpio_cfgall_range(S5PV210_GPD1(4), 2,
27 s3c_gpio_setpull(S5PV210_GPD1(4), S3C_GPIO_PULL_UP); 27 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
28 s3c_gpio_cfgpin(S5PV210_GPD1(5), S3C_GPIO_SFN(2));
29 s3c_gpio_setpull(S5PV210_GPD1(5), S3C_GPIO_PULL_UP);
30} 28}
diff --git a/arch/arm/mach-s5pv210/setup-ide.c b/arch/arm/mach-s5pv210/setup-ide.c
index b558b1cc8d60..ea123d546bd2 100644
--- a/arch/arm/mach-s5pv210/setup-ide.c
+++ b/arch/arm/mach-s5pv210/setup-ide.c
@@ -15,36 +15,25 @@
15 15
16#include <plat/gpio-cfg.h> 16#include <plat/gpio-cfg.h>
17 17
18static void s5pv210_ide_cfg_gpios(unsigned int base, unsigned int nr)
19{
20 s3c_gpio_cfgrange_nopull(base, nr, S3C_GPIO_SFN(4));
21
22 for (; nr > 0; nr--, base++)
23 s5p_gpio_set_drvstr(base, S5P_GPIO_DRVSTR_LV4);
24}
25
18void s5pv210_ide_setup_gpio(void) 26void s5pv210_ide_setup_gpio(void)
19{ 27{
20 unsigned int gpio = 0; 28 /* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, CF_DMACK */
21 29 s5pv210_ide_cfg_gpios(S5PV210_GPJ0(0), 8);
22 for (gpio = S5PV210_GPJ0(0); gpio <= S5PV210_GPJ0(7); gpio++) { 30
23 /* CF_Add[0 - 2], CF_IORDY, CF_INTRQ, CF_DMARQ, CF_DMARST, 31 /* CF_Data[0 - 7] */
24 CF_DMACK */ 32 s5pv210_ide_cfg_gpios(S5PV210_GPJ2(0), 8);
25 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4)); 33
26 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE); 34 /* CF_Data[8 - 15] */
27 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4); 35 s5pv210_ide_cfg_gpios(S5PV210_GPJ3(0), 8);
28 } 36
29 37 /* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */
30 for (gpio = S5PV210_GPJ2(0); gpio <= S5PV210_GPJ2(7); gpio++) { 38 s5pv210_ide_cfg_gpios(S5PV210_GPJ4(0), 4);
31 /*CF_Data[0 - 7] */
32 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
33 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
34 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
35 }
36
37 for (gpio = S5PV210_GPJ3(0); gpio <= S5PV210_GPJ3(7); gpio++) {
38 /* CF_Data[8 - 15] */
39 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
40 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
41 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
42 }
43
44 for (gpio = S5PV210_GPJ4(0); gpio <= S5PV210_GPJ4(3); gpio++) {
45 /* CF_CS0, CF_CS1, CF_IORD, CF_IOWR */
46 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(4));
47 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
48 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
49 }
50} 39}
diff --git a/arch/arm/mach-s5pv210/setup-keypad.c b/arch/arm/mach-s5pv210/setup-keypad.c
index 37b2790aafc3..c56420a52f48 100644
--- a/arch/arm/mach-s5pv210/setup-keypad.c
+++ b/arch/arm/mach-s5pv210/setup-keypad.c
@@ -16,19 +16,9 @@
16 16
17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols) 17void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
18{ 18{
19 unsigned int gpio, end;
20
21 /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */ 19 /* Set all the necessary GPH3 pins to special-function 3: KP_ROW[x] */
22 end = S5PV210_GPH3(rows); 20 s3c_gpio_cfgrange_nopull(S5PV210_GPH3(0), rows, S3C_GPIO_SFN(3));
23 for (gpio = S5PV210_GPH3(0); gpio < end; gpio++) {
24 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
25 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
26 }
27 21
28 /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */ 22 /* Set all the necessary GPH2 pins to special-function 3: KP_COL[x] */
29 end = S5PV210_GPH2(cols); 23 s3c_gpio_cfgrange_nopull(S5PV210_GPH2(0), cols, S3C_GPIO_SFN(3));
30 for (gpio = S5PV210_GPH2(0); gpio < end; gpio++) {
31 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
32 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
33 }
34} 24}
diff --git a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
index b18587b1ec58..746777d56df9 100644
--- a/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
+++ b/arch/arm/mach-s5pv210/setup-sdhci-gpio.c
@@ -26,26 +26,17 @@
26void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width) 26void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
27{ 27{
28 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 28 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
29 unsigned int gpio;
30 29
31 /* Set all the necessary GPG0/GPG1 pins to special-function 2 */ 30 /* Set all the necessary GPG0/GPG1 pins to special-function 2 */
32 for (gpio = S5PV210_GPG0(0); gpio < S5PV210_GPG0(2); gpio++) { 31 s3c_gpio_cfgrange_nopull(S5PV210_GPG0(0), 2, S3C_GPIO_SFN(2));
33 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2)); 32
34 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
35 }
36 switch (width) { 33 switch (width) {
37 case 8: 34 case 8:
38 /* GPG1[3:6] special-funtion 3 */ 35 /* GPG1[3:6] special-funtion 3 */
39 for (gpio = S5PV210_GPG1(3); gpio <= S5PV210_GPG1(6); gpio++) { 36 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(3));
40 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
41 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
42 }
43 case 4: 37 case 4:
44 /* GPG0[3:6] special-funtion 2 */ 38 /* GPG0[3:6] special-funtion 2 */
45 for (gpio = S5PV210_GPG0(3); gpio <= S5PV210_GPG0(6); gpio++) { 39 s3c_gpio_cfgrange_nopull(S5PV210_GPG0(3), 4, S3C_GPIO_SFN(2));
46 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
47 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
48 }
49 default: 40 default:
50 break; 41 break;
51 } 42 }
@@ -59,19 +50,12 @@ void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
59void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width) 50void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
60{ 51{
61 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 52 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
62 unsigned int gpio;
63 53
64 /* Set all the necessary GPG1[0:1] pins to special-function 2 */ 54 /* Set all the necessary GPG1[0:1] pins to special-function 2 */
65 for (gpio = S5PV210_GPG1(0); gpio < S5PV210_GPG1(2); gpio++) { 55 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(0), 2, S3C_GPIO_SFN(2));
66 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
67 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
68 }
69 56
70 /* Data pin GPG1[3:6] to special-function 2 */ 57 /* Data pin GPG1[3:6] to special-function 2 */
71 for (gpio = S5PV210_GPG1(3); gpio <= S5PV210_GPG1(6); gpio++) { 58 s3c_gpio_cfgrange_nopull(S5PV210_GPG1(3), 4, S3C_GPIO_SFN(2));
72 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
73 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
74 }
75 59
76 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { 60 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
77 s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP); 61 s3c_gpio_setpull(S5PV210_GPG1(2), S3C_GPIO_PULL_UP);
@@ -82,27 +66,17 @@ void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
82void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width) 66void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
83{ 67{
84 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 68 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
85 unsigned int gpio;
86 69
87 /* Set all the necessary GPG2[0:1] pins to special-function 2 */ 70 /* Set all the necessary GPG2[0:1] pins to special-function 2 */
88 for (gpio = S5PV210_GPG2(0); gpio < S5PV210_GPG2(2); gpio++) { 71 s3c_gpio_cfgrange_nopull(S5PV210_GPG2(0), 2, S3C_GPIO_SFN(2));
89 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
90 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
91 }
92 72
93 switch (width) { 73 switch (width) {
94 case 8: 74 case 8:
95 /* Data pin GPG3[3:6] to special-function 3 */ 75 /* Data pin GPG3[3:6] to special-function 3 */
96 for (gpio = S5PV210_GPG3(3); gpio <= S5PV210_GPG3(6); gpio++) { 76 s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(3));
97 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
98 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
99 }
100 case 4: 77 case 4:
101 /* Data pin GPG2[3:6] to special-function 2 */ 78 /* Data pin GPG2[3:6] to special-function 2 */
102 for (gpio = S5PV210_GPG2(3); gpio <= S5PV210_GPG2(6); gpio++) { 79 s3c_gpio_cfgrange_nopull(S5PV210_GPG2(3), 4, S3C_GPIO_SFN(2));
103 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
104 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
105 }
106 default: 80 default:
107 break; 81 break;
108 } 82 }
@@ -116,19 +90,12 @@ void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
116void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width) 90void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width)
117{ 91{
118 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data; 92 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
119 unsigned int gpio;
120 93
121 /* Set all the necessary GPG3[0:2] pins to special-function 2 */ 94 /* Set all the necessary GPG3[0:1] pins to special-function 2 */
122 for (gpio = S5PV210_GPG3(0); gpio < S5PV210_GPG3(2); gpio++) { 95 s3c_gpio_cfgrange_nopull(S5PV210_GPG3(0), 2, S3C_GPIO_SFN(2));
123 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
124 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
125 }
126 96
127 /* Data pin GPG3[3:6] to special-function 2 */ 97 /* Data pin GPG3[3:6] to special-function 2 */
128 for (gpio = S5PV210_GPG3(3); gpio <= S5PV210_GPG3(6); gpio++) { 98 s3c_gpio_cfgrange_nopull(S5PV210_GPG3(3), 4, S3C_GPIO_SFN(2));
129 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
130 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
131 }
132 99
133 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) { 100 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
134 s3c_gpio_setpull(S5PV210_GPG3(2), S3C_GPIO_PULL_UP); 101 s3c_gpio_setpull(S5PV210_GPG3(2), S3C_GPIO_PULL_UP);
diff --git a/arch/arm/mach-s5pv210/sleep.S b/arch/arm/mach-s5pv210/sleep.S
new file mode 100644
index 000000000000..d4d222b716b4
--- /dev/null
+++ b/arch/arm/mach-s5pv210/sleep.S
@@ -0,0 +1,170 @@
1/* linux/arch/arm/plat-s5p/sleep.S
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV210 power Manager (Suspend-To-RAM) support
7 * Based on S3C2410 sleep code by:
8 * Ben Dooks, (c) 2004 Simtec Electronics
9 *
10 * Based on PXA/SA1100 sleep code by:
11 * Nicolas Pitre, (c) 2002 Monta Vista Software Inc
12 * Cliff Brake, (c) 2001
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 as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27*/
28
29#include <linux/linkage.h>
30#include <asm/assembler.h>
31#include <asm/memory.h>
32
33 .text
34
35 /* s3c_cpu_save
36 *
37 * entry:
38 * r0 = save address (virtual addr of s3c_sleep_save_phys)
39 */
40
41ENTRY(s3c_cpu_save)
42
43 stmfd sp!, { r3 - r12, lr }
44
45 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
46 mrc p15, 0, r5, c3, c0, 0 @ Domain ID
47 mrc p15, 0, r6, c2, c0, 0 @ Translation Table BASE0
48 mrc p15, 0, r7, c2, c0, 1 @ Translation Table BASE1
49 mrc p15, 0, r8, c2, c0, 2 @ Translation Table Control
50 mrc p15, 0, r9, c1, c0, 0 @ Control register
51 mrc p15, 0, r10, c1, c0, 1 @ Auxiliary control register
52 mrc p15, 0, r11, c1, c0, 2 @ Co-processor access controls
53 mrc p15, 0, r12, c10, c2, 0 @ Read PRRR
54 mrc p15, 0, r3, c10, c2, 1 @ READ NMRR
55
56 stmia r0, { r3 - r13 }
57
58 bl s3c_pm_cb_flushcache
59
60 ldr r0, =pm_cpu_sleep
61 ldr r0, [ r0 ]
62 mov pc, r0
63
64resume_with_mmu:
65 /*
66 * After MMU is turned on, restore the previous MMU table.
67 */
68 ldr r9 , =(PAGE_OFFSET - PHYS_OFFSET)
69 add r4, r4, r9
70 str r12, [r4]
71
72 ldmfd sp!, { r3 - r12, pc }
73
74 .ltorg
75
76 .data
77
78 .global s3c_sleep_save_phys
79s3c_sleep_save_phys:
80 .word 0
81
82 /* sleep magic, to allow the bootloader to check for an valid
83 * image to resume to. Must be the first word before the
84 * s3c_cpu_resume entry.
85 */
86
87 .word 0x2bedf00d
88
89 /* s3c_cpu_resume
90 *
91 * resume code entry for bootloader to call
92 *
93 * we must put this code here in the data segment as we have no
94 * other way of restoring the stack pointer after sleep, and we
95 * must not write to the code segment (code is read-only)
96 */
97
98ENTRY(s3c_cpu_resume)
99 mov r0, #PSR_I_BIT | PSR_F_BIT | SVC_MODE
100 msr cpsr_c, r0
101
102 mov r1, #0
103 mcr p15, 0, r1, c8, c7, 0 @ invalidate TLBs
104 mcr p15, 0, r1, c7, c5, 0 @ invalidate I Cache
105
106 ldr r0, s3c_sleep_save_phys @ address of restore block
107 ldmia r0, { r3 - r13 }
108
109 mcr p15, 0, r4, c13, c0, 0 @ FCSE/PID
110 mcr p15, 0, r5, c3, c0, 0 @ Domain ID
111
112 mcr p15, 0, r8, c2, c0, 2 @ Translation Table Control
113 mcr p15, 0, r7, c2, c0, 1 @ Translation Table BASE1
114 mcr p15, 0, r6, c2, c0, 0 @ Translation Table BASE0
115
116 mcr p15, 0, r10, c1, c0, 1 @ Auxiliary control register
117
118 mov r0, #0
119 mcr p15, 0, r0, c8, c7, 0 @ Invalidate I & D TLB
120
121 mov r0, #0 @ restore copro access
122 mcr p15, 0, r11, c1, c0, 2 @ Co-processor access
123 mcr p15, 0, r0, c7, c5, 4
124
125 mcr p15, 0, r12, c10, c2, 0 @ write PRRR
126 mcr p15, 0, r3, c10, c2, 1 @ write NMRR
127
128 /*
129 * In Cortex-A8, when MMU is turned on, the pipeline is flushed.
130 * And there are no valid entries in the MMU table at this point.
131 * So before turning on the MMU, the MMU entry for the DRAM address
132 * range is added. After the MMU is turned on, the other entries
133 * in the MMU table will be restored.
134 */
135
136 /* r6 = Translation Table BASE0 */
137 mov r4, r6
138 mov r4, r4, LSR #14
139 mov r4, r4, LSL #14
140
141 /* Load address for adding to MMU table list */
142 ldr r11, =0xE010F000 @ INFORM0 reg.
143 ldr r10, [r11, #0]
144 mov r10, r10, LSR #18
145 bic r10, r10, #0x3
146 orr r4, r4, r10
147
148 /* Calculate MMU table entry */
149 mov r10, r10, LSL #18
150 ldr r5, =0x40E
151 orr r10, r10, r5
152
153 /* Back up originally data */
154 ldr r12, [r4]
155
156 /* Add calculated MMU table entry into MMU table list */
157 str r10, [r4]
158
159 ldr r2, =resume_with_mmu
160 mcr p15, 0, r9, c1, c0, 0 @ turn on MMU, etc
161
162 nop
163 nop
164 nop
165 nop
166 nop @ second-to-last before mmu
167
168 mov pc, r2 @ go back to virtual address
169
170 .ltorg
diff --git a/arch/arm/mach-s5pv310/Kconfig b/arch/arm/mach-s5pv310/Kconfig
index 331b5bd97aba..1150b360f38c 100644
--- a/arch/arm/mach-s5pv310/Kconfig
+++ b/arch/arm/mach-s5pv310/Kconfig
@@ -11,7 +11,6 @@ if ARCH_S5PV310
11 11
12config CPU_S5PV310 12config CPU_S5PV310
13 bool 13 bool
14 select PLAT_S5P
15 help 14 help
16 Enable S5PV310 CPU support 15 Enable S5PV310 CPU support
17 16
@@ -25,21 +24,105 @@ config S5PV310_SETUP_I2C2
25 help 24 help
26 Common setup code for i2c bus 2. 25 Common setup code for i2c bus 2.
27 26
27config S5PV310_SETUP_I2C3
28 bool
29 help
30 Common setup code for i2c bus 3.
31
32config S5PV310_SETUP_I2C4
33 bool
34 help
35 Common setup code for i2c bus 4.
36
37config S5PV310_SETUP_I2C5
38 bool
39 help
40 Common setup code for i2c bus 5.
41
42config S5PV310_SETUP_I2C6
43 bool
44 help
45 Common setup code for i2c bus 6.
46
47config S5PV310_SETUP_I2C7
48 bool
49 help
50 Common setup code for i2c bus 7.
51
52config S5PV310_SETUP_SDHCI
53 bool
54 select S5PV310_SETUP_SDHCI_GPIO
55 help
56 Internal helper functions for S5PV310 based SDHCI systems.
57
58config S5PV310_SETUP_SDHCI_GPIO
59 bool
60 help
61 Common setup code for SDHCI gpio.
62
28# machine support 63# machine support
29 64
30config MACH_SMDKV310 65menu "S5PC210 Machines"
31 bool "SMDKV310" 66
67config MACH_SMDKC210
68 bool "SMDKC210"
32 select CPU_S5PV310 69 select CPU_S5PV310
33 select ARCH_SPARSEMEM_ENABLE 70 select S3C_DEV_RTC
71 select S3C_DEV_WDT
72 select S3C_DEV_HSMMC
73 select S3C_DEV_HSMMC1
74 select S3C_DEV_HSMMC2
75 select S3C_DEV_HSMMC3
76 select S5PV310_SETUP_SDHCI
34 help 77 help
35 Machine support for Samsung SMDKV310 78 Machine support for Samsung SMDKC210
79 S5PC210(MCP) is one of package option of S5PV310
36 80
37config MACH_UNIVERSAL_C210 81config MACH_UNIVERSAL_C210
38 bool "Mobile UNIVERSAL_C210 Board" 82 bool "Mobile UNIVERSAL_C210 Board"
39 select CPU_S5PV310 83 select CPU_S5PV310
40 select ARCH_SPARSEMEM_ENABLE 84 select S5P_DEV_ONENAND
85 select S3C_DEV_I2C1
86 select S5PV310_SETUP_I2C1
41 help 87 help
42 Machine support for Samsung Mobile Universal S5PC210 Reference 88 Machine support for Samsung Mobile Universal S5PC210 Reference
43 Board. S5PC210(MCP) is one of package option of S5PV310 89 Board. S5PC210(MCP) is one of package option of S5PV310
44 90
91endmenu
92
93menu "S5PV310 Machines"
94
95config MACH_SMDKV310
96 bool "SMDKV310"
97 select CPU_S5PV310
98 select S3C_DEV_RTC
99 select S3C_DEV_WDT
100 select S3C_DEV_HSMMC
101 select S3C_DEV_HSMMC1
102 select S3C_DEV_HSMMC2
103 select S3C_DEV_HSMMC3
104 select S5PV310_SETUP_SDHCI
105 help
106 Machine support for Samsung SMDKV310
107
108endmenu
109
110comment "Configuration for HSMMC bus width"
111
112menu "Use 8-bit bus width"
113
114config S5PV310_SDHCI_CH0_8BIT
115 bool "Channel 0 with 8-bit bus"
116 help
117 Support HSMMC Channel 0 8-bit bus.
118 If selected, Channel 1 is disabled.
119
120config S5PV310_SDHCI_CH2_8BIT
121 bool "Channel 2 with 8-bit bus"
122 help
123 Support HSMMC Channel 2 8-bit bus.
124 If selected, Channel 3 is disabled.
125
126endmenu
127
45endif 128endif
diff --git a/arch/arm/mach-s5pv310/Makefile b/arch/arm/mach-s5pv310/Makefile
index d5b51c72340f..84afc64e7c01 100644
--- a/arch/arm/mach-s5pv310/Makefile
+++ b/arch/arm/mach-s5pv310/Makefile
@@ -13,7 +13,7 @@ obj- :=
13# Core support for S5PV310 system 13# Core support for S5PV310 system
14 14
15obj-$(CONFIG_CPU_S5PV310) += cpu.o init.o clock.o irq-combiner.o 15obj-$(CONFIG_CPU_S5PV310) += cpu.o init.o clock.o irq-combiner.o
16obj-$(CONFIG_CPU_S5PV310) += setup-i2c0.o time.o 16obj-$(CONFIG_CPU_S5PV310) += setup-i2c0.o time.o gpiolib.o irq-eint.o
17 17
18obj-$(CONFIG_SMP) += platsmp.o headsmp.o 18obj-$(CONFIG_SMP) += platsmp.o headsmp.o
19obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o 19obj-$(CONFIG_LOCAL_TIMERS) += localtimer.o
@@ -21,6 +21,7 @@ obj-$(CONFIG_HOTPLUG_CPU) += hotplug.o
21 21
22# machine support 22# machine support
23 23
24obj-$(CONFIG_MACH_SMDKC210) += mach-smdkc210.o
24obj-$(CONFIG_MACH_SMDKV310) += mach-smdkv310.o 25obj-$(CONFIG_MACH_SMDKV310) += mach-smdkv310.o
25obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o 26obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o
26 27
@@ -28,3 +29,10 @@ obj-$(CONFIG_MACH_UNIVERSAL_C210) += mach-universal_c210.o
28 29
29obj-$(CONFIG_S5PV310_SETUP_I2C1) += setup-i2c1.o 30obj-$(CONFIG_S5PV310_SETUP_I2C1) += setup-i2c1.o
30obj-$(CONFIG_S5PV310_SETUP_I2C2) += setup-i2c2.o 31obj-$(CONFIG_S5PV310_SETUP_I2C2) += setup-i2c2.o
32obj-$(CONFIG_S5PV310_SETUP_I2C3) += setup-i2c3.o
33obj-$(CONFIG_S5PV310_SETUP_I2C4) += setup-i2c4.o
34obj-$(CONFIG_S5PV310_SETUP_I2C5) += setup-i2c5.o
35obj-$(CONFIG_S5PV310_SETUP_I2C6) += setup-i2c6.o
36obj-$(CONFIG_S5PV310_SETUP_I2C7) += setup-i2c7.o
37obj-$(CONFIG_S5PV310_SETUP_SDHCI) += setup-sdhci.o
38obj-$(CONFIG_S5PV310_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
diff --git a/arch/arm/mach-s5pv310/clock.c b/arch/arm/mach-s5pv310/clock.c
index 26a0f03df8ea..58c9d33f36fe 100644
--- a/arch/arm/mach-s5pv310/clock.c
+++ b/arch/arm/mach-s5pv310/clock.c
@@ -30,16 +30,92 @@ static struct clk clk_sclk_hdmi27m = {
30 .rate = 27000000, 30 .rate = 27000000,
31}; 31};
32 32
33static struct clk clk_sclk_hdmiphy = {
34 .name = "sclk_hdmiphy",
35 .id = -1,
36};
37
38static struct clk clk_sclk_usbphy0 = {
39 .name = "sclk_usbphy0",
40 .id = -1,
41 .rate = 27000000,
42};
43
44static struct clk clk_sclk_usbphy1 = {
45 .name = "sclk_usbphy1",
46 .id = -1,
47};
48
49static int s5pv310_clksrc_mask_top_ctrl(struct clk *clk, int enable)
50{
51 return s5p_gatectrl(S5P_CLKSRC_MASK_TOP, clk, enable);
52}
53
54static int s5pv310_clksrc_mask_cam_ctrl(struct clk *clk, int enable)
55{
56 return s5p_gatectrl(S5P_CLKSRC_MASK_CAM, clk, enable);
57}
58
59static int s5pv310_clksrc_mask_lcd0_ctrl(struct clk *clk, int enable)
60{
61 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD0, clk, enable);
62}
63
64static int s5pv310_clksrc_mask_lcd1_ctrl(struct clk *clk, int enable)
65{
66 return s5p_gatectrl(S5P_CLKSRC_MASK_LCD1, clk, enable);
67}
68
69static int s5pv310_clksrc_mask_fsys_ctrl(struct clk *clk, int enable)
70{
71 return s5p_gatectrl(S5P_CLKSRC_MASK_FSYS, clk, enable);
72}
73
33static int s5pv310_clksrc_mask_peril0_ctrl(struct clk *clk, int enable) 74static int s5pv310_clksrc_mask_peril0_ctrl(struct clk *clk, int enable)
34{ 75{
35 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable); 76 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL0, clk, enable);
36} 77}
37 78
79static int s5pv310_clksrc_mask_peril1_ctrl(struct clk *clk, int enable)
80{
81 return s5p_gatectrl(S5P_CLKSRC_MASK_PERIL1, clk, enable);
82}
83
84static int s5pv310_clk_ip_cam_ctrl(struct clk *clk, int enable)
85{
86 return s5p_gatectrl(S5P_CLKGATE_IP_CAM, clk, enable);
87}
88
89static int s5pv310_clk_ip_image_ctrl(struct clk *clk, int enable)
90{
91 return s5p_gatectrl(S5P_CLKGATE_IP_IMAGE, clk, enable);
92}
93
94static int s5pv310_clk_ip_lcd0_ctrl(struct clk *clk, int enable)
95{
96 return s5p_gatectrl(S5P_CLKGATE_IP_LCD0, clk, enable);
97}
98
99static int s5pv310_clk_ip_lcd1_ctrl(struct clk *clk, int enable)
100{
101 return s5p_gatectrl(S5P_CLKGATE_IP_LCD1, clk, enable);
102}
103
104static int s5pv310_clk_ip_fsys_ctrl(struct clk *clk, int enable)
105{
106 return s5p_gatectrl(S5P_CLKGATE_IP_FSYS, clk, enable);
107}
108
38static int s5pv310_clk_ip_peril_ctrl(struct clk *clk, int enable) 109static int s5pv310_clk_ip_peril_ctrl(struct clk *clk, int enable)
39{ 110{
40 return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable); 111 return s5p_gatectrl(S5P_CLKGATE_IP_PERIL, clk, enable);
41} 112}
42 113
114static int s5pv310_clk_ip_perir_ctrl(struct clk *clk, int enable)
115{
116 return s5p_gatectrl(S5P_CLKGATE_IP_PERIR, clk, enable);
117}
118
43/* Core list of CMU_CPU side */ 119/* Core list of CMU_CPU side */
44 120
45static struct clksrc_clk clk_mout_apll = { 121static struct clksrc_clk clk_mout_apll = {
@@ -79,7 +155,7 @@ static struct clksrc_clk clk_mout_mpll = {
79}; 155};
80 156
81static struct clk *clkset_moutcore_list[] = { 157static struct clk *clkset_moutcore_list[] = {
82 [0] = &clk_sclk_apll.clk, 158 [0] = &clk_mout_apll.clk,
83 [1] = &clk_mout_mpll.clk, 159 [1] = &clk_mout_mpll.clk,
84}; 160};
85 161
@@ -150,24 +226,6 @@ static struct clksrc_clk clk_periphclk = {
150 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 }, 226 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 12, .size = 3 },
151}; 227};
152 228
153static struct clksrc_clk clk_atclk = {
154 .clk = {
155 .name = "atclk",
156 .id = -1,
157 .parent = &clk_moutcore.clk,
158 },
159 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 16, .size = 3 },
160};
161
162static struct clksrc_clk clk_pclk_dbg = {
163 .clk = {
164 .name = "pclk_dbg",
165 .id = -1,
166 .parent = &clk_atclk.clk,
167 },
168 .reg_div = { .reg = S5P_CLKDIV_CPU, .shift = 20, .size = 3 },
169};
170
171/* Core list of CMU_CORE side */ 229/* Core list of CMU_CORE side */
172 230
173static struct clk *clkset_corebus_list[] = { 231static struct clk *clkset_corebus_list[] = {
@@ -241,7 +299,7 @@ static struct clk *clkset_aclk_top_list[] = {
241 [1] = &clk_sclk_apll.clk, 299 [1] = &clk_sclk_apll.clk,
242}; 300};
243 301
244static struct clksrc_sources clkset_aclk_200 = { 302static struct clksrc_sources clkset_aclk = {
245 .sources = clkset_aclk_top_list, 303 .sources = clkset_aclk_top_list,
246 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list), 304 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
247}; 305};
@@ -251,52 +309,37 @@ static struct clksrc_clk clk_aclk_200 = {
251 .name = "aclk_200", 309 .name = "aclk_200",
252 .id = -1, 310 .id = -1,
253 }, 311 },
254 .sources = &clkset_aclk_200, 312 .sources = &clkset_aclk,
255 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 }, 313 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 12, .size = 1 },
256 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 }, 314 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 0, .size = 3 },
257}; 315};
258 316
259static struct clksrc_sources clkset_aclk_100 = {
260 .sources = clkset_aclk_top_list,
261 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
262};
263
264static struct clksrc_clk clk_aclk_100 = { 317static struct clksrc_clk clk_aclk_100 = {
265 .clk = { 318 .clk = {
266 .name = "aclk_100", 319 .name = "aclk_100",
267 .id = -1, 320 .id = -1,
268 }, 321 },
269 .sources = &clkset_aclk_100, 322 .sources = &clkset_aclk,
270 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 }, 323 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 16, .size = 1 },
271 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 }, 324 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 4, .size = 4 },
272}; 325};
273 326
274static struct clksrc_sources clkset_aclk_160 = {
275 .sources = clkset_aclk_top_list,
276 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
277};
278
279static struct clksrc_clk clk_aclk_160 = { 327static struct clksrc_clk clk_aclk_160 = {
280 .clk = { 328 .clk = {
281 .name = "aclk_160", 329 .name = "aclk_160",
282 .id = -1, 330 .id = -1,
283 }, 331 },
284 .sources = &clkset_aclk_160, 332 .sources = &clkset_aclk,
285 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 }, 333 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 20, .size = 1 },
286 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 }, 334 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 8, .size = 3 },
287}; 335};
288 336
289static struct clksrc_sources clkset_aclk_133 = {
290 .sources = clkset_aclk_top_list,
291 .nr_sources = ARRAY_SIZE(clkset_aclk_top_list),
292};
293
294static struct clksrc_clk clk_aclk_133 = { 337static struct clksrc_clk clk_aclk_133 = {
295 .clk = { 338 .clk = {
296 .name = "aclk_133", 339 .name = "aclk_133",
297 .id = -1, 340 .id = -1,
298 }, 341 },
299 .sources = &clkset_aclk_133, 342 .sources = &clkset_aclk,
300 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 }, 343 .reg_src = { .reg = S5P_CLKSRC_TOP0, .shift = 24, .size = 1 },
301 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 }, 344 .reg_div = { .reg = S5P_CLKDIV_TOP, .shift = 12, .size = 3 },
302}; 345};
@@ -315,6 +358,8 @@ static struct clksrc_clk clk_vpllsrc = {
315 .clk = { 358 .clk = {
316 .name = "vpll_src", 359 .name = "vpll_src",
317 .id = -1, 360 .id = -1,
361 .enable = s5pv310_clksrc_mask_top_ctrl,
362 .ctrlbit = (1 << 0),
318 }, 363 },
319 .sources = &clkset_vpllsrc, 364 .sources = &clkset_vpllsrc,
320 .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 }, 365 .reg_src = { .reg = S5P_CLKSRC_TOP1, .shift = 0, .size = 1 },
@@ -346,7 +391,175 @@ static struct clk init_clocks_disable[] = {
346 .parent = &clk_aclk_100.clk, 391 .parent = &clk_aclk_100.clk,
347 .enable = s5pv310_clk_ip_peril_ctrl, 392 .enable = s5pv310_clk_ip_peril_ctrl,
348 .ctrlbit = (1<<24), 393 .ctrlbit = (1<<24),
349 } 394 }, {
395 .name = "csis",
396 .id = 0,
397 .enable = s5pv310_clk_ip_cam_ctrl,
398 .ctrlbit = (1 << 4),
399 }, {
400 .name = "csis",
401 .id = 1,
402 .enable = s5pv310_clk_ip_cam_ctrl,
403 .ctrlbit = (1 << 5),
404 }, {
405 .name = "fimc",
406 .id = 0,
407 .enable = s5pv310_clk_ip_cam_ctrl,
408 .ctrlbit = (1 << 0),
409 }, {
410 .name = "fimc",
411 .id = 1,
412 .enable = s5pv310_clk_ip_cam_ctrl,
413 .ctrlbit = (1 << 1),
414 }, {
415 .name = "fimc",
416 .id = 2,
417 .enable = s5pv310_clk_ip_cam_ctrl,
418 .ctrlbit = (1 << 2),
419 }, {
420 .name = "fimc",
421 .id = 3,
422 .enable = s5pv310_clk_ip_cam_ctrl,
423 .ctrlbit = (1 << 3),
424 }, {
425 .name = "fimd",
426 .id = 0,
427 .enable = s5pv310_clk_ip_lcd0_ctrl,
428 .ctrlbit = (1 << 0),
429 }, {
430 .name = "fimd",
431 .id = 1,
432 .enable = s5pv310_clk_ip_lcd1_ctrl,
433 .ctrlbit = (1 << 0),
434 }, {
435 .name = "hsmmc",
436 .id = 0,
437 .parent = &clk_aclk_133.clk,
438 .enable = s5pv310_clk_ip_fsys_ctrl,
439 .ctrlbit = (1 << 5),
440 }, {
441 .name = "hsmmc",
442 .id = 1,
443 .parent = &clk_aclk_133.clk,
444 .enable = s5pv310_clk_ip_fsys_ctrl,
445 .ctrlbit = (1 << 6),
446 }, {
447 .name = "hsmmc",
448 .id = 2,
449 .parent = &clk_aclk_133.clk,
450 .enable = s5pv310_clk_ip_fsys_ctrl,
451 .ctrlbit = (1 << 7),
452 }, {
453 .name = "hsmmc",
454 .id = 3,
455 .parent = &clk_aclk_133.clk,
456 .enable = s5pv310_clk_ip_fsys_ctrl,
457 .ctrlbit = (1 << 8),
458 }, {
459 .name = "hsmmc",
460 .id = 4,
461 .parent = &clk_aclk_133.clk,
462 .enable = s5pv310_clk_ip_fsys_ctrl,
463 .ctrlbit = (1 << 9),
464 }, {
465 .name = "sata",
466 .id = -1,
467 .enable = s5pv310_clk_ip_fsys_ctrl,
468 .ctrlbit = (1 << 10),
469 }, {
470 .name = "adc",
471 .id = -1,
472 .enable = s5pv310_clk_ip_peril_ctrl,
473 .ctrlbit = (1 << 15),
474 }, {
475 .name = "rtc",
476 .id = -1,
477 .enable = s5pv310_clk_ip_perir_ctrl,
478 .ctrlbit = (1 << 15),
479 }, {
480 .name = "watchdog",
481 .id = -1,
482 .enable = s5pv310_clk_ip_perir_ctrl,
483 .ctrlbit = (1 << 14),
484 }, {
485 .name = "usbhost",
486 .id = -1,
487 .enable = s5pv310_clk_ip_fsys_ctrl ,
488 .ctrlbit = (1 << 12),
489 }, {
490 .name = "otg",
491 .id = -1,
492 .enable = s5pv310_clk_ip_fsys_ctrl,
493 .ctrlbit = (1 << 13),
494 }, {
495 .name = "spi",
496 .id = 0,
497 .enable = s5pv310_clk_ip_peril_ctrl,
498 .ctrlbit = (1 << 16),
499 }, {
500 .name = "spi",
501 .id = 1,
502 .enable = s5pv310_clk_ip_peril_ctrl,
503 .ctrlbit = (1 << 17),
504 }, {
505 .name = "spi",
506 .id = 2,
507 .enable = s5pv310_clk_ip_peril_ctrl,
508 .ctrlbit = (1 << 18),
509 }, {
510 .name = "fimg2d",
511 .id = -1,
512 .enable = s5pv310_clk_ip_image_ctrl,
513 .ctrlbit = (1 << 0),
514 }, {
515 .name = "i2c",
516 .id = 0,
517 .parent = &clk_aclk_100.clk,
518 .enable = s5pv310_clk_ip_peril_ctrl,
519 .ctrlbit = (1 << 6),
520 }, {
521 .name = "i2c",
522 .id = 1,
523 .parent = &clk_aclk_100.clk,
524 .enable = s5pv310_clk_ip_peril_ctrl,
525 .ctrlbit = (1 << 7),
526 }, {
527 .name = "i2c",
528 .id = 2,
529 .parent = &clk_aclk_100.clk,
530 .enable = s5pv310_clk_ip_peril_ctrl,
531 .ctrlbit = (1 << 8),
532 }, {
533 .name = "i2c",
534 .id = 3,
535 .parent = &clk_aclk_100.clk,
536 .enable = s5pv310_clk_ip_peril_ctrl,
537 .ctrlbit = (1 << 9),
538 }, {
539 .name = "i2c",
540 .id = 4,
541 .parent = &clk_aclk_100.clk,
542 .enable = s5pv310_clk_ip_peril_ctrl,
543 .ctrlbit = (1 << 10),
544 }, {
545 .name = "i2c",
546 .id = 5,
547 .parent = &clk_aclk_100.clk,
548 .enable = s5pv310_clk_ip_peril_ctrl,
549 .ctrlbit = (1 << 11),
550 }, {
551 .name = "i2c",
552 .id = 6,
553 .parent = &clk_aclk_100.clk,
554 .enable = s5pv310_clk_ip_peril_ctrl,
555 .ctrlbit = (1 << 12),
556 }, {
557 .name = "i2c",
558 .id = 7,
559 .parent = &clk_aclk_100.clk,
560 .enable = s5pv310_clk_ip_peril_ctrl,
561 .ctrlbit = (1 << 13),
562 },
350}; 563};
351 564
352static struct clk init_clocks[] = { 565static struct clk init_clocks[] = {
@@ -387,6 +600,9 @@ static struct clk *clkset_group_list[] = {
387 [0] = &clk_ext_xtal_mux, 600 [0] = &clk_ext_xtal_mux,
388 [1] = &clk_xusbxti, 601 [1] = &clk_xusbxti,
389 [2] = &clk_sclk_hdmi27m, 602 [2] = &clk_sclk_hdmi27m,
603 [3] = &clk_sclk_usbphy0,
604 [4] = &clk_sclk_usbphy1,
605 [5] = &clk_sclk_hdmiphy,
390 [6] = &clk_mout_mpll.clk, 606 [6] = &clk_mout_mpll.clk,
391 [7] = &clk_mout_epll.clk, 607 [7] = &clk_mout_epll.clk,
392 [8] = &clk_sclk_vpll.clk, 608 [8] = &clk_sclk_vpll.clk,
@@ -397,6 +613,104 @@ static struct clksrc_sources clkset_group = {
397 .nr_sources = ARRAY_SIZE(clkset_group_list), 613 .nr_sources = ARRAY_SIZE(clkset_group_list),
398}; 614};
399 615
616static struct clk *clkset_mout_g2d0_list[] = {
617 [0] = &clk_mout_mpll.clk,
618 [1] = &clk_sclk_apll.clk,
619};
620
621static struct clksrc_sources clkset_mout_g2d0 = {
622 .sources = clkset_mout_g2d0_list,
623 .nr_sources = ARRAY_SIZE(clkset_mout_g2d0_list),
624};
625
626static struct clksrc_clk clk_mout_g2d0 = {
627 .clk = {
628 .name = "mout_g2d0",
629 .id = -1,
630 },
631 .sources = &clkset_mout_g2d0,
632 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 0, .size = 1 },
633};
634
635static struct clk *clkset_mout_g2d1_list[] = {
636 [0] = &clk_mout_epll.clk,
637 [1] = &clk_sclk_vpll.clk,
638};
639
640static struct clksrc_sources clkset_mout_g2d1 = {
641 .sources = clkset_mout_g2d1_list,
642 .nr_sources = ARRAY_SIZE(clkset_mout_g2d1_list),
643};
644
645static struct clksrc_clk clk_mout_g2d1 = {
646 .clk = {
647 .name = "mout_g2d1",
648 .id = -1,
649 },
650 .sources = &clkset_mout_g2d1,
651 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 4, .size = 1 },
652};
653
654static struct clk *clkset_mout_g2d_list[] = {
655 [0] = &clk_mout_g2d0.clk,
656 [1] = &clk_mout_g2d1.clk,
657};
658
659static struct clksrc_sources clkset_mout_g2d = {
660 .sources = clkset_mout_g2d_list,
661 .nr_sources = ARRAY_SIZE(clkset_mout_g2d_list),
662};
663
664static struct clksrc_clk clk_dout_mmc0 = {
665 .clk = {
666 .name = "dout_mmc0",
667 .id = -1,
668 },
669 .sources = &clkset_group,
670 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 0, .size = 4 },
671 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 0, .size = 4 },
672};
673
674static struct clksrc_clk clk_dout_mmc1 = {
675 .clk = {
676 .name = "dout_mmc1",
677 .id = -1,
678 },
679 .sources = &clkset_group,
680 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 4, .size = 4 },
681 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 16, .size = 4 },
682};
683
684static struct clksrc_clk clk_dout_mmc2 = {
685 .clk = {
686 .name = "dout_mmc2",
687 .id = -1,
688 },
689 .sources = &clkset_group,
690 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 8, .size = 4 },
691 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 0, .size = 4 },
692};
693
694static struct clksrc_clk clk_dout_mmc3 = {
695 .clk = {
696 .name = "dout_mmc3",
697 .id = -1,
698 },
699 .sources = &clkset_group,
700 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 12, .size = 4 },
701 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 16, .size = 4 },
702};
703
704static struct clksrc_clk clk_dout_mmc4 = {
705 .clk = {
706 .name = "dout_mmc4",
707 .id = -1,
708 },
709 .sources = &clkset_group,
710 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 16, .size = 4 },
711 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 0, .size = 4 },
712};
713
400static struct clksrc_clk clksrcs[] = { 714static struct clksrc_clk clksrcs[] = {
401 { 715 {
402 .clk = { 716 .clk = {
@@ -448,7 +762,200 @@ static struct clksrc_clk clksrcs[] = {
448 .sources = &clkset_group, 762 .sources = &clkset_group,
449 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 }, 763 .reg_src = { .reg = S5P_CLKSRC_PERIL0, .shift = 24, .size = 4 },
450 .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 }, 764 .reg_div = { .reg = S5P_CLKDIV_PERIL3, .shift = 0, .size = 4 },
451 }, 765 }, {
766 .clk = {
767 .name = "sclk_csis",
768 .id = 0,
769 .enable = s5pv310_clksrc_mask_cam_ctrl,
770 .ctrlbit = (1 << 24),
771 },
772 .sources = &clkset_group,
773 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 24, .size = 4 },
774 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 24, .size = 4 },
775 }, {
776 .clk = {
777 .name = "sclk_csis",
778 .id = 1,
779 .enable = s5pv310_clksrc_mask_cam_ctrl,
780 .ctrlbit = (1 << 28),
781 },
782 .sources = &clkset_group,
783 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 28, .size = 4 },
784 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
785 }, {
786 .clk = {
787 .name = "sclk_cam",
788 .id = 0,
789 .enable = s5pv310_clksrc_mask_cam_ctrl,
790 .ctrlbit = (1 << 16),
791 },
792 .sources = &clkset_group,
793 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 16, .size = 4 },
794 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
795 }, {
796 .clk = {
797 .name = "sclk_cam",
798 .id = 1,
799 .enable = s5pv310_clksrc_mask_cam_ctrl,
800 .ctrlbit = (1 << 20),
801 },
802 .sources = &clkset_group,
803 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 20, .size = 4 },
804 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 20, .size = 4 },
805 }, {
806 .clk = {
807 .name = "sclk_fimc",
808 .id = 0,
809 .enable = s5pv310_clksrc_mask_cam_ctrl,
810 .ctrlbit = (1 << 0),
811 },
812 .sources = &clkset_group,
813 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 0, .size = 4 },
814 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 0, .size = 4 },
815 }, {
816 .clk = {
817 .name = "sclk_fimc",
818 .id = 1,
819 .enable = s5pv310_clksrc_mask_cam_ctrl,
820 .ctrlbit = (1 << 4),
821 },
822 .sources = &clkset_group,
823 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 4, .size = 4 },
824 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 4, .size = 4 },
825 }, {
826 .clk = {
827 .name = "sclk_fimc",
828 .id = 2,
829 .enable = s5pv310_clksrc_mask_cam_ctrl,
830 .ctrlbit = (1 << 8),
831 },
832 .sources = &clkset_group,
833 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 8, .size = 4 },
834 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 8, .size = 4 },
835 }, {
836 .clk = {
837 .name = "sclk_fimc",
838 .id = 3,
839 .enable = s5pv310_clksrc_mask_cam_ctrl,
840 .ctrlbit = (1 << 12),
841 },
842 .sources = &clkset_group,
843 .reg_src = { .reg = S5P_CLKSRC_CAM, .shift = 12, .size = 4 },
844 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 12, .size = 4 },
845 }, {
846 .clk = {
847 .name = "sclk_fimd",
848 .id = 0,
849 .enable = s5pv310_clksrc_mask_lcd0_ctrl,
850 .ctrlbit = (1 << 0),
851 },
852 .sources = &clkset_group,
853 .reg_src = { .reg = S5P_CLKSRC_LCD0, .shift = 0, .size = 4 },
854 .reg_div = { .reg = S5P_CLKDIV_LCD0, .shift = 0, .size = 4 },
855 }, {
856 .clk = {
857 .name = "sclk_fimd",
858 .id = 1,
859 .enable = s5pv310_clksrc_mask_lcd1_ctrl,
860 .ctrlbit = (1 << 0),
861 },
862 .sources = &clkset_group,
863 .reg_src = { .reg = S5P_CLKSRC_LCD1, .shift = 0, .size = 4 },
864 .reg_div = { .reg = S5P_CLKDIV_LCD1, .shift = 0, .size = 4 },
865 }, {
866 .clk = {
867 .name = "sclk_sata",
868 .id = -1,
869 .enable = s5pv310_clksrc_mask_fsys_ctrl,
870 .ctrlbit = (1 << 24),
871 },
872 .sources = &clkset_mout_corebus,
873 .reg_src = { .reg = S5P_CLKSRC_FSYS, .shift = 24, .size = 1 },
874 .reg_div = { .reg = S5P_CLKDIV_FSYS0, .shift = 20, .size = 4 },
875 }, {
876 .clk = {
877 .name = "sclk_spi",
878 .id = 0,
879 .enable = s5pv310_clksrc_mask_peril1_ctrl,
880 .ctrlbit = (1 << 16),
881 },
882 .sources = &clkset_group,
883 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 16, .size = 4 },
884 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 0, .size = 4 },
885 }, {
886 .clk = {
887 .name = "sclk_spi",
888 .id = 1,
889 .enable = s5pv310_clksrc_mask_peril1_ctrl,
890 .ctrlbit = (1 << 20),
891 },
892 .sources = &clkset_group,
893 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 20, .size = 4 },
894 .reg_div = { .reg = S5P_CLKDIV_PERIL1, .shift = 16, .size = 4 },
895 }, {
896 .clk = {
897 .name = "sclk_spi",
898 .id = 2,
899 .enable = s5pv310_clksrc_mask_peril1_ctrl,
900 .ctrlbit = (1 << 24),
901 },
902 .sources = &clkset_group,
903 .reg_src = { .reg = S5P_CLKSRC_PERIL1, .shift = 24, .size = 4 },
904 .reg_div = { .reg = S5P_CLKDIV_PERIL2, .shift = 0, .size = 4 },
905 }, {
906 .clk = {
907 .name = "sclk_fimg2d",
908 .id = -1,
909 },
910 .sources = &clkset_mout_g2d,
911 .reg_src = { .reg = S5P_CLKSRC_IMAGE, .shift = 8, .size = 1 },
912 .reg_div = { .reg = S5P_CLKDIV_IMAGE, .shift = 0, .size = 4 },
913 }, {
914 .clk = {
915 .name = "sclk_mmc",
916 .id = 0,
917 .parent = &clk_dout_mmc0.clk,
918 .enable = s5pv310_clksrc_mask_fsys_ctrl,
919 .ctrlbit = (1 << 0),
920 },
921 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 8, .size = 8 },
922 }, {
923 .clk = {
924 .name = "sclk_mmc",
925 .id = 1,
926 .parent = &clk_dout_mmc1.clk,
927 .enable = s5pv310_clksrc_mask_fsys_ctrl,
928 .ctrlbit = (1 << 4),
929 },
930 .reg_div = { .reg = S5P_CLKDIV_FSYS1, .shift = 24, .size = 8 },
931 }, {
932 .clk = {
933 .name = "sclk_mmc",
934 .id = 2,
935 .parent = &clk_dout_mmc2.clk,
936 .enable = s5pv310_clksrc_mask_fsys_ctrl,
937 .ctrlbit = (1 << 8),
938 },
939 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 8, .size = 8 },
940 }, {
941 .clk = {
942 .name = "sclk_mmc",
943 .id = 3,
944 .parent = &clk_dout_mmc3.clk,
945 .enable = s5pv310_clksrc_mask_fsys_ctrl,
946 .ctrlbit = (1 << 12),
947 },
948 .reg_div = { .reg = S5P_CLKDIV_FSYS2, .shift = 24, .size = 8 },
949 }, {
950 .clk = {
951 .name = "sclk_mmc",
952 .id = 4,
953 .parent = &clk_dout_mmc4.clk,
954 .enable = s5pv310_clksrc_mask_fsys_ctrl,
955 .ctrlbit = (1 << 16),
956 },
957 .reg_div = { .reg = S5P_CLKDIV_FSYS3, .shift = 8, .size = 8 },
958 }
452}; 959};
453 960
454/* Clock initialization code */ 961/* Clock initialization code */
@@ -464,8 +971,6 @@ static struct clksrc_clk *sysclks[] = {
464 &clk_aclk_cores, 971 &clk_aclk_cores,
465 &clk_aclk_corem1, 972 &clk_aclk_corem1,
466 &clk_periphclk, 973 &clk_periphclk,
467 &clk_atclk,
468 &clk_pclk_dbg,
469 &clk_mout_corebus, 974 &clk_mout_corebus,
470 &clk_sclk_dmc, 975 &clk_sclk_dmc,
471 &clk_aclk_cored, 976 &clk_aclk_cored,
@@ -478,6 +983,11 @@ static struct clksrc_clk *sysclks[] = {
478 &clk_aclk_100, 983 &clk_aclk_100,
479 &clk_aclk_160, 984 &clk_aclk_160,
480 &clk_aclk_133, 985 &clk_aclk_133,
986 &clk_dout_mmc0,
987 &clk_dout_mmc1,
988 &clk_dout_mmc2,
989 &clk_dout_mmc3,
990 &clk_dout_mmc4,
481}; 991};
482 992
483void __init_or_cpufreq s5pv310_setup_clocks(void) 993void __init_or_cpufreq s5pv310_setup_clocks(void)
@@ -490,15 +1000,11 @@ void __init_or_cpufreq s5pv310_setup_clocks(void)
490 unsigned long vpllsrc; 1000 unsigned long vpllsrc;
491 unsigned long xtal; 1001 unsigned long xtal;
492 unsigned long armclk; 1002 unsigned long armclk;
493 unsigned long aclk_corem0;
494 unsigned long aclk_cores;
495 unsigned long aclk_corem1;
496 unsigned long periphclk;
497 unsigned long sclk_dmc; 1003 unsigned long sclk_dmc;
498 unsigned long aclk_cored; 1004 unsigned long aclk_200;
499 unsigned long aclk_corep; 1005 unsigned long aclk_100;
500 unsigned long aclk_acp; 1006 unsigned long aclk_160;
501 unsigned long pclk_acp; 1007 unsigned long aclk_133;
502 unsigned int ptr; 1008 unsigned int ptr;
503 1009
504 printk(KERN_DEBUG "%s: registering clocks\n", __func__); 1010 printk(KERN_DEBUG "%s: registering clocks\n", __func__);
@@ -529,26 +1035,21 @@ void __init_or_cpufreq s5pv310_setup_clocks(void)
529 apll, mpll, epll, vpll); 1035 apll, mpll, epll, vpll);
530 1036
531 armclk = clk_get_rate(&clk_armclk.clk); 1037 armclk = clk_get_rate(&clk_armclk.clk);
532 aclk_corem0 = clk_get_rate(&clk_aclk_corem0.clk);
533 aclk_cores = clk_get_rate(&clk_aclk_cores.clk);
534 aclk_corem1 = clk_get_rate(&clk_aclk_corem1.clk);
535 periphclk = clk_get_rate(&clk_periphclk.clk);
536 sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk); 1038 sclk_dmc = clk_get_rate(&clk_sclk_dmc.clk);
537 aclk_cored = clk_get_rate(&clk_aclk_cored.clk); 1039
538 aclk_corep = clk_get_rate(&clk_aclk_corep.clk); 1040 aclk_200 = clk_get_rate(&clk_aclk_200.clk);
539 aclk_acp = clk_get_rate(&clk_aclk_acp.clk); 1041 aclk_100 = clk_get_rate(&clk_aclk_100.clk);
540 pclk_acp = clk_get_rate(&clk_pclk_acp.clk); 1042 aclk_160 = clk_get_rate(&clk_aclk_160.clk);
541 1043 aclk_133 = clk_get_rate(&clk_aclk_133.clk);
542 printk(KERN_INFO "S5PV310: ARMCLK=%ld, COREM0=%ld, CORES=%ld\n" 1044
543 "COREM1=%ld, PERI=%ld, DMC=%ld, CORED=%ld\n" 1045 printk(KERN_INFO "S5PV310: ARMCLK=%ld, DMC=%ld, ACLK200=%ld\n"
544 "COREP=%ld, ACLK_ACP=%ld, PCLK_ACP=%ld", 1046 "ACLK100=%ld, ACLK160=%ld, ACLK133=%ld\n",
545 armclk, aclk_corem0, aclk_cores, aclk_corem1, 1047 armclk, sclk_dmc, aclk_200,
546 periphclk, sclk_dmc, aclk_cored, aclk_corep, 1048 aclk_100, aclk_160, aclk_133);
547 aclk_acp, pclk_acp);
548 1049
549 clk_f.rate = armclk; 1050 clk_f.rate = armclk;
550 clk_h.rate = sclk_dmc; 1051 clk_h.rate = sclk_dmc;
551 clk_p.rate = periphclk; 1052 clk_p.rate = aclk_100;
552 1053
553 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) 1054 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
554 s3c_set_clksrc(&clksrcs[ptr], true); 1055 s3c_set_clksrc(&clksrcs[ptr], true);
diff --git a/arch/arm/mach-s5pv310/cpu.c b/arch/arm/mach-s5pv310/cpu.c
index 4add39853ff9..82ce4aa6d61a 100644
--- a/arch/arm/mach-s5pv310/cpu.c
+++ b/arch/arm/mach-s5pv310/cpu.c
@@ -15,10 +15,12 @@
15#include <asm/mach/irq.h> 15#include <asm/mach/irq.h>
16 16
17#include <asm/proc-fns.h> 17#include <asm/proc-fns.h>
18#include <asm/hardware/cache-l2x0.h>
18 19
19#include <plat/cpu.h> 20#include <plat/cpu.h>
20#include <plat/clock.h> 21#include <plat/clock.h>
21#include <plat/s5pv310.h> 22#include <plat/s5pv310.h>
23#include <plat/sdhci.h>
22 24
23#include <mach/regs-irq.h> 25#include <mach/regs-irq.h>
24 26
@@ -56,15 +58,30 @@ static struct map_desc s5pv310_iodesc[] __initdata = {
56 .length = SZ_4K, 58 .length = SZ_4K,
57 .type = MT_DEVICE, 59 .type = MT_DEVICE,
58 }, { 60 }, {
59 .virtual = (unsigned long)S5P_VA_GPIO, 61 .virtual = (unsigned long)S5P_VA_GPIO1,
60 .pfn = __phys_to_pfn(S5PV310_PA_GPIO1), 62 .pfn = __phys_to_pfn(S5PV310_PA_GPIO1),
61 .length = SZ_4K, 63 .length = SZ_4K,
62 .type = MT_DEVICE, 64 .type = MT_DEVICE,
63 }, { 65 }, {
66 .virtual = (unsigned long)S5P_VA_GPIO2,
67 .pfn = __phys_to_pfn(S5PV310_PA_GPIO2),
68 .length = SZ_4K,
69 .type = MT_DEVICE,
70 }, {
71 .virtual = (unsigned long)S5P_VA_GPIO3,
72 .pfn = __phys_to_pfn(S5PV310_PA_GPIO3),
73 .length = SZ_256,
74 .type = MT_DEVICE,
75 }, {
64 .virtual = (unsigned long)S3C_VA_UART, 76 .virtual = (unsigned long)S3C_VA_UART,
65 .pfn = __phys_to_pfn(S3C_PA_UART), 77 .pfn = __phys_to_pfn(S3C_PA_UART),
66 .length = SZ_512K, 78 .length = SZ_512K,
67 .type = MT_DEVICE, 79 .type = MT_DEVICE,
80 }, {
81 .virtual = (unsigned long)S5P_VA_SROMC,
82 .pfn = __phys_to_pfn(S5PV310_PA_SROMC),
83 .length = SZ_4K,
84 .type = MT_DEVICE,
68 }, 85 },
69}; 86};
70 87
@@ -83,6 +100,12 @@ static void s5pv310_idle(void)
83void __init s5pv310_map_io(void) 100void __init s5pv310_map_io(void)
84{ 101{
85 iotable_init(s5pv310_iodesc, ARRAY_SIZE(s5pv310_iodesc)); 102 iotable_init(s5pv310_iodesc, ARRAY_SIZE(s5pv310_iodesc));
103
104 /* initialize device information early */
105 s5pv310_default_sdhci0();
106 s5pv310_default_sdhci1();
107 s5pv310_default_sdhci2();
108 s5pv310_default_sdhci3();
86} 109}
87 110
88void __init s5pv310_init_clocks(int xtal) 111void __init s5pv310_init_clocks(int xtal)
@@ -131,6 +154,28 @@ static int __init s5pv310_core_init(void)
131 154
132core_initcall(s5pv310_core_init); 155core_initcall(s5pv310_core_init);
133 156
157#ifdef CONFIG_CACHE_L2X0
158static int __init s5pv310_l2x0_cache_init(void)
159{
160 /* TAG, Data Latency Control: 2cycle */
161 __raw_writel(0x110, S5P_VA_L2CC + L2X0_TAG_LATENCY_CTRL);
162 __raw_writel(0x110, S5P_VA_L2CC + L2X0_DATA_LATENCY_CTRL);
163
164 /* L2X0 Prefetch Control */
165 __raw_writel(0x30000007, S5P_VA_L2CC + L2X0_PREFETCH_CTRL);
166
167 /* L2X0 Power Control */
168 __raw_writel(L2X0_DYNAMIC_CLK_GATING_EN | L2X0_STNDBY_MODE_EN,
169 S5P_VA_L2CC + L2X0_POWER_CTRL);
170
171 l2x0_init(S5P_VA_L2CC, 0x7C070001, 0xC200ffff);
172
173 return 0;
174}
175
176early_initcall(s5pv310_l2x0_cache_init);
177#endif
178
134int __init s5pv310_init(void) 179int __init s5pv310_init(void)
135{ 180{
136 printk(KERN_INFO "S5PV310: Initializing architecture\n"); 181 printk(KERN_INFO "S5PV310: Initializing architecture\n");
diff --git a/arch/arm/mach-s5pv310/gpiolib.c b/arch/arm/mach-s5pv310/gpiolib.c
new file mode 100644
index 000000000000..55217b8923ec
--- /dev/null
+++ b/arch/arm/mach-s5pv310/gpiolib.c
@@ -0,0 +1,304 @@
1/* linux/arch/arm/mach-s5pv310/gpiolib.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - GPIOlib support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/irq.h>
15#include <linux/io.h>
16#include <linux/gpio.h>
17
18#include <mach/map.h>
19
20#include <plat/gpio-core.h>
21#include <plat/gpio-cfg.h>
22#include <plat/gpio-cfg-helpers.h>
23
24static struct s3c_gpio_cfg gpio_cfg = {
25 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
26 .set_pull = s3c_gpio_setpull_updown,
27 .get_pull = s3c_gpio_getpull_updown,
28};
29
30static struct s3c_gpio_cfg gpio_cfg_noint = {
31 .set_config = s3c_gpio_setcfg_s3c64xx_4bit,
32 .set_pull = s3c_gpio_setpull_updown,
33 .get_pull = s3c_gpio_getpull_updown,
34};
35
36/*
37 * Following are the gpio banks in v310.
38 *
39 * The 'config' member when left to NULL, is initialized to the default
40 * structure gpio_cfg in the init function below.
41 *
42 * The 'base' member is also initialized in the init function below.
43 * Note: The initialization of 'base' member of s3c_gpio_chip structure
44 * uses the above macro and depends on the banks being listed in order here.
45 */
46static struct s3c_gpio_chip s5pv310_gpio_part1_4bit[] = {
47 {
48 .chip = {
49 .base = S5PV310_GPA0(0),
50 .ngpio = S5PV310_GPIO_A0_NR,
51 .label = "GPA0",
52 },
53 }, {
54 .chip = {
55 .base = S5PV310_GPA1(0),
56 .ngpio = S5PV310_GPIO_A1_NR,
57 .label = "GPA1",
58 },
59 }, {
60 .chip = {
61 .base = S5PV310_GPB(0),
62 .ngpio = S5PV310_GPIO_B_NR,
63 .label = "GPB",
64 },
65 }, {
66 .chip = {
67 .base = S5PV310_GPC0(0),
68 .ngpio = S5PV310_GPIO_C0_NR,
69 .label = "GPC0",
70 },
71 }, {
72 .chip = {
73 .base = S5PV310_GPC1(0),
74 .ngpio = S5PV310_GPIO_C1_NR,
75 .label = "GPC1",
76 },
77 }, {
78 .chip = {
79 .base = S5PV310_GPD0(0),
80 .ngpio = S5PV310_GPIO_D0_NR,
81 .label = "GPD0",
82 },
83 }, {
84 .chip = {
85 .base = S5PV310_GPD1(0),
86 .ngpio = S5PV310_GPIO_D1_NR,
87 .label = "GPD1",
88 },
89 }, {
90 .chip = {
91 .base = S5PV310_GPE0(0),
92 .ngpio = S5PV310_GPIO_E0_NR,
93 .label = "GPE0",
94 },
95 }, {
96 .chip = {
97 .base = S5PV310_GPE1(0),
98 .ngpio = S5PV310_GPIO_E1_NR,
99 .label = "GPE1",
100 },
101 }, {
102 .chip = {
103 .base = S5PV310_GPE2(0),
104 .ngpio = S5PV310_GPIO_E2_NR,
105 .label = "GPE2",
106 },
107 }, {
108 .chip = {
109 .base = S5PV310_GPE3(0),
110 .ngpio = S5PV310_GPIO_E3_NR,
111 .label = "GPE3",
112 },
113 }, {
114 .chip = {
115 .base = S5PV310_GPE4(0),
116 .ngpio = S5PV310_GPIO_E4_NR,
117 .label = "GPE4",
118 },
119 }, {
120 .chip = {
121 .base = S5PV310_GPF0(0),
122 .ngpio = S5PV310_GPIO_F0_NR,
123 .label = "GPF0",
124 },
125 }, {
126 .chip = {
127 .base = S5PV310_GPF1(0),
128 .ngpio = S5PV310_GPIO_F1_NR,
129 .label = "GPF1",
130 },
131 }, {
132 .chip = {
133 .base = S5PV310_GPF2(0),
134 .ngpio = S5PV310_GPIO_F2_NR,
135 .label = "GPF2",
136 },
137 }, {
138 .chip = {
139 .base = S5PV310_GPF3(0),
140 .ngpio = S5PV310_GPIO_F3_NR,
141 .label = "GPF3",
142 },
143 },
144};
145
146static struct s3c_gpio_chip s5pv310_gpio_part2_4bit[] = {
147 {
148 .chip = {
149 .base = S5PV310_GPJ0(0),
150 .ngpio = S5PV310_GPIO_J0_NR,
151 .label = "GPJ0",
152 },
153 }, {
154 .chip = {
155 .base = S5PV310_GPJ1(0),
156 .ngpio = S5PV310_GPIO_J1_NR,
157 .label = "GPJ1",
158 },
159 }, {
160 .chip = {
161 .base = S5PV310_GPK0(0),
162 .ngpio = S5PV310_GPIO_K0_NR,
163 .label = "GPK0",
164 },
165 }, {
166 .chip = {
167 .base = S5PV310_GPK1(0),
168 .ngpio = S5PV310_GPIO_K1_NR,
169 .label = "GPK1",
170 },
171 }, {
172 .chip = {
173 .base = S5PV310_GPK2(0),
174 .ngpio = S5PV310_GPIO_K2_NR,
175 .label = "GPK2",
176 },
177 }, {
178 .chip = {
179 .base = S5PV310_GPK3(0),
180 .ngpio = S5PV310_GPIO_K3_NR,
181 .label = "GPK3",
182 },
183 }, {
184 .chip = {
185 .base = S5PV310_GPL0(0),
186 .ngpio = S5PV310_GPIO_L0_NR,
187 .label = "GPL0",
188 },
189 }, {
190 .chip = {
191 .base = S5PV310_GPL1(0),
192 .ngpio = S5PV310_GPIO_L1_NR,
193 .label = "GPL1",
194 },
195 }, {
196 .chip = {
197 .base = S5PV310_GPL2(0),
198 .ngpio = S5PV310_GPIO_L2_NR,
199 .label = "GPL2",
200 },
201 }, {
202 .base = (S5P_VA_GPIO2 + 0xC00),
203 .config = &gpio_cfg_noint,
204 .irq_base = IRQ_EINT(0),
205 .chip = {
206 .base = S5PV310_GPX0(0),
207 .ngpio = S5PV310_GPIO_X0_NR,
208 .label = "GPX0",
209 .to_irq = samsung_gpiolib_to_irq,
210 },
211 }, {
212 .base = (S5P_VA_GPIO2 + 0xC20),
213 .config = &gpio_cfg_noint,
214 .irq_base = IRQ_EINT(8),
215 .chip = {
216 .base = S5PV310_GPX1(0),
217 .ngpio = S5PV310_GPIO_X1_NR,
218 .label = "GPX1",
219 .to_irq = samsung_gpiolib_to_irq,
220 },
221 }, {
222 .base = (S5P_VA_GPIO2 + 0xC40),
223 .config = &gpio_cfg_noint,
224 .irq_base = IRQ_EINT(16),
225 .chip = {
226 .base = S5PV310_GPX2(0),
227 .ngpio = S5PV310_GPIO_X2_NR,
228 .label = "GPX2",
229 .to_irq = samsung_gpiolib_to_irq,
230 },
231 }, {
232 .base = (S5P_VA_GPIO2 + 0xC60),
233 .config = &gpio_cfg_noint,
234 .irq_base = IRQ_EINT(24),
235 .chip = {
236 .base = S5PV310_GPX3(0),
237 .ngpio = S5PV310_GPIO_X3_NR,
238 .label = "GPX3",
239 .to_irq = samsung_gpiolib_to_irq,
240 },
241 },
242};
243
244static struct s3c_gpio_chip s5pv310_gpio_part3_4bit[] = {
245 {
246 .chip = {
247 .base = S5PV310_GPZ(0),
248 .ngpio = S5PV310_GPIO_Z_NR,
249 .label = "GPZ",
250 },
251 },
252};
253
254static __init int s5pv310_gpiolib_init(void)
255{
256 struct s3c_gpio_chip *chip;
257 int i;
258 int nr_chips;
259
260 /* GPIO part 1 */
261
262 chip = s5pv310_gpio_part1_4bit;
263 nr_chips = ARRAY_SIZE(s5pv310_gpio_part1_4bit);
264
265 for (i = 0; i < nr_chips; i++, chip++) {
266 if (chip->config == NULL)
267 chip->config = &gpio_cfg;
268 if (chip->base == NULL)
269 chip->base = S5P_VA_GPIO1 + (i) * 0x20;
270 }
271
272 samsung_gpiolib_add_4bit_chips(s5pv310_gpio_part1_4bit, nr_chips);
273
274 /* GPIO part 2 */
275
276 chip = s5pv310_gpio_part2_4bit;
277 nr_chips = ARRAY_SIZE(s5pv310_gpio_part2_4bit);
278
279 for (i = 0; i < nr_chips; i++, chip++) {
280 if (chip->config == NULL)
281 chip->config = &gpio_cfg;
282 if (chip->base == NULL)
283 chip->base = S5P_VA_GPIO2 + (i) * 0x20;
284 }
285
286 samsung_gpiolib_add_4bit_chips(s5pv310_gpio_part2_4bit, nr_chips);
287
288 /* GPIO part 3 */
289
290 chip = s5pv310_gpio_part3_4bit;
291 nr_chips = ARRAY_SIZE(s5pv310_gpio_part3_4bit);
292
293 for (i = 0; i < nr_chips; i++, chip++) {
294 if (chip->config == NULL)
295 chip->config = &gpio_cfg;
296 if (chip->base == NULL)
297 chip->base = S5P_VA_GPIO3 + (i) * 0x20;
298 }
299
300 samsung_gpiolib_add_4bit_chips(s5pv310_gpio_part3_4bit, nr_chips);
301
302 return 0;
303}
304core_initcall(s5pv310_gpiolib_init);
diff --git a/arch/arm/mach-s5pv310/hotplug.c b/arch/arm/mach-s5pv310/hotplug.c
new file mode 100644
index 000000000000..03652c3605f6
--- /dev/null
+++ b/arch/arm/mach-s5pv310/hotplug.c
@@ -0,0 +1,144 @@
1/* linux arch/arm/mach-s5pv310/hotplug.c
2 *
3 * Cloned from linux/arch/arm/mach-realview/hotplug.c
4 *
5 * Copyright (C) 2002 ARM Ltd.
6 * All Rights Reserved
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/smp.h>
16#include <linux/completion.h>
17
18#include <asm/cacheflush.h>
19
20extern volatile int pen_release;
21
22static DECLARE_COMPLETION(cpu_killed);
23
24static inline void cpu_enter_lowpower(void)
25{
26 unsigned int v;
27
28 flush_cache_all();
29 asm volatile(
30 " mcr p15, 0, %1, c7, c5, 0\n"
31 " mcr p15, 0, %1, c7, c10, 4\n"
32 /*
33 * Turn off coherency
34 */
35 " mrc p15, 0, %0, c1, c0, 1\n"
36 " bic %0, %0, #0x20\n"
37 " mcr p15, 0, %0, c1, c0, 1\n"
38 " mrc p15, 0, %0, c1, c0, 0\n"
39 " bic %0, %0, #0x04\n"
40 " mcr p15, 0, %0, c1, c0, 0\n"
41 : "=&r" (v)
42 : "r" (0)
43 : "cc");
44}
45
46static inline void cpu_leave_lowpower(void)
47{
48 unsigned int v;
49
50 asm volatile(
51 "mrc p15, 0, %0, c1, c0, 0\n"
52 " orr %0, %0, #0x04\n"
53 " mcr p15, 0, %0, c1, c0, 0\n"
54 " mrc p15, 0, %0, c1, c0, 1\n"
55 " orr %0, %0, #0x20\n"
56 " mcr p15, 0, %0, c1, c0, 1\n"
57 : "=&r" (v)
58 :
59 : "cc");
60}
61
62static inline void platform_do_lowpower(unsigned int cpu)
63{
64 /*
65 * there is no power-control hardware on this platform, so all
66 * we can do is put the core into WFI; this is safe as the calling
67 * code will have already disabled interrupts
68 */
69 for (;;) {
70 /*
71 * here's the WFI
72 */
73 asm(".word 0xe320f003\n"
74 :
75 :
76 : "memory", "cc");
77
78 if (pen_release == cpu) {
79 /*
80 * OK, proper wakeup, we're done
81 */
82 break;
83 }
84
85 /*
86 * getting here, means that we have come out of WFI without
87 * having been woken up - this shouldn't happen
88 *
89 * The trouble is, letting people know about this is not really
90 * possible, since we are currently running incoherently, and
91 * therefore cannot safely call printk() or anything else
92 */
93#ifdef DEBUG
94 printk(KERN_WARN "CPU%u: spurious wakeup call\n", cpu);
95#endif
96 }
97}
98
99int platform_cpu_kill(unsigned int cpu)
100{
101 return wait_for_completion_timeout(&cpu_killed, 5000);
102}
103
104/*
105 * platform-specific code to shutdown a CPU
106 *
107 * Called with IRQs disabled
108 */
109void platform_cpu_die(unsigned int cpu)
110{
111#ifdef DEBUG
112 unsigned int this_cpu = hard_smp_processor_id();
113
114 if (cpu != this_cpu) {
115 printk(KERN_CRIT "Eek! platform_cpu_die running on %u, should be %u\n",
116 this_cpu, cpu);
117 BUG();
118 }
119#endif
120
121 printk(KERN_NOTICE "CPU%u: shutdown\n", cpu);
122 complete(&cpu_killed);
123
124 /*
125 * we're ready for shutdown now, so do it
126 */
127 cpu_enter_lowpower();
128 platform_do_lowpower(cpu);
129
130 /*
131 * bring this CPU back into the world of cache
132 * coherency, and then restore interrupts
133 */
134 cpu_leave_lowpower();
135}
136
137int platform_cpu_disable(unsigned int cpu)
138{
139 /*
140 * we don't allow CPU 0 to be shutdown (it is still too special
141 * e.g. clock tick interrupts)
142 */
143 return cpu == 0 ? -EPERM : 0;
144}
diff --git a/arch/arm/mach-s5pv310/include/mach/irqs.h b/arch/arm/mach-s5pv310/include/mach/irqs.h
index 471fc3bb199a..99e7dad8a85a 100644
--- a/arch/arm/mach-s5pv310/include/mach/irqs.h
+++ b/arch/arm/mach-s5pv310/include/mach/irqs.h
@@ -3,7 +3,7 @@
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd. 3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/ 4 * http://www.samsung.com/
5 * 5 *
6 * S5PV210 - IRQ definitions 6 * S5PV310 - IRQ definitions
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 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 9 * it under the terms of the GNU General Public License version 2 as
@@ -60,6 +60,9 @@
60#define IRQ_TIMER3_VIC COMBINER_IRQ(22, 3) 60#define IRQ_TIMER3_VIC COMBINER_IRQ(22, 3)
61#define IRQ_TIMER4_VIC COMBINER_IRQ(22, 4) 61#define IRQ_TIMER4_VIC COMBINER_IRQ(22, 4)
62 62
63#define IRQ_RTC_ALARM COMBINER_IRQ(23, 0)
64#define IRQ_RTC_TIC COMBINER_IRQ(23, 1)
65
63#define IRQ_UART0 COMBINER_IRQ(26, 0) 66#define IRQ_UART0 COMBINER_IRQ(26, 0)
64#define IRQ_UART1 COMBINER_IRQ(26, 1) 67#define IRQ_UART1 COMBINER_IRQ(26, 1)
65#define IRQ_UART2 COMBINER_IRQ(26, 2) 68#define IRQ_UART2 COMBINER_IRQ(26, 2)
@@ -67,13 +70,46 @@
67#define IRQ_UART4 COMBINER_IRQ(26, 4) 70#define IRQ_UART4 COMBINER_IRQ(26, 4)
68 71
69#define IRQ_IIC COMBINER_IRQ(27, 0) 72#define IRQ_IIC COMBINER_IRQ(27, 0)
73#define IRQ_IIC1 COMBINER_IRQ(27, 1)
74#define IRQ_IIC2 COMBINER_IRQ(27, 2)
75#define IRQ_IIC3 COMBINER_IRQ(27, 3)
76#define IRQ_IIC4 COMBINER_IRQ(27, 4)
77#define IRQ_IIC5 COMBINER_IRQ(27, 5)
78#define IRQ_IIC6 COMBINER_IRQ(27, 6)
79#define IRQ_IIC7 COMBINER_IRQ(27, 7)
80
81#define IRQ_HSMMC0 COMBINER_IRQ(29, 0)
82#define IRQ_HSMMC1 COMBINER_IRQ(29, 1)
83#define IRQ_HSMMC2 COMBINER_IRQ(29, 2)
84#define IRQ_HSMMC3 COMBINER_IRQ(29, 3)
70 85
71#define IRQ_ONENAND_AUDI COMBINER_IRQ(34, 0) 86#define IRQ_ONENAND_AUDI COMBINER_IRQ(34, 0)
72 87
73/* Set the default NR_IRQS */ 88#define IRQ_EINT4 COMBINER_IRQ(37, 0)
89#define IRQ_EINT5 COMBINER_IRQ(37, 1)
90#define IRQ_EINT6 COMBINER_IRQ(37, 2)
91#define IRQ_EINT7 COMBINER_IRQ(37, 3)
92#define IRQ_EINT8 COMBINER_IRQ(38, 0)
93
94#define IRQ_EINT9 COMBINER_IRQ(38, 1)
95#define IRQ_EINT10 COMBINER_IRQ(38, 2)
96#define IRQ_EINT11 COMBINER_IRQ(38, 3)
97#define IRQ_EINT12 COMBINER_IRQ(38, 4)
98#define IRQ_EINT13 COMBINER_IRQ(38, 5)
99#define IRQ_EINT14 COMBINER_IRQ(38, 6)
100#define IRQ_EINT15 COMBINER_IRQ(38, 7)
101
102#define IRQ_EINT16_31 COMBINER_IRQ(39, 0)
74 103
75#define NR_IRQS COMBINER_IRQ(MAX_COMBINER_NR, 0) 104#define MAX_COMBINER_NR 40
105
106#define S5P_IRQ_EINT_BASE COMBINER_IRQ(MAX_COMBINER_NR, 0)
107
108#define S5P_EINT_BASE1 (S5P_IRQ_EINT_BASE + 0)
109#define S5P_EINT_BASE2 (S5P_IRQ_EINT_BASE + 16)
110
111/* Set the default NR_IRQS */
76 112
77#define MAX_COMBINER_NR 39 113#define NR_IRQS (S5P_IRQ_EINT_BASE + 32)
78 114
79#endif /* __ASM_ARCH_IRQS_H */ 115#endif /* __ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/map.h b/arch/arm/mach-s5pv310/include/mach/map.h
index aff6d23624bb..7acf4e77e92e 100644
--- a/arch/arm/mach-s5pv310/include/mach/map.h
+++ b/arch/arm/mach-s5pv310/include/mach/map.h
@@ -25,6 +25,8 @@
25 25
26#define S5PV310_PA_SYSRAM (0x02025000) 26#define S5PV310_PA_SYSRAM (0x02025000)
27 27
28#define S5PV310_PA_SROM_BANK(x) (0x04000000 + ((x) * 0x01000000))
29
28#define S5PC210_PA_ONENAND (0x0C000000) 30#define S5PC210_PA_ONENAND (0x0C000000)
29#define S5P_PA_ONENAND S5PC210_PA_ONENAND 31#define S5P_PA_ONENAND S5PC210_PA_ONENAND
30 32
@@ -34,12 +36,13 @@
34#define S5PV310_PA_CHIPID (0x10000000) 36#define S5PV310_PA_CHIPID (0x10000000)
35#define S5P_PA_CHIPID S5PV310_PA_CHIPID 37#define S5P_PA_CHIPID S5PV310_PA_CHIPID
36 38
37#define S5PV310_PA_SYSCON (0x10020000) 39#define S5PV310_PA_SYSCON (0x10010000)
38#define S5P_PA_SYSCON S5PV310_PA_SYSCON 40#define S5P_PA_SYSCON S5PV310_PA_SYSCON
39 41
40#define S5PV310_PA_CMU (0x10030000) 42#define S5PV310_PA_CMU (0x10030000)
41 43
42#define S5PV310_PA_WATCHDOG (0x10060000) 44#define S5PV310_PA_WATCHDOG (0x10060000)
45#define S5PV310_PA_RTC (0x10070000)
43 46
44#define S5PV310_PA_COMBINER (0x10448000) 47#define S5PV310_PA_COMBINER (0x10448000)
45 48
@@ -55,6 +58,8 @@
55 58
56#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000)) 59#define S5PV310_PA_HSMMC(x) (0x12510000 + ((x) * 0x10000))
57 60
61#define S5PV310_PA_SROMC (0x12570000)
62
58#define S5PV310_PA_UART (0x13800000) 63#define S5PV310_PA_UART (0x13800000)
59 64
60#define S5P_PA_UART(x) (S5PV310_PA_UART + ((x) * S3C_UART_OFFSET)) 65#define S5P_PA_UART(x) (S5PV310_PA_UART + ((x) * S3C_UART_OFFSET))
@@ -66,7 +71,7 @@
66 71
67#define S5P_SZ_UART SZ_256 72#define S5P_SZ_UART SZ_256
68 73
69#define S5PV310_PA_IIC0 (0x13860000) 74#define S5PV310_PA_IIC(x) (0x13860000 + ((x) * 0x10000))
70 75
71#define S5PV310_PA_TIMER (0x139D0000) 76#define S5PV310_PA_TIMER (0x139D0000)
72#define S5P_PA_TIMER S5PV310_PA_TIMER 77#define S5P_PA_TIMER S5PV310_PA_TIMER
@@ -80,7 +85,15 @@
80#define S3C_PA_HSMMC1 S5PV310_PA_HSMMC(1) 85#define S3C_PA_HSMMC1 S5PV310_PA_HSMMC(1)
81#define S3C_PA_HSMMC2 S5PV310_PA_HSMMC(2) 86#define S3C_PA_HSMMC2 S5PV310_PA_HSMMC(2)
82#define S3C_PA_HSMMC3 S5PV310_PA_HSMMC(3) 87#define S3C_PA_HSMMC3 S5PV310_PA_HSMMC(3)
83#define S3C_PA_IIC S5PV310_PA_IIC0 88#define S3C_PA_IIC S5PV310_PA_IIC(0)
89#define S3C_PA_IIC1 S5PV310_PA_IIC(1)
90#define S3C_PA_IIC2 S5PV310_PA_IIC(2)
91#define S3C_PA_IIC3 S5PV310_PA_IIC(3)
92#define S3C_PA_IIC4 S5PV310_PA_IIC(4)
93#define S3C_PA_IIC5 S5PV310_PA_IIC(5)
94#define S3C_PA_IIC6 S5PV310_PA_IIC(6)
95#define S3C_PA_IIC7 S5PV310_PA_IIC(7)
96#define S3C_PA_RTC S5PV310_PA_RTC
84#define S3C_PA_WDT S5PV310_PA_WATCHDOG 97#define S3C_PA_WDT S5PV310_PA_WATCHDOG
85 98
86#endif /* __ASM_ARCH_MAP_H */ 99#endif /* __ASM_ARCH_MAP_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-clock.h b/arch/arm/mach-s5pv310/include/mach/regs-clock.h
index 4013553cd9be..f1028cad9788 100644
--- a/arch/arm/mach-s5pv310/include/mach/regs-clock.h
+++ b/arch/arm/mach-s5pv310/include/mach/regs-clock.h
@@ -26,11 +26,23 @@
26 26
27#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210) 27#define S5P_CLKSRC_TOP0 S5P_CLKREG(0x0C210)
28#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214) 28#define S5P_CLKSRC_TOP1 S5P_CLKREG(0x0C214)
29 29#define S5P_CLKSRC_CAM S5P_CLKREG(0x0C220)
30#define S5P_CLKSRC_IMAGE S5P_CLKREG(0x0C230)
31#define S5P_CLKSRC_LCD0 S5P_CLKREG(0x0C234)
32#define S5P_CLKSRC_LCD1 S5P_CLKREG(0x0C238)
33#define S5P_CLKSRC_FSYS S5P_CLKREG(0x0C240)
30#define S5P_CLKSRC_PERIL0 S5P_CLKREG(0x0C250) 34#define S5P_CLKSRC_PERIL0 S5P_CLKREG(0x0C250)
35#define S5P_CLKSRC_PERIL1 S5P_CLKREG(0x0C254)
31 36
32#define S5P_CLKDIV_TOP S5P_CLKREG(0x0C510) 37#define S5P_CLKDIV_TOP S5P_CLKREG(0x0C510)
33 38#define S5P_CLKDIV_CAM S5P_CLKREG(0x0C520)
39#define S5P_CLKDIV_IMAGE S5P_CLKREG(0x0C530)
40#define S5P_CLKDIV_LCD0 S5P_CLKREG(0x0C534)
41#define S5P_CLKDIV_LCD1 S5P_CLKREG(0x0C538)
42#define S5P_CLKDIV_FSYS0 S5P_CLKREG(0x0C540)
43#define S5P_CLKDIV_FSYS1 S5P_CLKREG(0x0C544)
44#define S5P_CLKDIV_FSYS2 S5P_CLKREG(0x0C548)
45#define S5P_CLKDIV_FSYS3 S5P_CLKREG(0x0C54C)
34#define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x0C550) 46#define S5P_CLKDIV_PERIL0 S5P_CLKREG(0x0C550)
35#define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x0C554) 47#define S5P_CLKDIV_PERIL1 S5P_CLKREG(0x0C554)
36#define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x0C558) 48#define S5P_CLKDIV_PERIL2 S5P_CLKREG(0x0C558)
@@ -38,9 +50,21 @@
38#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560) 50#define S5P_CLKDIV_PERIL4 S5P_CLKREG(0x0C560)
39#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564) 51#define S5P_CLKDIV_PERIL5 S5P_CLKREG(0x0C564)
40 52
53#define S5P_CLKSRC_MASK_TOP S5P_CLKREG(0x0C310)
54#define S5P_CLKSRC_MASK_CAM S5P_CLKREG(0x0C320)
55#define S5P_CLKSRC_MASK_LCD0 S5P_CLKREG(0x0C334)
56#define S5P_CLKSRC_MASK_LCD1 S5P_CLKREG(0x0C338)
57#define S5P_CLKSRC_MASK_FSYS S5P_CLKREG(0x0C340)
41#define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350) 58#define S5P_CLKSRC_MASK_PERIL0 S5P_CLKREG(0x0C350)
59#define S5P_CLKSRC_MASK_PERIL1 S5P_CLKREG(0x0C354)
42 60
61#define S5P_CLKGATE_IP_CAM S5P_CLKREG(0x0C920)
62#define S5P_CLKGATE_IP_IMAGE S5P_CLKREG(0x0C930)
63#define S5P_CLKGATE_IP_LCD0 S5P_CLKREG(0x0C934)
64#define S5P_CLKGATE_IP_LCD1 S5P_CLKREG(0x0C938)
65#define S5P_CLKGATE_IP_FSYS S5P_CLKREG(0x0C940)
43#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950) 66#define S5P_CLKGATE_IP_PERIL S5P_CLKREG(0x0C950)
67#define S5P_CLKGATE_IP_PERIR S5P_CLKREG(0x0C960)
44 68
45#define S5P_CLKSRC_CORE S5P_CLKREG(0x10200) 69#define S5P_CLKSRC_CORE S5P_CLKREG(0x10200)
46#define S5P_CLKDIV_CORE0 S5P_CLKREG(0x10500) 70#define S5P_CLKDIV_CORE0 S5P_CLKREG(0x10500)
@@ -60,4 +84,8 @@
60 84
61#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800) 85#define S5P_CLKGATE_SCLKCPU S5P_CLKREG(0x14800)
62 86
87/* Compatibility defines */
88
89#define S5P_EPLL_CON S5P_EPLL_CON0
90
63#endif /* __ASM_ARCH_REGS_CLOCK_H */ 91#endif /* __ASM_ARCH_REGS_CLOCK_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-gpio.h b/arch/arm/mach-s5pv310/include/mach/regs-gpio.h
new file mode 100644
index 000000000000..82e9e0c9d452
--- /dev/null
+++ b/arch/arm/mach-s5pv310/include/mach/regs-gpio.h
@@ -0,0 +1,42 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/regs-gpio.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - GPIO (including EINT) register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_GPIO_H
14#define __ASM_ARCH_REGS_GPIO_H __FILE__
15
16#include <mach/map.h>
17#include <mach/irqs.h>
18
19#define S5PV310_EINT40CON (S5P_VA_GPIO2 + 0xE00)
20#define S5P_EINT_CON(x) (S5PV310_EINT40CON + ((x) * 0x4))
21
22#define S5PV310_EINT40FLTCON0 (S5P_VA_GPIO2 + 0xE80)
23#define S5P_EINT_FLTCON(x) (S5PV310_EINT40FLTCON0 + ((x) * 0x4))
24
25#define S5PV310_EINT40MASK (S5P_VA_GPIO2 + 0xF00)
26#define S5P_EINT_MASK(x) (S5PV310_EINT40MASK + ((x) * 0x4))
27
28#define S5PV310_EINT40PEND (S5P_VA_GPIO2 + 0xF40)
29#define S5P_EINT_PEND(x) (S5PV310_EINT40PEND + ((x) * 0x4))
30
31#define EINT_REG_NR(x) (EINT_OFFSET(x) >> 3)
32
33#define eint_irq_to_bit(irq) (1 << (EINT_OFFSET(irq) & 0x7))
34
35#define EINT_MODE S3C_GPIO_SFN(0xf)
36
37#define EINT_GPIO_0(x) S5PV310_GPX0(x)
38#define EINT_GPIO_1(x) S5PV310_GPX1(x)
39#define EINT_GPIO_2(x) S5PV310_GPX2(x)
40#define EINT_GPIO_3(x) S5PV310_GPX3(x)
41
42#endif /* __ASM_ARCH_REGS_GPIO_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/regs-srom.h b/arch/arm/mach-s5pv310/include/mach/regs-srom.h
new file mode 100644
index 000000000000..1898b3e10550
--- /dev/null
+++ b/arch/arm/mach-s5pv310/include/mach/regs-srom.h
@@ -0,0 +1,50 @@
1/* linux/arch/arm/mach-s5pv310/include/mach/regs-srom.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - SROMC register definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_REGS_SROM_H
14#define __ASM_ARCH_REGS_SROM_H __FILE__
15
16#include <mach/map.h>
17
18#define S5PV310_SROMREG(x) (S5P_VA_SROMC + (x))
19
20#define S5PV310_SROM_BW S5PV310_SROMREG(0x0)
21#define S5PV310_SROM_BC0 S5PV310_SROMREG(0x4)
22#define S5PV310_SROM_BC1 S5PV310_SROMREG(0x8)
23#define S5PV310_SROM_BC2 S5PV310_SROMREG(0xc)
24#define S5PV310_SROM_BC3 S5PV310_SROMREG(0x10)
25
26/* one register BW holds 4 x 4-bit packed settings for NCS0 - NCS3 */
27
28#define S5PV310_SROM_BW__DATAWIDTH__SHIFT 0
29#define S5PV310_SROM_BW__ADDRMODE__SHIFT 1
30#define S5PV310_SROM_BW__WAITENABLE__SHIFT 2
31#define S5PV310_SROM_BW__BYTEENABLE__SHIFT 3
32
33#define S5PV310_SROM_BW__CS_MASK 0xf
34
35#define S5PV310_SROM_BW__NCS0__SHIFT 0
36#define S5PV310_SROM_BW__NCS1__SHIFT 4
37#define S5PV310_SROM_BW__NCS2__SHIFT 8
38#define S5PV310_SROM_BW__NCS3__SHIFT 12
39
40/* applies to same to BCS0 - BCS3 */
41
42#define S5PV310_SROM_BCX__PMC__SHIFT 0
43#define S5PV310_SROM_BCX__TACP__SHIFT 4
44#define S5PV310_SROM_BCX__TCAH__SHIFT 8
45#define S5PV310_SROM_BCX__TCOH__SHIFT 12
46#define S5PV310_SROM_BCX__TACC__SHIFT 16
47#define S5PV310_SROM_BCX__TCOS__SHIFT 24
48#define S5PV310_SROM_BCX__TACS__SHIFT 28
49
50#endif /* __ASM_ARCH_REGS_SROM_H */
diff --git a/arch/arm/mach-s5pv310/include/mach/vmalloc.h b/arch/arm/mach-s5pv310/include/mach/vmalloc.h
index 256f221edf3a..65759fb97581 100644
--- a/arch/arm/mach-s5pv310/include/mach/vmalloc.h
+++ b/arch/arm/mach-s5pv310/include/mach/vmalloc.h
@@ -17,6 +17,6 @@
17#ifndef __ASM_ARCH_VMALLOC_H 17#ifndef __ASM_ARCH_VMALLOC_H
18#define __ASM_ARCH_VMALLOC_H __FILE__ 18#define __ASM_ARCH_VMALLOC_H __FILE__
19 19
20#define VMALLOC_END (0xF0000000UL) 20#define VMALLOC_END 0xF6000000UL
21 21
22#endif /* __ASM_ARCH_VMALLOC_H */ 22#endif /* __ASM_ARCH_VMALLOC_H */
diff --git a/arch/arm/mach-s5pv310/irq-combiner.c b/arch/arm/mach-s5pv310/irq-combiner.c
index 0f7052164f23..c3f88c3faf6c 100644
--- a/arch/arm/mach-s5pv310/irq-combiner.c
+++ b/arch/arm/mach-s5pv310/irq-combiner.c
@@ -66,11 +66,7 @@ static void combiner_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
66 if (status == 0) 66 if (status == 0)
67 goto out; 67 goto out;
68 68
69 for (combiner_irq = 0; combiner_irq < 32; combiner_irq++) { 69 combiner_irq = __ffs(status);
70 if (status & 0x1)
71 break;
72 status >>= 1;
73 }
74 70
75 cascade_irq = combiner_irq + (chip_data->irq_offset & ~31); 71 cascade_irq = combiner_irq + (chip_data->irq_offset & ~31);
76 if (unlikely(cascade_irq >= NR_IRQS)) 72 if (unlikely(cascade_irq >= NR_IRQS))
diff --git a/arch/arm/mach-s5pv310/irq-eint.c b/arch/arm/mach-s5pv310/irq-eint.c
new file mode 100644
index 000000000000..5877503e92c3
--- /dev/null
+++ b/arch/arm/mach-s5pv310/irq-eint.c
@@ -0,0 +1,228 @@
1/* linux/arch/arm/mach-s5pv310/irq-eint.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5PV310 - IRQ EINT support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#include <linux/kernel.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16#include <linux/io.h>
17#include <linux/sysdev.h>
18#include <linux/gpio.h>
19
20#include <plat/pm.h>
21#include <plat/cpu.h>
22#include <plat/gpio-cfg.h>
23
24#include <mach/regs-gpio.h>
25
26static DEFINE_SPINLOCK(eint_lock);
27
28static unsigned int eint0_15_data[16];
29
30static unsigned int s5pv310_get_irq_nr(unsigned int number)
31{
32 u32 ret = 0;
33
34 switch (number) {
35 case 0 ... 3:
36 ret = (number + IRQ_EINT0);
37 break;
38 case 4 ... 7:
39 ret = (number + (IRQ_EINT4 - 4));
40 break;
41 case 8 ... 15:
42 ret = (number + (IRQ_EINT8 - 8));
43 break;
44 default:
45 printk(KERN_ERR "number available : %d\n", number);
46 }
47
48 return ret;
49}
50
51static inline void s5pv310_irq_eint_mask(unsigned int irq)
52{
53 u32 mask;
54
55 spin_lock(&eint_lock);
56 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(irq)));
57 mask |= eint_irq_to_bit(irq);
58 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(irq)));
59 spin_unlock(&eint_lock);
60}
61
62static void s5pv310_irq_eint_unmask(unsigned int irq)
63{
64 u32 mask;
65
66 spin_lock(&eint_lock);
67 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(irq)));
68 mask &= ~(eint_irq_to_bit(irq));
69 __raw_writel(mask, S5P_EINT_MASK(EINT_REG_NR(irq)));
70 spin_unlock(&eint_lock);
71}
72
73static inline void s5pv310_irq_eint_ack(unsigned int irq)
74{
75 __raw_writel(eint_irq_to_bit(irq), S5P_EINT_PEND(EINT_REG_NR(irq)));
76}
77
78static void s5pv310_irq_eint_maskack(unsigned int irq)
79{
80 s5pv310_irq_eint_mask(irq);
81 s5pv310_irq_eint_ack(irq);
82}
83
84static int s5pv310_irq_eint_set_type(unsigned int irq, unsigned int type)
85{
86 int offs = EINT_OFFSET(irq);
87 int shift;
88 u32 ctrl, mask;
89 u32 newvalue = 0;
90
91 switch (type) {
92 case IRQ_TYPE_EDGE_RISING:
93 newvalue = S5P_IRQ_TYPE_EDGE_RISING;
94 break;
95
96 case IRQ_TYPE_EDGE_FALLING:
97 newvalue = S5P_IRQ_TYPE_EDGE_FALLING;
98 break;
99
100 case IRQ_TYPE_EDGE_BOTH:
101 newvalue = S5P_IRQ_TYPE_EDGE_BOTH;
102 break;
103
104 case IRQ_TYPE_LEVEL_LOW:
105 newvalue = S5P_IRQ_TYPE_LEVEL_LOW;
106 break;
107
108 case IRQ_TYPE_LEVEL_HIGH:
109 newvalue = S5P_IRQ_TYPE_LEVEL_HIGH;
110 break;
111
112 default:
113 printk(KERN_ERR "No such irq type %d", type);
114 return -EINVAL;
115 }
116
117 shift = (offs & 0x7) * 4;
118 mask = 0x7 << shift;
119
120 spin_lock(&eint_lock);
121 ctrl = __raw_readl(S5P_EINT_CON(EINT_REG_NR(irq)));
122 ctrl &= ~mask;
123 ctrl |= newvalue << shift;
124 __raw_writel(ctrl, S5P_EINT_CON(EINT_REG_NR(irq)));
125 spin_unlock(&eint_lock);
126
127 switch (offs) {
128 case 0 ... 7:
129 s3c_gpio_cfgpin(EINT_GPIO_0(offs & 0x7), EINT_MODE);
130 break;
131 case 8 ... 15:
132 s3c_gpio_cfgpin(EINT_GPIO_1(offs & 0x7), EINT_MODE);
133 break;
134 case 16 ... 23:
135 s3c_gpio_cfgpin(EINT_GPIO_2(offs & 0x7), EINT_MODE);
136 break;
137 case 24 ... 31:
138 s3c_gpio_cfgpin(EINT_GPIO_3(offs & 0x7), EINT_MODE);
139 break;
140 default:
141 printk(KERN_ERR "No such irq number %d", offs);
142 }
143
144 return 0;
145}
146
147static struct irq_chip s5pv310_irq_eint = {
148 .name = "s5pv310-eint",
149 .mask = s5pv310_irq_eint_mask,
150 .unmask = s5pv310_irq_eint_unmask,
151 .mask_ack = s5pv310_irq_eint_maskack,
152 .ack = s5pv310_irq_eint_ack,
153 .set_type = s5pv310_irq_eint_set_type,
154#ifdef CONFIG_PM
155 .set_wake = s3c_irqext_wake,
156#endif
157};
158
159/* s5pv310_irq_demux_eint
160 *
161 * This function demuxes the IRQ from from EINTs 16 to 31.
162 * It is designed to be inlined into the specific handler
163 * s5p_irq_demux_eintX_Y.
164 *
165 * Each EINT pend/mask registers handle eight of them.
166 */
167static inline void s5pv310_irq_demux_eint(unsigned int start)
168{
169 unsigned int irq;
170
171 u32 status = __raw_readl(S5P_EINT_PEND(EINT_REG_NR(start)));
172 u32 mask = __raw_readl(S5P_EINT_MASK(EINT_REG_NR(start)));
173
174 status &= ~mask;
175 status &= 0xff;
176
177 while (status) {
178 irq = fls(status) - 1;
179 generic_handle_irq(irq + start);
180 status &= ~(1 << irq);
181 }
182}
183
184static void s5pv310_irq_demux_eint16_31(unsigned int irq, struct irq_desc *desc)
185{
186 s5pv310_irq_demux_eint(IRQ_EINT(16));
187 s5pv310_irq_demux_eint(IRQ_EINT(24));
188}
189
190static void s5pv310_irq_eint0_15(unsigned int irq, struct irq_desc *desc)
191{
192 u32 *irq_data = get_irq_data(irq);
193 struct irq_chip *chip = get_irq_chip(irq);
194
195 chip->mask(irq);
196
197 if (chip->ack)
198 chip->ack(irq);
199
200 generic_handle_irq(*irq_data);
201
202 chip->unmask(irq);
203}
204
205int __init s5pv310_init_irq_eint(void)
206{
207 int irq;
208
209 for (irq = 0 ; irq <= 31 ; irq++) {
210 set_irq_chip(IRQ_EINT(irq), &s5pv310_irq_eint);
211 set_irq_handler(IRQ_EINT(irq), handle_level_irq);
212 set_irq_flags(IRQ_EINT(irq), IRQF_VALID);
213 }
214
215 set_irq_chained_handler(IRQ_EINT16_31, s5pv310_irq_demux_eint16_31);
216
217 for (irq = 0 ; irq <= 15 ; irq++) {
218 eint0_15_data[irq] = IRQ_EINT(irq);
219
220 set_irq_data(s5pv310_get_irq_nr(irq), &eint0_15_data[irq]);
221 set_irq_chained_handler(s5pv310_get_irq_nr(irq),
222 s5pv310_irq_eint0_15);
223 }
224
225 return 0;
226}
227
228arch_initcall(s5pv310_init_irq_eint);
diff --git a/arch/arm/mach-s5pv310/mach-smdkc210.c b/arch/arm/mach-s5pv310/mach-smdkc210.c
new file mode 100644
index 000000000000..2b8d4fc52d7c
--- /dev/null
+++ b/arch/arm/mach-s5pv310/mach-smdkc210.c
@@ -0,0 +1,202 @@
1/* linux/arch/arm/mach-s5pv310/mach-smdkc210.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9*/
10
11#include <linux/serial_core.h>
12#include <linux/gpio.h>
13#include <linux/mmc/host.h>
14#include <linux/platform_device.h>
15#include <linux/smsc911x.h>
16#include <linux/io.h>
17
18#include <asm/mach/arch.h>
19#include <asm/mach-types.h>
20
21#include <plat/regs-serial.h>
22#include <plat/s5pv310.h>
23#include <plat/cpu.h>
24#include <plat/devs.h>
25#include <plat/sdhci.h>
26
27#include <mach/map.h>
28#include <mach/regs-srom.h>
29
30/* Following are default values for UCON, ULCON and UFCON UART registers */
31#define SMDKC210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
32 S3C2410_UCON_RXILEVEL | \
33 S3C2410_UCON_TXIRQMODE | \
34 S3C2410_UCON_RXIRQMODE | \
35 S3C2410_UCON_RXFIFO_TOI | \
36 S3C2443_UCON_RXERR_IRQEN)
37
38#define SMDKC210_ULCON_DEFAULT S3C2410_LCON_CS8
39
40#define SMDKC210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
41 S5PV210_UFCON_TXTRIG4 | \
42 S5PV210_UFCON_RXTRIG4)
43
44static struct s3c2410_uartcfg smdkc210_uartcfgs[] __initdata = {
45 [0] = {
46 .hwport = 0,
47 .flags = 0,
48 .ucon = SMDKC210_UCON_DEFAULT,
49 .ulcon = SMDKC210_ULCON_DEFAULT,
50 .ufcon = SMDKC210_UFCON_DEFAULT,
51 },
52 [1] = {
53 .hwport = 1,
54 .flags = 0,
55 .ucon = SMDKC210_UCON_DEFAULT,
56 .ulcon = SMDKC210_ULCON_DEFAULT,
57 .ufcon = SMDKC210_UFCON_DEFAULT,
58 },
59 [2] = {
60 .hwport = 2,
61 .flags = 0,
62 .ucon = SMDKC210_UCON_DEFAULT,
63 .ulcon = SMDKC210_ULCON_DEFAULT,
64 .ufcon = SMDKC210_UFCON_DEFAULT,
65 },
66 [3] = {
67 .hwport = 3,
68 .flags = 0,
69 .ucon = SMDKC210_UCON_DEFAULT,
70 .ulcon = SMDKC210_ULCON_DEFAULT,
71 .ufcon = SMDKC210_UFCON_DEFAULT,
72 },
73};
74
75static struct s3c_sdhci_platdata smdkc210_hsmmc0_pdata __initdata = {
76 .cd_type = S3C_SDHCI_CD_GPIO,
77 .ext_cd_gpio = S5PV310_GPK0(2),
78 .ext_cd_gpio_invert = 1,
79 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
80#ifdef CONFIG_S5PV310_SDHCI_CH0_8BIT
81 .max_width = 8,
82 .host_caps = MMC_CAP_8_BIT_DATA,
83#endif
84};
85
86static struct s3c_sdhci_platdata smdkc210_hsmmc1_pdata __initdata = {
87 .cd_type = S3C_SDHCI_CD_GPIO,
88 .ext_cd_gpio = S5PV310_GPK0(2),
89 .ext_cd_gpio_invert = 1,
90 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
91};
92
93static struct s3c_sdhci_platdata smdkc210_hsmmc2_pdata __initdata = {
94 .cd_type = S3C_SDHCI_CD_GPIO,
95 .ext_cd_gpio = S5PV310_GPK2(2),
96 .ext_cd_gpio_invert = 1,
97 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
98#ifdef CONFIG_S5PV310_SDHCI_CH2_8BIT
99 .max_width = 8,
100 .host_caps = MMC_CAP_8_BIT_DATA,
101#endif
102};
103
104static struct s3c_sdhci_platdata smdkc210_hsmmc3_pdata __initdata = {
105 .cd_type = S3C_SDHCI_CD_GPIO,
106 .ext_cd_gpio = S5PV310_GPK2(2),
107 .ext_cd_gpio_invert = 1,
108 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
109};
110
111static struct resource smdkc210_smsc911x_resources[] = {
112 [0] = {
113 .start = S5PV310_PA_SROM_BANK(1),
114 .end = S5PV310_PA_SROM_BANK(1) + SZ_64K - 1,
115 .flags = IORESOURCE_MEM,
116 },
117 [1] = {
118 .start = IRQ_EINT(5),
119 .end = IRQ_EINT(5),
120 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
121 },
122};
123
124static struct smsc911x_platform_config smsc9215_config = {
125 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
126 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
127 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
128 .phy_interface = PHY_INTERFACE_MODE_MII,
129 .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
130};
131
132static struct platform_device smdkc210_smsc911x = {
133 .name = "smsc911x",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(smdkc210_smsc911x_resources),
136 .resource = smdkc210_smsc911x_resources,
137 .dev = {
138 .platform_data = &smsc9215_config,
139 },
140};
141
142static struct platform_device *smdkc210_devices[] __initdata = {
143 &s3c_device_hsmmc0,
144 &s3c_device_hsmmc1,
145 &s3c_device_hsmmc2,
146 &s3c_device_hsmmc3,
147 &s3c_device_rtc,
148 &s3c_device_wdt,
149 &smdkc210_smsc911x,
150};
151
152static void __init smdkc210_smsc911x_init(void)
153{
154 u32 cs1;
155
156 /* configure nCS1 width to 16 bits */
157 cs1 = __raw_readl(S5PV310_SROM_BW) &
158 ~(S5PV310_SROM_BW__CS_MASK <<
159 S5PV310_SROM_BW__NCS1__SHIFT);
160 cs1 |= ((1 << S5PV310_SROM_BW__DATAWIDTH__SHIFT) |
161 (1 << S5PV310_SROM_BW__WAITENABLE__SHIFT) |
162 (1 << S5PV310_SROM_BW__BYTEENABLE__SHIFT)) <<
163 S5PV310_SROM_BW__NCS1__SHIFT;
164 __raw_writel(cs1, S5PV310_SROM_BW);
165
166 /* set timing for nCS1 suitable for ethernet chip */
167 __raw_writel((0x1 << S5PV310_SROM_BCX__PMC__SHIFT) |
168 (0x9 << S5PV310_SROM_BCX__TACP__SHIFT) |
169 (0xc << S5PV310_SROM_BCX__TCAH__SHIFT) |
170 (0x1 << S5PV310_SROM_BCX__TCOH__SHIFT) |
171 (0x6 << S5PV310_SROM_BCX__TACC__SHIFT) |
172 (0x1 << S5PV310_SROM_BCX__TCOS__SHIFT) |
173 (0x1 << S5PV310_SROM_BCX__TACS__SHIFT), S5PV310_SROM_BC1);
174}
175
176static void __init smdkc210_map_io(void)
177{
178 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
179 s3c24xx_init_clocks(24000000);
180 s3c24xx_init_uarts(smdkc210_uartcfgs, ARRAY_SIZE(smdkc210_uartcfgs));
181}
182
183static void __init smdkc210_machine_init(void)
184{
185 smdkc210_smsc911x_init();
186
187 s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata);
188 s3c_sdhci1_set_platdata(&smdkc210_hsmmc1_pdata);
189 s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata);
190 s3c_sdhci3_set_platdata(&smdkc210_hsmmc3_pdata);
191
192 platform_add_devices(smdkc210_devices, ARRAY_SIZE(smdkc210_devices));
193}
194
195MACHINE_START(SMDKC210, "SMDKC210")
196 /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
197 .boot_params = S5P_PA_SDRAM + 0x100,
198 .init_irq = s5pv310_init_irq,
199 .map_io = smdkc210_map_io,
200 .init_machine = smdkc210_machine_init,
201 .timer = &s5pv310_timer,
202MACHINE_END
diff --git a/arch/arm/mach-s5pv310/mach-smdkv310.c b/arch/arm/mach-s5pv310/mach-smdkv310.c
index 46215a14b3bb..35826d66632c 100644
--- a/arch/arm/mach-s5pv310/mach-smdkv310.c
+++ b/arch/arm/mach-s5pv310/mach-smdkv310.c
@@ -9,16 +9,23 @@
9*/ 9*/
10 10
11#include <linux/serial_core.h> 11#include <linux/serial_core.h>
12#include <linux/gpio.h>
13#include <linux/mmc/host.h>
14#include <linux/platform_device.h>
15#include <linux/smsc911x.h>
16#include <linux/io.h>
12 17
13#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
14#include <asm/mach-types.h> 19#include <asm/mach-types.h>
15#include <asm/hardware/cache-l2x0.h>
16 20
17#include <plat/regs-serial.h> 21#include <plat/regs-serial.h>
18#include <plat/s5pv310.h> 22#include <plat/s5pv310.h>
19#include <plat/cpu.h> 23#include <plat/cpu.h>
24#include <plat/devs.h>
25#include <plat/sdhci.h>
20 26
21#include <mach/map.h> 27#include <mach/map.h>
28#include <mach/regs-srom.h>
22 29
23/* Following are default values for UCON, ULCON and UFCON UART registers */ 30/* Following are default values for UCON, ULCON and UFCON UART registers */
24#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ 31#define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -65,6 +72,107 @@ static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
65 }, 72 },
66}; 73};
67 74
75static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
76 .cd_type = S3C_SDHCI_CD_GPIO,
77 .ext_cd_gpio = S5PV310_GPK0(2),
78 .ext_cd_gpio_invert = 1,
79 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
80#ifdef CONFIG_S5PV310_SDHCI_CH0_8BIT
81 .max_width = 8,
82 .host_caps = MMC_CAP_8_BIT_DATA,
83#endif
84};
85
86static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
87 .cd_type = S3C_SDHCI_CD_GPIO,
88 .ext_cd_gpio = S5PV310_GPK0(2),
89 .ext_cd_gpio_invert = 1,
90 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
91};
92
93static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
94 .cd_type = S3C_SDHCI_CD_GPIO,
95 .ext_cd_gpio = S5PV310_GPK2(2),
96 .ext_cd_gpio_invert = 1,
97 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
98#ifdef CONFIG_S5PV310_SDHCI_CH2_8BIT
99 .max_width = 8,
100 .host_caps = MMC_CAP_8_BIT_DATA,
101#endif
102};
103
104static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
105 .cd_type = S3C_SDHCI_CD_GPIO,
106 .ext_cd_gpio = S5PV310_GPK2(2),
107 .ext_cd_gpio_invert = 1,
108 .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
109};
110
111static struct resource smdkv310_smsc911x_resources[] = {
112 [0] = {
113 .start = S5PV310_PA_SROM_BANK(1),
114 .end = S5PV310_PA_SROM_BANK(1) + SZ_64K - 1,
115 .flags = IORESOURCE_MEM,
116 },
117 [1] = {
118 .start = IRQ_EINT(5),
119 .end = IRQ_EINT(5),
120 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
121 },
122};
123
124static struct smsc911x_platform_config smsc9215_config = {
125 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
126 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
127 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
128 .phy_interface = PHY_INTERFACE_MODE_MII,
129 .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
130};
131
132static struct platform_device smdkv310_smsc911x = {
133 .name = "smsc911x",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources),
136 .resource = smdkv310_smsc911x_resources,
137 .dev = {
138 .platform_data = &smsc9215_config,
139 },
140};
141
142static struct platform_device *smdkv310_devices[] __initdata = {
143 &s3c_device_hsmmc0,
144 &s3c_device_hsmmc1,
145 &s3c_device_hsmmc2,
146 &s3c_device_hsmmc3,
147 &s3c_device_rtc,
148 &s3c_device_wdt,
149 &smdkv310_smsc911x,
150};
151
152static void __init smdkv310_smsc911x_init(void)
153{
154 u32 cs1;
155
156 /* configure nCS1 width to 16 bits */
157 cs1 = __raw_readl(S5PV310_SROM_BW) &
158 ~(S5PV310_SROM_BW__CS_MASK <<
159 S5PV310_SROM_BW__NCS1__SHIFT);
160 cs1 |= ((1 << S5PV310_SROM_BW__DATAWIDTH__SHIFT) |
161 (1 << S5PV310_SROM_BW__WAITENABLE__SHIFT) |
162 (1 << S5PV310_SROM_BW__BYTEENABLE__SHIFT)) <<
163 S5PV310_SROM_BW__NCS1__SHIFT;
164 __raw_writel(cs1, S5PV310_SROM_BW);
165
166 /* set timing for nCS1 suitable for ethernet chip */
167 __raw_writel((0x1 << S5PV310_SROM_BCX__PMC__SHIFT) |
168 (0x9 << S5PV310_SROM_BCX__TACP__SHIFT) |
169 (0xc << S5PV310_SROM_BCX__TCAH__SHIFT) |
170 (0x1 << S5PV310_SROM_BCX__TCOH__SHIFT) |
171 (0x6 << S5PV310_SROM_BCX__TACC__SHIFT) |
172 (0x1 << S5PV310_SROM_BCX__TCOS__SHIFT) |
173 (0x1 << S5PV310_SROM_BCX__TACS__SHIFT), S5PV310_SROM_BC1);
174}
175
68static void __init smdkv310_map_io(void) 176static void __init smdkv310_map_io(void)
69{ 177{
70 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 178 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -74,9 +182,14 @@ static void __init smdkv310_map_io(void)
74 182
75static void __init smdkv310_machine_init(void) 183static void __init smdkv310_machine_init(void)
76{ 184{
77#ifdef CONFIG_CACHE_L2X0 185 smdkv310_smsc911x_init();
78 l2x0_init(S5P_VA_L2CC, 1 << 28, 0xffffffff); 186
79#endif 187 s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
188 s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
189 s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
190 s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
191
192 platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
80} 193}
81 194
82MACHINE_START(SMDKV310, "SMDKV310") 195MACHINE_START(SMDKV310, "SMDKV310")
diff --git a/arch/arm/mach-s5pv310/mach-universal_c210.c b/arch/arm/mach-s5pv310/mach-universal_c210.c
index d7c2ec770f88..16d8fc00cafd 100644
--- a/arch/arm/mach-s5pv310/mach-universal_c210.c
+++ b/arch/arm/mach-s5pv310/mach-universal_c210.c
@@ -7,15 +7,20 @@
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8*/ 8*/
9 9
10#include <linux/platform_device.h>
10#include <linux/serial_core.h> 11#include <linux/serial_core.h>
12#include <linux/input.h>
13#include <linux/i2c.h>
14#include <linux/gpio_keys.h>
15#include <linux/gpio.h>
11 16
12#include <asm/mach/arch.h> 17#include <asm/mach/arch.h>
13#include <asm/mach-types.h> 18#include <asm/mach-types.h>
14#include <asm/hardware/cache-l2x0.h>
15 19
16#include <plat/regs-serial.h> 20#include <plat/regs-serial.h>
17#include <plat/s5pv310.h> 21#include <plat/s5pv310.h>
18#include <plat/cpu.h> 22#include <plat/cpu.h>
23#include <plat/devs.h>
19 24
20#include <mach/map.h> 25#include <mach/map.h>
21 26
@@ -60,6 +65,72 @@ static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
60 }, 65 },
61}; 66};
62 67
68static struct gpio_keys_button universal_gpio_keys_tables[] = {
69 {
70 .code = KEY_VOLUMEUP,
71 .gpio = S5PV310_GPX2(0), /* XEINT16 */
72 .desc = "gpio-keys: KEY_VOLUMEUP",
73 .type = EV_KEY,
74 .active_low = 1,
75 .debounce_interval = 1,
76 }, {
77 .code = KEY_VOLUMEDOWN,
78 .gpio = S5PV310_GPX2(1), /* XEINT17 */
79 .desc = "gpio-keys: KEY_VOLUMEDOWN",
80 .type = EV_KEY,
81 .active_low = 1,
82 .debounce_interval = 1,
83 }, {
84 .code = KEY_CONFIG,
85 .gpio = S5PV310_GPX2(2), /* XEINT18 */
86 .desc = "gpio-keys: KEY_CONFIG",
87 .type = EV_KEY,
88 .active_low = 1,
89 .debounce_interval = 1,
90 }, {
91 .code = KEY_CAMERA,
92 .gpio = S5PV310_GPX2(3), /* XEINT19 */
93 .desc = "gpio-keys: KEY_CAMERA",
94 .type = EV_KEY,
95 .active_low = 1,
96 .debounce_interval = 1,
97 }, {
98 .code = KEY_OK,
99 .gpio = S5PV310_GPX3(5), /* XEINT29 */
100 .desc = "gpio-keys: KEY_OK",
101 .type = EV_KEY,
102 .active_low = 1,
103 .debounce_interval = 1,
104 },
105};
106
107static struct gpio_keys_platform_data universal_gpio_keys_data = {
108 .buttons = universal_gpio_keys_tables,
109 .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
110};
111
112static struct platform_device universal_gpio_keys = {
113 .name = "gpio-keys",
114 .dev = {
115 .platform_data = &universal_gpio_keys_data,
116 },
117};
118
119/* I2C0 */
120static struct i2c_board_info i2c0_devs[] __initdata = {
121 /* Camera, To be updated */
122};
123
124/* I2C1 */
125static struct i2c_board_info i2c1_devs[] __initdata = {
126 /* Gyro, To be updated */
127};
128
129static struct platform_device *universal_devices[] __initdata = {
130 &universal_gpio_keys,
131 &s5p_device_onenand,
132};
133
63static void __init universal_map_io(void) 134static void __init universal_map_io(void)
64{ 135{
65 s5p_init_io(NULL, 0, S5P_VA_CHIPID); 136 s5p_init_io(NULL, 0, S5P_VA_CHIPID);
@@ -69,9 +140,11 @@ static void __init universal_map_io(void)
69 140
70static void __init universal_machine_init(void) 141static void __init universal_machine_init(void)
71{ 142{
72#ifdef CONFIG_CACHE_L2X0 143 i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
73 l2x0_init(S5P_VA_L2CC, 1 << 28, 0xffffffff); 144 i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
74#endif 145
146 /* Last */
147 platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
75} 148}
76 149
77MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210") 150MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
diff --git a/arch/arm/mach-s5pv310/setup-i2c0.c b/arch/arm/mach-s5pv310/setup-i2c0.c
index 436712807383..f47f8f3152ec 100644
--- a/arch/arm/mach-s5pv310/setup-i2c0.c
+++ b/arch/arm/mach-s5pv310/setup-i2c0.c
@@ -21,8 +21,6 @@ struct platform_device; /* don't need the contents */
21 21
22void s3c_i2c0_cfg_gpio(struct platform_device *dev) 22void s3c_i2c0_cfg_gpio(struct platform_device *dev)
23{ 23{
24 s3c_gpio_cfgpin(S5PV310_GPD1(0), S3C_GPIO_SFN(2)); 24 s3c_gpio_cfgall_range(S5PV310_GPD1(0), 2,
25 s3c_gpio_setpull(S5PV310_GPD1(0), S3C_GPIO_PULL_UP); 25 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
26 s3c_gpio_cfgpin(S5PV310_GPD1(1), S3C_GPIO_SFN(2));
27 s3c_gpio_setpull(S5PV310_GPD1(1), S3C_GPIO_PULL_UP);
28} 26}
diff --git a/arch/arm/mach-s5pv310/setup-i2c1.c b/arch/arm/mach-s5pv310/setup-i2c1.c
index 1ecd5bc35b5a..9d07e4e2f14c 100644
--- a/arch/arm/mach-s5pv310/setup-i2c1.c
+++ b/arch/arm/mach-s5pv310/setup-i2c1.c
@@ -18,8 +18,6 @@ struct platform_device; /* don't need the contents */
18 18
19void s3c_i2c1_cfg_gpio(struct platform_device *dev) 19void s3c_i2c1_cfg_gpio(struct platform_device *dev)
20{ 20{
21 s3c_gpio_cfgpin(S5PV310_GPD1(2), S3C_GPIO_SFN(2)); 21 s3c_gpio_cfgall_range(S5PV310_GPD1(2), 2,
22 s3c_gpio_setpull(S5PV310_GPD1(2), S3C_GPIO_PULL_UP); 22 S3C_GPIO_SFN(2), S3C_GPIO_PULL_UP);
23 s3c_gpio_cfgpin(S5PV310_GPD1(3), S3C_GPIO_SFN(2));
24 s3c_gpio_setpull(S5PV310_GPD1(3), S3C_GPIO_PULL_UP);
25} 23}
diff --git a/arch/arm/mach-s5pv310/setup-i2c2.c b/arch/arm/mach-s5pv310/setup-i2c2.c
index 4c0d8def660a..4163b1233daf 100644
--- a/arch/arm/mach-s5pv310/setup-i2c2.c
+++ b/arch/arm/mach-s5pv310/setup-i2c2.c
@@ -18,8 +18,6 @@ struct platform_device; /* don't need the contents */
18 18
19void s3c_i2c2_cfg_gpio(struct platform_device *dev) 19void s3c_i2c2_cfg_gpio(struct platform_device *dev)
20{ 20{
21 s3c_gpio_cfgpin(S5PV310_GPA0(6), S3C_GPIO_SFN(3)); 21 s3c_gpio_cfgall_range(S5PV310_GPA0(6), 2,
22 s3c_gpio_setpull(S5PV310_GPA0(6), S3C_GPIO_PULL_UP); 22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23 s3c_gpio_cfgpin(S5PV310_GPA0(7), S3C_GPIO_SFN(3));
24 s3c_gpio_setpull(S5PV310_GPA0(7), S3C_GPIO_PULL_UP);
25} 23}
diff --git a/arch/arm/mach-s5pv310/setup-i2c3.c b/arch/arm/mach-s5pv310/setup-i2c3.c
new file mode 100644
index 000000000000..180f153d2a20
--- /dev/null
+++ b/arch/arm/mach-s5pv310/setup-i2c3.c
@@ -0,0 +1,23 @@
1/*
2 * linux/arch/arm/mach-s5pv310/setup-i2c3.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C3 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <plat/iic.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c3_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(S5PV310_GPA1(2), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-s5pv310/setup-i2c4.c b/arch/arm/mach-s5pv310/setup-i2c4.c
new file mode 100644
index 000000000000..909e8dfc5316
--- /dev/null
+++ b/arch/arm/mach-s5pv310/setup-i2c4.c
@@ -0,0 +1,23 @@
1/*
2 * linux/arch/arm/mach-s5pv310/setup-i2c4.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C4 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <plat/iic.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c4_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(S5PV310_GPB(2), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-s5pv310/setup-i2c5.c b/arch/arm/mach-s5pv310/setup-i2c5.c
new file mode 100644
index 000000000000..5d0fa4ac0283
--- /dev/null
+++ b/arch/arm/mach-s5pv310/setup-i2c5.c
@@ -0,0 +1,23 @@
1/*
2 * linux/arch/arm/mach-s5pv310/setup-i2c5.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C5 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <plat/iic.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c5_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(S5PV310_GPB(6), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-s5pv310/setup-i2c6.c b/arch/arm/mach-s5pv310/setup-i2c6.c
new file mode 100644
index 000000000000..34aafab92ac4
--- /dev/null
+++ b/arch/arm/mach-s5pv310/setup-i2c6.c
@@ -0,0 +1,23 @@
1/*
2 * linux/arch/arm/mach-s5pv310/setup-i2c6.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C6 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <plat/iic.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c6_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(S5PV310_GPC1(3), 2,
22 S3C_GPIO_SFN(4), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-s5pv310/setup-i2c7.c b/arch/arm/mach-s5pv310/setup-i2c7.c
new file mode 100644
index 000000000000..9b25b8d18920
--- /dev/null
+++ b/arch/arm/mach-s5pv310/setup-i2c7.c
@@ -0,0 +1,23 @@
1/*
2 * linux/arch/arm/mach-s5pv310/setup-i2c7.c
3 *
4 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
5 *
6 * I2C7 GPIO configuration.
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
13struct platform_device; /* don't need the contents */
14
15#include <linux/gpio.h>
16#include <plat/iic.h>
17#include <plat/gpio-cfg.h>
18
19void s3c_i2c7_cfg_gpio(struct platform_device *dev)
20{
21 s3c_gpio_cfgall_range(S5PV310_GPD0(2), 2,
22 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
23}
diff --git a/arch/arm/mach-s5pv310/setup-sdhci-gpio.c b/arch/arm/mach-s5pv310/setup-sdhci-gpio.c
new file mode 100644
index 000000000000..86d38cc49135
--- /dev/null
+++ b/arch/arm/mach-s5pv310/setup-sdhci-gpio.c
@@ -0,0 +1,152 @@
1/* linux/arch/arm/mach-s5pv310/setup-sdhci-gpio.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV310 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
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/types.h>
15#include <linux/interrupt.h>
16#include <linux/platform_device.h>
17#include <linux/io.h>
18#include <linux/gpio.h>
19#include <linux/mmc/host.h>
20#include <linux/mmc/card.h>
21
22#include <plat/gpio-cfg.h>
23#include <plat/regs-sdhci.h>
24#include <plat/sdhci.h>
25
26void s5pv310_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
27{
28 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
29 unsigned int gpio;
30
31 /* Set all the necessary GPK0[0:1] pins to special-function 2 */
32 for (gpio = S5PV310_GPK0(0); gpio < S5PV310_GPK0(2); gpio++) {
33 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
34 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
35 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
36 }
37
38 switch (width) {
39 case 8:
40 for (gpio = S5PV310_GPK1(3); gpio <= S5PV310_GPK1(6); gpio++) {
41 /* Data pin GPK1[3:6] to special-funtion 3 */
42 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
43 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
44 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
45 }
46 case 4:
47 for (gpio = S5PV310_GPK0(3); gpio <= S5PV310_GPK0(6); gpio++) {
48 /* Data pin GPK0[3:6] to special-funtion 2 */
49 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
50 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
51 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
52 }
53 default:
54 break;
55 }
56
57 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
58 s3c_gpio_cfgpin(S5PV310_GPK0(2), S3C_GPIO_SFN(2));
59 s3c_gpio_setpull(S5PV310_GPK0(2), S3C_GPIO_PULL_UP);
60 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
61 }
62}
63
64void s5pv310_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
65{
66 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
67 unsigned int gpio;
68
69 /* Set all the necessary GPK1[0:1] pins to special-function 2 */
70 for (gpio = S5PV310_GPK1(0); gpio < S5PV310_GPK1(2); gpio++) {
71 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
72 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
73 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
74 }
75
76 for (gpio = S5PV310_GPK1(3); gpio <= S5PV310_GPK1(6); gpio++) {
77 /* Data pin GPK1[3:6] to special-function 2 */
78 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
79 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
80 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
81 }
82
83 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
84 s3c_gpio_cfgpin(S5PV310_GPK1(2), S3C_GPIO_SFN(2));
85 s3c_gpio_setpull(S5PV310_GPK1(2), S3C_GPIO_PULL_UP);
86 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
87 }
88}
89
90void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *dev, int width)
91{
92 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
93 unsigned int gpio;
94
95 /* Set all the necessary GPK2[0:1] pins to special-function 2 */
96 for (gpio = S5PV310_GPK2(0); gpio < S5PV310_GPK2(2); gpio++) {
97 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
98 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
99 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
100 }
101
102 switch (width) {
103 case 8:
104 for (gpio = S5PV310_GPK3(3); gpio <= S5PV310_GPK3(6); gpio++) {
105 /* Data pin GPK3[3:6] to special-function 3 */
106 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
107 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
108 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
109 }
110 case 4:
111 for (gpio = S5PV310_GPK2(3); gpio <= S5PV310_GPK2(6); gpio++) {
112 /* Data pin GPK2[3:6] to special-function 2 */
113 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
114 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
115 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
116 }
117 default:
118 break;
119 }
120
121 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
122 s3c_gpio_cfgpin(S5PV310_GPK2(2), S3C_GPIO_SFN(2));
123 s3c_gpio_setpull(S5PV310_GPK2(2), S3C_GPIO_PULL_UP);
124 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
125 }
126}
127
128void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *dev, int width)
129{
130 struct s3c_sdhci_platdata *pdata = dev->dev.platform_data;
131 unsigned int gpio;
132
133 /* Set all the necessary GPK3[0:1] pins to special-function 2 */
134 for (gpio = S5PV310_GPK3(0); gpio < S5PV310_GPK3(2); gpio++) {
135 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
136 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
137 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
138 }
139
140 for (gpio = S5PV310_GPK3(3); gpio <= S5PV310_GPK3(6); gpio++) {
141 /* Data pin GPK3[3:6] to special-function 2 */
142 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
143 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
144 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
145 }
146
147 if (pdata->cd_type == S3C_SDHCI_CD_INTERNAL) {
148 s3c_gpio_cfgpin(S5PV310_GPK3(2), S3C_GPIO_SFN(2));
149 s3c_gpio_setpull(S5PV310_GPK3(2), S3C_GPIO_PULL_UP);
150 s5p_gpio_set_drvstr(gpio, S5P_GPIO_DRVSTR_LV4);
151 }
152}
diff --git a/arch/arm/mach-s5pv310/setup-sdhci.c b/arch/arm/mach-s5pv310/setup-sdhci.c
new file mode 100644
index 000000000000..db8358fc4662
--- /dev/null
+++ b/arch/arm/mach-s5pv310/setup-sdhci.c
@@ -0,0 +1,69 @@
1/* linux/arch/arm/mach-s5pv310/setup-sdhci.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5PV310 - Helper functions for settign up SDHCI device(s) (HSMMC)
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/types.h>
15#include <linux/interrupt.h>
16#include <linux/platform_device.h>
17#include <linux/io.h>
18
19#include <linux/mmc/card.h>
20#include <linux/mmc/host.h>
21
22#include <plat/regs-sdhci.h>
23
24/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
25
26char *s5pv310_hsmmc_clksrcs[4] = {
27 [0] = NULL,
28 [1] = NULL,
29 [2] = "sclk_mmc", /* mmc_bus */
30 [3] = NULL,
31};
32
33void s5pv310_setup_sdhci_cfg_card(struct platform_device *dev, void __iomem *r,
34 struct mmc_ios *ios, struct mmc_card *card)
35{
36 u32 ctrl2, ctrl3;
37
38 /* don't need to alter anything acording to card-type */
39
40 ctrl2 = readl(r + S3C_SDHCI_CONTROL2);
41
42 /* select base clock source to HCLK */
43
44 ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
45
46 /*
47 * clear async mode, enable conflict mask, rx feedback ctrl, SD
48 * clk hold and no use debounce count
49 */
50
51 ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
52 S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
53 S3C_SDHCI_CTRL2_ENFBCLKRX |
54 S3C_SDHCI_CTRL2_DFCNT_NONE |
55 S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
56
57 /* Tx and Rx feedback clock delay control */
58
59 if (ios->clock < 25 * 1000000)
60 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
61 S3C_SDHCI_CTRL3_FCSEL2 |
62 S3C_SDHCI_CTRL3_FCSEL1 |
63 S3C_SDHCI_CTRL3_FCSEL0);
64 else
65 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
66
67 writel(ctrl2, r + S3C_SDHCI_CONTROL2);
68 writel(ctrl3, r + S3C_SDHCI_CONTROL3);
69}
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
index c0a13ef5436f..96f7dc103b59 100644
--- a/arch/arm/mach-sa1100/cpu-sa1100.c
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c
@@ -184,16 +184,15 @@ static int sa1100_target(struct cpufreq_policy *policy,
184{ 184{
185 unsigned int cur = sa11x0_getspeed(0); 185 unsigned int cur = sa11x0_getspeed(0);
186 unsigned int new_ppcr; 186 unsigned int new_ppcr;
187
188 struct cpufreq_freqs freqs; 187 struct cpufreq_freqs freqs;
188
189 new_ppcr = sa11x0_freq_to_ppcr(target_freq);
189 switch(relation){ 190 switch(relation){
190 case CPUFREQ_RELATION_L: 191 case CPUFREQ_RELATION_L:
191 new_ppcr = sa11x0_freq_to_ppcr(target_freq);
192 if (sa11x0_ppcr_to_freq(new_ppcr) > policy->max) 192 if (sa11x0_ppcr_to_freq(new_ppcr) > policy->max)
193 new_ppcr--; 193 new_ppcr--;
194 break; 194 break;
195 case CPUFREQ_RELATION_H: 195 case CPUFREQ_RELATION_H:
196 new_ppcr = sa11x0_freq_to_ppcr(target_freq);
197 if ((sa11x0_ppcr_to_freq(new_ppcr) > target_freq) && 196 if ((sa11x0_ppcr_to_freq(new_ppcr) > target_freq) &&
198 (sa11x0_ppcr_to_freq(new_ppcr - 1) >= policy->min)) 197 (sa11x0_ppcr_to_freq(new_ppcr - 1) >= policy->min))
199 new_ppcr--; 198 new_ppcr--;
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 54b479c35ee0..51dcd59eda6a 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -116,4 +116,6 @@ endmenu
116config SH_CLK_CPG 116config SH_CLK_CPG
117 bool 117 bool
118 118
119source "drivers/sh/Kconfig"
120
119endif 121endif
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 14923989ea05..d3260542b943 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -30,7 +30,6 @@
30#include <linux/mtd/mtd.h> 30#include <linux/mtd/mtd.h>
31#include <linux/mtd/partitions.h> 31#include <linux/mtd/partitions.h>
32#include <linux/mtd/physmap.h> 32#include <linux/mtd/physmap.h>
33#include <linux/mmc/host.h>
34#include <linux/mmc/sh_mmcif.h> 33#include <linux/mmc/sh_mmcif.h>
35#include <linux/i2c.h> 34#include <linux/i2c.h>
36#include <linux/i2c/tsc2007.h> 35#include <linux/i2c/tsc2007.h>
@@ -44,6 +43,10 @@
44#include <linux/input/sh_keysc.h> 43#include <linux/input/sh_keysc.h>
45#include <linux/usb/r8a66597.h> 44#include <linux/usb/r8a66597.h>
46 45
46#include <media/sh_mobile_ceu.h>
47#include <media/sh_mobile_csi2.h>
48#include <media/soc_camera.h>
49
47#include <sound/sh_fsi.h> 50#include <sound/sh_fsi.h>
48 51
49#include <video/sh_mobile_hdmi.h> 52#include <video/sh_mobile_hdmi.h>
@@ -160,11 +163,13 @@ static struct mtd_partition nor_flash_partitions[] = {
160 .name = "loader", 163 .name = "loader",
161 .offset = 0x00000000, 164 .offset = 0x00000000,
162 .size = 512 * 1024, 165 .size = 512 * 1024,
166 .mask_flags = MTD_WRITEABLE,
163 }, 167 },
164 { 168 {
165 .name = "bootenv", 169 .name = "bootenv",
166 .offset = MTDPART_OFS_APPEND, 170 .offset = MTDPART_OFS_APPEND,
167 .size = 512 * 1024, 171 .size = 512 * 1024,
172 .mask_flags = MTD_WRITEABLE,
168 }, 173 },
169 { 174 {
170 .name = "kernel_ro", 175 .name = "kernel_ro",
@@ -235,10 +240,22 @@ static struct platform_device smc911x_device = {
235 }, 240 },
236}; 241};
237 242
243/*
244 * The card detect pin of the top SD/MMC slot (CN7) is active low and is
245 * connected to GPIO A22 of SH7372 (GPIO_PORT41).
246 */
247static int slot_cn7_get_cd(struct platform_device *pdev)
248{
249 if (gpio_is_valid(GPIO_PORT41))
250 return !gpio_get_value(GPIO_PORT41);
251 else
252 return -ENXIO;
253}
254
238/* SH_MMCIF */ 255/* SH_MMCIF */
239static struct resource sh_mmcif_resources[] = { 256static struct resource sh_mmcif_resources[] = {
240 [0] = { 257 [0] = {
241 .name = "SH_MMCIF", 258 .name = "MMCIF",
242 .start = 0xE6BD0000, 259 .start = 0xE6BD0000,
243 .end = 0xE6BD00FF, 260 .end = 0xE6BD00FF,
244 .flags = IORESOURCE_MEM, 261 .flags = IORESOURCE_MEM,
@@ -261,6 +278,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = {
261 .caps = MMC_CAP_4_BIT_DATA | 278 .caps = MMC_CAP_4_BIT_DATA |
262 MMC_CAP_8_BIT_DATA | 279 MMC_CAP_8_BIT_DATA |
263 MMC_CAP_NEEDS_POLL, 280 MMC_CAP_NEEDS_POLL,
281 .get_cd = slot_cn7_get_cd,
264}; 282};
265 283
266static struct platform_device sh_mmcif_device = { 284static struct platform_device sh_mmcif_device = {
@@ -310,6 +328,8 @@ static struct sh_mobile_sdhi_info sdhi1_info = {
310 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, 328 .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX,
311 .tmio_ocr_mask = MMC_VDD_165_195, 329 .tmio_ocr_mask = MMC_VDD_165_195,
312 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, 330 .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE,
331 .tmio_caps = MMC_CAP_NEEDS_POLL,
332 .get_cd = slot_cn7_get_cd,
313}; 333};
314 334
315static struct resource sdhi1_resources[] = { 335static struct resource sdhi1_resources[] = {
@@ -375,10 +395,40 @@ static struct platform_device usb1_host_device = {
375 .resource = usb1_host_resources, 395 .resource = usb1_host_resources,
376}; 396};
377 397
398const static struct fb_videomode ap4evb_lcdc_modes[] = {
399 {
400#ifdef CONFIG_AP4EVB_QHD
401 .name = "R63302(QHD)",
402 .xres = 544,
403 .yres = 961,
404 .left_margin = 72,
405 .right_margin = 600,
406 .hsync_len = 16,
407 .upper_margin = 8,
408 .lower_margin = 8,
409 .vsync_len = 2,
410 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
411#else
412 .name = "WVGA Panel",
413 .xres = 800,
414 .yres = 480,
415 .left_margin = 220,
416 .right_margin = 110,
417 .hsync_len = 70,
418 .upper_margin = 20,
419 .lower_margin = 5,
420 .vsync_len = 5,
421 .sync = 0,
422#endif
423 },
424};
425
378static struct sh_mobile_lcdc_info lcdc_info = { 426static struct sh_mobile_lcdc_info lcdc_info = {
379 .ch[0] = { 427 .ch[0] = {
380 .chan = LCDC_CHAN_MAINLCD, 428 .chan = LCDC_CHAN_MAINLCD,
381 .bpp = 16, 429 .bpp = 16,
430 .lcd_cfg = ap4evb_lcdc_modes,
431 .num_cfg = ARRAY_SIZE(ap4evb_lcdc_modes),
382 } 432 }
383}; 433};
384 434
@@ -517,26 +567,41 @@ static struct platform_device *qhd_devices[] __initdata = {
517 567
518/* FSI */ 568/* FSI */
519#define IRQ_FSI evt2irq(0x1840) 569#define IRQ_FSI evt2irq(0x1840)
520#define FSIACKCR 0xE6150018 570
521static void fsiackcr_init(struct clk *clk) 571static int fsi_set_rate(int is_porta, int rate)
522{ 572{
523 u32 status = __raw_readl(clk->enable_reg); 573 struct clk *fsib_clk;
574 struct clk *fdiv_clk = &sh7372_fsidivb_clk;
575 int ret;
524 576
525 /* use external clock */ 577 /* set_rate is not needed if port A */
526 status &= ~0x000000ff; 578 if (is_porta)
527 status |= 0x00000080; 579 return 0;
528 __raw_writel(status, clk->enable_reg); 580
529} 581 fsib_clk = clk_get(NULL, "fsib_clk");
582 if (IS_ERR(fsib_clk))
583 return -EINVAL;
584
585 switch (rate) {
586 case 44100:
587 clk_set_rate(fsib_clk, clk_round_rate(fsib_clk, 11283000));
588 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
589 break;
590 case 48000:
591 clk_set_rate(fsib_clk, clk_round_rate(fsib_clk, 85428000));
592 clk_set_rate(fdiv_clk, clk_round_rate(fdiv_clk, 12204000));
593 ret = SH_FSI_ACKMD_256 | SH_FSI_BPFMD_64;
594 break;
595 default:
596 pr_err("unsupported rate in FSI2 port B\n");
597 ret = -EINVAL;
598 break;
599 }
530 600
531static struct clk_ops fsiackcr_clk_ops = { 601 clk_put(fsib_clk);
532 .init = fsiackcr_init,
533};
534 602
535static struct clk fsiackcr_clk = { 603 return ret;
536 .ops = &fsiackcr_clk_ops, 604}
537 .enable_reg = (void __iomem *)FSIACKCR,
538 .rate = 0, /* unknown */
539};
540 605
541static struct sh_fsi_platform_info fsi_info = { 606static struct sh_fsi_platform_info fsi_info = {
542 .porta_flags = SH_FSI_BRS_INV | 607 .porta_flags = SH_FSI_BRS_INV |
@@ -544,6 +609,12 @@ static struct sh_fsi_platform_info fsi_info = {
544 SH_FSI_IN_SLAVE_MODE | 609 SH_FSI_IN_SLAVE_MODE |
545 SH_FSI_OFMT(PCM) | 610 SH_FSI_OFMT(PCM) |
546 SH_FSI_IFMT(PCM), 611 SH_FSI_IFMT(PCM),
612
613 .portb_flags = SH_FSI_BRS_INV |
614 SH_FSI_BRM_INV |
615 SH_FSI_LRS_INV |
616 SH_FSI_OFMT(SPDIF),
617 .set_rate = fsi_set_rate,
547}; 618};
548 619
549static struct resource fsi_resources[] = { 620static struct resource fsi_resources[] = {
@@ -577,26 +648,6 @@ static struct sh_mobile_lcdc_info sh_mobile_lcdc1_info = {
577 .interface_type = RGB24, 648 .interface_type = RGB24,
578 .clock_divider = 1, 649 .clock_divider = 1,
579 .flags = LCDC_FLAGS_DWPOL, 650 .flags = LCDC_FLAGS_DWPOL,
580 .lcd_cfg = {
581 .name = "HDMI",
582 /* So far only 720p is supported */
583 .xres = 1280,
584 .yres = 720,
585 /*
586 * If left and right margins are not multiples of 8,
587 * LDHAJR will be adjusted accordingly by the LCDC
588 * driver. Until we start using EDID, these values
589 * might have to be adjusted for different monitors.
590 */
591 .left_margin = 200,
592 .right_margin = 88,
593 .hsync_len = 48,
594 .upper_margin = 20,
595 .lower_margin = 5,
596 .vsync_len = 5,
597 .pixclock = 13468,
598 .sync = FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
599 },
600 } 651 }
601}; 652};
602 653
@@ -608,7 +659,7 @@ static struct resource lcdc1_resources[] = {
608 .flags = IORESOURCE_MEM, 659 .flags = IORESOURCE_MEM,
609 }, 660 },
610 [1] = { 661 [1] = {
611 .start = intcs_evt2irq(0x17a0), 662 .start = intcs_evt2irq(0x1780),
612 .flags = IORESOURCE_IRQ, 663 .flags = IORESOURCE_IRQ,
613 }, 664 },
614}; 665};
@@ -627,6 +678,7 @@ static struct platform_device lcdc1_device = {
627static struct sh_mobile_hdmi_info hdmi_info = { 678static struct sh_mobile_hdmi_info hdmi_info = {
628 .lcd_chan = &sh_mobile_lcdc1_info.ch[0], 679 .lcd_chan = &sh_mobile_lcdc1_info.ch[0],
629 .lcd_dev = &lcdc1_device.dev, 680 .lcd_dev = &lcdc1_device.dev,
681 .flags = HDMI_SND_SRC_SPDIF,
630}; 682};
631 683
632static struct resource hdmi_resources[] = { 684static struct resource hdmi_resources[] = {
@@ -689,6 +741,95 @@ static struct platform_device leds_device = {
689 }, 741 },
690}; 742};
691 743
744static struct i2c_board_info imx074_info = {
745 I2C_BOARD_INFO("imx074", 0x1a),
746};
747
748struct soc_camera_link imx074_link = {
749 .bus_id = 0,
750 .board_info = &imx074_info,
751 .i2c_adapter_id = 0,
752 .module_name = "imx074",
753};
754
755static struct platform_device ap4evb_camera = {
756 .name = "soc-camera-pdrv",
757 .id = 0,
758 .dev = {
759 .platform_data = &imx074_link,
760 },
761};
762
763static struct sh_csi2_client_config csi2_clients[] = {
764 {
765 .phy = SH_CSI2_PHY_MAIN,
766 .lanes = 3,
767 .channel = 0,
768 .pdev = &ap4evb_camera,
769 },
770};
771
772static struct sh_csi2_pdata csi2_info = {
773 .type = SH_CSI2C,
774 .clients = csi2_clients,
775 .num_clients = ARRAY_SIZE(csi2_clients),
776 .flags = SH_CSI2_ECC | SH_CSI2_CRC,
777};
778
779static struct resource csi2_resources[] = {
780 [0] = {
781 .name = "CSI2",
782 .start = 0xffc90000,
783 .end = 0xffc90fff,
784 .flags = IORESOURCE_MEM,
785 },
786 [1] = {
787 .start = intcs_evt2irq(0x17a0),
788 .flags = IORESOURCE_IRQ,
789 },
790};
791
792static struct platform_device csi2_device = {
793 .name = "sh-mobile-csi2",
794 .id = 0,
795 .num_resources = ARRAY_SIZE(csi2_resources),
796 .resource = csi2_resources,
797 .dev = {
798 .platform_data = &csi2_info,
799 },
800};
801
802static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
803 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
804 .csi2_dev = &csi2_device.dev,
805};
806
807static struct resource ceu_resources[] = {
808 [0] = {
809 .name = "CEU",
810 .start = 0xfe910000,
811 .end = 0xfe91009f,
812 .flags = IORESOURCE_MEM,
813 },
814 [1] = {
815 .start = intcs_evt2irq(0x880),
816 .flags = IORESOURCE_IRQ,
817 },
818 [2] = {
819 /* place holder for contiguous memory */
820 },
821};
822
823static struct platform_device ceu_device = {
824 .name = "sh_mobile_ceu",
825 .id = 0, /* "ceu0" clock */
826 .num_resources = ARRAY_SIZE(ceu_resources),
827 .resource = ceu_resources,
828 .dev = {
829 .platform_data = &sh_mobile_ceu_info,
830 },
831};
832
692static struct platform_device *ap4evb_devices[] __initdata = { 833static struct platform_device *ap4evb_devices[] __initdata = {
693 &leds_device, 834 &leds_device,
694 &nor_flash_device, 835 &nor_flash_device,
@@ -701,6 +842,9 @@ static struct platform_device *ap4evb_devices[] __initdata = {
701 &lcdc1_device, 842 &lcdc1_device,
702 &lcdc_device, 843 &lcdc_device,
703 &hdmi_device, 844 &hdmi_device,
845 &csi2_device,
846 &ceu_device,
847 &ap4evb_camera,
704}; 848};
705 849
706static int __init hdmi_init_pm_clock(void) 850static int __init hdmi_init_pm_clock(void)
@@ -715,22 +859,22 @@ static int __init hdmi_init_pm_clock(void)
715 goto out; 859 goto out;
716 } 860 }
717 861
718 ret = clk_set_parent(&pllc2_clk, &dv_clki_div2_clk); 862 ret = clk_set_parent(&sh7372_pllc2_clk, &sh7372_dv_clki_div2_clk);
719 if (ret < 0) { 863 if (ret < 0) {
720 pr_err("Cannot set PLLC2 parent: %d, %d users\n", ret, pllc2_clk.usecount); 864 pr_err("Cannot set PLLC2 parent: %d, %d users\n", ret, sh7372_pllc2_clk.usecount);
721 goto out; 865 goto out;
722 } 866 }
723 867
724 pr_debug("PLLC2 initial frequency %lu\n", clk_get_rate(&pllc2_clk)); 868 pr_debug("PLLC2 initial frequency %lu\n", clk_get_rate(&sh7372_pllc2_clk));
725 869
726 rate = clk_round_rate(&pllc2_clk, 594000000); 870 rate = clk_round_rate(&sh7372_pllc2_clk, 594000000);
727 if (rate < 0) { 871 if (rate < 0) {
728 pr_err("Cannot get suitable rate: %ld\n", rate); 872 pr_err("Cannot get suitable rate: %ld\n", rate);
729 ret = rate; 873 ret = rate;
730 goto out; 874 goto out;
731 } 875 }
732 876
733 ret = clk_set_rate(&pllc2_clk, rate); 877 ret = clk_set_rate(&sh7372_pllc2_clk, rate);
734 if (ret < 0) { 878 if (ret < 0) {
735 pr_err("Cannot set rate %ld: %d\n", rate, ret); 879 pr_err("Cannot set rate %ld: %d\n", rate, ret);
736 goto out; 880 goto out;
@@ -738,7 +882,7 @@ static int __init hdmi_init_pm_clock(void)
738 882
739 pr_debug("PLLC2 set frequency %lu\n", rate); 883 pr_debug("PLLC2 set frequency %lu\n", rate);
740 884
741 ret = clk_set_parent(hdmi_ick, &pllc2_clk); 885 ret = clk_set_parent(hdmi_ick, &sh7372_pllc2_clk);
742 if (ret < 0) { 886 if (ret < 0) {
743 pr_err("Cannot set HDMI parent: %d\n", ret); 887 pr_err("Cannot set HDMI parent: %d\n", ret);
744 goto out; 888 goto out;
@@ -752,11 +896,51 @@ out:
752 896
753device_initcall(hdmi_init_pm_clock); 897device_initcall(hdmi_init_pm_clock);
754 898
899#define FSIACK_DUMMY_RATE 48000
900static int __init fsi_init_pm_clock(void)
901{
902 struct clk *fsia_ick;
903 int ret;
904
905 /*
906 * FSIACK is connected to AK4642,
907 * and the rate is depend on playing sound rate.
908 * So, set dummy rate (= 48k) here
909 */
910 ret = clk_set_rate(&sh7372_fsiack_clk, FSIACK_DUMMY_RATE);
911 if (ret < 0) {
912 pr_err("Cannot set FSIACK dummy rate: %d\n", ret);
913 return ret;
914 }
915
916 fsia_ick = clk_get(&fsi_device.dev, "icka");
917 if (IS_ERR(fsia_ick)) {
918 ret = PTR_ERR(fsia_ick);
919 pr_err("Cannot get FSI ICK: %d\n", ret);
920 return ret;
921 }
922
923 ret = clk_set_parent(fsia_ick, &sh7372_fsiack_clk);
924 if (ret < 0) {
925 pr_err("Cannot set FSI-A parent: %d\n", ret);
926 goto out;
927 }
928
929 ret = clk_set_rate(fsia_ick, FSIACK_DUMMY_RATE);
930 if (ret < 0)
931 pr_err("Cannot set FSI-A rate: %d\n", ret);
932
933out:
934 clk_put(fsia_ick);
935
936 return ret;
937}
938device_initcall(fsi_init_pm_clock);
939
755/* 940/*
756 * FIXME !! 941 * FIXME !!
757 * 942 *
758 * gpio_no_direction 943 * gpio_no_direction
759 * gpio_pull_up
760 * are quick_hack. 944 * are quick_hack.
761 * 945 *
762 * current gpio frame work doesn't have 946 * current gpio frame work doesn't have
@@ -768,49 +952,37 @@ static void __init gpio_no_direction(u32 addr)
768 __raw_writeb(0x00, addr); 952 __raw_writeb(0x00, addr);
769} 953}
770 954
771static void __init gpio_pull_up(u32 addr)
772{
773 u8 data = __raw_readb(addr);
774
775 data &= 0x0F;
776 data |= 0xC0;
777 __raw_writeb(data, addr);
778}
779
780/* TouchScreen */ 955/* TouchScreen */
956#ifdef CONFIG_AP4EVB_QHD
957# define GPIO_TSC_IRQ GPIO_FN_IRQ28_123
958# define GPIO_TSC_PORT GPIO_PORT123
959#else /* WVGA */
960# define GPIO_TSC_IRQ GPIO_FN_IRQ7_40
961# define GPIO_TSC_PORT GPIO_PORT40
962#endif
963
781#define IRQ28 evt2irq(0x3380) /* IRQ28A */ 964#define IRQ28 evt2irq(0x3380) /* IRQ28A */
782#define IRQ7 evt2irq(0x02e0) /* IRQ7A */ 965#define IRQ7 evt2irq(0x02e0) /* IRQ7A */
783static int ts_get_pendown_state(void) 966static int ts_get_pendown_state(void)
784{ 967{
785 int val1, val2; 968 int val;
786 969
787 gpio_free(GPIO_FN_IRQ28_123); 970 gpio_free(GPIO_TSC_IRQ);
788 gpio_free(GPIO_FN_IRQ7_40);
789 971
790 gpio_request(GPIO_PORT123, NULL); 972 gpio_request(GPIO_TSC_PORT, NULL);
791 gpio_request(GPIO_PORT40, NULL);
792 973
793 gpio_direction_input(GPIO_PORT123); 974 gpio_direction_input(GPIO_TSC_PORT);
794 gpio_direction_input(GPIO_PORT40);
795 975
796 val1 = gpio_get_value(GPIO_PORT123); 976 val = gpio_get_value(GPIO_TSC_PORT);
797 val2 = gpio_get_value(GPIO_PORT40);
798 977
799 gpio_request(GPIO_FN_IRQ28_123, NULL); /* for QHD */ 978 gpio_request(GPIO_TSC_IRQ, NULL);
800 gpio_request(GPIO_FN_IRQ7_40, NULL); /* for WVGA */
801 979
802 return val1 ^ val2; 980 return !val;
803} 981}
804 982
805#define PORT40CR 0xE6051028
806#define PORT123CR 0xE605007B
807static int ts_init(void) 983static int ts_init(void)
808{ 984{
809 gpio_request(GPIO_FN_IRQ28_123, NULL); /* for QHD */ 985 gpio_request(GPIO_TSC_IRQ, NULL);
810 gpio_request(GPIO_FN_IRQ7_40, NULL); /* for WVGA */
811
812 gpio_pull_up(PORT40CR);
813 gpio_pull_up(PORT123CR);
814 986
815 return 0; 987 return 0;
816} 988}
@@ -865,6 +1037,7 @@ static void __init ap4evb_map_io(void)
865 1037
866#define GPIO_PORT9CR 0xE6051009 1038#define GPIO_PORT9CR 0xE6051009
867#define GPIO_PORT10CR 0xE605100A 1039#define GPIO_PORT10CR 0xE605100A
1040#define USCCR1 0xE6058144
868static void __init ap4evb_init(void) 1041static void __init ap4evb_init(void)
869{ 1042{
870 u32 srcr4; 1043 u32 srcr4;
@@ -935,7 +1108,7 @@ static void __init ap4evb_init(void)
935 /* setup USB phy */ 1108 /* setup USB phy */
936 __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */ 1109 __raw_writew(0x8a0a, 0xE6058130); /* USBCR2 */
937 1110
938 /* enable FSI2 */ 1111 /* enable FSI2 port A (ak4643) */
939 gpio_request(GPIO_FN_FSIAIBT, NULL); 1112 gpio_request(GPIO_FN_FSIAIBT, NULL);
940 gpio_request(GPIO_FN_FSIAILR, NULL); 1113 gpio_request(GPIO_FN_FSIAILR, NULL);
941 gpio_request(GPIO_FN_FSIAISLD, NULL); 1114 gpio_request(GPIO_FN_FSIAISLD, NULL);
@@ -948,6 +1121,14 @@ static void __init ap4evb_init(void)
948 gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */ 1121 gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */
949 gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */ 1122 gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */
950 1123
1124 /* card detect pin for MMC slot (CN7) */
1125 gpio_request(GPIO_PORT41, NULL);
1126 gpio_direction_input(GPIO_PORT41);
1127
1128 /* setup FSI2 port B (HDMI) */
1129 gpio_request(GPIO_FN_FSIBCK, NULL);
1130 __raw_writew(__raw_readw(USCCR1) & ~(1 << 6), USCCR1); /* use SPDIF */
1131
951 /* set SPU2 clock to 119.6 MHz */ 1132 /* set SPU2 clock to 119.6 MHz */
952 clk = clk_get(NULL, "spu_clk"); 1133 clk = clk_get(NULL, "spu_clk");
953 if (!IS_ERR(clk)) { 1134 if (!IS_ERR(clk)) {
@@ -955,14 +1136,6 @@ static void __init ap4evb_init(void)
955 clk_put(clk); 1136 clk_put(clk);
956 } 1137 }
957 1138
958 /* change parent of FSI A */
959 clk = clk_get(NULL, "fsia_clk");
960 if (!IS_ERR(clk)) {
961 clk_register(&fsiackcr_clk);
962 clk_set_parent(clk, &fsiackcr_clk);
963 clk_put(clk);
964 }
965
966 /* 1139 /*
967 * set irq priority, to avoid sound chopping 1140 * set irq priority, to avoid sound chopping
968 * when NFS rootfs is used 1141 * when NFS rootfs is used
@@ -977,8 +1150,10 @@ static void __init ap4evb_init(void)
977 ARRAY_SIZE(i2c1_devices)); 1150 ARRAY_SIZE(i2c1_devices));
978 1151
979#ifdef CONFIG_AP4EVB_QHD 1152#ifdef CONFIG_AP4EVB_QHD
1153
980 /* 1154 /*
981 * QHD 1155 * For QHD Panel (MIPI-DSI, CONFIG_AP4EVB_QHD=y) and
1156 * IRQ28 for Touch Panel, set dip switches S3, S43 as OFF, ON.
982 */ 1157 */
983 1158
984 /* enable KEYSC */ 1159 /* enable KEYSC */
@@ -1004,17 +1179,6 @@ static void __init ap4evb_init(void)
1004 lcdc_info.ch[0].interface_type = RGB24; 1179 lcdc_info.ch[0].interface_type = RGB24;
1005 lcdc_info.ch[0].clock_divider = 1; 1180 lcdc_info.ch[0].clock_divider = 1;
1006 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL; 1181 lcdc_info.ch[0].flags = LCDC_FLAGS_DWPOL;
1007 lcdc_info.ch[0].lcd_cfg.name = "R63302(QHD)";
1008 lcdc_info.ch[0].lcd_cfg.xres = 544;
1009 lcdc_info.ch[0].lcd_cfg.yres = 961;
1010 lcdc_info.ch[0].lcd_cfg.left_margin = 72;
1011 lcdc_info.ch[0].lcd_cfg.right_margin = 600;
1012 lcdc_info.ch[0].lcd_cfg.hsync_len = 16;
1013 lcdc_info.ch[0].lcd_cfg.upper_margin = 8;
1014 lcdc_info.ch[0].lcd_cfg.lower_margin = 8;
1015 lcdc_info.ch[0].lcd_cfg.vsync_len = 2;
1016 lcdc_info.ch[0].lcd_cfg.sync = FB_SYNC_VERT_HIGH_ACT |
1017 FB_SYNC_HOR_HIGH_ACT;
1018 lcdc_info.ch[0].lcd_size_cfg.width = 44; 1182 lcdc_info.ch[0].lcd_size_cfg.width = 44;
1019 lcdc_info.ch[0].lcd_size_cfg.height = 79; 1183 lcdc_info.ch[0].lcd_size_cfg.height = 79;
1020 1184
@@ -1022,8 +1186,10 @@ static void __init ap4evb_init(void)
1022 1186
1023#else 1187#else
1024 /* 1188 /*
1025 * WVGA 1189 * For WVGA Panel (18-bit RGB, CONFIG_AP4EVB_WVGA=y) and
1190 * IRQ7 for Touch Panel, set dip switches S3, S43 to ON, OFF.
1026 */ 1191 */
1192
1027 gpio_request(GPIO_FN_LCDD17, NULL); 1193 gpio_request(GPIO_FN_LCDD17, NULL);
1028 gpio_request(GPIO_FN_LCDD16, NULL); 1194 gpio_request(GPIO_FN_LCDD16, NULL);
1029 gpio_request(GPIO_FN_LCDD15, NULL); 1195 gpio_request(GPIO_FN_LCDD15, NULL);
@@ -1055,16 +1221,6 @@ static void __init ap4evb_init(void)
1055 lcdc_info.ch[0].interface_type = RGB18; 1221 lcdc_info.ch[0].interface_type = RGB18;
1056 lcdc_info.ch[0].clock_divider = 2; 1222 lcdc_info.ch[0].clock_divider = 2;
1057 lcdc_info.ch[0].flags = 0; 1223 lcdc_info.ch[0].flags = 0;
1058 lcdc_info.ch[0].lcd_cfg.name = "WVGA Panel";
1059 lcdc_info.ch[0].lcd_cfg.xres = 800;
1060 lcdc_info.ch[0].lcd_cfg.yres = 480;
1061 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
1062 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
1063 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
1064 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
1065 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
1066 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
1067 lcdc_info.ch[0].lcd_cfg.sync = 0;
1068 lcdc_info.ch[0].lcd_size_cfg.width = 152; 1224 lcdc_info.ch[0].lcd_size_cfg.width = 152;
1069 lcdc_info.ch[0].lcd_size_cfg.height = 91; 1225 lcdc_info.ch[0].lcd_size_cfg.height = 91;
1070 1226
@@ -1075,6 +1231,23 @@ static void __init ap4evb_init(void)
1075 i2c_register_board_info(0, &tsc_device, 1); 1231 i2c_register_board_info(0, &tsc_device, 1);
1076#endif /* CONFIG_AP4EVB_QHD */ 1232#endif /* CONFIG_AP4EVB_QHD */
1077 1233
1234 /* CEU */
1235
1236 /*
1237 * TODO: reserve memory for V4L2 DMA buffers, when a suitable API
1238 * becomes available
1239 */
1240
1241 /* MIPI-CSI stuff */
1242 gpio_request(GPIO_FN_VIO_CKO, NULL);
1243
1244 clk = clk_get(NULL, "vck1_clk");
1245 if (!IS_ERR(clk)) {
1246 clk_set_rate(clk, clk_round_rate(clk, 13000000));
1247 clk_enable(clk);
1248 clk_put(clk);
1249 }
1250
1078 sh7372_add_standard_devices(); 1251 sh7372_add_standard_devices();
1079 1252
1080 /* HDMI */ 1253 /* HDMI */
@@ -1097,7 +1270,7 @@ static void __init ap4evb_timer_init(void)
1097 shmobile_timer.init(); 1270 shmobile_timer.init();
1098 1271
1099 /* External clock source */ 1272 /* External clock source */
1100 clk_set_rate(&dv_clki_clk, 27000000); 1273 clk_set_rate(&sh7372_dv_clki_clk, 27000000);
1101} 1274}
1102 1275
1103static struct sys_timer ap4evb_timer = { 1276static struct sys_timer ap4evb_timer = {
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
index b6454c9f2abb..9f78729098f2 100644
--- a/arch/arm/mach-shmobile/clock-sh7367.c
+++ b/arch/arm/mach-shmobile/clock-sh7367.c
@@ -321,7 +321,7 @@ static struct clk_lookup lookups[] = {
321 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[SYMSTP001]), /* SCIFA3 */ 321 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[SYMSTP001]), /* SCIFA3 */
322 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[SYMSTP000]), /* SCIFA4 */ 322 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[SYMSTP000]), /* SCIFA4 */
323 CLKDEV_DEV_ID("sh_siu", &mstp_clks[SYMSTP231]), /* SIU */ 323 CLKDEV_DEV_ID("sh_siu", &mstp_clks[SYMSTP231]), /* SIU */
324 CLKDEV_CON_ID("cmt1", &mstp_clks[SYMSTP229]), /* CMT10 */ 324 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[SYMSTP229]), /* CMT10 */
325 CLKDEV_DEV_ID("sh_irda", &mstp_clks[SYMSTP225]), /* IRDA */ 325 CLKDEV_DEV_ID("sh_irda", &mstp_clks[SYMSTP225]), /* IRDA */
326 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[SYMSTP223]), /* IIC1 */ 326 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[SYMSTP223]), /* IIC1 */
327 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[SYMSTP222]), /* USBHS */ 327 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[SYMSTP222]), /* USBHS */
diff --git a/arch/arm/mach-shmobile/clock-sh7372.c b/arch/arm/mach-shmobile/clock-sh7372.c
index 759468992ad2..7db31e6c6bf2 100644
--- a/arch/arm/mach-shmobile/clock-sh7372.c
+++ b/arch/arm/mach-shmobile/clock-sh7372.c
@@ -50,8 +50,11 @@
50#define SMSTPCR3 0xe615013c 50#define SMSTPCR3 0xe615013c
51#define SMSTPCR4 0xe6150140 51#define SMSTPCR4 0xe6150140
52 52
53#define FSIDIVA 0xFE1F8000
54#define FSIDIVB 0xFE1F8008
55
53/* Platforms must set frequency on their DV_CLKI pin */ 56/* Platforms must set frequency on their DV_CLKI pin */
54struct clk dv_clki_clk = { 57struct clk sh7372_dv_clki_clk = {
55}; 58};
56 59
57/* Fixed 32 KHz root clock from EXTALR pin */ 60/* Fixed 32 KHz root clock from EXTALR pin */
@@ -86,9 +89,9 @@ static struct clk_ops div2_clk_ops = {
86}; 89};
87 90
88/* Divide dv_clki by two */ 91/* Divide dv_clki by two */
89struct clk dv_clki_div2_clk = { 92struct clk sh7372_dv_clki_div2_clk = {
90 .ops = &div2_clk_ops, 93 .ops = &div2_clk_ops,
91 .parent = &dv_clki_clk, 94 .parent = &sh7372_dv_clki_clk,
92}; 95};
93 96
94/* Divide extal1 by two */ 97/* Divide extal1 by two */
@@ -150,7 +153,7 @@ static struct clk pllc1_div2_clk = {
150static struct clk *pllc2_parent[] = { 153static struct clk *pllc2_parent[] = {
151 [0] = &extal1_div2_clk, 154 [0] = &extal1_div2_clk,
152 [1] = &extal2_div2_clk, 155 [1] = &extal2_div2_clk,
153 [2] = &dv_clki_div2_clk, 156 [2] = &sh7372_dv_clki_div2_clk,
154}; 157};
155 158
156/* Only multipliers 20 * 2 to 46 * 2 are valid, last entry for CPUFREQ_TABLE_END */ 159/* Only multipliers 20 * 2 to 46 * 2 are valid, last entry for CPUFREQ_TABLE_END */
@@ -284,27 +287,37 @@ static struct clk_ops pllc2_clk_ops = {
284 .set_parent = pllc2_set_parent, 287 .set_parent = pllc2_set_parent,
285}; 288};
286 289
287struct clk pllc2_clk = { 290struct clk sh7372_pllc2_clk = {
288 .ops = &pllc2_clk_ops, 291 .ops = &pllc2_clk_ops,
289 .parent = &extal1_div2_clk, 292 .parent = &extal1_div2_clk,
290 .freq_table = pllc2_freq_table, 293 .freq_table = pllc2_freq_table,
294 .nr_freqs = ARRAY_SIZE(pllc2_freq_table) - 1,
291 .parent_table = pllc2_parent, 295 .parent_table = pllc2_parent,
292 .parent_num = ARRAY_SIZE(pllc2_parent), 296 .parent_num = ARRAY_SIZE(pllc2_parent),
293}; 297};
294 298
299/* External input clock (pin name: FSIACK/FSIBCK ) */
300struct clk sh7372_fsiack_clk = {
301};
302
303struct clk sh7372_fsibck_clk = {
304};
305
295static struct clk *main_clks[] = { 306static struct clk *main_clks[] = {
296 &dv_clki_clk, 307 &sh7372_dv_clki_clk,
297 &r_clk, 308 &r_clk,
298 &sh7372_extal1_clk, 309 &sh7372_extal1_clk,
299 &sh7372_extal2_clk, 310 &sh7372_extal2_clk,
300 &dv_clki_div2_clk, 311 &sh7372_dv_clki_div2_clk,
301 &extal1_div2_clk, 312 &extal1_div2_clk,
302 &extal2_div2_clk, 313 &extal2_div2_clk,
303 &extal2_div4_clk, 314 &extal2_div4_clk,
304 &pllc0_clk, 315 &pllc0_clk,
305 &pllc1_clk, 316 &pllc1_clk,
306 &pllc1_div2_clk, 317 &pllc1_div2_clk,
307 &pllc2_clk, 318 &sh7372_pllc2_clk,
319 &sh7372_fsiack_clk,
320 &sh7372_fsibck_clk,
308}; 321};
309 322
310static void div4_kick(struct clk *clk) 323static void div4_kick(struct clk *clk)
@@ -357,7 +370,7 @@ static struct clk div4_clks[DIV4_NR] = {
357}; 370};
358 371
359enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_FMSI, DIV6_FMSO, 372enum { DIV6_VCK1, DIV6_VCK2, DIV6_VCK3, DIV6_FMSI, DIV6_FMSO,
360 DIV6_FSIA, DIV6_FSIB, DIV6_SUB, DIV6_SPU, 373 DIV6_SUB, DIV6_SPU,
361 DIV6_VOU, DIV6_DSIT, DIV6_DSI0P, DIV6_DSI1P, 374 DIV6_VOU, DIV6_DSIT, DIV6_DSI0P, DIV6_DSI1P,
362 DIV6_NR }; 375 DIV6_NR };
363 376
@@ -367,8 +380,6 @@ static struct clk div6_clks[DIV6_NR] = {
367 [DIV6_VCK3] = SH_CLK_DIV6(&pllc1_div2_clk, VCLKCR3, 0), 380 [DIV6_VCK3] = SH_CLK_DIV6(&pllc1_div2_clk, VCLKCR3, 0),
368 [DIV6_FMSI] = SH_CLK_DIV6(&pllc1_div2_clk, FMSICKCR, 0), 381 [DIV6_FMSI] = SH_CLK_DIV6(&pllc1_div2_clk, FMSICKCR, 0),
369 [DIV6_FMSO] = SH_CLK_DIV6(&pllc1_div2_clk, FMSOCKCR, 0), 382 [DIV6_FMSO] = SH_CLK_DIV6(&pllc1_div2_clk, FMSOCKCR, 0),
370 [DIV6_FSIA] = SH_CLK_DIV6(&pllc1_div2_clk, FSIACKCR, 0),
371 [DIV6_FSIB] = SH_CLK_DIV6(&pllc1_div2_clk, FSIBCKCR, 0),
372 [DIV6_SUB] = SH_CLK_DIV6(&sh7372_extal2_clk, SUBCKCR, 0), 383 [DIV6_SUB] = SH_CLK_DIV6(&sh7372_extal2_clk, SUBCKCR, 0),
373 [DIV6_SPU] = SH_CLK_DIV6(&pllc1_div2_clk, SPUCKCR, 0), 384 [DIV6_SPU] = SH_CLK_DIV6(&pllc1_div2_clk, SPUCKCR, 0),
374 [DIV6_VOU] = SH_CLK_DIV6(&pllc1_div2_clk, VOUCKCR, 0), 385 [DIV6_VOU] = SH_CLK_DIV6(&pllc1_div2_clk, VOUCKCR, 0),
@@ -377,24 +388,137 @@ static struct clk div6_clks[DIV6_NR] = {
377 [DIV6_DSI1P] = SH_CLK_DIV6(&pllc1_div2_clk, DSI1PCKCR, 0), 388 [DIV6_DSI1P] = SH_CLK_DIV6(&pllc1_div2_clk, DSI1PCKCR, 0),
378}; 389};
379 390
380enum { DIV6_HDMI, DIV6_REPARENT_NR }; 391enum { DIV6_HDMI, DIV6_FSIA, DIV6_FSIB, DIV6_REPARENT_NR };
381 392
382/* Indices are important - they are the actual src selecting values */ 393/* Indices are important - they are the actual src selecting values */
383static struct clk *hdmi_parent[] = { 394static struct clk *hdmi_parent[] = {
384 [0] = &pllc1_div2_clk, 395 [0] = &pllc1_div2_clk,
385 [1] = &pllc2_clk, 396 [1] = &sh7372_pllc2_clk,
386 [2] = &dv_clki_clk, 397 [2] = &sh7372_dv_clki_clk,
387 [3] = NULL, /* pllc2_div4 not implemented yet */ 398 [3] = NULL, /* pllc2_div4 not implemented yet */
388}; 399};
389 400
401static struct clk *fsiackcr_parent[] = {
402 [0] = &pllc1_div2_clk,
403 [1] = &sh7372_pllc2_clk,
404 [2] = &sh7372_fsiack_clk, /* external input for FSI A */
405 [3] = NULL, /* setting prohibited */
406};
407
408static struct clk *fsibckcr_parent[] = {
409 [0] = &pllc1_div2_clk,
410 [1] = &sh7372_pllc2_clk,
411 [2] = &sh7372_fsibck_clk, /* external input for FSI B */
412 [3] = NULL, /* setting prohibited */
413};
414
390static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = { 415static struct clk div6_reparent_clks[DIV6_REPARENT_NR] = {
391 [DIV6_HDMI] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, HDMICKCR, 0, 416 [DIV6_HDMI] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, HDMICKCR, 0,
392 hdmi_parent, ARRAY_SIZE(hdmi_parent), 6, 2), 417 hdmi_parent, ARRAY_SIZE(hdmi_parent), 6, 2),
418 [DIV6_FSIA] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, FSIACKCR, 0,
419 fsiackcr_parent, ARRAY_SIZE(fsiackcr_parent), 6, 2),
420 [DIV6_FSIB] = SH_CLK_DIV6_EXT(&pllc1_div2_clk, FSIBCKCR, 0,
421 fsibckcr_parent, ARRAY_SIZE(fsibckcr_parent), 6, 2),
422};
423
424/* FSI DIV */
425static unsigned long fsidiv_recalc(struct clk *clk)
426{
427 unsigned long value;
428
429 value = __raw_readl(clk->mapping->base);
430
431 if ((value & 0x3) != 0x3)
432 return 0;
433
434 value >>= 16;
435 if (value < 2)
436 return 0;
437
438 return clk->parent->rate / value;
439}
440
441static long fsidiv_round_rate(struct clk *clk, unsigned long rate)
442{
443 return clk_rate_div_range_round(clk, 2, 0xffff, rate);
444}
445
446static void fsidiv_disable(struct clk *clk)
447{
448 __raw_writel(0, clk->mapping->base);
449}
450
451static int fsidiv_enable(struct clk *clk)
452{
453 unsigned long value;
454
455 value = __raw_readl(clk->mapping->base) >> 16;
456 if (value < 2) {
457 fsidiv_disable(clk);
458 return -ENOENT;
459 }
460
461 __raw_writel((value << 16) | 0x3, clk->mapping->base);
462
463 return 0;
464}
465
466static int fsidiv_set_rate(struct clk *clk,
467 unsigned long rate, int algo_id)
468{
469 int idx;
470
471 if (clk->parent->rate == rate) {
472 fsidiv_disable(clk);
473 return 0;
474 }
475
476 idx = (clk->parent->rate / rate) & 0xffff;
477 if (idx < 2)
478 return -ENOENT;
479
480 __raw_writel(idx << 16, clk->mapping->base);
481 return fsidiv_enable(clk);
482}
483
484static struct clk_ops fsidiv_clk_ops = {
485 .recalc = fsidiv_recalc,
486 .round_rate = fsidiv_round_rate,
487 .set_rate = fsidiv_set_rate,
488 .enable = fsidiv_enable,
489 .disable = fsidiv_disable,
490};
491
492static struct clk_mapping sh7372_fsidiva_clk_mapping = {
493 .phys = FSIDIVA,
494 .len = 8,
495};
496
497struct clk sh7372_fsidiva_clk = {
498 .ops = &fsidiv_clk_ops,
499 .parent = &div6_reparent_clks[DIV6_FSIA], /* late install */
500 .mapping = &sh7372_fsidiva_clk_mapping,
501};
502
503static struct clk_mapping sh7372_fsidivb_clk_mapping = {
504 .phys = FSIDIVB,
505 .len = 8,
506};
507
508struct clk sh7372_fsidivb_clk = {
509 .ops = &fsidiv_clk_ops,
510 .parent = &div6_reparent_clks[DIV6_FSIB], /* late install */
511 .mapping = &sh7372_fsidivb_clk_mapping,
512};
513
514static struct clk *late_main_clks[] = {
515 &sh7372_fsidiva_clk,
516 &sh7372_fsidivb_clk,
393}; 517};
394 518
395enum { MSTP001, 519enum { MSTP001,
396 MSTP131, MSTP130, 520 MSTP131, MSTP130,
397 MSTP129, MSTP128, MSTP127, MSTP126, 521 MSTP129, MSTP128, MSTP127, MSTP126, MSTP125,
398 MSTP118, MSTP117, MSTP116, 522 MSTP118, MSTP117, MSTP116,
399 MSTP106, MSTP101, MSTP100, 523 MSTP106, MSTP101, MSTP100,
400 MSTP223, 524 MSTP223,
@@ -414,6 +538,7 @@ static struct clk mstp_clks[MSTP_NR] = {
414 [MSTP128] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 28, 0), /* VEU0 */ 538 [MSTP128] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 28, 0), /* VEU0 */
415 [MSTP127] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 27, 0), /* CEU */ 539 [MSTP127] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 27, 0), /* CEU */
416 [MSTP126] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 26, 0), /* CSI2 */ 540 [MSTP126] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 26, 0), /* CSI2 */
541 [MSTP125] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 25, 0), /* TMU0 */
417 [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX */ 542 [MSTP118] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 18, 0), /* DSITX */
418 [MSTP117] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */ 543 [MSTP117] = MSTP(&div4_clks[DIV4_B], SMSTPCR1, 17, 0), /* LCDC1 */
419 [MSTP116] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */ 544 [MSTP116] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR1, 16, 0), /* IIC0 */
@@ -429,7 +554,7 @@ static struct clk mstp_clks[MSTP_NR] = {
429 [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */ 554 [MSTP201] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 1, 0), /* SCIFA3 */
430 [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */ 555 [MSTP200] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR2, 0, 0), /* SCIFA4 */
431 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */ 556 [MSTP329] = MSTP(&r_clk, SMSTPCR3, 29, 0), /* CMT10 */
432 [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, 0), /* FSIA */ 557 [MSTP328] = MSTP(&div6_clks[DIV6_SPU], SMSTPCR3, 28, 0), /* FSI2 */
433 [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */ 558 [MSTP323] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 23, 0), /* IIC1 */
434 [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */ 559 [MSTP322] = MSTP(&div6_clks[DIV6_SUB], SMSTPCR3, 22, 0), /* USB0 */
435 [MSTP314] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */ 560 [MSTP314] = MSTP(&div4_clks[DIV4_HP], SMSTPCR3, 14, 0), /* SDHI0 */
@@ -445,10 +570,11 @@ static struct clk mstp_clks[MSTP_NR] = {
445 570
446#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk } 571#define CLKDEV_CON_ID(_id, _clk) { .con_id = _id, .clk = _clk }
447#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk } 572#define CLKDEV_DEV_ID(_id, _clk) { .dev_id = _id, .clk = _clk }
573#define CLKDEV_ICK_ID(_cid, _did, _clk) { .con_id = _cid, .dev_id = _did, .clk = _clk }
448 574
449static struct clk_lookup lookups[] = { 575static struct clk_lookup lookups[] = {
450 /* main clocks */ 576 /* main clocks */
451 CLKDEV_CON_ID("dv_clki_div2_clk", &dv_clki_div2_clk), 577 CLKDEV_CON_ID("dv_clki_div2_clk", &sh7372_dv_clki_div2_clk),
452 CLKDEV_CON_ID("r_clk", &r_clk), 578 CLKDEV_CON_ID("r_clk", &r_clk),
453 CLKDEV_CON_ID("extal1", &sh7372_extal1_clk), 579 CLKDEV_CON_ID("extal1", &sh7372_extal1_clk),
454 CLKDEV_CON_ID("extal2", &sh7372_extal2_clk), 580 CLKDEV_CON_ID("extal2", &sh7372_extal2_clk),
@@ -458,7 +584,7 @@ static struct clk_lookup lookups[] = {
458 CLKDEV_CON_ID("pllc0_clk", &pllc0_clk), 584 CLKDEV_CON_ID("pllc0_clk", &pllc0_clk),
459 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk), 585 CLKDEV_CON_ID("pllc1_clk", &pllc1_clk),
460 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk), 586 CLKDEV_CON_ID("pllc1_div2_clk", &pllc1_div2_clk),
461 CLKDEV_CON_ID("pllc2_clk", &pllc2_clk), 587 CLKDEV_CON_ID("pllc2_clk", &sh7372_pllc2_clk),
462 588
463 /* DIV4 clocks */ 589 /* DIV4 clocks */
464 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]), 590 CLKDEV_CON_ID("i_clk", &div4_clks[DIV4_I]),
@@ -483,8 +609,8 @@ static struct clk_lookup lookups[] = {
483 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]), 609 CLKDEV_CON_ID("vck3_clk", &div6_clks[DIV6_VCK3]),
484 CLKDEV_CON_ID("fmsi_clk", &div6_clks[DIV6_FMSI]), 610 CLKDEV_CON_ID("fmsi_clk", &div6_clks[DIV6_FMSI]),
485 CLKDEV_CON_ID("fmso_clk", &div6_clks[DIV6_FMSO]), 611 CLKDEV_CON_ID("fmso_clk", &div6_clks[DIV6_FMSO]),
486 CLKDEV_CON_ID("fsia_clk", &div6_clks[DIV6_FSIA]), 612 CLKDEV_CON_ID("fsia_clk", &div6_reparent_clks[DIV6_FSIA]),
487 CLKDEV_CON_ID("fsib_clk", &div6_clks[DIV6_FSIB]), 613 CLKDEV_CON_ID("fsib_clk", &div6_reparent_clks[DIV6_FSIB]),
488 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]), 614 CLKDEV_CON_ID("sub_clk", &div6_clks[DIV6_SUB]),
489 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]), 615 CLKDEV_CON_ID("spu_clk", &div6_clks[DIV6_SPU]),
490 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]), 616 CLKDEV_CON_ID("vou_clk", &div6_clks[DIV6_VOU]),
@@ -501,6 +627,8 @@ static struct clk_lookup lookups[] = {
501 CLKDEV_DEV_ID("uio_pdrv_genirq.1", &mstp_clks[MSTP128]), /* VEU0 */ 627 CLKDEV_DEV_ID("uio_pdrv_genirq.1", &mstp_clks[MSTP128]), /* VEU0 */
502 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU */ 628 CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU */
503 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2 */ 629 CLKDEV_DEV_ID("sh-mobile-csi2.0", &mstp_clks[MSTP126]), /* CSI2 */
630 CLKDEV_DEV_ID("sh_tmu.0", &mstp_clks[MSTP125]), /* TMU00 */
631 CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */
504 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */ 632 CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */
505 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */ 633 CLKDEV_DEV_ID("sh_mobile_lcdc_fb.1", &mstp_clks[MSTP117]), /* LCDC1 */
506 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */ 634 CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* IIC0 */
@@ -516,7 +644,7 @@ static struct clk_lookup lookups[] = {
516 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */ 644 CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP202]), /* SCIFA2 */
517 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */ 645 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
518 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ 646 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
519 CLKDEV_CON_ID("cmt1", &mstp_clks[MSTP329]), /* CMT10 */ 647 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
520 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI2 */ 648 CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI2 */
521 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */ 649 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */
522 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP323]), /* USB0 */ 650 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP323]), /* USB0 */
@@ -531,7 +659,10 @@ static struct clk_lookup lookups[] = {
531 CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */ 659 CLKDEV_DEV_ID("r8a66597_hcd.1", &mstp_clks[MSTP406]), /* USB1 */
532 CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */ 660 CLKDEV_DEV_ID("r8a66597_udc.1", &mstp_clks[MSTP406]), /* USB1 */
533 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */ 661 CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
534 {.con_id = "ick", .dev_id = "sh-mobile-hdmi", .clk = &div6_reparent_clks[DIV6_HDMI]}, 662
663 CLKDEV_ICK_ID("ick", "sh-mobile-hdmi", &div6_reparent_clks[DIV6_HDMI]),
664 CLKDEV_ICK_ID("icka", "sh_fsi2", &div6_reparent_clks[DIV6_FSIA]),
665 CLKDEV_ICK_ID("ickb", "sh_fsi2", &div6_reparent_clks[DIV6_FSIB]),
535}; 666};
536 667
537void __init sh7372_clock_init(void) 668void __init sh7372_clock_init(void)
@@ -548,11 +679,14 @@ void __init sh7372_clock_init(void)
548 ret = sh_clk_div6_register(div6_clks, DIV6_NR); 679 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
549 680
550 if (!ret) 681 if (!ret)
551 ret = sh_clk_div6_reparent_register(div6_reparent_clks, DIV6_NR); 682 ret = sh_clk_div6_reparent_register(div6_reparent_clks, DIV6_REPARENT_NR);
552 683
553 if (!ret) 684 if (!ret)
554 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR); 685 ret = sh_clk_mstp32_register(mstp_clks, MSTP_NR);
555 686
687 for (k = 0; !ret && (k < ARRAY_SIZE(late_main_clks)); k++)
688 ret = clk_register(late_main_clks[k]);
689
556 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 690 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
557 691
558 if (!ret) 692 if (!ret)
diff --git a/arch/arm/mach-shmobile/clock-sh7377.c b/arch/arm/mach-shmobile/clock-sh7377.c
index e007c28cf0a8..f91395aeb9ab 100644
--- a/arch/arm/mach-shmobile/clock-sh7377.c
+++ b/arch/arm/mach-shmobile/clock-sh7377.c
@@ -333,7 +333,7 @@ static struct clk_lookup lookups[] = {
333 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */ 333 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP201]), /* SCIFA3 */
334 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */ 334 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP200]), /* SCIFA4 */
335 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */ 335 CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP331]), /* SCIFA6 */
336 CLKDEV_CON_ID("cmt1", &mstp_clks[MSTP329]), /* CMT10 */ 336 CLKDEV_DEV_ID("sh_cmt.10", &mstp_clks[MSTP329]), /* CMT10 */
337 CLKDEV_DEV_ID("sh_irda", &mstp_clks[MSTP325]), /* IRDA */ 337 CLKDEV_DEV_ID("sh_irda", &mstp_clks[MSTP325]), /* IRDA */
338 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */ 338 CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* IIC1 */
339 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USBHS */ 339 CLKDEV_DEV_ID("r8a66597_hcd.0", &mstp_clks[MSTP322]), /* USBHS */
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
index 5bc6bd444d72..2b1bb9e43dda 100644
--- a/arch/arm/mach-shmobile/include/mach/gpio.h
+++ b/arch/arm/mach-shmobile/include/mach/gpio.h
@@ -35,12 +35,12 @@ static inline int gpio_cansleep(unsigned gpio)
35 35
36static inline int gpio_to_irq(unsigned gpio) 36static inline int gpio_to_irq(unsigned gpio)
37{ 37{
38 return -ENOSYS; 38 return __gpio_to_irq(gpio);
39} 39}
40 40
41static inline int irq_to_gpio(unsigned int irq) 41static inline int irq_to_gpio(unsigned int irq)
42{ 42{
43 return -EINVAL; 43 return -ENOSYS;
44} 44}
45 45
46#endif /* CONFIG_GPIOLIB */ 46#endif /* CONFIG_GPIOLIB */
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index 33e9700ded7e..e4f9004e7103 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -457,8 +457,14 @@ enum {
457 SHDMA_SLAVE_SDHI2_TX, 457 SHDMA_SLAVE_SDHI2_TX,
458}; 458};
459 459
460extern struct clk dv_clki_clk; 460extern struct clk sh7372_extal1_clk;
461extern struct clk dv_clki_div2_clk; 461extern struct clk sh7372_extal2_clk;
462extern struct clk pllc2_clk; 462extern struct clk sh7372_dv_clki_clk;
463extern struct clk sh7372_dv_clki_div2_clk;
464extern struct clk sh7372_pllc2_clk;
465extern struct clk sh7372_fsiack_clk;
466extern struct clk sh7372_fsibck_clk;
467extern struct clk sh7372_fsidiva_clk;
468extern struct clk sh7372_fsidivb_clk;
463 469
464#endif /* __ASM_SH7372_H__ */ 470#endif /* __ASM_SH7372_H__ */
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index e3551b56cd03..30b2f400666a 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -98,7 +98,7 @@ static struct intc_vect intca_vectors[] __initdata = {
98 INTC_VECT(IRQ14A, 0x03c0), INTC_VECT(IRQ15A, 0x03e0), 98 INTC_VECT(IRQ14A, 0x03c0), INTC_VECT(IRQ15A, 0x03e0),
99 INTC_VECT(IRQ16A, 0x3200), INTC_VECT(IRQ17A, 0x3220), 99 INTC_VECT(IRQ16A, 0x3200), INTC_VECT(IRQ17A, 0x3220),
100 INTC_VECT(IRQ18A, 0x3240), INTC_VECT(IRQ19A, 0x3260), 100 INTC_VECT(IRQ18A, 0x3240), INTC_VECT(IRQ19A, 0x3260),
101 INTC_VECT(IRQ20A, 0x3280), INTC_VECT(IRQ31A, 0x32a0), 101 INTC_VECT(IRQ20A, 0x3280), INTC_VECT(IRQ21A, 0x32a0),
102 INTC_VECT(IRQ22A, 0x32c0), INTC_VECT(IRQ23A, 0x32e0), 102 INTC_VECT(IRQ22A, 0x32c0), INTC_VECT(IRQ23A, 0x32e0),
103 INTC_VECT(IRQ24A, 0x3300), INTC_VECT(IRQ25A, 0x3320), 103 INTC_VECT(IRQ24A, 0x3300), INTC_VECT(IRQ25A, 0x3320),
104 INTC_VECT(IRQ26A, 0x3340), INTC_VECT(IRQ27A, 0x3360), 104 INTC_VECT(IRQ26A, 0x3340), INTC_VECT(IRQ27A, 0x3360),
@@ -369,9 +369,13 @@ enum {
369 INTCS, 369 INTCS,
370 370
371 /* interrupt sources INTCS */ 371 /* interrupt sources INTCS */
372
373 /* IRQ0S - IRQ31S */
372 VEU_VEU0, VEU_VEU1, VEU_VEU2, VEU_VEU3, 374 VEU_VEU0, VEU_VEU1, VEU_VEU2, VEU_VEU3,
373 RTDMAC_1_DEI0, RTDMAC_1_DEI1, RTDMAC_1_DEI2, RTDMAC_1_DEI3, 375 RTDMAC_1_DEI0, RTDMAC_1_DEI1, RTDMAC_1_DEI2, RTDMAC_1_DEI3,
374 CEU, BEU_BEU0, BEU_BEU1, BEU_BEU2, 376 CEU, BEU_BEU0, BEU_BEU1, BEU_BEU2,
377 /* MFI */
378 /* BBIF2 */
375 VPU, 379 VPU,
376 TSIF1, 380 TSIF1,
377 _3DG_SGX530, 381 _3DG_SGX530,
@@ -379,13 +383,17 @@ enum {
379 IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2, 383 IIC2_ALI2, IIC2_TACKI2, IIC2_WAITI2, IIC2_DTEI2,
380 IPMMU_IPMMUR, IPMMU_IPMMUR2, 384 IPMMU_IPMMUR, IPMMU_IPMMUR2,
381 RTDMAC_2_DEI4, RTDMAC_2_DEI5, RTDMAC_2_DADERR, 385 RTDMAC_2_DEI4, RTDMAC_2_DEI5, RTDMAC_2_DADERR,
386 /* KEYSC */
387 /* TTI20 */
382 MSIOF, 388 MSIOF,
383 IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0, 389 IIC0_ALI0, IIC0_TACKI0, IIC0_WAITI0, IIC0_DTEI0,
384 TMU_TUNI0, TMU_TUNI1, TMU_TUNI2, 390 TMU_TUNI0, TMU_TUNI1, TMU_TUNI2,
385 CMT0, 391 CMT0,
386 TSIF0, 392 TSIF0,
393 /* CMT2 */
387 LMB, 394 LMB,
388 CTI, 395 CTI,
396 /* RWDT0 */
389 ICB, 397 ICB,
390 JPU_JPEG, 398 JPU_JPEG,
391 LCDC, 399 LCDC,
@@ -397,11 +405,17 @@ enum {
397 CSIRX, 405 CSIRX,
398 DSITX_DSITX0, 406 DSITX_DSITX0,
399 DSITX_DSITX1, 407 DSITX_DSITX1,
408 /* SPU2 */
409 /* FSI */
410 /* FMSI */
411 /* HDMI */
400 TMU1_TUNI0, TMU1_TUNI1, TMU1_TUNI2, 412 TMU1_TUNI0, TMU1_TUNI1, TMU1_TUNI2,
401 CMT4, 413 CMT4,
402 DSITX1_DSITX1_0, 414 DSITX1_DSITX1_0,
403 DSITX1_DSITX1_1, 415 DSITX1_DSITX1_1,
416 /* MFIS2 */
404 CPORTS2R, 417 CPORTS2R,
418 /* CEC */
405 JPU6E, 419 JPU6E,
406 420
407 /* interrupt groups INTCS */ 421 /* interrupt groups INTCS */
@@ -410,12 +424,15 @@ enum {
410}; 424};
411 425
412static struct intc_vect intcs_vectors[] = { 426static struct intc_vect intcs_vectors[] = {
427 /* IRQ0S - IRQ31S */
413 INTCS_VECT(VEU_VEU0, 0x700), INTCS_VECT(VEU_VEU1, 0x720), 428 INTCS_VECT(VEU_VEU0, 0x700), INTCS_VECT(VEU_VEU1, 0x720),
414 INTCS_VECT(VEU_VEU2, 0x740), INTCS_VECT(VEU_VEU3, 0x760), 429 INTCS_VECT(VEU_VEU2, 0x740), INTCS_VECT(VEU_VEU3, 0x760),
415 INTCS_VECT(RTDMAC_1_DEI0, 0x800), INTCS_VECT(RTDMAC_1_DEI1, 0x820), 430 INTCS_VECT(RTDMAC_1_DEI0, 0x800), INTCS_VECT(RTDMAC_1_DEI1, 0x820),
416 INTCS_VECT(RTDMAC_1_DEI2, 0x840), INTCS_VECT(RTDMAC_1_DEI3, 0x860), 431 INTCS_VECT(RTDMAC_1_DEI2, 0x840), INTCS_VECT(RTDMAC_1_DEI3, 0x860),
417 INTCS_VECT(CEU, 0x880), INTCS_VECT(BEU_BEU0, 0x8a0), 432 INTCS_VECT(CEU, 0x880), INTCS_VECT(BEU_BEU0, 0x8a0),
418 INTCS_VECT(BEU_BEU1, 0x8c0), INTCS_VECT(BEU_BEU2, 0x8e0), 433 INTCS_VECT(BEU_BEU1, 0x8c0), INTCS_VECT(BEU_BEU2, 0x8e0),
434 /* MFI */
435 /* BBIF2 */
419 INTCS_VECT(VPU, 0x980), 436 INTCS_VECT(VPU, 0x980),
420 INTCS_VECT(TSIF1, 0x9a0), 437 INTCS_VECT(TSIF1, 0x9a0),
421 INTCS_VECT(_3DG_SGX530, 0x9e0), 438 INTCS_VECT(_3DG_SGX530, 0x9e0),
@@ -425,14 +442,19 @@ static struct intc_vect intcs_vectors[] = {
425 INTCS_VECT(IPMMU_IPMMUR, 0xb00), INTCS_VECT(IPMMU_IPMMUR2, 0xb20), 442 INTCS_VECT(IPMMU_IPMMUR, 0xb00), INTCS_VECT(IPMMU_IPMMUR2, 0xb20),
426 INTCS_VECT(RTDMAC_2_DEI4, 0xb80), INTCS_VECT(RTDMAC_2_DEI5, 0xba0), 443 INTCS_VECT(RTDMAC_2_DEI4, 0xb80), INTCS_VECT(RTDMAC_2_DEI5, 0xba0),
427 INTCS_VECT(RTDMAC_2_DADERR, 0xbc0), 444 INTCS_VECT(RTDMAC_2_DADERR, 0xbc0),
445 /* KEYSC */
446 /* TTI20 */
447 INTCS_VECT(MSIOF, 0x0d20),
428 INTCS_VECT(IIC0_ALI0, 0xe00), INTCS_VECT(IIC0_TACKI0, 0xe20), 448 INTCS_VECT(IIC0_ALI0, 0xe00), INTCS_VECT(IIC0_TACKI0, 0xe20),
429 INTCS_VECT(IIC0_WAITI0, 0xe40), INTCS_VECT(IIC0_DTEI0, 0xe60), 449 INTCS_VECT(IIC0_WAITI0, 0xe40), INTCS_VECT(IIC0_DTEI0, 0xe60),
430 INTCS_VECT(TMU_TUNI0, 0xe80), INTCS_VECT(TMU_TUNI1, 0xea0), 450 INTCS_VECT(TMU_TUNI0, 0xe80), INTCS_VECT(TMU_TUNI1, 0xea0),
431 INTCS_VECT(TMU_TUNI2, 0xec0), 451 INTCS_VECT(TMU_TUNI2, 0xec0),
432 INTCS_VECT(CMT0, 0xf00), 452 INTCS_VECT(CMT0, 0xf00),
433 INTCS_VECT(TSIF0, 0xf20), 453 INTCS_VECT(TSIF0, 0xf20),
454 /* CMT2 */
434 INTCS_VECT(LMB, 0xf60), 455 INTCS_VECT(LMB, 0xf60),
435 INTCS_VECT(CTI, 0x400), 456 INTCS_VECT(CTI, 0x400),
457 /* RWDT0 */
436 INTCS_VECT(ICB, 0x480), 458 INTCS_VECT(ICB, 0x480),
437 INTCS_VECT(JPU_JPEG, 0x560), 459 INTCS_VECT(JPU_JPEG, 0x560),
438 INTCS_VECT(LCDC, 0x580), 460 INTCS_VECT(LCDC, 0x580),
@@ -446,12 +468,18 @@ static struct intc_vect intcs_vectors[] = {
446 INTCS_VECT(CSIRX, 0x17a0), 468 INTCS_VECT(CSIRX, 0x17a0),
447 INTCS_VECT(DSITX_DSITX0, 0x17c0), 469 INTCS_VECT(DSITX_DSITX0, 0x17c0),
448 INTCS_VECT(DSITX_DSITX1, 0x17e0), 470 INTCS_VECT(DSITX_DSITX1, 0x17e0),
471 /* SPU2 */
472 /* FSI */
473 /* FMSI */
474 /* HDMI */
449 INTCS_VECT(TMU1_TUNI0, 0x1900), INTCS_VECT(TMU1_TUNI1, 0x1920), 475 INTCS_VECT(TMU1_TUNI0, 0x1900), INTCS_VECT(TMU1_TUNI1, 0x1920),
450 INTCS_VECT(TMU1_TUNI2, 0x1940), 476 INTCS_VECT(TMU1_TUNI2, 0x1940),
451 INTCS_VECT(CMT4, 0x1980), 477 INTCS_VECT(CMT4, 0x1980),
452 INTCS_VECT(DSITX1_DSITX1_0, 0x19a0), 478 INTCS_VECT(DSITX1_DSITX1_0, 0x19a0),
453 INTCS_VECT(DSITX1_DSITX1_1, 0x19c0), 479 INTCS_VECT(DSITX1_DSITX1_1, 0x19c0),
480 /* MFIS2 */
454 INTCS_VECT(CPORTS2R, 0x1a20), 481 INTCS_VECT(CPORTS2R, 0x1a20),
482 /* CEC */
455 INTCS_VECT(JPU6E, 0x1a80), 483 INTCS_VECT(JPU6E, 0x1a80),
456 484
457 INTC_VECT(INTCS, 0xf80), 485 INTC_VECT(INTCS, 0xf80),
diff --git a/arch/arm/mach-shmobile/pfc-sh7372.c b/arch/arm/mach-shmobile/pfc-sh7372.c
index ec420353f8e3..9c265dae138a 100644
--- a/arch/arm/mach-shmobile/pfc-sh7372.c
+++ b/arch/arm/mach-shmobile/pfc-sh7372.c
@@ -166,12 +166,12 @@ enum {
166 MSIOF2_TSYNC_MARK, MSIOF2_TSCK_MARK, MSIOF2_RXD_MARK, 166 MSIOF2_TSYNC_MARK, MSIOF2_TSCK_MARK, MSIOF2_RXD_MARK,
167 MSIOF2_TXD_MARK, 167 MSIOF2_TXD_MARK,
168 168
169 /* MSIOF3 */ 169 /* BBIF1 */
170 BBIF1_RXD_MARK, BBIF1_TSYNC_MARK, BBIF1_TSCK_MARK, 170 BBIF1_RXD_MARK, BBIF1_TSYNC_MARK, BBIF1_TSCK_MARK,
171 BBIF1_TXD_MARK, BBIF1_RSCK_MARK, BBIF1_RSYNC_MARK, 171 BBIF1_TXD_MARK, BBIF1_RSCK_MARK, BBIF1_RSYNC_MARK,
172 BBIF1_FLOW_MARK, BB_RX_FLOW_N_MARK, 172 BBIF1_FLOW_MARK, BB_RX_FLOW_N_MARK,
173 173
174 /* MSIOF4 */ 174 /* BBIF2 */
175 BBIF2_TSCK1_MARK, BBIF2_TSYNC1_MARK, 175 BBIF2_TSCK1_MARK, BBIF2_TSYNC1_MARK,
176 BBIF2_TXD1_MARK, BBIF2_RXD_MARK, 176 BBIF2_TXD1_MARK, BBIF2_RXD_MARK,
177 177
@@ -976,12 +976,12 @@ static struct pinmux_gpio pinmux_gpios[] = {
976 GPIO_FN(MSIOF2_TSYNC), GPIO_FN(MSIOF2_TSCK), GPIO_FN(MSIOF2_RXD), 976 GPIO_FN(MSIOF2_TSYNC), GPIO_FN(MSIOF2_TSCK), GPIO_FN(MSIOF2_RXD),
977 GPIO_FN(MSIOF2_TXD), 977 GPIO_FN(MSIOF2_TXD),
978 978
979 /* MSIOF3 */ 979 /* BBIF1 */
980 GPIO_FN(BBIF1_RXD), GPIO_FN(BBIF1_TSYNC), GPIO_FN(BBIF1_TSCK), 980 GPIO_FN(BBIF1_RXD), GPIO_FN(BBIF1_TSYNC), GPIO_FN(BBIF1_TSCK),
981 GPIO_FN(BBIF1_TXD), GPIO_FN(BBIF1_RSCK), GPIO_FN(BBIF1_RSYNC), 981 GPIO_FN(BBIF1_TXD), GPIO_FN(BBIF1_RSCK), GPIO_FN(BBIF1_RSYNC),
982 GPIO_FN(BBIF1_FLOW), GPIO_FN(BB_RX_FLOW_N), 982 GPIO_FN(BBIF1_FLOW), GPIO_FN(BB_RX_FLOW_N),
983 983
984 /* MSIOF4 */ 984 /* BBIF2 */
985 GPIO_FN(BBIF2_TSCK1), GPIO_FN(BBIF2_TSYNC1), 985 GPIO_FN(BBIF2_TSCK1), GPIO_FN(BBIF2_TSYNC1),
986 GPIO_FN(BBIF2_TXD1), GPIO_FN(BBIF2_RXD), 986 GPIO_FN(BBIF2_TXD1), GPIO_FN(BBIF2_RXD),
987 987
diff --git a/arch/arm/mach-shmobile/setup-sh7367.c b/arch/arm/mach-shmobile/setup-sh7367.c
index 3148c11a550e..003008c18360 100644
--- a/arch/arm/mach-shmobile/setup-sh7367.c
+++ b/arch/arm/mach-shmobile/setup-sh7367.c
@@ -154,7 +154,6 @@ static struct sh_timer_config cmt10_platform_data = {
154 .name = "CMT10", 154 .name = "CMT10",
155 .channel_offset = 0x10, 155 .channel_offset = 0x10,
156 .timer_bit = 0, 156 .timer_bit = 0,
157 .clk = "r_clk",
158 .clockevent_rating = 125, 157 .clockevent_rating = 125,
159 .clocksource_rating = 125, 158 .clocksource_rating = 125,
160}; 159};
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index e26686c9d0b6..564a6d0be473 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -158,7 +158,6 @@ static struct sh_timer_config cmt10_platform_data = {
158 .name = "CMT10", 158 .name = "CMT10",
159 .channel_offset = 0x10, 159 .channel_offset = 0x10,
160 .timer_bit = 0, 160 .timer_bit = 0,
161 .clk = "cmt1",
162 .clockevent_rating = 125, 161 .clockevent_rating = 125,
163 .clocksource_rating = 125, 162 .clocksource_rating = 125,
164}; 163};
@@ -186,6 +185,67 @@ static struct platform_device cmt10_device = {
186 .num_resources = ARRAY_SIZE(cmt10_resources), 185 .num_resources = ARRAY_SIZE(cmt10_resources),
187}; 186};
188 187
188/* TMU */
189static struct sh_timer_config tmu00_platform_data = {
190 .name = "TMU00",
191 .channel_offset = 0x4,
192 .timer_bit = 0,
193 .clockevent_rating = 200,
194};
195
196static struct resource tmu00_resources[] = {
197 [0] = {
198 .name = "TMU00",
199 .start = 0xfff60008,
200 .end = 0xfff60013,
201 .flags = IORESOURCE_MEM,
202 },
203 [1] = {
204 .start = intcs_evt2irq(0xe80), /* TMU_TUNI0 */
205 .flags = IORESOURCE_IRQ,
206 },
207};
208
209static struct platform_device tmu00_device = {
210 .name = "sh_tmu",
211 .id = 0,
212 .dev = {
213 .platform_data = &tmu00_platform_data,
214 },
215 .resource = tmu00_resources,
216 .num_resources = ARRAY_SIZE(tmu00_resources),
217};
218
219static struct sh_timer_config tmu01_platform_data = {
220 .name = "TMU01",
221 .channel_offset = 0x10,
222 .timer_bit = 1,
223 .clocksource_rating = 200,
224};
225
226static struct resource tmu01_resources[] = {
227 [0] = {
228 .name = "TMU01",
229 .start = 0xfff60014,
230 .end = 0xfff6001f,
231 .flags = IORESOURCE_MEM,
232 },
233 [1] = {
234 .start = intcs_evt2irq(0xea0), /* TMU_TUNI1 */
235 .flags = IORESOURCE_IRQ,
236 },
237};
238
239static struct platform_device tmu01_device = {
240 .name = "sh_tmu",
241 .id = 1,
242 .dev = {
243 .platform_data = &tmu01_platform_data,
244 },
245 .resource = tmu01_resources,
246 .num_resources = ARRAY_SIZE(tmu01_resources),
247};
248
189/* I2C */ 249/* I2C */
190static struct resource iic0_resources[] = { 250static struct resource iic0_resources[] = {
191 [0] = { 251 [0] = {
@@ -419,14 +479,14 @@ static struct resource sh7372_dmae0_resources[] = {
419 }, 479 },
420 { 480 {
421 /* DMA error IRQ */ 481 /* DMA error IRQ */
422 .start = 246, 482 .start = evt2irq(0x20c0),
423 .end = 246, 483 .end = evt2irq(0x20c0),
424 .flags = IORESOURCE_IRQ, 484 .flags = IORESOURCE_IRQ,
425 }, 485 },
426 { 486 {
427 /* IRQ for channels 0-5 */ 487 /* IRQ for channels 0-5 */
428 .start = 240, 488 .start = evt2irq(0x2000),
429 .end = 245, 489 .end = evt2irq(0x20a0),
430 .flags = IORESOURCE_IRQ, 490 .flags = IORESOURCE_IRQ,
431 }, 491 },
432}; 492};
@@ -447,14 +507,14 @@ static struct resource sh7372_dmae1_resources[] = {
447 }, 507 },
448 { 508 {
449 /* DMA error IRQ */ 509 /* DMA error IRQ */
450 .start = 254, 510 .start = evt2irq(0x21c0),
451 .end = 254, 511 .end = evt2irq(0x21c0),
452 .flags = IORESOURCE_IRQ, 512 .flags = IORESOURCE_IRQ,
453 }, 513 },
454 { 514 {
455 /* IRQ for channels 0-5 */ 515 /* IRQ for channels 0-5 */
456 .start = 248, 516 .start = evt2irq(0x2100),
457 .end = 253, 517 .end = evt2irq(0x21a0),
458 .flags = IORESOURCE_IRQ, 518 .flags = IORESOURCE_IRQ,
459 }, 519 },
460}; 520};
@@ -475,14 +535,14 @@ static struct resource sh7372_dmae2_resources[] = {
475 }, 535 },
476 { 536 {
477 /* DMA error IRQ */ 537 /* DMA error IRQ */
478 .start = 262, 538 .start = evt2irq(0x22c0),
479 .end = 262, 539 .end = evt2irq(0x22c0),
480 .flags = IORESOURCE_IRQ, 540 .flags = IORESOURCE_IRQ,
481 }, 541 },
482 { 542 {
483 /* IRQ for channels 0-5 */ 543 /* IRQ for channels 0-5 */
484 .start = 256, 544 .start = evt2irq(0x2200),
485 .end = 261, 545 .end = evt2irq(0x22a0),
486 .flags = IORESOURCE_IRQ, 546 .flags = IORESOURCE_IRQ,
487 }, 547 },
488}; 548};
@@ -526,6 +586,11 @@ static struct platform_device *sh7372_early_devices[] __initdata = {
526 &scif5_device, 586 &scif5_device,
527 &scif6_device, 587 &scif6_device,
528 &cmt10_device, 588 &cmt10_device,
589 &tmu00_device,
590 &tmu01_device,
591};
592
593static struct platform_device *sh7372_late_devices[] __initdata = {
529 &iic0_device, 594 &iic0_device,
530 &iic1_device, 595 &iic1_device,
531 &dma0_device, 596 &dma0_device,
@@ -537,6 +602,9 @@ void __init sh7372_add_standard_devices(void)
537{ 602{
538 platform_add_devices(sh7372_early_devices, 603 platform_add_devices(sh7372_early_devices,
539 ARRAY_SIZE(sh7372_early_devices)); 604 ARRAY_SIZE(sh7372_early_devices));
605
606 platform_add_devices(sh7372_late_devices,
607 ARRAY_SIZE(sh7372_late_devices));
540} 608}
541 609
542void __init sh7372_add_early_devices(void) 610void __init sh7372_add_early_devices(void)
diff --git a/arch/arm/mach-shmobile/setup-sh7377.c b/arch/arm/mach-shmobile/setup-sh7377.c
index bb4adf17dbf4..575dbd6c2f1d 100644
--- a/arch/arm/mach-shmobile/setup-sh7377.c
+++ b/arch/arm/mach-shmobile/setup-sh7377.c
@@ -172,7 +172,6 @@ static struct sh_timer_config cmt10_platform_data = {
172 .name = "CMT10", 172 .name = "CMT10",
173 .channel_offset = 0x10, 173 .channel_offset = 0x10,
174 .timer_bit = 0, 174 .timer_bit = 0,
175 .clk = "r_clk",
176 .clockevent_rating = 125, 175 .clockevent_rating = 125,
177 .clocksource_rating = 125, 176 .clocksource_rating = 125,
178}; 177};
diff --git a/arch/arm/mach-u300/clock.c b/arch/arm/mach-u300/clock.c
index 60acf9e708ae..7458fc6df5c6 100644
--- a/arch/arm/mach-u300/clock.c
+++ b/arch/arm/mach-u300/clock.c
@@ -66,7 +66,7 @@ static DEFINE_SPINLOCK(syscon_resetreg_lock);
66 * AMBA bus 66 * AMBA bus
67 * | 67 * |
68 * +- CPU 68 * +- CPU
69 * +- NANDIF NAND Flash interface 69 * +- FSMC NANDIF NAND Flash interface
70 * +- SEMI Shared Memory interface 70 * +- SEMI Shared Memory interface
71 * +- ISP Image Signal Processor (U335 only) 71 * +- ISP Image Signal Processor (U335 only)
72 * +- CDS (U335 only) 72 * +- CDS (U335 only)
@@ -726,7 +726,7 @@ static struct clk cpu_clk = {
726}; 726};
727 727
728static struct clk nandif_clk = { 728static struct clk nandif_clk = {
729 .name = "NANDIF", 729 .name = "FSMC",
730 .parent = &amba_clk, 730 .parent = &amba_clk,
731 .hw_ctrld = false, 731 .hw_ctrld = false,
732 .reset = true, 732 .reset = true,
@@ -1259,7 +1259,7 @@ static struct clk_lookup lookups[] = {
1259 /* Connected directly to the AMBA bus */ 1259 /* Connected directly to the AMBA bus */
1260 DEF_LOOKUP("amba", &amba_clk), 1260 DEF_LOOKUP("amba", &amba_clk),
1261 DEF_LOOKUP("cpu", &cpu_clk), 1261 DEF_LOOKUP("cpu", &cpu_clk),
1262 DEF_LOOKUP("fsmc", &nandif_clk), 1262 DEF_LOOKUP("fsmc-nand", &nandif_clk),
1263 DEF_LOOKUP("semi", &semi_clk), 1263 DEF_LOOKUP("semi", &semi_clk),
1264#ifdef CONFIG_MACH_U300_BS335 1264#ifdef CONFIG_MACH_U300_BS335
1265 DEF_LOOKUP("isp", &isp_clk), 1265 DEF_LOOKUP("isp", &isp_clk),
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index ea41c236be0f..aa53ee22438f 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -21,7 +21,8 @@
21#include <linux/gpio.h> 21#include <linux/gpio.h>
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <mach/coh901318.h> 24#include <linux/mtd/nand.h>
25#include <linux/mtd/fsmc.h>
25 26
26#include <asm/types.h> 27#include <asm/types.h>
27#include <asm/setup.h> 28#include <asm/setup.h>
@@ -30,6 +31,7 @@
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
32 33
34#include <mach/coh901318.h>
33#include <mach/hardware.h> 35#include <mach/hardware.h>
34#include <mach/syscon.h> 36#include <mach/syscon.h>
35#include <mach/dma_channels.h> 37#include <mach/dma_channels.h>
@@ -285,6 +287,13 @@ static struct resource rtc_resources[] = {
285 */ 287 */
286static struct resource fsmc_resources[] = { 288static struct resource fsmc_resources[] = {
287 { 289 {
290 .name = "nand_data",
291 .start = U300_NAND_CS0_PHYS_BASE,
292 .end = U300_NAND_CS0_PHYS_BASE + SZ_16K - 1,
293 .flags = IORESOURCE_MEM,
294 },
295 {
296 .name = "fsmc_regs",
288 .start = U300_NAND_IF_PHYS_BASE, 297 .start = U300_NAND_IF_PHYS_BASE,
289 .end = U300_NAND_IF_PHYS_BASE + SZ_4K - 1, 298 .end = U300_NAND_IF_PHYS_BASE + SZ_4K - 1,
290 .flags = IORESOURCE_MEM, 299 .flags = IORESOURCE_MEM,
@@ -1429,11 +1438,39 @@ static struct platform_device rtc_device = {
1429 .resource = rtc_resources, 1438 .resource = rtc_resources,
1430}; 1439};
1431 1440
1432static struct platform_device fsmc_device = { 1441static struct mtd_partition u300_partitions[] = {
1433 .name = "nandif", 1442 {
1443 .name = "bootrecords",
1444 .offset = 0,
1445 .size = SZ_128K,
1446 },
1447 {
1448 .name = "free",
1449 .offset = SZ_128K,
1450 .size = 8064 * SZ_1K,
1451 },
1452 {
1453 .name = "platform",
1454 .offset = 8192 * SZ_1K,
1455 .size = 253952 * SZ_1K,
1456 },
1457};
1458
1459static struct fsmc_nand_platform_data nand_platform_data = {
1460 .partitions = u300_partitions,
1461 .nr_partitions = ARRAY_SIZE(u300_partitions),
1462 .options = NAND_SKIP_BBTSCAN,
1463 .width = FSMC_NAND_BW8,
1464};
1465
1466static struct platform_device nand_device = {
1467 .name = "fsmc-nand",
1434 .id = -1, 1468 .id = -1,
1435 .num_resources = ARRAY_SIZE(fsmc_resources),
1436 .resource = fsmc_resources, 1469 .resource = fsmc_resources,
1470 .num_resources = ARRAY_SIZE(fsmc_resources),
1471 .dev = {
1472 .platform_data = &nand_platform_data,
1473 },
1437}; 1474};
1438 1475
1439static struct platform_device ave_device = { 1476static struct platform_device ave_device = {
@@ -1465,7 +1502,7 @@ static struct platform_device *platform_devs[] __initdata = {
1465 &keypad_device, 1502 &keypad_device,
1466 &rtc_device, 1503 &rtc_device,
1467 &gpio_device, 1504 &gpio_device,
1468 &fsmc_device, 1505 &nand_device,
1469 &wdog_device, 1506 &wdog_device,
1470 &ave_device 1507 &ave_device
1471}; 1508};
diff --git a/arch/arm/mach-u300/include/mach/u300-regs.h b/arch/arm/mach-u300/include/mach/u300-regs.h
index 56721a0cd2af..8b85df4c8d8f 100644
--- a/arch/arm/mach-u300/include/mach/u300-regs.h
+++ b/arch/arm/mach-u300/include/mach/u300-regs.h
@@ -20,11 +20,9 @@
20 20
21/* NAND Flash CS0 */ 21/* NAND Flash CS0 */
22#define U300_NAND_CS0_PHYS_BASE 0x80000000 22#define U300_NAND_CS0_PHYS_BASE 0x80000000
23#define U300_NAND_CS0_VIRT_BASE 0xff040000
24 23
25/* NFIF */ 24/* NFIF */
26#define U300_NAND_IF_PHYS_BASE 0x9f800000 25#define U300_NAND_IF_PHYS_BASE 0x9f800000
27#define U300_NAND_IF_VIRT_BASE 0xff030000
28 26
29/* AHB Peripherals */ 27/* AHB Peripherals */
30#define U300_AHB_PER_PHYS_BASE 0xa0000000 28#define U300_AHB_PER_PHYS_BASE 0xa0000000
diff --git a/arch/arm/mach-u300/spi.c b/arch/arm/mach-u300/spi.c
index edb2c0d255c2..00869def5420 100644
--- a/arch/arm/mach-u300/spi.c
+++ b/arch/arm/mach-u300/spi.c
@@ -67,7 +67,7 @@ static struct spi_board_info u300_spi_devices[] = {
67 .bus_num = 0, /* Only one bus on this chip */ 67 .bus_num = 0, /* Only one bus on this chip */
68 .chip_select = 0, 68 .chip_select = 0,
69 /* Means SPI_CS_HIGH, change if e.g low CS */ 69 /* Means SPI_CS_HIGH, change if e.g low CS */
70 .mode = SPI_MODE_1 | SPI_LSB_FIRST | SPI_LOOP, 70 .mode = SPI_MODE_1 | SPI_LOOP,
71 }, 71 },
72#endif 72#endif
73}; 73};
diff --git a/arch/arm/mach-ux500/cpu.c b/arch/arm/mach-ux500/cpu.c
index e0fd747e447a..73fb1a551ec6 100644
--- a/arch/arm/mach-ux500/cpu.c
+++ b/arch/arm/mach-ux500/cpu.c
@@ -10,6 +10,7 @@
10#include <linux/io.h> 10#include <linux/io.h>
11#include <linux/clk.h> 11#include <linux/clk.h>
12 12
13#include <asm/cacheflush.h>
13#include <asm/hardware/cache-l2x0.h> 14#include <asm/hardware/cache-l2x0.h>
14#include <asm/hardware/gic.h> 15#include <asm/hardware/gic.h>
15#include <asm/mach/map.h> 16#include <asm/mach/map.h>
@@ -71,6 +72,46 @@ void __init ux500_init_irq(void)
71} 72}
72 73
73#ifdef CONFIG_CACHE_L2X0 74#ifdef CONFIG_CACHE_L2X0
75static inline void ux500_cache_wait(void __iomem *reg, unsigned long mask)
76{
77 /* wait for the operation to complete */
78 while (readl(reg) & mask)
79 ;
80}
81
82static inline void ux500_cache_sync(void)
83{
84 void __iomem *base = __io_address(UX500_L2CC_BASE);
85 writel(0, base + L2X0_CACHE_SYNC);
86 ux500_cache_wait(base + L2X0_CACHE_SYNC, 1);
87}
88
89/*
90 * The L2 cache cannot be turned off in the non-secure world.
91 * Dummy until a secure service is in place.
92 */
93static void ux500_l2x0_disable(void)
94{
95}
96
97/*
98 * This is only called when doing a kexec, just after turning off the L2
99 * and L1 cache, and it is surrounded by a spinlock in the generic version.
100 * However, we're not really turning off the L2 cache right now and the
101 * PL310 does not support exclusive accesses (used to implement the spinlock).
102 * So, the invalidation needs to be done without the spinlock.
103 */
104static void ux500_l2x0_inv_all(void)
105{
106 void __iomem *l2x0_base = __io_address(UX500_L2CC_BASE);
107 uint32_t l2x0_way_mask = (1<<16) - 1; /* Bitmask of active ways */
108
109 /* invalidate all ways */
110 writel(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
111 ux500_cache_wait(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
112 ux500_cache_sync();
113}
114
74static int ux500_l2x0_init(void) 115static int ux500_l2x0_init(void)
75{ 116{
76 void __iomem *l2x0_base; 117 void __iomem *l2x0_base;
@@ -80,6 +121,10 @@ static int ux500_l2x0_init(void)
80 /* 64KB way size, 8 way associativity, force WA */ 121 /* 64KB way size, 8 way associativity, force WA */
81 l2x0_init(l2x0_base, 0x3e060000, 0xc0000fff); 122 l2x0_init(l2x0_base, 0x3e060000, 0xc0000fff);
82 123
124 /* Override invalidate function */
125 outer_cache.disable = ux500_l2x0_disable;
126 outer_cache.inv_all = ux500_l2x0_inv_all;
127
83 return 0; 128 return 0;
84} 129}
85early_initcall(ux500_l2x0_init); 130early_initcall(ux500_l2x0_init);
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index c2e405a9e025..fd25ccd7272f 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -54,7 +54,9 @@ static struct map_desc ct_ca9x4_io_desc[] __initdata = {
54 54
55static void __init ct_ca9x4_map_io(void) 55static void __init ct_ca9x4_map_io(void)
56{ 56{
57#ifdef CONFIG_LOCAL_TIMERS
57 twd_base = MMIO_P2V(A9_MPCORE_TWD); 58 twd_base = MMIO_P2V(A9_MPCORE_TWD);
59#endif
58 v2m_map_io(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); 60 v2m_map_io(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc));
59} 61}
60 62
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index a0a2928ae4dd..4414a01e1e8a 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -779,6 +779,14 @@ config CACHE_L2X0
779 help 779 help
780 This option enables the L2x0 PrimeCell. 780 This option enables the L2x0 PrimeCell.
781 781
782config CACHE_PL310
783 bool
784 depends on CACHE_L2X0
785 default y if CPU_V7 && !CPU_V6
786 help
787 This option enables optimisations for the PL310 cache
788 controller.
789
782config CACHE_TAUROS2 790config CACHE_TAUROS2
783 bool "Enable the Tauros2 L2 cache controller" 791 bool "Enable the Tauros2 L2 cache controller"
784 depends on (ARCH_DOVE || ARCH_MMP) 792 depends on (ARCH_DOVE || ARCH_MMP)
diff --git a/arch/arm/mm/cache-fa.S b/arch/arm/mm/cache-fa.S
index 7148e53e6078..1fa6f71470de 100644
--- a/arch/arm/mm/cache-fa.S
+++ b/arch/arm/mm/cache-fa.S
@@ -38,6 +38,17 @@
38#define CACHE_DLIMIT (CACHE_DSIZE * 2) 38#define CACHE_DLIMIT (CACHE_DSIZE * 2)
39 39
40/* 40/*
41 * flush_icache_all()
42 *
43 * Unconditionally clean and invalidate the entire icache.
44 */
45ENTRY(fa_flush_icache_all)
46 mov r0, #0
47 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
48 mov pc, lr
49ENDPROC(fa_flush_icache_all)
50
51/*
41 * flush_user_cache_all() 52 * flush_user_cache_all()
42 * 53 *
43 * Clean and invalidate all cache entries in a particular address 54 * Clean and invalidate all cache entries in a particular address
@@ -233,6 +244,7 @@ ENDPROC(fa_dma_unmap_area)
233 244
234 .type fa_cache_fns, #object 245 .type fa_cache_fns, #object
235ENTRY(fa_cache_fns) 246ENTRY(fa_cache_fns)
247 .long fa_flush_icache_all
236 .long fa_flush_kern_cache_all 248 .long fa_flush_kern_cache_all
237 .long fa_flush_user_cache_all 249 .long fa_flush_user_cache_all
238 .long fa_flush_user_cache_range 250 .long fa_flush_user_cache_range
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 9982eb385c0f..170c9bb95866 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -28,14 +28,24 @@
28static void __iomem *l2x0_base; 28static void __iomem *l2x0_base;
29static DEFINE_SPINLOCK(l2x0_lock); 29static DEFINE_SPINLOCK(l2x0_lock);
30static uint32_t l2x0_way_mask; /* Bitmask of active ways */ 30static uint32_t l2x0_way_mask; /* Bitmask of active ways */
31static uint32_t l2x0_size;
31 32
32static inline void cache_wait(void __iomem *reg, unsigned long mask) 33static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
33{ 34{
34 /* wait for the operation to complete */ 35 /* wait for cache operation by line or way to complete */
35 while (readl_relaxed(reg) & mask) 36 while (readl_relaxed(reg) & mask)
36 ; 37 ;
37} 38}
38 39
40#ifdef CONFIG_CACHE_PL310
41static inline void cache_wait(void __iomem *reg, unsigned long mask)
42{
43 /* cache operations by line are atomic on PL310 */
44}
45#else
46#define cache_wait cache_wait_way
47#endif
48
39static inline void cache_sync(void) 49static inline void cache_sync(void)
40{ 50{
41 void __iomem *base = l2x0_base; 51 void __iomem *base = l2x0_base;
@@ -103,14 +113,40 @@ static void l2x0_cache_sync(void)
103 spin_unlock_irqrestore(&l2x0_lock, flags); 113 spin_unlock_irqrestore(&l2x0_lock, flags);
104} 114}
105 115
106static inline void l2x0_inv_all(void) 116static void l2x0_flush_all(void)
117{
118 unsigned long flags;
119
120 /* clean all ways */
121 spin_lock_irqsave(&l2x0_lock, flags);
122 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_INV_WAY);
123 cache_wait_way(l2x0_base + L2X0_CLEAN_INV_WAY, l2x0_way_mask);
124 cache_sync();
125 spin_unlock_irqrestore(&l2x0_lock, flags);
126}
127
128static void l2x0_clean_all(void)
129{
130 unsigned long flags;
131
132 /* clean all ways */
133 spin_lock_irqsave(&l2x0_lock, flags);
134 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_WAY);
135 cache_wait_way(l2x0_base + L2X0_CLEAN_WAY, l2x0_way_mask);
136 cache_sync();
137 spin_unlock_irqrestore(&l2x0_lock, flags);
138}
139
140static void l2x0_inv_all(void)
107{ 141{
108 unsigned long flags; 142 unsigned long flags;
109 143
110 /* invalidate all ways */ 144 /* invalidate all ways */
111 spin_lock_irqsave(&l2x0_lock, flags); 145 spin_lock_irqsave(&l2x0_lock, flags);
146 /* Invalidating when L2 is enabled is a nono */
147 BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1);
112 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY); 148 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
113 cache_wait(l2x0_base + L2X0_INV_WAY, l2x0_way_mask); 149 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
114 cache_sync(); 150 cache_sync();
115 spin_unlock_irqrestore(&l2x0_lock, flags); 151 spin_unlock_irqrestore(&l2x0_lock, flags);
116} 152}
@@ -159,6 +195,11 @@ static void l2x0_clean_range(unsigned long start, unsigned long end)
159 void __iomem *base = l2x0_base; 195 void __iomem *base = l2x0_base;
160 unsigned long flags; 196 unsigned long flags;
161 197
198 if ((end - start) >= l2x0_size) {
199 l2x0_clean_all();
200 return;
201 }
202
162 spin_lock_irqsave(&l2x0_lock, flags); 203 spin_lock_irqsave(&l2x0_lock, flags);
163 start &= ~(CACHE_LINE_SIZE - 1); 204 start &= ~(CACHE_LINE_SIZE - 1);
164 while (start < end) { 205 while (start < end) {
@@ -184,6 +225,11 @@ static void l2x0_flush_range(unsigned long start, unsigned long end)
184 void __iomem *base = l2x0_base; 225 void __iomem *base = l2x0_base;
185 unsigned long flags; 226 unsigned long flags;
186 227
228 if ((end - start) >= l2x0_size) {
229 l2x0_flush_all();
230 return;
231 }
232
187 spin_lock_irqsave(&l2x0_lock, flags); 233 spin_lock_irqsave(&l2x0_lock, flags);
188 start &= ~(CACHE_LINE_SIZE - 1); 234 start &= ~(CACHE_LINE_SIZE - 1);
189 while (start < end) { 235 while (start < end) {
@@ -206,10 +252,20 @@ static void l2x0_flush_range(unsigned long start, unsigned long end)
206 spin_unlock_irqrestore(&l2x0_lock, flags); 252 spin_unlock_irqrestore(&l2x0_lock, flags);
207} 253}
208 254
255static void l2x0_disable(void)
256{
257 unsigned long flags;
258
259 spin_lock_irqsave(&l2x0_lock, flags);
260 writel(0, l2x0_base + L2X0_CTRL);
261 spin_unlock_irqrestore(&l2x0_lock, flags);
262}
263
209void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask) 264void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
210{ 265{
211 __u32 aux; 266 __u32 aux;
212 __u32 cache_id; 267 __u32 cache_id;
268 __u32 way_size = 0;
213 int ways; 269 int ways;
214 const char *type; 270 const char *type;
215 271
@@ -244,6 +300,13 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
244 l2x0_way_mask = (1 << ways) - 1; 300 l2x0_way_mask = (1 << ways) - 1;
245 301
246 /* 302 /*
303 * L2 cache Size = Way size * Number of ways
304 */
305 way_size = (aux & L2X0_AUX_CTRL_WAY_SIZE_MASK) >> 17;
306 way_size = 1 << (way_size + 3);
307 l2x0_size = ways * way_size * SZ_1K;
308
309 /*
247 * Check if l2x0 controller is already enabled. 310 * Check if l2x0 controller is already enabled.
248 * If you are booting from non-secure mode 311 * If you are booting from non-secure mode
249 * accessing the below registers will fault. 312 * accessing the below registers will fault.
@@ -263,8 +326,11 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
263 outer_cache.clean_range = l2x0_clean_range; 326 outer_cache.clean_range = l2x0_clean_range;
264 outer_cache.flush_range = l2x0_flush_range; 327 outer_cache.flush_range = l2x0_flush_range;
265 outer_cache.sync = l2x0_cache_sync; 328 outer_cache.sync = l2x0_cache_sync;
329 outer_cache.flush_all = l2x0_flush_all;
330 outer_cache.inv_all = l2x0_inv_all;
331 outer_cache.disable = l2x0_disable;
266 332
267 printk(KERN_INFO "%s cache controller enabled\n", type); 333 printk(KERN_INFO "%s cache controller enabled\n", type);
268 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x\n", 334 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
269 ways, cache_id, aux); 335 ways, cache_id, aux, l2x0_size);
270} 336}
diff --git a/arch/arm/mm/cache-v3.S b/arch/arm/mm/cache-v3.S
index c2ff3c599fee..2e2bc406a18d 100644
--- a/arch/arm/mm/cache-v3.S
+++ b/arch/arm/mm/cache-v3.S
@@ -13,6 +13,15 @@
13#include "proc-macros.S" 13#include "proc-macros.S"
14 14
15/* 15/*
16 * flush_icache_all()
17 *
18 * Unconditionally clean and invalidate the entire icache.
19 */
20ENTRY(v3_flush_icache_all)
21 mov pc, lr
22ENDPROC(v3_flush_icache_all)
23
24/*
16 * flush_user_cache_all() 25 * flush_user_cache_all()
17 * 26 *
18 * Invalidate all cache entries in a particular address 27 * Invalidate all cache entries in a particular address
@@ -122,6 +131,7 @@ ENDPROC(v3_dma_map_area)
122 131
123 .type v3_cache_fns, #object 132 .type v3_cache_fns, #object
124ENTRY(v3_cache_fns) 133ENTRY(v3_cache_fns)
134 .long v3_flush_icache_all
125 .long v3_flush_kern_cache_all 135 .long v3_flush_kern_cache_all
126 .long v3_flush_user_cache_all 136 .long v3_flush_user_cache_all
127 .long v3_flush_user_cache_range 137 .long v3_flush_user_cache_range
diff --git a/arch/arm/mm/cache-v4.S b/arch/arm/mm/cache-v4.S
index 4810f7e3e813..a8fefb523f19 100644
--- a/arch/arm/mm/cache-v4.S
+++ b/arch/arm/mm/cache-v4.S
@@ -13,6 +13,15 @@
13#include "proc-macros.S" 13#include "proc-macros.S"
14 14
15/* 15/*
16 * flush_icache_all()
17 *
18 * Unconditionally clean and invalidate the entire icache.
19 */
20ENTRY(v4_flush_icache_all)
21 mov pc, lr
22ENDPROC(v4_flush_icache_all)
23
24/*
16 * flush_user_cache_all() 25 * flush_user_cache_all()
17 * 26 *
18 * Invalidate all cache entries in a particular address 27 * Invalidate all cache entries in a particular address
@@ -134,6 +143,7 @@ ENDPROC(v4_dma_map_area)
134 143
135 .type v4_cache_fns, #object 144 .type v4_cache_fns, #object
136ENTRY(v4_cache_fns) 145ENTRY(v4_cache_fns)
146 .long v4_flush_icache_all
137 .long v4_flush_kern_cache_all 147 .long v4_flush_kern_cache_all
138 .long v4_flush_user_cache_all 148 .long v4_flush_user_cache_all
139 .long v4_flush_user_cache_range 149 .long v4_flush_user_cache_range
diff --git a/arch/arm/mm/cache-v4wb.S b/arch/arm/mm/cache-v4wb.S
index df8368afa102..d3644db467b7 100644
--- a/arch/arm/mm/cache-v4wb.S
+++ b/arch/arm/mm/cache-v4wb.S
@@ -51,6 +51,17 @@ flush_base:
51 .text 51 .text
52 52
53/* 53/*
54 * flush_icache_all()
55 *
56 * Unconditionally clean and invalidate the entire icache.
57 */
58ENTRY(v4wb_flush_icache_all)
59 mov r0, #0
60 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
61 mov pc, lr
62ENDPROC(v4wb_flush_icache_all)
63
64/*
54 * flush_user_cache_all() 65 * flush_user_cache_all()
55 * 66 *
56 * Clean and invalidate all cache entries in a particular address 67 * Clean and invalidate all cache entries in a particular address
@@ -244,6 +255,7 @@ ENDPROC(v4wb_dma_unmap_area)
244 255
245 .type v4wb_cache_fns, #object 256 .type v4wb_cache_fns, #object
246ENTRY(v4wb_cache_fns) 257ENTRY(v4wb_cache_fns)
258 .long v4wb_flush_icache_all
247 .long v4wb_flush_kern_cache_all 259 .long v4wb_flush_kern_cache_all
248 .long v4wb_flush_user_cache_all 260 .long v4wb_flush_user_cache_all
249 .long v4wb_flush_user_cache_range 261 .long v4wb_flush_user_cache_range
diff --git a/arch/arm/mm/cache-v4wt.S b/arch/arm/mm/cache-v4wt.S
index 45c70312f43b..49c2b66cf3dd 100644
--- a/arch/arm/mm/cache-v4wt.S
+++ b/arch/arm/mm/cache-v4wt.S
@@ -41,6 +41,17 @@
41#define CACHE_DLIMIT 16384 41#define CACHE_DLIMIT 16384
42 42
43/* 43/*
44 * flush_icache_all()
45 *
46 * Unconditionally clean and invalidate the entire icache.
47 */
48ENTRY(v4wt_flush_icache_all)
49 mov r0, #0
50 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
51 mov pc, lr
52ENDPROC(v4wt_flush_icache_all)
53
54/*
44 * flush_user_cache_all() 55 * flush_user_cache_all()
45 * 56 *
46 * Invalidate all cache entries in a particular address 57 * Invalidate all cache entries in a particular address
@@ -188,6 +199,7 @@ ENDPROC(v4wt_dma_map_area)
188 199
189 .type v4wt_cache_fns, #object 200 .type v4wt_cache_fns, #object
190ENTRY(v4wt_cache_fns) 201ENTRY(v4wt_cache_fns)
202 .long v4wt_flush_icache_all
191 .long v4wt_flush_kern_cache_all 203 .long v4wt_flush_kern_cache_all
192 .long v4wt_flush_user_cache_all 204 .long v4wt_flush_user_cache_all
193 .long v4wt_flush_user_cache_range 205 .long v4wt_flush_user_cache_range
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index e4dd0646e859..ac6a36142fcd 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -198,7 +198,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
198 * fragmentation of the DMA space, and also prevents allocations 198 * fragmentation of the DMA space, and also prevents allocations
199 * smaller than a section from crossing a section boundary. 199 * smaller than a section from crossing a section boundary.
200 */ 200 */
201 bit = fls(size - 1) + 1; 201 bit = fls(size - 1);
202 if (bit > SECTION_SHIFT) 202 if (bit > SECTION_SHIFT)
203 bit = SECTION_SHIFT; 203 bit = SECTION_SHIFT;
204 align = 1 << bit; 204 align = 1 << bit;
diff --git a/arch/arm/mm/fault-armv.c b/arch/arm/mm/fault-armv.c
index c493d7244d3d..83e59f870426 100644
--- a/arch/arm/mm/fault-armv.c
+++ b/arch/arm/mm/fault-armv.c
@@ -66,6 +66,30 @@ static int do_adjust_pte(struct vm_area_struct *vma, unsigned long address,
66 return ret; 66 return ret;
67} 67}
68 68
69#if USE_SPLIT_PTLOCKS
70/*
71 * If we are using split PTE locks, then we need to take the page
72 * lock here. Otherwise we are using shared mm->page_table_lock
73 * which is already locked, thus cannot take it.
74 */
75static inline void do_pte_lock(spinlock_t *ptl)
76{
77 /*
78 * Use nested version here to indicate that we are already
79 * holding one similar spinlock.
80 */
81 spin_lock_nested(ptl, SINGLE_DEPTH_NESTING);
82}
83
84static inline void do_pte_unlock(spinlock_t *ptl)
85{
86 spin_unlock(ptl);
87}
88#else /* !USE_SPLIT_PTLOCKS */
89static inline void do_pte_lock(spinlock_t *ptl) {}
90static inline void do_pte_unlock(spinlock_t *ptl) {}
91#endif /* USE_SPLIT_PTLOCKS */
92
69static int adjust_pte(struct vm_area_struct *vma, unsigned long address, 93static int adjust_pte(struct vm_area_struct *vma, unsigned long address,
70 unsigned long pfn) 94 unsigned long pfn)
71{ 95{
@@ -90,11 +114,11 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address,
90 */ 114 */
91 ptl = pte_lockptr(vma->vm_mm, pmd); 115 ptl = pte_lockptr(vma->vm_mm, pmd);
92 pte = pte_offset_map(pmd, address); 116 pte = pte_offset_map(pmd, address);
93 spin_lock(ptl); 117 do_pte_lock(ptl);
94 118
95 ret = do_adjust_pte(vma, address, pfn, pte); 119 ret = do_adjust_pte(vma, address, pfn, pte);
96 120
97 spin_unlock(ptl); 121 do_pte_unlock(ptl);
98 pte_unmap(pte); 122 pte_unmap(pte);
99 123
100 return ret; 124 return ret;
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 7fd9b5eb177f..5164069ced42 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -18,6 +18,7 @@
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/gfp.h> 19#include <linux/gfp.h>
20#include <linux/memblock.h> 20#include <linux/memblock.h>
21#include <linux/sort.h>
21 22
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/sections.h> 24#include <asm/sections.h>
@@ -121,9 +122,10 @@ void show_mem(void)
121 printk("%d pages swap cached\n", cached); 122 printk("%d pages swap cached\n", cached);
122} 123}
123 124
124static void __init find_limits(struct meminfo *mi, 125static void __init find_limits(unsigned long *min, unsigned long *max_low,
125 unsigned long *min, unsigned long *max_low, unsigned long *max_high) 126 unsigned long *max_high)
126{ 127{
128 struct meminfo *mi = &meminfo;
127 int i; 129 int i;
128 130
129 *min = -1UL; 131 *min = -1UL;
@@ -147,14 +149,13 @@ static void __init find_limits(struct meminfo *mi,
147 } 149 }
148} 150}
149 151
150static void __init arm_bootmem_init(struct meminfo *mi, 152static void __init arm_bootmem_init(unsigned long start_pfn,
151 unsigned long start_pfn, unsigned long end_pfn) 153 unsigned long end_pfn)
152{ 154{
153 struct memblock_region *reg; 155 struct memblock_region *reg;
154 unsigned int boot_pages; 156 unsigned int boot_pages;
155 phys_addr_t bitmap; 157 phys_addr_t bitmap;
156 pg_data_t *pgdat; 158 pg_data_t *pgdat;
157 int i;
158 159
159 /* 160 /*
160 * Allocate the bootmem bitmap page. This must be in a region 161 * Allocate the bootmem bitmap page. This must be in a region
@@ -172,30 +173,39 @@ static void __init arm_bootmem_init(struct meminfo *mi,
172 pgdat = NODE_DATA(0); 173 pgdat = NODE_DATA(0);
173 init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn); 174 init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
174 175
175 for_each_bank(i, mi) { 176 /* Free the lowmem regions from memblock into bootmem. */
176 struct membank *bank = &mi->bank[i]; 177 for_each_memblock(memory, reg) {
177 if (!bank->highmem) 178 unsigned long start = memblock_region_memory_base_pfn(reg);
178 free_bootmem(bank_phys_start(bank), bank_phys_size(bank)); 179 unsigned long end = memblock_region_memory_end_pfn(reg);
180
181 if (end >= end_pfn)
182 end = end_pfn;
183 if (start >= end)
184 break;
185
186 free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT);
179 } 187 }
180 188
181 /* 189 /* Reserve the lowmem memblock reserved regions in bootmem. */
182 * Reserve the memblock reserved regions in bootmem.
183 */
184 for_each_memblock(reserved, reg) { 190 for_each_memblock(reserved, reg) {
185 phys_addr_t start = memblock_region_reserved_base_pfn(reg); 191 unsigned long start = memblock_region_reserved_base_pfn(reg);
186 phys_addr_t end = memblock_region_reserved_end_pfn(reg); 192 unsigned long end = memblock_region_reserved_end_pfn(reg);
187 if (start >= start_pfn && end <= end_pfn) 193
188 reserve_bootmem_node(pgdat, __pfn_to_phys(start), 194 if (end >= end_pfn)
189 (end - start) << PAGE_SHIFT, 195 end = end_pfn;
190 BOOTMEM_DEFAULT); 196 if (start >= end)
197 break;
198
199 reserve_bootmem(__pfn_to_phys(start),
200 (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT);
191 } 201 }
192} 202}
193 203
194static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min, 204static void __init arm_bootmem_free(unsigned long min, unsigned long max_low,
195 unsigned long max_low, unsigned long max_high) 205 unsigned long max_high)
196{ 206{
197 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 207 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
198 int i; 208 struct memblock_region *reg;
199 209
200 /* 210 /*
201 * initialise the zones. 211 * initialise the zones.
@@ -217,13 +227,20 @@ static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min,
217 * holes = node_size - sum(bank_sizes) 227 * holes = node_size - sum(bank_sizes)
218 */ 228 */
219 memcpy(zhole_size, zone_size, sizeof(zhole_size)); 229 memcpy(zhole_size, zone_size, sizeof(zhole_size));
220 for_each_bank(i, mi) { 230 for_each_memblock(memory, reg) {
221 int idx = 0; 231 unsigned long start = memblock_region_memory_base_pfn(reg);
232 unsigned long end = memblock_region_memory_end_pfn(reg);
233
234 if (start < max_low) {
235 unsigned long low_end = min(end, max_low);
236 zhole_size[0] -= low_end - start;
237 }
222#ifdef CONFIG_HIGHMEM 238#ifdef CONFIG_HIGHMEM
223 if (mi->bank[i].highmem) 239 if (end > max_low) {
224 idx = ZONE_HIGHMEM; 240 unsigned long high_start = max(start, max_low);
241 zhole_size[ZONE_HIGHMEM] -= end - high_start;
242 }
225#endif 243#endif
226 zhole_size[idx] -= bank_pfn_size(&mi->bank[i]);
227 } 244 }
228 245
229 /* 246 /*
@@ -256,10 +273,19 @@ static void arm_memory_present(void)
256} 273}
257#endif 274#endif
258 275
276static int __init meminfo_cmp(const void *_a, const void *_b)
277{
278 const struct membank *a = _a, *b = _b;
279 long cmp = bank_pfn_start(a) - bank_pfn_start(b);
280 return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
281}
282
259void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc) 283void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
260{ 284{
261 int i; 285 int i;
262 286
287 sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
288
263 memblock_init(); 289 memblock_init();
264 for (i = 0; i < mi->nr_banks; i++) 290 for (i = 0; i < mi->nr_banks; i++)
265 memblock_add(mi->bank[i].start, mi->bank[i].size); 291 memblock_add(mi->bank[i].start, mi->bank[i].size);
@@ -292,14 +318,13 @@ void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
292 318
293void __init bootmem_init(void) 319void __init bootmem_init(void)
294{ 320{
295 struct meminfo *mi = &meminfo;
296 unsigned long min, max_low, max_high; 321 unsigned long min, max_low, max_high;
297 322
298 max_low = max_high = 0; 323 max_low = max_high = 0;
299 324
300 find_limits(mi, &min, &max_low, &max_high); 325 find_limits(&min, &max_low, &max_high);
301 326
302 arm_bootmem_init(mi, min, max_low); 327 arm_bootmem_init(min, max_low);
303 328
304 /* 329 /*
305 * Sparsemem tries to allocate bootmem in memory_present(), 330 * Sparsemem tries to allocate bootmem in memory_present(),
@@ -317,7 +342,7 @@ void __init bootmem_init(void)
317 * the sparse mem_map arrays initialized by sparse_init() 342 * the sparse mem_map arrays initialized by sparse_init()
318 * for memmap_init_zone(), otherwise all PFNs are invalid. 343 * for memmap_init_zone(), otherwise all PFNs are invalid.
319 */ 344 */
320 arm_bootmem_free(mi, min, max_low, max_high); 345 arm_bootmem_free(min, max_low, max_high);
321 346
322 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1; 347 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1;
323 348
@@ -411,6 +436,56 @@ static void __init free_unused_memmap(struct meminfo *mi)
411 } 436 }
412} 437}
413 438
439static void __init free_highpages(void)
440{
441#ifdef CONFIG_HIGHMEM
442 unsigned long max_low = max_low_pfn + PHYS_PFN_OFFSET;
443 struct memblock_region *mem, *res;
444
445 /* set highmem page free */
446 for_each_memblock(memory, mem) {
447 unsigned long start = memblock_region_memory_base_pfn(mem);
448 unsigned long end = memblock_region_memory_end_pfn(mem);
449
450 /* Ignore complete lowmem entries */
451 if (end <= max_low)
452 continue;
453
454 /* Truncate partial highmem entries */
455 if (start < max_low)
456 start = max_low;
457
458 /* Find and exclude any reserved regions */
459 for_each_memblock(reserved, res) {
460 unsigned long res_start, res_end;
461
462 res_start = memblock_region_reserved_base_pfn(res);
463 res_end = memblock_region_reserved_end_pfn(res);
464
465 if (res_end < start)
466 continue;
467 if (res_start < start)
468 res_start = start;
469 if (res_start > end)
470 res_start = end;
471 if (res_end > end)
472 res_end = end;
473 if (res_start != start)
474 totalhigh_pages += free_area(start, res_start,
475 NULL);
476 start = res_end;
477 if (start == end)
478 break;
479 }
480
481 /* And now free anything which remains */
482 if (start < end)
483 totalhigh_pages += free_area(start, end, NULL);
484 }
485 totalram_pages += totalhigh_pages;
486#endif
487}
488
414/* 489/*
415 * mem_init() marks the free areas in the mem_map and tells us how much 490 * mem_init() marks the free areas in the mem_map and tells us how much
416 * memory is free. This is done after various parts of the system have 491 * memory is free. This is done after various parts of the system have
@@ -419,6 +494,7 @@ static void __init free_unused_memmap(struct meminfo *mi)
419void __init mem_init(void) 494void __init mem_init(void)
420{ 495{
421 unsigned long reserved_pages, free_pages; 496 unsigned long reserved_pages, free_pages;
497 struct memblock_region *reg;
422 int i; 498 int i;
423#ifdef CONFIG_HAVE_TCM 499#ifdef CONFIG_HAVE_TCM
424 /* These pointers are filled in on TCM detection */ 500 /* These pointers are filled in on TCM detection */
@@ -439,16 +515,7 @@ void __init mem_init(void)
439 __phys_to_pfn(__pa(swapper_pg_dir)), NULL); 515 __phys_to_pfn(__pa(swapper_pg_dir)), NULL);
440#endif 516#endif
441 517
442#ifdef CONFIG_HIGHMEM 518 free_highpages();
443 /* set highmem page free */
444 for_each_bank (i, &meminfo) {
445 unsigned long start = bank_pfn_start(&meminfo.bank[i]);
446 unsigned long end = bank_pfn_end(&meminfo.bank[i]);
447 if (start >= max_low_pfn + PHYS_PFN_OFFSET)
448 totalhigh_pages += free_area(start, end, NULL);
449 }
450 totalram_pages += totalhigh_pages;
451#endif
452 519
453 reserved_pages = free_pages = 0; 520 reserved_pages = free_pages = 0;
454 521
@@ -478,9 +545,11 @@ void __init mem_init(void)
478 */ 545 */
479 printk(KERN_INFO "Memory:"); 546 printk(KERN_INFO "Memory:");
480 num_physpages = 0; 547 num_physpages = 0;
481 for (i = 0; i < meminfo.nr_banks; i++) { 548 for_each_memblock(memory, reg) {
482 num_physpages += bank_pfn_size(&meminfo.bank[i]); 549 unsigned long pages = memblock_region_memory_end_pfn(reg) -
483 printk(" %ldMB", bank_phys_size(&meminfo.bank[i]) >> 20); 550 memblock_region_memory_base_pfn(reg);
551 num_physpages += pages;
552 printk(" %ldMB", pages >> (20 - PAGE_SHIFT));
484 } 553 }
485 printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT)); 554 printk(" = %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
486 555
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index c32f731d56d3..72ad3e1f56cf 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -14,7 +14,6 @@
14#include <linux/mman.h> 14#include <linux/mman.h>
15#include <linux/nodemask.h> 15#include <linux/nodemask.h>
16#include <linux/memblock.h> 16#include <linux/memblock.h>
17#include <linux/sort.h>
18#include <linux/fs.h> 17#include <linux/fs.h>
19 18
20#include <asm/cputype.h> 19#include <asm/cputype.h>
@@ -265,17 +264,17 @@ static struct mem_type mem_types[] = {
265 .domain = DOMAIN_KERNEL, 264 .domain = DOMAIN_KERNEL,
266 }, 265 },
267 [MT_MEMORY_DTCM] = { 266 [MT_MEMORY_DTCM] = {
268 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | 267 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
269 L_PTE_DIRTY | L_PTE_WRITE, 268 L_PTE_WRITE,
270 .prot_l1 = PMD_TYPE_TABLE, 269 .prot_l1 = PMD_TYPE_TABLE,
271 .prot_sect = PMD_TYPE_SECT | PMD_SECT_XN, 270 .prot_sect = PMD_TYPE_SECT | PMD_SECT_XN,
272 .domain = DOMAIN_KERNEL, 271 .domain = DOMAIN_KERNEL,
273 }, 272 },
274 [MT_MEMORY_ITCM] = { 273 [MT_MEMORY_ITCM] = {
275 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY | 274 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
276 L_PTE_USER | L_PTE_EXEC, 275 L_PTE_WRITE | L_PTE_EXEC,
277 .prot_l1 = PMD_TYPE_TABLE, 276 .prot_l1 = PMD_TYPE_TABLE,
278 .domain = DOMAIN_IO, 277 .domain = DOMAIN_KERNEL,
279 }, 278 },
280}; 279};
281 280
@@ -745,13 +744,14 @@ static int __init early_vmalloc(char *arg)
745} 744}
746early_param("vmalloc", early_vmalloc); 745early_param("vmalloc", early_vmalloc);
747 746
748phys_addr_t lowmem_end_addr; 747static phys_addr_t lowmem_limit __initdata = 0;
749 748
750static void __init sanity_check_meminfo(void) 749static void __init sanity_check_meminfo(void)
751{ 750{
752 int i, j, highmem = 0; 751 int i, j, highmem = 0;
753 752
754 lowmem_end_addr = __pa(vmalloc_min - 1) + 1; 753 lowmem_limit = __pa(vmalloc_min - 1) + 1;
754 memblock_set_current_limit(lowmem_limit);
755 755
756 for (i = 0, j = 0; i < meminfo.nr_banks; i++) { 756 for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
757 struct membank *bank = &meminfo.bank[j]; 757 struct membank *bank = &meminfo.bank[j];
@@ -852,6 +852,7 @@ static void __init sanity_check_meminfo(void)
852static inline void prepare_page_table(void) 852static inline void prepare_page_table(void)
853{ 853{
854 unsigned long addr; 854 unsigned long addr;
855 phys_addr_t end;
855 856
856 /* 857 /*
857 * Clear out all the mappings below the kernel image. 858 * Clear out all the mappings below the kernel image.
@@ -867,10 +868,17 @@ static inline void prepare_page_table(void)
867 pmd_clear(pmd_off_k(addr)); 868 pmd_clear(pmd_off_k(addr));
868 869
869 /* 870 /*
871 * Find the end of the first block of lowmem.
872 */
873 end = memblock.memory.regions[0].base + memblock.memory.regions[0].size;
874 if (end >= lowmem_limit)
875 end = lowmem_limit;
876
877 /*
870 * Clear out all the kernel space mappings, except for the first 878 * Clear out all the kernel space mappings, except for the first
871 * memory bank, up to the end of the vmalloc region. 879 * memory bank, up to the end of the vmalloc region.
872 */ 880 */
873 for (addr = __phys_to_virt(bank_phys_end(&meminfo.bank[0])); 881 for (addr = __phys_to_virt(end);
874 addr < VMALLOC_END; addr += PGDIR_SIZE) 882 addr < VMALLOC_END; addr += PGDIR_SIZE)
875 pmd_clear(pmd_off_k(addr)); 883 pmd_clear(pmd_off_k(addr));
876} 884}
@@ -987,37 +995,28 @@ static void __init kmap_init(void)
987#endif 995#endif
988} 996}
989 997
990static inline void map_memory_bank(struct membank *bank)
991{
992 struct map_desc map;
993
994 map.pfn = bank_pfn_start(bank);
995 map.virtual = __phys_to_virt(bank_phys_start(bank));
996 map.length = bank_phys_size(bank);
997 map.type = MT_MEMORY;
998
999 create_mapping(&map);
1000}
1001
1002static void __init map_lowmem(void) 998static void __init map_lowmem(void)
1003{ 999{
1004 struct meminfo *mi = &meminfo; 1000 struct memblock_region *reg;
1005 int i;
1006 1001
1007 /* Map all the lowmem memory banks. */ 1002 /* Map all the lowmem memory banks. */
1008 for (i = 0; i < mi->nr_banks; i++) { 1003 for_each_memblock(memory, reg) {
1009 struct membank *bank = &mi->bank[i]; 1004 phys_addr_t start = reg->base;
1005 phys_addr_t end = start + reg->size;
1006 struct map_desc map;
1007
1008 if (end > lowmem_limit)
1009 end = lowmem_limit;
1010 if (start >= end)
1011 break;
1010 1012
1011 if (!bank->highmem) 1013 map.pfn = __phys_to_pfn(start);
1012 map_memory_bank(bank); 1014 map.virtual = __phys_to_virt(start);
1013 } 1015 map.length = end - start;
1014} 1016 map.type = MT_MEMORY;
1015 1017
1016static int __init meminfo_cmp(const void *_a, const void *_b) 1018 create_mapping(&map);
1017{ 1019 }
1018 const struct membank *a = _a, *b = _b;
1019 long cmp = bank_pfn_start(a) - bank_pfn_start(b);
1020 return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
1021} 1020}
1022 1021
1023/* 1022/*
@@ -1028,8 +1027,6 @@ void __init paging_init(struct machine_desc *mdesc)
1028{ 1027{
1029 void *zero_page; 1028 void *zero_page;
1030 1029
1031 sort(&meminfo.bank, meminfo.nr_banks, sizeof(meminfo.bank[0]), meminfo_cmp, NULL);
1032
1033 build_mem_type_table(); 1030 build_mem_type_table();
1034 sanity_check_meminfo(); 1031 sanity_check_meminfo();
1035 prepare_page_table(); 1032 prepare_page_table();
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index a6f5f8475b96..bcf748d9f4e2 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -119,6 +119,20 @@ ENTRY(cpu_arm1020_do_idle)
119/* ================================= CACHE ================================ */ 119/* ================================= CACHE ================================ */
120 120
121 .align 5 121 .align 5
122
123/*
124 * flush_icache_all()
125 *
126 * Unconditionally clean and invalidate the entire icache.
127 */
128ENTRY(arm1020_flush_icache_all)
129#ifndef CONFIG_CPU_ICACHE_DISABLE
130 mov r0, #0
131 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
132#endif
133 mov pc, lr
134ENDPROC(arm1020_flush_icache_all)
135
122/* 136/*
123 * flush_user_cache_all() 137 * flush_user_cache_all()
124 * 138 *
@@ -351,6 +365,7 @@ ENTRY(arm1020_dma_unmap_area)
351ENDPROC(arm1020_dma_unmap_area) 365ENDPROC(arm1020_dma_unmap_area)
352 366
353ENTRY(arm1020_cache_fns) 367ENTRY(arm1020_cache_fns)
368 .long arm1020_flush_icache_all
354 .long arm1020_flush_kern_cache_all 369 .long arm1020_flush_kern_cache_all
355 .long arm1020_flush_user_cache_all 370 .long arm1020_flush_user_cache_all
356 .long arm1020_flush_user_cache_range 371 .long arm1020_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index afc06b9c3133..ab7ec26657ea 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -119,6 +119,20 @@ ENTRY(cpu_arm1020e_do_idle)
119/* ================================= CACHE ================================ */ 119/* ================================= CACHE ================================ */
120 120
121 .align 5 121 .align 5
122
123/*
124 * flush_icache_all()
125 *
126 * Unconditionally clean and invalidate the entire icache.
127 */
128ENTRY(arm1020e_flush_icache_all)
129#ifndef CONFIG_CPU_ICACHE_DISABLE
130 mov r0, #0
131 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
132#endif
133 mov pc, lr
134ENDPROC(arm1020e_flush_icache_all)
135
122/* 136/*
123 * flush_user_cache_all() 137 * flush_user_cache_all()
124 * 138 *
@@ -337,6 +351,7 @@ ENTRY(arm1020e_dma_unmap_area)
337ENDPROC(arm1020e_dma_unmap_area) 351ENDPROC(arm1020e_dma_unmap_area)
338 352
339ENTRY(arm1020e_cache_fns) 353ENTRY(arm1020e_cache_fns)
354 .long arm1020e_flush_icache_all
340 .long arm1020e_flush_kern_cache_all 355 .long arm1020e_flush_kern_cache_all
341 .long arm1020e_flush_user_cache_all 356 .long arm1020e_flush_user_cache_all
342 .long arm1020e_flush_user_cache_range 357 .long arm1020e_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index 8915e0ba3fe5..831c5e54e22f 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -108,6 +108,20 @@ ENTRY(cpu_arm1022_do_idle)
108/* ================================= CACHE ================================ */ 108/* ================================= CACHE ================================ */
109 109
110 .align 5 110 .align 5
111
112/*
113 * flush_icache_all()
114 *
115 * Unconditionally clean and invalidate the entire icache.
116 */
117ENTRY(arm1022_flush_icache_all)
118#ifndef CONFIG_CPU_ICACHE_DISABLE
119 mov r0, #0
120 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
121#endif
122 mov pc, lr
123ENDPROC(arm1022_flush_icache_all)
124
111/* 125/*
112 * flush_user_cache_all() 126 * flush_user_cache_all()
113 * 127 *
@@ -326,6 +340,7 @@ ENTRY(arm1022_dma_unmap_area)
326ENDPROC(arm1022_dma_unmap_area) 340ENDPROC(arm1022_dma_unmap_area)
327 341
328ENTRY(arm1022_cache_fns) 342ENTRY(arm1022_cache_fns)
343 .long arm1022_flush_icache_all
329 .long arm1022_flush_kern_cache_all 344 .long arm1022_flush_kern_cache_all
330 .long arm1022_flush_user_cache_all 345 .long arm1022_flush_user_cache_all
331 .long arm1022_flush_user_cache_range 346 .long arm1022_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index ff446c5d476f..e3f7e9a166bf 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -108,6 +108,20 @@ ENTRY(cpu_arm1026_do_idle)
108/* ================================= CACHE ================================ */ 108/* ================================= CACHE ================================ */
109 109
110 .align 5 110 .align 5
111
112/*
113 * flush_icache_all()
114 *
115 * Unconditionally clean and invalidate the entire icache.
116 */
117ENTRY(arm1026_flush_icache_all)
118#ifndef CONFIG_CPU_ICACHE_DISABLE
119 mov r0, #0
120 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
121#endif
122 mov pc, lr
123ENDPROC(arm1026_flush_icache_all)
124
111/* 125/*
112 * flush_user_cache_all() 126 * flush_user_cache_all()
113 * 127 *
@@ -320,6 +334,7 @@ ENTRY(arm1026_dma_unmap_area)
320ENDPROC(arm1026_dma_unmap_area) 334ENDPROC(arm1026_dma_unmap_area)
321 335
322ENTRY(arm1026_cache_fns) 336ENTRY(arm1026_cache_fns)
337 .long arm1026_flush_icache_all
323 .long arm1026_flush_kern_cache_all 338 .long arm1026_flush_kern_cache_all
324 .long arm1026_flush_user_cache_all 339 .long arm1026_flush_user_cache_all
325 .long arm1026_flush_user_cache_range 340 .long arm1026_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index fecf570939f3..6109f278a904 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -110,6 +110,17 @@ ENTRY(cpu_arm920_do_idle)
110#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH 110#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
111 111
112/* 112/*
113 * flush_icache_all()
114 *
115 * Unconditionally clean and invalidate the entire icache.
116 */
117ENTRY(arm920_flush_icache_all)
118 mov r0, #0
119 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
120 mov pc, lr
121ENDPROC(arm920_flush_icache_all)
122
123/*
113 * flush_user_cache_all() 124 * flush_user_cache_all()
114 * 125 *
115 * Invalidate all cache entries in a particular address 126 * Invalidate all cache entries in a particular address
@@ -305,6 +316,7 @@ ENTRY(arm920_dma_unmap_area)
305ENDPROC(arm920_dma_unmap_area) 316ENDPROC(arm920_dma_unmap_area)
306 317
307ENTRY(arm920_cache_fns) 318ENTRY(arm920_cache_fns)
319 .long arm920_flush_icache_all
308 .long arm920_flush_kern_cache_all 320 .long arm920_flush_kern_cache_all
309 .long arm920_flush_user_cache_all 321 .long arm920_flush_user_cache_all
310 .long arm920_flush_user_cache_range 322 .long arm920_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index e3cbf87c9480..bb2f0f46a5e6 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -112,6 +112,17 @@ ENTRY(cpu_arm922_do_idle)
112#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH 112#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
113 113
114/* 114/*
115 * flush_icache_all()
116 *
117 * Unconditionally clean and invalidate the entire icache.
118 */
119ENTRY(arm922_flush_icache_all)
120 mov r0, #0
121 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
122 mov pc, lr
123ENDPROC(arm922_flush_icache_all)
124
125/*
115 * flush_user_cache_all() 126 * flush_user_cache_all()
116 * 127 *
117 * Clean and invalidate all cache entries in a particular 128 * Clean and invalidate all cache entries in a particular
@@ -307,6 +318,7 @@ ENTRY(arm922_dma_unmap_area)
307ENDPROC(arm922_dma_unmap_area) 318ENDPROC(arm922_dma_unmap_area)
308 319
309ENTRY(arm922_cache_fns) 320ENTRY(arm922_cache_fns)
321 .long arm922_flush_icache_all
310 .long arm922_flush_kern_cache_all 322 .long arm922_flush_kern_cache_all
311 .long arm922_flush_user_cache_all 323 .long arm922_flush_user_cache_all
312 .long arm922_flush_user_cache_range 324 .long arm922_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index 572424c867b5..c13e01accfe2 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -145,6 +145,17 @@ ENTRY(cpu_arm925_do_idle)
145 mov pc, lr 145 mov pc, lr
146 146
147/* 147/*
148 * flush_icache_all()
149 *
150 * Unconditionally clean and invalidate the entire icache.
151 */
152ENTRY(arm925_flush_icache_all)
153 mov r0, #0
154 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
155 mov pc, lr
156ENDPROC(arm925_flush_icache_all)
157
158/*
148 * flush_user_cache_all() 159 * flush_user_cache_all()
149 * 160 *
150 * Clean and invalidate all cache entries in a particular 161 * Clean and invalidate all cache entries in a particular
@@ -362,6 +373,7 @@ ENTRY(arm925_dma_unmap_area)
362ENDPROC(arm925_dma_unmap_area) 373ENDPROC(arm925_dma_unmap_area)
363 374
364ENTRY(arm925_cache_fns) 375ENTRY(arm925_cache_fns)
376 .long arm925_flush_icache_all
365 .long arm925_flush_kern_cache_all 377 .long arm925_flush_kern_cache_all
366 .long arm925_flush_user_cache_all 378 .long arm925_flush_user_cache_all
367 .long arm925_flush_user_cache_range 379 .long arm925_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 63d168b4ebe6..42eb4315740b 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -111,6 +111,17 @@ ENTRY(cpu_arm926_do_idle)
111 mov pc, lr 111 mov pc, lr
112 112
113/* 113/*
114 * flush_icache_all()
115 *
116 * Unconditionally clean and invalidate the entire icache.
117 */
118ENTRY(arm926_flush_icache_all)
119 mov r0, #0
120 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
121 mov pc, lr
122ENDPROC(arm926_flush_icache_all)
123
124/*
114 * flush_user_cache_all() 125 * flush_user_cache_all()
115 * 126 *
116 * Clean and invalidate all cache entries in a particular 127 * Clean and invalidate all cache entries in a particular
@@ -325,6 +336,7 @@ ENTRY(arm926_dma_unmap_area)
325ENDPROC(arm926_dma_unmap_area) 336ENDPROC(arm926_dma_unmap_area)
326 337
327ENTRY(arm926_cache_fns) 338ENTRY(arm926_cache_fns)
339 .long arm926_flush_icache_all
328 .long arm926_flush_kern_cache_all 340 .long arm926_flush_kern_cache_all
329 .long arm926_flush_user_cache_all 341 .long arm926_flush_user_cache_all
330 .long arm926_flush_user_cache_range 342 .long arm926_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S
index f6a62822418e..7b11cdb9935f 100644
--- a/arch/arm/mm/proc-arm940.S
+++ b/arch/arm/mm/proc-arm940.S
@@ -68,6 +68,17 @@ ENTRY(cpu_arm940_do_idle)
68 mov pc, lr 68 mov pc, lr
69 69
70/* 70/*
71 * flush_icache_all()
72 *
73 * Unconditionally clean and invalidate the entire icache.
74 */
75ENTRY(arm940_flush_icache_all)
76 mov r0, #0
77 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
78 mov pc, lr
79ENDPROC(arm940_flush_icache_all)
80
81/*
71 * flush_user_cache_all() 82 * flush_user_cache_all()
72 */ 83 */
73ENTRY(arm940_flush_user_cache_all) 84ENTRY(arm940_flush_user_cache_all)
@@ -254,6 +265,7 @@ ENTRY(arm940_dma_unmap_area)
254ENDPROC(arm940_dma_unmap_area) 265ENDPROC(arm940_dma_unmap_area)
255 266
256ENTRY(arm940_cache_fns) 267ENTRY(arm940_cache_fns)
268 .long arm940_flush_icache_all
257 .long arm940_flush_kern_cache_all 269 .long arm940_flush_kern_cache_all
258 .long arm940_flush_user_cache_all 270 .long arm940_flush_user_cache_all
259 .long arm940_flush_user_cache_range 271 .long arm940_flush_user_cache_range
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index ea2e7f2eb95b..1a5bbf080342 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -75,6 +75,17 @@ ENTRY(cpu_arm946_do_idle)
75 mov pc, lr 75 mov pc, lr
76 76
77/* 77/*
78 * flush_icache_all()
79 *
80 * Unconditionally clean and invalidate the entire icache.
81 */
82ENTRY(arm946_flush_icache_all)
83 mov r0, #0
84 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
85 mov pc, lr
86ENDPROC(arm946_flush_icache_all)
87
88/*
78 * flush_user_cache_all() 89 * flush_user_cache_all()
79 */ 90 */
80ENTRY(arm946_flush_user_cache_all) 91ENTRY(arm946_flush_user_cache_all)
@@ -296,6 +307,7 @@ ENTRY(arm946_dma_unmap_area)
296ENDPROC(arm946_dma_unmap_area) 307ENDPROC(arm946_dma_unmap_area)
297 308
298ENTRY(arm946_cache_fns) 309ENTRY(arm946_cache_fns)
310 .long arm946_flush_icache_all
299 .long arm946_flush_kern_cache_all 311 .long arm946_flush_kern_cache_all
300 .long arm946_flush_user_cache_all 312 .long arm946_flush_user_cache_all
301 .long arm946_flush_user_cache_range 313 .long arm946_flush_user_cache_range
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index 578da69200cf..b4597edbff97 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -124,6 +124,17 @@ ENTRY(cpu_feroceon_do_idle)
124 mov pc, lr 124 mov pc, lr
125 125
126/* 126/*
127 * flush_icache_all()
128 *
129 * Unconditionally clean and invalidate the entire icache.
130 */
131ENTRY(feroceon_flush_icache_all)
132 mov r0, #0
133 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
134 mov pc, lr
135ENDPROC(feroceon_flush_icache_all)
136
137/*
127 * flush_user_cache_all() 138 * flush_user_cache_all()
128 * 139 *
129 * Clean and invalidate all cache entries in a particular 140 * Clean and invalidate all cache entries in a particular
@@ -401,6 +412,7 @@ ENTRY(feroceon_dma_unmap_area)
401ENDPROC(feroceon_dma_unmap_area) 412ENDPROC(feroceon_dma_unmap_area)
402 413
403ENTRY(feroceon_cache_fns) 414ENTRY(feroceon_cache_fns)
415 .long feroceon_flush_icache_all
404 .long feroceon_flush_kern_cache_all 416 .long feroceon_flush_kern_cache_all
405 .long feroceon_flush_user_cache_all 417 .long feroceon_flush_user_cache_all
406 .long feroceon_flush_user_cache_range 418 .long feroceon_flush_user_cache_range
@@ -412,6 +424,7 @@ ENTRY(feroceon_cache_fns)
412 .long feroceon_dma_flush_range 424 .long feroceon_dma_flush_range
413 425
414ENTRY(feroceon_range_cache_fns) 426ENTRY(feroceon_range_cache_fns)
427 .long feroceon_flush_icache_all
415 .long feroceon_flush_kern_cache_all 428 .long feroceon_flush_kern_cache_all
416 .long feroceon_flush_user_cache_all 429 .long feroceon_flush_user_cache_all
417 .long feroceon_flush_user_cache_range 430 .long feroceon_flush_user_cache_range
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index cad07e403044..ec26355cb7c2 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -141,6 +141,17 @@ ENTRY(cpu_xsc3_do_idle)
141/* ================================= CACHE ================================ */ 141/* ================================= CACHE ================================ */
142 142
143/* 143/*
144 * flush_icache_all()
145 *
146 * Unconditionally clean and invalidate the entire icache.
147 */
148ENTRY(xsc3_flush_icache_all)
149 mov r0, #0
150 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
151 mov pc, lr
152ENDPROC(xsc3_flush_icache_all)
153
154/*
144 * flush_user_cache_all() 155 * flush_user_cache_all()
145 * 156 *
146 * Invalidate all cache entries in a particular address 157 * Invalidate all cache entries in a particular address
@@ -325,6 +336,7 @@ ENTRY(xsc3_dma_unmap_area)
325ENDPROC(xsc3_dma_unmap_area) 336ENDPROC(xsc3_dma_unmap_area)
326 337
327ENTRY(xsc3_cache_fns) 338ENTRY(xsc3_cache_fns)
339 .long xsc3_flush_icache_all
328 .long xsc3_flush_kern_cache_all 340 .long xsc3_flush_kern_cache_all
329 .long xsc3_flush_user_cache_all 341 .long xsc3_flush_user_cache_all
330 .long xsc3_flush_user_cache_range 342 .long xsc3_flush_user_cache_range
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index cb245edb2c2b..523408c0bb38 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -181,6 +181,17 @@ ENTRY(cpu_xscale_do_idle)
181/* ================================= CACHE ================================ */ 181/* ================================= CACHE ================================ */
182 182
183/* 183/*
184 * flush_icache_all()
185 *
186 * Unconditionally clean and invalidate the entire icache.
187 */
188ENTRY(xscale_flush_icache_all)
189 mov r0, #0
190 mcr p15, 0, r0, c7, c5, 0 @ invalidate I cache
191 mov pc, lr
192ENDPROC(xscale_flush_icache_all)
193
194/*
184 * flush_user_cache_all() 195 * flush_user_cache_all()
185 * 196 *
186 * Invalidate all cache entries in a particular address 197 * Invalidate all cache entries in a particular address
@@ -397,6 +408,7 @@ ENTRY(xscale_dma_unmap_area)
397ENDPROC(xscale_dma_unmap_area) 408ENDPROC(xscale_dma_unmap_area)
398 409
399ENTRY(xscale_cache_fns) 410ENTRY(xscale_cache_fns)
411 .long xscale_flush_icache_all
400 .long xscale_flush_kern_cache_all 412 .long xscale_flush_kern_cache_all
401 .long xscale_flush_user_cache_all 413 .long xscale_flush_user_cache_all
402 .long xscale_flush_user_cache_range 414 .long xscale_flush_user_cache_range
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 06875b4dd70f..372670952789 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_MXC_USE_EPIT) += epit.o
18obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o 18obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o
19obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o 19obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o
20obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o 20obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
21obj-$(CONFIG_CPU_FREQ_IMX) += cpufreq.o
21ifdef CONFIG_SND_IMX_SOC 22ifdef CONFIG_SND_IMX_SOC
22obj-y += ssi-fiq.o 23obj-y += ssi-fiq.o
23obj-y += ssi-fiq-ksym.o 24obj-y += ssi-fiq-ksym.o
diff --git a/arch/arm/plat-mxc/cpufreq.c b/arch/arm/plat-mxc/cpufreq.c
new file mode 100644
index 000000000000..039538e68793
--- /dev/null
+++ b/arch/arm/plat-mxc/cpufreq.c
@@ -0,0 +1,206 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14/*
15 * A driver for the Freescale Semiconductor i.MXC CPUfreq module.
16 * The CPUFREQ driver is for controling CPU frequency. It allows you to change
17 * the CPU clock speed on the fly.
18 */
19
20#include <linux/cpufreq.h>
21#include <linux/clk.h>
22#include <linux/err.h>
23#include <linux/slab.h>
24#include <mach/hardware.h>
25#include <mach/clock.h>
26
27#define CLK32_FREQ 32768
28#define NANOSECOND (1000 * 1000 * 1000)
29
30struct cpu_op *(*get_cpu_op)(int *op);
31
32static int cpu_freq_khz_min;
33static int cpu_freq_khz_max;
34
35static struct clk *cpu_clk;
36static struct cpufreq_frequency_table *imx_freq_table;
37
38static int cpu_op_nr;
39static struct cpu_op *cpu_op_tbl;
40
41static int set_cpu_freq(int freq)
42{
43 int ret = 0;
44 int org_cpu_rate;
45
46 org_cpu_rate = clk_get_rate(cpu_clk);
47 if (org_cpu_rate == freq)
48 return ret;
49
50 ret = clk_set_rate(cpu_clk, freq);
51 if (ret != 0) {
52 printk(KERN_DEBUG "cannot set CPU clock rate\n");
53 return ret;
54 }
55
56 return ret;
57}
58
59static int mxc_verify_speed(struct cpufreq_policy *policy)
60{
61 if (policy->cpu != 0)
62 return -EINVAL;
63
64 return cpufreq_frequency_table_verify(policy, imx_freq_table);
65}
66
67static unsigned int mxc_get_speed(unsigned int cpu)
68{
69 if (cpu)
70 return 0;
71
72 return clk_get_rate(cpu_clk) / 1000;
73}
74
75static int mxc_set_target(struct cpufreq_policy *policy,
76 unsigned int target_freq, unsigned int relation)
77{
78 struct cpufreq_freqs freqs;
79 int freq_Hz;
80 int ret = 0;
81 unsigned int index;
82
83 cpufreq_frequency_table_target(policy, imx_freq_table,
84 target_freq, relation, &index);
85 freq_Hz = imx_freq_table[index].frequency * 1000;
86
87 freqs.old = clk_get_rate(cpu_clk) / 1000;
88 freqs.new = freq_Hz / 1000;
89 freqs.cpu = 0;
90 freqs.flags = 0;
91 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
92
93 ret = set_cpu_freq(freq_Hz);
94
95 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
96
97 return ret;
98}
99
100static int __init mxc_cpufreq_init(struct cpufreq_policy *policy)
101{
102 int ret;
103 int i;
104
105 printk(KERN_INFO "i.MXC CPU frequency driver\n");
106
107 if (policy->cpu != 0)
108 return -EINVAL;
109
110 if (!get_cpu_op)
111 return -EINVAL;
112
113 cpu_clk = clk_get(NULL, "cpu_clk");
114 if (IS_ERR(cpu_clk)) {
115 printk(KERN_ERR "%s: failed to get cpu clock\n", __func__);
116 return PTR_ERR(cpu_clk);
117 }
118
119 cpu_op_tbl = get_cpu_op(&cpu_op_nr);
120
121 cpu_freq_khz_min = cpu_op_tbl[0].cpu_rate / 1000;
122 cpu_freq_khz_max = cpu_op_tbl[0].cpu_rate / 1000;
123
124 imx_freq_table = kmalloc(
125 sizeof(struct cpufreq_frequency_table) * (cpu_op_nr + 1),
126 GFP_KERNEL);
127 if (!imx_freq_table) {
128 ret = -ENOMEM;
129 goto err1;
130 }
131
132 for (i = 0; i < cpu_op_nr; i++) {
133 imx_freq_table[i].index = i;
134 imx_freq_table[i].frequency = cpu_op_tbl[i].cpu_rate / 1000;
135
136 if ((cpu_op_tbl[i].cpu_rate / 1000) < cpu_freq_khz_min)
137 cpu_freq_khz_min = cpu_op_tbl[i].cpu_rate / 1000;
138
139 if ((cpu_op_tbl[i].cpu_rate / 1000) > cpu_freq_khz_max)
140 cpu_freq_khz_max = cpu_op_tbl[i].cpu_rate / 1000;
141 }
142
143 imx_freq_table[i].index = i;
144 imx_freq_table[i].frequency = CPUFREQ_TABLE_END;
145
146 policy->cur = clk_get_rate(cpu_clk) / 1000;
147 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
148 policy->min = policy->cpuinfo.min_freq = cpu_freq_khz_min;
149 policy->max = policy->cpuinfo.max_freq = cpu_freq_khz_max;
150
151 /* Manual states, that PLL stabilizes in two CLK32 periods */
152 policy->cpuinfo.transition_latency = 2 * NANOSECOND / CLK32_FREQ;
153
154 ret = cpufreq_frequency_table_cpuinfo(policy, imx_freq_table);
155
156 if (ret < 0) {
157 printk(KERN_ERR "%s: failed to register i.MXC CPUfreq \
158 with error code %d\n", __func__, ret);
159 goto err;
160 }
161
162 cpufreq_frequency_table_get_attr(imx_freq_table, policy->cpu);
163 return 0;
164err:
165 kfree(imx_freq_table);
166err1:
167 clk_put(cpu_clk);
168 return ret;
169}
170
171static int mxc_cpufreq_exit(struct cpufreq_policy *policy)
172{
173 cpufreq_frequency_table_put_attr(policy->cpu);
174
175 set_cpu_freq(cpu_freq_khz_max * 1000);
176 clk_put(cpu_clk);
177 kfree(imx_freq_table);
178 return 0;
179}
180
181static struct cpufreq_driver mxc_driver = {
182 .flags = CPUFREQ_STICKY,
183 .verify = mxc_verify_speed,
184 .target = mxc_set_target,
185 .get = mxc_get_speed,
186 .init = mxc_cpufreq_init,
187 .exit = mxc_cpufreq_exit,
188 .name = "imx",
189};
190
191static int __devinit mxc_cpufreq_driver_init(void)
192{
193 return cpufreq_register_driver(&mxc_driver);
194}
195
196static void mxc_cpufreq_driver_exit(void)
197{
198 cpufreq_unregister_driver(&mxc_driver);
199}
200
201module_init(mxc_cpufreq_driver_init);
202module_exit(mxc_cpufreq_driver_exit);
203
204MODULE_AUTHOR("Freescale Semiconductor Inc. Yong Shen <yong.shen@linaro.org>");
205MODULE_DESCRIPTION("CPUfreq driver for i.MX");
206MODULE_LICENSE("GPL");
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
index 404799487f17..9aa6f3ea9012 100644
--- a/arch/arm/plat-mxc/devices/Kconfig
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -6,9 +6,13 @@ config IMX_HAVE_PLATFORM_FEC
6 default y if ARCH_MX25 || SOC_IMX27 || ARCH_MX35 || ARCH_MX51 6 default y if ARCH_MX25 || SOC_IMX27 || ARCH_MX35 || ARCH_MX51
7 7
8config IMX_HAVE_PLATFORM_FLEXCAN 8config IMX_HAVE_PLATFORM_FLEXCAN
9 select HAVE_CAN_FLEXCAN 9 select HAVE_CAN_FLEXCAN if CAN
10 bool 10 bool
11 11
12config IMX_HAVE_PLATFORM_GPIO_KEYS
13 bool
14 default y if ARCH_MX51
15
12config IMX_HAVE_PLATFORM_IMX_I2C 16config IMX_HAVE_PLATFORM_IMX_I2C
13 bool 17 bool
14 18
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
index 0a3c1f089413..45aefeb283ba 100644
--- a/arch/arm/plat-mxc/devices/Makefile
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -1,6 +1,7 @@
1obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o 1obj-$(CONFIG_IMX_HAVE_PLATFORM_ESDHC) += platform-esdhc.o
2obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o 2obj-$(CONFIG_IMX_HAVE_PLATFORM_FEC) += platform-fec.o
3obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o 3obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
4obj-$(CONFIG_IMX_HAVE_PLATFORM_GPIO_KEYS) += platform-gpio_keys.o
4obj-y += platform-imx-dma.o 5obj-y += platform-imx-dma.o
5obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o 6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o 7obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o
diff --git a/arch/arm/plat-mxc/devices/platform-gpio_keys.c b/arch/arm/plat-mxc/devices/platform-gpio_keys.c
new file mode 100644
index 000000000000..1c53a532ea0e
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-gpio_keys.c
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17 */
18#include <asm/sizes.h>
19#include <mach/hardware.h>
20#include <mach/devices-common.h>
21
22struct platform_device *__init imx_add_gpio_keys(
23 const struct gpio_keys_platform_data *pdata)
24{
25 return imx_add_platform_device("gpio-keys", -1, NULL,
26 0, pdata, sizeof(*pdata));
27}
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 9d38da077edb..9c3e36232b5b 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/interrupt.h>
23#include <linux/io.h> 24#include <linux/io.h>
24#include <linux/irq.h> 25#include <linux/irq.h>
25#include <linux/gpio.h> 26#include <linux/gpio.h>
@@ -201,11 +202,42 @@ static void mx2_gpio_irq_handler(u32 irq, struct irq_desc *desc)
201 } 202 }
202} 203}
203 204
205/*
206 * Set interrupt number "irq" in the GPIO as a wake-up source.
207 * While system is running, all registered GPIO interrupts need to have
208 * wake-up enabled. When system is suspended, only selected GPIO interrupts
209 * need to have wake-up enabled.
210 * @param irq interrupt source number
211 * @param enable enable as wake-up if equal to non-zero
212 * @return This function returns 0 on success.
213 */
214static int gpio_set_wake_irq(u32 irq, u32 enable)
215{
216 u32 gpio = irq_to_gpio(irq);
217 u32 gpio_idx = gpio & 0x1F;
218 struct mxc_gpio_port *port = &mxc_gpio_ports[gpio / 32];
219
220 if (enable) {
221 if (port->irq_high && (gpio_idx >= 16))
222 enable_irq_wake(port->irq_high);
223 else
224 enable_irq_wake(port->irq);
225 } else {
226 if (port->irq_high && (gpio_idx >= 16))
227 disable_irq_wake(port->irq_high);
228 else
229 disable_irq_wake(port->irq);
230 }
231
232 return 0;
233}
234
204static struct irq_chip gpio_irq_chip = { 235static struct irq_chip gpio_irq_chip = {
205 .ack = gpio_ack_irq, 236 .ack = gpio_ack_irq,
206 .mask = gpio_mask_irq, 237 .mask = gpio_mask_irq,
207 .unmask = gpio_unmask_irq, 238 .unmask = gpio_unmask_irq,
208 .set_type = gpio_set_irq_type, 239 .set_type = gpio_set_irq_type,
240 .set_wake = gpio_set_wake_irq,
209}; 241};
210 242
211static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset, 243static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 86d7575a564d..8c6896fd1e5f 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -29,6 +29,10 @@ struct platform_device *__init imx_add_flexcan(int id,
29 resource_size_t irq, 29 resource_size_t irq,
30 const struct flexcan_platform_data *pdata); 30 const struct flexcan_platform_data *pdata);
31 31
32#include <linux/gpio_keys.h>
33struct platform_device *__init imx_add_gpio_keys(
34 const struct gpio_keys_platform_data *pdata);
35
32#include <mach/i2c.h> 36#include <mach/i2c.h>
33struct imx_imx_i2c_data { 37struct imx_imx_i2c_data {
34 int id; 38 int id;
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
index e46b1c2836d4..d7a41e9a2605 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
@@ -45,6 +45,8 @@ typedef enum iomux_config {
45 PAD_CTL_PKE | PAD_CTL_HYS) 45 PAD_CTL_PKE | PAD_CTL_HYS)
46#define MX51_GPIO_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PKE | \ 46#define MX51_GPIO_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PKE | \
47 PAD_CTL_SRE_FAST) 47 PAD_CTL_SRE_FAST)
48#define MX51_GPIO_PAD_CTRL_2 (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \
49 PAD_CTL_PUS_100K_UP)
48#define MX51_ECSPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \ 50#define MX51_ECSPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \
49 PAD_CTL_SRE_FAST) 51 PAD_CTL_SRE_FAST)
50#define MX51_SDHCI_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PUS_47K_UP | \ 52#define MX51_SDHCI_PAD_CTRL (PAD_CTL_DSE_HIGH | PAD_CTL_PUS_47K_UP | \
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index 03e2afabc9fc..61cfe827498b 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -240,7 +240,6 @@ static inline void mx31_setup_weimcs(size_t cs,
240#define MPEG4_ENC_BASE_ADDR MX31_MPEG4_ENC_BASE_ADDR 240#define MPEG4_ENC_BASE_ADDR MX31_MPEG4_ENC_BASE_ADDR
241#define MXC_INT_MPEG4_ENCODER MX31_INT_MPEG4_ENCODER 241#define MXC_INT_MPEG4_ENCODER MX31_INT_MPEG4_ENCODER
242#define MXC_INT_FIRI MX31_INT_FIRI 242#define MXC_INT_FIRI MX31_INT_FIRI
243#define MXC_INT_MMC_SDHC1 MX31_INT_MMC_SDHC1
244#define MXC_INT_MBX MX31_INT_MBX 243#define MXC_INT_MBX MX31_INT_MBX
245#define MXC_INT_CSPI3 MX31_INT_CSPI3 244#define MXC_INT_CSPI3 MX31_INT_CSPI3
246#define MXC_INT_SIM2 MX31_INT_SIM2 245#define MXC_INT_SIM2 MX31_INT_SIM2
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h
index ff905cb32458..6267cff6035d 100644
--- a/arch/arm/plat-mxc/include/mach/mx35.h
+++ b/arch/arm/plat-mxc/include/mach/mx35.h
@@ -197,8 +197,6 @@
197/* these should go away */ 197/* these should go away */
198#define MXC_FEC_BASE_ADDR MX35_FEC_BASE_ADDR 198#define MXC_FEC_BASE_ADDR MX35_FEC_BASE_ADDR
199#define MXC_INT_OWIRE MX35_INT_OWIRE 199#define MXC_INT_OWIRE MX35_INT_OWIRE
200#define MXC_INT_MMC_SDHC2 MX35_INT_MMC_SDHC2
201#define MXC_INT_MMC_SDHC3 MX35_INT_MMC_SDHC3
202#define MXC_INT_GPU2D MX35_INT_GPU2D 200#define MXC_INT_GPU2D MX35_INT_GPU2D
203#define MXC_INT_ASRC MX35_INT_ASRC 201#define MXC_INT_ASRC MX35_INT_ASRC
204#define MXC_INT_USBHS MX35_INT_USBHS 202#define MXC_INT_USBHS MX35_INT_USBHS
diff --git a/arch/arm/plat-mxc/include/mach/mxc.h b/arch/arm/plat-mxc/include/mach/mxc.h
index a790bf212972..a42c7207082d 100644
--- a/arch/arm/plat-mxc/include/mach/mxc.h
+++ b/arch/arm/plat-mxc/include/mach/mxc.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved. 2 * Copyright 2004-2007, 2010 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) 3 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
4 * 4 *
5 * This program is free software; you can redistribute it and/or 5 * This program is free software; you can redistribute it and/or
@@ -20,6 +20,8 @@
20#ifndef __ASM_ARCH_MXC_H__ 20#ifndef __ASM_ARCH_MXC_H__
21#define __ASM_ARCH_MXC_H__ 21#define __ASM_ARCH_MXC_H__
22 22
23#include <linux/types.h>
24
23#ifndef __ASM_ARCH_MXC_HARDWARE_H__ 25#ifndef __ASM_ARCH_MXC_HARDWARE_H__
24#error "Do not include directly." 26#error "Do not include directly."
25#endif 27#endif
@@ -133,6 +135,15 @@ extern unsigned int __mxc_cpu_type;
133# define cpu_is_mxc91231() (0) 135# define cpu_is_mxc91231() (0)
134#endif 136#endif
135 137
138#ifndef __ASSEMBLY__
139
140struct cpu_op {
141 u32 cpu_rate;
142};
143
144extern struct cpu_op *(*get_cpu_op)(int *op);
145#endif
146
136#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2) 147#if defined(CONFIG_ARCH_MX3) || defined(CONFIG_ARCH_MX2)
137/* These are deprecated, use mx[23][157]_setup_weimcs instead. */ 148/* These are deprecated, use mx[23][157]_setup_weimcs instead. */
138#define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10)) 149#define CSCR_U(n) (IO_ADDRESS(WEIM_BASE_ADDR + n * 0x10))
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 221a675ebbae..f04731820301 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -19,6 +19,7 @@
19#include <plat/common.h> 19#include <plat/common.h>
20#include <plat/board.h> 20#include <plat/board.h>
21#include <plat/vram.h> 21#include <plat/vram.h>
22#include <plat/dsp.h>
22 23
23 24
24#define NO_LENGTH_CHECK 0xffffffff 25#define NO_LENGTH_CHECK 0xffffffff
@@ -64,4 +65,5 @@ void __init omap_reserve(void)
64{ 65{
65 omapfb_reserve_sdram_memblock(); 66 omapfb_reserve_sdram_memblock();
66 omap_vram_reserve_sdram_memblock(); 67 omap_vram_reserve_sdram_memblock();
68 omap_dsp_reserve_sdram_memblock();
67} 69}
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index 1e2383eae638..fc819120978d 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -15,6 +15,7 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/memblock.h>
18 19
19#include <mach/hardware.h> 20#include <mach/hardware.h>
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
@@ -231,6 +232,77 @@ static void omap_init_uwire(void)
231static inline void omap_init_uwire(void) {} 232static inline void omap_init_uwire(void) {}
232#endif 233#endif
233 234
235/*-------------------------------------------------------------------------*/
236
237#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
238
239static struct resource wdt_resources[] = {
240 {
241 .flags = IORESOURCE_MEM,
242 },
243};
244
245static struct platform_device omap_wdt_device = {
246 .name = "omap_wdt",
247 .id = -1,
248 .num_resources = ARRAY_SIZE(wdt_resources),
249 .resource = wdt_resources,
250};
251
252static void omap_init_wdt(void)
253{
254 if (cpu_is_omap16xx())
255 wdt_resources[0].start = 0xfffeb000;
256 else if (cpu_is_omap2420())
257 wdt_resources[0].start = 0x48022000; /* WDT2 */
258 else if (cpu_is_omap2430())
259 wdt_resources[0].start = 0x49016000; /* WDT2 */
260 else if (cpu_is_omap343x())
261 wdt_resources[0].start = 0x48314000; /* WDT2 */
262 else if (cpu_is_omap44xx())
263 wdt_resources[0].start = 0x4a314000;
264 else
265 return;
266
267 wdt_resources[0].end = wdt_resources[0].start + 0x4f;
268
269 (void) platform_device_register(&omap_wdt_device);
270}
271#else
272static inline void omap_init_wdt(void) {}
273#endif
274
275#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
276
277static phys_addr_t omap_dsp_phys_mempool_base;
278
279void __init omap_dsp_reserve_sdram_memblock(void)
280{
281 phys_addr_t size = CONFIG_TIDSPBRIDGE_MEMPOOL_SIZE;
282 phys_addr_t paddr;
283
284 if (!size)
285 return;
286
287 paddr = memblock_alloc(size, SZ_1M);
288 if (!paddr) {
289 pr_err("%s: failed to reserve %x bytes\n",
290 __func__, size);
291 return;
292 }
293 memblock_free(paddr, size);
294 memblock_remove(paddr, size);
295
296 omap_dsp_phys_mempool_base = paddr;
297}
298
299phys_addr_t omap_dsp_get_mempool_base(void)
300{
301 return omap_dsp_phys_mempool_base;
302}
303EXPORT_SYMBOL(omap_dsp_get_mempool_base);
304#endif
305
234/* 306/*
235 * This gets called after board-specific INIT_MACHINE, and initializes most 307 * This gets called after board-specific INIT_MACHINE, and initializes most
236 * on-chip peripherals accessible on this board (except for few like USB): 308 * on-chip peripherals accessible on this board (except for few like USB):
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index f5c5b8da9a87..2c2826571d45 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1983,6 +1983,8 @@ static int omap2_dma_handle_ch(int ch)
1983 1983
1984 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(ch)); 1984 dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(ch));
1985 dma_write(1 << ch, IRQSTATUS_L0); 1985 dma_write(1 << ch, IRQSTATUS_L0);
1986 /* read back the register to flush the write */
1987 dma_read(IRQSTATUS_L0);
1986 1988
1987 /* If the ch is not chained then chain_id will be -1 */ 1989 /* If the ch is not chained then chain_id will be -1 */
1988 if (dma_chan[ch].chain_id != -1) { 1990 if (dma_chan[ch].chain_id != -1) {
diff --git a/arch/arm/plat-omap/include/plat/dsp.h b/arch/arm/plat-omap/include/plat/dsp.h
new file mode 100644
index 000000000000..9c604b390f9f
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/dsp.h
@@ -0,0 +1,31 @@
1#ifndef __OMAP_DSP_H__
2#define __OMAP_DSP_H__
3
4#include <linux/types.h>
5
6struct omap_dsp_platform_data {
7 void (*dsp_set_min_opp) (u8 opp_id);
8 u8 (*dsp_get_opp) (void);
9 void (*cpu_set_freq) (unsigned long f);
10 unsigned long (*cpu_get_freq) (void);
11 unsigned long mpu_speed[6];
12
13 /* functions to write and read PRCM registers */
14 void (*dsp_prm_write)(u32, s16 , u16);
15 u32 (*dsp_prm_read)(s16 , u16);
16 u32 (*dsp_prm_rmw_bits)(u32, u32, s16, s16);
17 void (*dsp_cm_write)(u32, s16 , u16);
18 u32 (*dsp_cm_read)(s16 , u16);
19 u32 (*dsp_cm_rmw_bits)(u32, u32, s16, s16);
20
21 phys_addr_t phys_mempool_base;
22 phys_addr_t phys_mempool_size;
23};
24
25#if defined(CONFIG_TIDSPBRIDGE) || defined(CONFIG_TIDSPBRIDGE_MODULE)
26extern void omap_dsp_reserve_sdram_memblock(void);
27#else
28static inline void omap_dsp_reserve_sdram_memblock(void) { }
29#endif
30
31#endif
diff --git a/arch/arm/plat-orion/include/plat/pcie.h b/arch/arm/plat-orion/include/plat/pcie.h
index 3ebfef72b4e7..cc99163e73fd 100644
--- a/arch/arm/plat-orion/include/plat/pcie.h
+++ b/arch/arm/plat-orion/include/plat/pcie.h
@@ -11,12 +11,15 @@
11#ifndef __PLAT_PCIE_H 11#ifndef __PLAT_PCIE_H
12#define __PLAT_PCIE_H 12#define __PLAT_PCIE_H
13 13
14struct pci_bus;
15
14u32 orion_pcie_dev_id(void __iomem *base); 16u32 orion_pcie_dev_id(void __iomem *base);
15u32 orion_pcie_rev(void __iomem *base); 17u32 orion_pcie_rev(void __iomem *base);
16int orion_pcie_link_up(void __iomem *base); 18int orion_pcie_link_up(void __iomem *base);
17int orion_pcie_x4_mode(void __iomem *base); 19int orion_pcie_x4_mode(void __iomem *base);
18int orion_pcie_get_local_bus_nr(void __iomem *base); 20int orion_pcie_get_local_bus_nr(void __iomem *base);
19void orion_pcie_set_local_bus_nr(void __iomem *base, int nr); 21void orion_pcie_set_local_bus_nr(void __iomem *base, int nr);
22void orion_pcie_reset(void __iomem *base);
20void orion_pcie_setup(void __iomem *base, 23void orion_pcie_setup(void __iomem *base,
21 struct mbus_dram_target_info *dram); 24 struct mbus_dram_target_info *dram);
22int orion_pcie_rd_conf(void __iomem *base, struct pci_bus *bus, 25int orion_pcie_rd_conf(void __iomem *base, struct pci_bus *bus,
diff --git a/arch/arm/plat-orion/pcie.c b/arch/arm/plat-orion/pcie.c
index 779553a1595e..af2d733c50b5 100644
--- a/arch/arm/plat-orion/pcie.c
+++ b/arch/arm/plat-orion/pcie.c
@@ -182,11 +182,6 @@ void __init orion_pcie_setup(void __iomem *base,
182 u32 mask; 182 u32 mask;
183 183
184 /* 184 /*
185 * soft reset PCIe unit
186 */
187 orion_pcie_reset(base);
188
189 /*
190 * Point PCIe unit MBUS decode windows to DRAM space. 185 * Point PCIe unit MBUS decode windows to DRAM space.
191 */ 186 */
192 orion_pcie_setup_wins(base, dram); 187 orion_pcie_setup_wins(base, dram);
diff --git a/arch/arm/plat-pxa/include/plat/pxa3xx_nand.h b/arch/arm/plat-pxa/include/plat/pxa3xx_nand.h
index 3478eae32d8a..01a8448e471c 100644
--- a/arch/arm/plat-pxa/include/plat/pxa3xx_nand.h
+++ b/arch/arm/plat-pxa/include/plat/pxa3xx_nand.h
@@ -30,15 +30,15 @@ struct pxa3xx_nand_cmdset {
30}; 30};
31 31
32struct pxa3xx_nand_flash { 32struct pxa3xx_nand_flash {
33 const struct pxa3xx_nand_timing *timing; /* NAND Flash timing */ 33 uint32_t chip_id;
34 const struct pxa3xx_nand_cmdset *cmdset; 34 unsigned int page_per_block; /* Pages per block (PG_PER_BLK) */
35 35 unsigned int page_size; /* Page size in bytes (PAGE_SZ) */
36 uint32_t page_per_block;/* Pages per block (PG_PER_BLK) */ 36 unsigned int flash_width; /* Width of Flash memory (DWIDTH_M) */
37 uint32_t page_size; /* Page size in bytes (PAGE_SZ) */ 37 unsigned int dfc_width; /* Width of flash controller(DWIDTH_C) */
38 uint32_t flash_width; /* Width of Flash memory (DWIDTH_M) */ 38 unsigned int num_blocks; /* Number of physical blocks in Flash */
39 uint32_t dfc_width; /* Width of flash controller(DWIDTH_C) */ 39
40 uint32_t num_blocks; /* Number of physical blocks in Flash */ 40 struct pxa3xx_nand_cmdset *cmdset; /* NAND command set */
41 uint32_t chip_id; 41 struct pxa3xx_nand_timing *timing; /* NAND Flash timing */
42}; 42};
43 43
44struct pxa3xx_nand_platform_data { 44struct pxa3xx_nand_platform_data {
diff --git a/arch/arm/plat-pxa/include/plat/sdhci.h b/arch/arm/plat-pxa/include/plat/sdhci.h
new file mode 100644
index 000000000000..e49c5b6fc4e2
--- /dev/null
+++ b/arch/arm/plat-pxa/include/plat/sdhci.h
@@ -0,0 +1,32 @@
1/* linux/arch/arm/plat-pxa/include/plat/sdhci.h
2 *
3 * Copyright 2010 Marvell
4 * Zhangfei Gao <zhangfei.gao@marvell.com>
5 *
6 * PXA Platform - SDHCI platform data definitions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __PLAT_PXA_SDHCI_H
14#define __PLAT_PXA_SDHCI_H
15
16/* pxa specific flag */
17/* Require clock free running */
18#define PXA_FLAG_DISABLE_CLOCK_GATING (1<<0)
19
20/*
21 * struct pxa_sdhci_platdata() - Platform device data for PXA SDHCI
22 * @max_speed: the maximum speed supported
23 * @quirks: quirks of specific device
24 * @flags: flags for platform requirement
25 */
26struct sdhci_pxa_platdata {
27 unsigned int max_speed;
28 unsigned int quirks;
29 unsigned int flags;
30};
31
32#endif /* __PLAT_PXA_SDHCI_H */
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig
index 984bf66826d2..5a27b1b538f2 100644
--- a/arch/arm/plat-s3c24xx/Kconfig
+++ b/arch/arm/plat-s3c24xx/Kconfig
@@ -69,6 +69,7 @@ config S3C24XX_GPIO_EXTRA
69 int 69 int
70 default 128 if S3C24XX_GPIO_EXTRA128 70 default 128 if S3C24XX_GPIO_EXTRA128
71 default 64 if S3C24XX_GPIO_EXTRA64 71 default 64 if S3C24XX_GPIO_EXTRA64
72 default 16 if ARCH_H1940
72 default 0 73 default 0
73 74
74config S3C24XX_GPIO_EXTRA64 75config S3C24XX_GPIO_EXTRA64
diff --git a/arch/arm/plat-s3c24xx/common-smdk.c b/arch/arm/plat-s3c24xx/common-smdk.c
index 7b44d0c592b5..bcc43f346272 100644
--- a/arch/arm/plat-s3c24xx/common-smdk.c
+++ b/arch/arm/plat-s3c24xx/common-smdk.c
@@ -147,7 +147,7 @@ static struct mtd_partition smdk_default_nand_part[] = {
147 [7] = { 147 [7] = {
148 .name = "S3C2410 flash partition 7", 148 .name = "S3C2410 flash partition 7",
149 .offset = SZ_1M * 48, 149 .offset = SZ_1M * 48,
150 .size = SZ_16M, 150 .size = MTDPART_SIZ_FULL,
151 } 151 }
152}; 152};
153 153
diff --git a/arch/arm/plat-s3c24xx/gpiolib.c b/arch/arm/plat-s3c24xx/gpiolib.c
index 4c0896f2572d..24c6f5a30596 100644
--- a/arch/arm/plat-s3c24xx/gpiolib.c
+++ b/arch/arm/plat-s3c24xx/gpiolib.c
@@ -74,11 +74,6 @@ static int s3c24xx_gpiolib_bankf_toirq(struct gpio_chip *chip, unsigned offset)
74 return -EINVAL; 74 return -EINVAL;
75} 75}
76 76
77static int s3c24xx_gpiolib_bankg_toirq(struct gpio_chip *chip, unsigned offset)
78{
79 return IRQ_EINT8 + offset;
80}
81
82static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = { 77static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = {
83 .set_config = s3c_gpio_setcfg_s3c24xx_a, 78 .set_config = s3c_gpio_setcfg_s3c24xx_a,
84 .get_config = s3c_gpio_getcfg_s3c24xx_a, 79 .get_config = s3c_gpio_getcfg_s3c24xx_a,
@@ -87,6 +82,8 @@ static struct s3c_gpio_cfg s3c24xx_gpiocfg_banka = {
87struct s3c_gpio_cfg s3c24xx_gpiocfg_default = { 82struct s3c_gpio_cfg s3c24xx_gpiocfg_default = {
88 .set_config = s3c_gpio_setcfg_s3c24xx, 83 .set_config = s3c_gpio_setcfg_s3c24xx,
89 .get_config = s3c_gpio_getcfg_s3c24xx, 84 .get_config = s3c_gpio_getcfg_s3c24xx,
85 .set_pull = s3c_gpio_setpull_1up,
86 .get_pull = s3c_gpio_getpull_1up,
90}; 87};
91 88
92struct s3c_gpio_chip s3c24xx_gpios[] = { 89struct s3c_gpio_chip s3c24xx_gpios[] = {
@@ -157,12 +154,13 @@ struct s3c_gpio_chip s3c24xx_gpios[] = {
157 [6] = { 154 [6] = {
158 .base = S3C2410_GPGCON, 155 .base = S3C2410_GPGCON,
159 .pm = __gpio_pm(&s3c_gpio_pm_2bit), 156 .pm = __gpio_pm(&s3c_gpio_pm_2bit),
157 .irq_base = IRQ_EINT8,
160 .chip = { 158 .chip = {
161 .base = S3C2410_GPG(0), 159 .base = S3C2410_GPG(0),
162 .owner = THIS_MODULE, 160 .owner = THIS_MODULE,
163 .label = "GPIOG", 161 .label = "GPIOG",
164 .ngpio = 16, 162 .ngpio = 16,
165 .to_irq = s3c24xx_gpiolib_bankg_toirq, 163 .to_irq = samsung_gpiolib_to_irq,
166 }, 164 },
167 }, { 165 }, {
168 .base = S3C2410_GPHCON, 166 .base = S3C2410_GPHCON,
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 25960966af7c..65dbfa8e0a86 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -32,6 +32,11 @@ config S5P_EXT_INT
32 Use the external interrupts (other than GPIO interrupts.) 32 Use the external interrupts (other than GPIO interrupts.)
33 Note: Do not choose this for S5P6440 and S5P6450. 33 Note: Do not choose this for S5P6440 and S5P6450.
34 34
35config S5P_GPIO_INT
36 bool
37 help
38 Common code for the GPIO interrupts (other than external interrupts.)
39
35config S5P_DEV_FIMC0 40config S5P_DEV_FIMC0
36 bool 41 bool
37 help 42 help
diff --git a/arch/arm/plat-s5p/Makefile b/arch/arm/plat-s5p/Makefile
index f3e917e27da8..de65238a7aef 100644
--- a/arch/arm/plat-s5p/Makefile
+++ b/arch/arm/plat-s5p/Makefile
@@ -18,6 +18,9 @@ obj-y += cpu.o
18obj-y += clock.o 18obj-y += clock.o
19obj-y += irq.o 19obj-y += irq.o
20obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o 20obj-$(CONFIG_S5P_EXT_INT) += irq-eint.o
21obj-$(CONFIG_S5P_GPIO_INT) += irq-gpioint.o
22obj-$(CONFIG_PM) += pm.o
23obj-$(CONFIG_PM) += irq-pm.o
21 24
22# devices 25# devices
23 26
diff --git a/arch/arm/plat-s5p/clock.c b/arch/arm/plat-s5p/clock.c
index 8aaf4e6b60c3..8d081d968c58 100644
--- a/arch/arm/plat-s5p/clock.c
+++ b/arch/arm/plat-s5p/clock.c
@@ -21,6 +21,8 @@
21#include <linux/io.h> 21#include <linux/io.h>
22#include <asm/div64.h> 22#include <asm/div64.h>
23 23
24#include <mach/regs-clock.h>
25
24#include <plat/clock.h> 26#include <plat/clock.h>
25#include <plat/clock-clksrc.h> 27#include <plat/clock-clksrc.h>
26#include <plat/s5p-clock.h> 28#include <plat/s5p-clock.h>
@@ -88,14 +90,6 @@ struct clk clk_fout_vpll = {
88 .ctrlbit = (1 << 31), 90 .ctrlbit = (1 << 31),
89}; 91};
90 92
91/* ARM clock */
92struct clk clk_arm = {
93 .name = "armclk",
94 .id = -1,
95 .rate = 0,
96 .ctrlbit = 0,
97};
98
99/* Possible clock sources for APLL Mux */ 93/* Possible clock sources for APLL Mux */
100static struct clk *clk_src_apll_list[] = { 94static struct clk *clk_src_apll_list[] = {
101 [0] = &clk_fin_apll, 95 [0] = &clk_fin_apll,
@@ -156,6 +150,24 @@ int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable)
156 return 0; 150 return 0;
157} 151}
158 152
153int s5p_epll_enable(struct clk *clk, int enable)
154{
155 unsigned int ctrlbit = clk->ctrlbit;
156 unsigned int epll_con = __raw_readl(S5P_EPLL_CON) & ~ctrlbit;
157
158 if (enable)
159 __raw_writel(epll_con | ctrlbit, S5P_EPLL_CON);
160 else
161 __raw_writel(epll_con, S5P_EPLL_CON);
162
163 return 0;
164}
165
166unsigned long s5p_epll_get_rate(struct clk *clk)
167{
168 return clk->rate;
169}
170
159static struct clk *s5p_clks[] __initdata = { 171static struct clk *s5p_clks[] __initdata = {
160 &clk_ext_xtal_mux, 172 &clk_ext_xtal_mux,
161 &clk_48m, 173 &clk_48m,
@@ -165,7 +177,6 @@ static struct clk *s5p_clks[] __initdata = {
165 &clk_fout_epll, 177 &clk_fout_epll,
166 &clk_fout_dpll, 178 &clk_fout_dpll,
167 &clk_fout_vpll, 179 &clk_fout_vpll,
168 &clk_arm,
169 &clk_vpll, 180 &clk_vpll,
170 &clk_xusbxti, 181 &clk_xusbxti,
171}; 182};
diff --git a/arch/arm/plat-s5p/include/plat/irqs.h b/arch/arm/plat-s5p/include/plat/irqs.h
index 3fb3a3a17465..ba9121c60a2a 100644
--- a/arch/arm/plat-s5p/include/plat/irqs.h
+++ b/arch/arm/plat-s5p/include/plat/irqs.h
@@ -94,4 +94,22 @@
94 ((irq) - S5P_EINT_BASE1) : \ 94 ((irq) - S5P_EINT_BASE1) : \
95 ((irq) + 16 - S5P_EINT_BASE2)) 95 ((irq) + 16 - S5P_EINT_BASE2))
96 96
97#define IRQ_EINT_BIT(x) EINT_OFFSET(x)
98
99/* Typically only a few gpio chips require gpio interrupt support.
100 To avoid memory waste irq descriptors are allocated only for
101 S5P_GPIOINT_GROUP_COUNT chips, each with total number of
102 S5P_GPIOINT_GROUP_SIZE pins/irqs. Each GPIOINT group can be assiged
103 to any gpio chip with the s5p_register_gpio_interrupt() function */
104#define S5P_GPIOINT_GROUP_COUNT 4
105#define S5P_GPIOINT_GROUP_SIZE 8
106#define S5P_GPIOINT_COUNT (S5P_GPIOINT_GROUP_COUNT * S5P_GPIOINT_GROUP_SIZE)
107
108/* IRQ types common for all s5p platforms */
109#define S5P_IRQ_TYPE_LEVEL_LOW (0x00)
110#define S5P_IRQ_TYPE_LEVEL_HIGH (0x01)
111#define S5P_IRQ_TYPE_EDGE_FALLING (0x02)
112#define S5P_IRQ_TYPE_EDGE_RISING (0x03)
113#define S5P_IRQ_TYPE_EDGE_BOTH (0x04)
114
97#endif /* __ASM_PLAT_S5P_IRQS_H */ 115#endif /* __ASM_PLAT_S5P_IRQS_H */
diff --git a/arch/arm/plat-s5p/include/plat/map-s5p.h b/arch/arm/plat-s5p/include/plat/map-s5p.h
index c4ff88bf6477..fef353d44513 100644
--- a/arch/arm/plat-s5p/include/plat/map-s5p.h
+++ b/arch/arm/plat-s5p/include/plat/map-s5p.h
@@ -13,24 +13,38 @@
13#ifndef __ASM_PLAT_MAP_S5P_H 13#ifndef __ASM_PLAT_MAP_S5P_H
14#define __ASM_PLAT_MAP_S5P_H __FILE__ 14#define __ASM_PLAT_MAP_S5P_H __FILE__
15 15
16#define S5P_VA_CHIPID S3C_ADDR(0x00700000) 16#define S5P_VA_CHIPID S3C_ADDR(0x02000000)
17#define S5P_VA_GPIO S3C_ADDR(0x00500000) 17#define S5P_VA_CMU S3C_ADDR(0x02100000)
18#define S5P_VA_SYSTIMER S3C_ADDR(0x01200000) 18#define S5P_VA_GPIO S3C_ADDR(0x02200000)
19#define S5P_VA_SROMC S3C_ADDR(0x01100000) 19#define S5P_VA_GPIO1 S5P_VA_GPIO
20#define S5P_VA_SYSRAM S3C_ADDR(0x01180000) 20#define S5P_VA_GPIO2 S3C_ADDR(0x02240000)
21 21#define S5P_VA_GPIO3 S3C_ADDR(0x02280000)
22#define S5P_VA_COMBINER_BASE S3C_ADDR(0x00600000) 22
23#define S5P_VA_SYSRAM S3C_ADDR(0x02400000)
24#define S5P_VA_DMC0 S3C_ADDR(0x02440000)
25#define S5P_VA_DMC1 S3C_ADDR(0x02480000)
26#define S5P_VA_SROMC S3C_ADDR(0x024C0000)
27
28#define S5P_VA_SYSTIMER S3C_ADDR(0x02500000)
29#define S5P_VA_L2CC S3C_ADDR(0x02600000)
30
31#define S5P_VA_COMBINER_BASE S3C_ADDR(0x02700000)
23#define S5P_VA_COMBINER(x) (S5P_VA_COMBINER_BASE + ((x) >> 2) * 0x10) 32#define S5P_VA_COMBINER(x) (S5P_VA_COMBINER_BASE + ((x) >> 2) * 0x10)
24 33
25#define S5P_VA_COREPERI_BASE S3C_ADDR(0x00800000) 34#define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000)
26#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x)) 35#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x))
27#define S5P_VA_SCU S5P_VA_COREPERI(0x0) 36#define S5P_VA_SCU S5P_VA_COREPERI(0x0)
28#define S5P_VA_GIC_CPU S5P_VA_COREPERI(0x100) 37#define S5P_VA_GIC_CPU S5P_VA_COREPERI(0x100)
29#define S5P_VA_TWD S5P_VA_COREPERI(0x600) 38#define S5P_VA_TWD S5P_VA_COREPERI(0x600)
30#define S5P_VA_GIC_DIST S5P_VA_COREPERI(0x1000) 39#define S5P_VA_GIC_DIST S5P_VA_COREPERI(0x1000)
31 40
32#define S5P_VA_L2CC S3C_ADDR(0x00900000) 41#define S3C_VA_USB_HSPHY S3C_ADDR(0x02900000)
33#define S5P_VA_CMU S3C_ADDR(0x00920000) 42
43#define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000))
44#define VA_VIC0 VA_VIC(0)
45#define VA_VIC1 VA_VIC(1)
46#define VA_VIC2 VA_VIC(2)
47#define VA_VIC3 VA_VIC(3)
34 48
35#define S5P_VA_UART(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET)) 49#define S5P_VA_UART(x) (S3C_VA_UART + ((x) * S3C_UART_OFFSET))
36#define S5P_VA_UART0 S5P_VA_UART(0) 50#define S5P_VA_UART0 S5P_VA_UART(0)
@@ -42,10 +56,4 @@
42#define S3C_UART_OFFSET (0x400) 56#define S3C_UART_OFFSET (0x400)
43#endif 57#endif
44 58
45#define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000))
46#define VA_VIC0 VA_VIC(0)
47#define VA_VIC1 VA_VIC(1)
48#define VA_VIC2 VA_VIC(2)
49#define VA_VIC3 VA_VIC(3)
50
51#endif /* __ASM_PLAT_MAP_S5P_H */ 59#endif /* __ASM_PLAT_MAP_S5P_H */
diff --git a/arch/arm/plat-s5p/include/plat/s5p-clock.h b/arch/arm/plat-s5p/include/plat/s5p-clock.h
index 17036c898409..2b6dcff8ab2b 100644
--- a/arch/arm/plat-s5p/include/plat/s5p-clock.h
+++ b/arch/arm/plat-s5p/include/plat/s5p-clock.h
@@ -43,4 +43,8 @@ extern struct clksrc_sources clk_src_dpll;
43 43
44extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable); 44extern int s5p_gatectrl(void __iomem *reg, struct clk *clk, int enable);
45 45
46/* Common EPLL operations for S5P platform */
47extern int s5p_epll_enable(struct clk *clk, int enable);
48extern unsigned long s5p_epll_get_rate(struct clk *clk);
49
46#endif /* __ASM_PLAT_S5P_CLOCK_H */ 50#endif /* __ASM_PLAT_S5P_CLOCK_H */
diff --git a/arch/arm/plat-s5p/irq-eint.c b/arch/arm/plat-s5p/irq-eint.c
index f36cd3327025..752f1a645f9d 100644
--- a/arch/arm/plat-s5p/irq-eint.c
+++ b/arch/arm/plat-s5p/irq-eint.c
@@ -67,23 +67,23 @@ static int s5p_irq_eint_set_type(unsigned int irq, unsigned int type)
67 67
68 switch (type) { 68 switch (type) {
69 case IRQ_TYPE_EDGE_RISING: 69 case IRQ_TYPE_EDGE_RISING:
70 newvalue = S5P_EXTINT_RISEEDGE; 70 newvalue = S5P_IRQ_TYPE_EDGE_RISING;
71 break; 71 break;
72 72
73 case IRQ_TYPE_EDGE_FALLING: 73 case IRQ_TYPE_EDGE_FALLING:
74 newvalue = S5P_EXTINT_FALLEDGE; 74 newvalue = S5P_IRQ_TYPE_EDGE_FALLING;
75 break; 75 break;
76 76
77 case IRQ_TYPE_EDGE_BOTH: 77 case IRQ_TYPE_EDGE_BOTH:
78 newvalue = S5P_EXTINT_BOTHEDGE; 78 newvalue = S5P_IRQ_TYPE_EDGE_BOTH;
79 break; 79 break;
80 80
81 case IRQ_TYPE_LEVEL_LOW: 81 case IRQ_TYPE_LEVEL_LOW:
82 newvalue = S5P_EXTINT_LOWLEV; 82 newvalue = S5P_IRQ_TYPE_LEVEL_LOW;
83 break; 83 break;
84 84
85 case IRQ_TYPE_LEVEL_HIGH: 85 case IRQ_TYPE_LEVEL_HIGH:
86 newvalue = S5P_EXTINT_HILEV; 86 newvalue = S5P_IRQ_TYPE_LEVEL_HIGH;
87 break; 87 break;
88 88
89 default: 89 default:
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
new file mode 100644
index 000000000000..0e5dc8cbf5e3
--- /dev/null
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -0,0 +1,237 @@
1/* linux/arch/arm/plat-s5p/irq-gpioint.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * Author: Kyungmin Park <kyungmin.park@samsung.com>
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 * Author: Marek Szyprowski <m.szyprowski@samsung.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 */
14
15#include <linux/kernel.h>
16#include <linux/interrupt.h>
17#include <linux/irq.h>
18#include <linux/io.h>
19#include <linux/gpio.h>
20
21#include <mach/map.h>
22#include <plat/gpio-core.h>
23#include <plat/gpio-cfg.h>
24
25#define S5P_GPIOREG(x) (S5P_VA_GPIO + (x))
26
27#define GPIOINT_CON_OFFSET 0x700
28#define GPIOINT_MASK_OFFSET 0x900
29#define GPIOINT_PEND_OFFSET 0xA00
30
31static struct s3c_gpio_chip *irq_chips[S5P_GPIOINT_GROUP_MAXNR];
32
33static int s5p_gpioint_get_group(unsigned int irq)
34{
35 struct gpio_chip *chip = get_irq_data(irq);
36 struct s3c_gpio_chip *s3c_chip = container_of(chip,
37 struct s3c_gpio_chip, chip);
38 int group;
39
40 for (group = 0; group < S5P_GPIOINT_GROUP_MAXNR; group++)
41 if (s3c_chip == irq_chips[group])
42 break;
43
44 return group;
45}
46
47static int s5p_gpioint_get_offset(unsigned int irq)
48{
49 struct gpio_chip *chip = get_irq_data(irq);
50 struct s3c_gpio_chip *s3c_chip = container_of(chip,
51 struct s3c_gpio_chip, chip);
52
53 return irq - s3c_chip->irq_base;
54}
55
56static void s5p_gpioint_ack(unsigned int irq)
57{
58 int group, offset, pend_offset;
59 unsigned int value;
60
61 group = s5p_gpioint_get_group(irq);
62 offset = s5p_gpioint_get_offset(irq);
63 pend_offset = group << 2;
64
65 value = __raw_readl(S5P_GPIOREG(GPIOINT_PEND_OFFSET) + pend_offset);
66 value |= 1 << offset;
67 __raw_writel(value, S5P_GPIOREG(GPIOINT_PEND_OFFSET) + pend_offset);
68}
69
70static void s5p_gpioint_mask(unsigned int irq)
71{
72 int group, offset, mask_offset;
73 unsigned int value;
74
75 group = s5p_gpioint_get_group(irq);
76 offset = s5p_gpioint_get_offset(irq);
77 mask_offset = group << 2;
78
79 value = __raw_readl(S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset);
80 value |= 1 << offset;
81 __raw_writel(value, S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset);
82}
83
84static void s5p_gpioint_unmask(unsigned int irq)
85{
86 int group, offset, mask_offset;
87 unsigned int value;
88
89 group = s5p_gpioint_get_group(irq);
90 offset = s5p_gpioint_get_offset(irq);
91 mask_offset = group << 2;
92
93 value = __raw_readl(S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset);
94 value &= ~(1 << offset);
95 __raw_writel(value, S5P_GPIOREG(GPIOINT_MASK_OFFSET) + mask_offset);
96}
97
98static void s5p_gpioint_mask_ack(unsigned int irq)
99{
100 s5p_gpioint_mask(irq);
101 s5p_gpioint_ack(irq);
102}
103
104static int s5p_gpioint_set_type(unsigned int irq, unsigned int type)
105{
106 int group, offset, con_offset;
107 unsigned int value;
108
109 group = s5p_gpioint_get_group(irq);
110 offset = s5p_gpioint_get_offset(irq);
111 con_offset = group << 2;
112
113 switch (type) {
114 case IRQ_TYPE_EDGE_RISING:
115 type = S5P_IRQ_TYPE_EDGE_RISING;
116 break;
117 case IRQ_TYPE_EDGE_FALLING:
118 type = S5P_IRQ_TYPE_EDGE_FALLING;
119 break;
120 case IRQ_TYPE_EDGE_BOTH:
121 type = S5P_IRQ_TYPE_EDGE_BOTH;
122 break;
123 case IRQ_TYPE_LEVEL_HIGH:
124 type = S5P_IRQ_TYPE_LEVEL_HIGH;
125 break;
126 case IRQ_TYPE_LEVEL_LOW:
127 type = S5P_IRQ_TYPE_LEVEL_LOW;
128 break;
129 case IRQ_TYPE_NONE:
130 default:
131 printk(KERN_WARNING "No irq type\n");
132 return -EINVAL;
133 }
134
135 value = __raw_readl(S5P_GPIOREG(GPIOINT_CON_OFFSET) + con_offset);
136 value &= ~(0x7 << (offset * 0x4));
137 value |= (type << (offset * 0x4));
138 __raw_writel(value, S5P_GPIOREG(GPIOINT_CON_OFFSET) + con_offset);
139
140 return 0;
141}
142
143struct irq_chip s5p_gpioint = {
144 .name = "s5p_gpioint",
145 .ack = s5p_gpioint_ack,
146 .mask = s5p_gpioint_mask,
147 .mask_ack = s5p_gpioint_mask_ack,
148 .unmask = s5p_gpioint_unmask,
149 .set_type = s5p_gpioint_set_type,
150};
151
152static void s5p_gpioint_handler(unsigned int irq, struct irq_desc *desc)
153{
154 int group, offset, pend_offset, mask_offset;
155 int real_irq;
156 unsigned int pend, mask;
157
158 for (group = 0; group < S5P_GPIOINT_GROUP_MAXNR; group++) {
159 pend_offset = group << 2;
160 pend = __raw_readl(S5P_GPIOREG(GPIOINT_PEND_OFFSET) +
161 pend_offset);
162 if (!pend)
163 continue;
164
165 mask_offset = group << 2;
166 mask = __raw_readl(S5P_GPIOREG(GPIOINT_MASK_OFFSET) +
167 mask_offset);
168 pend &= ~mask;
169
170 for (offset = 0; offset < 8; offset++) {
171 if (pend & (1 << offset)) {
172 struct s3c_gpio_chip *chip = irq_chips[group];
173 if (chip) {
174 real_irq = chip->irq_base + offset;
175 generic_handle_irq(real_irq);
176 }
177 }
178 }
179 }
180}
181
182static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
183{
184 static int used_gpioint_groups = 0;
185 static bool handler_registered = 0;
186 int irq, group = chip->group;
187 int i;
188
189 if (used_gpioint_groups >= S5P_GPIOINT_GROUP_COUNT)
190 return -ENOMEM;
191
192 chip->irq_base = S5P_GPIOINT_BASE +
193 used_gpioint_groups * S5P_GPIOINT_GROUP_SIZE;
194 used_gpioint_groups++;
195
196 if (!handler_registered) {
197 set_irq_chained_handler(IRQ_GPIOINT, s5p_gpioint_handler);
198 handler_registered = 1;
199 }
200
201 irq_chips[group] = chip;
202 for (i = 0; i < chip->chip.ngpio; i++) {
203 irq = chip->irq_base + i;
204 set_irq_chip(irq, &s5p_gpioint);
205 set_irq_data(irq, &chip->chip);
206 set_irq_handler(irq, handle_level_irq);
207 set_irq_flags(irq, IRQF_VALID);
208 }
209 return 0;
210}
211
212int __init s5p_register_gpio_interrupt(int pin)
213{
214 struct s3c_gpio_chip *my_chip = s3c_gpiolib_getchip(pin);
215 int offset, group;
216 int ret;
217
218 if (!my_chip)
219 return -EINVAL;
220
221 offset = pin - my_chip->chip.base;
222 group = my_chip->group;
223
224 /* check if the group has been already registered */
225 if (my_chip->irq_base)
226 return my_chip->irq_base + offset;
227
228 /* register gpio group */
229 ret = s5p_gpioint_add(my_chip);
230 if (ret == 0) {
231 my_chip->chip.to_irq = samsung_gpiolib_to_irq;
232 printk(KERN_INFO "Registered interrupt support for gpio group %d.\n",
233 group);
234 return my_chip->irq_base + offset;
235 }
236 return ret;
237}
diff --git a/arch/arm/plat-s5p/irq-pm.c b/arch/arm/plat-s5p/irq-pm.c
new file mode 100644
index 000000000000..dc33b9ecda45
--- /dev/null
+++ b/arch/arm/plat-s5p/irq-pm.c
@@ -0,0 +1,93 @@
1/* linux/arch/arm/plat-s5p/irq-pm.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * Based on arch/arm/plat-s3c24xx/irq-pm.c,
7 * Copyright (c) 2003,2004 Simtec Electronics
8 * Ben Dooks <ben@simtec.co.uk>
9 * http://armlinux.simtec.co.uk/
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14*/
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/interrupt.h>
19#include <linux/sysdev.h>
20
21#include <plat/cpu.h>
22#include <plat/irqs.h>
23#include <plat/pm.h>
24#include <mach/map.h>
25
26#include <mach/regs-gpio.h>
27#include <mach/regs-irq.h>
28
29/* state for IRQs over sleep */
30
31/* default is to allow for EINT0..EINT31, and IRQ_RTC_TIC, IRQ_RTC_ALARM,
32 * as wakeup sources
33 *
34 * set bit to 1 in allow bitfield to enable the wakeup settings on it
35*/
36
37unsigned long s3c_irqwake_intallow = 0x00000006L;
38unsigned long s3c_irqwake_eintallow = 0xffffffffL;
39
40int s3c_irq_wake(unsigned int irqno, unsigned int state)
41{
42 unsigned long irqbit;
43
44 switch (irqno) {
45 case IRQ_RTC_TIC:
46 case IRQ_RTC_ALARM:
47 irqbit = 1 << (irqno + 1 - IRQ_RTC_ALARM);
48 if (!state)
49 s3c_irqwake_intmask |= irqbit;
50 else
51 s3c_irqwake_intmask &= ~irqbit;
52 break;
53 default:
54 return -ENOENT;
55 }
56 return 0;
57}
58
59static struct sleep_save eint_save[] = {
60 SAVE_ITEM(S5P_EINT_CON(0)),
61 SAVE_ITEM(S5P_EINT_CON(1)),
62 SAVE_ITEM(S5P_EINT_CON(2)),
63 SAVE_ITEM(S5P_EINT_CON(3)),
64
65 SAVE_ITEM(S5P_EINT_FLTCON(0)),
66 SAVE_ITEM(S5P_EINT_FLTCON(1)),
67 SAVE_ITEM(S5P_EINT_FLTCON(2)),
68 SAVE_ITEM(S5P_EINT_FLTCON(3)),
69 SAVE_ITEM(S5P_EINT_FLTCON(4)),
70 SAVE_ITEM(S5P_EINT_FLTCON(5)),
71 SAVE_ITEM(S5P_EINT_FLTCON(6)),
72 SAVE_ITEM(S5P_EINT_FLTCON(7)),
73
74 SAVE_ITEM(S5P_EINT_MASK(0)),
75 SAVE_ITEM(S5P_EINT_MASK(1)),
76 SAVE_ITEM(S5P_EINT_MASK(2)),
77 SAVE_ITEM(S5P_EINT_MASK(3)),
78};
79
80int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
81{
82 s3c_pm_do_save(eint_save, ARRAY_SIZE(eint_save));
83
84 return 0;
85}
86
87int s3c24xx_irq_resume(struct sys_device *dev)
88{
89 s3c_pm_do_restore(eint_save, ARRAY_SIZE(eint_save));
90
91 return 0;
92}
93
diff --git a/arch/arm/plat-s5p/pm.c b/arch/arm/plat-s5p/pm.c
new file mode 100644
index 000000000000..d592b6304b48
--- /dev/null
+++ b/arch/arm/plat-s5p/pm.c
@@ -0,0 +1,52 @@
1/* linux/arch/arm/plat-s5p/pm.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
5 *
6 * S5P Power Manager (Suspend-To-RAM) support
7 *
8 * Based on arch/arm/plat-s3c24xx/pm.c
9 * Copyright (c) 2004,2006 Simtec Electronics
10 * Ben Dooks <ben@simtec.co.uk>
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/suspend.h>
18#include <plat/pm.h>
19
20#define PFX "s5p pm: "
21
22/* s3c_pm_check_resume_pin
23 *
24 * check to see if the pin is configured correctly for sleep mode, and
25 * make any necessary adjustments if it is not
26*/
27
28static void s3c_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
29{
30 /* nothing here yet */
31}
32
33/* s3c_pm_configure_extint
34 *
35 * configure all external interrupt pins
36*/
37
38void s3c_pm_configure_extint(void)
39{
40 /* nothing here yet */
41}
42
43void s3c_pm_restore_core(void)
44{
45 /* nothing here yet */
46}
47
48void s3c_pm_save_core(void)
49{
50 /* nothing here yet */
51}
52
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 7c0bde781167..dcd6eff4ee53 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -180,6 +180,31 @@ config S3C_DEV_I2C2
180 help 180 help
181 Compile in platform device definitions for I2C channel 2 181 Compile in platform device definitions for I2C channel 2
182 182
183config S3C_DEV_I2C3
184 bool
185 help
186 Compile in platform device definition for I2C controller 3
187
188config S3C_DEV_I2C4
189 bool
190 help
191 Compile in platform device definition for I2C controller 4
192
193config S3C_DEV_I2C5
194 bool
195 help
196 Compile in platform device definition for I2C controller 5
197
198config S3C_DEV_I2C6
199 bool
200 help
201 Compile in platform device definition for I2C controller 6
202
203config S3C_DEV_I2C7
204 bool
205 help
206 Compile in platform device definition for I2C controller 7
207
183config S3C_DEV_FB 208config S3C_DEV_FB
184 bool 209 bool
185 help 210 help
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 4d8ff923207a..afcce474af8e 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -40,6 +40,11 @@ obj-$(CONFIG_S3C_DEV_HWMON) += dev-hwmon.o
40obj-y += dev-i2c0.o 40obj-y += dev-i2c0.o
41obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o 41obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o
42obj-$(CONFIG_S3C_DEV_I2C2) += dev-i2c2.o 42obj-$(CONFIG_S3C_DEV_I2C2) += dev-i2c2.o
43obj-$(CONFIG_S3C_DEV_I2C3) += dev-i2c3.o
44obj-$(CONFIG_S3C_DEV_I2C4) += dev-i2c4.o
45obj-$(CONFIG_S3C_DEV_I2C5) += dev-i2c5.o
46obj-$(CONFIG_S3C_DEV_I2C6) += dev-i2c6.o
47obj-$(CONFIG_S3C_DEV_I2C7) += dev-i2c7.o
43obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o 48obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o
44obj-y += dev-uart.o 49obj-y += dev-uart.o
45obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o 50obj-$(CONFIG_S3C_DEV_USB_HOST) += dev-usb.o
diff --git a/arch/arm/plat-samsung/dev-hsmmc.c b/arch/arm/plat-samsung/dev-hsmmc.c
index 9d2be0941410..db7a65c7f127 100644
--- a/arch/arm/plat-samsung/dev-hsmmc.c
+++ b/arch/arm/plat-samsung/dev-hsmmc.c
@@ -41,6 +41,7 @@ struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata = {
41 .max_width = 4, 41 .max_width = 4,
42 .host_caps = (MMC_CAP_4_BIT_DATA | 42 .host_caps = (MMC_CAP_4_BIT_DATA |
43 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 43 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
44 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
44}; 45};
45 46
46struct platform_device s3c_device_hsmmc0 = { 47struct platform_device s3c_device_hsmmc0 = {
@@ -59,17 +60,20 @@ void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd)
59{ 60{
60 struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata; 61 struct s3c_sdhci_platdata *set = &s3c_hsmmc0_def_platdata;
61 62
62 set->max_width = pd->max_width;
63 set->cd_type = pd->cd_type; 63 set->cd_type = pd->cd_type;
64 set->ext_cd_init = pd->ext_cd_init; 64 set->ext_cd_init = pd->ext_cd_init;
65 set->ext_cd_cleanup = pd->ext_cd_cleanup; 65 set->ext_cd_cleanup = pd->ext_cd_cleanup;
66 set->ext_cd_gpio = pd->ext_cd_gpio; 66 set->ext_cd_gpio = pd->ext_cd_gpio;
67 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; 67 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
68 68
69 if (pd->max_width)
70 set->max_width = pd->max_width;
69 if (pd->cfg_gpio) 71 if (pd->cfg_gpio)
70 set->cfg_gpio = pd->cfg_gpio; 72 set->cfg_gpio = pd->cfg_gpio;
71 if (pd->cfg_card) 73 if (pd->cfg_card)
72 set->cfg_card = pd->cfg_card; 74 set->cfg_card = pd->cfg_card;
73 if (pd->host_caps) 75 if (pd->host_caps)
74 set->host_caps = pd->host_caps; 76 set->host_caps |= pd->host_caps;
77 if (pd->clk_type)
78 set->clk_type = pd->clk_type;
75} 79}
diff --git a/arch/arm/plat-samsung/dev-hsmmc1.c b/arch/arm/plat-samsung/dev-hsmmc1.c
index a6c8295840af..2497321f08d7 100644
--- a/arch/arm/plat-samsung/dev-hsmmc1.c
+++ b/arch/arm/plat-samsung/dev-hsmmc1.c
@@ -41,6 +41,7 @@ struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata = {
41 .max_width = 4, 41 .max_width = 4,
42 .host_caps = (MMC_CAP_4_BIT_DATA | 42 .host_caps = (MMC_CAP_4_BIT_DATA |
43 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 43 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
44 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
44}; 45};
45 46
46struct platform_device s3c_device_hsmmc1 = { 47struct platform_device s3c_device_hsmmc1 = {
@@ -59,17 +60,20 @@ void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd)
59{ 60{
60 struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata; 61 struct s3c_sdhci_platdata *set = &s3c_hsmmc1_def_platdata;
61 62
62 set->max_width = pd->max_width;
63 set->cd_type = pd->cd_type; 63 set->cd_type = pd->cd_type;
64 set->ext_cd_init = pd->ext_cd_init; 64 set->ext_cd_init = pd->ext_cd_init;
65 set->ext_cd_cleanup = pd->ext_cd_cleanup; 65 set->ext_cd_cleanup = pd->ext_cd_cleanup;
66 set->ext_cd_gpio = pd->ext_cd_gpio; 66 set->ext_cd_gpio = pd->ext_cd_gpio;
67 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; 67 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
68 68
69 if (pd->max_width)
70 set->max_width = pd->max_width;
69 if (pd->cfg_gpio) 71 if (pd->cfg_gpio)
70 set->cfg_gpio = pd->cfg_gpio; 72 set->cfg_gpio = pd->cfg_gpio;
71 if (pd->cfg_card) 73 if (pd->cfg_card)
72 set->cfg_card = pd->cfg_card; 74 set->cfg_card = pd->cfg_card;
73 if (pd->host_caps) 75 if (pd->host_caps)
74 set->host_caps = pd->host_caps; 76 set->host_caps |= pd->host_caps;
77 if (pd->clk_type)
78 set->clk_type = pd->clk_type;
75} 79}
diff --git a/arch/arm/plat-samsung/dev-hsmmc2.c b/arch/arm/plat-samsung/dev-hsmmc2.c
index cb0d7143381a..f60aedba417c 100644
--- a/arch/arm/plat-samsung/dev-hsmmc2.c
+++ b/arch/arm/plat-samsung/dev-hsmmc2.c
@@ -42,6 +42,7 @@ struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = {
42 .max_width = 4, 42 .max_width = 4,
43 .host_caps = (MMC_CAP_4_BIT_DATA | 43 .host_caps = (MMC_CAP_4_BIT_DATA |
44 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 44 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
45 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
45}; 46};
46 47
47struct platform_device s3c_device_hsmmc2 = { 48struct platform_device s3c_device_hsmmc2 = {
@@ -60,17 +61,20 @@ void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd)
60{ 61{
61 struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata; 62 struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata;
62 63
63 set->max_width = pd->max_width;
64 set->cd_type = pd->cd_type; 64 set->cd_type = pd->cd_type;
65 set->ext_cd_init = pd->ext_cd_init; 65 set->ext_cd_init = pd->ext_cd_init;
66 set->ext_cd_cleanup = pd->ext_cd_cleanup; 66 set->ext_cd_cleanup = pd->ext_cd_cleanup;
67 set->ext_cd_gpio = pd->ext_cd_gpio; 67 set->ext_cd_gpio = pd->ext_cd_gpio;
68 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; 68 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
69 69
70 if (pd->max_width)
71 set->max_width = pd->max_width;
70 if (pd->cfg_gpio) 72 if (pd->cfg_gpio)
71 set->cfg_gpio = pd->cfg_gpio; 73 set->cfg_gpio = pd->cfg_gpio;
72 if (pd->cfg_card) 74 if (pd->cfg_card)
73 set->cfg_card = pd->cfg_card; 75 set->cfg_card = pd->cfg_card;
74 if (pd->host_caps) 76 if (pd->host_caps)
75 set->host_caps = pd->host_caps; 77 set->host_caps |= pd->host_caps;
78 if (pd->clk_type)
79 set->clk_type = pd->clk_type;
76} 80}
diff --git a/arch/arm/plat-samsung/dev-hsmmc3.c b/arch/arm/plat-samsung/dev-hsmmc3.c
index 85aaf0f2842f..ede776f20e62 100644
--- a/arch/arm/plat-samsung/dev-hsmmc3.c
+++ b/arch/arm/plat-samsung/dev-hsmmc3.c
@@ -33,8 +33,8 @@ static struct resource s3c_hsmmc3_resource[] = {
33 .flags = IORESOURCE_MEM, 33 .flags = IORESOURCE_MEM,
34 }, 34 },
35 [1] = { 35 [1] = {
36 .start = IRQ_MMC3, 36 .start = IRQ_HSMMC3,
37 .end = IRQ_MMC3, 37 .end = IRQ_HSMMC3,
38 .flags = IORESOURCE_IRQ, 38 .flags = IORESOURCE_IRQ,
39 } 39 }
40}; 40};
@@ -45,6 +45,7 @@ struct s3c_sdhci_platdata s3c_hsmmc3_def_platdata = {
45 .max_width = 4, 45 .max_width = 4,
46 .host_caps = (MMC_CAP_4_BIT_DATA | 46 .host_caps = (MMC_CAP_4_BIT_DATA |
47 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), 47 MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
48 .clk_type = S3C_SDHCI_CLK_DIV_INTERNAL,
48}; 49};
49 50
50struct platform_device s3c_device_hsmmc3 = { 51struct platform_device s3c_device_hsmmc3 = {
@@ -63,15 +64,20 @@ void s3c_sdhci3_set_platdata(struct s3c_sdhci_platdata *pd)
63{ 64{
64 struct s3c_sdhci_platdata *set = &s3c_hsmmc3_def_platdata; 65 struct s3c_sdhci_platdata *set = &s3c_hsmmc3_def_platdata;
65 66
66 set->max_width = pd->max_width;
67 set->cd_type = pd->cd_type; 67 set->cd_type = pd->cd_type;
68 set->ext_cd_init = pd->ext_cd_init; 68 set->ext_cd_init = pd->ext_cd_init;
69 set->ext_cd_cleanup = pd->ext_cd_cleanup; 69 set->ext_cd_cleanup = pd->ext_cd_cleanup;
70 set->ext_cd_gpio = pd->ext_cd_gpio; 70 set->ext_cd_gpio = pd->ext_cd_gpio;
71 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert; 71 set->ext_cd_gpio_invert = pd->ext_cd_gpio_invert;
72 72
73 if (pd->max_width)
74 set->max_width = pd->max_width;
73 if (pd->cfg_gpio) 75 if (pd->cfg_gpio)
74 set->cfg_gpio = pd->cfg_gpio; 76 set->cfg_gpio = pd->cfg_gpio;
75 if (pd->cfg_card) 77 if (pd->cfg_card)
76 set->cfg_card = pd->cfg_card; 78 set->cfg_card = pd->cfg_card;
79 if (pd->host_caps)
80 set->host_caps |= pd->host_caps;
81 if (pd->clk_type)
82 set->clk_type = pd->clk_type;
77} 83}
diff --git a/arch/arm/plat-samsung/dev-i2c2.c b/arch/arm/plat-samsung/dev-i2c2.c
index 07036dee09e7..ff4ba69b6830 100644
--- a/arch/arm/plat-samsung/dev-i2c2.c
+++ b/arch/arm/plat-samsung/dev-i2c2.c
@@ -32,8 +32,8 @@ static struct resource s3c_i2c_resource[] = {
32 .flags = IORESOURCE_MEM, 32 .flags = IORESOURCE_MEM,
33 }, 33 },
34 [1] = { 34 [1] = {
35 .start = IRQ_CAN0, 35 .start = IRQ_IIC2,
36 .end = IRQ_CAN0, 36 .end = IRQ_IIC2,
37 .flags = IORESOURCE_IRQ, 37 .flags = IORESOURCE_IRQ,
38 }, 38 },
39}; 39};
diff --git a/arch/arm/plat-samsung/dev-i2c3.c b/arch/arm/plat-samsung/dev-i2c3.c
new file mode 100644
index 000000000000..8586a10014b7
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c3.c
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-samsung/dev-i2c3.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P series device definition for i2c device 3
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/gfp.h>
14#include <linux/kernel.h>
15#include <linux/string.h>
16#include <linux/platform_device.h>
17
18#include <mach/irqs.h>
19#include <mach/map.h>
20
21#include <plat/regs-iic.h>
22#include <plat/iic.h>
23#include <plat/devs.h>
24#include <plat/cpu.h>
25
26static struct resource s3c_i2c_resource[] = {
27 [0] = {
28 .start = S3C_PA_IIC3,
29 .end = S3C_PA_IIC3 + SZ_4K - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_IIC3,
34 .end = IRQ_IIC3,
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39struct platform_device s3c_device_i2c3 = {
40 .name = "s3c2440-i2c",
41 .id = 3,
42 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
43 .resource = s3c_i2c_resource,
44};
45
46static struct s3c2410_platform_i2c default_i2c_data3 __initdata = {
47 .flags = 0,
48 .bus_num = 3,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *pd)
55{
56 struct s3c2410_platform_i2c *npd;
57
58 if (!pd)
59 pd = &default_i2c_data3;
60
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
62 if (!npd)
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c3_cfg_gpio;
66
67 s3c_device_i2c3.dev.platform_data = npd;
68}
diff --git a/arch/arm/plat-samsung/dev-i2c4.c b/arch/arm/plat-samsung/dev-i2c4.c
new file mode 100644
index 000000000000..df2159e2daa6
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c4.c
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-samsung/dev-i2c4.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P series device definition for i2c device 3
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/gfp.h>
14#include <linux/kernel.h>
15#include <linux/string.h>
16#include <linux/platform_device.h>
17
18#include <mach/irqs.h>
19#include <mach/map.h>
20
21#include <plat/regs-iic.h>
22#include <plat/iic.h>
23#include <plat/devs.h>
24#include <plat/cpu.h>
25
26static struct resource s3c_i2c_resource[] = {
27 [0] = {
28 .start = S3C_PA_IIC4,
29 .end = S3C_PA_IIC4 + SZ_4K - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_IIC4,
34 .end = IRQ_IIC4,
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39struct platform_device s3c_device_i2c4 = {
40 .name = "s3c2440-i2c",
41 .id = 4,
42 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
43 .resource = s3c_i2c_resource,
44};
45
46static struct s3c2410_platform_i2c default_i2c_data4 __initdata = {
47 .flags = 0,
48 .bus_num = 4,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *pd)
55{
56 struct s3c2410_platform_i2c *npd;
57
58 if (!pd)
59 pd = &default_i2c_data4;
60
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
62 if (!npd)
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c4_cfg_gpio;
66
67 s3c_device_i2c4.dev.platform_data = npd;
68}
diff --git a/arch/arm/plat-samsung/dev-i2c5.c b/arch/arm/plat-samsung/dev-i2c5.c
new file mode 100644
index 000000000000..0499c2c3877b
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c5.c
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-samsung/dev-i2c3.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P series device definition for i2c device 3
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/gfp.h>
14#include <linux/kernel.h>
15#include <linux/string.h>
16#include <linux/platform_device.h>
17
18#include <mach/irqs.h>
19#include <mach/map.h>
20
21#include <plat/regs-iic.h>
22#include <plat/iic.h>
23#include <plat/devs.h>
24#include <plat/cpu.h>
25
26static struct resource s3c_i2c_resource[] = {
27 [0] = {
28 .start = S3C_PA_IIC5,
29 .end = S3C_PA_IIC5 + SZ_4K - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_IIC5,
34 .end = IRQ_IIC5,
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39struct platform_device s3c_device_i2c5 = {
40 .name = "s3c2440-i2c",
41 .id = 5,
42 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
43 .resource = s3c_i2c_resource,
44};
45
46static struct s3c2410_platform_i2c default_i2c_data5 __initdata = {
47 .flags = 0,
48 .bus_num = 5,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *pd)
55{
56 struct s3c2410_platform_i2c *npd;
57
58 if (!pd)
59 pd = &default_i2c_data5;
60
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
62 if (!npd)
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c5_cfg_gpio;
66
67 s3c_device_i2c5.dev.platform_data = npd;
68}
diff --git a/arch/arm/plat-samsung/dev-i2c6.c b/arch/arm/plat-samsung/dev-i2c6.c
new file mode 100644
index 000000000000..4083108908a8
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c6.c
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-samsung/dev-i2c6.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P series device definition for i2c device 6
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/gfp.h>
14#include <linux/kernel.h>
15#include <linux/string.h>
16#include <linux/platform_device.h>
17
18#include <mach/irqs.h>
19#include <mach/map.h>
20
21#include <plat/regs-iic.h>
22#include <plat/iic.h>
23#include <plat/devs.h>
24#include <plat/cpu.h>
25
26static struct resource s3c_i2c_resource[] = {
27 [0] = {
28 .start = S3C_PA_IIC6,
29 .end = S3C_PA_IIC6 + SZ_4K - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_IIC6,
34 .end = IRQ_IIC6,
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39struct platform_device s3c_device_i2c6 = {
40 .name = "s3c2440-i2c",
41 .id = 6,
42 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
43 .resource = s3c_i2c_resource,
44};
45
46static struct s3c2410_platform_i2c default_i2c_data6 __initdata = {
47 .flags = 0,
48 .bus_num = 6,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *pd)
55{
56 struct s3c2410_platform_i2c *npd;
57
58 if (!pd)
59 pd = &default_i2c_data6;
60
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
62 if (!npd)
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c6_cfg_gpio;
66
67 s3c_device_i2c6.dev.platform_data = npd;
68}
diff --git a/arch/arm/plat-samsung/dev-i2c7.c b/arch/arm/plat-samsung/dev-i2c7.c
new file mode 100644
index 000000000000..1182451d7dce
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-i2c7.c
@@ -0,0 +1,68 @@
1/* linux/arch/arm/plat-samsung/dev-i2c7.c
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S5P series device definition for i2c device 7
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/gfp.h>
14#include <linux/kernel.h>
15#include <linux/string.h>
16#include <linux/platform_device.h>
17
18#include <mach/irqs.h>
19#include <mach/map.h>
20
21#include <plat/regs-iic.h>
22#include <plat/iic.h>
23#include <plat/devs.h>
24#include <plat/cpu.h>
25
26static struct resource s3c_i2c_resource[] = {
27 [0] = {
28 .start = S3C_PA_IIC7,
29 .end = S3C_PA_IIC7 + SZ_4K - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_IIC7,
34 .end = IRQ_IIC7,
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39struct platform_device s3c_device_i2c7 = {
40 .name = "s3c2440-i2c",
41 .id = 7,
42 .num_resources = ARRAY_SIZE(s3c_i2c_resource),
43 .resource = s3c_i2c_resource,
44};
45
46static struct s3c2410_platform_i2c default_i2c_data7 __initdata = {
47 .flags = 0,
48 .bus_num = 7,
49 .slave_addr = 0x10,
50 .frequency = 100*1000,
51 .sda_delay = 100,
52};
53
54void __init s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *pd)
55{
56 struct s3c2410_platform_i2c *npd;
57
58 if (!pd)
59 pd = &default_i2c_data7;
60
61 npd = kmemdup(pd, sizeof(struct s3c2410_platform_i2c), GFP_KERNEL);
62 if (!npd)
63 printk(KERN_ERR "%s: no memory for platform data\n", __func__);
64 else if (!npd->cfg_gpio)
65 npd->cfg_gpio = s3c_i2c7_cfg_gpio;
66
67 s3c_device_i2c7.dev.platform_data = npd;
68}
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c
index e3d41eaed1ff..b732b773b9af 100644
--- a/arch/arm/plat-samsung/gpio-config.c
+++ b/arch/arm/plat-samsung/gpio-config.c
@@ -41,6 +41,37 @@ int s3c_gpio_cfgpin(unsigned int pin, unsigned int config)
41} 41}
42EXPORT_SYMBOL(s3c_gpio_cfgpin); 42EXPORT_SYMBOL(s3c_gpio_cfgpin);
43 43
44int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
45 unsigned int cfg)
46{
47 int ret;
48
49 for (; nr > 0; nr--, start++) {
50 ret = s3c_gpio_cfgpin(start, cfg);
51 if (ret != 0)
52 return ret;
53 }
54
55 return 0;
56}
57EXPORT_SYMBOL_GPL(s3c_gpio_cfgpin_range);
58
59int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
60 unsigned int cfg, s3c_gpio_pull_t pull)
61{
62 int ret;
63
64 for (; nr > 0; nr--, start++) {
65 s3c_gpio_setpull(start, pull);
66 ret = s3c_gpio_cfgpin(start, cfg);
67 if (ret != 0)
68 return ret;
69 }
70
71 return 0;
72}
73EXPORT_SYMBOL_GPL(s3c_gpio_cfgall_range);
74
44unsigned s3c_gpio_getcfg(unsigned int pin) 75unsigned s3c_gpio_getcfg(unsigned int pin)
45{ 76{
46 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin); 77 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
@@ -80,6 +111,25 @@ int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull)
80} 111}
81EXPORT_SYMBOL(s3c_gpio_setpull); 112EXPORT_SYMBOL(s3c_gpio_setpull);
82 113
114s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin)
115{
116 struct s3c_gpio_chip *chip = s3c_gpiolib_getchip(pin);
117 unsigned long flags;
118 int offset;
119 u32 pup = 0;
120
121 if (chip) {
122 offset = pin - chip->chip.base;
123
124 s3c_gpio_lock(chip, flags);
125 pup = s3c_gpio_do_getpull(chip, offset);
126 s3c_gpio_unlock(chip, flags);
127 }
128
129 return (__force s3c_gpio_pull_t)pup;
130}
131EXPORT_SYMBOL(s3c_gpio_getpull);
132
83#ifdef CONFIG_S3C_GPIO_CFG_S3C24XX 133#ifdef CONFIG_S3C_GPIO_CFG_S3C24XX
84int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip, 134int s3c_gpio_setcfg_s3c24xx_a(struct s3c_gpio_chip *chip,
85 unsigned int off, unsigned int cfg) 135 unsigned int off, unsigned int cfg)
diff --git a/arch/arm/plat-samsung/gpio.c b/arch/arm/plat-samsung/gpio.c
index b83a83351cea..7743c4b8b2fb 100644
--- a/arch/arm/plat-samsung/gpio.c
+++ b/arch/arm/plat-samsung/gpio.c
@@ -157,3 +157,11 @@ __init void s3c_gpiolib_add(struct s3c_gpio_chip *chip)
157 if (ret >= 0) 157 if (ret >= 0)
158 s3c_gpiolib_track(chip); 158 s3c_gpiolib_track(chip);
159} 159}
160
161int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset)
162{
163 struct s3c_gpio_chip *s3c_chip = container_of(chip,
164 struct s3c_gpio_chip, chip);
165
166 return s3c_chip->irq_base + offset;
167}
diff --git a/arch/arm/plat-samsung/include/plat/audio.h b/arch/arm/plat-samsung/include/plat/audio.h
index e32f9edfd4b7..7712ff6336f4 100644
--- a/arch/arm/plat-samsung/include/plat/audio.h
+++ b/arch/arm/plat-samsung/include/plat/audio.h
@@ -16,6 +16,15 @@
16#define S3C64XX_AC97_GPE 1 16#define S3C64XX_AC97_GPE 1
17extern void s3c64xx_ac97_setup_gpio(int); 17extern void s3c64xx_ac97_setup_gpio(int);
18 18
19/*
20 * The machine init code calls s5p*_spdif_setup_gpio with
21 * one of these defines in order to select appropriate bank
22 * of GPIO for S/PDIF pins
23 */
24#define S5PC100_SPDIF_GPD 0
25#define S5PC100_SPDIF_GPG3 1
26extern void s5pc100_spdif_setup_gpio(int);
27
19/** 28/**
20 * struct s3c_audio_pdata - common platform data for audio device drivers 29 * struct s3c_audio_pdata - common platform data for audio device drivers
21 * @cfg_gpio: Callback function to setup mux'ed pins in I2S/PCM/AC97 mode 30 * @cfg_gpio: Callback function to setup mux'ed pins in I2S/PCM/AC97 mode
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index c8b94279bad1..2d82a6cb1444 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -48,6 +48,11 @@ extern struct platform_device s3c_device_wdt;
48extern struct platform_device s3c_device_i2c0; 48extern struct platform_device s3c_device_i2c0;
49extern struct platform_device s3c_device_i2c1; 49extern struct platform_device s3c_device_i2c1;
50extern struct platform_device s3c_device_i2c2; 50extern struct platform_device s3c_device_i2c2;
51extern struct platform_device s3c_device_i2c3;
52extern struct platform_device s3c_device_i2c4;
53extern struct platform_device s3c_device_i2c5;
54extern struct platform_device s3c_device_i2c6;
55extern struct platform_device s3c_device_i2c7;
51extern struct platform_device s3c_device_rtc; 56extern struct platform_device s3c_device_rtc;
52extern struct platform_device s3c_device_adc; 57extern struct platform_device s3c_device_adc;
53extern struct platform_device s3c_device_sdi; 58extern struct platform_device s3c_device_sdi;
@@ -89,6 +94,7 @@ extern struct platform_device s5pv210_device_pcm2;
89extern struct platform_device s5pv210_device_iis0; 94extern struct platform_device s5pv210_device_iis0;
90extern struct platform_device s5pv210_device_iis1; 95extern struct platform_device s5pv210_device_iis1;
91extern struct platform_device s5pv210_device_iis2; 96extern struct platform_device s5pv210_device_iis2;
97extern struct platform_device s5pv210_device_spdif;
92 98
93extern struct platform_device s5p6442_device_pcm0; 99extern struct platform_device s5p6442_device_pcm0;
94extern struct platform_device s5p6442_device_pcm1; 100extern struct platform_device s5p6442_device_pcm1;
@@ -108,6 +114,7 @@ extern struct platform_device s5pc100_device_pcm1;
108extern struct platform_device s5pc100_device_iis0; 114extern struct platform_device s5pc100_device_iis0;
109extern struct platform_device s5pc100_device_iis1; 115extern struct platform_device s5pc100_device_iis1;
110extern struct platform_device s5pc100_device_iis2; 116extern struct platform_device s5pc100_device_iis2;
117extern struct platform_device s5pc100_device_spdif;
111 118
112extern struct platform_device samsung_device_keypad; 119extern struct platform_device samsung_device_keypad;
113 120
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
index 3e21c75feefa..8fd65d8b5863 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg-helpers.h
@@ -42,6 +42,12 @@ static inline int s3c_gpio_do_setpull(struct s3c_gpio_chip *chip,
42 return (chip->config->set_pull)(chip, off, pull); 42 return (chip->config->set_pull)(chip, off, pull);
43} 43}
44 44
45static inline s3c_gpio_pull_t s3c_gpio_do_getpull(struct s3c_gpio_chip *chip,
46 unsigned int off)
47{
48 return chip->config->get_pull(chip, off);
49}
50
45/** 51/**
46 * s3c_gpio_setcfg_s3c24xx - S3C24XX style GPIO configuration. 52 * s3c_gpio_setcfg_s3c24xx - S3C24XX style GPIO configuration.
47 * @chip: The gpio chip that is being configured. 53 * @chip: The gpio chip that is being configured.
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
index 1c6b92947c5d..e4b5cf126fa9 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h
@@ -108,6 +108,19 @@ extern int s3c_gpio_cfgpin(unsigned int pin, unsigned int to);
108 */ 108 */
109extern unsigned s3c_gpio_getcfg(unsigned int pin); 109extern unsigned s3c_gpio_getcfg(unsigned int pin);
110 110
111/**
112 * s3c_gpio_cfgpin_range() - Change the GPIO function for configuring pin range
113 * @start: The pin number to start at
114 * @nr: The number of pins to configure from @start.
115 * @cfg: The configuration for the pin's function
116 *
117 * Call s3c_gpio_cfgpin() for the @nr pins starting at @start.
118 *
119 * @sa s3c_gpio_cfgpin.
120 */
121extern int s3c_gpio_cfgpin_range(unsigned int start, unsigned int nr,
122 unsigned int cfg);
123
111/* Define values for the pull-{up,down} available for each gpio pin. 124/* Define values for the pull-{up,down} available for each gpio pin.
112 * 125 *
113 * These values control the state of the weak pull-{up,down} resistors 126 * These values control the state of the weak pull-{up,down} resistors
@@ -140,6 +153,31 @@ extern int s3c_gpio_setpull(unsigned int pin, s3c_gpio_pull_t pull);
140*/ 153*/
141extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin); 154extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin);
142 155
156/* configure `all` aspects of an gpio */
157
158/**
159 * s3c_gpio_cfgall_range() - configure range of gpio functtion and pull.
160 * @start: The gpio number to start at.
161 * @nr: The number of gpio to configure from @start.
162 * @cfg: The configuration to use
163 * @pull: The pull setting to use.
164 *
165 * Run s3c_gpio_cfgpin() and s3c_gpio_setpull() over the gpio range starting
166 * @gpio and running for @size.
167 *
168 * @sa s3c_gpio_cfgpin
169 * @sa s3c_gpio_setpull
170 * @sa s3c_gpio_cfgpin_range
171 */
172extern int s3c_gpio_cfgall_range(unsigned int start, unsigned int nr,
173 unsigned int cfg, s3c_gpio_pull_t pull);
174
175static inline int s3c_gpio_cfgrange_nopull(unsigned int pin, unsigned int size,
176 unsigned int cfg)
177{
178 return s3c_gpio_cfgall_range(pin, size, cfg, S3C_GPIO_PULL_NONE);
179}
180
143/* Define values for the drvstr available for each gpio pin. 181/* Define values for the drvstr available for each gpio pin.
144 * 182 *
145 * These values control the value of the output signal driver strength, 183 * These values control the value of the output signal driver strength,
@@ -169,4 +207,22 @@ extern s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin);
169*/ 207*/
170extern int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr); 208extern int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr);
171 209
210/**
211 * s5p_register_gpio_interrupt() - register interrupt support for a gpio group
212 * @pin: The pin number from the group to be registered
213 *
214 * This function registers gpio interrupt support for the group that the
215 * specified pin belongs to.
216 *
217 * The total number of gpio pins is quite large ob s5p series. Registering
218 * irq support for all of them would be a resource waste. Because of that the
219 * interrupt support for standard gpio pins is registered dynamically.
220 *
221 * It will return the irq number of the interrupt that has been registered
222 * or -ENOMEM if no more gpio interrupts can be registered. It is allowed
223 * to call this function more than once for the same gpio group (the group
224 * will be registered only once).
225 */
226extern int s5p_register_gpio_interrupt(int pin);
227
172#endif /* __PLAT_GPIO_CFG_H */ 228#endif /* __PLAT_GPIO_CFG_H */
diff --git a/arch/arm/plat-samsung/include/plat/gpio-core.h b/arch/arm/plat-samsung/include/plat/gpio-core.h
index e358c7da8480..13a22b8861ef 100644
--- a/arch/arm/plat-samsung/include/plat/gpio-core.h
+++ b/arch/arm/plat-samsung/include/plat/gpio-core.h
@@ -43,6 +43,8 @@ struct s3c_gpio_cfg;
43 * struct s3c_gpio_chip - wrapper for specific implementation of gpio 43 * struct s3c_gpio_chip - wrapper for specific implementation of gpio
44 * @chip: The chip structure to be exported via gpiolib. 44 * @chip: The chip structure to be exported via gpiolib.
45 * @base: The base pointer to the gpio configuration registers. 45 * @base: The base pointer to the gpio configuration registers.
46 * @group: The group register number for gpio interrupt support.
47 * @irq_base: The base irq number.
46 * @config: special function and pull-resistor control information. 48 * @config: special function and pull-resistor control information.
47 * @lock: Lock for exclusive access to this gpio bank. 49 * @lock: Lock for exclusive access to this gpio bank.
48 * @pm_save: Save information for suspend/resume support. 50 * @pm_save: Save information for suspend/resume support.
@@ -63,6 +65,8 @@ struct s3c_gpio_chip {
63 struct s3c_gpio_cfg *config; 65 struct s3c_gpio_cfg *config;
64 struct s3c_gpio_pm *pm; 66 struct s3c_gpio_pm *pm;
65 void __iomem *base; 67 void __iomem *base;
68 int irq_base;
69 int group;
66 spinlock_t lock; 70 spinlock_t lock;
67#ifdef CONFIG_PM 71#ifdef CONFIG_PM
68 u32 pm_save[4]; 72 u32 pm_save[4];
@@ -118,6 +122,17 @@ extern void samsung_gpiolib_add_4bit2_chips(struct s3c_gpio_chip *chip,
118extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip); 122extern void samsung_gpiolib_add_4bit(struct s3c_gpio_chip *chip);
119extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip); 123extern void samsung_gpiolib_add_4bit2(struct s3c_gpio_chip *chip);
120 124
125
126/**
127 * samsung_gpiolib_to_irq - convert gpio pin to irq number
128 * @chip: The gpio chip that the pin belongs to.
129 * @offset: The offset of the pin in the chip.
130 *
131 * This helper returns the irq number calculated from the chip->irq_base and
132 * the provided offset.
133 */
134extern int samsung_gpiolib_to_irq(struct gpio_chip *chip, unsigned int offset);
135
121/* exported for core SoC support to change */ 136/* exported for core SoC support to change */
122extern struct s3c_gpio_cfg s3c24xx_gpiocfg_default; 137extern struct s3c_gpio_cfg s3c24xx_gpiocfg_default;
123 138
diff --git a/arch/arm/plat-samsung/include/plat/iic.h b/arch/arm/plat-samsung/include/plat/iic.h
index 133308bf595d..1543da8f85c1 100644
--- a/arch/arm/plat-samsung/include/plat/iic.h
+++ b/arch/arm/plat-samsung/include/plat/iic.h
@@ -55,10 +55,20 @@ struct s3c2410_platform_i2c {
55extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c); 55extern void s3c_i2c0_set_platdata(struct s3c2410_platform_i2c *i2c);
56extern void s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *i2c); 56extern void s3c_i2c1_set_platdata(struct s3c2410_platform_i2c *i2c);
57extern void s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *i2c); 57extern void s3c_i2c2_set_platdata(struct s3c2410_platform_i2c *i2c);
58extern void s3c_i2c3_set_platdata(struct s3c2410_platform_i2c *i2c);
59extern void s3c_i2c4_set_platdata(struct s3c2410_platform_i2c *i2c);
60extern void s3c_i2c5_set_platdata(struct s3c2410_platform_i2c *i2c);
61extern void s3c_i2c6_set_platdata(struct s3c2410_platform_i2c *i2c);
62extern void s3c_i2c7_set_platdata(struct s3c2410_platform_i2c *i2c);
58 63
59/* defined by architecture to configure gpio */ 64/* defined by architecture to configure gpio */
60extern void s3c_i2c0_cfg_gpio(struct platform_device *dev); 65extern void s3c_i2c0_cfg_gpio(struct platform_device *dev);
61extern void s3c_i2c1_cfg_gpio(struct platform_device *dev); 66extern void s3c_i2c1_cfg_gpio(struct platform_device *dev);
62extern void s3c_i2c2_cfg_gpio(struct platform_device *dev); 67extern void s3c_i2c2_cfg_gpio(struct platform_device *dev);
68extern void s3c_i2c3_cfg_gpio(struct platform_device *dev);
69extern void s3c_i2c4_cfg_gpio(struct platform_device *dev);
70extern void s3c_i2c5_cfg_gpio(struct platform_device *dev);
71extern void s3c_i2c6_cfg_gpio(struct platform_device *dev);
72extern void s3c_i2c7_cfg_gpio(struct platform_device *dev);
63 73
64#endif /* __ASM_ARCH_IIC_H */ 74#endif /* __ASM_ARCH_IIC_H */
diff --git a/arch/arm/plat-samsung/include/plat/map-base.h b/arch/arm/plat-samsung/include/plat/map-base.h
index 250be311c85b..3ffac4d2e4f0 100644
--- a/arch/arm/plat-samsung/include/plat/map-base.h
+++ b/arch/arm/plat-samsung/include/plat/map-base.h
@@ -14,7 +14,7 @@
14#ifndef __ASM_PLAT_MAP_H 14#ifndef __ASM_PLAT_MAP_H
15#define __ASM_PLAT_MAP_H __FILE__ 15#define __ASM_PLAT_MAP_H __FILE__
16 16
17/* Fit all our registers in at 0xF4000000 upwards, trying to use as 17/* Fit all our registers in at 0xF6000000 upwards, trying to use as
18 * little of the VA space as possible so vmalloc and friends have a 18 * little of the VA space as possible so vmalloc and friends have a
19 * better chance of getting memory. 19 * better chance of getting memory.
20 * 20 *
@@ -22,7 +22,7 @@
22 * an single MOVS instruction (ie, only 8 bits of set data) 22 * an single MOVS instruction (ie, only 8 bits of set data)
23 */ 23 */
24 24
25#define S3C_ADDR_BASE (0xF4000000) 25#define S3C_ADDR_BASE 0xF6000000
26 26
27#ifndef __ASSEMBLY__ 27#ifndef __ASSEMBLY__
28#define S3C_ADDR(x) ((void __iomem __force *)S3C_ADDR_BASE + (x)) 28#define S3C_ADDR(x) ((void __iomem __force *)S3C_ADDR_BASE + (x))
diff --git a/arch/arm/plat-samsung/include/plat/nand-core.h b/arch/arm/plat-samsung/include/plat/nand-core.h
new file mode 100644
index 000000000000..6de20789a95e
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/nand-core.h
@@ -0,0 +1,28 @@
1/* arch/arm/plat-samsung/include/plat/nand-core.h
2 *
3 * Copyright (c) 2010 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com/
5 *
6 * S3C - Nand Controller core functions
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef __ASM_ARCH_NAND_CORE_H
14#define __ASM_ARCH_NAND_CORE_H __FILE__
15
16/* These functions are only for use with the core support code, such as
17 * the cpu specific initialisation code
18 */
19
20/* re-define device name depending on support. */
21static inline void s3c_nand_setname(char *name)
22{
23#ifdef CONFIG_S3C_DEV_NAND
24 s3c_device_nand.name = name;
25#endif
26}
27
28#endif /* __ASM_ARCH_NAND_CORE_H */
diff --git a/arch/arm/plat-samsung/include/plat/sdhci.h b/arch/arm/plat-samsung/include/plat/sdhci.h
index 30844c263d03..85853f8c4c5d 100644
--- a/arch/arm/plat-samsung/include/plat/sdhci.h
+++ b/arch/arm/plat-samsung/include/plat/sdhci.h
@@ -28,11 +28,17 @@ enum cd_types {
28 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */ 28 S3C_SDHCI_CD_PERMANENT, /* no CD line, card permanently wired to host */
29}; 29};
30 30
31enum clk_types {
32 S3C_SDHCI_CLK_DIV_INTERNAL, /* use mmc internal clock divider */
33 S3C_SDHCI_CLK_DIV_EXTERNAL, /* use external clock divider */
34};
35
31/** 36/**
32 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI 37 * struct s3c_sdhci_platdata() - Platform device data for Samsung SDHCI
33 * @max_width: The maximum number of data bits supported. 38 * @max_width: The maximum number of data bits supported.
34 * @host_caps: Standard MMC host capabilities bit field. 39 * @host_caps: Standard MMC host capabilities bit field.
35 * @cd_type: Type of Card Detection method (see cd_types enum above) 40 * @cd_type: Type of Card Detection method (see cd_types enum above)
41 * @clk_type: Type of clock divider method (see clk_types enum above)
36 * @ext_cd_init: Initialize external card detect subsystem. Called on 42 * @ext_cd_init: Initialize external card detect subsystem. Called on
37 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL. 43 * sdhci-s3c driver probe when cd_type == S3C_SDHCI_CD_EXTERNAL.
38 * notify_func argument is a callback to the sdhci-s3c driver 44 * notify_func argument is a callback to the sdhci-s3c driver
@@ -59,6 +65,7 @@ struct s3c_sdhci_platdata {
59 unsigned int max_width; 65 unsigned int max_width;
60 unsigned int host_caps; 66 unsigned int host_caps;
61 enum cd_types cd_type; 67 enum cd_types cd_type;
68 enum clk_types clk_type;
62 69
63 char **clocks; /* set of clock sources */ 70 char **clocks; /* set of clock sources */
64 71
@@ -110,6 +117,10 @@ extern void s5pv210_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
110extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w); 117extern void s5pv210_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
111extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w); 118extern void s5pv210_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
112extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w); 119extern void s5pv210_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
120extern void s5pv310_setup_sdhci0_cfg_gpio(struct platform_device *, int w);
121extern void s5pv310_setup_sdhci1_cfg_gpio(struct platform_device *, int w);
122extern void s5pv310_setup_sdhci2_cfg_gpio(struct platform_device *, int w);
123extern void s5pv310_setup_sdhci3_cfg_gpio(struct platform_device *, int w);
113 124
114/* S3C64XX SDHCI setup */ 125/* S3C64XX SDHCI setup */
115 126
@@ -288,4 +299,57 @@ static inline void s5pv210_default_sdhci3(void) { }
288 299
289#endif /* CONFIG_S5PV210_SETUP_SDHCI */ 300#endif /* CONFIG_S5PV210_SETUP_SDHCI */
290 301
302/* S5PV310 SDHCI setup */
303#ifdef CONFIG_S5PV310_SETUP_SDHCI
304extern char *s5pv310_hsmmc_clksrcs[4];
305
306extern void s5pv310_setup_sdhci_cfg_card(struct platform_device *dev,
307 void __iomem *r,
308 struct mmc_ios *ios,
309 struct mmc_card *card);
310
311static inline void s5pv310_default_sdhci0(void)
312{
313#ifdef CONFIG_S3C_DEV_HSMMC
314 s3c_hsmmc0_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
315 s3c_hsmmc0_def_platdata.cfg_gpio = s5pv310_setup_sdhci0_cfg_gpio;
316 s3c_hsmmc0_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
317#endif
318}
319
320static inline void s5pv310_default_sdhci1(void)
321{
322#ifdef CONFIG_S3C_DEV_HSMMC1
323 s3c_hsmmc1_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
324 s3c_hsmmc1_def_platdata.cfg_gpio = s5pv310_setup_sdhci1_cfg_gpio;
325 s3c_hsmmc1_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
326#endif
327}
328
329static inline void s5pv310_default_sdhci2(void)
330{
331#ifdef CONFIG_S3C_DEV_HSMMC2
332 s3c_hsmmc2_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
333 s3c_hsmmc2_def_platdata.cfg_gpio = s5pv310_setup_sdhci2_cfg_gpio;
334 s3c_hsmmc2_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
335#endif
336}
337
338static inline void s5pv310_default_sdhci3(void)
339{
340#ifdef CONFIG_S3C_DEV_HSMMC3
341 s3c_hsmmc3_def_platdata.clocks = s5pv310_hsmmc_clksrcs;
342 s3c_hsmmc3_def_platdata.cfg_gpio = s5pv310_setup_sdhci3_cfg_gpio;
343 s3c_hsmmc3_def_platdata.cfg_card = s5pv310_setup_sdhci_cfg_card;
344#endif
345}
346
347#else
348static inline void s5pv310_default_sdhci0(void) { }
349static inline void s5pv310_default_sdhci1(void) { }
350static inline void s5pv310_default_sdhci2(void) { }
351static inline void s5pv310_default_sdhci3(void) { }
352
353#endif /* CONFIG_S5PV310_SETUP_SDHCI */
354
291#endif /* __PLAT_S3C_SDHCI_H */ 355#endif /* __PLAT_S3C_SDHCI_H */
diff --git a/arch/arm/plat-samsung/pm-gpio.c b/arch/arm/plat-samsung/pm-gpio.c
index 7df03f87fbfa..96528200eb79 100644
--- a/arch/arm/plat-samsung/pm-gpio.c
+++ b/arch/arm/plat-samsung/pm-gpio.c
@@ -192,7 +192,7 @@ struct s3c_gpio_pm s3c_gpio_pm_2bit = {
192 .resume = s3c_gpio_pm_2bit_resume, 192 .resume = s3c_gpio_pm_2bit_resume,
193}; 193};
194 194
195#ifdef CONFIG_ARCH_S3C64XX 195#if defined(CONFIG_ARCH_S3C64XX) || defined(CONFIG_PLAT_S5P)
196static void s3c_gpio_pm_4bit_save(struct s3c_gpio_chip *chip) 196static void s3c_gpio_pm_4bit_save(struct s3c_gpio_chip *chip)
197{ 197{
198 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON); 198 chip->pm_save[1] = __raw_readl(chip->base + OFFS_CON);
@@ -302,7 +302,7 @@ struct s3c_gpio_pm s3c_gpio_pm_4bit = {
302 .save = s3c_gpio_pm_4bit_save, 302 .save = s3c_gpio_pm_4bit_save,
303 .resume = s3c_gpio_pm_4bit_resume, 303 .resume = s3c_gpio_pm_4bit_resume,
304}; 304};
305#endif /* CONFIG_ARCH_S3C64XX */ 305#endif /* CONFIG_ARCH_S3C64XX || CONFIG_PLAT_S5P */
306 306
307/** 307/**
308 * s3c_pm_save_gpio() - save gpio chip data for suspend 308 * s3c_pm_save_gpio() - save gpio chip data for suspend
diff --git a/arch/arm/plat-samsung/s3c-pl330.c b/arch/arm/plat-samsung/s3c-pl330.c
index a91305a60aed..b4ff8d74ac40 100644
--- a/arch/arm/plat-samsung/s3c-pl330.c
+++ b/arch/arm/plat-samsung/s3c-pl330.c
@@ -15,6 +15,8 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/clk.h>
19#include <linux/err.h>
18 20
19#include <asm/hardware/pl330.h> 21#include <asm/hardware/pl330.h>
20 22
@@ -27,6 +29,7 @@
27 * @node: To attach to the global list of DMACs. 29 * @node: To attach to the global list of DMACs.
28 * @pi: PL330 configuration info for the DMAC. 30 * @pi: PL330 configuration info for the DMAC.
29 * @kmcache: Pool to quickly allocate xfers for all channels in the dmac. 31 * @kmcache: Pool to quickly allocate xfers for all channels in the dmac.
32 * @clk: Pointer of DMAC operation clock.
30 */ 33 */
31struct s3c_pl330_dmac { 34struct s3c_pl330_dmac {
32 unsigned busy_chan; 35 unsigned busy_chan;
@@ -34,6 +37,7 @@ struct s3c_pl330_dmac {
34 struct list_head node; 37 struct list_head node;
35 struct pl330_info *pi; 38 struct pl330_info *pi;
36 struct kmem_cache *kmcache; 39 struct kmem_cache *kmcache;
40 struct clk *clk;
37}; 41};
38 42
39/** 43/**
@@ -1072,16 +1076,25 @@ static int pl330_probe(struct platform_device *pdev)
1072 if (ret) 1076 if (ret)
1073 goto probe_err4; 1077 goto probe_err4;
1074 1078
1075 ret = pl330_add(pl330_info);
1076 if (ret)
1077 goto probe_err5;
1078
1079 /* Allocate a new DMAC */ 1079 /* Allocate a new DMAC */
1080 s3c_pl330_dmac = kmalloc(sizeof(*s3c_pl330_dmac), GFP_KERNEL); 1080 s3c_pl330_dmac = kmalloc(sizeof(*s3c_pl330_dmac), GFP_KERNEL);
1081 if (!s3c_pl330_dmac) { 1081 if (!s3c_pl330_dmac) {
1082 ret = -ENOMEM; 1082 ret = -ENOMEM;
1083 goto probe_err5;
1084 }
1085
1086 /* Get operation clock and enable it */
1087 s3c_pl330_dmac->clk = clk_get(&pdev->dev, "pdma");
1088 if (IS_ERR(s3c_pl330_dmac->clk)) {
1089 dev_err(&pdev->dev, "Cannot get operation clock.\n");
1090 ret = -EINVAL;
1083 goto probe_err6; 1091 goto probe_err6;
1084 } 1092 }
1093 clk_enable(s3c_pl330_dmac->clk);
1094
1095 ret = pl330_add(pl330_info);
1096 if (ret)
1097 goto probe_err7;
1085 1098
1086 /* Hook the info */ 1099 /* Hook the info */
1087 s3c_pl330_dmac->pi = pl330_info; 1100 s3c_pl330_dmac->pi = pl330_info;
@@ -1094,7 +1107,7 @@ static int pl330_probe(struct platform_device *pdev)
1094 1107
1095 if (!s3c_pl330_dmac->kmcache) { 1108 if (!s3c_pl330_dmac->kmcache) {
1096 ret = -ENOMEM; 1109 ret = -ENOMEM;
1097 goto probe_err7; 1110 goto probe_err8;
1098 } 1111 }
1099 1112
1100 /* Get the list of peripherals */ 1113 /* Get the list of peripherals */
@@ -1120,10 +1133,13 @@ static int pl330_probe(struct platform_device *pdev)
1120 1133
1121 return 0; 1134 return 0;
1122 1135
1136probe_err8:
1137 pl330_del(pl330_info);
1123probe_err7: 1138probe_err7:
1124 kfree(s3c_pl330_dmac); 1139 clk_disable(s3c_pl330_dmac->clk);
1140 clk_put(s3c_pl330_dmac->clk);
1125probe_err6: 1141probe_err6:
1126 pl330_del(pl330_info); 1142 kfree(s3c_pl330_dmac);
1127probe_err5: 1143probe_err5:
1128 free_irq(irq, pl330_info); 1144 free_irq(irq, pl330_info);
1129probe_err4: 1145probe_err4:
@@ -1188,6 +1204,10 @@ static int pl330_remove(struct platform_device *pdev)
1188 } 1204 }
1189 } 1205 }
1190 1206
1207 /* Disable operation clock */
1208 clk_disable(dmac->clk);
1209 clk_put(dmac->clk);
1210
1191 /* Remove the DMAC */ 1211 /* Remove the DMAC */
1192 list_del(&dmac->node); 1212 list_del(&dmac->node);
1193 kfree(dmac); 1213 kfree(dmac);
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index f0dc5b8075a7..313b13073c54 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "Linux Kernel Configuration"
7
8config AVR32 1config AVR32
9 def_bool y 2 def_bool y
10 # With EMBEDDED=n, we get lots of stuff automatically selected 3 # With EMBEDDED=n, we get lots of stuff automatically selected
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index d9a1cb7ec30a..0a221d48152d 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "Blackfin Kernel Configuration"
7
8config SYMBOL_PREFIX 1config SYMBOL_PREFIX
9 string 2 string
10 default "_" 3 default "_"
diff --git a/arch/blackfin/kernel/kgdb.c b/arch/blackfin/kernel/kgdb.c
index 08bc44ea6883..edae461b1c54 100644
--- a/arch/blackfin/kernel/kgdb.c
+++ b/arch/blackfin/kernel/kgdb.c
@@ -320,7 +320,7 @@ static void bfin_correct_hw_break(void)
320 } 320 }
321} 321}
322 322
323void kgdb_disable_hw_debug(struct pt_regs *regs) 323static void bfin_disable_hw_debug(struct pt_regs *regs)
324{ 324{
325 /* Disable hardware debugging while we are in kgdb */ 325 /* Disable hardware debugging while we are in kgdb */
326 bfin_write_WPIACTL(0); 326 bfin_write_WPIACTL(0);
@@ -406,6 +406,7 @@ struct kgdb_arch arch_kgdb_ops = {
406#endif 406#endif
407 .set_hw_breakpoint = bfin_set_hw_break, 407 .set_hw_breakpoint = bfin_set_hw_break,
408 .remove_hw_breakpoint = bfin_remove_hw_break, 408 .remove_hw_breakpoint = bfin_remove_hw_break,
409 .disable_hw_break = bfin_disable_hw_debug,
409 .remove_all_hw_break = bfin_remove_all_hw_break, 410 .remove_all_hw_break = bfin_remove_all_hw_break,
410 .correct_hw_break = bfin_correct_hw_break, 411 .correct_hw_break = bfin_correct_hw_break,
411}; 412};
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index aefe3b18a074..613e62831c55 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see the Configure script.
4#
5
6mainmenu "Linux/CRIS Kernel Configuration"
7
8config MMU 1config MMU
9 bool 2 bool
10 default y 3 default y
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 0f2417df6323..f6bcb039cd6d 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -1,7 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5config FRV 1config FRV
6 bool 2 bool
7 default y 3 default y
@@ -61,8 +57,6 @@ config HZ
61 int 57 int
62 default 1000 58 default 1000
63 59
64mainmenu "Fujitsu FR-V Kernel Configuration"
65
66source "init/Kconfig" 60source "init/Kconfig"
67 61
68source "kernel/Kconfig.freezer" 62source "kernel/Kconfig.freezer"
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 988b6ff34cc4..65f897d8c1e9 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "uClinux/h8300 (w/o MMU) Kernel Configuration"
7
8config H8300 1config H8300
9 bool 2 bool
10 default y 3 default y
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 7c82fa1fc911..e0f5b6d7f849 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "IA-64 Linux Kernel Configuration"
7
8source "init/Kconfig" 1source "init/Kconfig"
9 2
10source "kernel/Kconfig.freezer" 3source "kernel/Kconfig.freezer"
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 6b1852f7f972..39e534f5a3b0 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -618,16 +618,15 @@ pfm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
618} 618}
619 619
620 620
621static int 621static struct dentry *
622pfmfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data, 622pfmfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *data)
623 struct vfsmount *mnt)
624{ 623{
625 return get_sb_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC, mnt); 624 return mount_pseudo(fs_type, "pfm:", NULL, PFMFS_MAGIC);
626} 625}
627 626
628static struct file_system_type pfm_fs_type = { 627static struct file_system_type pfm_fs_type = {
629 .name = "pfmfs", 628 .name = "pfmfs",
630 .get_sb = pfmfs_get_sb, 629 .mount = pfmfs_mount,
631 .kill_sb = kill_anon_super, 630 .kill_sb = kill_anon_super,
632}; 631};
633 632
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 3867fd21f333..5c291d65196b 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "Linux/M32R Kernel Configuration"
7
8config M32R 1config M32R
9 bool 2 bool
10 default y 3 default y
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 77bb0d6baa62..bc9271b85759 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -1,7 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5config M68K 1config M68K
6 bool 2 bool
7 default y 3 default y
@@ -62,8 +58,6 @@ config HZ
62config ARCH_USES_GETTIMEOFFSET 58config ARCH_USES_GETTIMEOFFSET
63 def_bool y 59 def_bool y
64 60
65mainmenu "Linux/68k Kernel Configuration"
66
67source "init/Kconfig" 61source "init/Kconfig"
68 62
69source "kernel/Kconfig.freezer" 63source "kernel/Kconfig.freezer"
diff --git a/arch/m68k/include/asm/irqflags.h b/arch/m68k/include/asm/irqflags.h
index 4a5b284a1550..7ef4115b8c4a 100644
--- a/arch/m68k/include/asm/irqflags.h
+++ b/arch/m68k/include/asm/irqflags.h
@@ -2,7 +2,9 @@
2#define _M68K_IRQFLAGS_H 2#define _M68K_IRQFLAGS_H
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5#ifdef CONFIG_MMU
5#include <linux/hardirq.h> 6#include <linux/hardirq.h>
7#endif
6#include <linux/preempt.h> 8#include <linux/preempt.h>
7#include <asm/thread_info.h> 9#include <asm/thread_info.h>
8#include <asm/entry.h> 10#include <asm/entry.h>
diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h
index 789f3b2de0e9..415d5484916c 100644
--- a/arch/m68k/include/asm/machdep.h
+++ b/arch/m68k/include/asm/machdep.h
@@ -40,5 +40,6 @@ extern unsigned long hw_timer_offset(void);
40extern irqreturn_t arch_timer_interrupt(int irq, void *dummy); 40extern irqreturn_t arch_timer_interrupt(int irq, void *dummy);
41 41
42extern void config_BSP(char *command, int len); 42extern void config_BSP(char *command, int len);
43extern void do_IRQ(int irq, struct pt_regs *fp);
43 44
44#endif /* _M68K_MACHDEP_H */ 45#endif /* _M68K_MACHDEP_H */
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index 9287150e5fb0..fa9f746cf4ae 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "uClinux/68k (w/o MMU) Kernel Configuration"
7
8config M68K 1config M68K
9 bool 2 bool
10 default y 3 default y
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index dad40fc2bef8..387d5ffdfd3a 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -1,8 +1,3 @@
1# For a description of the syntax of this configuration file,
2# see Documentation/kbuild/kconfig-language.txt.
3
4mainmenu "Linux/Microblaze Kernel Configuration"
5
6config MICROBLAZE 1config MICROBLAZE
7 def_bool y 2 def_bool y
8 select HAVE_MEMBLOCK 3 select HAVE_MEMBLOCK
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 46cae2b163e4..67a2fa2caa49 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -4,18 +4,21 @@ config MIPS
4 select HAVE_GENERIC_DMA_COHERENT 4 select HAVE_GENERIC_DMA_COHERENT
5 select HAVE_IDE 5 select HAVE_IDE
6 select HAVE_OPROFILE 6 select HAVE_OPROFILE
7 select HAVE_PERF_EVENTS
8 select PERF_USE_VMALLOC
7 select HAVE_ARCH_KGDB 9 select HAVE_ARCH_KGDB
8 select HAVE_FUNCTION_TRACER 10 select HAVE_FUNCTION_TRACER
9 select HAVE_FUNCTION_TRACE_MCOUNT_TEST 11 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
10 select HAVE_DYNAMIC_FTRACE 12 select HAVE_DYNAMIC_FTRACE
11 select HAVE_FTRACE_MCOUNT_RECORD 13 select HAVE_FTRACE_MCOUNT_RECORD
14 select HAVE_C_RECORDMCOUNT
12 select HAVE_FUNCTION_GRAPH_TRACER 15 select HAVE_FUNCTION_GRAPH_TRACER
13 select HAVE_KPROBES 16 select HAVE_KPROBES
14 select HAVE_KRETPROBES 17 select HAVE_KRETPROBES
15 select RTC_LIB if !MACH_LOONGSON 18 select RTC_LIB if !MACH_LOONGSON
16 select GENERIC_ATOMIC64 if !64BIT 19 select GENERIC_ATOMIC64 if !64BIT
17 20 select HAVE_DMA_ATTRS
18mainmenu "Linux/MIPS Kernel Configuration" 21 select HAVE_DMA_API_DEBUG
19 22
20menu "Machine selection" 23menu "Machine selection"
21 24
@@ -693,6 +696,9 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
693 select SWAP_IO_SPACE 696 select SWAP_IO_SPACE
694 select HW_HAS_PCI 697 select HW_HAS_PCI
695 select ARCH_SUPPORTS_MSI 698 select ARCH_SUPPORTS_MSI
699 select ZONE_DMA32
700 select USB_ARCH_HAS_OHCI
701 select USB_ARCH_HAS_EHCI
696 help 702 help
697 This option supports all of the Octeon reference boards from Cavium 703 This option supports all of the Octeon reference boards from Cavium
698 Networks. It builds a kernel that dynamically determines the Octeon 704 Networks. It builds a kernel that dynamically determines the Octeon
@@ -1336,6 +1342,57 @@ config CPU_CAVIUM_OCTEON
1336 can have up to 16 Mips64v2 cores and 8 integrated gigabit ethernets. 1342 can have up to 16 Mips64v2 cores and 8 integrated gigabit ethernets.
1337 Full details can be found at http://www.caviumnetworks.com. 1343 Full details can be found at http://www.caviumnetworks.com.
1338 1344
1345config CPU_BMIPS3300
1346 bool "BMIPS3300"
1347 depends on SYS_HAS_CPU_BMIPS3300
1348 select DMA_NONCOHERENT
1349 select IRQ_CPU
1350 select SWAP_IO_SPACE
1351 select SYS_SUPPORTS_32BIT_KERNEL
1352 select WEAK_ORDERING
1353 help
1354 Broadcom BMIPS3300 processors.
1355
1356config CPU_BMIPS4350
1357 bool "BMIPS4350"
1358 depends on SYS_HAS_CPU_BMIPS4350
1359 select CPU_SUPPORTS_32BIT_KERNEL
1360 select DMA_NONCOHERENT
1361 select IRQ_CPU
1362 select SWAP_IO_SPACE
1363 select SYS_SUPPORTS_SMP
1364 select SYS_SUPPORTS_HOTPLUG_CPU
1365 select WEAK_ORDERING
1366 help
1367 Broadcom BMIPS4350 ("VIPER") processors.
1368
1369config CPU_BMIPS4380
1370 bool "BMIPS4380"
1371 depends on SYS_HAS_CPU_BMIPS4380
1372 select CPU_SUPPORTS_32BIT_KERNEL
1373 select DMA_NONCOHERENT
1374 select IRQ_CPU
1375 select SWAP_IO_SPACE
1376 select SYS_SUPPORTS_SMP
1377 select SYS_SUPPORTS_HOTPLUG_CPU
1378 select WEAK_ORDERING
1379 help
1380 Broadcom BMIPS4380 processors.
1381
1382config CPU_BMIPS5000
1383 bool "BMIPS5000"
1384 depends on SYS_HAS_CPU_BMIPS5000
1385 select CPU_SUPPORTS_32BIT_KERNEL
1386 select CPU_SUPPORTS_HIGHMEM
1387 select DMA_NONCOHERENT
1388 select IRQ_CPU
1389 select SWAP_IO_SPACE
1390 select SYS_SUPPORTS_SMP
1391 select SYS_SUPPORTS_HOTPLUG_CPU
1392 select WEAK_ORDERING
1393 help
1394 Broadcom BMIPS5000 processors.
1395
1339endchoice 1396endchoice
1340 1397
1341if CPU_LOONGSON2F 1398if CPU_LOONGSON2F
@@ -1454,6 +1511,18 @@ config SYS_HAS_CPU_SB1
1454config SYS_HAS_CPU_CAVIUM_OCTEON 1511config SYS_HAS_CPU_CAVIUM_OCTEON
1455 bool 1512 bool
1456 1513
1514config SYS_HAS_CPU_BMIPS3300
1515 bool
1516
1517config SYS_HAS_CPU_BMIPS4350
1518 bool
1519
1520config SYS_HAS_CPU_BMIPS4380
1521 bool
1522
1523config SYS_HAS_CPU_BMIPS5000
1524 bool
1525
1457# 1526#
1458# CPU may reorder R->R, R->W, W->R, W->W 1527# CPU may reorder R->R, R->W, W->R, W->W
1459# Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC 1528# Reordering beyond LL and SC is handled in WEAK_REORDERING_BEYOND_LLSC
@@ -1930,6 +1999,14 @@ config NODES_SHIFT
1930 default "6" 1999 default "6"
1931 depends on NEED_MULTIPLE_NODES 2000 depends on NEED_MULTIPLE_NODES
1932 2001
2002config HW_PERF_EVENTS
2003 bool "Enable hardware performance counter support for perf events"
2004 depends on PERF_EVENTS && !MIPS_MT_SMTC && OPROFILE=n && CPU_MIPS32
2005 default y
2006 help
2007 Enable hardware performance counter support for perf events. If
2008 disabled, perf events will use software events only.
2009
1933source "mm/Kconfig" 2010source "mm/Kconfig"
1934 2011
1935config SMP 2012config SMP
diff --git a/arch/mips/Kconfig.debug b/arch/mips/Kconfig.debug
index 43dc27997730..f437cd1fafb8 100644
--- a/arch/mips/Kconfig.debug
+++ b/arch/mips/Kconfig.debug
@@ -67,6 +67,15 @@ config CMDLINE_OVERRIDE
67 67
68 Normally, you will choose 'N' here. 68 Normally, you will choose 'N' here.
69 69
70config DEBUG_STACKOVERFLOW
71 bool "Check for stack overflows"
72 depends on DEBUG_KERNEL
73 help
74 This option will cause messages to be printed if free stack space
75 drops below a certain limit(2GB on MIPS). The debugging option
76 provides another way to check stack overflow happened on kernel mode
77 stack usually caused by nested interruption.
78
70config DEBUG_STACK_USAGE 79config DEBUG_STACK_USAGE
71 bool "Enable stack utilization instrumentation" 80 bool "Enable stack utilization instrumentation"
72 depends on DEBUG_KERNEL 81 depends on DEBUG_KERNEL
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index f4a4b663ebb3..7c1102e41fe2 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -48,9 +48,6 @@ ifneq ($(SUBARCH),$(ARCH))
48 endif 48 endif
49endif 49endif
50 50
51ifndef CONFIG_FUNCTION_TRACER
52cflags-y := -ffunction-sections
53endif
54ifdef CONFIG_FUNCTION_GRAPH_TRACER 51ifdef CONFIG_FUNCTION_GRAPH_TRACER
55 ifndef KBUILD_MCOUNT_RA_ADDRESS 52 ifndef KBUILD_MCOUNT_RA_ADDRESS
56 ifeq ($(call cc-option-yn,-mmcount-ra-address), y) 53 ifeq ($(call cc-option-yn,-mmcount-ra-address), y)
@@ -159,6 +156,7 @@ cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += $(call cc-option,-march=octeon) -Wa,--trap
159ifeq (,$(findstring march=octeon, $(cflags-$(CONFIG_CPU_CAVIUM_OCTEON)))) 156ifeq (,$(findstring march=octeon, $(cflags-$(CONFIG_CPU_CAVIUM_OCTEON))))
160cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon 157cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -Wa,-march=octeon
161endif 158endif
159cflags-$(CONFIG_CAVIUM_CN63XXP1) += -Wa,-mfix-cn63xxp1
162 160
163cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,) 161cflags-$(CONFIG_CPU_R4000_WORKAROUNDS) += $(call cc-option,-mfix-r4000,)
164cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,) 162cflags-$(CONFIG_CPU_R4400_WORKAROUNDS) += $(call cc-option,-mfix-r4400,)
diff --git a/arch/mips/ar7/gpio.c b/arch/mips/ar7/gpio.c
index c32fbb57441a..425dfa5d6e12 100644
--- a/arch/mips/ar7/gpio.c
+++ b/arch/mips/ar7/gpio.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org> 2 * Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
3 * Copyright (C) 2007 Eugene Konev <ejka@openwrt.org> 3 * Copyright (C) 2007 Eugene Konev <ejka@openwrt.org>
4 * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org> 4 * Copyright (C) 2009-2010 Florian Fainelli <florian@openwrt.org>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -37,6 +37,16 @@ static int ar7_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
37 return readl(gpio_in) & (1 << gpio); 37 return readl(gpio_in) & (1 << gpio);
38} 38}
39 39
40static int titan_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
41{
42 struct ar7_gpio_chip *gpch =
43 container_of(chip, struct ar7_gpio_chip, chip);
44 void __iomem *gpio_in0 = gpch->regs + TITAN_GPIO_INPUT_0;
45 void __iomem *gpio_in1 = gpch->regs + TITAN_GPIO_INPUT_1;
46
47 return readl(gpio >> 5 ? gpio_in1 : gpio_in0) & (1 << (gpio & 0x1f));
48}
49
40static void ar7_gpio_set_value(struct gpio_chip *chip, 50static void ar7_gpio_set_value(struct gpio_chip *chip,
41 unsigned gpio, int value) 51 unsigned gpio, int value)
42{ 52{
@@ -51,6 +61,21 @@ static void ar7_gpio_set_value(struct gpio_chip *chip,
51 writel(tmp, gpio_out); 61 writel(tmp, gpio_out);
52} 62}
53 63
64static void titan_gpio_set_value(struct gpio_chip *chip,
65 unsigned gpio, int value)
66{
67 struct ar7_gpio_chip *gpch =
68 container_of(chip, struct ar7_gpio_chip, chip);
69 void __iomem *gpio_out0 = gpch->regs + TITAN_GPIO_OUTPUT_0;
70 void __iomem *gpio_out1 = gpch->regs + TITAN_GPIO_OUTPUT_1;
71 unsigned tmp;
72
73 tmp = readl(gpio >> 5 ? gpio_out1 : gpio_out0) & ~(1 << (gpio & 0x1f));
74 if (value)
75 tmp |= 1 << (gpio & 0x1f);
76 writel(tmp, gpio >> 5 ? gpio_out1 : gpio_out0);
77}
78
54static int ar7_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) 79static int ar7_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
55{ 80{
56 struct ar7_gpio_chip *gpch = 81 struct ar7_gpio_chip *gpch =
@@ -62,6 +87,21 @@ static int ar7_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
62 return 0; 87 return 0;
63} 88}
64 89
90static int titan_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
91{
92 struct ar7_gpio_chip *gpch =
93 container_of(chip, struct ar7_gpio_chip, chip);
94 void __iomem *gpio_dir0 = gpch->regs + TITAN_GPIO_DIR_0;
95 void __iomem *gpio_dir1 = gpch->regs + TITAN_GPIO_DIR_1;
96
97 if (gpio >= TITAN_GPIO_MAX)
98 return -EINVAL;
99
100 writel(readl(gpio >> 5 ? gpio_dir1 : gpio_dir0) | (1 << (gpio & 0x1f)),
101 gpio >> 5 ? gpio_dir1 : gpio_dir0);
102 return 0;
103}
104
65static int ar7_gpio_direction_output(struct gpio_chip *chip, 105static int ar7_gpio_direction_output(struct gpio_chip *chip,
66 unsigned gpio, int value) 106 unsigned gpio, int value)
67{ 107{
@@ -75,6 +115,24 @@ static int ar7_gpio_direction_output(struct gpio_chip *chip,
75 return 0; 115 return 0;
76} 116}
77 117
118static int titan_gpio_direction_output(struct gpio_chip *chip,
119 unsigned gpio, int value)
120{
121 struct ar7_gpio_chip *gpch =
122 container_of(chip, struct ar7_gpio_chip, chip);
123 void __iomem *gpio_dir0 = gpch->regs + TITAN_GPIO_DIR_0;
124 void __iomem *gpio_dir1 = gpch->regs + TITAN_GPIO_DIR_1;
125
126 if (gpio >= TITAN_GPIO_MAX)
127 return -EINVAL;
128
129 titan_gpio_set_value(chip, gpio, value);
130 writel(readl(gpio >> 5 ? gpio_dir1 : gpio_dir0) & ~(1 <<
131 (gpio & 0x1f)), gpio >> 5 ? gpio_dir1 : gpio_dir0);
132
133 return 0;
134}
135
78static struct ar7_gpio_chip ar7_gpio_chip = { 136static struct ar7_gpio_chip ar7_gpio_chip = {
79 .chip = { 137 .chip = {
80 .label = "ar7-gpio", 138 .label = "ar7-gpio",
@@ -87,7 +145,19 @@ static struct ar7_gpio_chip ar7_gpio_chip = {
87 } 145 }
88}; 146};
89 147
90int ar7_gpio_enable(unsigned gpio) 148static struct ar7_gpio_chip titan_gpio_chip = {
149 .chip = {
150 .label = "titan-gpio",
151 .direction_input = titan_gpio_direction_input,
152 .direction_output = titan_gpio_direction_output,
153 .set = titan_gpio_set_value,
154 .get = titan_gpio_get_value,
155 .base = 0,
156 .ngpio = TITAN_GPIO_MAX,
157 }
158};
159
160static inline int ar7_gpio_enable_ar7(unsigned gpio)
91{ 161{
92 void __iomem *gpio_en = ar7_gpio_chip.regs + AR7_GPIO_ENABLE; 162 void __iomem *gpio_en = ar7_gpio_chip.regs + AR7_GPIO_ENABLE;
93 163
@@ -95,9 +165,26 @@ int ar7_gpio_enable(unsigned gpio)
95 165
96 return 0; 166 return 0;
97} 167}
168
169static inline int ar7_gpio_enable_titan(unsigned gpio)
170{
171 void __iomem *gpio_en0 = titan_gpio_chip.regs + TITAN_GPIO_ENBL_0;
172 void __iomem *gpio_en1 = titan_gpio_chip.regs + TITAN_GPIO_ENBL_1;
173
174 writel(readl(gpio >> 5 ? gpio_en1 : gpio_en0) | (1 << (gpio & 0x1f)),
175 gpio >> 5 ? gpio_en1 : gpio_en0);
176
177 return 0;
178}
179
180int ar7_gpio_enable(unsigned gpio)
181{
182 return ar7_is_titan() ? ar7_gpio_enable_titan(gpio) :
183 ar7_gpio_enable_ar7(gpio);
184}
98EXPORT_SYMBOL(ar7_gpio_enable); 185EXPORT_SYMBOL(ar7_gpio_enable);
99 186
100int ar7_gpio_disable(unsigned gpio) 187static inline int ar7_gpio_disable_ar7(unsigned gpio)
101{ 188{
102 void __iomem *gpio_en = ar7_gpio_chip.regs + AR7_GPIO_ENABLE; 189 void __iomem *gpio_en = ar7_gpio_chip.regs + AR7_GPIO_ENABLE;
103 190
@@ -105,27 +192,159 @@ int ar7_gpio_disable(unsigned gpio)
105 192
106 return 0; 193 return 0;
107} 194}
195
196static inline int ar7_gpio_disable_titan(unsigned gpio)
197{
198 void __iomem *gpio_en0 = titan_gpio_chip.regs + TITAN_GPIO_ENBL_0;
199 void __iomem *gpio_en1 = titan_gpio_chip.regs + TITAN_GPIO_ENBL_1;
200
201 writel(readl(gpio >> 5 ? gpio_en1 : gpio_en0) & ~(1 << (gpio & 0x1f)),
202 gpio >> 5 ? gpio_en1 : gpio_en0);
203
204 return 0;
205}
206
207int ar7_gpio_disable(unsigned gpio)
208{
209 return ar7_is_titan() ? ar7_gpio_disable_titan(gpio) :
210 ar7_gpio_disable_ar7(gpio);
211}
108EXPORT_SYMBOL(ar7_gpio_disable); 212EXPORT_SYMBOL(ar7_gpio_disable);
109 213
110static int __init ar7_gpio_init(void) 214struct titan_gpio_cfg {
215 u32 reg;
216 u32 shift;
217 u32 func;
218};
219
220static struct titan_gpio_cfg titan_gpio_table[] = {
221 /* reg, start bit, mux value */
222 {4, 24, 1},
223 {4, 26, 1},
224 {4, 28, 1},
225 {4, 30, 1},
226 {5, 6, 1},
227 {5, 8, 1},
228 {5, 10, 1},
229 {5, 12, 1},
230 {7, 14, 3},
231 {7, 16, 3},
232 {7, 18, 3},
233 {7, 20, 3},
234 {7, 22, 3},
235 {7, 26, 3},
236 {7, 28, 3},
237 {7, 30, 3},
238 {8, 0, 3},
239 {8, 2, 3},
240 {8, 4, 3},
241 {8, 10, 3},
242 {8, 14, 3},
243 {8, 16, 3},
244 {8, 18, 3},
245 {8, 20, 3},
246 {9, 8, 3},
247 {9, 10, 3},
248 {9, 12, 3},
249 {9, 14, 3},
250 {9, 18, 3},
251 {9, 20, 3},
252 {9, 24, 3},
253 {9, 26, 3},
254 {9, 28, 3},
255 {9, 30, 3},
256 {10, 0, 3},
257 {10, 2, 3},
258 {10, 8, 3},
259 {10, 10, 3},
260 {10, 12, 3},
261 {10, 14, 3},
262 {13, 12, 3},
263 {13, 14, 3},
264 {13, 16, 3},
265 {13, 18, 3},
266 {13, 24, 3},
267 {13, 26, 3},
268 {13, 28, 3},
269 {13, 30, 3},
270 {14, 2, 3},
271 {14, 6, 3},
272 {14, 8, 3},
273 {14, 12, 3}
274};
275
276static int titan_gpio_pinsel(unsigned gpio)
277{
278 struct titan_gpio_cfg gpio_cfg;
279 u32 mux_status, pin_sel_reg, tmp;
280 void __iomem *pin_sel = (void __iomem *)KSEG1ADDR(AR7_REGS_PINSEL);
281
282 if (gpio >= ARRAY_SIZE(titan_gpio_table))
283 return -EINVAL;
284
285 gpio_cfg = titan_gpio_table[gpio];
286 pin_sel_reg = gpio_cfg.reg - 1;
287
288 mux_status = (readl(pin_sel + pin_sel_reg) >> gpio_cfg.shift) & 0x3;
289
290 /* Check the mux status */
291 if (!((mux_status == 0) || (mux_status == gpio_cfg.func)))
292 return 0;
293
294 /* Set the pin sel value */
295 tmp = readl(pin_sel + pin_sel_reg);
296 tmp |= ((gpio_cfg.func & 0x3) << gpio_cfg.shift);
297 writel(tmp, pin_sel + pin_sel_reg);
298
299 return 0;
300}
301
302/* Perform minimal Titan GPIO configuration */
303static void titan_gpio_init(void)
304{
305 unsigned i;
306
307 for (i = 44; i < 48; i++) {
308 titan_gpio_pinsel(i);
309 ar7_gpio_enable_titan(i);
310 titan_gpio_direction_input(&titan_gpio_chip.chip, i);
311 }
312}
313
314int __init ar7_gpio_init(void)
111{ 315{
112 int ret; 316 int ret;
317 struct ar7_gpio_chip *gpch;
318 unsigned size;
319
320 if (!ar7_is_titan()) {
321 gpch = &ar7_gpio_chip;
322 size = 0x10;
323 } else {
324 gpch = &titan_gpio_chip;
325 size = 0x1f;
326 }
113 327
114 ar7_gpio_chip.regs = ioremap_nocache(AR7_REGS_GPIO, 328 gpch->regs = ioremap_nocache(AR7_REGS_GPIO,
115 AR7_REGS_GPIO + 0x10); 329 AR7_REGS_GPIO + 0x10);
116 330
117 if (!ar7_gpio_chip.regs) { 331 if (!gpch->regs) {
118 printk(KERN_ERR "ar7-gpio: failed to ioremap regs\n"); 332 printk(KERN_ERR "%s: failed to ioremap regs\n",
333 gpch->chip.label);
119 return -ENOMEM; 334 return -ENOMEM;
120 } 335 }
121 336
122 ret = gpiochip_add(&ar7_gpio_chip.chip); 337 ret = gpiochip_add(&gpch->chip);
123 if (ret) { 338 if (ret) {
124 printk(KERN_ERR "ar7-gpio: failed to add gpiochip\n"); 339 printk(KERN_ERR "%s: failed to add gpiochip\n",
340 gpch->chip.label);
125 return ret; 341 return ret;
126 } 342 }
127 printk(KERN_INFO "ar7-gpio: registered %d GPIOs\n", 343 printk(KERN_INFO "%s: registered %d GPIOs\n",
128 ar7_gpio_chip.chip.ngpio); 344 gpch->chip.label, gpch->chip.ngpio);
345
346 if (ar7_is_titan())
347 titan_gpio_init();
348
129 return ret; 349 return ret;
130} 350}
131arch_initcall(ar7_gpio_init);
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 0da5b2b8dd88..7d2fab392327 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -357,6 +357,11 @@ static struct gpio_led default_leds[] = {
357 }, 357 },
358}; 358};
359 359
360static struct gpio_led titan_leds[] = {
361 { .name = "status", .gpio = 8, .active_low = 1, },
362 { .name = "wifi", .gpio = 13, .active_low = 1, },
363};
364
360static struct gpio_led dsl502t_leds[] = { 365static struct gpio_led dsl502t_leds[] = {
361 { 366 {
362 .name = "status", 367 .name = "status",
@@ -495,6 +500,9 @@ static void __init detect_leds(void)
495 } else if (strstr(prid, "DG834")) { 500 } else if (strstr(prid, "DG834")) {
496 ar7_led_data.num_leds = ARRAY_SIZE(dg834g_leds); 501 ar7_led_data.num_leds = ARRAY_SIZE(dg834g_leds);
497 ar7_led_data.leds = dg834g_leds; 502 ar7_led_data.leds = dg834g_leds;
503 } else if (strstr(prid, "CYWM") || strstr(prid, "CYWL")) {
504 ar7_led_data.num_leds = ARRAY_SIZE(titan_leds);
505 ar7_led_data.leds = titan_leds;
498 } 506 }
499} 507}
500 508
@@ -560,6 +568,51 @@ static int __init ar7_register_uarts(void)
560 return 0; 568 return 0;
561} 569}
562 570
571static void __init titan_fixup_devices(void)
572{
573 /* Set vlynq0 data */
574 vlynq_low_data.reset_bit = 15;
575 vlynq_low_data.gpio_bit = 14;
576
577 /* Set vlynq1 data */
578 vlynq_high_data.reset_bit = 16;
579 vlynq_high_data.gpio_bit = 7;
580
581 /* Set vlynq0 resources */
582 vlynq_low_res[0].start = TITAN_REGS_VLYNQ0;
583 vlynq_low_res[0].end = TITAN_REGS_VLYNQ0 + 0xff;
584 vlynq_low_res[1].start = 33;
585 vlynq_low_res[1].end = 33;
586 vlynq_low_res[2].start = 0x0c000000;
587 vlynq_low_res[2].end = 0x0fffffff;
588 vlynq_low_res[3].start = 80;
589 vlynq_low_res[3].end = 111;
590
591 /* Set vlynq1 resources */
592 vlynq_high_res[0].start = TITAN_REGS_VLYNQ1;
593 vlynq_high_res[0].end = TITAN_REGS_VLYNQ1 + 0xff;
594 vlynq_high_res[1].start = 34;
595 vlynq_high_res[1].end = 34;
596 vlynq_high_res[2].start = 0x40000000;
597 vlynq_high_res[2].end = 0x43ffffff;
598 vlynq_high_res[3].start = 112;
599 vlynq_high_res[3].end = 143;
600
601 /* Set cpmac0 data */
602 cpmac_low_data.phy_mask = 0x40000000;
603
604 /* Set cpmac1 data */
605 cpmac_high_data.phy_mask = 0x80000000;
606
607 /* Set cpmac0 resources */
608 cpmac_low_res[0].start = TITAN_REGS_MAC0;
609 cpmac_low_res[0].end = TITAN_REGS_MAC0 + 0x7ff;
610
611 /* Set cpmac1 resources */
612 cpmac_high_res[0].start = TITAN_REGS_MAC1;
613 cpmac_high_res[0].end = TITAN_REGS_MAC1 + 0x7ff;
614}
615
563static int __init ar7_register_devices(void) 616static int __init ar7_register_devices(void)
564{ 617{
565 void __iomem *bootcr; 618 void __iomem *bootcr;
@@ -574,6 +627,9 @@ static int __init ar7_register_devices(void)
574 if (res) 627 if (res)
575 pr_warning("unable to register physmap-flash: %d\n", res); 628 pr_warning("unable to register physmap-flash: %d\n", res);
576 629
630 if (ar7_is_titan())
631 titan_fixup_devices();
632
577 ar7_device_disable(vlynq_low_data.reset_bit); 633 ar7_device_disable(vlynq_low_data.reset_bit);
578 res = platform_device_register(&vlynq_low); 634 res = platform_device_register(&vlynq_low);
579 if (res) 635 if (res)
diff --git a/arch/mips/ar7/prom.c b/arch/mips/ar7/prom.c
index 52385790e5c1..23818d299127 100644
--- a/arch/mips/ar7/prom.c
+++ b/arch/mips/ar7/prom.c
@@ -246,6 +246,8 @@ void __init prom_init(void)
246 ar7_init_cmdline(fw_arg0, (char **)fw_arg1); 246 ar7_init_cmdline(fw_arg0, (char **)fw_arg1);
247 ar7_init_env((struct env_var *)fw_arg2); 247 ar7_init_env((struct env_var *)fw_arg2);
248 console_config(); 248 console_config();
249
250 ar7_gpio_init();
249} 251}
250 252
251#define PORT(offset) (KSEG1ADDR(AR7_REGS_UART0 + (offset * 4))) 253#define PORT(offset) (KSEG1ADDR(AR7_REGS_UART0 + (offset * 4)))
diff --git a/arch/mips/ar7/setup.c b/arch/mips/ar7/setup.c
index 3a801d2cb6e5..f20b53e597c4 100644
--- a/arch/mips/ar7/setup.c
+++ b/arch/mips/ar7/setup.c
@@ -23,6 +23,7 @@
23#include <asm/reboot.h> 23#include <asm/reboot.h>
24#include <asm/mach-ar7/ar7.h> 24#include <asm/mach-ar7/ar7.h>
25#include <asm/mach-ar7/prom.h> 25#include <asm/mach-ar7/prom.h>
26#include <asm/mach-ar7/gpio.h>
26 27
27static void ar7_machine_restart(char *command) 28static void ar7_machine_restart(char *command)
28{ 29{
@@ -49,6 +50,8 @@ static void ar7_machine_power_off(void)
49const char *get_system_type(void) 50const char *get_system_type(void)
50{ 51{
51 u16 chip_id = ar7_chip_id(); 52 u16 chip_id = ar7_chip_id();
53 u16 titan_variant_id = titan_chip_id();
54
52 switch (chip_id) { 55 switch (chip_id) {
53 case AR7_CHIP_7100: 56 case AR7_CHIP_7100:
54 return "TI AR7 (TNETD7100)"; 57 return "TI AR7 (TNETD7100)";
@@ -56,6 +59,17 @@ const char *get_system_type(void)
56 return "TI AR7 (TNETD7200)"; 59 return "TI AR7 (TNETD7200)";
57 case AR7_CHIP_7300: 60 case AR7_CHIP_7300:
58 return "TI AR7 (TNETD7300)"; 61 return "TI AR7 (TNETD7300)";
62 case AR7_CHIP_TITAN:
63 switch (titan_variant_id) {
64 case TITAN_CHIP_1050:
65 return "TI AR7 (TNETV1050)";
66 case TITAN_CHIP_1055:
67 return "TI AR7 (TNETV1055)";
68 case TITAN_CHIP_1056:
69 return "TI AR7 (TNETV1056)";
70 case TITAN_CHIP_1060:
71 return "TI AR7 (TNETV1060)";
72 }
59 default: 73 default:
60 return "TI AR7 (unknown)"; 74 return "TI AR7 (unknown)";
61 } 75 }
diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index cbb7caf86d77..7c7e4d4486ce 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -10,7 +10,9 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/cpu.h> 12#include <linux/cpu.h>
13#include <asm/cpu.h>
13#include <asm/cpu-info.h> 14#include <asm/cpu-info.h>
15#include <asm/mipsregs.h>
14#include <bcm63xx_cpu.h> 16#include <bcm63xx_cpu.h>
15#include <bcm63xx_regs.h> 17#include <bcm63xx_regs.h>
16#include <bcm63xx_io.h> 18#include <bcm63xx_io.h>
@@ -296,26 +298,24 @@ void __init bcm63xx_cpu_init(void)
296 expected_cpu_id = 0; 298 expected_cpu_id = 0;
297 299
298 switch (c->cputype) { 300 switch (c->cputype) {
299 /* 301 case CPU_BMIPS3300:
300 * BCM6338 as the same PrId as BCM3302 see arch/mips/kernel/cpu-probe.c 302 if ((read_c0_prid() & 0xff00) == PRID_IMP_BMIPS3300_ALT) {
301 */ 303 expected_cpu_id = BCM6348_CPU_ID;
302 case CPU_BCM3302: 304 bcm63xx_regs_base = bcm96348_regs_base;
303 __cpu_name[cpu] = "Broadcom BCM6338"; 305 bcm63xx_irqs = bcm96348_irqs;
304 expected_cpu_id = BCM6338_CPU_ID; 306 } else {
305 bcm63xx_regs_base = bcm96338_regs_base; 307 __cpu_name[cpu] = "Broadcom BCM6338";
306 bcm63xx_irqs = bcm96338_irqs; 308 expected_cpu_id = BCM6338_CPU_ID;
309 bcm63xx_regs_base = bcm96338_regs_base;
310 bcm63xx_irqs = bcm96338_irqs;
311 }
307 break; 312 break;
308 case CPU_BCM6345: 313 case CPU_BMIPS32:
309 expected_cpu_id = BCM6345_CPU_ID; 314 expected_cpu_id = BCM6345_CPU_ID;
310 bcm63xx_regs_base = bcm96345_regs_base; 315 bcm63xx_regs_base = bcm96345_regs_base;
311 bcm63xx_irqs = bcm96345_irqs; 316 bcm63xx_irqs = bcm96345_irqs;
312 break; 317 break;
313 case CPU_BCM6348: 318 case CPU_BMIPS4350:
314 expected_cpu_id = BCM6348_CPU_ID;
315 bcm63xx_regs_base = bcm96348_regs_base;
316 bcm63xx_irqs = bcm96348_irqs;
317 break;
318 case CPU_BCM6358:
319 expected_cpu_id = BCM6358_CPU_ID; 319 expected_cpu_id = BCM6358_CPU_ID;
320 bcm63xx_regs_base = bcm96358_regs_base; 320 bcm63xx_regs_base = bcm96358_regs_base;
321 bcm63xx_irqs = bcm96358_irqs; 321 bcm63xx_irqs = bcm96358_irqs;
diff --git a/arch/mips/cavium-octeon/Kconfig b/arch/mips/cavium-octeon/Kconfig
index 47323ca452dc..caae22858163 100644
--- a/arch/mips/cavium-octeon/Kconfig
+++ b/arch/mips/cavium-octeon/Kconfig
@@ -3,6 +3,17 @@ config CAVIUM_OCTEON_SPECIFIC_OPTIONS
3 depends on CPU_CAVIUM_OCTEON 3 depends on CPU_CAVIUM_OCTEON
4 default "y" 4 default "y"
5 5
6config CAVIUM_CN63XXP1
7 bool "Enable CN63XXP1 errata worarounds"
8 depends on CAVIUM_OCTEON_SPECIFIC_OPTIONS
9 default "n"
10 help
11 The CN63XXP1 chip requires build time workarounds to
12 function reliably, select this option to enable them. These
13 workarounds will cause a slight decrease in performance on
14 non-CN63XXP1 hardware, so it is recommended to select "n"
15 unless it is known the workarounds are needed.
16
6config CAVIUM_OCTEON_2ND_KERNEL 17config CAVIUM_OCTEON_2ND_KERNEL
7 bool "Build the kernel to be used as a 2nd kernel on the same chip" 18 bool "Build the kernel to be used as a 2nd kernel on the same chip"
8 depends on CAVIUM_OCTEON_SPECIFIC_OPTIONS 19 depends on CAVIUM_OCTEON_SPECIFIC_OPTIONS
@@ -87,3 +98,15 @@ config ARCH_SPARSEMEM_ENABLE
87config CAVIUM_OCTEON_HELPER 98config CAVIUM_OCTEON_HELPER
88 def_bool y 99 def_bool y
89 depends on OCTEON_ETHERNET || PCI 100 depends on OCTEON_ETHERNET || PCI
101
102config IOMMU_HELPER
103 bool
104
105config NEED_SG_DMA_LENGTH
106 bool
107
108config SWIOTLB
109 def_bool y
110 depends on CPU_CAVIUM_OCTEON
111 select IOMMU_HELPER
112 select NEED_SG_DMA_LENGTH
diff --git a/arch/mips/cavium-octeon/csrc-octeon.c b/arch/mips/cavium-octeon/csrc-octeon.c
index b6847c8e0ddd..26bf71130bf8 100644
--- a/arch/mips/cavium-octeon/csrc-octeon.c
+++ b/arch/mips/cavium-octeon/csrc-octeon.c
@@ -4,14 +4,18 @@
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2007 by Ralf Baechle 6 * Copyright (C) 2007 by Ralf Baechle
7 * Copyright (C) 2009, 2010 Cavium Networks, Inc.
7 */ 8 */
8#include <linux/clocksource.h> 9#include <linux/clocksource.h>
9#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/smp.h>
10 12
13#include <asm/cpu-info.h>
11#include <asm/time.h> 14#include <asm/time.h>
12 15
13#include <asm/octeon/octeon.h> 16#include <asm/octeon/octeon.h>
14#include <asm/octeon/cvmx-ipd-defs.h> 17#include <asm/octeon/cvmx-ipd-defs.h>
18#include <asm/octeon/cvmx-mio-defs.h>
15 19
16/* 20/*
17 * Set the current core's cvmcount counter to the value of the 21 * Set the current core's cvmcount counter to the value of the
@@ -19,11 +23,23 @@
19 * on-line. This allows for a read from a local cpu register to 23 * on-line. This allows for a read from a local cpu register to
20 * access a synchronized counter. 24 * access a synchronized counter.
21 * 25 *
26 * On CPU_CAVIUM_OCTEON2 the IPD_CLK_COUNT is scaled by rdiv/sdiv.
22 */ 27 */
23void octeon_init_cvmcount(void) 28void octeon_init_cvmcount(void)
24{ 29{
25 unsigned long flags; 30 unsigned long flags;
26 unsigned loops = 2; 31 unsigned loops = 2;
32 u64 f = 0;
33 u64 rdiv = 0;
34 u64 sdiv = 0;
35 if (current_cpu_type() == CPU_CAVIUM_OCTEON2) {
36 union cvmx_mio_rst_boot rst_boot;
37 rst_boot.u64 = cvmx_read_csr(CVMX_MIO_RST_BOOT);
38 rdiv = rst_boot.s.c_mul; /* CPU clock */
39 sdiv = rst_boot.s.pnr_mul; /* I/O clock */
40 f = (0x8000000000000000ull / sdiv) * 2;
41 }
42
27 43
28 /* Clobber loops so GCC will not unroll the following while loop. */ 44 /* Clobber loops so GCC will not unroll the following while loop. */
29 asm("" : "+r" (loops)); 45 asm("" : "+r" (loops));
@@ -33,8 +49,20 @@ void octeon_init_cvmcount(void)
33 * Loop several times so we are executing from the cache, 49 * Loop several times so we are executing from the cache,
34 * which should give more deterministic timing. 50 * which should give more deterministic timing.
35 */ 51 */
36 while (loops--) 52 while (loops--) {
37 write_c0_cvmcount(cvmx_read_csr(CVMX_IPD_CLK_COUNT)); 53 u64 ipd_clk_count = cvmx_read_csr(CVMX_IPD_CLK_COUNT);
54 if (rdiv != 0) {
55 ipd_clk_count *= rdiv;
56 if (f != 0) {
57 asm("dmultu\t%[cnt],%[f]\n\t"
58 "mfhi\t%[cnt]"
59 : [cnt] "+r" (ipd_clk_count),
60 [f] "=r" (f)
61 : : "hi", "lo");
62 }
63 }
64 write_c0_cvmcount(ipd_clk_count);
65 }
38 local_irq_restore(flags); 66 local_irq_restore(flags);
39} 67}
40 68
@@ -77,7 +105,7 @@ unsigned long long notrace sched_clock(void)
77void __init plat_time_init(void) 105void __init plat_time_init(void)
78{ 106{
79 clocksource_mips.rating = 300; 107 clocksource_mips.rating = 300;
80 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency); 108 clocksource_set_clock(&clocksource_mips, octeon_get_clock_rate());
81 clocksource_register(&clocksource_mips); 109 clocksource_register(&clocksource_mips);
82} 110}
83 111
diff --git a/arch/mips/cavium-octeon/dma-octeon.c b/arch/mips/cavium-octeon/dma-octeon.c
index d22b5a2d64f4..1abb66caaa1d 100644
--- a/arch/mips/cavium-octeon/dma-octeon.c
+++ b/arch/mips/cavium-octeon/dma-octeon.c
@@ -8,335 +8,342 @@
8 * Copyright (C) 2005 Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com> 8 * Copyright (C) 2005 Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com>
9 * swiped from i386, and cloned for MIPS by Geert, polished by Ralf. 9 * swiped from i386, and cloned for MIPS by Geert, polished by Ralf.
10 * IP32 changes by Ilya. 10 * IP32 changes by Ilya.
11 * Cavium Networks: Create new dma setup for Cavium Networks Octeon based on 11 * Copyright (C) 2010 Cavium Networks, Inc.
12 * the kernels original.
13 */ 12 */
14#include <linux/types.h>
15#include <linux/mm.h>
16#include <linux/module.h>
17#include <linux/string.h>
18#include <linux/dma-mapping.h> 13#include <linux/dma-mapping.h>
19#include <linux/platform_device.h>
20#include <linux/scatterlist.h> 14#include <linux/scatterlist.h>
15#include <linux/bootmem.h>
16#include <linux/swiotlb.h>
17#include <linux/types.h>
18#include <linux/init.h>
19#include <linux/mm.h>
21 20
22#include <linux/cache.h> 21#include <asm/bootinfo.h>
23#include <linux/io.h>
24 22
25#include <asm/octeon/octeon.h> 23#include <asm/octeon/octeon.h>
24
25#ifdef CONFIG_PCI
26#include <asm/octeon/pci-octeon.h>
26#include <asm/octeon/cvmx-npi-defs.h> 27#include <asm/octeon/cvmx-npi-defs.h>
27#include <asm/octeon/cvmx-pci-defs.h> 28#include <asm/octeon/cvmx-pci-defs.h>
28 29
29#include <dma-coherence.h> 30static dma_addr_t octeon_hole_phys_to_dma(phys_addr_t paddr)
31{
32 if (paddr >= CVMX_PCIE_BAR1_PHYS_BASE && paddr < (CVMX_PCIE_BAR1_PHYS_BASE + CVMX_PCIE_BAR1_PHYS_SIZE))
33 return paddr - CVMX_PCIE_BAR1_PHYS_BASE + CVMX_PCIE_BAR1_RC_BASE;
34 else
35 return paddr;
36}
30 37
31#ifdef CONFIG_PCI 38static phys_addr_t octeon_hole_dma_to_phys(dma_addr_t daddr)
32#include <asm/octeon/pci-octeon.h> 39{
33#endif 40 if (daddr >= CVMX_PCIE_BAR1_RC_BASE)
41 return daddr + CVMX_PCIE_BAR1_PHYS_BASE - CVMX_PCIE_BAR1_RC_BASE;
42 else
43 return daddr;
44}
45
46static dma_addr_t octeon_gen1_phys_to_dma(struct device *dev, phys_addr_t paddr)
47{
48 if (paddr >= 0x410000000ull && paddr < 0x420000000ull)
49 paddr -= 0x400000000ull;
50 return octeon_hole_phys_to_dma(paddr);
51}
34 52
35#define BAR2_PCI_ADDRESS 0x8000000000ul 53static phys_addr_t octeon_gen1_dma_to_phys(struct device *dev, dma_addr_t daddr)
54{
55 daddr = octeon_hole_dma_to_phys(daddr);
36 56
37struct bar1_index_state { 57 if (daddr >= 0x10000000ull && daddr < 0x20000000ull)
38 int16_t ref_count; /* Number of PCI mappings using this index */ 58 daddr += 0x400000000ull;
39 uint16_t address_bits; /* Upper bits of physical address. This is
40 shifted 22 bits */
41};
42 59
43#ifdef CONFIG_PCI 60 return daddr;
44static DEFINE_RAW_SPINLOCK(bar1_lock); 61}
45static struct bar1_index_state bar1_state[32];
46#endif
47 62
48dma_addr_t octeon_map_dma_mem(struct device *dev, void *ptr, size_t size) 63static dma_addr_t octeon_big_phys_to_dma(struct device *dev, phys_addr_t paddr)
49{ 64{
50#ifndef CONFIG_PCI 65 if (paddr >= 0x410000000ull && paddr < 0x420000000ull)
51 /* Without PCI/PCIe this function can be called for Octeon internal 66 paddr -= 0x400000000ull;
52 devices such as USB. These devices all support 64bit addressing */ 67
68 /* Anything in the BAR1 hole or above goes via BAR2 */
69 if (paddr >= 0xf0000000ull)
70 paddr = OCTEON_BAR2_PCI_ADDRESS + paddr;
71
72 return paddr;
73}
74
75static phys_addr_t octeon_big_dma_to_phys(struct device *dev, dma_addr_t daddr)
76{
77 if (daddr >= OCTEON_BAR2_PCI_ADDRESS)
78 daddr -= OCTEON_BAR2_PCI_ADDRESS;
79
80 if (daddr >= 0x10000000ull && daddr < 0x20000000ull)
81 daddr += 0x400000000ull;
82 return daddr;
83}
84
85static dma_addr_t octeon_small_phys_to_dma(struct device *dev,
86 phys_addr_t paddr)
87{
88 if (paddr >= 0x410000000ull && paddr < 0x420000000ull)
89 paddr -= 0x400000000ull;
90
91 /* Anything not in the BAR1 range goes via BAR2 */
92 if (paddr >= octeon_bar1_pci_phys && paddr < octeon_bar1_pci_phys + 0x8000000ull)
93 paddr = paddr - octeon_bar1_pci_phys;
94 else
95 paddr = OCTEON_BAR2_PCI_ADDRESS + paddr;
96
97 return paddr;
98}
99
100static phys_addr_t octeon_small_dma_to_phys(struct device *dev,
101 dma_addr_t daddr)
102{
103 if (daddr >= OCTEON_BAR2_PCI_ADDRESS)
104 daddr -= OCTEON_BAR2_PCI_ADDRESS;
105 else
106 daddr += octeon_bar1_pci_phys;
107
108 if (daddr >= 0x10000000ull && daddr < 0x20000000ull)
109 daddr += 0x400000000ull;
110 return daddr;
111}
112
113#endif /* CONFIG_PCI */
114
115static dma_addr_t octeon_dma_map_page(struct device *dev, struct page *page,
116 unsigned long offset, size_t size, enum dma_data_direction direction,
117 struct dma_attrs *attrs)
118{
119 dma_addr_t daddr = swiotlb_map_page(dev, page, offset, size,
120 direction, attrs);
53 mb(); 121 mb();
54 return virt_to_phys(ptr);
55#else
56 unsigned long flags;
57 uint64_t dma_mask;
58 int64_t start_index;
59 dma_addr_t result = -1;
60 uint64_t physical = virt_to_phys(ptr);
61 int64_t index;
62 122
123 return daddr;
124}
125
126static int octeon_dma_map_sg(struct device *dev, struct scatterlist *sg,
127 int nents, enum dma_data_direction direction, struct dma_attrs *attrs)
128{
129 int r = swiotlb_map_sg_attrs(dev, sg, nents, direction, attrs);
63 mb(); 130 mb();
64 /* 131 return r;
65 * Use the DMA masks to determine the allowed memory 132}
66 * region. For us it doesn't limit the actual memory, just the
67 * address visible over PCI. Devices with limits need to use
68 * lower indexed Bar1 entries.
69 */
70 if (dev) {
71 dma_mask = dev->coherent_dma_mask;
72 if (dev->dma_mask)
73 dma_mask = *dev->dma_mask;
74 } else {
75 dma_mask = 0xfffffffful;
76 }
77 133
78 /* 134static void octeon_dma_sync_single_for_device(struct device *dev,
79 * Platform devices, such as the internal USB, skip all 135 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
80 * translation and use Octeon physical addresses directly. 136{
81 */ 137 swiotlb_sync_single_for_device(dev, dma_handle, size, direction);
82 if (!dev || dev->bus == &platform_bus_type) 138 mb();
83 return physical; 139}
84 140
85 switch (octeon_dma_bar_type) { 141static void octeon_dma_sync_sg_for_device(struct device *dev,
86 case OCTEON_DMA_BAR_TYPE_PCIE: 142 struct scatterlist *sg, int nelems, enum dma_data_direction direction)
87 if (unlikely(physical < (16ul << 10))) 143{
88 panic("dma_map_single: Not allowed to map first 16KB." 144 swiotlb_sync_sg_for_device(dev, sg, nelems, direction);
89 " It interferes with BAR0 special area\n"); 145 mb();
90 else if ((physical + size >= (256ul << 20)) && 146}
91 (physical < (512ul << 20)))
92 panic("dma_map_single: Not allowed to map bootbus\n");
93 else if ((physical + size >= 0x400000000ull) &&
94 physical < 0x410000000ull)
95 panic("dma_map_single: "
96 "Attempt to map illegal memory address 0x%llx\n",
97 physical);
98 else if (physical >= 0x420000000ull)
99 panic("dma_map_single: "
100 "Attempt to map illegal memory address 0x%llx\n",
101 physical);
102 else if (physical >= CVMX_PCIE_BAR1_PHYS_BASE &&
103 physical + size < (CVMX_PCIE_BAR1_PHYS_BASE + CVMX_PCIE_BAR1_PHYS_SIZE)) {
104 result = physical - CVMX_PCIE_BAR1_PHYS_BASE + CVMX_PCIE_BAR1_RC_BASE;
105
106 if (((result+size-1) & dma_mask) != result+size-1)
107 panic("dma_map_single: Attempt to map address 0x%llx-0x%llx, which can't be accessed according to the dma mask 0x%llx\n",
108 physical, physical+size-1, dma_mask);
109 goto done;
110 }
111
112 /* The 2nd 256MB is mapped at 256<<20 instead of 0x410000000 */
113 if ((physical >= 0x410000000ull) && physical < 0x420000000ull)
114 result = physical - 0x400000000ull;
115 else
116 result = physical;
117 if (((result+size-1) & dma_mask) != result+size-1)
118 panic("dma_map_single: Attempt to map address "
119 "0x%llx-0x%llx, which can't be accessed "
120 "according to the dma mask 0x%llx\n",
121 physical, physical+size-1, dma_mask);
122 goto done;
123 147
124 case OCTEON_DMA_BAR_TYPE_BIG: 148static void *octeon_dma_alloc_coherent(struct device *dev, size_t size,
125#ifdef CONFIG_64BIT 149 dma_addr_t *dma_handle, gfp_t gfp)
126 /* If the device supports 64bit addressing, then use BAR2 */ 150{
127 if (dma_mask > BAR2_PCI_ADDRESS) { 151 void *ret;
128 result = physical + BAR2_PCI_ADDRESS;
129 goto done;
130 }
131#endif
132 if (unlikely(physical < (4ul << 10))) {
133 panic("dma_map_single: Not allowed to map first 4KB. "
134 "It interferes with BAR0 special area\n");
135 } else if (physical < (256ul << 20)) {
136 if (unlikely(physical + size > (256ul << 20)))
137 panic("dma_map_single: Requested memory spans "
138 "Bar0 0:256MB and bootbus\n");
139 result = physical;
140 goto done;
141 } else if (unlikely(physical < (512ul << 20))) {
142 panic("dma_map_single: Not allowed to map bootbus\n");
143 } else if (physical < (2ul << 30)) {
144 if (unlikely(physical + size > (2ul << 30)))
145 panic("dma_map_single: Requested memory spans "
146 "Bar0 512MB:2GB and BAR1\n");
147 result = physical;
148 goto done;
149 } else if (physical < (2ul << 30) + (128 << 20)) {
150 /* Fall through */
151 } else if (physical <
152 (4ul << 30) - (OCTEON_PCI_BAR1_HOLE_SIZE << 20)) {
153 if (unlikely
154 (physical + size >
155 (4ul << 30) - (OCTEON_PCI_BAR1_HOLE_SIZE << 20)))
156 panic("dma_map_single: Requested memory "
157 "extends past Bar1 (4GB-%luMB)\n",
158 OCTEON_PCI_BAR1_HOLE_SIZE);
159 result = physical;
160 goto done;
161 } else if ((physical >= 0x410000000ull) &&
162 (physical < 0x420000000ull)) {
163 if (unlikely(physical + size > 0x420000000ull))
164 panic("dma_map_single: Requested memory spans "
165 "non existant memory\n");
166 /* BAR0 fixed mapping 256MB:512MB ->
167 * 16GB+256MB:16GB+512MB */
168 result = physical - 0x400000000ull;
169 goto done;
170 } else {
171 /* Continued below switch statement */
172 }
173 break;
174 152
175 case OCTEON_DMA_BAR_TYPE_SMALL: 153 if (dma_alloc_from_coherent(dev, size, dma_handle, &ret))
176#ifdef CONFIG_64BIT 154 return ret;
177 /* If the device supports 64bit addressing, then use BAR2 */ 155
178 if (dma_mask > BAR2_PCI_ADDRESS) { 156 /* ignore region specifiers */
179 result = physical + BAR2_PCI_ADDRESS; 157 gfp &= ~(__GFP_DMA | __GFP_DMA32 | __GFP_HIGHMEM);
180 goto done; 158
181 } 159#ifdef CONFIG_ZONE_DMA
160 if (dev == NULL)
161 gfp |= __GFP_DMA;
162 else if (dev->coherent_dma_mask <= DMA_BIT_MASK(24))
163 gfp |= __GFP_DMA;
164 else
182#endif 165#endif
183 /* Continued below switch statement */ 166#ifdef CONFIG_ZONE_DMA32
184 break; 167 if (dev->coherent_dma_mask <= DMA_BIT_MASK(32))
168 gfp |= __GFP_DMA32;
169 else
170#endif
171 ;
185 172
186 default: 173 /* Don't invoke OOM killer */
187 panic("dma_map_single: Invalid octeon_dma_bar_type\n"); 174 gfp |= __GFP_NORETRY;
188 }
189 175
190 /* Don't allow mapping to span multiple Bar entries. The hardware guys 176 ret = swiotlb_alloc_coherent(dev, size, dma_handle, gfp);
191 won't guarantee that DMA across boards work */
192 if (unlikely((physical >> 22) != ((physical + size - 1) >> 22)))
193 panic("dma_map_single: "
194 "Requested memory spans more than one Bar1 entry\n");
195 177
196 if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_BIG) 178 mb();
197 start_index = 31;
198 else if (unlikely(dma_mask < (1ul << 27)))
199 start_index = (dma_mask >> 22);
200 else
201 start_index = 31;
202
203 /* Only one processor can access the Bar register at once */
204 raw_spin_lock_irqsave(&bar1_lock, flags);
205
206 /* Look through Bar1 for existing mapping that will work */
207 for (index = start_index; index >= 0; index--) {
208 if ((bar1_state[index].address_bits == physical >> 22) &&
209 (bar1_state[index].ref_count)) {
210 /* An existing mapping will work, use it */
211 bar1_state[index].ref_count++;
212 if (unlikely(bar1_state[index].ref_count < 0))
213 panic("dma_map_single: "
214 "Bar1[%d] reference count overflowed\n",
215 (int) index);
216 result = (index << 22) | (physical & ((1 << 22) - 1));
217 /* Large BAR1 is offset at 2GB */
218 if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_BIG)
219 result += 2ul << 30;
220 goto done_unlock;
221 }
222 }
223 179
224 /* No existing mappings, look for a free entry */ 180 return ret;
225 for (index = start_index; index >= 0; index--) { 181}
226 if (unlikely(bar1_state[index].ref_count == 0)) {
227 union cvmx_pci_bar1_indexx bar1_index;
228 /* We have a free entry, use it */
229 bar1_state[index].ref_count = 1;
230 bar1_state[index].address_bits = physical >> 22;
231 bar1_index.u32 = 0;
232 /* Address bits[35:22] sent to L2C */
233 bar1_index.s.addr_idx = physical >> 22;
234 /* Don't put PCI accesses in L2. */
235 bar1_index.s.ca = 1;
236 /* Endian Swap Mode */
237 bar1_index.s.end_swp = 1;
238 /* Set '1' when the selected address range is valid. */
239 bar1_index.s.addr_v = 1;
240 octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index),
241 bar1_index.u32);
242 /* An existing mapping will work, use it */
243 result = (index << 22) | (physical & ((1 << 22) - 1));
244 /* Large BAR1 is offset at 2GB */
245 if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_BIG)
246 result += 2ul << 30;
247 goto done_unlock;
248 }
249 }
250 182
251 pr_err("dma_map_single: " 183static void octeon_dma_free_coherent(struct device *dev, size_t size,
252 "Can't find empty BAR1 index for physical mapping 0x%llx\n", 184 void *vaddr, dma_addr_t dma_handle)
253 (unsigned long long) physical); 185{
186 int order = get_order(size);
254 187
255done_unlock: 188 if (dma_release_from_coherent(dev, order, vaddr))
256 raw_spin_unlock_irqrestore(&bar1_lock, flags); 189 return;
257done: 190
258 pr_debug("dma_map_single 0x%llx->0x%llx\n", physical, result); 191 swiotlb_free_coherent(dev, size, vaddr, dma_handle);
259 return result;
260#endif
261} 192}
262 193
263void octeon_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr) 194static dma_addr_t octeon_unity_phys_to_dma(struct device *dev, phys_addr_t paddr)
264{ 195{
265#ifndef CONFIG_PCI 196 return paddr;
266 /* 197}
267 * Without PCI/PCIe this function can be called for Octeon internal
268 * devices such as USB. These devices all support 64bit addressing.
269 */
270 return;
271#else
272 unsigned long flags;
273 uint64_t index;
274 198
199static phys_addr_t octeon_unity_dma_to_phys(struct device *dev, dma_addr_t daddr)
200{
201 return daddr;
202}
203
204struct octeon_dma_map_ops {
205 struct dma_map_ops dma_map_ops;
206 dma_addr_t (*phys_to_dma)(struct device *dev, phys_addr_t paddr);
207 phys_addr_t (*dma_to_phys)(struct device *dev, dma_addr_t daddr);
208};
209
210dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
211{
212 struct octeon_dma_map_ops *ops = container_of(get_dma_ops(dev),
213 struct octeon_dma_map_ops,
214 dma_map_ops);
215
216 return ops->phys_to_dma(dev, paddr);
217}
218EXPORT_SYMBOL(phys_to_dma);
219
220phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
221{
222 struct octeon_dma_map_ops *ops = container_of(get_dma_ops(dev),
223 struct octeon_dma_map_ops,
224 dma_map_ops);
225
226 return ops->dma_to_phys(dev, daddr);
227}
228EXPORT_SYMBOL(dma_to_phys);
229
230static struct octeon_dma_map_ops octeon_linear_dma_map_ops = {
231 .dma_map_ops = {
232 .alloc_coherent = octeon_dma_alloc_coherent,
233 .free_coherent = octeon_dma_free_coherent,
234 .map_page = octeon_dma_map_page,
235 .unmap_page = swiotlb_unmap_page,
236 .map_sg = octeon_dma_map_sg,
237 .unmap_sg = swiotlb_unmap_sg_attrs,
238 .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
239 .sync_single_for_device = octeon_dma_sync_single_for_device,
240 .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
241 .sync_sg_for_device = octeon_dma_sync_sg_for_device,
242 .mapping_error = swiotlb_dma_mapping_error,
243 .dma_supported = swiotlb_dma_supported
244 },
245 .phys_to_dma = octeon_unity_phys_to_dma,
246 .dma_to_phys = octeon_unity_dma_to_phys
247};
248
249char *octeon_swiotlb;
250
251void __init plat_swiotlb_setup(void)
252{
253 int i;
254 phys_t max_addr;
255 phys_t addr_size;
256 size_t swiotlbsize;
257 unsigned long swiotlb_nslabs;
258
259 max_addr = 0;
260 addr_size = 0;
261
262 for (i = 0 ; i < boot_mem_map.nr_map; i++) {
263 struct boot_mem_map_entry *e = &boot_mem_map.map[i];
264 if (e->type != BOOT_MEM_RAM)
265 continue;
266
267 /* These addresses map low for PCI. */
268 if (e->addr > 0x410000000ull)
269 continue;
270
271 addr_size += e->size;
272
273 if (max_addr < e->addr + e->size)
274 max_addr = e->addr + e->size;
275
276 }
277
278 swiotlbsize = PAGE_SIZE;
279
280#ifdef CONFIG_PCI
275 /* 281 /*
276 * Platform devices, such as the internal USB, skip all 282 * For OCTEON_DMA_BAR_TYPE_SMALL, size the iotlb at 1/4 memory
277 * translation and use Octeon physical addresses directly. 283 * size to a maximum of 64MB
278 */ 284 */
279 if (dev->bus == &platform_bus_type) 285 if (OCTEON_IS_MODEL(OCTEON_CN31XX)
280 return; 286 || OCTEON_IS_MODEL(OCTEON_CN38XX_PASS2)) {
287 swiotlbsize = addr_size / 4;
288 if (swiotlbsize > 64 * (1<<20))
289 swiotlbsize = 64 * (1<<20);
290 } else if (max_addr > 0xf0000000ul) {
291 /*
292 * Otherwise only allocate a big iotlb if there is
293 * memory past the BAR1 hole.
294 */
295 swiotlbsize = 64 * (1<<20);
296 }
297#endif
298 swiotlb_nslabs = swiotlbsize >> IO_TLB_SHIFT;
299 swiotlb_nslabs = ALIGN(swiotlb_nslabs, IO_TLB_SEGSIZE);
300 swiotlbsize = swiotlb_nslabs << IO_TLB_SHIFT;
301
302 octeon_swiotlb = alloc_bootmem_low_pages(swiotlbsize);
281 303
304 swiotlb_init_with_tbl(octeon_swiotlb, swiotlb_nslabs, 1);
305
306 mips_dma_map_ops = &octeon_linear_dma_map_ops.dma_map_ops;
307}
308
309#ifdef CONFIG_PCI
310static struct octeon_dma_map_ops _octeon_pci_dma_map_ops = {
311 .dma_map_ops = {
312 .alloc_coherent = octeon_dma_alloc_coherent,
313 .free_coherent = octeon_dma_free_coherent,
314 .map_page = octeon_dma_map_page,
315 .unmap_page = swiotlb_unmap_page,
316 .map_sg = octeon_dma_map_sg,
317 .unmap_sg = swiotlb_unmap_sg_attrs,
318 .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
319 .sync_single_for_device = octeon_dma_sync_single_for_device,
320 .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
321 .sync_sg_for_device = octeon_dma_sync_sg_for_device,
322 .mapping_error = swiotlb_dma_mapping_error,
323 .dma_supported = swiotlb_dma_supported
324 },
325};
326
327struct dma_map_ops *octeon_pci_dma_map_ops;
328
329void __init octeon_pci_dma_init(void)
330{
282 switch (octeon_dma_bar_type) { 331 switch (octeon_dma_bar_type) {
283 case OCTEON_DMA_BAR_TYPE_PCIE: 332 case OCTEON_DMA_BAR_TYPE_PCIE:
284 /* Nothing to do, all mappings are static */ 333 _octeon_pci_dma_map_ops.phys_to_dma = octeon_gen1_phys_to_dma;
285 goto done; 334 _octeon_pci_dma_map_ops.dma_to_phys = octeon_gen1_dma_to_phys;
286 335 break;
287 case OCTEON_DMA_BAR_TYPE_BIG: 336 case OCTEON_DMA_BAR_TYPE_BIG:
288#ifdef CONFIG_64BIT 337 _octeon_pci_dma_map_ops.phys_to_dma = octeon_big_phys_to_dma;
289 /* Nothing to do for addresses using BAR2 */ 338 _octeon_pci_dma_map_ops.dma_to_phys = octeon_big_dma_to_phys;
290 if (dma_addr >= BAR2_PCI_ADDRESS)
291 goto done;
292#endif
293 if (unlikely(dma_addr < (4ul << 10)))
294 panic("dma_unmap_single: Unexpect DMA address 0x%llx\n",
295 dma_addr);
296 else if (dma_addr < (2ul << 30))
297 /* Nothing to do for addresses using BAR0 */
298 goto done;
299 else if (dma_addr < (2ul << 30) + (128ul << 20))
300 /* Need to unmap, fall through */
301 index = (dma_addr - (2ul << 30)) >> 22;
302 else if (dma_addr <
303 (4ul << 30) - (OCTEON_PCI_BAR1_HOLE_SIZE << 20))
304 goto done; /* Nothing to do for the rest of BAR1 */
305 else
306 panic("dma_unmap_single: Unexpect DMA address 0x%llx\n",
307 dma_addr);
308 /* Continued below switch statement */
309 break; 339 break;
310
311 case OCTEON_DMA_BAR_TYPE_SMALL: 340 case OCTEON_DMA_BAR_TYPE_SMALL:
312#ifdef CONFIG_64BIT 341 _octeon_pci_dma_map_ops.phys_to_dma = octeon_small_phys_to_dma;
313 /* Nothing to do for addresses using BAR2 */ 342 _octeon_pci_dma_map_ops.dma_to_phys = octeon_small_dma_to_phys;
314 if (dma_addr >= BAR2_PCI_ADDRESS)
315 goto done;
316#endif
317 index = dma_addr >> 22;
318 /* Continued below switch statement */
319 break; 343 break;
320
321 default: 344 default:
322 panic("dma_unmap_single: Invalid octeon_dma_bar_type\n"); 345 BUG();
323 } 346 }
324 347 octeon_pci_dma_map_ops = &_octeon_pci_dma_map_ops.dma_map_ops;
325 if (unlikely(index > 31))
326 panic("dma_unmap_single: "
327 "Attempt to unmap an invalid address (0x%llx)\n",
328 dma_addr);
329
330 raw_spin_lock_irqsave(&bar1_lock, flags);
331 bar1_state[index].ref_count--;
332 if (bar1_state[index].ref_count == 0)
333 octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index), 0);
334 else if (unlikely(bar1_state[index].ref_count < 0))
335 panic("dma_unmap_single: Bar1[%u] reference count < 0\n",
336 (int) index);
337 raw_spin_unlock_irqrestore(&bar1_lock, flags);
338done:
339 pr_debug("dma_unmap_single 0x%llx\n", dma_addr);
340 return;
341#endif
342} 348}
349#endif /* CONFIG_PCI */
diff --git a/arch/mips/cavium-octeon/executive/cvmx-l2c.c b/arch/mips/cavium-octeon/executive/cvmx-l2c.c
index 6abe56f1e097..d38246e33ddb 100644
--- a/arch/mips/cavium-octeon/executive/cvmx-l2c.c
+++ b/arch/mips/cavium-octeon/executive/cvmx-l2c.c
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -26,8 +26,8 @@
26 ***********************license end**************************************/ 26 ***********************license end**************************************/
27 27
28/* 28/*
29 * Implementation of the Level 2 Cache (L2C) control, measurement, and 29 * Implementation of the Level 2 Cache (L2C) control,
30 * debugging facilities. 30 * measurement, and debugging facilities.
31 */ 31 */
32 32
33#include <asm/octeon/cvmx.h> 33#include <asm/octeon/cvmx.h>
@@ -42,13 +42,7 @@
42 * if multiple applications or operating systems are running, then it 42 * if multiple applications or operating systems are running, then it
43 * is up to the user program to coordinate between them. 43 * is up to the user program to coordinate between them.
44 */ 44 */
45static cvmx_spinlock_t cvmx_l2c_spinlock; 45cvmx_spinlock_t cvmx_l2c_spinlock;
46
47static inline int l2_size_half(void)
48{
49 uint64_t val = cvmx_read_csr(CVMX_L2D_FUS3);
50 return !!(val & (1ull << 34));
51}
52 46
53int cvmx_l2c_get_core_way_partition(uint32_t core) 47int cvmx_l2c_get_core_way_partition(uint32_t core)
54{ 48{
@@ -58,6 +52,9 @@ int cvmx_l2c_get_core_way_partition(uint32_t core)
58 if (core >= cvmx_octeon_num_cores()) 52 if (core >= cvmx_octeon_num_cores())
59 return -1; 53 return -1;
60 54
55 if (OCTEON_IS_MODEL(OCTEON_CN63XX))
56 return cvmx_read_csr(CVMX_L2C_WPAR_PPX(core)) & 0xffff;
57
61 /* 58 /*
62 * Use the lower two bits of the coreNumber to determine the 59 * Use the lower two bits of the coreNumber to determine the
63 * bit offset of the UMSK[] field in the L2C_SPAR register. 60 * bit offset of the UMSK[] field in the L2C_SPAR register.
@@ -71,17 +68,13 @@ int cvmx_l2c_get_core_way_partition(uint32_t core)
71 68
72 switch (core & 0xC) { 69 switch (core & 0xC) {
73 case 0x0: 70 case 0x0:
74 return (cvmx_read_csr(CVMX_L2C_SPAR0) & (0xFF << field)) >> 71 return (cvmx_read_csr(CVMX_L2C_SPAR0) & (0xFF << field)) >> field;
75 field;
76 case 0x4: 72 case 0x4:
77 return (cvmx_read_csr(CVMX_L2C_SPAR1) & (0xFF << field)) >> 73 return (cvmx_read_csr(CVMX_L2C_SPAR1) & (0xFF << field)) >> field;
78 field;
79 case 0x8: 74 case 0x8:
80 return (cvmx_read_csr(CVMX_L2C_SPAR2) & (0xFF << field)) >> 75 return (cvmx_read_csr(CVMX_L2C_SPAR2) & (0xFF << field)) >> field;
81 field;
82 case 0xC: 76 case 0xC:
83 return (cvmx_read_csr(CVMX_L2C_SPAR3) & (0xFF << field)) >> 77 return (cvmx_read_csr(CVMX_L2C_SPAR3) & (0xFF << field)) >> field;
84 field;
85 } 78 }
86 return 0; 79 return 0;
87} 80}
@@ -95,48 +88,50 @@ int cvmx_l2c_set_core_way_partition(uint32_t core, uint32_t mask)
95 88
96 mask &= valid_mask; 89 mask &= valid_mask;
97 90
98 /* A UMSK setting which blocks all L2C Ways is an error. */ 91 /* A UMSK setting which blocks all L2C Ways is an error on some chips */
99 if (mask == valid_mask) 92 if (mask == valid_mask && !OCTEON_IS_MODEL(OCTEON_CN63XX))
100 return -1; 93 return -1;
101 94
102 /* Validate the core number */ 95 /* Validate the core number */
103 if (core >= cvmx_octeon_num_cores()) 96 if (core >= cvmx_octeon_num_cores())
104 return -1; 97 return -1;
105 98
106 /* Check to make sure current mask & new mask don't block all ways */ 99 if (OCTEON_IS_MODEL(OCTEON_CN63XX)) {
107 if (((mask | cvmx_l2c_get_core_way_partition(core)) & valid_mask) == 100 cvmx_write_csr(CVMX_L2C_WPAR_PPX(core), mask);
108 valid_mask) 101 return 0;
109 return -1; 102 }
110 103
111 /* Use the lower two bits of core to determine the bit offset of the 104 /*
105 * Use the lower two bits of core to determine the bit offset of the
112 * UMSK[] field in the L2C_SPAR register. 106 * UMSK[] field in the L2C_SPAR register.
113 */ 107 */
114 field = (core & 0x3) * 8; 108 field = (core & 0x3) * 8;
115 109
116 /* Assign the new mask setting to the UMSK[] field in the appropriate 110 /*
111 * Assign the new mask setting to the UMSK[] field in the appropriate
117 * L2C_SPAR register based on the core_num. 112 * L2C_SPAR register based on the core_num.
118 * 113 *
119 */ 114 */
120 switch (core & 0xC) { 115 switch (core & 0xC) {
121 case 0x0: 116 case 0x0:
122 cvmx_write_csr(CVMX_L2C_SPAR0, 117 cvmx_write_csr(CVMX_L2C_SPAR0,
123 (cvmx_read_csr(CVMX_L2C_SPAR0) & 118 (cvmx_read_csr(CVMX_L2C_SPAR0) & ~(0xFF << field)) |
124 ~(0xFF << field)) | mask << field); 119 mask << field);
125 break; 120 break;
126 case 0x4: 121 case 0x4:
127 cvmx_write_csr(CVMX_L2C_SPAR1, 122 cvmx_write_csr(CVMX_L2C_SPAR1,
128 (cvmx_read_csr(CVMX_L2C_SPAR1) & 123 (cvmx_read_csr(CVMX_L2C_SPAR1) & ~(0xFF << field)) |
129 ~(0xFF << field)) | mask << field); 124 mask << field);
130 break; 125 break;
131 case 0x8: 126 case 0x8:
132 cvmx_write_csr(CVMX_L2C_SPAR2, 127 cvmx_write_csr(CVMX_L2C_SPAR2,
133 (cvmx_read_csr(CVMX_L2C_SPAR2) & 128 (cvmx_read_csr(CVMX_L2C_SPAR2) & ~(0xFF << field)) |
134 ~(0xFF << field)) | mask << field); 129 mask << field);
135 break; 130 break;
136 case 0xC: 131 case 0xC:
137 cvmx_write_csr(CVMX_L2C_SPAR3, 132 cvmx_write_csr(CVMX_L2C_SPAR3,
138 (cvmx_read_csr(CVMX_L2C_SPAR3) & 133 (cvmx_read_csr(CVMX_L2C_SPAR3) & ~(0xFF << field)) |
139 ~(0xFF << field)) | mask << field); 134 mask << field);
140 break; 135 break;
141 } 136 }
142 return 0; 137 return 0;
@@ -146,84 +141,137 @@ int cvmx_l2c_set_hw_way_partition(uint32_t mask)
146{ 141{
147 uint32_t valid_mask; 142 uint32_t valid_mask;
148 143
149 valid_mask = 0xff; 144 valid_mask = (0x1 << cvmx_l2c_get_num_assoc()) - 1;
150
151 if (OCTEON_IS_MODEL(OCTEON_CN58XX) || OCTEON_IS_MODEL(OCTEON_CN38XX)) {
152 if (l2_size_half())
153 valid_mask = 0xf;
154 } else if (l2_size_half())
155 valid_mask = 0x3;
156
157 mask &= valid_mask; 145 mask &= valid_mask;
158 146
159 /* A UMSK setting which blocks all L2C Ways is an error. */ 147 /* A UMSK setting which blocks all L2C Ways is an error on some chips */
160 if (mask == valid_mask) 148 if (mask == valid_mask && !OCTEON_IS_MODEL(OCTEON_CN63XX))
161 return -1;
162 /* Check to make sure current mask & new mask don't block all ways */
163 if (((mask | cvmx_l2c_get_hw_way_partition()) & valid_mask) ==
164 valid_mask)
165 return -1; 149 return -1;
166 150
167 cvmx_write_csr(CVMX_L2C_SPAR4, 151 if (OCTEON_IS_MODEL(OCTEON_CN63XX))
168 (cvmx_read_csr(CVMX_L2C_SPAR4) & ~0xFF) | mask); 152 cvmx_write_csr(CVMX_L2C_WPAR_IOBX(0), mask);
153 else
154 cvmx_write_csr(CVMX_L2C_SPAR4,
155 (cvmx_read_csr(CVMX_L2C_SPAR4) & ~0xFF) | mask);
169 return 0; 156 return 0;
170} 157}
171 158
172int cvmx_l2c_get_hw_way_partition(void) 159int cvmx_l2c_get_hw_way_partition(void)
173{ 160{
174 return cvmx_read_csr(CVMX_L2C_SPAR4) & (0xFF); 161 if (OCTEON_IS_MODEL(OCTEON_CN63XX))
162 return cvmx_read_csr(CVMX_L2C_WPAR_IOBX(0)) & 0xffff;
163 else
164 return cvmx_read_csr(CVMX_L2C_SPAR4) & (0xFF);
175} 165}
176 166
177void cvmx_l2c_config_perf(uint32_t counter, enum cvmx_l2c_event event, 167void cvmx_l2c_config_perf(uint32_t counter, enum cvmx_l2c_event event,
178 uint32_t clear_on_read) 168 uint32_t clear_on_read)
179{ 169{
180 union cvmx_l2c_pfctl pfctl; 170 if (OCTEON_IS_MODEL(OCTEON_CN5XXX) || OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
171 union cvmx_l2c_pfctl pfctl;
181 172
182 pfctl.u64 = cvmx_read_csr(CVMX_L2C_PFCTL); 173 pfctl.u64 = cvmx_read_csr(CVMX_L2C_PFCTL);
183 174
184 switch (counter) { 175 switch (counter) {
185 case 0: 176 case 0:
186 pfctl.s.cnt0sel = event; 177 pfctl.s.cnt0sel = event;
187 pfctl.s.cnt0ena = 1; 178 pfctl.s.cnt0ena = 1;
188 if (!cvmx_octeon_is_pass1())
189 pfctl.s.cnt0rdclr = clear_on_read; 179 pfctl.s.cnt0rdclr = clear_on_read;
190 break; 180 break;
191 case 1: 181 case 1:
192 pfctl.s.cnt1sel = event; 182 pfctl.s.cnt1sel = event;
193 pfctl.s.cnt1ena = 1; 183 pfctl.s.cnt1ena = 1;
194 if (!cvmx_octeon_is_pass1())
195 pfctl.s.cnt1rdclr = clear_on_read; 184 pfctl.s.cnt1rdclr = clear_on_read;
196 break; 185 break;
197 case 2: 186 case 2:
198 pfctl.s.cnt2sel = event; 187 pfctl.s.cnt2sel = event;
199 pfctl.s.cnt2ena = 1; 188 pfctl.s.cnt2ena = 1;
200 if (!cvmx_octeon_is_pass1())
201 pfctl.s.cnt2rdclr = clear_on_read; 189 pfctl.s.cnt2rdclr = clear_on_read;
202 break; 190 break;
203 case 3: 191 case 3:
204 default: 192 default:
205 pfctl.s.cnt3sel = event; 193 pfctl.s.cnt3sel = event;
206 pfctl.s.cnt3ena = 1; 194 pfctl.s.cnt3ena = 1;
207 if (!cvmx_octeon_is_pass1())
208 pfctl.s.cnt3rdclr = clear_on_read; 195 pfctl.s.cnt3rdclr = clear_on_read;
209 break; 196 break;
210 } 197 }
211 198
212 cvmx_write_csr(CVMX_L2C_PFCTL, pfctl.u64); 199 cvmx_write_csr(CVMX_L2C_PFCTL, pfctl.u64);
200 } else {
201 union cvmx_l2c_tadx_prf l2c_tadx_prf;
202 int tad;
203
204 cvmx_dprintf("L2C performance counter events are different for this chip, mapping 'event' to cvmx_l2c_tad_event_t\n");
205 if (clear_on_read)
206 cvmx_dprintf("L2C counters don't support clear on read for this chip\n");
207
208 l2c_tadx_prf.u64 = cvmx_read_csr(CVMX_L2C_TADX_PRF(0));
209
210 switch (counter) {
211 case 0:
212 l2c_tadx_prf.s.cnt0sel = event;
213 break;
214 case 1:
215 l2c_tadx_prf.s.cnt1sel = event;
216 break;
217 case 2:
218 l2c_tadx_prf.s.cnt2sel = event;
219 break;
220 default:
221 case 3:
222 l2c_tadx_prf.s.cnt3sel = event;
223 break;
224 }
225 for (tad = 0; tad < CVMX_L2C_TADS; tad++)
226 cvmx_write_csr(CVMX_L2C_TADX_PRF(tad),
227 l2c_tadx_prf.u64);
228 }
213} 229}
214 230
215uint64_t cvmx_l2c_read_perf(uint32_t counter) 231uint64_t cvmx_l2c_read_perf(uint32_t counter)
216{ 232{
217 switch (counter) { 233 switch (counter) {
218 case 0: 234 case 0:
219 return cvmx_read_csr(CVMX_L2C_PFC0); 235 if (OCTEON_IS_MODEL(OCTEON_CN5XXX) || OCTEON_IS_MODEL(OCTEON_CN3XXX))
236 return cvmx_read_csr(CVMX_L2C_PFC0);
237 else {
238 uint64_t counter = 0;
239 int tad;
240 for (tad = 0; tad < CVMX_L2C_TADS; tad++)
241 counter += cvmx_read_csr(CVMX_L2C_TADX_PFC0(tad));
242 return counter;
243 }
220 case 1: 244 case 1:
221 return cvmx_read_csr(CVMX_L2C_PFC1); 245 if (OCTEON_IS_MODEL(OCTEON_CN5XXX) || OCTEON_IS_MODEL(OCTEON_CN3XXX))
246 return cvmx_read_csr(CVMX_L2C_PFC1);
247 else {
248 uint64_t counter = 0;
249 int tad;
250 for (tad = 0; tad < CVMX_L2C_TADS; tad++)
251 counter += cvmx_read_csr(CVMX_L2C_TADX_PFC1(tad));
252 return counter;
253 }
222 case 2: 254 case 2:
223 return cvmx_read_csr(CVMX_L2C_PFC2); 255 if (OCTEON_IS_MODEL(OCTEON_CN5XXX) || OCTEON_IS_MODEL(OCTEON_CN3XXX))
256 return cvmx_read_csr(CVMX_L2C_PFC2);
257 else {
258 uint64_t counter = 0;
259 int tad;
260 for (tad = 0; tad < CVMX_L2C_TADS; tad++)
261 counter += cvmx_read_csr(CVMX_L2C_TADX_PFC2(tad));
262 return counter;
263 }
224 case 3: 264 case 3:
225 default: 265 default:
226 return cvmx_read_csr(CVMX_L2C_PFC3); 266 if (OCTEON_IS_MODEL(OCTEON_CN5XXX) || OCTEON_IS_MODEL(OCTEON_CN3XXX))
267 return cvmx_read_csr(CVMX_L2C_PFC3);
268 else {
269 uint64_t counter = 0;
270 int tad;
271 for (tad = 0; tad < CVMX_L2C_TADS; tad++)
272 counter += cvmx_read_csr(CVMX_L2C_TADX_PFC3(tad));
273 return counter;
274 }
227 } 275 }
228} 276}
229 277
@@ -240,7 +288,7 @@ static void fault_in(uint64_t addr, int len)
240 volatile char dummy; 288 volatile char dummy;
241 /* 289 /*
242 * Adjust addr and length so we get all cache lines even for 290 * Adjust addr and length so we get all cache lines even for
243 * small ranges spanning two cache lines 291 * small ranges spanning two cache lines.
244 */ 292 */
245 len += addr & CVMX_CACHE_LINE_MASK; 293 len += addr & CVMX_CACHE_LINE_MASK;
246 addr &= ~CVMX_CACHE_LINE_MASK; 294 addr &= ~CVMX_CACHE_LINE_MASK;
@@ -259,67 +307,100 @@ static void fault_in(uint64_t addr, int len)
259 307
260int cvmx_l2c_lock_line(uint64_t addr) 308int cvmx_l2c_lock_line(uint64_t addr)
261{ 309{
262 int retval = 0; 310 if (OCTEON_IS_MODEL(OCTEON_CN63XX)) {
263 union cvmx_l2c_dbg l2cdbg; 311 int shift = CVMX_L2C_TAG_ADDR_ALIAS_SHIFT;
264 union cvmx_l2c_lckbase lckbase; 312 uint64_t assoc = cvmx_l2c_get_num_assoc();
265 union cvmx_l2c_lckoff lckoff; 313 uint64_t tag = addr >> shift;
266 union cvmx_l2t_err l2t_err; 314 uint64_t index = CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, cvmx_l2c_address_to_index(addr) << CVMX_L2C_IDX_ADDR_SHIFT);
267 l2cdbg.u64 = 0; 315 uint64_t way;
268 lckbase.u64 = 0; 316 union cvmx_l2c_tadx_tag l2c_tadx_tag;
269 lckoff.u64 = 0; 317
270 318 CVMX_CACHE_LCKL2(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, addr), 0);
271 cvmx_spinlock_lock(&cvmx_l2c_spinlock); 319
272 320 /* Make sure we were able to lock the line */
273 /* Clear l2t error bits if set */ 321 for (way = 0; way < assoc; way++) {
274 l2t_err.u64 = cvmx_read_csr(CVMX_L2T_ERR); 322 CVMX_CACHE_LTGL2I(index | (way << shift), 0);
275 l2t_err.s.lckerr = 1; 323 /* make sure CVMX_L2C_TADX_TAG is updated */
276 l2t_err.s.lckerr2 = 1; 324 CVMX_SYNC;
277 cvmx_write_csr(CVMX_L2T_ERR, l2t_err.u64); 325 l2c_tadx_tag.u64 = cvmx_read_csr(CVMX_L2C_TADX_TAG(0));
326 if (l2c_tadx_tag.s.valid && l2c_tadx_tag.s.tag == tag)
327 break;
328 }
278 329
279 addr &= ~CVMX_CACHE_LINE_MASK; 330 /* Check if a valid line is found */
331 if (way >= assoc) {
332 /* cvmx_dprintf("ERROR: cvmx_l2c_lock_line: line not found for locking at 0x%llx address\n", (unsigned long long)addr); */
333 return -1;
334 }
280 335
281 /* Set this core as debug core */ 336 /* Check if lock bit is not set */
282 l2cdbg.s.ppnum = cvmx_get_core_num(); 337 if (!l2c_tadx_tag.s.lock) {
283 CVMX_SYNC; 338 /* cvmx_dprintf("ERROR: cvmx_l2c_lock_line: Not able to lock at 0x%llx address\n", (unsigned long long)addr); */
284 cvmx_write_csr(CVMX_L2C_DBG, l2cdbg.u64); 339 return -1;
285 cvmx_read_csr(CVMX_L2C_DBG); 340 }
286 341 return way;
287 lckoff.s.lck_offset = 0; /* Only lock 1 line at a time */
288 cvmx_write_csr(CVMX_L2C_LCKOFF, lckoff.u64);
289 cvmx_read_csr(CVMX_L2C_LCKOFF);
290
291 if (((union cvmx_l2c_cfg) (cvmx_read_csr(CVMX_L2C_CFG))).s.idxalias) {
292 int alias_shift =
293 CVMX_L2C_IDX_ADDR_SHIFT + 2 * CVMX_L2_SET_BITS - 1;
294 uint64_t addr_tmp =
295 addr ^ (addr & ((1 << alias_shift) - 1)) >>
296 CVMX_L2_SET_BITS;
297 lckbase.s.lck_base = addr_tmp >> 7;
298 } else { 342 } else {
299 lckbase.s.lck_base = addr >> 7; 343 int retval = 0;
300 } 344 union cvmx_l2c_dbg l2cdbg;
345 union cvmx_l2c_lckbase lckbase;
346 union cvmx_l2c_lckoff lckoff;
347 union cvmx_l2t_err l2t_err;
301 348
302 lckbase.s.lck_ena = 1; 349 cvmx_spinlock_lock(&cvmx_l2c_spinlock);
303 cvmx_write_csr(CVMX_L2C_LCKBASE, lckbase.u64);
304 cvmx_read_csr(CVMX_L2C_LCKBASE); /* Make sure it gets there */
305 350
306 fault_in(addr, CVMX_CACHE_LINE_SIZE); 351 l2cdbg.u64 = 0;
352 lckbase.u64 = 0;
353 lckoff.u64 = 0;
307 354
308 lckbase.s.lck_ena = 0; 355 /* Clear l2t error bits if set */
309 cvmx_write_csr(CVMX_L2C_LCKBASE, lckbase.u64); 356 l2t_err.u64 = cvmx_read_csr(CVMX_L2T_ERR);
310 cvmx_read_csr(CVMX_L2C_LCKBASE); /* Make sure it gets there */ 357 l2t_err.s.lckerr = 1;
358 l2t_err.s.lckerr2 = 1;
359 cvmx_write_csr(CVMX_L2T_ERR, l2t_err.u64);
311 360
312 /* Stop being debug core */ 361 addr &= ~CVMX_CACHE_LINE_MASK;
313 cvmx_write_csr(CVMX_L2C_DBG, 0);
314 cvmx_read_csr(CVMX_L2C_DBG);
315 362
316 l2t_err.u64 = cvmx_read_csr(CVMX_L2T_ERR); 363 /* Set this core as debug core */
317 if (l2t_err.s.lckerr || l2t_err.s.lckerr2) 364 l2cdbg.s.ppnum = cvmx_get_core_num();
318 retval = 1; /* We were unable to lock the line */ 365 CVMX_SYNC;
366 cvmx_write_csr(CVMX_L2C_DBG, l2cdbg.u64);
367 cvmx_read_csr(CVMX_L2C_DBG);
368
369 lckoff.s.lck_offset = 0; /* Only lock 1 line at a time */
370 cvmx_write_csr(CVMX_L2C_LCKOFF, lckoff.u64);
371 cvmx_read_csr(CVMX_L2C_LCKOFF);
372
373 if (((union cvmx_l2c_cfg)(cvmx_read_csr(CVMX_L2C_CFG))).s.idxalias) {
374 int alias_shift = CVMX_L2C_IDX_ADDR_SHIFT + 2 * CVMX_L2_SET_BITS - 1;
375 uint64_t addr_tmp = addr ^ (addr & ((1 << alias_shift) - 1)) >> CVMX_L2_SET_BITS;
376 lckbase.s.lck_base = addr_tmp >> 7;
377 } else {
378 lckbase.s.lck_base = addr >> 7;
379 }
319 380
320 cvmx_spinlock_unlock(&cvmx_l2c_spinlock); 381 lckbase.s.lck_ena = 1;
382 cvmx_write_csr(CVMX_L2C_LCKBASE, lckbase.u64);
383 /* Make sure it gets there */
384 cvmx_read_csr(CVMX_L2C_LCKBASE);
321 385
322 return retval; 386 fault_in(addr, CVMX_CACHE_LINE_SIZE);
387
388 lckbase.s.lck_ena = 0;
389 cvmx_write_csr(CVMX_L2C_LCKBASE, lckbase.u64);
390 /* Make sure it gets there */
391 cvmx_read_csr(CVMX_L2C_LCKBASE);
392
393 /* Stop being debug core */
394 cvmx_write_csr(CVMX_L2C_DBG, 0);
395 cvmx_read_csr(CVMX_L2C_DBG);
396
397 l2t_err.u64 = cvmx_read_csr(CVMX_L2T_ERR);
398 if (l2t_err.s.lckerr || l2t_err.s.lckerr2)
399 retval = 1; /* We were unable to lock the line */
400
401 cvmx_spinlock_unlock(&cvmx_l2c_spinlock);
402 return retval;
403 }
323} 404}
324 405
325int cvmx_l2c_lock_mem_region(uint64_t start, uint64_t len) 406int cvmx_l2c_lock_mem_region(uint64_t start, uint64_t len)
@@ -336,7 +417,6 @@ int cvmx_l2c_lock_mem_region(uint64_t start, uint64_t len)
336 start += CVMX_CACHE_LINE_SIZE; 417 start += CVMX_CACHE_LINE_SIZE;
337 len -= CVMX_CACHE_LINE_SIZE; 418 len -= CVMX_CACHE_LINE_SIZE;
338 } 419 }
339
340 return retval; 420 return retval;
341} 421}
342 422
@@ -344,80 +424,73 @@ void cvmx_l2c_flush(void)
344{ 424{
345 uint64_t assoc, set; 425 uint64_t assoc, set;
346 uint64_t n_assoc, n_set; 426 uint64_t n_assoc, n_set;
347 union cvmx_l2c_dbg l2cdbg;
348
349 cvmx_spinlock_lock(&cvmx_l2c_spinlock);
350 427
351 l2cdbg.u64 = 0; 428 n_set = cvmx_l2c_get_num_sets();
352 if (!OCTEON_IS_MODEL(OCTEON_CN30XX)) 429 n_assoc = cvmx_l2c_get_num_assoc();
353 l2cdbg.s.ppnum = cvmx_get_core_num(); 430
354 l2cdbg.s.finv = 1; 431 if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
355 n_set = CVMX_L2_SETS; 432 uint64_t address;
356 n_assoc = l2_size_half() ? (CVMX_L2_ASSOC / 2) : CVMX_L2_ASSOC; 433 /* These may look like constants, but they aren't... */
357 for (set = 0; set < n_set; set++) { 434 int assoc_shift = CVMX_L2C_TAG_ADDR_ALIAS_SHIFT;
358 for (assoc = 0; assoc < n_assoc; assoc++) { 435 int set_shift = CVMX_L2C_IDX_ADDR_SHIFT;
359 l2cdbg.s.set = assoc; 436 for (set = 0; set < n_set; set++) {
360 /* Enter debug mode, and make sure all other 437 for (assoc = 0; assoc < n_assoc; assoc++) {
361 ** writes complete before we enter debug 438 address = CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
362 ** mode */ 439 (assoc << assoc_shift) | (set << set_shift));
363 CVMX_SYNCW; 440 CVMX_CACHE_WBIL2I(address, 0);
364 cvmx_write_csr(CVMX_L2C_DBG, l2cdbg.u64); 441 }
365 cvmx_read_csr(CVMX_L2C_DBG);
366
367 CVMX_PREPARE_FOR_STORE(CVMX_ADD_SEG
368 (CVMX_MIPS_SPACE_XKPHYS,
369 set * CVMX_CACHE_LINE_SIZE), 0);
370 CVMX_SYNCW; /* Push STF out to L2 */
371 /* Exit debug mode */
372 CVMX_SYNC;
373 cvmx_write_csr(CVMX_L2C_DBG, 0);
374 cvmx_read_csr(CVMX_L2C_DBG);
375 } 442 }
443 } else {
444 for (set = 0; set < n_set; set++)
445 for (assoc = 0; assoc < n_assoc; assoc++)
446 cvmx_l2c_flush_line(assoc, set);
376 } 447 }
377
378 cvmx_spinlock_unlock(&cvmx_l2c_spinlock);
379} 448}
380 449
450
381int cvmx_l2c_unlock_line(uint64_t address) 451int cvmx_l2c_unlock_line(uint64_t address)
382{ 452{
383 int assoc;
384 union cvmx_l2c_tag tag;
385 union cvmx_l2c_dbg l2cdbg;
386 uint32_t tag_addr;
387 453
388 uint32_t index = cvmx_l2c_address_to_index(address); 454 if (OCTEON_IS_MODEL(OCTEON_CN63XX)) {
455 int assoc;
456 union cvmx_l2c_tag tag;
457 uint32_t tag_addr;
458 uint32_t index = cvmx_l2c_address_to_index(address);
459
460 tag_addr = ((address >> CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) & ((1 << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) - 1));
461
462 /*
463 * For 63XX, we can flush a line by using the physical
464 * address directly, so finding the cache line used by
465 * the address is only required to provide the proper
466 * return value for the function.
467 */
468 for (assoc = 0; assoc < CVMX_L2_ASSOC; assoc++) {
469 tag = cvmx_l2c_get_tag(assoc, index);
470
471 if (tag.s.V && (tag.s.addr == tag_addr)) {
472 CVMX_CACHE_WBIL2(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, address), 0);
473 return tag.s.L;
474 }
475 }
476 } else {
477 int assoc;
478 union cvmx_l2c_tag tag;
479 uint32_t tag_addr;
389 480
390 cvmx_spinlock_lock(&cvmx_l2c_spinlock); 481 uint32_t index = cvmx_l2c_address_to_index(address);
391 /* Compute portion of address that is stored in tag */
392 tag_addr =
393 ((address >> CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) &
394 ((1 << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) - 1));
395 for (assoc = 0; assoc < CVMX_L2_ASSOC; assoc++) {
396 tag = cvmx_get_l2c_tag(assoc, index);
397 482
398 if (tag.s.V && (tag.s.addr == tag_addr)) { 483 /* Compute portion of address that is stored in tag */
399 l2cdbg.u64 = 0; 484 tag_addr = ((address >> CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) & ((1 << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) - 1));
400 l2cdbg.s.ppnum = cvmx_get_core_num(); 485 for (assoc = 0; assoc < CVMX_L2_ASSOC; assoc++) {
401 l2cdbg.s.set = assoc; 486 tag = cvmx_l2c_get_tag(assoc, index);
402 l2cdbg.s.finv = 1;
403 487
404 CVMX_SYNC; 488 if (tag.s.V && (tag.s.addr == tag_addr)) {
405 /* Enter debug mode */ 489 cvmx_l2c_flush_line(assoc, index);
406 cvmx_write_csr(CVMX_L2C_DBG, l2cdbg.u64); 490 return tag.s.L;
407 cvmx_read_csr(CVMX_L2C_DBG); 491 }
408
409 CVMX_PREPARE_FOR_STORE(CVMX_ADD_SEG
410 (CVMX_MIPS_SPACE_XKPHYS,
411 address), 0);
412 CVMX_SYNC;
413 /* Exit debug mode */
414 cvmx_write_csr(CVMX_L2C_DBG, 0);
415 cvmx_read_csr(CVMX_L2C_DBG);
416 cvmx_spinlock_unlock(&cvmx_l2c_spinlock);
417 return tag.s.L;
418 } 492 }
419 } 493 }
420 cvmx_spinlock_unlock(&cvmx_l2c_spinlock);
421 return 0; 494 return 0;
422} 495}
423 496
@@ -445,48 +518,49 @@ union __cvmx_l2c_tag {
445 uint64_t u64; 518 uint64_t u64;
446 struct cvmx_l2c_tag_cn50xx { 519 struct cvmx_l2c_tag_cn50xx {
447 uint64_t reserved:40; 520 uint64_t reserved:40;
448 uint64_t V:1; /* Line valid */ 521 uint64_t V:1; /* Line valid */
449 uint64_t D:1; /* Line dirty */ 522 uint64_t D:1; /* Line dirty */
450 uint64_t L:1; /* Line locked */ 523 uint64_t L:1; /* Line locked */
451 uint64_t U:1; /* Use, LRU eviction */ 524 uint64_t U:1; /* Use, LRU eviction */
452 uint64_t addr:20; /* Phys mem addr (33..14) */ 525 uint64_t addr:20; /* Phys mem addr (33..14) */
453 } cn50xx; 526 } cn50xx;
454 struct cvmx_l2c_tag_cn30xx { 527 struct cvmx_l2c_tag_cn30xx {
455 uint64_t reserved:41; 528 uint64_t reserved:41;
456 uint64_t V:1; /* Line valid */ 529 uint64_t V:1; /* Line valid */
457 uint64_t D:1; /* Line dirty */ 530 uint64_t D:1; /* Line dirty */
458 uint64_t L:1; /* Line locked */ 531 uint64_t L:1; /* Line locked */
459 uint64_t U:1; /* Use, LRU eviction */ 532 uint64_t U:1; /* Use, LRU eviction */
460 uint64_t addr:19; /* Phys mem addr (33..15) */ 533 uint64_t addr:19; /* Phys mem addr (33..15) */
461 } cn30xx; 534 } cn30xx;
462 struct cvmx_l2c_tag_cn31xx { 535 struct cvmx_l2c_tag_cn31xx {
463 uint64_t reserved:42; 536 uint64_t reserved:42;
464 uint64_t V:1; /* Line valid */ 537 uint64_t V:1; /* Line valid */
465 uint64_t D:1; /* Line dirty */ 538 uint64_t D:1; /* Line dirty */
466 uint64_t L:1; /* Line locked */ 539 uint64_t L:1; /* Line locked */
467 uint64_t U:1; /* Use, LRU eviction */ 540 uint64_t U:1; /* Use, LRU eviction */
468 uint64_t addr:18; /* Phys mem addr (33..16) */ 541 uint64_t addr:18; /* Phys mem addr (33..16) */
469 } cn31xx; 542 } cn31xx;
470 struct cvmx_l2c_tag_cn38xx { 543 struct cvmx_l2c_tag_cn38xx {
471 uint64_t reserved:43; 544 uint64_t reserved:43;
472 uint64_t V:1; /* Line valid */ 545 uint64_t V:1; /* Line valid */
473 uint64_t D:1; /* Line dirty */ 546 uint64_t D:1; /* Line dirty */
474 uint64_t L:1; /* Line locked */ 547 uint64_t L:1; /* Line locked */
475 uint64_t U:1; /* Use, LRU eviction */ 548 uint64_t U:1; /* Use, LRU eviction */
476 uint64_t addr:17; /* Phys mem addr (33..17) */ 549 uint64_t addr:17; /* Phys mem addr (33..17) */
477 } cn38xx; 550 } cn38xx;
478 struct cvmx_l2c_tag_cn58xx { 551 struct cvmx_l2c_tag_cn58xx {
479 uint64_t reserved:44; 552 uint64_t reserved:44;
480 uint64_t V:1; /* Line valid */ 553 uint64_t V:1; /* Line valid */
481 uint64_t D:1; /* Line dirty */ 554 uint64_t D:1; /* Line dirty */
482 uint64_t L:1; /* Line locked */ 555 uint64_t L:1; /* Line locked */
483 uint64_t U:1; /* Use, LRU eviction */ 556 uint64_t U:1; /* Use, LRU eviction */
484 uint64_t addr:16; /* Phys mem addr (33..18) */ 557 uint64_t addr:16; /* Phys mem addr (33..18) */
485 } cn58xx; 558 } cn58xx;
486 struct cvmx_l2c_tag_cn58xx cn56xx; /* 2048 sets */ 559 struct cvmx_l2c_tag_cn58xx cn56xx; /* 2048 sets */
487 struct cvmx_l2c_tag_cn31xx cn52xx; /* 512 sets */ 560 struct cvmx_l2c_tag_cn31xx cn52xx; /* 512 sets */
488}; 561};
489 562
563
490/** 564/**
491 * @INTERNAL 565 * @INTERNAL
492 * Function to read a L2C tag. This code make the current core 566 * Function to read a L2C tag. This code make the current core
@@ -503,7 +577,7 @@ union __cvmx_l2c_tag {
503static union __cvmx_l2c_tag __read_l2_tag(uint64_t assoc, uint64_t index) 577static union __cvmx_l2c_tag __read_l2_tag(uint64_t assoc, uint64_t index)
504{ 578{
505 579
506 uint64_t debug_tag_addr = (((1ULL << 63) | (index << 7)) + 96); 580 uint64_t debug_tag_addr = CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, (index << 7) + 96);
507 uint64_t core = cvmx_get_core_num(); 581 uint64_t core = cvmx_get_core_num();
508 union __cvmx_l2c_tag tag_val; 582 union __cvmx_l2c_tag tag_val;
509 uint64_t dbg_addr = CVMX_L2C_DBG; 583 uint64_t dbg_addr = CVMX_L2C_DBG;
@@ -512,12 +586,15 @@ static union __cvmx_l2c_tag __read_l2_tag(uint64_t assoc, uint64_t index)
512 union cvmx_l2c_dbg debug_val; 586 union cvmx_l2c_dbg debug_val;
513 debug_val.u64 = 0; 587 debug_val.u64 = 0;
514 /* 588 /*
515 * For low core count parts, the core number is always small enough 589 * For low core count parts, the core number is always small
516 * to stay in the correct field and not set any reserved bits. 590 * enough to stay in the correct field and not set any
591 * reserved bits.
517 */ 592 */
518 debug_val.s.ppnum = core; 593 debug_val.s.ppnum = core;
519 debug_val.s.l2t = 1; 594 debug_val.s.l2t = 1;
520 debug_val.s.set = assoc; 595 debug_val.s.set = assoc;
596
597 local_irq_save(flags);
521 /* 598 /*
522 * Make sure core is quiet (no prefetches, etc.) before 599 * Make sure core is quiet (no prefetches, etc.) before
523 * entering debug mode. 600 * entering debug mode.
@@ -526,112 +603,139 @@ static union __cvmx_l2c_tag __read_l2_tag(uint64_t assoc, uint64_t index)
526 /* Flush L1 to make sure debug load misses L1 */ 603 /* Flush L1 to make sure debug load misses L1 */
527 CVMX_DCACHE_INVALIDATE; 604 CVMX_DCACHE_INVALIDATE;
528 605
529 local_irq_save(flags);
530
531 /* 606 /*
532 * The following must be done in assembly as when in debug 607 * The following must be done in assembly as when in debug
533 * mode all data loads from L2 return special debug data, not 608 * mode all data loads from L2 return special debug data, not
534 * normal memory contents. Also, interrupts must be 609 * normal memory contents. Also, interrupts must be disabled,
535 * disabled, since if an interrupt occurs while in debug mode 610 * since if an interrupt occurs while in debug mode the ISR
536 * the ISR will get debug data from all its memory reads 611 * will get debug data from all its memory * reads instead of
537 * instead of the contents of memory 612 * the contents of memory.
538 */ 613 */
539 614
540 asm volatile (".set push \n" 615 asm volatile (
541 " .set mips64 \n" 616 ".set push\n\t"
542 " .set noreorder \n" 617 ".set mips64\n\t"
543 /* Enter debug mode, wait for store */ 618 ".set noreorder\n\t"
544 " sd %[dbg_val], 0(%[dbg_addr]) \n" 619 "sd %[dbg_val], 0(%[dbg_addr])\n\t" /* Enter debug mode, wait for store */
545 " ld $0, 0(%[dbg_addr]) \n" 620 "ld $0, 0(%[dbg_addr])\n\t"
546 /* Read L2C tag data */ 621 "ld %[tag_val], 0(%[tag_addr])\n\t" /* Read L2C tag data */
547 " ld %[tag_val], 0(%[tag_addr]) \n" 622 "sd $0, 0(%[dbg_addr])\n\t" /* Exit debug mode, wait for store */
548 /* Exit debug mode, wait for store */ 623 "ld $0, 0(%[dbg_addr])\n\t"
549 " sd $0, 0(%[dbg_addr]) \n" 624 "cache 9, 0($0)\n\t" /* Invalidate dcache to discard debug data */
550 " ld $0, 0(%[dbg_addr]) \n" 625 ".set pop"
551 /* Invalidate dcache to discard debug data */ 626 : [tag_val] "=r" (tag_val)
552 " cache 9, 0($0) \n" 627 : [dbg_addr] "r" (dbg_addr), [dbg_val] "r" (debug_val), [tag_addr] "r" (debug_tag_addr)
553 " .set pop" : 628 : "memory");
554 [tag_val] "=r"(tag_val.u64) : [dbg_addr] "r"(dbg_addr),
555 [dbg_val] "r"(debug_val.u64),
556 [tag_addr] "r"(debug_tag_addr) : "memory");
557 629
558 local_irq_restore(flags); 630 local_irq_restore(flags);
559 return tag_val;
560 631
632 return tag_val;
561} 633}
562 634
635
563union cvmx_l2c_tag cvmx_l2c_get_tag(uint32_t association, uint32_t index) 636union cvmx_l2c_tag cvmx_l2c_get_tag(uint32_t association, uint32_t index)
564{ 637{
565 union __cvmx_l2c_tag tmp_tag;
566 union cvmx_l2c_tag tag; 638 union cvmx_l2c_tag tag;
567 tag.u64 = 0; 639 tag.u64 = 0;
568 640
569 if ((int)association >= cvmx_l2c_get_num_assoc()) { 641 if ((int)association >= cvmx_l2c_get_num_assoc()) {
570 cvmx_dprintf 642 cvmx_dprintf("ERROR: cvmx_l2c_get_tag association out of range\n");
571 ("ERROR: cvmx_get_l2c_tag association out of range\n");
572 return tag; 643 return tag;
573 } 644 }
574 if ((int)index >= cvmx_l2c_get_num_sets()) { 645 if ((int)index >= cvmx_l2c_get_num_sets()) {
575 cvmx_dprintf("ERROR: cvmx_get_l2c_tag " 646 cvmx_dprintf("ERROR: cvmx_l2c_get_tag index out of range (arg: %d, max: %d)\n",
576 "index out of range (arg: %d, max: %d\n", 647 (int)index, cvmx_l2c_get_num_sets());
577 index, cvmx_l2c_get_num_sets());
578 return tag; 648 return tag;
579 } 649 }
580 /* __read_l2_tag is intended for internal use only */ 650 if (OCTEON_IS_MODEL(OCTEON_CN63XX)) {
581 tmp_tag = __read_l2_tag(association, index); 651 union cvmx_l2c_tadx_tag l2c_tadx_tag;
582 652 uint64_t address = CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
583 /* 653 (association << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) |
584 * Convert all tag structure types to generic version, as it 654 (index << CVMX_L2C_IDX_ADDR_SHIFT));
585 * can represent all models. 655 /*
586 */ 656 * Use L2 cache Index load tag cache instruction, as
587 if (OCTEON_IS_MODEL(OCTEON_CN58XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) { 657 * hardware loads the virtual tag for the L2 cache
588 tag.s.V = tmp_tag.cn58xx.V; 658 * block with the contents of L2C_TAD0_TAG
589 tag.s.D = tmp_tag.cn58xx.D; 659 * register.
590 tag.s.L = tmp_tag.cn58xx.L; 660 */
591 tag.s.U = tmp_tag.cn58xx.U; 661 CVMX_CACHE_LTGL2I(address, 0);
592 tag.s.addr = tmp_tag.cn58xx.addr; 662 CVMX_SYNC; /* make sure CVMX_L2C_TADX_TAG is updated */
593 } else if (OCTEON_IS_MODEL(OCTEON_CN38XX)) { 663 l2c_tadx_tag.u64 = cvmx_read_csr(CVMX_L2C_TADX_TAG(0));
594 tag.s.V = tmp_tag.cn38xx.V; 664
595 tag.s.D = tmp_tag.cn38xx.D; 665 tag.s.V = l2c_tadx_tag.s.valid;
596 tag.s.L = tmp_tag.cn38xx.L; 666 tag.s.D = l2c_tadx_tag.s.dirty;
597 tag.s.U = tmp_tag.cn38xx.U; 667 tag.s.L = l2c_tadx_tag.s.lock;
598 tag.s.addr = tmp_tag.cn38xx.addr; 668 tag.s.U = l2c_tadx_tag.s.use;
599 } else if (OCTEON_IS_MODEL(OCTEON_CN31XX) 669 tag.s.addr = l2c_tadx_tag.s.tag;
600 || OCTEON_IS_MODEL(OCTEON_CN52XX)) {
601 tag.s.V = tmp_tag.cn31xx.V;
602 tag.s.D = tmp_tag.cn31xx.D;
603 tag.s.L = tmp_tag.cn31xx.L;
604 tag.s.U = tmp_tag.cn31xx.U;
605 tag.s.addr = tmp_tag.cn31xx.addr;
606 } else if (OCTEON_IS_MODEL(OCTEON_CN30XX)) {
607 tag.s.V = tmp_tag.cn30xx.V;
608 tag.s.D = tmp_tag.cn30xx.D;
609 tag.s.L = tmp_tag.cn30xx.L;
610 tag.s.U = tmp_tag.cn30xx.U;
611 tag.s.addr = tmp_tag.cn30xx.addr;
612 } else if (OCTEON_IS_MODEL(OCTEON_CN50XX)) {
613 tag.s.V = tmp_tag.cn50xx.V;
614 tag.s.D = tmp_tag.cn50xx.D;
615 tag.s.L = tmp_tag.cn50xx.L;
616 tag.s.U = tmp_tag.cn50xx.U;
617 tag.s.addr = tmp_tag.cn50xx.addr;
618 } else { 670 } else {
619 cvmx_dprintf("Unsupported OCTEON Model in %s\n", __func__); 671 union __cvmx_l2c_tag tmp_tag;
672 /* __read_l2_tag is intended for internal use only */
673 tmp_tag = __read_l2_tag(association, index);
674
675 /*
676 * Convert all tag structure types to generic version,
677 * as it can represent all models.
678 */
679 if (OCTEON_IS_MODEL(OCTEON_CN58XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) {
680 tag.s.V = tmp_tag.cn58xx.V;
681 tag.s.D = tmp_tag.cn58xx.D;
682 tag.s.L = tmp_tag.cn58xx.L;
683 tag.s.U = tmp_tag.cn58xx.U;
684 tag.s.addr = tmp_tag.cn58xx.addr;
685 } else if (OCTEON_IS_MODEL(OCTEON_CN38XX)) {
686 tag.s.V = tmp_tag.cn38xx.V;
687 tag.s.D = tmp_tag.cn38xx.D;
688 tag.s.L = tmp_tag.cn38xx.L;
689 tag.s.U = tmp_tag.cn38xx.U;
690 tag.s.addr = tmp_tag.cn38xx.addr;
691 } else if (OCTEON_IS_MODEL(OCTEON_CN31XX) || OCTEON_IS_MODEL(OCTEON_CN52XX)) {
692 tag.s.V = tmp_tag.cn31xx.V;
693 tag.s.D = tmp_tag.cn31xx.D;
694 tag.s.L = tmp_tag.cn31xx.L;
695 tag.s.U = tmp_tag.cn31xx.U;
696 tag.s.addr = tmp_tag.cn31xx.addr;
697 } else if (OCTEON_IS_MODEL(OCTEON_CN30XX)) {
698 tag.s.V = tmp_tag.cn30xx.V;
699 tag.s.D = tmp_tag.cn30xx.D;
700 tag.s.L = tmp_tag.cn30xx.L;
701 tag.s.U = tmp_tag.cn30xx.U;
702 tag.s.addr = tmp_tag.cn30xx.addr;
703 } else if (OCTEON_IS_MODEL(OCTEON_CN50XX)) {
704 tag.s.V = tmp_tag.cn50xx.V;
705 tag.s.D = tmp_tag.cn50xx.D;
706 tag.s.L = tmp_tag.cn50xx.L;
707 tag.s.U = tmp_tag.cn50xx.U;
708 tag.s.addr = tmp_tag.cn50xx.addr;
709 } else {
710 cvmx_dprintf("Unsupported OCTEON Model in %s\n", __func__);
711 }
620 } 712 }
621
622 return tag; 713 return tag;
623} 714}
624 715
625uint32_t cvmx_l2c_address_to_index(uint64_t addr) 716uint32_t cvmx_l2c_address_to_index(uint64_t addr)
626{ 717{
627 uint64_t idx = addr >> CVMX_L2C_IDX_ADDR_SHIFT; 718 uint64_t idx = addr >> CVMX_L2C_IDX_ADDR_SHIFT;
628 union cvmx_l2c_cfg l2c_cfg; 719 int indxalias = 0;
629 l2c_cfg.u64 = cvmx_read_csr(CVMX_L2C_CFG);
630 720
631 if (l2c_cfg.s.idxalias) { 721 if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
632 idx ^= 722 union cvmx_l2c_ctl l2c_ctl;
633 ((addr & CVMX_L2C_ALIAS_MASK) >> 723 l2c_ctl.u64 = cvmx_read_csr(CVMX_L2C_CTL);
634 CVMX_L2C_TAG_ADDR_ALIAS_SHIFT); 724 indxalias = !l2c_ctl.s.disidxalias;
725 } else {
726 union cvmx_l2c_cfg l2c_cfg;
727 l2c_cfg.u64 = cvmx_read_csr(CVMX_L2C_CFG);
728 indxalias = l2c_cfg.s.idxalias;
729 }
730
731 if (indxalias) {
732 if (OCTEON_IS_MODEL(OCTEON_CN63XX)) {
733 uint32_t a_14_12 = (idx / (CVMX_L2C_MEMBANK_SELECT_SIZE/(1<<CVMX_L2C_IDX_ADDR_SHIFT))) & 0x7;
734 idx ^= idx / cvmx_l2c_get_num_sets();
735 idx ^= a_14_12;
736 } else {
737 idx ^= ((addr & CVMX_L2C_ALIAS_MASK) >> CVMX_L2C_TAG_ADDR_ALIAS_SHIFT);
738 }
635 } 739 }
636 idx &= CVMX_L2C_IDX_MASK; 740 idx &= CVMX_L2C_IDX_MASK;
637 return idx; 741 return idx;
@@ -652,10 +756,9 @@ int cvmx_l2c_get_set_bits(void)
652 int l2_set_bits; 756 int l2_set_bits;
653 if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN58XX)) 757 if (OCTEON_IS_MODEL(OCTEON_CN56XX) || OCTEON_IS_MODEL(OCTEON_CN58XX))
654 l2_set_bits = 11; /* 2048 sets */ 758 l2_set_bits = 11; /* 2048 sets */
655 else if (OCTEON_IS_MODEL(OCTEON_CN38XX)) 759 else if (OCTEON_IS_MODEL(OCTEON_CN38XX) || OCTEON_IS_MODEL(OCTEON_CN63XX))
656 l2_set_bits = 10; /* 1024 sets */ 760 l2_set_bits = 10; /* 1024 sets */
657 else if (OCTEON_IS_MODEL(OCTEON_CN31XX) 761 else if (OCTEON_IS_MODEL(OCTEON_CN31XX) || OCTEON_IS_MODEL(OCTEON_CN52XX))
658 || OCTEON_IS_MODEL(OCTEON_CN52XX))
659 l2_set_bits = 9; /* 512 sets */ 762 l2_set_bits = 9; /* 512 sets */
660 else if (OCTEON_IS_MODEL(OCTEON_CN30XX)) 763 else if (OCTEON_IS_MODEL(OCTEON_CN30XX))
661 l2_set_bits = 8; /* 256 sets */ 764 l2_set_bits = 8; /* 256 sets */
@@ -666,7 +769,6 @@ int cvmx_l2c_get_set_bits(void)
666 l2_set_bits = 11; /* 2048 sets */ 769 l2_set_bits = 11; /* 2048 sets */
667 } 770 }
668 return l2_set_bits; 771 return l2_set_bits;
669
670} 772}
671 773
672/* Return the number of sets in the L2 Cache */ 774/* Return the number of sets in the L2 Cache */
@@ -682,8 +784,11 @@ int cvmx_l2c_get_num_assoc(void)
682 if (OCTEON_IS_MODEL(OCTEON_CN56XX) || 784 if (OCTEON_IS_MODEL(OCTEON_CN56XX) ||
683 OCTEON_IS_MODEL(OCTEON_CN52XX) || 785 OCTEON_IS_MODEL(OCTEON_CN52XX) ||
684 OCTEON_IS_MODEL(OCTEON_CN58XX) || 786 OCTEON_IS_MODEL(OCTEON_CN58XX) ||
685 OCTEON_IS_MODEL(OCTEON_CN50XX) || OCTEON_IS_MODEL(OCTEON_CN38XX)) 787 OCTEON_IS_MODEL(OCTEON_CN50XX) ||
788 OCTEON_IS_MODEL(OCTEON_CN38XX))
686 l2_assoc = 8; 789 l2_assoc = 8;
790 else if (OCTEON_IS_MODEL(OCTEON_CN63XX))
791 l2_assoc = 16;
687 else if (OCTEON_IS_MODEL(OCTEON_CN31XX) || 792 else if (OCTEON_IS_MODEL(OCTEON_CN31XX) ||
688 OCTEON_IS_MODEL(OCTEON_CN30XX)) 793 OCTEON_IS_MODEL(OCTEON_CN30XX))
689 l2_assoc = 4; 794 l2_assoc = 4;
@@ -693,11 +798,42 @@ int cvmx_l2c_get_num_assoc(void)
693 } 798 }
694 799
695 /* Check to see if part of the cache is disabled */ 800 /* Check to see if part of the cache is disabled */
696 if (cvmx_fuse_read(265)) 801 if (OCTEON_IS_MODEL(OCTEON_CN63XX)) {
697 l2_assoc = l2_assoc >> 2; 802 union cvmx_mio_fus_dat3 mio_fus_dat3;
698 else if (cvmx_fuse_read(264)) 803
699 l2_assoc = l2_assoc >> 1; 804 mio_fus_dat3.u64 = cvmx_read_csr(CVMX_MIO_FUS_DAT3);
700 805 /*
806 * cvmx_mio_fus_dat3.s.l2c_crip fuses map as follows
807 * <2> will be not used for 63xx
808 * <1> disables 1/2 ways
809 * <0> disables 1/4 ways
810 * They are cumulative, so for 63xx:
811 * <1> <0>
812 * 0 0 16-way 2MB cache
813 * 0 1 12-way 1.5MB cache
814 * 1 0 8-way 1MB cache
815 * 1 1 4-way 512KB cache
816 */
817
818 if (mio_fus_dat3.s.l2c_crip == 3)
819 l2_assoc = 4;
820 else if (mio_fus_dat3.s.l2c_crip == 2)
821 l2_assoc = 8;
822 else if (mio_fus_dat3.s.l2c_crip == 1)
823 l2_assoc = 12;
824 } else {
825 union cvmx_l2d_fus3 val;
826 val.u64 = cvmx_read_csr(CVMX_L2D_FUS3);
827 /*
828 * Using shifts here, as bit position names are
829 * different for each model but they all mean the
830 * same.
831 */
832 if ((val.u64 >> 35) & 0x1)
833 l2_assoc = l2_assoc >> 2;
834 else if ((val.u64 >> 34) & 0x1)
835 l2_assoc = l2_assoc >> 1;
836 }
701 return l2_assoc; 837 return l2_assoc;
702} 838}
703 839
@@ -711,24 +847,54 @@ int cvmx_l2c_get_num_assoc(void)
711 */ 847 */
712void cvmx_l2c_flush_line(uint32_t assoc, uint32_t index) 848void cvmx_l2c_flush_line(uint32_t assoc, uint32_t index)
713{ 849{
714 union cvmx_l2c_dbg l2cdbg; 850 /* Check the range of the index. */
851 if (index > (uint32_t)cvmx_l2c_get_num_sets()) {
852 cvmx_dprintf("ERROR: cvmx_l2c_flush_line index out of range.\n");
853 return;
854 }
715 855
716 l2cdbg.u64 = 0; 856 /* Check the range of association. */
717 l2cdbg.s.ppnum = cvmx_get_core_num(); 857 if (assoc > (uint32_t)cvmx_l2c_get_num_assoc()) {
718 l2cdbg.s.finv = 1; 858 cvmx_dprintf("ERROR: cvmx_l2c_flush_line association out of range.\n");
859 return;
860 }
719 861
720 l2cdbg.s.set = assoc; 862 if (OCTEON_IS_MODEL(OCTEON_CN63XX)) {
721 /* 863 uint64_t address;
722 * Enter debug mode, and make sure all other writes complete 864 /* Create the address based on index and association.
723 * before we enter debug mode. 865 * Bits<20:17> select the way of the cache block involved in
724 */ 866 * the operation
725 asm volatile ("sync" : : : "memory"); 867 * Bits<16:7> of the effect address select the index
726 cvmx_write_csr(CVMX_L2C_DBG, l2cdbg.u64); 868 */
727 cvmx_read_csr(CVMX_L2C_DBG); 869 address = CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
728 870 (assoc << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) |
729 CVMX_PREPARE_FOR_STORE(((1ULL << 63) + (index) * 128), 0); 871 (index << CVMX_L2C_IDX_ADDR_SHIFT));
730 /* Exit debug mode */ 872 CVMX_CACHE_WBIL2I(address, 0);
731 asm volatile ("sync" : : : "memory"); 873 } else {
732 cvmx_write_csr(CVMX_L2C_DBG, 0); 874 union cvmx_l2c_dbg l2cdbg;
733 cvmx_read_csr(CVMX_L2C_DBG); 875
876 l2cdbg.u64 = 0;
877 if (!OCTEON_IS_MODEL(OCTEON_CN30XX))
878 l2cdbg.s.ppnum = cvmx_get_core_num();
879 l2cdbg.s.finv = 1;
880
881 l2cdbg.s.set = assoc;
882 cvmx_spinlock_lock(&cvmx_l2c_spinlock);
883 /*
884 * Enter debug mode, and make sure all other writes
885 * complete before we enter debug mode
886 */
887 CVMX_SYNC;
888 cvmx_write_csr(CVMX_L2C_DBG, l2cdbg.u64);
889 cvmx_read_csr(CVMX_L2C_DBG);
890
891 CVMX_PREPARE_FOR_STORE(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
892 index * CVMX_CACHE_LINE_SIZE),
893 0);
894 /* Exit debug mode */
895 CVMX_SYNC;
896 cvmx_write_csr(CVMX_L2C_DBG, 0);
897 cvmx_read_csr(CVMX_L2C_DBG);
898 cvmx_spinlock_unlock(&cvmx_l2c_spinlock);
899 }
734} 900}
diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c
index 62ac30eef5e8..cecaf62aef32 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -3,13 +3,15 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2004-2009 Cavium Networks 6 * Copyright (C) 2004-2010 Cavium Networks
7 * Copyright (C) 2008 Wind River Systems 7 * Copyright (C) 2008 Wind River Systems
8 */ 8 */
9 9
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/i2c.h> 12#include <linux/i2c.h>
13#include <linux/usb.h>
14#include <linux/dma-mapping.h>
13#include <linux/module.h> 15#include <linux/module.h>
14#include <linux/platform_device.h> 16#include <linux/platform_device.h>
15 17
@@ -198,7 +200,7 @@ static int __init octeon_i2c_device_init(void)
198 num_ports = 1; 200 num_ports = 1;
199 201
200 for (port = 0; port < num_ports; port++) { 202 for (port = 0; port < num_ports; port++) {
201 octeon_i2c_data[port].sys_freq = octeon_get_clock_rate(); 203 octeon_i2c_data[port].sys_freq = octeon_get_io_clock_rate();
202 /*FIXME: should be examined. At the moment is set for 100Khz */ 204 /*FIXME: should be examined. At the moment is set for 100Khz */
203 octeon_i2c_data[port].i2c_freq = 100000; 205 octeon_i2c_data[port].i2c_freq = 100000;
204 206
@@ -301,6 +303,10 @@ static int __init octeon_mgmt_device_init(void)
301 ret = -ENOMEM; 303 ret = -ENOMEM;
302 goto out; 304 goto out;
303 } 305 }
306 /* No DMA restrictions */
307 pd->dev.coherent_dma_mask = DMA_BIT_MASK(64);
308 pd->dev.dma_mask = &pd->dev.coherent_dma_mask;
309
304 switch (port) { 310 switch (port) {
305 case 0: 311 case 0:
306 mgmt_port_resource.start = OCTEON_IRQ_MII0; 312 mgmt_port_resource.start = OCTEON_IRQ_MII0;
@@ -332,6 +338,108 @@ out:
332} 338}
333device_initcall(octeon_mgmt_device_init); 339device_initcall(octeon_mgmt_device_init);
334 340
341#ifdef CONFIG_USB
342
343static int __init octeon_ehci_device_init(void)
344{
345 struct platform_device *pd;
346 int ret = 0;
347
348 struct resource usb_resources[] = {
349 {
350 .flags = IORESOURCE_MEM,
351 }, {
352 .flags = IORESOURCE_IRQ,
353 }
354 };
355
356 /* Only Octeon2 has ehci/ohci */
357 if (!OCTEON_IS_MODEL(OCTEON_CN63XX))
358 return 0;
359
360 if (octeon_is_simulation() || usb_disabled())
361 return 0; /* No USB in the simulator. */
362
363 pd = platform_device_alloc("octeon-ehci", 0);
364 if (!pd) {
365 ret = -ENOMEM;
366 goto out;
367 }
368
369 usb_resources[0].start = 0x00016F0000000000ULL;
370 usb_resources[0].end = usb_resources[0].start + 0x100;
371
372 usb_resources[1].start = OCTEON_IRQ_USB0;
373 usb_resources[1].end = OCTEON_IRQ_USB0;
374
375 ret = platform_device_add_resources(pd, usb_resources,
376 ARRAY_SIZE(usb_resources));
377 if (ret)
378 goto fail;
379
380 ret = platform_device_add(pd);
381 if (ret)
382 goto fail;
383
384 return ret;
385fail:
386 platform_device_put(pd);
387out:
388 return ret;
389}
390device_initcall(octeon_ehci_device_init);
391
392static int __init octeon_ohci_device_init(void)
393{
394 struct platform_device *pd;
395 int ret = 0;
396
397 struct resource usb_resources[] = {
398 {
399 .flags = IORESOURCE_MEM,
400 }, {
401 .flags = IORESOURCE_IRQ,
402 }
403 };
404
405 /* Only Octeon2 has ehci/ohci */
406 if (!OCTEON_IS_MODEL(OCTEON_CN63XX))
407 return 0;
408
409 if (octeon_is_simulation() || usb_disabled())
410 return 0; /* No USB in the simulator. */
411
412 pd = platform_device_alloc("octeon-ohci", 0);
413 if (!pd) {
414 ret = -ENOMEM;
415 goto out;
416 }
417
418 usb_resources[0].start = 0x00016F0000000400ULL;
419 usb_resources[0].end = usb_resources[0].start + 0x100;
420
421 usb_resources[1].start = OCTEON_IRQ_USB0;
422 usb_resources[1].end = OCTEON_IRQ_USB0;
423
424 ret = platform_device_add_resources(pd, usb_resources,
425 ARRAY_SIZE(usb_resources));
426 if (ret)
427 goto fail;
428
429 ret = platform_device_add(pd);
430 if (ret)
431 goto fail;
432
433 return ret;
434fail:
435 platform_device_put(pd);
436out:
437 return ret;
438}
439device_initcall(octeon_ohci_device_init);
440
441#endif /* CONFIG_USB */
442
335MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>"); 443MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>");
336MODULE_LICENSE("GPL"); 444MODULE_LICENSE("GPL");
337MODULE_DESCRIPTION("Platform driver for Octeon SOC"); 445MODULE_DESCRIPTION("Platform driver for Octeon SOC");
diff --git a/arch/mips/cavium-octeon/serial.c b/arch/mips/cavium-octeon/serial.c
index 12dbf533b77d..057f0ae88c99 100644
--- a/arch/mips/cavium-octeon/serial.c
+++ b/arch/mips/cavium-octeon/serial.c
@@ -66,7 +66,7 @@ static void __init octeon_uart_set_common(struct plat_serial8250_port *p)
66 /* Make simulator output fast*/ 66 /* Make simulator output fast*/
67 p->uartclk = 115200 * 16; 67 p->uartclk = 115200 * 16;
68 else 68 else
69 p->uartclk = mips_hpt_frequency; 69 p->uartclk = octeon_get_io_clock_rate();
70 p->serial_in = octeon_serial_in; 70 p->serial_in = octeon_serial_in;
71 p->serial_out = octeon_serial_out; 71 p->serial_out = octeon_serial_out;
72} 72}
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index 69197cb6c7ea..b0c3686c96dd 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -33,6 +33,7 @@
33 33
34#include <asm/octeon/octeon.h> 34#include <asm/octeon/octeon.h>
35#include <asm/octeon/pci-octeon.h> 35#include <asm/octeon/pci-octeon.h>
36#include <asm/octeon/cvmx-mio-defs.h>
36 37
37#ifdef CONFIG_CAVIUM_DECODE_RSL 38#ifdef CONFIG_CAVIUM_DECODE_RSL
38extern void cvmx_interrupt_rsl_decode(void); 39extern void cvmx_interrupt_rsl_decode(void);
@@ -96,12 +97,21 @@ int octeon_is_pci_host(void)
96 */ 97 */
97uint64_t octeon_get_clock_rate(void) 98uint64_t octeon_get_clock_rate(void)
98{ 99{
99 if (octeon_is_simulation()) 100 struct cvmx_sysinfo *sysinfo = cvmx_sysinfo_get();
100 octeon_bootinfo->eclock_hz = 6000000; 101
101 return octeon_bootinfo->eclock_hz; 102 return sysinfo->cpu_clock_hz;
102} 103}
103EXPORT_SYMBOL(octeon_get_clock_rate); 104EXPORT_SYMBOL(octeon_get_clock_rate);
104 105
106static u64 octeon_io_clock_rate;
107
108u64 octeon_get_io_clock_rate(void)
109{
110 return octeon_io_clock_rate;
111}
112EXPORT_SYMBOL(octeon_get_io_clock_rate);
113
114
105/** 115/**
106 * Write to the LCD display connected to the bootbus. This display 116 * Write to the LCD display connected to the bootbus. This display
107 * exists on most Cavium evaluation boards. If it doesn't exist, then 117 * exists on most Cavium evaluation boards. If it doesn't exist, then
@@ -346,8 +356,18 @@ void octeon_user_io_init(void)
346 cvmmemctl.s.wbfltime = 0; 356 cvmmemctl.s.wbfltime = 0;
347 /* R/W If set, do not put Istream in the L2 cache. */ 357 /* R/W If set, do not put Istream in the L2 cache. */
348 cvmmemctl.s.istrnol2 = 0; 358 cvmmemctl.s.istrnol2 = 0;
349 /* R/W The write buffer threshold. */ 359
350 cvmmemctl.s.wbthresh = 10; 360 /*
361 * R/W The write buffer threshold. As per erratum Core-14752
362 * for CN63XX, a sc/scd might fail if the write buffer is
363 * full. Lowering WBTHRESH greatly lowers the chances of the
364 * write buffer ever being full and triggering the erratum.
365 */
366 if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_X))
367 cvmmemctl.s.wbthresh = 4;
368 else
369 cvmmemctl.s.wbthresh = 10;
370
351 /* R/W If set, CVMSEG is available for loads/stores in 371 /* R/W If set, CVMSEG is available for loads/stores in
352 * kernel/debug mode. */ 372 * kernel/debug mode. */
353#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0 373#if CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0
@@ -365,14 +385,13 @@ void octeon_user_io_init(void)
365 * is max legal value. */ 385 * is max legal value. */
366 cvmmemctl.s.lmemsz = CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE; 386 cvmmemctl.s.lmemsz = CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE;
367 387
388 write_c0_cvmmemctl(cvmmemctl.u64);
368 389
369 if (smp_processor_id() == 0) 390 if (smp_processor_id() == 0)
370 pr_notice("CVMSEG size: %d cache lines (%d bytes)\n", 391 pr_notice("CVMSEG size: %d cache lines (%d bytes)\n",
371 CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE, 392 CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE,
372 CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE * 128); 393 CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE * 128);
373 394
374 write_c0_cvmmemctl(cvmmemctl.u64);
375
376 /* Move the performance counter interrupts to IRQ 6 */ 395 /* Move the performance counter interrupts to IRQ 6 */
377 cvmctl = read_c0_cvmctl(); 396 cvmctl = read_c0_cvmctl();
378 cvmctl &= ~(7 << 7); 397 cvmctl &= ~(7 << 7);
@@ -416,6 +435,41 @@ void __init prom_init(void)
416 cvmx_phys_to_ptr(octeon_boot_desc_ptr->cvmx_desc_vaddr); 435 cvmx_phys_to_ptr(octeon_boot_desc_ptr->cvmx_desc_vaddr);
417 cvmx_bootmem_init(cvmx_phys_to_ptr(octeon_bootinfo->phy_mem_desc_addr)); 436 cvmx_bootmem_init(cvmx_phys_to_ptr(octeon_bootinfo->phy_mem_desc_addr));
418 437
438 sysinfo = cvmx_sysinfo_get();
439 memset(sysinfo, 0, sizeof(*sysinfo));
440 sysinfo->system_dram_size = octeon_bootinfo->dram_size << 20;
441 sysinfo->phy_mem_desc_ptr =
442 cvmx_phys_to_ptr(octeon_bootinfo->phy_mem_desc_addr);
443 sysinfo->core_mask = octeon_bootinfo->core_mask;
444 sysinfo->exception_base_addr = octeon_bootinfo->exception_base_addr;
445 sysinfo->cpu_clock_hz = octeon_bootinfo->eclock_hz;
446 sysinfo->dram_data_rate_hz = octeon_bootinfo->dclock_hz * 2;
447 sysinfo->board_type = octeon_bootinfo->board_type;
448 sysinfo->board_rev_major = octeon_bootinfo->board_rev_major;
449 sysinfo->board_rev_minor = octeon_bootinfo->board_rev_minor;
450 memcpy(sysinfo->mac_addr_base, octeon_bootinfo->mac_addr_base,
451 sizeof(sysinfo->mac_addr_base));
452 sysinfo->mac_addr_count = octeon_bootinfo->mac_addr_count;
453 memcpy(sysinfo->board_serial_number,
454 octeon_bootinfo->board_serial_number,
455 sizeof(sysinfo->board_serial_number));
456 sysinfo->compact_flash_common_base_addr =
457 octeon_bootinfo->compact_flash_common_base_addr;
458 sysinfo->compact_flash_attribute_base_addr =
459 octeon_bootinfo->compact_flash_attribute_base_addr;
460 sysinfo->led_display_base_addr = octeon_bootinfo->led_display_base_addr;
461 sysinfo->dfa_ref_clock_hz = octeon_bootinfo->dfa_ref_clock_hz;
462 sysinfo->bootloader_config_flags = octeon_bootinfo->config_flags;
463
464 if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) {
465 /* I/O clock runs at a different rate than the CPU. */
466 union cvmx_mio_rst_boot rst_boot;
467 rst_boot.u64 = cvmx_read_csr(CVMX_MIO_RST_BOOT);
468 octeon_io_clock_rate = 50000000 * rst_boot.s.pnr_mul;
469 } else {
470 octeon_io_clock_rate = sysinfo->cpu_clock_hz;
471 }
472
419 /* 473 /*
420 * Only enable the LED controller if we're running on a CN38XX, CN58XX, 474 * Only enable the LED controller if we're running on a CN38XX, CN58XX,
421 * or CN56XX. The CN30XX and CN31XX don't have an LED controller. 475 * or CN56XX. The CN30XX and CN31XX don't have an LED controller.
@@ -479,33 +533,6 @@ void __init prom_init(void)
479 } 533 }
480#endif 534#endif
481 535
482 sysinfo = cvmx_sysinfo_get();
483 memset(sysinfo, 0, sizeof(*sysinfo));
484 sysinfo->system_dram_size = octeon_bootinfo->dram_size << 20;
485 sysinfo->phy_mem_desc_ptr =
486 cvmx_phys_to_ptr(octeon_bootinfo->phy_mem_desc_addr);
487 sysinfo->core_mask = octeon_bootinfo->core_mask;
488 sysinfo->exception_base_addr = octeon_bootinfo->exception_base_addr;
489 sysinfo->cpu_clock_hz = octeon_bootinfo->eclock_hz;
490 sysinfo->dram_data_rate_hz = octeon_bootinfo->dclock_hz * 2;
491 sysinfo->board_type = octeon_bootinfo->board_type;
492 sysinfo->board_rev_major = octeon_bootinfo->board_rev_major;
493 sysinfo->board_rev_minor = octeon_bootinfo->board_rev_minor;
494 memcpy(sysinfo->mac_addr_base, octeon_bootinfo->mac_addr_base,
495 sizeof(sysinfo->mac_addr_base));
496 sysinfo->mac_addr_count = octeon_bootinfo->mac_addr_count;
497 memcpy(sysinfo->board_serial_number,
498 octeon_bootinfo->board_serial_number,
499 sizeof(sysinfo->board_serial_number));
500 sysinfo->compact_flash_common_base_addr =
501 octeon_bootinfo->compact_flash_common_base_addr;
502 sysinfo->compact_flash_attribute_base_addr =
503 octeon_bootinfo->compact_flash_attribute_base_addr;
504 sysinfo->led_display_base_addr = octeon_bootinfo->led_display_base_addr;
505 sysinfo->dfa_ref_clock_hz = octeon_bootinfo->dfa_ref_clock_hz;
506 sysinfo->bootloader_config_flags = octeon_bootinfo->config_flags;
507
508
509 octeon_check_cpu_bist(); 536 octeon_check_cpu_bist();
510 537
511 octeon_uart = octeon_get_boot_uart(); 538 octeon_uart = octeon_get_boot_uart();
@@ -740,6 +767,31 @@ EXPORT_SYMBOL(prom_putchar);
740 767
741void prom_free_prom_memory(void) 768void prom_free_prom_memory(void)
742{ 769{
770 if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_X)) {
771 /* Check for presence of Core-14449 fix. */
772 u32 insn;
773 u32 *foo;
774
775 foo = &insn;
776
777 asm volatile("# before" : : : "memory");
778 prefetch(foo);
779 asm volatile(
780 ".set push\n\t"
781 ".set noreorder\n\t"
782 "bal 1f\n\t"
783 "nop\n"
784 "1:\tlw %0,-12($31)\n\t"
785 ".set pop\n\t"
786 : "=r" (insn) : : "$31", "memory");
787
788 if ((insn >> 26) != 0x33)
789 panic("No PREF instruction at Core-14449 probe point.\n");
790
791 if (((insn >> 16) & 0x1f) != 28)
792 panic("Core-14449 WAR not in place (%04x).\n"
793 "Please build kernel with proper options (CONFIG_CAVIUM_CN63XXP1).\n", insn);
794 }
743#ifdef CONFIG_CAVIUM_DECODE_RSL 795#ifdef CONFIG_CAVIUM_DECODE_RSL
744 cvmx_interrupt_rsl_enable(); 796 cvmx_interrupt_rsl_enable();
745 797
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h
index 47d87da379f9..4a02fe891ab6 100644
--- a/arch/mips/include/asm/atomic.h
+++ b/arch/mips/include/asm/atomic.h
@@ -64,18 +64,16 @@ static __inline__ void atomic_add(int i, atomic_t * v)
64 } else if (kernel_uses_llsc) { 64 } else if (kernel_uses_llsc) {
65 int temp; 65 int temp;
66 66
67 __asm__ __volatile__( 67 do {
68 " .set mips3 \n" 68 __asm__ __volatile__(
69 "1: ll %0, %1 # atomic_add \n" 69 " .set mips3 \n"
70 " addu %0, %2 \n" 70 " ll %0, %1 # atomic_add \n"
71 " sc %0, %1 \n" 71 " addu %0, %2 \n"
72 " beqz %0, 2f \n" 72 " sc %0, %1 \n"
73 " .subsection 2 \n" 73 " .set mips0 \n"
74 "2: b 1b \n" 74 : "=&r" (temp), "=m" (v->counter)
75 " .previous \n" 75 : "Ir" (i), "m" (v->counter));
76 " .set mips0 \n" 76 } while (unlikely(!temp));
77 : "=&r" (temp), "=m" (v->counter)
78 : "Ir" (i), "m" (v->counter));
79 } else { 77 } else {
80 unsigned long flags; 78 unsigned long flags;
81 79
@@ -109,18 +107,16 @@ static __inline__ void atomic_sub(int i, atomic_t * v)
109 } else if (kernel_uses_llsc) { 107 } else if (kernel_uses_llsc) {
110 int temp; 108 int temp;
111 109
112 __asm__ __volatile__( 110 do {
113 " .set mips3 \n" 111 __asm__ __volatile__(
114 "1: ll %0, %1 # atomic_sub \n" 112 " .set mips3 \n"
115 " subu %0, %2 \n" 113 " ll %0, %1 # atomic_sub \n"
116 " sc %0, %1 \n" 114 " subu %0, %2 \n"
117 " beqz %0, 2f \n" 115 " sc %0, %1 \n"
118 " .subsection 2 \n" 116 " .set mips0 \n"
119 "2: b 1b \n" 117 : "=&r" (temp), "=m" (v->counter)
120 " .previous \n" 118 : "Ir" (i), "m" (v->counter));
121 " .set mips0 \n" 119 } while (unlikely(!temp));
122 : "=&r" (temp), "=m" (v->counter)
123 : "Ir" (i), "m" (v->counter));
124 } else { 120 } else {
125 unsigned long flags; 121 unsigned long flags;
126 122
@@ -156,20 +152,19 @@ static __inline__ int atomic_add_return(int i, atomic_t * v)
156 } else if (kernel_uses_llsc) { 152 } else if (kernel_uses_llsc) {
157 int temp; 153 int temp;
158 154
159 __asm__ __volatile__( 155 do {
160 " .set mips3 \n" 156 __asm__ __volatile__(
161 "1: ll %1, %2 # atomic_add_return \n" 157 " .set mips3 \n"
162 " addu %0, %1, %3 \n" 158 " ll %1, %2 # atomic_add_return \n"
163 " sc %0, %2 \n" 159 " addu %0, %1, %3 \n"
164 " beqz %0, 2f \n" 160 " sc %0, %2 \n"
165 " addu %0, %1, %3 \n" 161 " .set mips0 \n"
166 " .subsection 2 \n" 162 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
167 "2: b 1b \n" 163 : "Ir" (i), "m" (v->counter)
168 " .previous \n" 164 : "memory");
169 " .set mips0 \n" 165 } while (unlikely(!result));
170 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 166
171 : "Ir" (i), "m" (v->counter) 167 result = temp + i;
172 : "memory");
173 } else { 168 } else {
174 unsigned long flags; 169 unsigned long flags;
175 170
@@ -205,23 +200,24 @@ static __inline__ int atomic_sub_return(int i, atomic_t * v)
205 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 200 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
206 : "Ir" (i), "m" (v->counter) 201 : "Ir" (i), "m" (v->counter)
207 : "memory"); 202 : "memory");
203
204 result = temp - i;
208 } else if (kernel_uses_llsc) { 205 } else if (kernel_uses_llsc) {
209 int temp; 206 int temp;
210 207
211 __asm__ __volatile__( 208 do {
212 " .set mips3 \n" 209 __asm__ __volatile__(
213 "1: ll %1, %2 # atomic_sub_return \n" 210 " .set mips3 \n"
214 " subu %0, %1, %3 \n" 211 " ll %1, %2 # atomic_sub_return \n"
215 " sc %0, %2 \n" 212 " subu %0, %1, %3 \n"
216 " beqz %0, 2f \n" 213 " sc %0, %2 \n"
217 " subu %0, %1, %3 \n" 214 " .set mips0 \n"
218 " .subsection 2 \n" 215 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
219 "2: b 1b \n" 216 : "Ir" (i), "m" (v->counter)
220 " .previous \n" 217 : "memory");
221 " .set mips0 \n" 218 } while (unlikely(!result));
222 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 219
223 : "Ir" (i), "m" (v->counter) 220 result = temp - i;
224 : "memory");
225 } else { 221 } else {
226 unsigned long flags; 222 unsigned long flags;
227 223
@@ -279,12 +275,9 @@ static __inline__ int atomic_sub_if_positive(int i, atomic_t * v)
279 " bltz %0, 1f \n" 275 " bltz %0, 1f \n"
280 " sc %0, %2 \n" 276 " sc %0, %2 \n"
281 " .set noreorder \n" 277 " .set noreorder \n"
282 " beqz %0, 2f \n" 278 " beqz %0, 1b \n"
283 " subu %0, %1, %3 \n" 279 " subu %0, %1, %3 \n"
284 " .set reorder \n" 280 " .set reorder \n"
285 " .subsection 2 \n"
286 "2: b 1b \n"
287 " .previous \n"
288 "1: \n" 281 "1: \n"
289 " .set mips0 \n" 282 " .set mips0 \n"
290 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 283 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
@@ -443,18 +436,16 @@ static __inline__ void atomic64_add(long i, atomic64_t * v)
443 } else if (kernel_uses_llsc) { 436 } else if (kernel_uses_llsc) {
444 long temp; 437 long temp;
445 438
446 __asm__ __volatile__( 439 do {
447 " .set mips3 \n" 440 __asm__ __volatile__(
448 "1: lld %0, %1 # atomic64_add \n" 441 " .set mips3 \n"
449 " daddu %0, %2 \n" 442 " lld %0, %1 # atomic64_add \n"
450 " scd %0, %1 \n" 443 " daddu %0, %2 \n"
451 " beqz %0, 2f \n" 444 " scd %0, %1 \n"
452 " .subsection 2 \n" 445 " .set mips0 \n"
453 "2: b 1b \n" 446 : "=&r" (temp), "=m" (v->counter)
454 " .previous \n" 447 : "Ir" (i), "m" (v->counter));
455 " .set mips0 \n" 448 } while (unlikely(!temp));
456 : "=&r" (temp), "=m" (v->counter)
457 : "Ir" (i), "m" (v->counter));
458 } else { 449 } else {
459 unsigned long flags; 450 unsigned long flags;
460 451
@@ -488,18 +479,16 @@ static __inline__ void atomic64_sub(long i, atomic64_t * v)
488 } else if (kernel_uses_llsc) { 479 } else if (kernel_uses_llsc) {
489 long temp; 480 long temp;
490 481
491 __asm__ __volatile__( 482 do {
492 " .set mips3 \n" 483 __asm__ __volatile__(
493 "1: lld %0, %1 # atomic64_sub \n" 484 " .set mips3 \n"
494 " dsubu %0, %2 \n" 485 " lld %0, %1 # atomic64_sub \n"
495 " scd %0, %1 \n" 486 " dsubu %0, %2 \n"
496 " beqz %0, 2f \n" 487 " scd %0, %1 \n"
497 " .subsection 2 \n" 488 " .set mips0 \n"
498 "2: b 1b \n" 489 : "=&r" (temp), "=m" (v->counter)
499 " .previous \n" 490 : "Ir" (i), "m" (v->counter));
500 " .set mips0 \n" 491 } while (unlikely(!temp));
501 : "=&r" (temp), "=m" (v->counter)
502 : "Ir" (i), "m" (v->counter));
503 } else { 492 } else {
504 unsigned long flags; 493 unsigned long flags;
505 494
@@ -535,20 +524,19 @@ static __inline__ long atomic64_add_return(long i, atomic64_t * v)
535 } else if (kernel_uses_llsc) { 524 } else if (kernel_uses_llsc) {
536 long temp; 525 long temp;
537 526
538 __asm__ __volatile__( 527 do {
539 " .set mips3 \n" 528 __asm__ __volatile__(
540 "1: lld %1, %2 # atomic64_add_return \n" 529 " .set mips3 \n"
541 " daddu %0, %1, %3 \n" 530 " lld %1, %2 # atomic64_add_return \n"
542 " scd %0, %2 \n" 531 " daddu %0, %1, %3 \n"
543 " beqz %0, 2f \n" 532 " scd %0, %2 \n"
544 " daddu %0, %1, %3 \n" 533 " .set mips0 \n"
545 " .subsection 2 \n" 534 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
546 "2: b 1b \n" 535 : "Ir" (i), "m" (v->counter)
547 " .previous \n" 536 : "memory");
548 " .set mips0 \n" 537 } while (unlikely(!result));
549 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 538
550 : "Ir" (i), "m" (v->counter) 539 result = temp + i;
551 : "memory");
552 } else { 540 } else {
553 unsigned long flags; 541 unsigned long flags;
554 542
@@ -587,20 +575,19 @@ static __inline__ long atomic64_sub_return(long i, atomic64_t * v)
587 } else if (kernel_uses_llsc) { 575 } else if (kernel_uses_llsc) {
588 long temp; 576 long temp;
589 577
590 __asm__ __volatile__( 578 do {
591 " .set mips3 \n" 579 __asm__ __volatile__(
592 "1: lld %1, %2 # atomic64_sub_return \n" 580 " .set mips3 \n"
593 " dsubu %0, %1, %3 \n" 581 " lld %1, %2 # atomic64_sub_return \n"
594 " scd %0, %2 \n" 582 " dsubu %0, %1, %3 \n"
595 " beqz %0, 2f \n" 583 " scd %0, %2 \n"
596 " dsubu %0, %1, %3 \n" 584 " .set mips0 \n"
597 " .subsection 2 \n" 585 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
598 "2: b 1b \n" 586 : "Ir" (i), "m" (v->counter)
599 " .previous \n" 587 : "memory");
600 " .set mips0 \n" 588 } while (unlikely(!result));
601 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 589
602 : "Ir" (i), "m" (v->counter) 590 result = temp - i;
603 : "memory");
604 } else { 591 } else {
605 unsigned long flags; 592 unsigned long flags;
606 593
@@ -658,12 +645,9 @@ static __inline__ long atomic64_sub_if_positive(long i, atomic64_t * v)
658 " bltz %0, 1f \n" 645 " bltz %0, 1f \n"
659 " scd %0, %2 \n" 646 " scd %0, %2 \n"
660 " .set noreorder \n" 647 " .set noreorder \n"
661 " beqz %0, 2f \n" 648 " beqz %0, 1b \n"
662 " dsubu %0, %1, %3 \n" 649 " dsubu %0, %1, %3 \n"
663 " .set reorder \n" 650 " .set reorder \n"
664 " .subsection 2 \n"
665 "2: b 1b \n"
666 " .previous \n"
667 "1: \n" 651 "1: \n"
668 " .set mips0 \n" 652 " .set mips0 \n"
669 : "=&r" (result), "=&r" (temp), "=m" (v->counter) 653 : "=&r" (result), "=&r" (temp), "=m" (v->counter)
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index b0ce7ca2851f..50b4ef288c53 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -73,30 +73,26 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
73 : "ir" (1UL << bit), "m" (*m)); 73 : "ir" (1UL << bit), "m" (*m));
74#ifdef CONFIG_CPU_MIPSR2 74#ifdef CONFIG_CPU_MIPSR2
75 } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { 75 } else if (kernel_uses_llsc && __builtin_constant_p(bit)) {
76 __asm__ __volatile__( 76 do {
77 "1: " __LL "%0, %1 # set_bit \n" 77 __asm__ __volatile__(
78 " " __INS "%0, %4, %2, 1 \n" 78 " " __LL "%0, %1 # set_bit \n"
79 " " __SC "%0, %1 \n" 79 " " __INS "%0, %3, %2, 1 \n"
80 " beqz %0, 2f \n" 80 " " __SC "%0, %1 \n"
81 " .subsection 2 \n" 81 : "=&r" (temp), "+m" (*m)
82 "2: b 1b \n" 82 : "ir" (bit), "r" (~0));
83 " .previous \n" 83 } while (unlikely(!temp));
84 : "=&r" (temp), "=m" (*m)
85 : "ir" (bit), "m" (*m), "r" (~0));
86#endif /* CONFIG_CPU_MIPSR2 */ 84#endif /* CONFIG_CPU_MIPSR2 */
87 } else if (kernel_uses_llsc) { 85 } else if (kernel_uses_llsc) {
88 __asm__ __volatile__( 86 do {
89 " .set mips3 \n" 87 __asm__ __volatile__(
90 "1: " __LL "%0, %1 # set_bit \n" 88 " .set mips3 \n"
91 " or %0, %2 \n" 89 " " __LL "%0, %1 # set_bit \n"
92 " " __SC "%0, %1 \n" 90 " or %0, %2 \n"
93 " beqz %0, 2f \n" 91 " " __SC "%0, %1 \n"
94 " .subsection 2 \n" 92 " .set mips0 \n"
95 "2: b 1b \n" 93 : "=&r" (temp), "+m" (*m)
96 " .previous \n" 94 : "ir" (1UL << bit));
97 " .set mips0 \n" 95 } while (unlikely(!temp));
98 : "=&r" (temp), "=m" (*m)
99 : "ir" (1UL << bit), "m" (*m));
100 } else { 96 } else {
101 volatile unsigned long *a = addr; 97 volatile unsigned long *a = addr;
102 unsigned long mask; 98 unsigned long mask;
@@ -134,34 +130,30 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
134 " " __SC "%0, %1 \n" 130 " " __SC "%0, %1 \n"
135 " beqzl %0, 1b \n" 131 " beqzl %0, 1b \n"
136 " .set mips0 \n" 132 " .set mips0 \n"
137 : "=&r" (temp), "=m" (*m) 133 : "=&r" (temp), "+m" (*m)
138 : "ir" (~(1UL << bit)), "m" (*m)); 134 : "ir" (~(1UL << bit)));
139#ifdef CONFIG_CPU_MIPSR2 135#ifdef CONFIG_CPU_MIPSR2
140 } else if (kernel_uses_llsc && __builtin_constant_p(bit)) { 136 } else if (kernel_uses_llsc && __builtin_constant_p(bit)) {
141 __asm__ __volatile__( 137 do {
142 "1: " __LL "%0, %1 # clear_bit \n" 138 __asm__ __volatile__(
143 " " __INS "%0, $0, %2, 1 \n" 139 " " __LL "%0, %1 # clear_bit \n"
144 " " __SC "%0, %1 \n" 140 " " __INS "%0, $0, %2, 1 \n"
145 " beqz %0, 2f \n" 141 " " __SC "%0, %1 \n"
146 " .subsection 2 \n" 142 : "=&r" (temp), "+m" (*m)
147 "2: b 1b \n" 143 : "ir" (bit));
148 " .previous \n" 144 } while (unlikely(!temp));
149 : "=&r" (temp), "=m" (*m)
150 : "ir" (bit), "m" (*m));
151#endif /* CONFIG_CPU_MIPSR2 */ 145#endif /* CONFIG_CPU_MIPSR2 */
152 } else if (kernel_uses_llsc) { 146 } else if (kernel_uses_llsc) {
153 __asm__ __volatile__( 147 do {
154 " .set mips3 \n" 148 __asm__ __volatile__(
155 "1: " __LL "%0, %1 # clear_bit \n" 149 " .set mips3 \n"
156 " and %0, %2 \n" 150 " " __LL "%0, %1 # clear_bit \n"
157 " " __SC "%0, %1 \n" 151 " and %0, %2 \n"
158 " beqz %0, 2f \n" 152 " " __SC "%0, %1 \n"
159 " .subsection 2 \n" 153 " .set mips0 \n"
160 "2: b 1b \n" 154 : "=&r" (temp), "+m" (*m)
161 " .previous \n" 155 : "ir" (~(1UL << bit)));
162 " .set mips0 \n" 156 } while (unlikely(!temp));
163 : "=&r" (temp), "=m" (*m)
164 : "ir" (~(1UL << bit)), "m" (*m));
165 } else { 157 } else {
166 volatile unsigned long *a = addr; 158 volatile unsigned long *a = addr;
167 unsigned long mask; 159 unsigned long mask;
@@ -213,24 +205,22 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
213 " " __SC "%0, %1 \n" 205 " " __SC "%0, %1 \n"
214 " beqzl %0, 1b \n" 206 " beqzl %0, 1b \n"
215 " .set mips0 \n" 207 " .set mips0 \n"
216 : "=&r" (temp), "=m" (*m) 208 : "=&r" (temp), "+m" (*m)
217 : "ir" (1UL << bit), "m" (*m)); 209 : "ir" (1UL << bit));
218 } else if (kernel_uses_llsc) { 210 } else if (kernel_uses_llsc) {
219 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 211 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
220 unsigned long temp; 212 unsigned long temp;
221 213
222 __asm__ __volatile__( 214 do {
223 " .set mips3 \n" 215 __asm__ __volatile__(
224 "1: " __LL "%0, %1 # change_bit \n" 216 " .set mips3 \n"
225 " xor %0, %2 \n" 217 " " __LL "%0, %1 # change_bit \n"
226 " " __SC "%0, %1 \n" 218 " xor %0, %2 \n"
227 " beqz %0, 2f \n" 219 " " __SC "%0, %1 \n"
228 " .subsection 2 \n" 220 " .set mips0 \n"
229 "2: b 1b \n" 221 : "=&r" (temp), "+m" (*m)
230 " .previous \n" 222 : "ir" (1UL << bit));
231 " .set mips0 \n" 223 } while (unlikely(!temp));
232 : "=&r" (temp), "=m" (*m)
233 : "ir" (1UL << bit), "m" (*m));
234 } else { 224 } else {
235 volatile unsigned long *a = addr; 225 volatile unsigned long *a = addr;
236 unsigned long mask; 226 unsigned long mask;
@@ -272,30 +262,26 @@ static inline int test_and_set_bit(unsigned long nr,
272 " beqzl %2, 1b \n" 262 " beqzl %2, 1b \n"
273 " and %2, %0, %3 \n" 263 " and %2, %0, %3 \n"
274 " .set mips0 \n" 264 " .set mips0 \n"
275 : "=&r" (temp), "=m" (*m), "=&r" (res) 265 : "=&r" (temp), "+m" (*m), "=&r" (res)
276 : "r" (1UL << bit), "m" (*m) 266 : "r" (1UL << bit)
277 : "memory"); 267 : "memory");
278 } else if (kernel_uses_llsc) { 268 } else if (kernel_uses_llsc) {
279 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 269 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
280 unsigned long temp; 270 unsigned long temp;
281 271
282 __asm__ __volatile__( 272 do {
283 " .set push \n" 273 __asm__ __volatile__(
284 " .set noreorder \n" 274 " .set mips3 \n"
285 " .set mips3 \n" 275 " " __LL "%0, %1 # test_and_set_bit \n"
286 "1: " __LL "%0, %1 # test_and_set_bit \n" 276 " or %2, %0, %3 \n"
287 " or %2, %0, %3 \n" 277 " " __SC "%2, %1 \n"
288 " " __SC "%2, %1 \n" 278 " .set mips0 \n"
289 " beqz %2, 2f \n" 279 : "=&r" (temp), "+m" (*m), "=&r" (res)
290 " and %2, %0, %3 \n" 280 : "r" (1UL << bit)
291 " .subsection 2 \n" 281 : "memory");
292 "2: b 1b \n" 282 } while (unlikely(!res));
293 " nop \n" 283
294 " .previous \n" 284 res = temp & (1UL << bit);
295 " .set pop \n"
296 : "=&r" (temp), "=m" (*m), "=&r" (res)
297 : "r" (1UL << bit), "m" (*m)
298 : "memory");
299 } else { 285 } else {
300 volatile unsigned long *a = addr; 286 volatile unsigned long *a = addr;
301 unsigned long mask; 287 unsigned long mask;
@@ -340,30 +326,26 @@ static inline int test_and_set_bit_lock(unsigned long nr,
340 " beqzl %2, 1b \n" 326 " beqzl %2, 1b \n"
341 " and %2, %0, %3 \n" 327 " and %2, %0, %3 \n"
342 " .set mips0 \n" 328 " .set mips0 \n"
343 : "=&r" (temp), "=m" (*m), "=&r" (res) 329 : "=&r" (temp), "+m" (*m), "=&r" (res)
344 : "r" (1UL << bit), "m" (*m) 330 : "r" (1UL << bit)
345 : "memory"); 331 : "memory");
346 } else if (kernel_uses_llsc) { 332 } else if (kernel_uses_llsc) {
347 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 333 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
348 unsigned long temp; 334 unsigned long temp;
349 335
350 __asm__ __volatile__( 336 do {
351 " .set push \n" 337 __asm__ __volatile__(
352 " .set noreorder \n" 338 " .set mips3 \n"
353 " .set mips3 \n" 339 " " __LL "%0, %1 # test_and_set_bit \n"
354 "1: " __LL "%0, %1 # test_and_set_bit \n" 340 " or %2, %0, %3 \n"
355 " or %2, %0, %3 \n" 341 " " __SC "%2, %1 \n"
356 " " __SC "%2, %1 \n" 342 " .set mips0 \n"
357 " beqz %2, 2f \n" 343 : "=&r" (temp), "+m" (*m), "=&r" (res)
358 " and %2, %0, %3 \n" 344 : "r" (1UL << bit)
359 " .subsection 2 \n" 345 : "memory");
360 "2: b 1b \n" 346 } while (unlikely(!res));
361 " nop \n" 347
362 " .previous \n" 348 res = temp & (1UL << bit);
363 " .set pop \n"
364 : "=&r" (temp), "=m" (*m), "=&r" (res)
365 : "r" (1UL << bit), "m" (*m)
366 : "memory");
367 } else { 349 } else {
368 volatile unsigned long *a = addr; 350 volatile unsigned long *a = addr;
369 unsigned long mask; 351 unsigned long mask;
@@ -410,49 +392,43 @@ static inline int test_and_clear_bit(unsigned long nr,
410 " beqzl %2, 1b \n" 392 " beqzl %2, 1b \n"
411 " and %2, %0, %3 \n" 393 " and %2, %0, %3 \n"
412 " .set mips0 \n" 394 " .set mips0 \n"
413 : "=&r" (temp), "=m" (*m), "=&r" (res) 395 : "=&r" (temp), "+m" (*m), "=&r" (res)
414 : "r" (1UL << bit), "m" (*m) 396 : "r" (1UL << bit)
415 : "memory"); 397 : "memory");
416#ifdef CONFIG_CPU_MIPSR2 398#ifdef CONFIG_CPU_MIPSR2
417 } else if (kernel_uses_llsc && __builtin_constant_p(nr)) { 399 } else if (kernel_uses_llsc && __builtin_constant_p(nr)) {
418 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 400 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
419 unsigned long temp; 401 unsigned long temp;
420 402
421 __asm__ __volatile__( 403 do {
422 "1: " __LL "%0, %1 # test_and_clear_bit \n" 404 __asm__ __volatile__(
423 " " __EXT "%2, %0, %3, 1 \n" 405 " " __LL "%0, %1 # test_and_clear_bit \n"
424 " " __INS "%0, $0, %3, 1 \n" 406 " " __EXT "%2, %0, %3, 1 \n"
425 " " __SC "%0, %1 \n" 407 " " __INS "%0, $0, %3, 1 \n"
426 " beqz %0, 2f \n" 408 " " __SC "%0, %1 \n"
427 " .subsection 2 \n" 409 : "=&r" (temp), "+m" (*m), "=&r" (res)
428 "2: b 1b \n" 410 : "ir" (bit)
429 " .previous \n" 411 : "memory");
430 : "=&r" (temp), "=m" (*m), "=&r" (res) 412 } while (unlikely(!temp));
431 : "ir" (bit), "m" (*m)
432 : "memory");
433#endif 413#endif
434 } else if (kernel_uses_llsc) { 414 } else if (kernel_uses_llsc) {
435 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 415 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
436 unsigned long temp; 416 unsigned long temp;
437 417
438 __asm__ __volatile__( 418 do {
439 " .set push \n" 419 __asm__ __volatile__(
440 " .set noreorder \n" 420 " .set mips3 \n"
441 " .set mips3 \n" 421 " " __LL "%0, %1 # test_and_clear_bit \n"
442 "1: " __LL "%0, %1 # test_and_clear_bit \n" 422 " or %2, %0, %3 \n"
443 " or %2, %0, %3 \n" 423 " xor %2, %3 \n"
444 " xor %2, %3 \n" 424 " " __SC "%2, %1 \n"
445 " " __SC "%2, %1 \n" 425 " .set mips0 \n"
446 " beqz %2, 2f \n" 426 : "=&r" (temp), "+m" (*m), "=&r" (res)
447 " and %2, %0, %3 \n" 427 : "r" (1UL << bit)
448 " .subsection 2 \n" 428 : "memory");
449 "2: b 1b \n" 429 } while (unlikely(!res));
450 " nop \n" 430
451 " .previous \n" 431 res = temp & (1UL << bit);
452 " .set pop \n"
453 : "=&r" (temp), "=m" (*m), "=&r" (res)
454 : "r" (1UL << bit), "m" (*m)
455 : "memory");
456 } else { 432 } else {
457 volatile unsigned long *a = addr; 433 volatile unsigned long *a = addr;
458 unsigned long mask; 434 unsigned long mask;
@@ -499,30 +475,26 @@ static inline int test_and_change_bit(unsigned long nr,
499 " beqzl %2, 1b \n" 475 " beqzl %2, 1b \n"
500 " and %2, %0, %3 \n" 476 " and %2, %0, %3 \n"
501 " .set mips0 \n" 477 " .set mips0 \n"
502 : "=&r" (temp), "=m" (*m), "=&r" (res) 478 : "=&r" (temp), "+m" (*m), "=&r" (res)
503 : "r" (1UL << bit), "m" (*m) 479 : "r" (1UL << bit)
504 : "memory"); 480 : "memory");
505 } else if (kernel_uses_llsc) { 481 } else if (kernel_uses_llsc) {
506 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG); 482 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
507 unsigned long temp; 483 unsigned long temp;
508 484
509 __asm__ __volatile__( 485 do {
510 " .set push \n" 486 __asm__ __volatile__(
511 " .set noreorder \n" 487 " .set mips3 \n"
512 " .set mips3 \n" 488 " " __LL "%0, %1 # test_and_change_bit \n"
513 "1: " __LL "%0, %1 # test_and_change_bit \n" 489 " xor %2, %0, %3 \n"
514 " xor %2, %0, %3 \n" 490 " " __SC "\t%2, %1 \n"
515 " " __SC "\t%2, %1 \n" 491 " .set mips0 \n"
516 " beqz %2, 2f \n" 492 : "=&r" (temp), "+m" (*m), "=&r" (res)
517 " and %2, %0, %3 \n" 493 : "r" (1UL << bit)
518 " .subsection 2 \n" 494 : "memory");
519 "2: b 1b \n" 495 } while (unlikely(!res));
520 " nop \n" 496
521 " .previous \n" 497 res = temp & (1UL << bit);
522 " .set pop \n"
523 : "=&r" (temp), "=m" (*m), "=&r" (res)
524 : "r" (1UL << bit), "m" (*m)
525 : "memory");
526 } else { 498 } else {
527 volatile unsigned long *a = addr; 499 volatile unsigned long *a = addr;
528 unsigned long mask; 500 unsigned long mask;
diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index 15a8ef0707c6..35cd1bab69c3 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -125,4 +125,16 @@ extern unsigned long fw_arg0, fw_arg1, fw_arg2, fw_arg3;
125 */ 125 */
126extern void plat_mem_setup(void); 126extern void plat_mem_setup(void);
127 127
128#ifdef CONFIG_SWIOTLB
129/*
130 * Optional platform hook to call swiotlb_setup().
131 */
132extern void plat_swiotlb_setup(void);
133
134#else
135
136static inline void plat_swiotlb_setup(void) {}
137
138#endif /* CONFIG_SWIOTLB */
139
128#endif /* _ASM_BOOTINFO_H */ 140#endif /* _ASM_BOOTINFO_H */
diff --git a/arch/mips/include/asm/cmpxchg.h b/arch/mips/include/asm/cmpxchg.h
index 2d28017e95d0..d8d1c2805ac7 100644
--- a/arch/mips/include/asm/cmpxchg.h
+++ b/arch/mips/include/asm/cmpxchg.h
@@ -44,12 +44,9 @@
44 " move $1, %z4 \n" \ 44 " move $1, %z4 \n" \
45 " .set mips3 \n" \ 45 " .set mips3 \n" \
46 " " st " $1, %1 \n" \ 46 " " st " $1, %1 \n" \
47 " beqz $1, 3f \n" \ 47 " beqz $1, 1b \n" \
48 "2: \n" \
49 " .subsection 2 \n" \
50 "3: b 1b \n" \
51 " .previous \n" \
52 " .set pop \n" \ 48 " .set pop \n" \
49 "2: \n" \
53 : "=&r" (__ret), "=R" (*m) \ 50 : "=&r" (__ret), "=R" (*m) \
54 : "R" (*m), "Jr" (old), "Jr" (new) \ 51 : "R" (*m), "Jr" (old), "Jr" (new) \
55 : "memory"); \ 52 : "memory"); \
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index b201a8f5b127..06d59dcbe243 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -111,14 +111,16 @@
111 * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM 111 * These are the PRID's for when 23:16 == PRID_COMP_BROADCOM
112 */ 112 */
113 113
114#define PRID_IMP_BCM4710 0x4000 114#define PRID_IMP_BMIPS4KC 0x4000
115#define PRID_IMP_BCM3302 0x9000 115#define PRID_IMP_BMIPS32 0x8000
116#define PRID_IMP_BCM6338 0x9000 116#define PRID_IMP_BMIPS3300 0x9000
117#define PRID_IMP_BCM6345 0x8000 117#define PRID_IMP_BMIPS3300_ALT 0x9100
118#define PRID_IMP_BCM6348 0x9100 118#define PRID_IMP_BMIPS3300_BUG 0x0000
119#define PRID_IMP_BCM4350 0xA000 119#define PRID_IMP_BMIPS43XX 0xa000
120#define PRID_REV_BCM6358 0x0010 120#define PRID_IMP_BMIPS5000 0x5a00
121#define PRID_REV_BCM6368 0x0030 121
122#define PRID_REV_BMIPS4380_LO 0x0040
123#define PRID_REV_BMIPS4380_HI 0x006f
122 124
123/* 125/*
124 * These are the PRID's for when 23:16 == PRID_COMP_CAVIUM 126 * These are the PRID's for when 23:16 == PRID_COMP_CAVIUM
@@ -131,6 +133,7 @@
131#define PRID_IMP_CAVIUM_CN56XX 0x0400 133#define PRID_IMP_CAVIUM_CN56XX 0x0400
132#define PRID_IMP_CAVIUM_CN50XX 0x0600 134#define PRID_IMP_CAVIUM_CN50XX 0x0600
133#define PRID_IMP_CAVIUM_CN52XX 0x0700 135#define PRID_IMP_CAVIUM_CN52XX 0x0700
136#define PRID_IMP_CAVIUM_CN63XX 0x9000
134 137
135/* 138/*
136 * These are the PRID's for when 23:16 == PRID_COMP_INGENIC 139 * These are the PRID's for when 23:16 == PRID_COMP_INGENIC
@@ -223,15 +226,14 @@ enum cpu_type_enum {
223 * MIPS32 class processors 226 * MIPS32 class processors
224 */ 227 */
225 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, 228 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
226 CPU_ALCHEMY, CPU_PR4450, CPU_BCM3302, CPU_BCM4710, 229 CPU_ALCHEMY, CPU_PR4450, CPU_BMIPS32, CPU_BMIPS3300, CPU_BMIPS4350,
227 CPU_BCM6338, CPU_BCM6345, CPU_BCM6348, CPU_BCM6358, 230 CPU_BMIPS4380, CPU_BMIPS5000, CPU_JZRISC,
228 CPU_JZRISC,
229 231
230 /* 232 /*
231 * MIPS64 class processors 233 * MIPS64 class processors
232 */ 234 */
233 CPU_5KC, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2, 235 CPU_5KC, CPU_20KC, CPU_25KF, CPU_SB1, CPU_SB1A, CPU_LOONGSON2,
234 CPU_CAVIUM_OCTEON, CPU_CAVIUM_OCTEON_PLUS, 236 CPU_CAVIUM_OCTEON, CPU_CAVIUM_OCTEON_PLUS, CPU_CAVIUM_OCTEON2,
235 237
236 CPU_LAST 238 CPU_LAST
237}; 239};
diff --git a/arch/mips/include/asm/device.h b/arch/mips/include/asm/device.h
index 06746c5e8099..c94fafba9e62 100644
--- a/arch/mips/include/asm/device.h
+++ b/arch/mips/include/asm/device.h
@@ -3,4 +3,17 @@
3 * 3 *
4 * This file is released under the GPLv2 4 * This file is released under the GPLv2
5 */ 5 */
6#include <asm-generic/device.h> 6#ifndef _ASM_MIPS_DEVICE_H
7#define _ASM_MIPS_DEVICE_H
8
9struct dma_map_ops;
10
11struct dev_archdata {
12 /* DMA operations on that device */
13 struct dma_map_ops *dma_ops;
14};
15
16struct pdev_archdata {
17};
18
19#endif /* _ASM_MIPS_DEVICE_H*/
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h
index 18fbf7af8e93..655f849bd08d 100644
--- a/arch/mips/include/asm/dma-mapping.h
+++ b/arch/mips/include/asm/dma-mapping.h
@@ -5,51 +5,41 @@
5#include <asm/cache.h> 5#include <asm/cache.h>
6#include <asm-generic/dma-coherent.h> 6#include <asm-generic/dma-coherent.h>
7 7
8void *dma_alloc_noncoherent(struct device *dev, size_t size, 8#include <dma-coherence.h>
9 dma_addr_t *dma_handle, gfp_t flag);
10 9
11void dma_free_noncoherent(struct device *dev, size_t size, 10extern struct dma_map_ops *mips_dma_map_ops;
12 void *vaddr, dma_addr_t dma_handle);
13 11
14void *dma_alloc_coherent(struct device *dev, size_t size, 12static inline struct dma_map_ops *get_dma_ops(struct device *dev)
15 dma_addr_t *dma_handle, gfp_t flag); 13{
14 if (dev && dev->archdata.dma_ops)
15 return dev->archdata.dma_ops;
16 else
17 return mips_dma_map_ops;
18}
16 19
17void dma_free_coherent(struct device *dev, size_t size, 20static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
18 void *vaddr, dma_addr_t dma_handle); 21{
22 if (!dev->dma_mask)
23 return 0;
19 24
20extern dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, 25 return addr + size <= *dev->dma_mask;
21 enum dma_data_direction direction); 26}
22extern void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, 27
23 size_t size, enum dma_data_direction direction); 28static inline void dma_mark_clean(void *addr, size_t size) {}
24extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 29
25 enum dma_data_direction direction); 30#include <asm-generic/dma-mapping-common.h>
26extern dma_addr_t dma_map_page(struct device *dev, struct page *page, 31
27 unsigned long offset, size_t size, enum dma_data_direction direction); 32static inline int dma_supported(struct device *dev, u64 mask)
28
29static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
30 size_t size, enum dma_data_direction direction)
31{ 33{
32 dma_unmap_single(dev, dma_address, size, direction); 34 struct dma_map_ops *ops = get_dma_ops(dev);
35 return ops->dma_supported(dev, mask);
33} 36}
34 37
35extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 38static inline int dma_mapping_error(struct device *dev, u64 mask)
36 int nhwentries, enum dma_data_direction direction); 39{
37extern void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, 40 struct dma_map_ops *ops = get_dma_ops(dev);
38 size_t size, enum dma_data_direction direction); 41 return ops->mapping_error(dev, mask);
39extern void dma_sync_single_for_device(struct device *dev, 42}
40 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction);
41extern void dma_sync_single_range_for_cpu(struct device *dev,
42 dma_addr_t dma_handle, unsigned long offset, size_t size,
43 enum dma_data_direction direction);
44extern void dma_sync_single_range_for_device(struct device *dev,
45 dma_addr_t dma_handle, unsigned long offset, size_t size,
46 enum dma_data_direction direction);
47extern void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
48 int nelems, enum dma_data_direction direction);
49extern void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
50 int nelems, enum dma_data_direction direction);
51extern int dma_mapping_error(struct device *dev, dma_addr_t dma_addr);
52extern int dma_supported(struct device *dev, u64 mask);
53 43
54static inline int 44static inline int
55dma_set_mask(struct device *dev, u64 mask) 45dma_set_mask(struct device *dev, u64 mask)
@@ -65,4 +55,34 @@ dma_set_mask(struct device *dev, u64 mask)
65extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 55extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
66 enum dma_data_direction direction); 56 enum dma_data_direction direction);
67 57
58static inline void *dma_alloc_coherent(struct device *dev, size_t size,
59 dma_addr_t *dma_handle, gfp_t gfp)
60{
61 void *ret;
62 struct dma_map_ops *ops = get_dma_ops(dev);
63
64 ret = ops->alloc_coherent(dev, size, dma_handle, gfp);
65
66 debug_dma_alloc_coherent(dev, size, *dma_handle, ret);
67
68 return ret;
69}
70
71static inline void dma_free_coherent(struct device *dev, size_t size,
72 void *vaddr, dma_addr_t dma_handle)
73{
74 struct dma_map_ops *ops = get_dma_ops(dev);
75
76 ops->free_coherent(dev, size, vaddr, dma_handle);
77
78 debug_dma_free_coherent(dev, size, vaddr, dma_handle);
79}
80
81
82void *dma_alloc_noncoherent(struct device *dev, size_t size,
83 dma_addr_t *dma_handle, gfp_t flag);
84
85void dma_free_noncoherent(struct device *dev, size_t size,
86 void *vaddr, dma_addr_t dma_handle);
87
68#endif /* _ASM_DMA_MAPPING_H */ 88#endif /* _ASM_DMA_MAPPING_H */
diff --git a/arch/mips/include/asm/dma.h b/arch/mips/include/asm/dma.h
index 1353c81065d1..2d47da62d5a7 100644
--- a/arch/mips/include/asm/dma.h
+++ b/arch/mips/include/asm/dma.h
@@ -91,7 +91,10 @@
91#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000) 91#define MAX_DMA_ADDRESS (PAGE_OFFSET + 0x01000000)
92#endif 92#endif
93#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS)) 93#define MAX_DMA_PFN PFN_DOWN(virt_to_phys((void *)MAX_DMA_ADDRESS))
94
95#ifndef MAX_DMA32_PFN
94#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT)) 96#define MAX_DMA32_PFN (1UL << (32 - PAGE_SHIFT))
97#endif
95 98
96/* 8237 DMA controllers */ 99/* 8237 DMA controllers */
97#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */ 100#define IO_DMA1_BASE 0x00 /* 8 bit slave DMA, channels 0..3 */
diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
index bdcdef02d147..fffc8307a80a 100644
--- a/arch/mips/include/asm/local.h
+++ b/arch/mips/include/asm/local.h
@@ -117,7 +117,7 @@ static __inline__ long local_sub_return(long i, local_t * l)
117 117
118#define local_cmpxchg(l, o, n) \ 118#define local_cmpxchg(l, o, n) \
119 ((long)cmpxchg_local(&((l)->a.counter), (o), (n))) 119 ((long)cmpxchg_local(&((l)->a.counter), (o), (n)))
120#define local_xchg(l, n) (xchg_local(&((l)->a.counter), (n))) 120#define local_xchg(l, n) (atomic_long_xchg((&(l)->a), (n)))
121 121
122/** 122/**
123 * local_add_unless - add unless the number is a given value 123 * local_add_unless - add unless the number is a given value
diff --git a/arch/mips/include/asm/mach-ar7/ar7.h b/arch/mips/include/asm/mach-ar7/ar7.h
index 483ffea9ecb1..7919d76186bf 100644
--- a/arch/mips/include/asm/mach-ar7/ar7.h
+++ b/arch/mips/include/asm/mach-ar7/ar7.h
@@ -39,6 +39,7 @@
39#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00) 39#define AR7_REGS_UART0 (AR7_REGS_BASE + 0x0e00)
40#define AR7_REGS_USB (AR7_REGS_BASE + 0x1200) 40#define AR7_REGS_USB (AR7_REGS_BASE + 0x1200)
41#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600) 41#define AR7_REGS_RESET (AR7_REGS_BASE + 0x1600)
42#define AR7_REGS_PINSEL (AR7_REGS_BASE + 0x160C)
42#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800) 43#define AR7_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1800)
43#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00) 44#define AR7_REGS_DCL (AR7_REGS_BASE + 0x1a00)
44#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00) 45#define AR7_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1c00)
@@ -50,6 +51,14 @@
50#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00) 51#define UR8_REGS_WDT (AR7_REGS_BASE + 0x0b00)
51#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00) 52#define UR8_REGS_UART1 (AR7_REGS_BASE + 0x0f00)
52 53
54/* Titan registers */
55#define TITAN_REGS_ESWITCH_BASE (0x08640000)
56#define TITAN_REGS_MAC0 (TITAN_REGS_ESWITCH_BASE)
57#define TITAN_REGS_MAC1 (TITAN_REGS_ESWITCH_BASE + 0x0800)
58#define TITAN_REGS_MDIO (TITAN_REGS_ESWITCH_BASE + 0x02000)
59#define TITAN_REGS_VLYNQ0 (AR7_REGS_BASE + 0x1c00)
60#define TITAN_REGS_VLYNQ1 (AR7_REGS_BASE + 0x1300)
61
53#define AR7_RESET_PERIPHERAL 0x0 62#define AR7_RESET_PERIPHERAL 0x0
54#define AR7_RESET_SOFTWARE 0x4 63#define AR7_RESET_SOFTWARE 0x4
55#define AR7_RESET_STATUS 0x8 64#define AR7_RESET_STATUS 0x8
@@ -59,15 +68,30 @@
59#define AR7_RESET_BIT_MDIO 22 68#define AR7_RESET_BIT_MDIO 22
60#define AR7_RESET_BIT_EPHY 26 69#define AR7_RESET_BIT_EPHY 26
61 70
71#define TITAN_RESET_BIT_EPHY1 28
72
62/* GPIO control registers */ 73/* GPIO control registers */
63#define AR7_GPIO_INPUT 0x0 74#define AR7_GPIO_INPUT 0x0
64#define AR7_GPIO_OUTPUT 0x4 75#define AR7_GPIO_OUTPUT 0x4
65#define AR7_GPIO_DIR 0x8 76#define AR7_GPIO_DIR 0x8
66#define AR7_GPIO_ENABLE 0xc 77#define AR7_GPIO_ENABLE 0xc
78#define TITAN_GPIO_INPUT_0 0x0
79#define TITAN_GPIO_INPUT_1 0x4
80#define TITAN_GPIO_OUTPUT_0 0x8
81#define TITAN_GPIO_OUTPUT_1 0xc
82#define TITAN_GPIO_DIR_0 0x10
83#define TITAN_GPIO_DIR_1 0x14
84#define TITAN_GPIO_ENBL_0 0x18
85#define TITAN_GPIO_ENBL_1 0x1c
67 86
68#define AR7_CHIP_7100 0x18 87#define AR7_CHIP_7100 0x18
69#define AR7_CHIP_7200 0x2b 88#define AR7_CHIP_7200 0x2b
70#define AR7_CHIP_7300 0x05 89#define AR7_CHIP_7300 0x05
90#define AR7_CHIP_TITAN 0x07
91#define TITAN_CHIP_1050 0x0f
92#define TITAN_CHIP_1055 0x0e
93#define TITAN_CHIP_1056 0x0d
94#define TITAN_CHIP_1060 0x07
71 95
72/* Interrupts */ 96/* Interrupts */
73#define AR7_IRQ_UART0 15 97#define AR7_IRQ_UART0 15
@@ -95,14 +119,29 @@ struct plat_dsl_data {
95 119
96extern int ar7_cpu_clock, ar7_bus_clock, ar7_dsp_clock; 120extern int ar7_cpu_clock, ar7_bus_clock, ar7_dsp_clock;
97 121
122static inline int ar7_is_titan(void)
123{
124 return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x24)) & 0xffff) ==
125 AR7_CHIP_TITAN;
126}
127
98static inline u16 ar7_chip_id(void) 128static inline u16 ar7_chip_id(void)
99{ 129{
100 return readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x14)) & 0xffff; 130 return ar7_is_titan() ? AR7_CHIP_TITAN : (readl((void *)
131 KSEG1ADDR(AR7_REGS_GPIO + 0x14)) & 0xffff);
132}
133
134static inline u16 titan_chip_id(void)
135{
136 unsigned int val = readl((void *)KSEG1ADDR(AR7_REGS_GPIO +
137 TITAN_GPIO_INPUT_1));
138 return ((val >> 12) & 0x0f);
101} 139}
102 140
103static inline u8 ar7_chip_rev(void) 141static inline u8 ar7_chip_rev(void)
104{ 142{
105 return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + 0x14)) >> 16) & 0xff; 143 return (readl((void *)KSEG1ADDR(AR7_REGS_GPIO + (ar7_is_titan() ? 0x24 :
144 0x14))) >> 16) & 0xff;
106} 145}
107 146
108struct clk { 147struct clk {
@@ -161,4 +200,8 @@ static inline void ar7_device_off(u32 bit)
161 msleep(20); 200 msleep(20);
162} 201}
163 202
203int __init ar7_gpio_init(void);
204
205int __init ar7_gpio_init(void);
206
164#endif /* __AR7_H__ */ 207#endif /* __AR7_H__ */
diff --git a/arch/mips/include/asm/mach-ar7/gpio.h b/arch/mips/include/asm/mach-ar7/gpio.h
index abc317c0372e..c177cd1eed25 100644
--- a/arch/mips/include/asm/mach-ar7/gpio.h
+++ b/arch/mips/include/asm/mach-ar7/gpio.h
@@ -22,7 +22,8 @@
22#include <asm/mach-ar7/ar7.h> 22#include <asm/mach-ar7/ar7.h>
23 23
24#define AR7_GPIO_MAX 32 24#define AR7_GPIO_MAX 32
25#define NR_BUILTIN_GPIO AR7_GPIO_MAX 25#define TITAN_GPIO_MAX 51
26#define NR_BUILTIN_GPIO TITAN_GPIO_MAX
26 27
27#define gpio_to_irq(gpio) -1 28#define gpio_to_irq(gpio) -1
28 29
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h b/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
new file mode 100644
index 000000000000..5325084d5c48
--- /dev/null
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm963xx_tag.h
@@ -0,0 +1,97 @@
1#ifndef __BCM963XX_TAG_H
2#define __BCM963XX_TAG_H
3
4#define TAGVER_LEN 4 /* Length of Tag Version */
5#define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */
6#define SIG1_LEN 20 /* Company Signature 1 Length */
7#define SIG2_LEN 14 /* Company Signature 2 Lenght */
8#define BOARDID_LEN 16 /* Length of BoardId */
9#define ENDIANFLAG_LEN 2 /* Endian Flag Length */
10#define CHIPID_LEN 6 /* Chip Id Length */
11#define IMAGE_LEN 10 /* Length of Length Field */
12#define ADDRESS_LEN 12 /* Length of Address field */
13#define DUALFLAG_LEN 2 /* Dual Image flag Length */
14#define INACTIVEFLAG_LEN 2 /* Inactie Flag Length */
15#define RSASIG_LEN 20 /* Length of RSA Signature in tag */
16#define TAGINFO1_LEN 30 /* Length of vendor information field1 in tag */
17#define FLASHLAYOUTVER_LEN 4 /* Length of Flash Layout Version String tag */
18#define TAGINFO2_LEN 16 /* Length of vendor information field2 in tag */
19#define CRC_LEN 4 /* Length of CRC in bytes */
20#define ALTTAGINFO_LEN 54 /* Alternate length for vendor information; Pirelli */
21
22#define NUM_PIRELLI 2
23#define IMAGETAG_CRC_START 0xFFFFFFFF
24
25#define PIRELLI_BOARDS { \
26 "AGPF-S0", \
27 "DWV-S0", \
28}
29
30/*
31 * The broadcom firmware assumes the rootfs starts the image,
32 * therefore uses the rootfs start (flash_image_address)
33 * to determine where to flash the image. Since we have the kernel first
34 * we have to give it the kernel address, but the crc uses the length
35 * associated with this address (root_length), which is added to the kernel
36 * length (kernel_length) to determine the length of image to flash and thus
37 * needs to be rootfs + deadcode (jffs2 EOF marker)
38*/
39
40struct bcm_tag {
41 /* 0-3: Version of the image tag */
42 char tag_version[TAGVER_LEN];
43 /* 4-23: Company Line 1 */
44 char sig_1[SIG1_LEN];
45 /* 24-37: Company Line 2 */
46 char sig_2[SIG2_LEN];
47 /* 38-43: Chip this image is for */
48 char chip_id[CHIPID_LEN];
49 /* 44-59: Board name */
50 char board_id[BOARDID_LEN];
51 /* 60-61: Map endianness -- 1 BE 0 LE */
52 char big_endian[ENDIANFLAG_LEN];
53 /* 62-71: Total length of image */
54 char total_length[IMAGE_LEN];
55 /* 72-83: Address in memory of CFE */
56 char cfe__address[ADDRESS_LEN];
57 /* 84-93: Size of CFE */
58 char cfe_length[IMAGE_LEN];
59 /* 94-105: Address in memory of image start
60 * (kernel for OpenWRT, rootfs for stock firmware)
61 */
62 char flash_image_start[ADDRESS_LEN];
63 /* 106-115: Size of rootfs */
64 char root_length[IMAGE_LEN];
65 /* 116-127: Address in memory of kernel */
66 char kernel_address[ADDRESS_LEN];
67 /* 128-137: Size of kernel */
68 char kernel_length[IMAGE_LEN];
69 /* 138-139: Unused at the moment */
70 char dual_image[DUALFLAG_LEN];
71 /* 140-141: Unused at the moment */
72 char inactive_flag[INACTIVEFLAG_LEN];
73 /* 142-161: RSA Signature (not used; some vendors may use this) */
74 char rsa_signature[RSASIG_LEN];
75 /* 162-191: Compilation and related information (not used in OpenWrt) */
76 char information1[TAGINFO1_LEN];
77 /* 192-195: Version flash layout */
78 char flash_layout_ver[FLASHLAYOUTVER_LEN];
79 /* 196-199: kernel+rootfs CRC32 */
80 char fskernel_crc[CRC_LEN];
81 /* 200-215: Unused except on Alice Gate where is is information */
82 char information2[TAGINFO2_LEN];
83 /* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */
84 char image_crc[CRC_LEN];
85 /* 220-223: CRC32 of rootfs partition */
86 char rootfs_crc[CRC_LEN];
87 /* 224-227: CRC32 of kernel partition */
88 char kernel_crc[CRC_LEN];
89 /* 228-235: Unused at present */
90 char reserved1[8];
91 /* 236-239: CRC32 of header excluding tagVersion */
92 char header_crc[CRC_LEN];
93 /* 240-255: Unused at present */
94 char reserved2[16];
95};
96
97#endif /* __BCM63XX_TAG_H */
diff --git a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
index b952fc7215e2..0d5a42b5f47a 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h
@@ -59,7 +59,7 @@
59#define cpu_has_veic 0 59#define cpu_has_veic 0
60#define cpu_hwrena_impl_bits 0xc0000000 60#define cpu_hwrena_impl_bits 0xc0000000
61 61
62#define kernel_uses_smartmips_rixi (cpu_data[0].cputype == CPU_CAVIUM_OCTEON_PLUS) 62#define kernel_uses_smartmips_rixi (cpu_data[0].cputype != CPU_CAVIUM_OCTEON)
63 63
64#define ARCH_HAS_IRQ_PER_CPU 1 64#define ARCH_HAS_IRQ_PER_CPU 1
65#define ARCH_HAS_SPINLOCK_PREFETCH 1 65#define ARCH_HAS_SPINLOCK_PREFETCH 1
@@ -81,4 +81,10 @@ static inline int octeon_has_saa(void)
81 return id >= 0x000d0300; 81 return id >= 0x000d0300;
82} 82}
83 83
84/*
85 * The last 256MB are reserved for device to device mappings and the
86 * BAR1 hole.
87 */
88#define MAX_DMA32_PFN (((1ULL << 32) - (1ULL << 28)) >> PAGE_SHIFT)
89
84#endif 90#endif
diff --git a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
index 17d579471ec4..be8fb4240cec 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/dma-coherence.h
@@ -15,41 +15,40 @@
15 15
16struct device; 16struct device;
17 17
18dma_addr_t octeon_map_dma_mem(struct device *, void *, size_t); 18extern void octeon_pci_dma_init(void);
19void octeon_unmap_dma_mem(struct device *, dma_addr_t);
20 19
21static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, 20static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
22 size_t size) 21 size_t size)
23{ 22{
24 return octeon_map_dma_mem(dev, addr, size); 23 BUG();
25} 24}
26 25
27static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, 26static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
28 struct page *page) 27 struct page *page)
29{ 28{
30 return octeon_map_dma_mem(dev, page_address(page), PAGE_SIZE); 29 BUG();
31} 30}
32 31
33static inline unsigned long plat_dma_addr_to_phys(struct device *dev, 32static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
34 dma_addr_t dma_addr) 33 dma_addr_t dma_addr)
35{ 34{
36 return dma_addr; 35 BUG();
37} 36}
38 37
39static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, 38static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
40 size_t size, enum dma_data_direction direction) 39 size_t size, enum dma_data_direction direction)
41{ 40{
42 octeon_unmap_dma_mem(dev, dma_addr); 41 BUG();
43} 42}
44 43
45static inline int plat_dma_supported(struct device *dev, u64 mask) 44static inline int plat_dma_supported(struct device *dev, u64 mask)
46{ 45{
47 return 1; 46 BUG();
48} 47}
49 48
50static inline void plat_extra_sync_for_device(struct device *dev) 49static inline void plat_extra_sync_for_device(struct device *dev)
51{ 50{
52 mb(); 51 BUG();
53} 52}
54 53
55static inline int plat_device_is_coherent(struct device *dev) 54static inline int plat_device_is_coherent(struct device *dev)
@@ -60,7 +59,14 @@ static inline int plat_device_is_coherent(struct device *dev)
60static inline int plat_dma_mapping_error(struct device *dev, 59static inline int plat_dma_mapping_error(struct device *dev,
61 dma_addr_t dma_addr) 60 dma_addr_t dma_addr)
62{ 61{
63 return dma_addr == -1; 62 BUG();
64} 63}
65 64
65dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr);
66phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr);
67
68struct dma_map_ops;
69extern struct dma_map_ops *octeon_pci_dma_map_ops;
70extern char *octeon_swiotlb;
71
66#endif /* __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H */ 72#endif /* __ASM_MACH_CAVIUM_OCTEON_DMA_COHERENCE_H */
diff --git a/arch/mips/include/asm/mach-ip27/dma-coherence.h b/arch/mips/include/asm/mach-ip27/dma-coherence.h
index d3d04018a858..016d0989b141 100644
--- a/arch/mips/include/asm/mach-ip27/dma-coherence.h
+++ b/arch/mips/include/asm/mach-ip27/dma-coherence.h
@@ -26,14 +26,15 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
26 return pa; 26 return pa;
27} 27}
28 28
29static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) 29static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
30 struct page *page)
30{ 31{
31 dma_addr_t pa = dev_to_baddr(dev, page_to_phys(page)); 32 dma_addr_t pa = dev_to_baddr(dev, page_to_phys(page));
32 33
33 return pa; 34 return pa;
34} 35}
35 36
36static unsigned long plat_dma_addr_to_phys(struct device *dev, 37static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
37 dma_addr_t dma_addr) 38 dma_addr_t dma_addr)
38{ 39{
39 return dma_addr & ~(0xffUL << 56); 40 return dma_addr & ~(0xffUL << 56);
diff --git a/arch/mips/include/asm/mach-ip32/dma-coherence.h b/arch/mips/include/asm/mach-ip32/dma-coherence.h
index 37855955b313..c8fb5aacf50a 100644
--- a/arch/mips/include/asm/mach-ip32/dma-coherence.h
+++ b/arch/mips/include/asm/mach-ip32/dma-coherence.h
@@ -37,7 +37,8 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
37 return pa; 37 return pa;
38} 38}
39 39
40static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) 40static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
41 struct page *page)
41{ 42{
42 dma_addr_t pa; 43 dma_addr_t pa;
43 44
@@ -50,7 +51,7 @@ static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
50} 51}
51 52
52/* This is almost certainly wrong but it's what dma-ip32.c used to use */ 53/* This is almost certainly wrong but it's what dma-ip32.c used to use */
53static unsigned long plat_dma_addr_to_phys(struct device *dev, 54static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
54 dma_addr_t dma_addr) 55 dma_addr_t dma_addr)
55{ 56{
56 unsigned long addr = dma_addr & RAM_OFFSET_MASK; 57 unsigned long addr = dma_addr & RAM_OFFSET_MASK;
diff --git a/arch/mips/include/asm/mach-jazz/dma-coherence.h b/arch/mips/include/asm/mach-jazz/dma-coherence.h
index f93aee59454a..302101b54acb 100644
--- a/arch/mips/include/asm/mach-jazz/dma-coherence.h
+++ b/arch/mips/include/asm/mach-jazz/dma-coherence.h
@@ -12,23 +12,24 @@
12 12
13struct device; 13struct device;
14 14
15static dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size) 15static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size)
16{ 16{
17 return vdma_alloc(virt_to_phys(addr), size); 17 return vdma_alloc(virt_to_phys(addr), size);
18} 18}
19 19
20static dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page) 20static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
21 struct page *page)
21{ 22{
22 return vdma_alloc(page_to_phys(page), PAGE_SIZE); 23 return vdma_alloc(page_to_phys(page), PAGE_SIZE);
23} 24}
24 25
25static unsigned long plat_dma_addr_to_phys(struct device *dev, 26static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
26 dma_addr_t dma_addr) 27 dma_addr_t dma_addr)
27{ 28{
28 return vdma_log2phys(dma_addr); 29 return vdma_log2phys(dma_addr);
29} 30}
30 31
31static void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, 32static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
32 size_t size, enum dma_data_direction direction) 33 size_t size, enum dma_data_direction direction)
33{ 34{
34 vdma_free(dma_addr); 35 vdma_free(dma_addr);
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 335474c155f6..4d9870975382 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -1040,6 +1040,12 @@ do { \
1040#define read_c0_dtaglo() __read_32bit_c0_register($28, 2) 1040#define read_c0_dtaglo() __read_32bit_c0_register($28, 2)
1041#define write_c0_dtaglo(val) __write_32bit_c0_register($28, 2, val) 1041#define write_c0_dtaglo(val) __write_32bit_c0_register($28, 2, val)
1042 1042
1043#define read_c0_ddatalo() __read_32bit_c0_register($28, 3)
1044#define write_c0_ddatalo(val) __write_32bit_c0_register($28, 3, val)
1045
1046#define read_c0_staglo() __read_32bit_c0_register($28, 4)
1047#define write_c0_staglo(val) __write_32bit_c0_register($28, 4, val)
1048
1043#define read_c0_taghi() __read_32bit_c0_register($29, 0) 1049#define read_c0_taghi() __read_32bit_c0_register($29, 0)
1044#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val) 1050#define write_c0_taghi(val) __write_32bit_c0_register($29, 0, val)
1045 1051
@@ -1082,6 +1088,51 @@ do { \
1082#define read_octeon_c0_dcacheerr() __read_64bit_c0_register($27, 1) 1088#define read_octeon_c0_dcacheerr() __read_64bit_c0_register($27, 1)
1083#define write_octeon_c0_dcacheerr(val) __write_64bit_c0_register($27, 1, val) 1089#define write_octeon_c0_dcacheerr(val) __write_64bit_c0_register($27, 1, val)
1084 1090
1091/* BMIPS3300 */
1092#define read_c0_brcm_config_0() __read_32bit_c0_register($22, 0)
1093#define write_c0_brcm_config_0(val) __write_32bit_c0_register($22, 0, val)
1094
1095#define read_c0_brcm_bus_pll() __read_32bit_c0_register($22, 4)
1096#define write_c0_brcm_bus_pll(val) __write_32bit_c0_register($22, 4, val)
1097
1098#define read_c0_brcm_reset() __read_32bit_c0_register($22, 5)
1099#define write_c0_brcm_reset(val) __write_32bit_c0_register($22, 5, val)
1100
1101/* BMIPS4380 */
1102#define read_c0_brcm_cmt_intr() __read_32bit_c0_register($22, 1)
1103#define write_c0_brcm_cmt_intr(val) __write_32bit_c0_register($22, 1, val)
1104
1105#define read_c0_brcm_cmt_ctrl() __read_32bit_c0_register($22, 2)
1106#define write_c0_brcm_cmt_ctrl(val) __write_32bit_c0_register($22, 2, val)
1107
1108#define read_c0_brcm_cmt_local() __read_32bit_c0_register($22, 3)
1109#define write_c0_brcm_cmt_local(val) __write_32bit_c0_register($22, 3, val)
1110
1111#define read_c0_brcm_config_1() __read_32bit_c0_register($22, 5)
1112#define write_c0_brcm_config_1(val) __write_32bit_c0_register($22, 5, val)
1113
1114#define read_c0_brcm_cbr() __read_32bit_c0_register($22, 6)
1115#define write_c0_brcm_cbr(val) __write_32bit_c0_register($22, 6, val)
1116
1117/* BMIPS5000 */
1118#define read_c0_brcm_config() __read_32bit_c0_register($22, 0)
1119#define write_c0_brcm_config(val) __write_32bit_c0_register($22, 0, val)
1120
1121#define read_c0_brcm_mode() __read_32bit_c0_register($22, 1)
1122#define write_c0_brcm_mode(val) __write_32bit_c0_register($22, 1, val)
1123
1124#define read_c0_brcm_action() __read_32bit_c0_register($22, 2)
1125#define write_c0_brcm_action(val) __write_32bit_c0_register($22, 2, val)
1126
1127#define read_c0_brcm_edsp() __read_32bit_c0_register($22, 3)
1128#define write_c0_brcm_edsp(val) __write_32bit_c0_register($22, 3, val)
1129
1130#define read_c0_brcm_bootvec() __read_32bit_c0_register($22, 4)
1131#define write_c0_brcm_bootvec(val) __write_32bit_c0_register($22, 4, val)
1132
1133#define read_c0_brcm_sleepcount() __read_32bit_c0_register($22, 7)
1134#define write_c0_brcm_sleepcount(val) __write_32bit_c0_register($22, 7, val)
1135
1085/* 1136/*
1086 * Macros to access the floating point coprocessor control registers 1137 * Macros to access the floating point coprocessor control registers
1087 */ 1138 */
diff --git a/arch/mips/include/asm/octeon/cvmx-agl-defs.h b/arch/mips/include/asm/octeon/cvmx-agl-defs.h
index ec94b9ab7be1..30d68f2365e0 100644
--- a/arch/mips/include/asm/octeon/cvmx-agl-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-agl-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,148 +28,80 @@
28#ifndef __CVMX_AGL_DEFS_H__ 28#ifndef __CVMX_AGL_DEFS_H__
29#define __CVMX_AGL_DEFS_H__ 29#define __CVMX_AGL_DEFS_H__
30 30
31#define CVMX_AGL_GMX_BAD_REG \ 31#define CVMX_AGL_GMX_BAD_REG (CVMX_ADD_IO_SEG(0x00011800E0000518ull))
32 CVMX_ADD_IO_SEG(0x00011800E0000518ull) 32#define CVMX_AGL_GMX_BIST (CVMX_ADD_IO_SEG(0x00011800E0000400ull))
33#define CVMX_AGL_GMX_BIST \ 33#define CVMX_AGL_GMX_DRV_CTL (CVMX_ADD_IO_SEG(0x00011800E00007F0ull))
34 CVMX_ADD_IO_SEG(0x00011800E0000400ull) 34#define CVMX_AGL_GMX_INF_MODE (CVMX_ADD_IO_SEG(0x00011800E00007F8ull))
35#define CVMX_AGL_GMX_DRV_CTL \ 35#define CVMX_AGL_GMX_PRTX_CFG(offset) (CVMX_ADD_IO_SEG(0x00011800E0000010ull) + ((offset) & 1) * 2048)
36 CVMX_ADD_IO_SEG(0x00011800E00007F0ull) 36#define CVMX_AGL_GMX_RXX_ADR_CAM0(offset) (CVMX_ADD_IO_SEG(0x00011800E0000180ull) + ((offset) & 1) * 2048)
37#define CVMX_AGL_GMX_INF_MODE \ 37#define CVMX_AGL_GMX_RXX_ADR_CAM1(offset) (CVMX_ADD_IO_SEG(0x00011800E0000188ull) + ((offset) & 1) * 2048)
38 CVMX_ADD_IO_SEG(0x00011800E00007F8ull) 38#define CVMX_AGL_GMX_RXX_ADR_CAM2(offset) (CVMX_ADD_IO_SEG(0x00011800E0000190ull) + ((offset) & 1) * 2048)
39#define CVMX_AGL_GMX_PRTX_CFG(offset) \ 39#define CVMX_AGL_GMX_RXX_ADR_CAM3(offset) (CVMX_ADD_IO_SEG(0x00011800E0000198ull) + ((offset) & 1) * 2048)
40 CVMX_ADD_IO_SEG(0x00011800E0000010ull + (((offset) & 1) * 2048)) 40#define CVMX_AGL_GMX_RXX_ADR_CAM4(offset) (CVMX_ADD_IO_SEG(0x00011800E00001A0ull) + ((offset) & 1) * 2048)
41#define CVMX_AGL_GMX_RXX_ADR_CAM0(offset) \ 41#define CVMX_AGL_GMX_RXX_ADR_CAM5(offset) (CVMX_ADD_IO_SEG(0x00011800E00001A8ull) + ((offset) & 1) * 2048)
42 CVMX_ADD_IO_SEG(0x00011800E0000180ull + (((offset) & 1) * 2048)) 42#define CVMX_AGL_GMX_RXX_ADR_CAM_EN(offset) (CVMX_ADD_IO_SEG(0x00011800E0000108ull) + ((offset) & 1) * 2048)
43#define CVMX_AGL_GMX_RXX_ADR_CAM1(offset) \ 43#define CVMX_AGL_GMX_RXX_ADR_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000100ull) + ((offset) & 1) * 2048)
44 CVMX_ADD_IO_SEG(0x00011800E0000188ull + (((offset) & 1) * 2048)) 44#define CVMX_AGL_GMX_RXX_DECISION(offset) (CVMX_ADD_IO_SEG(0x00011800E0000040ull) + ((offset) & 1) * 2048)
45#define CVMX_AGL_GMX_RXX_ADR_CAM2(offset) \ 45#define CVMX_AGL_GMX_RXX_FRM_CHK(offset) (CVMX_ADD_IO_SEG(0x00011800E0000020ull) + ((offset) & 1) * 2048)
46 CVMX_ADD_IO_SEG(0x00011800E0000190ull + (((offset) & 1) * 2048)) 46#define CVMX_AGL_GMX_RXX_FRM_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000018ull) + ((offset) & 1) * 2048)
47#define CVMX_AGL_GMX_RXX_ADR_CAM3(offset) \ 47#define CVMX_AGL_GMX_RXX_FRM_MAX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000030ull) + ((offset) & 1) * 2048)
48 CVMX_ADD_IO_SEG(0x00011800E0000198ull + (((offset) & 1) * 2048)) 48#define CVMX_AGL_GMX_RXX_FRM_MIN(offset) (CVMX_ADD_IO_SEG(0x00011800E0000028ull) + ((offset) & 1) * 2048)
49#define CVMX_AGL_GMX_RXX_ADR_CAM4(offset) \ 49#define CVMX_AGL_GMX_RXX_IFG(offset) (CVMX_ADD_IO_SEG(0x00011800E0000058ull) + ((offset) & 1) * 2048)
50 CVMX_ADD_IO_SEG(0x00011800E00001A0ull + (((offset) & 1) * 2048)) 50#define CVMX_AGL_GMX_RXX_INT_EN(offset) (CVMX_ADD_IO_SEG(0x00011800E0000008ull) + ((offset) & 1) * 2048)
51#define CVMX_AGL_GMX_RXX_ADR_CAM5(offset) \ 51#define CVMX_AGL_GMX_RXX_INT_REG(offset) (CVMX_ADD_IO_SEG(0x00011800E0000000ull) + ((offset) & 1) * 2048)
52 CVMX_ADD_IO_SEG(0x00011800E00001A8ull + (((offset) & 1) * 2048)) 52#define CVMX_AGL_GMX_RXX_JABBER(offset) (CVMX_ADD_IO_SEG(0x00011800E0000038ull) + ((offset) & 1) * 2048)
53#define CVMX_AGL_GMX_RXX_ADR_CAM_EN(offset) \ 53#define CVMX_AGL_GMX_RXX_PAUSE_DROP_TIME(offset) (CVMX_ADD_IO_SEG(0x00011800E0000068ull) + ((offset) & 1) * 2048)
54 CVMX_ADD_IO_SEG(0x00011800E0000108ull + (((offset) & 1) * 2048)) 54#define CVMX_AGL_GMX_RXX_RX_INBND(offset) (CVMX_ADD_IO_SEG(0x00011800E0000060ull) + ((offset) & 1) * 2048)
55#define CVMX_AGL_GMX_RXX_ADR_CTL(offset) \ 55#define CVMX_AGL_GMX_RXX_STATS_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000050ull) + ((offset) & 1) * 2048)
56 CVMX_ADD_IO_SEG(0x00011800E0000100ull + (((offset) & 1) * 2048)) 56#define CVMX_AGL_GMX_RXX_STATS_OCTS(offset) (CVMX_ADD_IO_SEG(0x00011800E0000088ull) + ((offset) & 1) * 2048)
57#define CVMX_AGL_GMX_RXX_DECISION(offset) \ 57#define CVMX_AGL_GMX_RXX_STATS_OCTS_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000098ull) + ((offset) & 1) * 2048)
58 CVMX_ADD_IO_SEG(0x00011800E0000040ull + (((offset) & 1) * 2048)) 58#define CVMX_AGL_GMX_RXX_STATS_OCTS_DMAC(offset) (CVMX_ADD_IO_SEG(0x00011800E00000A8ull) + ((offset) & 1) * 2048)
59#define CVMX_AGL_GMX_RXX_FRM_CHK(offset) \ 59#define CVMX_AGL_GMX_RXX_STATS_OCTS_DRP(offset) (CVMX_ADD_IO_SEG(0x00011800E00000B8ull) + ((offset) & 1) * 2048)
60 CVMX_ADD_IO_SEG(0x00011800E0000020ull + (((offset) & 1) * 2048)) 60#define CVMX_AGL_GMX_RXX_STATS_PKTS(offset) (CVMX_ADD_IO_SEG(0x00011800E0000080ull) + ((offset) & 1) * 2048)
61#define CVMX_AGL_GMX_RXX_FRM_CTL(offset) \ 61#define CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(offset) (CVMX_ADD_IO_SEG(0x00011800E00000C0ull) + ((offset) & 1) * 2048)
62 CVMX_ADD_IO_SEG(0x00011800E0000018ull + (((offset) & 1) * 2048)) 62#define CVMX_AGL_GMX_RXX_STATS_PKTS_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000090ull) + ((offset) & 1) * 2048)
63#define CVMX_AGL_GMX_RXX_FRM_MAX(offset) \ 63#define CVMX_AGL_GMX_RXX_STATS_PKTS_DMAC(offset) (CVMX_ADD_IO_SEG(0x00011800E00000A0ull) + ((offset) & 1) * 2048)
64 CVMX_ADD_IO_SEG(0x00011800E0000030ull + (((offset) & 1) * 2048)) 64#define CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(offset) (CVMX_ADD_IO_SEG(0x00011800E00000B0ull) + ((offset) & 1) * 2048)
65#define CVMX_AGL_GMX_RXX_FRM_MIN(offset) \ 65#define CVMX_AGL_GMX_RXX_UDD_SKP(offset) (CVMX_ADD_IO_SEG(0x00011800E0000048ull) + ((offset) & 1) * 2048)
66 CVMX_ADD_IO_SEG(0x00011800E0000028ull + (((offset) & 1) * 2048)) 66#define CVMX_AGL_GMX_RX_BP_DROPX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000420ull) + ((offset) & 1) * 8)
67#define CVMX_AGL_GMX_RXX_IFG(offset) \ 67#define CVMX_AGL_GMX_RX_BP_OFFX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000460ull) + ((offset) & 1) * 8)
68 CVMX_ADD_IO_SEG(0x00011800E0000058ull + (((offset) & 1) * 2048)) 68#define CVMX_AGL_GMX_RX_BP_ONX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000440ull) + ((offset) & 1) * 8)
69#define CVMX_AGL_GMX_RXX_INT_EN(offset) \ 69#define CVMX_AGL_GMX_RX_PRT_INFO (CVMX_ADD_IO_SEG(0x00011800E00004E8ull))
70 CVMX_ADD_IO_SEG(0x00011800E0000008ull + (((offset) & 1) * 2048)) 70#define CVMX_AGL_GMX_RX_TX_STATUS (CVMX_ADD_IO_SEG(0x00011800E00007E8ull))
71#define CVMX_AGL_GMX_RXX_INT_REG(offset) \ 71#define CVMX_AGL_GMX_SMACX(offset) (CVMX_ADD_IO_SEG(0x00011800E0000230ull) + ((offset) & 1) * 2048)
72 CVMX_ADD_IO_SEG(0x00011800E0000000ull + (((offset) & 1) * 2048)) 72#define CVMX_AGL_GMX_STAT_BP (CVMX_ADD_IO_SEG(0x00011800E0000520ull))
73#define CVMX_AGL_GMX_RXX_JABBER(offset) \ 73#define CVMX_AGL_GMX_TXX_APPEND(offset) (CVMX_ADD_IO_SEG(0x00011800E0000218ull) + ((offset) & 1) * 2048)
74 CVMX_ADD_IO_SEG(0x00011800E0000038ull + (((offset) & 1) * 2048)) 74#define CVMX_AGL_GMX_TXX_CLK(offset) (CVMX_ADD_IO_SEG(0x00011800E0000208ull) + ((offset) & 1) * 2048)
75#define CVMX_AGL_GMX_RXX_PAUSE_DROP_TIME(offset) \ 75#define CVMX_AGL_GMX_TXX_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000270ull) + ((offset) & 1) * 2048)
76 CVMX_ADD_IO_SEG(0x00011800E0000068ull + (((offset) & 1) * 2048)) 76#define CVMX_AGL_GMX_TXX_MIN_PKT(offset) (CVMX_ADD_IO_SEG(0x00011800E0000240ull) + ((offset) & 1) * 2048)
77#define CVMX_AGL_GMX_RXX_STATS_CTL(offset) \ 77#define CVMX_AGL_GMX_TXX_PAUSE_PKT_INTERVAL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000248ull) + ((offset) & 1) * 2048)
78 CVMX_ADD_IO_SEG(0x00011800E0000050ull + (((offset) & 1) * 2048)) 78#define CVMX_AGL_GMX_TXX_PAUSE_PKT_TIME(offset) (CVMX_ADD_IO_SEG(0x00011800E0000238ull) + ((offset) & 1) * 2048)
79#define CVMX_AGL_GMX_RXX_STATS_OCTS(offset) \ 79#define CVMX_AGL_GMX_TXX_PAUSE_TOGO(offset) (CVMX_ADD_IO_SEG(0x00011800E0000258ull) + ((offset) & 1) * 2048)
80 CVMX_ADD_IO_SEG(0x00011800E0000088ull + (((offset) & 1) * 2048)) 80#define CVMX_AGL_GMX_TXX_PAUSE_ZERO(offset) (CVMX_ADD_IO_SEG(0x00011800E0000260ull) + ((offset) & 1) * 2048)
81#define CVMX_AGL_GMX_RXX_STATS_OCTS_CTL(offset) \ 81#define CVMX_AGL_GMX_TXX_SOFT_PAUSE(offset) (CVMX_ADD_IO_SEG(0x00011800E0000250ull) + ((offset) & 1) * 2048)
82 CVMX_ADD_IO_SEG(0x00011800E0000098ull + (((offset) & 1) * 2048)) 82#define CVMX_AGL_GMX_TXX_STAT0(offset) (CVMX_ADD_IO_SEG(0x00011800E0000280ull) + ((offset) & 1) * 2048)
83#define CVMX_AGL_GMX_RXX_STATS_OCTS_DMAC(offset) \ 83#define CVMX_AGL_GMX_TXX_STAT1(offset) (CVMX_ADD_IO_SEG(0x00011800E0000288ull) + ((offset) & 1) * 2048)
84 CVMX_ADD_IO_SEG(0x00011800E00000A8ull + (((offset) & 1) * 2048)) 84#define CVMX_AGL_GMX_TXX_STAT2(offset) (CVMX_ADD_IO_SEG(0x00011800E0000290ull) + ((offset) & 1) * 2048)
85#define CVMX_AGL_GMX_RXX_STATS_OCTS_DRP(offset) \ 85#define CVMX_AGL_GMX_TXX_STAT3(offset) (CVMX_ADD_IO_SEG(0x00011800E0000298ull) + ((offset) & 1) * 2048)
86 CVMX_ADD_IO_SEG(0x00011800E00000B8ull + (((offset) & 1) * 2048)) 86#define CVMX_AGL_GMX_TXX_STAT4(offset) (CVMX_ADD_IO_SEG(0x00011800E00002A0ull) + ((offset) & 1) * 2048)
87#define CVMX_AGL_GMX_RXX_STATS_PKTS(offset) \ 87#define CVMX_AGL_GMX_TXX_STAT5(offset) (CVMX_ADD_IO_SEG(0x00011800E00002A8ull) + ((offset) & 1) * 2048)
88 CVMX_ADD_IO_SEG(0x00011800E0000080ull + (((offset) & 1) * 2048)) 88#define CVMX_AGL_GMX_TXX_STAT6(offset) (CVMX_ADD_IO_SEG(0x00011800E00002B0ull) + ((offset) & 1) * 2048)
89#define CVMX_AGL_GMX_RXX_STATS_PKTS_BAD(offset) \ 89#define CVMX_AGL_GMX_TXX_STAT7(offset) (CVMX_ADD_IO_SEG(0x00011800E00002B8ull) + ((offset) & 1) * 2048)
90 CVMX_ADD_IO_SEG(0x00011800E00000C0ull + (((offset) & 1) * 2048)) 90#define CVMX_AGL_GMX_TXX_STAT8(offset) (CVMX_ADD_IO_SEG(0x00011800E00002C0ull) + ((offset) & 1) * 2048)
91#define CVMX_AGL_GMX_RXX_STATS_PKTS_CTL(offset) \ 91#define CVMX_AGL_GMX_TXX_STAT9(offset) (CVMX_ADD_IO_SEG(0x00011800E00002C8ull) + ((offset) & 1) * 2048)
92 CVMX_ADD_IO_SEG(0x00011800E0000090ull + (((offset) & 1) * 2048)) 92#define CVMX_AGL_GMX_TXX_STATS_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0000268ull) + ((offset) & 1) * 2048)
93#define CVMX_AGL_GMX_RXX_STATS_PKTS_DMAC(offset) \ 93#define CVMX_AGL_GMX_TXX_THRESH(offset) (CVMX_ADD_IO_SEG(0x00011800E0000210ull) + ((offset) & 1) * 2048)
94 CVMX_ADD_IO_SEG(0x00011800E00000A0ull + (((offset) & 1) * 2048)) 94#define CVMX_AGL_GMX_TX_BP (CVMX_ADD_IO_SEG(0x00011800E00004D0ull))
95#define CVMX_AGL_GMX_RXX_STATS_PKTS_DRP(offset) \ 95#define CVMX_AGL_GMX_TX_COL_ATTEMPT (CVMX_ADD_IO_SEG(0x00011800E0000498ull))
96 CVMX_ADD_IO_SEG(0x00011800E00000B0ull + (((offset) & 1) * 2048)) 96#define CVMX_AGL_GMX_TX_IFG (CVMX_ADD_IO_SEG(0x00011800E0000488ull))
97#define CVMX_AGL_GMX_RXX_UDD_SKP(offset) \ 97#define CVMX_AGL_GMX_TX_INT_EN (CVMX_ADD_IO_SEG(0x00011800E0000508ull))
98 CVMX_ADD_IO_SEG(0x00011800E0000048ull + (((offset) & 1) * 2048)) 98#define CVMX_AGL_GMX_TX_INT_REG (CVMX_ADD_IO_SEG(0x00011800E0000500ull))
99#define CVMX_AGL_GMX_RX_BP_DROPX(offset) \ 99#define CVMX_AGL_GMX_TX_JAM (CVMX_ADD_IO_SEG(0x00011800E0000490ull))
100 CVMX_ADD_IO_SEG(0x00011800E0000420ull + (((offset) & 1) * 8)) 100#define CVMX_AGL_GMX_TX_LFSR (CVMX_ADD_IO_SEG(0x00011800E00004F8ull))
101#define CVMX_AGL_GMX_RX_BP_OFFX(offset) \ 101#define CVMX_AGL_GMX_TX_OVR_BP (CVMX_ADD_IO_SEG(0x00011800E00004C8ull))
102 CVMX_ADD_IO_SEG(0x00011800E0000460ull + (((offset) & 1) * 8)) 102#define CVMX_AGL_GMX_TX_PAUSE_PKT_DMAC (CVMX_ADD_IO_SEG(0x00011800E00004A0ull))
103#define CVMX_AGL_GMX_RX_BP_ONX(offset) \ 103#define CVMX_AGL_GMX_TX_PAUSE_PKT_TYPE (CVMX_ADD_IO_SEG(0x00011800E00004A8ull))
104 CVMX_ADD_IO_SEG(0x00011800E0000440ull + (((offset) & 1) * 8)) 104#define CVMX_AGL_PRTX_CTL(offset) (CVMX_ADD_IO_SEG(0x00011800E0002000ull) + ((offset) & 1) * 8)
105#define CVMX_AGL_GMX_RX_PRT_INFO \
106 CVMX_ADD_IO_SEG(0x00011800E00004E8ull)
107#define CVMX_AGL_GMX_RX_TX_STATUS \
108 CVMX_ADD_IO_SEG(0x00011800E00007E8ull)
109#define CVMX_AGL_GMX_SMACX(offset) \
110 CVMX_ADD_IO_SEG(0x00011800E0000230ull + (((offset) & 1) * 2048))
111#define CVMX_AGL_GMX_STAT_BP \
112 CVMX_ADD_IO_SEG(0x00011800E0000520ull)
113#define CVMX_AGL_GMX_TXX_APPEND(offset) \
114 CVMX_ADD_IO_SEG(0x00011800E0000218ull + (((offset) & 1) * 2048))
115#define CVMX_AGL_GMX_TXX_CTL(offset) \
116 CVMX_ADD_IO_SEG(0x00011800E0000270ull + (((offset) & 1) * 2048))
117#define CVMX_AGL_GMX_TXX_MIN_PKT(offset) \
118 CVMX_ADD_IO_SEG(0x00011800E0000240ull + (((offset) & 1) * 2048))
119#define CVMX_AGL_GMX_TXX_PAUSE_PKT_INTERVAL(offset) \
120 CVMX_ADD_IO_SEG(0x00011800E0000248ull + (((offset) & 1) * 2048))
121#define CVMX_AGL_GMX_TXX_PAUSE_PKT_TIME(offset) \
122 CVMX_ADD_IO_SEG(0x00011800E0000238ull + (((offset) & 1) * 2048))
123#define CVMX_AGL_GMX_TXX_PAUSE_TOGO(offset) \
124 CVMX_ADD_IO_SEG(0x00011800E0000258ull + (((offset) & 1) * 2048))
125#define CVMX_AGL_GMX_TXX_PAUSE_ZERO(offset) \
126 CVMX_ADD_IO_SEG(0x00011800E0000260ull + (((offset) & 1) * 2048))
127#define CVMX_AGL_GMX_TXX_SOFT_PAUSE(offset) \
128 CVMX_ADD_IO_SEG(0x00011800E0000250ull + (((offset) & 1) * 2048))
129#define CVMX_AGL_GMX_TXX_STAT0(offset) \
130 CVMX_ADD_IO_SEG(0x00011800E0000280ull + (((offset) & 1) * 2048))
131#define CVMX_AGL_GMX_TXX_STAT1(offset) \
132 CVMX_ADD_IO_SEG(0x00011800E0000288ull + (((offset) & 1) * 2048))
133#define CVMX_AGL_GMX_TXX_STAT2(offset) \
134 CVMX_ADD_IO_SEG(0x00011800E0000290ull + (((offset) & 1) * 2048))
135#define CVMX_AGL_GMX_TXX_STAT3(offset) \
136 CVMX_ADD_IO_SEG(0x00011800E0000298ull + (((offset) & 1) * 2048))
137#define CVMX_AGL_GMX_TXX_STAT4(offset) \
138 CVMX_ADD_IO_SEG(0x00011800E00002A0ull + (((offset) & 1) * 2048))
139#define CVMX_AGL_GMX_TXX_STAT5(offset) \
140 CVMX_ADD_IO_SEG(0x00011800E00002A8ull + (((offset) & 1) * 2048))
141#define CVMX_AGL_GMX_TXX_STAT6(offset) \
142 CVMX_ADD_IO_SEG(0x00011800E00002B0ull + (((offset) & 1) * 2048))
143#define CVMX_AGL_GMX_TXX_STAT7(offset) \
144 CVMX_ADD_IO_SEG(0x00011800E00002B8ull + (((offset) & 1) * 2048))
145#define CVMX_AGL_GMX_TXX_STAT8(offset) \
146 CVMX_ADD_IO_SEG(0x00011800E00002C0ull + (((offset) & 1) * 2048))
147#define CVMX_AGL_GMX_TXX_STAT9(offset) \
148 CVMX_ADD_IO_SEG(0x00011800E00002C8ull + (((offset) & 1) * 2048))
149#define CVMX_AGL_GMX_TXX_STATS_CTL(offset) \
150 CVMX_ADD_IO_SEG(0x00011800E0000268ull + (((offset) & 1) * 2048))
151#define CVMX_AGL_GMX_TXX_THRESH(offset) \
152 CVMX_ADD_IO_SEG(0x00011800E0000210ull + (((offset) & 1) * 2048))
153#define CVMX_AGL_GMX_TX_BP \
154 CVMX_ADD_IO_SEG(0x00011800E00004D0ull)
155#define CVMX_AGL_GMX_TX_COL_ATTEMPT \
156 CVMX_ADD_IO_SEG(0x00011800E0000498ull)
157#define CVMX_AGL_GMX_TX_IFG \
158 CVMX_ADD_IO_SEG(0x00011800E0000488ull)
159#define CVMX_AGL_GMX_TX_INT_EN \
160 CVMX_ADD_IO_SEG(0x00011800E0000508ull)
161#define CVMX_AGL_GMX_TX_INT_REG \
162 CVMX_ADD_IO_SEG(0x00011800E0000500ull)
163#define CVMX_AGL_GMX_TX_JAM \
164 CVMX_ADD_IO_SEG(0x00011800E0000490ull)
165#define CVMX_AGL_GMX_TX_LFSR \
166 CVMX_ADD_IO_SEG(0x00011800E00004F8ull)
167#define CVMX_AGL_GMX_TX_OVR_BP \
168 CVMX_ADD_IO_SEG(0x00011800E00004C8ull)
169#define CVMX_AGL_GMX_TX_PAUSE_PKT_DMAC \
170 CVMX_ADD_IO_SEG(0x00011800E00004A0ull)
171#define CVMX_AGL_GMX_TX_PAUSE_PKT_TYPE \
172 CVMX_ADD_IO_SEG(0x00011800E00004A8ull)
173 105
174union cvmx_agl_gmx_bad_reg { 106union cvmx_agl_gmx_bad_reg {
175 uint64_t u64; 107 uint64_t u64;
@@ -183,14 +115,29 @@ union cvmx_agl_gmx_bad_reg {
183 uint64_t ovrflw:1; 115 uint64_t ovrflw:1;
184 uint64_t reserved_27_31:5; 116 uint64_t reserved_27_31:5;
185 uint64_t statovr:1; 117 uint64_t statovr:1;
118 uint64_t reserved_24_25:2;
119 uint64_t loststat:2;
120 uint64_t reserved_4_21:18;
121 uint64_t out_ovr:2;
122 uint64_t reserved_0_1:2;
123 } s;
124 struct cvmx_agl_gmx_bad_reg_cn52xx {
125 uint64_t reserved_38_63:26;
126 uint64_t txpsh1:1;
127 uint64_t txpop1:1;
128 uint64_t ovrflw1:1;
129 uint64_t txpsh:1;
130 uint64_t txpop:1;
131 uint64_t ovrflw:1;
132 uint64_t reserved_27_31:5;
133 uint64_t statovr:1;
186 uint64_t reserved_23_25:3; 134 uint64_t reserved_23_25:3;
187 uint64_t loststat:1; 135 uint64_t loststat:1;
188 uint64_t reserved_4_21:18; 136 uint64_t reserved_4_21:18;
189 uint64_t out_ovr:2; 137 uint64_t out_ovr:2;
190 uint64_t reserved_0_1:2; 138 uint64_t reserved_0_1:2;
191 } s; 139 } cn52xx;
192 struct cvmx_agl_gmx_bad_reg_s cn52xx; 140 struct cvmx_agl_gmx_bad_reg_cn52xx cn52xxp1;
193 struct cvmx_agl_gmx_bad_reg_s cn52xxp1;
194 struct cvmx_agl_gmx_bad_reg_cn56xx { 141 struct cvmx_agl_gmx_bad_reg_cn56xx {
195 uint64_t reserved_35_63:29; 142 uint64_t reserved_35_63:29;
196 uint64_t txpsh:1; 143 uint64_t txpsh:1;
@@ -205,18 +152,25 @@ union cvmx_agl_gmx_bad_reg {
205 uint64_t reserved_0_1:2; 152 uint64_t reserved_0_1:2;
206 } cn56xx; 153 } cn56xx;
207 struct cvmx_agl_gmx_bad_reg_cn56xx cn56xxp1; 154 struct cvmx_agl_gmx_bad_reg_cn56xx cn56xxp1;
155 struct cvmx_agl_gmx_bad_reg_s cn63xx;
156 struct cvmx_agl_gmx_bad_reg_s cn63xxp1;
208}; 157};
209 158
210union cvmx_agl_gmx_bist { 159union cvmx_agl_gmx_bist {
211 uint64_t u64; 160 uint64_t u64;
212 struct cvmx_agl_gmx_bist_s { 161 struct cvmx_agl_gmx_bist_s {
162 uint64_t reserved_25_63:39;
163 uint64_t status:25;
164 } s;
165 struct cvmx_agl_gmx_bist_cn52xx {
213 uint64_t reserved_10_63:54; 166 uint64_t reserved_10_63:54;
214 uint64_t status:10; 167 uint64_t status:10;
215 } s; 168 } cn52xx;
216 struct cvmx_agl_gmx_bist_s cn52xx; 169 struct cvmx_agl_gmx_bist_cn52xx cn52xxp1;
217 struct cvmx_agl_gmx_bist_s cn52xxp1; 170 struct cvmx_agl_gmx_bist_cn52xx cn56xx;
218 struct cvmx_agl_gmx_bist_s cn56xx; 171 struct cvmx_agl_gmx_bist_cn52xx cn56xxp1;
219 struct cvmx_agl_gmx_bist_s cn56xxp1; 172 struct cvmx_agl_gmx_bist_s cn63xx;
173 struct cvmx_agl_gmx_bist_s cn63xxp1;
220}; 174};
221 175
222union cvmx_agl_gmx_drv_ctl { 176union cvmx_agl_gmx_drv_ctl {
@@ -264,7 +218,13 @@ union cvmx_agl_gmx_inf_mode {
264union cvmx_agl_gmx_prtx_cfg { 218union cvmx_agl_gmx_prtx_cfg {
265 uint64_t u64; 219 uint64_t u64;
266 struct cvmx_agl_gmx_prtx_cfg_s { 220 struct cvmx_agl_gmx_prtx_cfg_s {
267 uint64_t reserved_6_63:58; 221 uint64_t reserved_14_63:50;
222 uint64_t tx_idle:1;
223 uint64_t rx_idle:1;
224 uint64_t reserved_9_11:3;
225 uint64_t speed_msb:1;
226 uint64_t reserved_7_7:1;
227 uint64_t burst:1;
268 uint64_t tx_en:1; 228 uint64_t tx_en:1;
269 uint64_t rx_en:1; 229 uint64_t rx_en:1;
270 uint64_t slottime:1; 230 uint64_t slottime:1;
@@ -272,10 +232,20 @@ union cvmx_agl_gmx_prtx_cfg {
272 uint64_t speed:1; 232 uint64_t speed:1;
273 uint64_t en:1; 233 uint64_t en:1;
274 } s; 234 } s;
275 struct cvmx_agl_gmx_prtx_cfg_s cn52xx; 235 struct cvmx_agl_gmx_prtx_cfg_cn52xx {
276 struct cvmx_agl_gmx_prtx_cfg_s cn52xxp1; 236 uint64_t reserved_6_63:58;
277 struct cvmx_agl_gmx_prtx_cfg_s cn56xx; 237 uint64_t tx_en:1;
278 struct cvmx_agl_gmx_prtx_cfg_s cn56xxp1; 238 uint64_t rx_en:1;
239 uint64_t slottime:1;
240 uint64_t duplex:1;
241 uint64_t speed:1;
242 uint64_t en:1;
243 } cn52xx;
244 struct cvmx_agl_gmx_prtx_cfg_cn52xx cn52xxp1;
245 struct cvmx_agl_gmx_prtx_cfg_cn52xx cn56xx;
246 struct cvmx_agl_gmx_prtx_cfg_cn52xx cn56xxp1;
247 struct cvmx_agl_gmx_prtx_cfg_s cn63xx;
248 struct cvmx_agl_gmx_prtx_cfg_s cn63xxp1;
279}; 249};
280 250
281union cvmx_agl_gmx_rxx_adr_cam0 { 251union cvmx_agl_gmx_rxx_adr_cam0 {
@@ -287,6 +257,8 @@ union cvmx_agl_gmx_rxx_adr_cam0 {
287 struct cvmx_agl_gmx_rxx_adr_cam0_s cn52xxp1; 257 struct cvmx_agl_gmx_rxx_adr_cam0_s cn52xxp1;
288 struct cvmx_agl_gmx_rxx_adr_cam0_s cn56xx; 258 struct cvmx_agl_gmx_rxx_adr_cam0_s cn56xx;
289 struct cvmx_agl_gmx_rxx_adr_cam0_s cn56xxp1; 259 struct cvmx_agl_gmx_rxx_adr_cam0_s cn56xxp1;
260 struct cvmx_agl_gmx_rxx_adr_cam0_s cn63xx;
261 struct cvmx_agl_gmx_rxx_adr_cam0_s cn63xxp1;
290}; 262};
291 263
292union cvmx_agl_gmx_rxx_adr_cam1 { 264union cvmx_agl_gmx_rxx_adr_cam1 {
@@ -298,6 +270,8 @@ union cvmx_agl_gmx_rxx_adr_cam1 {
298 struct cvmx_agl_gmx_rxx_adr_cam1_s cn52xxp1; 270 struct cvmx_agl_gmx_rxx_adr_cam1_s cn52xxp1;
299 struct cvmx_agl_gmx_rxx_adr_cam1_s cn56xx; 271 struct cvmx_agl_gmx_rxx_adr_cam1_s cn56xx;
300 struct cvmx_agl_gmx_rxx_adr_cam1_s cn56xxp1; 272 struct cvmx_agl_gmx_rxx_adr_cam1_s cn56xxp1;
273 struct cvmx_agl_gmx_rxx_adr_cam1_s cn63xx;
274 struct cvmx_agl_gmx_rxx_adr_cam1_s cn63xxp1;
301}; 275};
302 276
303union cvmx_agl_gmx_rxx_adr_cam2 { 277union cvmx_agl_gmx_rxx_adr_cam2 {
@@ -309,6 +283,8 @@ union cvmx_agl_gmx_rxx_adr_cam2 {
309 struct cvmx_agl_gmx_rxx_adr_cam2_s cn52xxp1; 283 struct cvmx_agl_gmx_rxx_adr_cam2_s cn52xxp1;
310 struct cvmx_agl_gmx_rxx_adr_cam2_s cn56xx; 284 struct cvmx_agl_gmx_rxx_adr_cam2_s cn56xx;
311 struct cvmx_agl_gmx_rxx_adr_cam2_s cn56xxp1; 285 struct cvmx_agl_gmx_rxx_adr_cam2_s cn56xxp1;
286 struct cvmx_agl_gmx_rxx_adr_cam2_s cn63xx;
287 struct cvmx_agl_gmx_rxx_adr_cam2_s cn63xxp1;
312}; 288};
313 289
314union cvmx_agl_gmx_rxx_adr_cam3 { 290union cvmx_agl_gmx_rxx_adr_cam3 {
@@ -320,6 +296,8 @@ union cvmx_agl_gmx_rxx_adr_cam3 {
320 struct cvmx_agl_gmx_rxx_adr_cam3_s cn52xxp1; 296 struct cvmx_agl_gmx_rxx_adr_cam3_s cn52xxp1;
321 struct cvmx_agl_gmx_rxx_adr_cam3_s cn56xx; 297 struct cvmx_agl_gmx_rxx_adr_cam3_s cn56xx;
322 struct cvmx_agl_gmx_rxx_adr_cam3_s cn56xxp1; 298 struct cvmx_agl_gmx_rxx_adr_cam3_s cn56xxp1;
299 struct cvmx_agl_gmx_rxx_adr_cam3_s cn63xx;
300 struct cvmx_agl_gmx_rxx_adr_cam3_s cn63xxp1;
323}; 301};
324 302
325union cvmx_agl_gmx_rxx_adr_cam4 { 303union cvmx_agl_gmx_rxx_adr_cam4 {
@@ -331,6 +309,8 @@ union cvmx_agl_gmx_rxx_adr_cam4 {
331 struct cvmx_agl_gmx_rxx_adr_cam4_s cn52xxp1; 309 struct cvmx_agl_gmx_rxx_adr_cam4_s cn52xxp1;
332 struct cvmx_agl_gmx_rxx_adr_cam4_s cn56xx; 310 struct cvmx_agl_gmx_rxx_adr_cam4_s cn56xx;
333 struct cvmx_agl_gmx_rxx_adr_cam4_s cn56xxp1; 311 struct cvmx_agl_gmx_rxx_adr_cam4_s cn56xxp1;
312 struct cvmx_agl_gmx_rxx_adr_cam4_s cn63xx;
313 struct cvmx_agl_gmx_rxx_adr_cam4_s cn63xxp1;
334}; 314};
335 315
336union cvmx_agl_gmx_rxx_adr_cam5 { 316union cvmx_agl_gmx_rxx_adr_cam5 {
@@ -342,6 +322,8 @@ union cvmx_agl_gmx_rxx_adr_cam5 {
342 struct cvmx_agl_gmx_rxx_adr_cam5_s cn52xxp1; 322 struct cvmx_agl_gmx_rxx_adr_cam5_s cn52xxp1;
343 struct cvmx_agl_gmx_rxx_adr_cam5_s cn56xx; 323 struct cvmx_agl_gmx_rxx_adr_cam5_s cn56xx;
344 struct cvmx_agl_gmx_rxx_adr_cam5_s cn56xxp1; 324 struct cvmx_agl_gmx_rxx_adr_cam5_s cn56xxp1;
325 struct cvmx_agl_gmx_rxx_adr_cam5_s cn63xx;
326 struct cvmx_agl_gmx_rxx_adr_cam5_s cn63xxp1;
345}; 327};
346 328
347union cvmx_agl_gmx_rxx_adr_cam_en { 329union cvmx_agl_gmx_rxx_adr_cam_en {
@@ -354,6 +336,8 @@ union cvmx_agl_gmx_rxx_adr_cam_en {
354 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn52xxp1; 336 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn52xxp1;
355 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn56xx; 337 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn56xx;
356 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn56xxp1; 338 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn56xxp1;
339 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn63xx;
340 struct cvmx_agl_gmx_rxx_adr_cam_en_s cn63xxp1;
357}; 341};
358 342
359union cvmx_agl_gmx_rxx_adr_ctl { 343union cvmx_agl_gmx_rxx_adr_ctl {
@@ -368,6 +352,8 @@ union cvmx_agl_gmx_rxx_adr_ctl {
368 struct cvmx_agl_gmx_rxx_adr_ctl_s cn52xxp1; 352 struct cvmx_agl_gmx_rxx_adr_ctl_s cn52xxp1;
369 struct cvmx_agl_gmx_rxx_adr_ctl_s cn56xx; 353 struct cvmx_agl_gmx_rxx_adr_ctl_s cn56xx;
370 struct cvmx_agl_gmx_rxx_adr_ctl_s cn56xxp1; 354 struct cvmx_agl_gmx_rxx_adr_ctl_s cn56xxp1;
355 struct cvmx_agl_gmx_rxx_adr_ctl_s cn63xx;
356 struct cvmx_agl_gmx_rxx_adr_ctl_s cn63xxp1;
371}; 357};
372 358
373union cvmx_agl_gmx_rxx_decision { 359union cvmx_agl_gmx_rxx_decision {
@@ -380,11 +366,26 @@ union cvmx_agl_gmx_rxx_decision {
380 struct cvmx_agl_gmx_rxx_decision_s cn52xxp1; 366 struct cvmx_agl_gmx_rxx_decision_s cn52xxp1;
381 struct cvmx_agl_gmx_rxx_decision_s cn56xx; 367 struct cvmx_agl_gmx_rxx_decision_s cn56xx;
382 struct cvmx_agl_gmx_rxx_decision_s cn56xxp1; 368 struct cvmx_agl_gmx_rxx_decision_s cn56xxp1;
369 struct cvmx_agl_gmx_rxx_decision_s cn63xx;
370 struct cvmx_agl_gmx_rxx_decision_s cn63xxp1;
383}; 371};
384 372
385union cvmx_agl_gmx_rxx_frm_chk { 373union cvmx_agl_gmx_rxx_frm_chk {
386 uint64_t u64; 374 uint64_t u64;
387 struct cvmx_agl_gmx_rxx_frm_chk_s { 375 struct cvmx_agl_gmx_rxx_frm_chk_s {
376 uint64_t reserved_10_63:54;
377 uint64_t niberr:1;
378 uint64_t skperr:1;
379 uint64_t rcverr:1;
380 uint64_t lenerr:1;
381 uint64_t alnerr:1;
382 uint64_t fcserr:1;
383 uint64_t jabber:1;
384 uint64_t maxerr:1;
385 uint64_t carext:1;
386 uint64_t minerr:1;
387 } s;
388 struct cvmx_agl_gmx_rxx_frm_chk_cn52xx {
388 uint64_t reserved_9_63:55; 389 uint64_t reserved_9_63:55;
389 uint64_t skperr:1; 390 uint64_t skperr:1;
390 uint64_t rcverr:1; 391 uint64_t rcverr:1;
@@ -395,17 +396,21 @@ union cvmx_agl_gmx_rxx_frm_chk {
395 uint64_t maxerr:1; 396 uint64_t maxerr:1;
396 uint64_t reserved_1_1:1; 397 uint64_t reserved_1_1:1;
397 uint64_t minerr:1; 398 uint64_t minerr:1;
398 } s; 399 } cn52xx;
399 struct cvmx_agl_gmx_rxx_frm_chk_s cn52xx; 400 struct cvmx_agl_gmx_rxx_frm_chk_cn52xx cn52xxp1;
400 struct cvmx_agl_gmx_rxx_frm_chk_s cn52xxp1; 401 struct cvmx_agl_gmx_rxx_frm_chk_cn52xx cn56xx;
401 struct cvmx_agl_gmx_rxx_frm_chk_s cn56xx; 402 struct cvmx_agl_gmx_rxx_frm_chk_cn52xx cn56xxp1;
402 struct cvmx_agl_gmx_rxx_frm_chk_s cn56xxp1; 403 struct cvmx_agl_gmx_rxx_frm_chk_s cn63xx;
404 struct cvmx_agl_gmx_rxx_frm_chk_s cn63xxp1;
403}; 405};
404 406
405union cvmx_agl_gmx_rxx_frm_ctl { 407union cvmx_agl_gmx_rxx_frm_ctl {
406 uint64_t u64; 408 uint64_t u64;
407 struct cvmx_agl_gmx_rxx_frm_ctl_s { 409 struct cvmx_agl_gmx_rxx_frm_ctl_s {
408 uint64_t reserved_10_63:54; 410 uint64_t reserved_13_63:51;
411 uint64_t ptp_mode:1;
412 uint64_t reserved_11_11:1;
413 uint64_t null_dis:1;
409 uint64_t pre_align:1; 414 uint64_t pre_align:1;
410 uint64_t pad_len:1; 415 uint64_t pad_len:1;
411 uint64_t vlan_len:1; 416 uint64_t vlan_len:1;
@@ -417,10 +422,24 @@ union cvmx_agl_gmx_rxx_frm_ctl {
417 uint64_t pre_strp:1; 422 uint64_t pre_strp:1;
418 uint64_t pre_chk:1; 423 uint64_t pre_chk:1;
419 } s; 424 } s;
420 struct cvmx_agl_gmx_rxx_frm_ctl_s cn52xx; 425 struct cvmx_agl_gmx_rxx_frm_ctl_cn52xx {
421 struct cvmx_agl_gmx_rxx_frm_ctl_s cn52xxp1; 426 uint64_t reserved_10_63:54;
422 struct cvmx_agl_gmx_rxx_frm_ctl_s cn56xx; 427 uint64_t pre_align:1;
423 struct cvmx_agl_gmx_rxx_frm_ctl_s cn56xxp1; 428 uint64_t pad_len:1;
429 uint64_t vlan_len:1;
430 uint64_t pre_free:1;
431 uint64_t ctl_smac:1;
432 uint64_t ctl_mcst:1;
433 uint64_t ctl_bck:1;
434 uint64_t ctl_drp:1;
435 uint64_t pre_strp:1;
436 uint64_t pre_chk:1;
437 } cn52xx;
438 struct cvmx_agl_gmx_rxx_frm_ctl_cn52xx cn52xxp1;
439 struct cvmx_agl_gmx_rxx_frm_ctl_cn52xx cn56xx;
440 struct cvmx_agl_gmx_rxx_frm_ctl_cn52xx cn56xxp1;
441 struct cvmx_agl_gmx_rxx_frm_ctl_s cn63xx;
442 struct cvmx_agl_gmx_rxx_frm_ctl_s cn63xxp1;
424}; 443};
425 444
426union cvmx_agl_gmx_rxx_frm_max { 445union cvmx_agl_gmx_rxx_frm_max {
@@ -433,6 +452,8 @@ union cvmx_agl_gmx_rxx_frm_max {
433 struct cvmx_agl_gmx_rxx_frm_max_s cn52xxp1; 452 struct cvmx_agl_gmx_rxx_frm_max_s cn52xxp1;
434 struct cvmx_agl_gmx_rxx_frm_max_s cn56xx; 453 struct cvmx_agl_gmx_rxx_frm_max_s cn56xx;
435 struct cvmx_agl_gmx_rxx_frm_max_s cn56xxp1; 454 struct cvmx_agl_gmx_rxx_frm_max_s cn56xxp1;
455 struct cvmx_agl_gmx_rxx_frm_max_s cn63xx;
456 struct cvmx_agl_gmx_rxx_frm_max_s cn63xxp1;
436}; 457};
437 458
438union cvmx_agl_gmx_rxx_frm_min { 459union cvmx_agl_gmx_rxx_frm_min {
@@ -445,6 +466,8 @@ union cvmx_agl_gmx_rxx_frm_min {
445 struct cvmx_agl_gmx_rxx_frm_min_s cn52xxp1; 466 struct cvmx_agl_gmx_rxx_frm_min_s cn52xxp1;
446 struct cvmx_agl_gmx_rxx_frm_min_s cn56xx; 467 struct cvmx_agl_gmx_rxx_frm_min_s cn56xx;
447 struct cvmx_agl_gmx_rxx_frm_min_s cn56xxp1; 468 struct cvmx_agl_gmx_rxx_frm_min_s cn56xxp1;
469 struct cvmx_agl_gmx_rxx_frm_min_s cn63xx;
470 struct cvmx_agl_gmx_rxx_frm_min_s cn63xxp1;
448}; 471};
449 472
450union cvmx_agl_gmx_rxx_ifg { 473union cvmx_agl_gmx_rxx_ifg {
@@ -457,6 +480,8 @@ union cvmx_agl_gmx_rxx_ifg {
457 struct cvmx_agl_gmx_rxx_ifg_s cn52xxp1; 480 struct cvmx_agl_gmx_rxx_ifg_s cn52xxp1;
458 struct cvmx_agl_gmx_rxx_ifg_s cn56xx; 481 struct cvmx_agl_gmx_rxx_ifg_s cn56xx;
459 struct cvmx_agl_gmx_rxx_ifg_s cn56xxp1; 482 struct cvmx_agl_gmx_rxx_ifg_s cn56xxp1;
483 struct cvmx_agl_gmx_rxx_ifg_s cn63xx;
484 struct cvmx_agl_gmx_rxx_ifg_s cn63xxp1;
460}; 485};
461 486
462union cvmx_agl_gmx_rxx_int_en { 487union cvmx_agl_gmx_rxx_int_en {
@@ -464,6 +489,29 @@ union cvmx_agl_gmx_rxx_int_en {
464 struct cvmx_agl_gmx_rxx_int_en_s { 489 struct cvmx_agl_gmx_rxx_int_en_s {
465 uint64_t reserved_20_63:44; 490 uint64_t reserved_20_63:44;
466 uint64_t pause_drp:1; 491 uint64_t pause_drp:1;
492 uint64_t phy_dupx:1;
493 uint64_t phy_spd:1;
494 uint64_t phy_link:1;
495 uint64_t ifgerr:1;
496 uint64_t coldet:1;
497 uint64_t falerr:1;
498 uint64_t rsverr:1;
499 uint64_t pcterr:1;
500 uint64_t ovrerr:1;
501 uint64_t niberr:1;
502 uint64_t skperr:1;
503 uint64_t rcverr:1;
504 uint64_t lenerr:1;
505 uint64_t alnerr:1;
506 uint64_t fcserr:1;
507 uint64_t jabber:1;
508 uint64_t maxerr:1;
509 uint64_t carext:1;
510 uint64_t minerr:1;
511 } s;
512 struct cvmx_agl_gmx_rxx_int_en_cn52xx {
513 uint64_t reserved_20_63:44;
514 uint64_t pause_drp:1;
467 uint64_t reserved_16_18:3; 515 uint64_t reserved_16_18:3;
468 uint64_t ifgerr:1; 516 uint64_t ifgerr:1;
469 uint64_t coldet:1; 517 uint64_t coldet:1;
@@ -481,11 +529,12 @@ union cvmx_agl_gmx_rxx_int_en {
481 uint64_t maxerr:1; 529 uint64_t maxerr:1;
482 uint64_t reserved_1_1:1; 530 uint64_t reserved_1_1:1;
483 uint64_t minerr:1; 531 uint64_t minerr:1;
484 } s; 532 } cn52xx;
485 struct cvmx_agl_gmx_rxx_int_en_s cn52xx; 533 struct cvmx_agl_gmx_rxx_int_en_cn52xx cn52xxp1;
486 struct cvmx_agl_gmx_rxx_int_en_s cn52xxp1; 534 struct cvmx_agl_gmx_rxx_int_en_cn52xx cn56xx;
487 struct cvmx_agl_gmx_rxx_int_en_s cn56xx; 535 struct cvmx_agl_gmx_rxx_int_en_cn52xx cn56xxp1;
488 struct cvmx_agl_gmx_rxx_int_en_s cn56xxp1; 536 struct cvmx_agl_gmx_rxx_int_en_s cn63xx;
537 struct cvmx_agl_gmx_rxx_int_en_s cn63xxp1;
489}; 538};
490 539
491union cvmx_agl_gmx_rxx_int_reg { 540union cvmx_agl_gmx_rxx_int_reg {
@@ -493,6 +542,29 @@ union cvmx_agl_gmx_rxx_int_reg {
493 struct cvmx_agl_gmx_rxx_int_reg_s { 542 struct cvmx_agl_gmx_rxx_int_reg_s {
494 uint64_t reserved_20_63:44; 543 uint64_t reserved_20_63:44;
495 uint64_t pause_drp:1; 544 uint64_t pause_drp:1;
545 uint64_t phy_dupx:1;
546 uint64_t phy_spd:1;
547 uint64_t phy_link:1;
548 uint64_t ifgerr:1;
549 uint64_t coldet:1;
550 uint64_t falerr:1;
551 uint64_t rsverr:1;
552 uint64_t pcterr:1;
553 uint64_t ovrerr:1;
554 uint64_t niberr:1;
555 uint64_t skperr:1;
556 uint64_t rcverr:1;
557 uint64_t lenerr:1;
558 uint64_t alnerr:1;
559 uint64_t fcserr:1;
560 uint64_t jabber:1;
561 uint64_t maxerr:1;
562 uint64_t carext:1;
563 uint64_t minerr:1;
564 } s;
565 struct cvmx_agl_gmx_rxx_int_reg_cn52xx {
566 uint64_t reserved_20_63:44;
567 uint64_t pause_drp:1;
496 uint64_t reserved_16_18:3; 568 uint64_t reserved_16_18:3;
497 uint64_t ifgerr:1; 569 uint64_t ifgerr:1;
498 uint64_t coldet:1; 570 uint64_t coldet:1;
@@ -510,11 +582,12 @@ union cvmx_agl_gmx_rxx_int_reg {
510 uint64_t maxerr:1; 582 uint64_t maxerr:1;
511 uint64_t reserved_1_1:1; 583 uint64_t reserved_1_1:1;
512 uint64_t minerr:1; 584 uint64_t minerr:1;
513 } s; 585 } cn52xx;
514 struct cvmx_agl_gmx_rxx_int_reg_s cn52xx; 586 struct cvmx_agl_gmx_rxx_int_reg_cn52xx cn52xxp1;
515 struct cvmx_agl_gmx_rxx_int_reg_s cn52xxp1; 587 struct cvmx_agl_gmx_rxx_int_reg_cn52xx cn56xx;
516 struct cvmx_agl_gmx_rxx_int_reg_s cn56xx; 588 struct cvmx_agl_gmx_rxx_int_reg_cn52xx cn56xxp1;
517 struct cvmx_agl_gmx_rxx_int_reg_s cn56xxp1; 589 struct cvmx_agl_gmx_rxx_int_reg_s cn63xx;
590 struct cvmx_agl_gmx_rxx_int_reg_s cn63xxp1;
518}; 591};
519 592
520union cvmx_agl_gmx_rxx_jabber { 593union cvmx_agl_gmx_rxx_jabber {
@@ -527,6 +600,8 @@ union cvmx_agl_gmx_rxx_jabber {
527 struct cvmx_agl_gmx_rxx_jabber_s cn52xxp1; 600 struct cvmx_agl_gmx_rxx_jabber_s cn52xxp1;
528 struct cvmx_agl_gmx_rxx_jabber_s cn56xx; 601 struct cvmx_agl_gmx_rxx_jabber_s cn56xx;
529 struct cvmx_agl_gmx_rxx_jabber_s cn56xxp1; 602 struct cvmx_agl_gmx_rxx_jabber_s cn56xxp1;
603 struct cvmx_agl_gmx_rxx_jabber_s cn63xx;
604 struct cvmx_agl_gmx_rxx_jabber_s cn63xxp1;
530}; 605};
531 606
532union cvmx_agl_gmx_rxx_pause_drop_time { 607union cvmx_agl_gmx_rxx_pause_drop_time {
@@ -539,6 +614,20 @@ union cvmx_agl_gmx_rxx_pause_drop_time {
539 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn52xxp1; 614 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn52xxp1;
540 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn56xx; 615 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn56xx;
541 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn56xxp1; 616 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn56xxp1;
617 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn63xx;
618 struct cvmx_agl_gmx_rxx_pause_drop_time_s cn63xxp1;
619};
620
621union cvmx_agl_gmx_rxx_rx_inbnd {
622 uint64_t u64;
623 struct cvmx_agl_gmx_rxx_rx_inbnd_s {
624 uint64_t reserved_4_63:60;
625 uint64_t duplex:1;
626 uint64_t speed:2;
627 uint64_t status:1;
628 } s;
629 struct cvmx_agl_gmx_rxx_rx_inbnd_s cn63xx;
630 struct cvmx_agl_gmx_rxx_rx_inbnd_s cn63xxp1;
542}; 631};
543 632
544union cvmx_agl_gmx_rxx_stats_ctl { 633union cvmx_agl_gmx_rxx_stats_ctl {
@@ -551,6 +640,8 @@ union cvmx_agl_gmx_rxx_stats_ctl {
551 struct cvmx_agl_gmx_rxx_stats_ctl_s cn52xxp1; 640 struct cvmx_agl_gmx_rxx_stats_ctl_s cn52xxp1;
552 struct cvmx_agl_gmx_rxx_stats_ctl_s cn56xx; 641 struct cvmx_agl_gmx_rxx_stats_ctl_s cn56xx;
553 struct cvmx_agl_gmx_rxx_stats_ctl_s cn56xxp1; 642 struct cvmx_agl_gmx_rxx_stats_ctl_s cn56xxp1;
643 struct cvmx_agl_gmx_rxx_stats_ctl_s cn63xx;
644 struct cvmx_agl_gmx_rxx_stats_ctl_s cn63xxp1;
554}; 645};
555 646
556union cvmx_agl_gmx_rxx_stats_octs { 647union cvmx_agl_gmx_rxx_stats_octs {
@@ -563,6 +654,8 @@ union cvmx_agl_gmx_rxx_stats_octs {
563 struct cvmx_agl_gmx_rxx_stats_octs_s cn52xxp1; 654 struct cvmx_agl_gmx_rxx_stats_octs_s cn52xxp1;
564 struct cvmx_agl_gmx_rxx_stats_octs_s cn56xx; 655 struct cvmx_agl_gmx_rxx_stats_octs_s cn56xx;
565 struct cvmx_agl_gmx_rxx_stats_octs_s cn56xxp1; 656 struct cvmx_agl_gmx_rxx_stats_octs_s cn56xxp1;
657 struct cvmx_agl_gmx_rxx_stats_octs_s cn63xx;
658 struct cvmx_agl_gmx_rxx_stats_octs_s cn63xxp1;
566}; 659};
567 660
568union cvmx_agl_gmx_rxx_stats_octs_ctl { 661union cvmx_agl_gmx_rxx_stats_octs_ctl {
@@ -575,6 +668,8 @@ union cvmx_agl_gmx_rxx_stats_octs_ctl {
575 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn52xxp1; 668 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn52xxp1;
576 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn56xx; 669 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn56xx;
577 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn56xxp1; 670 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn56xxp1;
671 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn63xx;
672 struct cvmx_agl_gmx_rxx_stats_octs_ctl_s cn63xxp1;
578}; 673};
579 674
580union cvmx_agl_gmx_rxx_stats_octs_dmac { 675union cvmx_agl_gmx_rxx_stats_octs_dmac {
@@ -587,6 +682,8 @@ union cvmx_agl_gmx_rxx_stats_octs_dmac {
587 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn52xxp1; 682 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn52xxp1;
588 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn56xx; 683 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn56xx;
589 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn56xxp1; 684 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn56xxp1;
685 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn63xx;
686 struct cvmx_agl_gmx_rxx_stats_octs_dmac_s cn63xxp1;
590}; 687};
591 688
592union cvmx_agl_gmx_rxx_stats_octs_drp { 689union cvmx_agl_gmx_rxx_stats_octs_drp {
@@ -599,6 +696,8 @@ union cvmx_agl_gmx_rxx_stats_octs_drp {
599 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn52xxp1; 696 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn52xxp1;
600 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn56xx; 697 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn56xx;
601 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn56xxp1; 698 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn56xxp1;
699 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn63xx;
700 struct cvmx_agl_gmx_rxx_stats_octs_drp_s cn63xxp1;
602}; 701};
603 702
604union cvmx_agl_gmx_rxx_stats_pkts { 703union cvmx_agl_gmx_rxx_stats_pkts {
@@ -611,6 +710,8 @@ union cvmx_agl_gmx_rxx_stats_pkts {
611 struct cvmx_agl_gmx_rxx_stats_pkts_s cn52xxp1; 710 struct cvmx_agl_gmx_rxx_stats_pkts_s cn52xxp1;
612 struct cvmx_agl_gmx_rxx_stats_pkts_s cn56xx; 711 struct cvmx_agl_gmx_rxx_stats_pkts_s cn56xx;
613 struct cvmx_agl_gmx_rxx_stats_pkts_s cn56xxp1; 712 struct cvmx_agl_gmx_rxx_stats_pkts_s cn56xxp1;
713 struct cvmx_agl_gmx_rxx_stats_pkts_s cn63xx;
714 struct cvmx_agl_gmx_rxx_stats_pkts_s cn63xxp1;
614}; 715};
615 716
616union cvmx_agl_gmx_rxx_stats_pkts_bad { 717union cvmx_agl_gmx_rxx_stats_pkts_bad {
@@ -623,6 +724,8 @@ union cvmx_agl_gmx_rxx_stats_pkts_bad {
623 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn52xxp1; 724 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn52xxp1;
624 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn56xx; 725 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn56xx;
625 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn56xxp1; 726 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn56xxp1;
727 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn63xx;
728 struct cvmx_agl_gmx_rxx_stats_pkts_bad_s cn63xxp1;
626}; 729};
627 730
628union cvmx_agl_gmx_rxx_stats_pkts_ctl { 731union cvmx_agl_gmx_rxx_stats_pkts_ctl {
@@ -635,6 +738,8 @@ union cvmx_agl_gmx_rxx_stats_pkts_ctl {
635 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn52xxp1; 738 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn52xxp1;
636 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn56xx; 739 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn56xx;
637 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn56xxp1; 740 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn56xxp1;
741 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn63xx;
742 struct cvmx_agl_gmx_rxx_stats_pkts_ctl_s cn63xxp1;
638}; 743};
639 744
640union cvmx_agl_gmx_rxx_stats_pkts_dmac { 745union cvmx_agl_gmx_rxx_stats_pkts_dmac {
@@ -647,6 +752,8 @@ union cvmx_agl_gmx_rxx_stats_pkts_dmac {
647 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn52xxp1; 752 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn52xxp1;
648 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn56xx; 753 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn56xx;
649 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn56xxp1; 754 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn56xxp1;
755 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn63xx;
756 struct cvmx_agl_gmx_rxx_stats_pkts_dmac_s cn63xxp1;
650}; 757};
651 758
652union cvmx_agl_gmx_rxx_stats_pkts_drp { 759union cvmx_agl_gmx_rxx_stats_pkts_drp {
@@ -659,6 +766,8 @@ union cvmx_agl_gmx_rxx_stats_pkts_drp {
659 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn52xxp1; 766 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn52xxp1;
660 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn56xx; 767 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn56xx;
661 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn56xxp1; 768 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn56xxp1;
769 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn63xx;
770 struct cvmx_agl_gmx_rxx_stats_pkts_drp_s cn63xxp1;
662}; 771};
663 772
664union cvmx_agl_gmx_rxx_udd_skp { 773union cvmx_agl_gmx_rxx_udd_skp {
@@ -673,6 +782,8 @@ union cvmx_agl_gmx_rxx_udd_skp {
673 struct cvmx_agl_gmx_rxx_udd_skp_s cn52xxp1; 782 struct cvmx_agl_gmx_rxx_udd_skp_s cn52xxp1;
674 struct cvmx_agl_gmx_rxx_udd_skp_s cn56xx; 783 struct cvmx_agl_gmx_rxx_udd_skp_s cn56xx;
675 struct cvmx_agl_gmx_rxx_udd_skp_s cn56xxp1; 784 struct cvmx_agl_gmx_rxx_udd_skp_s cn56xxp1;
785 struct cvmx_agl_gmx_rxx_udd_skp_s cn63xx;
786 struct cvmx_agl_gmx_rxx_udd_skp_s cn63xxp1;
676}; 787};
677 788
678union cvmx_agl_gmx_rx_bp_dropx { 789union cvmx_agl_gmx_rx_bp_dropx {
@@ -685,6 +796,8 @@ union cvmx_agl_gmx_rx_bp_dropx {
685 struct cvmx_agl_gmx_rx_bp_dropx_s cn52xxp1; 796 struct cvmx_agl_gmx_rx_bp_dropx_s cn52xxp1;
686 struct cvmx_agl_gmx_rx_bp_dropx_s cn56xx; 797 struct cvmx_agl_gmx_rx_bp_dropx_s cn56xx;
687 struct cvmx_agl_gmx_rx_bp_dropx_s cn56xxp1; 798 struct cvmx_agl_gmx_rx_bp_dropx_s cn56xxp1;
799 struct cvmx_agl_gmx_rx_bp_dropx_s cn63xx;
800 struct cvmx_agl_gmx_rx_bp_dropx_s cn63xxp1;
688}; 801};
689 802
690union cvmx_agl_gmx_rx_bp_offx { 803union cvmx_agl_gmx_rx_bp_offx {
@@ -697,6 +810,8 @@ union cvmx_agl_gmx_rx_bp_offx {
697 struct cvmx_agl_gmx_rx_bp_offx_s cn52xxp1; 810 struct cvmx_agl_gmx_rx_bp_offx_s cn52xxp1;
698 struct cvmx_agl_gmx_rx_bp_offx_s cn56xx; 811 struct cvmx_agl_gmx_rx_bp_offx_s cn56xx;
699 struct cvmx_agl_gmx_rx_bp_offx_s cn56xxp1; 812 struct cvmx_agl_gmx_rx_bp_offx_s cn56xxp1;
813 struct cvmx_agl_gmx_rx_bp_offx_s cn63xx;
814 struct cvmx_agl_gmx_rx_bp_offx_s cn63xxp1;
700}; 815};
701 816
702union cvmx_agl_gmx_rx_bp_onx { 817union cvmx_agl_gmx_rx_bp_onx {
@@ -709,6 +824,8 @@ union cvmx_agl_gmx_rx_bp_onx {
709 struct cvmx_agl_gmx_rx_bp_onx_s cn52xxp1; 824 struct cvmx_agl_gmx_rx_bp_onx_s cn52xxp1;
710 struct cvmx_agl_gmx_rx_bp_onx_s cn56xx; 825 struct cvmx_agl_gmx_rx_bp_onx_s cn56xx;
711 struct cvmx_agl_gmx_rx_bp_onx_s cn56xxp1; 826 struct cvmx_agl_gmx_rx_bp_onx_s cn56xxp1;
827 struct cvmx_agl_gmx_rx_bp_onx_s cn63xx;
828 struct cvmx_agl_gmx_rx_bp_onx_s cn63xxp1;
712}; 829};
713 830
714union cvmx_agl_gmx_rx_prt_info { 831union cvmx_agl_gmx_rx_prt_info {
@@ -728,6 +845,8 @@ union cvmx_agl_gmx_rx_prt_info {
728 uint64_t commit:1; 845 uint64_t commit:1;
729 } cn56xx; 846 } cn56xx;
730 struct cvmx_agl_gmx_rx_prt_info_cn56xx cn56xxp1; 847 struct cvmx_agl_gmx_rx_prt_info_cn56xx cn56xxp1;
848 struct cvmx_agl_gmx_rx_prt_info_s cn63xx;
849 struct cvmx_agl_gmx_rx_prt_info_s cn63xxp1;
731}; 850};
732 851
733union cvmx_agl_gmx_rx_tx_status { 852union cvmx_agl_gmx_rx_tx_status {
@@ -747,6 +866,8 @@ union cvmx_agl_gmx_rx_tx_status {
747 uint64_t rx:1; 866 uint64_t rx:1;
748 } cn56xx; 867 } cn56xx;
749 struct cvmx_agl_gmx_rx_tx_status_cn56xx cn56xxp1; 868 struct cvmx_agl_gmx_rx_tx_status_cn56xx cn56xxp1;
869 struct cvmx_agl_gmx_rx_tx_status_s cn63xx;
870 struct cvmx_agl_gmx_rx_tx_status_s cn63xxp1;
750}; 871};
751 872
752union cvmx_agl_gmx_smacx { 873union cvmx_agl_gmx_smacx {
@@ -759,6 +880,8 @@ union cvmx_agl_gmx_smacx {
759 struct cvmx_agl_gmx_smacx_s cn52xxp1; 880 struct cvmx_agl_gmx_smacx_s cn52xxp1;
760 struct cvmx_agl_gmx_smacx_s cn56xx; 881 struct cvmx_agl_gmx_smacx_s cn56xx;
761 struct cvmx_agl_gmx_smacx_s cn56xxp1; 882 struct cvmx_agl_gmx_smacx_s cn56xxp1;
883 struct cvmx_agl_gmx_smacx_s cn63xx;
884 struct cvmx_agl_gmx_smacx_s cn63xxp1;
762}; 885};
763 886
764union cvmx_agl_gmx_stat_bp { 887union cvmx_agl_gmx_stat_bp {
@@ -772,6 +895,8 @@ union cvmx_agl_gmx_stat_bp {
772 struct cvmx_agl_gmx_stat_bp_s cn52xxp1; 895 struct cvmx_agl_gmx_stat_bp_s cn52xxp1;
773 struct cvmx_agl_gmx_stat_bp_s cn56xx; 896 struct cvmx_agl_gmx_stat_bp_s cn56xx;
774 struct cvmx_agl_gmx_stat_bp_s cn56xxp1; 897 struct cvmx_agl_gmx_stat_bp_s cn56xxp1;
898 struct cvmx_agl_gmx_stat_bp_s cn63xx;
899 struct cvmx_agl_gmx_stat_bp_s cn63xxp1;
775}; 900};
776 901
777union cvmx_agl_gmx_txx_append { 902union cvmx_agl_gmx_txx_append {
@@ -787,6 +912,18 @@ union cvmx_agl_gmx_txx_append {
787 struct cvmx_agl_gmx_txx_append_s cn52xxp1; 912 struct cvmx_agl_gmx_txx_append_s cn52xxp1;
788 struct cvmx_agl_gmx_txx_append_s cn56xx; 913 struct cvmx_agl_gmx_txx_append_s cn56xx;
789 struct cvmx_agl_gmx_txx_append_s cn56xxp1; 914 struct cvmx_agl_gmx_txx_append_s cn56xxp1;
915 struct cvmx_agl_gmx_txx_append_s cn63xx;
916 struct cvmx_agl_gmx_txx_append_s cn63xxp1;
917};
918
919union cvmx_agl_gmx_txx_clk {
920 uint64_t u64;
921 struct cvmx_agl_gmx_txx_clk_s {
922 uint64_t reserved_6_63:58;
923 uint64_t clk_cnt:6;
924 } s;
925 struct cvmx_agl_gmx_txx_clk_s cn63xx;
926 struct cvmx_agl_gmx_txx_clk_s cn63xxp1;
790}; 927};
791 928
792union cvmx_agl_gmx_txx_ctl { 929union cvmx_agl_gmx_txx_ctl {
@@ -800,6 +937,8 @@ union cvmx_agl_gmx_txx_ctl {
800 struct cvmx_agl_gmx_txx_ctl_s cn52xxp1; 937 struct cvmx_agl_gmx_txx_ctl_s cn52xxp1;
801 struct cvmx_agl_gmx_txx_ctl_s cn56xx; 938 struct cvmx_agl_gmx_txx_ctl_s cn56xx;
802 struct cvmx_agl_gmx_txx_ctl_s cn56xxp1; 939 struct cvmx_agl_gmx_txx_ctl_s cn56xxp1;
940 struct cvmx_agl_gmx_txx_ctl_s cn63xx;
941 struct cvmx_agl_gmx_txx_ctl_s cn63xxp1;
803}; 942};
804 943
805union cvmx_agl_gmx_txx_min_pkt { 944union cvmx_agl_gmx_txx_min_pkt {
@@ -812,6 +951,8 @@ union cvmx_agl_gmx_txx_min_pkt {
812 struct cvmx_agl_gmx_txx_min_pkt_s cn52xxp1; 951 struct cvmx_agl_gmx_txx_min_pkt_s cn52xxp1;
813 struct cvmx_agl_gmx_txx_min_pkt_s cn56xx; 952 struct cvmx_agl_gmx_txx_min_pkt_s cn56xx;
814 struct cvmx_agl_gmx_txx_min_pkt_s cn56xxp1; 953 struct cvmx_agl_gmx_txx_min_pkt_s cn56xxp1;
954 struct cvmx_agl_gmx_txx_min_pkt_s cn63xx;
955 struct cvmx_agl_gmx_txx_min_pkt_s cn63xxp1;
815}; 956};
816 957
817union cvmx_agl_gmx_txx_pause_pkt_interval { 958union cvmx_agl_gmx_txx_pause_pkt_interval {
@@ -824,6 +965,8 @@ union cvmx_agl_gmx_txx_pause_pkt_interval {
824 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn52xxp1; 965 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn52xxp1;
825 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn56xx; 966 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn56xx;
826 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn56xxp1; 967 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn56xxp1;
968 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn63xx;
969 struct cvmx_agl_gmx_txx_pause_pkt_interval_s cn63xxp1;
827}; 970};
828 971
829union cvmx_agl_gmx_txx_pause_pkt_time { 972union cvmx_agl_gmx_txx_pause_pkt_time {
@@ -836,6 +979,8 @@ union cvmx_agl_gmx_txx_pause_pkt_time {
836 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn52xxp1; 979 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn52xxp1;
837 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn56xx; 980 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn56xx;
838 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn56xxp1; 981 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn56xxp1;
982 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn63xx;
983 struct cvmx_agl_gmx_txx_pause_pkt_time_s cn63xxp1;
839}; 984};
840 985
841union cvmx_agl_gmx_txx_pause_togo { 986union cvmx_agl_gmx_txx_pause_togo {
@@ -848,6 +993,8 @@ union cvmx_agl_gmx_txx_pause_togo {
848 struct cvmx_agl_gmx_txx_pause_togo_s cn52xxp1; 993 struct cvmx_agl_gmx_txx_pause_togo_s cn52xxp1;
849 struct cvmx_agl_gmx_txx_pause_togo_s cn56xx; 994 struct cvmx_agl_gmx_txx_pause_togo_s cn56xx;
850 struct cvmx_agl_gmx_txx_pause_togo_s cn56xxp1; 995 struct cvmx_agl_gmx_txx_pause_togo_s cn56xxp1;
996 struct cvmx_agl_gmx_txx_pause_togo_s cn63xx;
997 struct cvmx_agl_gmx_txx_pause_togo_s cn63xxp1;
851}; 998};
852 999
853union cvmx_agl_gmx_txx_pause_zero { 1000union cvmx_agl_gmx_txx_pause_zero {
@@ -860,6 +1007,8 @@ union cvmx_agl_gmx_txx_pause_zero {
860 struct cvmx_agl_gmx_txx_pause_zero_s cn52xxp1; 1007 struct cvmx_agl_gmx_txx_pause_zero_s cn52xxp1;
861 struct cvmx_agl_gmx_txx_pause_zero_s cn56xx; 1008 struct cvmx_agl_gmx_txx_pause_zero_s cn56xx;
862 struct cvmx_agl_gmx_txx_pause_zero_s cn56xxp1; 1009 struct cvmx_agl_gmx_txx_pause_zero_s cn56xxp1;
1010 struct cvmx_agl_gmx_txx_pause_zero_s cn63xx;
1011 struct cvmx_agl_gmx_txx_pause_zero_s cn63xxp1;
863}; 1012};
864 1013
865union cvmx_agl_gmx_txx_soft_pause { 1014union cvmx_agl_gmx_txx_soft_pause {
@@ -872,6 +1021,8 @@ union cvmx_agl_gmx_txx_soft_pause {
872 struct cvmx_agl_gmx_txx_soft_pause_s cn52xxp1; 1021 struct cvmx_agl_gmx_txx_soft_pause_s cn52xxp1;
873 struct cvmx_agl_gmx_txx_soft_pause_s cn56xx; 1022 struct cvmx_agl_gmx_txx_soft_pause_s cn56xx;
874 struct cvmx_agl_gmx_txx_soft_pause_s cn56xxp1; 1023 struct cvmx_agl_gmx_txx_soft_pause_s cn56xxp1;
1024 struct cvmx_agl_gmx_txx_soft_pause_s cn63xx;
1025 struct cvmx_agl_gmx_txx_soft_pause_s cn63xxp1;
875}; 1026};
876 1027
877union cvmx_agl_gmx_txx_stat0 { 1028union cvmx_agl_gmx_txx_stat0 {
@@ -884,6 +1035,8 @@ union cvmx_agl_gmx_txx_stat0 {
884 struct cvmx_agl_gmx_txx_stat0_s cn52xxp1; 1035 struct cvmx_agl_gmx_txx_stat0_s cn52xxp1;
885 struct cvmx_agl_gmx_txx_stat0_s cn56xx; 1036 struct cvmx_agl_gmx_txx_stat0_s cn56xx;
886 struct cvmx_agl_gmx_txx_stat0_s cn56xxp1; 1037 struct cvmx_agl_gmx_txx_stat0_s cn56xxp1;
1038 struct cvmx_agl_gmx_txx_stat0_s cn63xx;
1039 struct cvmx_agl_gmx_txx_stat0_s cn63xxp1;
887}; 1040};
888 1041
889union cvmx_agl_gmx_txx_stat1 { 1042union cvmx_agl_gmx_txx_stat1 {
@@ -896,6 +1049,8 @@ union cvmx_agl_gmx_txx_stat1 {
896 struct cvmx_agl_gmx_txx_stat1_s cn52xxp1; 1049 struct cvmx_agl_gmx_txx_stat1_s cn52xxp1;
897 struct cvmx_agl_gmx_txx_stat1_s cn56xx; 1050 struct cvmx_agl_gmx_txx_stat1_s cn56xx;
898 struct cvmx_agl_gmx_txx_stat1_s cn56xxp1; 1051 struct cvmx_agl_gmx_txx_stat1_s cn56xxp1;
1052 struct cvmx_agl_gmx_txx_stat1_s cn63xx;
1053 struct cvmx_agl_gmx_txx_stat1_s cn63xxp1;
899}; 1054};
900 1055
901union cvmx_agl_gmx_txx_stat2 { 1056union cvmx_agl_gmx_txx_stat2 {
@@ -908,6 +1063,8 @@ union cvmx_agl_gmx_txx_stat2 {
908 struct cvmx_agl_gmx_txx_stat2_s cn52xxp1; 1063 struct cvmx_agl_gmx_txx_stat2_s cn52xxp1;
909 struct cvmx_agl_gmx_txx_stat2_s cn56xx; 1064 struct cvmx_agl_gmx_txx_stat2_s cn56xx;
910 struct cvmx_agl_gmx_txx_stat2_s cn56xxp1; 1065 struct cvmx_agl_gmx_txx_stat2_s cn56xxp1;
1066 struct cvmx_agl_gmx_txx_stat2_s cn63xx;
1067 struct cvmx_agl_gmx_txx_stat2_s cn63xxp1;
911}; 1068};
912 1069
913union cvmx_agl_gmx_txx_stat3 { 1070union cvmx_agl_gmx_txx_stat3 {
@@ -920,6 +1077,8 @@ union cvmx_agl_gmx_txx_stat3 {
920 struct cvmx_agl_gmx_txx_stat3_s cn52xxp1; 1077 struct cvmx_agl_gmx_txx_stat3_s cn52xxp1;
921 struct cvmx_agl_gmx_txx_stat3_s cn56xx; 1078 struct cvmx_agl_gmx_txx_stat3_s cn56xx;
922 struct cvmx_agl_gmx_txx_stat3_s cn56xxp1; 1079 struct cvmx_agl_gmx_txx_stat3_s cn56xxp1;
1080 struct cvmx_agl_gmx_txx_stat3_s cn63xx;
1081 struct cvmx_agl_gmx_txx_stat3_s cn63xxp1;
923}; 1082};
924 1083
925union cvmx_agl_gmx_txx_stat4 { 1084union cvmx_agl_gmx_txx_stat4 {
@@ -932,6 +1091,8 @@ union cvmx_agl_gmx_txx_stat4 {
932 struct cvmx_agl_gmx_txx_stat4_s cn52xxp1; 1091 struct cvmx_agl_gmx_txx_stat4_s cn52xxp1;
933 struct cvmx_agl_gmx_txx_stat4_s cn56xx; 1092 struct cvmx_agl_gmx_txx_stat4_s cn56xx;
934 struct cvmx_agl_gmx_txx_stat4_s cn56xxp1; 1093 struct cvmx_agl_gmx_txx_stat4_s cn56xxp1;
1094 struct cvmx_agl_gmx_txx_stat4_s cn63xx;
1095 struct cvmx_agl_gmx_txx_stat4_s cn63xxp1;
935}; 1096};
936 1097
937union cvmx_agl_gmx_txx_stat5 { 1098union cvmx_agl_gmx_txx_stat5 {
@@ -944,6 +1105,8 @@ union cvmx_agl_gmx_txx_stat5 {
944 struct cvmx_agl_gmx_txx_stat5_s cn52xxp1; 1105 struct cvmx_agl_gmx_txx_stat5_s cn52xxp1;
945 struct cvmx_agl_gmx_txx_stat5_s cn56xx; 1106 struct cvmx_agl_gmx_txx_stat5_s cn56xx;
946 struct cvmx_agl_gmx_txx_stat5_s cn56xxp1; 1107 struct cvmx_agl_gmx_txx_stat5_s cn56xxp1;
1108 struct cvmx_agl_gmx_txx_stat5_s cn63xx;
1109 struct cvmx_agl_gmx_txx_stat5_s cn63xxp1;
947}; 1110};
948 1111
949union cvmx_agl_gmx_txx_stat6 { 1112union cvmx_agl_gmx_txx_stat6 {
@@ -956,6 +1119,8 @@ union cvmx_agl_gmx_txx_stat6 {
956 struct cvmx_agl_gmx_txx_stat6_s cn52xxp1; 1119 struct cvmx_agl_gmx_txx_stat6_s cn52xxp1;
957 struct cvmx_agl_gmx_txx_stat6_s cn56xx; 1120 struct cvmx_agl_gmx_txx_stat6_s cn56xx;
958 struct cvmx_agl_gmx_txx_stat6_s cn56xxp1; 1121 struct cvmx_agl_gmx_txx_stat6_s cn56xxp1;
1122 struct cvmx_agl_gmx_txx_stat6_s cn63xx;
1123 struct cvmx_agl_gmx_txx_stat6_s cn63xxp1;
959}; 1124};
960 1125
961union cvmx_agl_gmx_txx_stat7 { 1126union cvmx_agl_gmx_txx_stat7 {
@@ -968,6 +1133,8 @@ union cvmx_agl_gmx_txx_stat7 {
968 struct cvmx_agl_gmx_txx_stat7_s cn52xxp1; 1133 struct cvmx_agl_gmx_txx_stat7_s cn52xxp1;
969 struct cvmx_agl_gmx_txx_stat7_s cn56xx; 1134 struct cvmx_agl_gmx_txx_stat7_s cn56xx;
970 struct cvmx_agl_gmx_txx_stat7_s cn56xxp1; 1135 struct cvmx_agl_gmx_txx_stat7_s cn56xxp1;
1136 struct cvmx_agl_gmx_txx_stat7_s cn63xx;
1137 struct cvmx_agl_gmx_txx_stat7_s cn63xxp1;
971}; 1138};
972 1139
973union cvmx_agl_gmx_txx_stat8 { 1140union cvmx_agl_gmx_txx_stat8 {
@@ -980,6 +1147,8 @@ union cvmx_agl_gmx_txx_stat8 {
980 struct cvmx_agl_gmx_txx_stat8_s cn52xxp1; 1147 struct cvmx_agl_gmx_txx_stat8_s cn52xxp1;
981 struct cvmx_agl_gmx_txx_stat8_s cn56xx; 1148 struct cvmx_agl_gmx_txx_stat8_s cn56xx;
982 struct cvmx_agl_gmx_txx_stat8_s cn56xxp1; 1149 struct cvmx_agl_gmx_txx_stat8_s cn56xxp1;
1150 struct cvmx_agl_gmx_txx_stat8_s cn63xx;
1151 struct cvmx_agl_gmx_txx_stat8_s cn63xxp1;
983}; 1152};
984 1153
985union cvmx_agl_gmx_txx_stat9 { 1154union cvmx_agl_gmx_txx_stat9 {
@@ -992,6 +1161,8 @@ union cvmx_agl_gmx_txx_stat9 {
992 struct cvmx_agl_gmx_txx_stat9_s cn52xxp1; 1161 struct cvmx_agl_gmx_txx_stat9_s cn52xxp1;
993 struct cvmx_agl_gmx_txx_stat9_s cn56xx; 1162 struct cvmx_agl_gmx_txx_stat9_s cn56xx;
994 struct cvmx_agl_gmx_txx_stat9_s cn56xxp1; 1163 struct cvmx_agl_gmx_txx_stat9_s cn56xxp1;
1164 struct cvmx_agl_gmx_txx_stat9_s cn63xx;
1165 struct cvmx_agl_gmx_txx_stat9_s cn63xxp1;
995}; 1166};
996 1167
997union cvmx_agl_gmx_txx_stats_ctl { 1168union cvmx_agl_gmx_txx_stats_ctl {
@@ -1004,6 +1175,8 @@ union cvmx_agl_gmx_txx_stats_ctl {
1004 struct cvmx_agl_gmx_txx_stats_ctl_s cn52xxp1; 1175 struct cvmx_agl_gmx_txx_stats_ctl_s cn52xxp1;
1005 struct cvmx_agl_gmx_txx_stats_ctl_s cn56xx; 1176 struct cvmx_agl_gmx_txx_stats_ctl_s cn56xx;
1006 struct cvmx_agl_gmx_txx_stats_ctl_s cn56xxp1; 1177 struct cvmx_agl_gmx_txx_stats_ctl_s cn56xxp1;
1178 struct cvmx_agl_gmx_txx_stats_ctl_s cn63xx;
1179 struct cvmx_agl_gmx_txx_stats_ctl_s cn63xxp1;
1007}; 1180};
1008 1181
1009union cvmx_agl_gmx_txx_thresh { 1182union cvmx_agl_gmx_txx_thresh {
@@ -1016,6 +1189,8 @@ union cvmx_agl_gmx_txx_thresh {
1016 struct cvmx_agl_gmx_txx_thresh_s cn52xxp1; 1189 struct cvmx_agl_gmx_txx_thresh_s cn52xxp1;
1017 struct cvmx_agl_gmx_txx_thresh_s cn56xx; 1190 struct cvmx_agl_gmx_txx_thresh_s cn56xx;
1018 struct cvmx_agl_gmx_txx_thresh_s cn56xxp1; 1191 struct cvmx_agl_gmx_txx_thresh_s cn56xxp1;
1192 struct cvmx_agl_gmx_txx_thresh_s cn63xx;
1193 struct cvmx_agl_gmx_txx_thresh_s cn63xxp1;
1019}; 1194};
1020 1195
1021union cvmx_agl_gmx_tx_bp { 1196union cvmx_agl_gmx_tx_bp {
@@ -1031,6 +1206,8 @@ union cvmx_agl_gmx_tx_bp {
1031 uint64_t bp:1; 1206 uint64_t bp:1;
1032 } cn56xx; 1207 } cn56xx;
1033 struct cvmx_agl_gmx_tx_bp_cn56xx cn56xxp1; 1208 struct cvmx_agl_gmx_tx_bp_cn56xx cn56xxp1;
1209 struct cvmx_agl_gmx_tx_bp_s cn63xx;
1210 struct cvmx_agl_gmx_tx_bp_s cn63xxp1;
1034}; 1211};
1035 1212
1036union cvmx_agl_gmx_tx_col_attempt { 1213union cvmx_agl_gmx_tx_col_attempt {
@@ -1043,6 +1220,8 @@ union cvmx_agl_gmx_tx_col_attempt {
1043 struct cvmx_agl_gmx_tx_col_attempt_s cn52xxp1; 1220 struct cvmx_agl_gmx_tx_col_attempt_s cn52xxp1;
1044 struct cvmx_agl_gmx_tx_col_attempt_s cn56xx; 1221 struct cvmx_agl_gmx_tx_col_attempt_s cn56xx;
1045 struct cvmx_agl_gmx_tx_col_attempt_s cn56xxp1; 1222 struct cvmx_agl_gmx_tx_col_attempt_s cn56xxp1;
1223 struct cvmx_agl_gmx_tx_col_attempt_s cn63xx;
1224 struct cvmx_agl_gmx_tx_col_attempt_s cn63xxp1;
1046}; 1225};
1047 1226
1048union cvmx_agl_gmx_tx_ifg { 1227union cvmx_agl_gmx_tx_ifg {
@@ -1056,12 +1235,16 @@ union cvmx_agl_gmx_tx_ifg {
1056 struct cvmx_agl_gmx_tx_ifg_s cn52xxp1; 1235 struct cvmx_agl_gmx_tx_ifg_s cn52xxp1;
1057 struct cvmx_agl_gmx_tx_ifg_s cn56xx; 1236 struct cvmx_agl_gmx_tx_ifg_s cn56xx;
1058 struct cvmx_agl_gmx_tx_ifg_s cn56xxp1; 1237 struct cvmx_agl_gmx_tx_ifg_s cn56xxp1;
1238 struct cvmx_agl_gmx_tx_ifg_s cn63xx;
1239 struct cvmx_agl_gmx_tx_ifg_s cn63xxp1;
1059}; 1240};
1060 1241
1061union cvmx_agl_gmx_tx_int_en { 1242union cvmx_agl_gmx_tx_int_en {
1062 uint64_t u64; 1243 uint64_t u64;
1063 struct cvmx_agl_gmx_tx_int_en_s { 1244 struct cvmx_agl_gmx_tx_int_en_s {
1064 uint64_t reserved_18_63:46; 1245 uint64_t reserved_22_63:42;
1246 uint64_t ptp_lost:2;
1247 uint64_t reserved_18_19:2;
1065 uint64_t late_col:2; 1248 uint64_t late_col:2;
1066 uint64_t reserved_14_15:2; 1249 uint64_t reserved_14_15:2;
1067 uint64_t xsdef:2; 1250 uint64_t xsdef:2;
@@ -1072,8 +1255,19 @@ union cvmx_agl_gmx_tx_int_en {
1072 uint64_t reserved_1_1:1; 1255 uint64_t reserved_1_1:1;
1073 uint64_t pko_nxa:1; 1256 uint64_t pko_nxa:1;
1074 } s; 1257 } s;
1075 struct cvmx_agl_gmx_tx_int_en_s cn52xx; 1258 struct cvmx_agl_gmx_tx_int_en_cn52xx {
1076 struct cvmx_agl_gmx_tx_int_en_s cn52xxp1; 1259 uint64_t reserved_18_63:46;
1260 uint64_t late_col:2;
1261 uint64_t reserved_14_15:2;
1262 uint64_t xsdef:2;
1263 uint64_t reserved_10_11:2;
1264 uint64_t xscol:2;
1265 uint64_t reserved_4_7:4;
1266 uint64_t undflw:2;
1267 uint64_t reserved_1_1:1;
1268 uint64_t pko_nxa:1;
1269 } cn52xx;
1270 struct cvmx_agl_gmx_tx_int_en_cn52xx cn52xxp1;
1077 struct cvmx_agl_gmx_tx_int_en_cn56xx { 1271 struct cvmx_agl_gmx_tx_int_en_cn56xx {
1078 uint64_t reserved_17_63:47; 1272 uint64_t reserved_17_63:47;
1079 uint64_t late_col:1; 1273 uint64_t late_col:1;
@@ -1087,12 +1281,16 @@ union cvmx_agl_gmx_tx_int_en {
1087 uint64_t pko_nxa:1; 1281 uint64_t pko_nxa:1;
1088 } cn56xx; 1282 } cn56xx;
1089 struct cvmx_agl_gmx_tx_int_en_cn56xx cn56xxp1; 1283 struct cvmx_agl_gmx_tx_int_en_cn56xx cn56xxp1;
1284 struct cvmx_agl_gmx_tx_int_en_s cn63xx;
1285 struct cvmx_agl_gmx_tx_int_en_s cn63xxp1;
1090}; 1286};
1091 1287
1092union cvmx_agl_gmx_tx_int_reg { 1288union cvmx_agl_gmx_tx_int_reg {
1093 uint64_t u64; 1289 uint64_t u64;
1094 struct cvmx_agl_gmx_tx_int_reg_s { 1290 struct cvmx_agl_gmx_tx_int_reg_s {
1095 uint64_t reserved_18_63:46; 1291 uint64_t reserved_22_63:42;
1292 uint64_t ptp_lost:2;
1293 uint64_t reserved_18_19:2;
1096 uint64_t late_col:2; 1294 uint64_t late_col:2;
1097 uint64_t reserved_14_15:2; 1295 uint64_t reserved_14_15:2;
1098 uint64_t xsdef:2; 1296 uint64_t xsdef:2;
@@ -1103,8 +1301,19 @@ union cvmx_agl_gmx_tx_int_reg {
1103 uint64_t reserved_1_1:1; 1301 uint64_t reserved_1_1:1;
1104 uint64_t pko_nxa:1; 1302 uint64_t pko_nxa:1;
1105 } s; 1303 } s;
1106 struct cvmx_agl_gmx_tx_int_reg_s cn52xx; 1304 struct cvmx_agl_gmx_tx_int_reg_cn52xx {
1107 struct cvmx_agl_gmx_tx_int_reg_s cn52xxp1; 1305 uint64_t reserved_18_63:46;
1306 uint64_t late_col:2;
1307 uint64_t reserved_14_15:2;
1308 uint64_t xsdef:2;
1309 uint64_t reserved_10_11:2;
1310 uint64_t xscol:2;
1311 uint64_t reserved_4_7:4;
1312 uint64_t undflw:2;
1313 uint64_t reserved_1_1:1;
1314 uint64_t pko_nxa:1;
1315 } cn52xx;
1316 struct cvmx_agl_gmx_tx_int_reg_cn52xx cn52xxp1;
1108 struct cvmx_agl_gmx_tx_int_reg_cn56xx { 1317 struct cvmx_agl_gmx_tx_int_reg_cn56xx {
1109 uint64_t reserved_17_63:47; 1318 uint64_t reserved_17_63:47;
1110 uint64_t late_col:1; 1319 uint64_t late_col:1;
@@ -1118,6 +1327,8 @@ union cvmx_agl_gmx_tx_int_reg {
1118 uint64_t pko_nxa:1; 1327 uint64_t pko_nxa:1;
1119 } cn56xx; 1328 } cn56xx;
1120 struct cvmx_agl_gmx_tx_int_reg_cn56xx cn56xxp1; 1329 struct cvmx_agl_gmx_tx_int_reg_cn56xx cn56xxp1;
1330 struct cvmx_agl_gmx_tx_int_reg_s cn63xx;
1331 struct cvmx_agl_gmx_tx_int_reg_s cn63xxp1;
1121}; 1332};
1122 1333
1123union cvmx_agl_gmx_tx_jam { 1334union cvmx_agl_gmx_tx_jam {
@@ -1130,6 +1341,8 @@ union cvmx_agl_gmx_tx_jam {
1130 struct cvmx_agl_gmx_tx_jam_s cn52xxp1; 1341 struct cvmx_agl_gmx_tx_jam_s cn52xxp1;
1131 struct cvmx_agl_gmx_tx_jam_s cn56xx; 1342 struct cvmx_agl_gmx_tx_jam_s cn56xx;
1132 struct cvmx_agl_gmx_tx_jam_s cn56xxp1; 1343 struct cvmx_agl_gmx_tx_jam_s cn56xxp1;
1344 struct cvmx_agl_gmx_tx_jam_s cn63xx;
1345 struct cvmx_agl_gmx_tx_jam_s cn63xxp1;
1133}; 1346};
1134 1347
1135union cvmx_agl_gmx_tx_lfsr { 1348union cvmx_agl_gmx_tx_lfsr {
@@ -1142,6 +1355,8 @@ union cvmx_agl_gmx_tx_lfsr {
1142 struct cvmx_agl_gmx_tx_lfsr_s cn52xxp1; 1355 struct cvmx_agl_gmx_tx_lfsr_s cn52xxp1;
1143 struct cvmx_agl_gmx_tx_lfsr_s cn56xx; 1356 struct cvmx_agl_gmx_tx_lfsr_s cn56xx;
1144 struct cvmx_agl_gmx_tx_lfsr_s cn56xxp1; 1357 struct cvmx_agl_gmx_tx_lfsr_s cn56xxp1;
1358 struct cvmx_agl_gmx_tx_lfsr_s cn63xx;
1359 struct cvmx_agl_gmx_tx_lfsr_s cn63xxp1;
1145}; 1360};
1146 1361
1147union cvmx_agl_gmx_tx_ovr_bp { 1362union cvmx_agl_gmx_tx_ovr_bp {
@@ -1165,6 +1380,8 @@ union cvmx_agl_gmx_tx_ovr_bp {
1165 uint64_t ign_full:1; 1380 uint64_t ign_full:1;
1166 } cn56xx; 1381 } cn56xx;
1167 struct cvmx_agl_gmx_tx_ovr_bp_cn56xx cn56xxp1; 1382 struct cvmx_agl_gmx_tx_ovr_bp_cn56xx cn56xxp1;
1383 struct cvmx_agl_gmx_tx_ovr_bp_s cn63xx;
1384 struct cvmx_agl_gmx_tx_ovr_bp_s cn63xxp1;
1168}; 1385};
1169 1386
1170union cvmx_agl_gmx_tx_pause_pkt_dmac { 1387union cvmx_agl_gmx_tx_pause_pkt_dmac {
@@ -1177,6 +1394,8 @@ union cvmx_agl_gmx_tx_pause_pkt_dmac {
1177 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn52xxp1; 1394 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn52xxp1;
1178 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn56xx; 1395 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn56xx;
1179 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn56xxp1; 1396 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn56xxp1;
1397 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn63xx;
1398 struct cvmx_agl_gmx_tx_pause_pkt_dmac_s cn63xxp1;
1180}; 1399};
1181 1400
1182union cvmx_agl_gmx_tx_pause_pkt_type { 1401union cvmx_agl_gmx_tx_pause_pkt_type {
@@ -1189,6 +1408,39 @@ union cvmx_agl_gmx_tx_pause_pkt_type {
1189 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn52xxp1; 1408 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn52xxp1;
1190 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn56xx; 1409 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn56xx;
1191 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn56xxp1; 1410 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn56xxp1;
1411 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn63xx;
1412 struct cvmx_agl_gmx_tx_pause_pkt_type_s cn63xxp1;
1413};
1414
1415union cvmx_agl_prtx_ctl {
1416 uint64_t u64;
1417 struct cvmx_agl_prtx_ctl_s {
1418 uint64_t drv_byp:1;
1419 uint64_t reserved_62_62:1;
1420 uint64_t cmp_pctl:6;
1421 uint64_t reserved_54_55:2;
1422 uint64_t cmp_nctl:6;
1423 uint64_t reserved_46_47:2;
1424 uint64_t drv_pctl:6;
1425 uint64_t reserved_38_39:2;
1426 uint64_t drv_nctl:6;
1427 uint64_t reserved_29_31:3;
1428 uint64_t clk_set:5;
1429 uint64_t clkrx_byp:1;
1430 uint64_t reserved_21_22:2;
1431 uint64_t clkrx_set:5;
1432 uint64_t clktx_byp:1;
1433 uint64_t reserved_13_14:2;
1434 uint64_t clktx_set:5;
1435 uint64_t reserved_5_7:3;
1436 uint64_t dllrst:1;
1437 uint64_t comp:1;
1438 uint64_t enable:1;
1439 uint64_t clkrst:1;
1440 uint64_t mode:1;
1441 } s;
1442 struct cvmx_agl_prtx_ctl_s cn63xx;
1443 struct cvmx_agl_prtx_ctl_s cn63xxp1;
1192}; 1444};
1193 1445
1194#endif 1446#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-asm.h b/arch/mips/include/asm/octeon/cvmx-asm.h
index b21d3fc1ef91..5de5de95311b 100644
--- a/arch/mips/include/asm/octeon/cvmx-asm.h
+++ b/arch/mips/include/asm/octeon/cvmx-asm.h
@@ -114,6 +114,17 @@
114#define CVMX_DCACHE_INVALIDATE \ 114#define CVMX_DCACHE_INVALIDATE \
115 { CVMX_SYNC; asm volatile ("cache 9, 0($0)" : : ); } 115 { CVMX_SYNC; asm volatile ("cache 9, 0($0)" : : ); }
116 116
117#define CVMX_CACHE(op, address, offset) \
118 asm volatile ("cache " CVMX_TMP_STR(op) ", " CVMX_TMP_STR(offset) "(%[rbase])" \
119 : : [rbase] "d" (address) )
120/* fetch and lock the state. */
121#define CVMX_CACHE_LCKL2(address, offset) CVMX_CACHE(31, address, offset)
122/* unlock the state. */
123#define CVMX_CACHE_WBIL2(address, offset) CVMX_CACHE(23, address, offset)
124/* invalidate the cache block and clear the USED bits for the block */
125#define CVMX_CACHE_WBIL2I(address, offset) CVMX_CACHE(3, address, offset)
126/* load virtual tag and data for the L2 cache block into L2C_TAD0_TAG register */
127#define CVMX_CACHE_LTGL2I(address, offset) CVMX_CACHE(7, address, offset)
117 128
118#define CVMX_POP(result, input) \ 129#define CVMX_POP(result, input) \
119 asm ("pop %[rd],%[rs]" : [rd] "=d" (result) : [rs] "d" (input)) 130 asm ("pop %[rd],%[rs]" : [rd] "=d" (result) : [rs] "d" (input))
diff --git a/arch/mips/include/asm/octeon/cvmx-ciu-defs.h b/arch/mips/include/asm/octeon/cvmx-ciu-defs.h
index f8f05b7764b7..27cead370411 100644
--- a/arch/mips/include/asm/octeon/cvmx-ciu-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-ciu-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,87 +28,61 @@
28#ifndef __CVMX_CIU_DEFS_H__ 28#ifndef __CVMX_CIU_DEFS_H__
29#define __CVMX_CIU_DEFS_H__ 29#define __CVMX_CIU_DEFS_H__
30 30
31#define CVMX_CIU_BIST \ 31#define CVMX_CIU_BIST (CVMX_ADD_IO_SEG(0x0001070000000730ull))
32 CVMX_ADD_IO_SEG(0x0001070000000730ull) 32#define CVMX_CIU_BLOCK_INT (CVMX_ADD_IO_SEG(0x00010700000007C0ull))
33#define CVMX_CIU_DINT \ 33#define CVMX_CIU_DINT (CVMX_ADD_IO_SEG(0x0001070000000720ull))
34 CVMX_ADD_IO_SEG(0x0001070000000720ull) 34#define CVMX_CIU_FUSE (CVMX_ADD_IO_SEG(0x0001070000000728ull))
35#define CVMX_CIU_FUSE \ 35#define CVMX_CIU_GSTOP (CVMX_ADD_IO_SEG(0x0001070000000710ull))
36 CVMX_ADD_IO_SEG(0x0001070000000728ull) 36#define CVMX_CIU_INT33_SUM0 (CVMX_ADD_IO_SEG(0x0001070000000110ull))
37#define CVMX_CIU_GSTOP \ 37#define CVMX_CIU_INTX_EN0(offset) (CVMX_ADD_IO_SEG(0x0001070000000200ull) + ((offset) & 63) * 16)
38 CVMX_ADD_IO_SEG(0x0001070000000710ull) 38#define CVMX_CIU_INTX_EN0_W1C(offset) (CVMX_ADD_IO_SEG(0x0001070000002200ull) + ((offset) & 63) * 16)
39#define CVMX_CIU_INTX_EN0(offset) \ 39#define CVMX_CIU_INTX_EN0_W1S(offset) (CVMX_ADD_IO_SEG(0x0001070000006200ull) + ((offset) & 63) * 16)
40 CVMX_ADD_IO_SEG(0x0001070000000200ull + (((offset) & 63) * 16)) 40#define CVMX_CIU_INTX_EN1(offset) (CVMX_ADD_IO_SEG(0x0001070000000208ull) + ((offset) & 63) * 16)
41#define CVMX_CIU_INTX_EN0_W1C(offset) \ 41#define CVMX_CIU_INTX_EN1_W1C(offset) (CVMX_ADD_IO_SEG(0x0001070000002208ull) + ((offset) & 63) * 16)
42 CVMX_ADD_IO_SEG(0x0001070000002200ull + (((offset) & 63) * 16)) 42#define CVMX_CIU_INTX_EN1_W1S(offset) (CVMX_ADD_IO_SEG(0x0001070000006208ull) + ((offset) & 63) * 16)
43#define CVMX_CIU_INTX_EN0_W1S(offset) \ 43#define CVMX_CIU_INTX_EN4_0(offset) (CVMX_ADD_IO_SEG(0x0001070000000C80ull) + ((offset) & 15) * 16)
44 CVMX_ADD_IO_SEG(0x0001070000006200ull + (((offset) & 63) * 16)) 44#define CVMX_CIU_INTX_EN4_0_W1C(offset) (CVMX_ADD_IO_SEG(0x0001070000002C80ull) + ((offset) & 15) * 16)
45#define CVMX_CIU_INTX_EN1(offset) \ 45#define CVMX_CIU_INTX_EN4_0_W1S(offset) (CVMX_ADD_IO_SEG(0x0001070000006C80ull) + ((offset) & 15) * 16)
46 CVMX_ADD_IO_SEG(0x0001070000000208ull + (((offset) & 63) * 16)) 46#define CVMX_CIU_INTX_EN4_1(offset) (CVMX_ADD_IO_SEG(0x0001070000000C88ull) + ((offset) & 15) * 16)
47#define CVMX_CIU_INTX_EN1_W1C(offset) \ 47#define CVMX_CIU_INTX_EN4_1_W1C(offset) (CVMX_ADD_IO_SEG(0x0001070000002C88ull) + ((offset) & 15) * 16)
48 CVMX_ADD_IO_SEG(0x0001070000002208ull + (((offset) & 63) * 16)) 48#define CVMX_CIU_INTX_EN4_1_W1S(offset) (CVMX_ADD_IO_SEG(0x0001070000006C88ull) + ((offset) & 15) * 16)
49#define CVMX_CIU_INTX_EN1_W1S(offset) \ 49#define CVMX_CIU_INTX_SUM0(offset) (CVMX_ADD_IO_SEG(0x0001070000000000ull) + ((offset) & 63) * 8)
50 CVMX_ADD_IO_SEG(0x0001070000006208ull + (((offset) & 63) * 16)) 50#define CVMX_CIU_INTX_SUM4(offset) (CVMX_ADD_IO_SEG(0x0001070000000C00ull) + ((offset) & 15) * 8)
51#define CVMX_CIU_INTX_EN4_0(offset) \ 51#define CVMX_CIU_INT_DBG_SEL (CVMX_ADD_IO_SEG(0x00010700000007D0ull))
52 CVMX_ADD_IO_SEG(0x0001070000000C80ull + (((offset) & 15) * 16)) 52#define CVMX_CIU_INT_SUM1 (CVMX_ADD_IO_SEG(0x0001070000000108ull))
53#define CVMX_CIU_INTX_EN4_0_W1C(offset) \ 53#define CVMX_CIU_MBOX_CLRX(offset) (CVMX_ADD_IO_SEG(0x0001070000000680ull) + ((offset) & 15) * 8)
54 CVMX_ADD_IO_SEG(0x0001070000002C80ull + (((offset) & 15) * 16)) 54#define CVMX_CIU_MBOX_SETX(offset) (CVMX_ADD_IO_SEG(0x0001070000000600ull) + ((offset) & 15) * 8)
55#define CVMX_CIU_INTX_EN4_0_W1S(offset) \ 55#define CVMX_CIU_NMI (CVMX_ADD_IO_SEG(0x0001070000000718ull))
56 CVMX_ADD_IO_SEG(0x0001070000006C80ull + (((offset) & 15) * 16)) 56#define CVMX_CIU_PCI_INTA (CVMX_ADD_IO_SEG(0x0001070000000750ull))
57#define CVMX_CIU_INTX_EN4_1(offset) \ 57#define CVMX_CIU_PP_DBG (CVMX_ADD_IO_SEG(0x0001070000000708ull))
58 CVMX_ADD_IO_SEG(0x0001070000000C88ull + (((offset) & 15) * 16)) 58#define CVMX_CIU_PP_POKEX(offset) (CVMX_ADD_IO_SEG(0x0001070000000580ull) + ((offset) & 15) * 8)
59#define CVMX_CIU_INTX_EN4_1_W1C(offset) \ 59#define CVMX_CIU_PP_RST (CVMX_ADD_IO_SEG(0x0001070000000700ull))
60 CVMX_ADD_IO_SEG(0x0001070000002C88ull + (((offset) & 15) * 16)) 60#define CVMX_CIU_QLM0 (CVMX_ADD_IO_SEG(0x0001070000000780ull))
61#define CVMX_CIU_INTX_EN4_1_W1S(offset) \ 61#define CVMX_CIU_QLM1 (CVMX_ADD_IO_SEG(0x0001070000000788ull))
62 CVMX_ADD_IO_SEG(0x0001070000006C88ull + (((offset) & 15) * 16)) 62#define CVMX_CIU_QLM2 (CVMX_ADD_IO_SEG(0x0001070000000790ull))
63#define CVMX_CIU_INTX_SUM0(offset) \ 63#define CVMX_CIU_QLM_DCOK (CVMX_ADD_IO_SEG(0x0001070000000760ull))
64 CVMX_ADD_IO_SEG(0x0001070000000000ull + (((offset) & 63) * 8)) 64#define CVMX_CIU_QLM_JTGC (CVMX_ADD_IO_SEG(0x0001070000000768ull))
65#define CVMX_CIU_INTX_SUM4(offset) \ 65#define CVMX_CIU_QLM_JTGD (CVMX_ADD_IO_SEG(0x0001070000000770ull))
66 CVMX_ADD_IO_SEG(0x0001070000000C00ull + (((offset) & 15) * 8)) 66#define CVMX_CIU_SOFT_BIST (CVMX_ADD_IO_SEG(0x0001070000000738ull))
67#define CVMX_CIU_INT_SUM1 \ 67#define CVMX_CIU_SOFT_PRST (CVMX_ADD_IO_SEG(0x0001070000000748ull))
68 CVMX_ADD_IO_SEG(0x0001070000000108ull) 68#define CVMX_CIU_SOFT_PRST1 (CVMX_ADD_IO_SEG(0x0001070000000758ull))
69#define CVMX_CIU_MBOX_CLRX(offset) \ 69#define CVMX_CIU_SOFT_RST (CVMX_ADD_IO_SEG(0x0001070000000740ull))
70 CVMX_ADD_IO_SEG(0x0001070000000680ull + (((offset) & 15) * 8)) 70#define CVMX_CIU_TIMX(offset) (CVMX_ADD_IO_SEG(0x0001070000000480ull) + ((offset) & 3) * 8)
71#define CVMX_CIU_MBOX_SETX(offset) \ 71#define CVMX_CIU_WDOGX(offset) (CVMX_ADD_IO_SEG(0x0001070000000500ull) + ((offset) & 15) * 8)
72 CVMX_ADD_IO_SEG(0x0001070000000600ull + (((offset) & 15) * 8))
73#define CVMX_CIU_NMI \
74 CVMX_ADD_IO_SEG(0x0001070000000718ull)
75#define CVMX_CIU_PCI_INTA \
76 CVMX_ADD_IO_SEG(0x0001070000000750ull)
77#define CVMX_CIU_PP_DBG \
78 CVMX_ADD_IO_SEG(0x0001070000000708ull)
79#define CVMX_CIU_PP_POKEX(offset) \
80 CVMX_ADD_IO_SEG(0x0001070000000580ull + (((offset) & 15) * 8))
81#define CVMX_CIU_PP_RST \
82 CVMX_ADD_IO_SEG(0x0001070000000700ull)
83#define CVMX_CIU_QLM_DCOK \
84 CVMX_ADD_IO_SEG(0x0001070000000760ull)
85#define CVMX_CIU_QLM_JTGC \
86 CVMX_ADD_IO_SEG(0x0001070000000768ull)
87#define CVMX_CIU_QLM_JTGD \
88 CVMX_ADD_IO_SEG(0x0001070000000770ull)
89#define CVMX_CIU_SOFT_BIST \
90 CVMX_ADD_IO_SEG(0x0001070000000738ull)
91#define CVMX_CIU_SOFT_PRST \
92 CVMX_ADD_IO_SEG(0x0001070000000748ull)
93#define CVMX_CIU_SOFT_PRST1 \
94 CVMX_ADD_IO_SEG(0x0001070000000758ull)
95#define CVMX_CIU_SOFT_RST \
96 CVMX_ADD_IO_SEG(0x0001070000000740ull)
97#define CVMX_CIU_TIMX(offset) \
98 CVMX_ADD_IO_SEG(0x0001070000000480ull + (((offset) & 3) * 8))
99#define CVMX_CIU_WDOGX(offset) \
100 CVMX_ADD_IO_SEG(0x0001070000000500ull + (((offset) & 15) * 8))
101 72
102union cvmx_ciu_bist { 73union cvmx_ciu_bist {
103 uint64_t u64; 74 uint64_t u64;
104 struct cvmx_ciu_bist_s { 75 struct cvmx_ciu_bist_s {
76 uint64_t reserved_5_63:59;
77 uint64_t bist:5;
78 } s;
79 struct cvmx_ciu_bist_cn30xx {
105 uint64_t reserved_4_63:60; 80 uint64_t reserved_4_63:60;
106 uint64_t bist:4; 81 uint64_t bist:4;
107 } s; 82 } cn30xx;
108 struct cvmx_ciu_bist_s cn30xx; 83 struct cvmx_ciu_bist_cn30xx cn31xx;
109 struct cvmx_ciu_bist_s cn31xx; 84 struct cvmx_ciu_bist_cn30xx cn38xx;
110 struct cvmx_ciu_bist_s cn38xx; 85 struct cvmx_ciu_bist_cn30xx cn38xxp2;
111 struct cvmx_ciu_bist_s cn38xxp2;
112 struct cvmx_ciu_bist_cn50xx { 86 struct cvmx_ciu_bist_cn50xx {
113 uint64_t reserved_2_63:62; 87 uint64_t reserved_2_63:62;
114 uint64_t bist:2; 88 uint64_t bist:2;
@@ -118,10 +92,57 @@ union cvmx_ciu_bist {
118 uint64_t bist:3; 92 uint64_t bist:3;
119 } cn52xx; 93 } cn52xx;
120 struct cvmx_ciu_bist_cn52xx cn52xxp1; 94 struct cvmx_ciu_bist_cn52xx cn52xxp1;
121 struct cvmx_ciu_bist_s cn56xx; 95 struct cvmx_ciu_bist_cn30xx cn56xx;
122 struct cvmx_ciu_bist_s cn56xxp1; 96 struct cvmx_ciu_bist_cn30xx cn56xxp1;
123 struct cvmx_ciu_bist_s cn58xx; 97 struct cvmx_ciu_bist_cn30xx cn58xx;
124 struct cvmx_ciu_bist_s cn58xxp1; 98 struct cvmx_ciu_bist_cn30xx cn58xxp1;
99 struct cvmx_ciu_bist_s cn63xx;
100 struct cvmx_ciu_bist_s cn63xxp1;
101};
102
103union cvmx_ciu_block_int {
104 uint64_t u64;
105 struct cvmx_ciu_block_int_s {
106 uint64_t reserved_43_63:21;
107 uint64_t ptp:1;
108 uint64_t dpi:1;
109 uint64_t dfm:1;
110 uint64_t reserved_34_39:6;
111 uint64_t srio1:1;
112 uint64_t srio0:1;
113 uint64_t reserved_31_31:1;
114 uint64_t iob:1;
115 uint64_t reserved_29_29:1;
116 uint64_t agl:1;
117 uint64_t reserved_27_27:1;
118 uint64_t pem1:1;
119 uint64_t pem0:1;
120 uint64_t reserved_23_24:2;
121 uint64_t asxpcs0:1;
122 uint64_t reserved_21_21:1;
123 uint64_t pip:1;
124 uint64_t reserved_18_19:2;
125 uint64_t lmc0:1;
126 uint64_t l2c:1;
127 uint64_t reserved_15_15:1;
128 uint64_t rad:1;
129 uint64_t usb:1;
130 uint64_t pow:1;
131 uint64_t tim:1;
132 uint64_t pko:1;
133 uint64_t ipd:1;
134 uint64_t reserved_8_8:1;
135 uint64_t zip:1;
136 uint64_t dfa:1;
137 uint64_t fpa:1;
138 uint64_t key:1;
139 uint64_t sli:1;
140 uint64_t reserved_2_2:1;
141 uint64_t gmx0:1;
142 uint64_t mio:1;
143 } s;
144 struct cvmx_ciu_block_int_s cn63xx;
145 struct cvmx_ciu_block_int_s cn63xxp1;
125}; 146};
126 147
127union cvmx_ciu_dint { 148union cvmx_ciu_dint {
@@ -153,6 +174,11 @@ union cvmx_ciu_dint {
153 struct cvmx_ciu_dint_cn56xx cn56xxp1; 174 struct cvmx_ciu_dint_cn56xx cn56xxp1;
154 struct cvmx_ciu_dint_s cn58xx; 175 struct cvmx_ciu_dint_s cn58xx;
155 struct cvmx_ciu_dint_s cn58xxp1; 176 struct cvmx_ciu_dint_s cn58xxp1;
177 struct cvmx_ciu_dint_cn63xx {
178 uint64_t reserved_6_63:58;
179 uint64_t dint:6;
180 } cn63xx;
181 struct cvmx_ciu_dint_cn63xx cn63xxp1;
156}; 182};
157 183
158union cvmx_ciu_fuse { 184union cvmx_ciu_fuse {
@@ -184,6 +210,11 @@ union cvmx_ciu_fuse {
184 struct cvmx_ciu_fuse_cn56xx cn56xxp1; 210 struct cvmx_ciu_fuse_cn56xx cn56xxp1;
185 struct cvmx_ciu_fuse_s cn58xx; 211 struct cvmx_ciu_fuse_s cn58xx;
186 struct cvmx_ciu_fuse_s cn58xxp1; 212 struct cvmx_ciu_fuse_s cn58xxp1;
213 struct cvmx_ciu_fuse_cn63xx {
214 uint64_t reserved_6_63:58;
215 uint64_t fuse:6;
216 } cn63xx;
217 struct cvmx_ciu_fuse_cn63xx cn63xxp1;
187}; 218};
188 219
189union cvmx_ciu_gstop { 220union cvmx_ciu_gstop {
@@ -203,6 +234,8 @@ union cvmx_ciu_gstop {
203 struct cvmx_ciu_gstop_s cn56xxp1; 234 struct cvmx_ciu_gstop_s cn56xxp1;
204 struct cvmx_ciu_gstop_s cn58xx; 235 struct cvmx_ciu_gstop_s cn58xx;
205 struct cvmx_ciu_gstop_s cn58xxp1; 236 struct cvmx_ciu_gstop_s cn58xxp1;
237 struct cvmx_ciu_gstop_s cn63xx;
238 struct cvmx_ciu_gstop_s cn63xxp1;
206}; 239};
207 240
208union cvmx_ciu_intx_en0 { 241union cvmx_ciu_intx_en0 {
@@ -343,6 +376,8 @@ union cvmx_ciu_intx_en0 {
343 struct cvmx_ciu_intx_en0_cn56xx cn56xxp1; 376 struct cvmx_ciu_intx_en0_cn56xx cn56xxp1;
344 struct cvmx_ciu_intx_en0_cn38xx cn58xx; 377 struct cvmx_ciu_intx_en0_cn38xx cn58xx;
345 struct cvmx_ciu_intx_en0_cn38xx cn58xxp1; 378 struct cvmx_ciu_intx_en0_cn38xx cn58xxp1;
379 struct cvmx_ciu_intx_en0_cn52xx cn63xx;
380 struct cvmx_ciu_intx_en0_cn52xx cn63xxp1;
346}; 381};
347 382
348union cvmx_ciu_intx_en0_w1c { 383union cvmx_ciu_intx_en0_w1c {
@@ -412,6 +447,8 @@ union cvmx_ciu_intx_en0_w1c {
412 uint64_t gpio:16; 447 uint64_t gpio:16;
413 uint64_t workq:16; 448 uint64_t workq:16;
414 } cn58xx; 449 } cn58xx;
450 struct cvmx_ciu_intx_en0_w1c_cn52xx cn63xx;
451 struct cvmx_ciu_intx_en0_w1c_cn52xx cn63xxp1;
415}; 452};
416 453
417union cvmx_ciu_intx_en0_w1s { 454union cvmx_ciu_intx_en0_w1s {
@@ -481,12 +518,42 @@ union cvmx_ciu_intx_en0_w1s {
481 uint64_t gpio:16; 518 uint64_t gpio:16;
482 uint64_t workq:16; 519 uint64_t workq:16;
483 } cn58xx; 520 } cn58xx;
521 struct cvmx_ciu_intx_en0_w1s_cn52xx cn63xx;
522 struct cvmx_ciu_intx_en0_w1s_cn52xx cn63xxp1;
484}; 523};
485 524
486union cvmx_ciu_intx_en1 { 525union cvmx_ciu_intx_en1 {
487 uint64_t u64; 526 uint64_t u64;
488 struct cvmx_ciu_intx_en1_s { 527 struct cvmx_ciu_intx_en1_s {
489 uint64_t reserved_20_63:44; 528 uint64_t rst:1;
529 uint64_t reserved_57_62:6;
530 uint64_t dfm:1;
531 uint64_t reserved_53_55:3;
532 uint64_t lmc0:1;
533 uint64_t srio1:1;
534 uint64_t srio0:1;
535 uint64_t pem1:1;
536 uint64_t pem0:1;
537 uint64_t ptp:1;
538 uint64_t agl:1;
539 uint64_t reserved_37_45:9;
540 uint64_t agx0:1;
541 uint64_t dpi:1;
542 uint64_t sli:1;
543 uint64_t usb:1;
544 uint64_t dfa:1;
545 uint64_t key:1;
546 uint64_t rad:1;
547 uint64_t tim:1;
548 uint64_t zip:1;
549 uint64_t pko:1;
550 uint64_t pip:1;
551 uint64_t ipd:1;
552 uint64_t l2c:1;
553 uint64_t pow:1;
554 uint64_t fpa:1;
555 uint64_t iob:1;
556 uint64_t mio:1;
490 uint64_t nand:1; 557 uint64_t nand:1;
491 uint64_t mii1:1; 558 uint64_t mii1:1;
492 uint64_t usb1:1; 559 uint64_t usb1:1;
@@ -531,12 +598,76 @@ union cvmx_ciu_intx_en1 {
531 struct cvmx_ciu_intx_en1_cn56xx cn56xxp1; 598 struct cvmx_ciu_intx_en1_cn56xx cn56xxp1;
532 struct cvmx_ciu_intx_en1_cn38xx cn58xx; 599 struct cvmx_ciu_intx_en1_cn38xx cn58xx;
533 struct cvmx_ciu_intx_en1_cn38xx cn58xxp1; 600 struct cvmx_ciu_intx_en1_cn38xx cn58xxp1;
601 struct cvmx_ciu_intx_en1_cn63xx {
602 uint64_t rst:1;
603 uint64_t reserved_57_62:6;
604 uint64_t dfm:1;
605 uint64_t reserved_53_55:3;
606 uint64_t lmc0:1;
607 uint64_t srio1:1;
608 uint64_t srio0:1;
609 uint64_t pem1:1;
610 uint64_t pem0:1;
611 uint64_t ptp:1;
612 uint64_t agl:1;
613 uint64_t reserved_37_45:9;
614 uint64_t agx0:1;
615 uint64_t dpi:1;
616 uint64_t sli:1;
617 uint64_t usb:1;
618 uint64_t dfa:1;
619 uint64_t key:1;
620 uint64_t rad:1;
621 uint64_t tim:1;
622 uint64_t zip:1;
623 uint64_t pko:1;
624 uint64_t pip:1;
625 uint64_t ipd:1;
626 uint64_t l2c:1;
627 uint64_t pow:1;
628 uint64_t fpa:1;
629 uint64_t iob:1;
630 uint64_t mio:1;
631 uint64_t nand:1;
632 uint64_t mii1:1;
633 uint64_t reserved_6_17:12;
634 uint64_t wdog:6;
635 } cn63xx;
636 struct cvmx_ciu_intx_en1_cn63xx cn63xxp1;
534}; 637};
535 638
536union cvmx_ciu_intx_en1_w1c { 639union cvmx_ciu_intx_en1_w1c {
537 uint64_t u64; 640 uint64_t u64;
538 struct cvmx_ciu_intx_en1_w1c_s { 641 struct cvmx_ciu_intx_en1_w1c_s {
539 uint64_t reserved_20_63:44; 642 uint64_t rst:1;
643 uint64_t reserved_57_62:6;
644 uint64_t dfm:1;
645 uint64_t reserved_53_55:3;
646 uint64_t lmc0:1;
647 uint64_t srio1:1;
648 uint64_t srio0:1;
649 uint64_t pem1:1;
650 uint64_t pem0:1;
651 uint64_t ptp:1;
652 uint64_t agl:1;
653 uint64_t reserved_37_45:9;
654 uint64_t agx0:1;
655 uint64_t dpi:1;
656 uint64_t sli:1;
657 uint64_t usb:1;
658 uint64_t dfa:1;
659 uint64_t key:1;
660 uint64_t rad:1;
661 uint64_t tim:1;
662 uint64_t zip:1;
663 uint64_t pko:1;
664 uint64_t pip:1;
665 uint64_t ipd:1;
666 uint64_t l2c:1;
667 uint64_t pow:1;
668 uint64_t fpa:1;
669 uint64_t iob:1;
670 uint64_t mio:1;
540 uint64_t nand:1; 671 uint64_t nand:1;
541 uint64_t mii1:1; 672 uint64_t mii1:1;
542 uint64_t usb1:1; 673 uint64_t usb1:1;
@@ -560,12 +691,76 @@ union cvmx_ciu_intx_en1_w1c {
560 uint64_t reserved_16_63:48; 691 uint64_t reserved_16_63:48;
561 uint64_t wdog:16; 692 uint64_t wdog:16;
562 } cn58xx; 693 } cn58xx;
694 struct cvmx_ciu_intx_en1_w1c_cn63xx {
695 uint64_t rst:1;
696 uint64_t reserved_57_62:6;
697 uint64_t dfm:1;
698 uint64_t reserved_53_55:3;
699 uint64_t lmc0:1;
700 uint64_t srio1:1;
701 uint64_t srio0:1;
702 uint64_t pem1:1;
703 uint64_t pem0:1;
704 uint64_t ptp:1;
705 uint64_t agl:1;
706 uint64_t reserved_37_45:9;
707 uint64_t agx0:1;
708 uint64_t dpi:1;
709 uint64_t sli:1;
710 uint64_t usb:1;
711 uint64_t dfa:1;
712 uint64_t key:1;
713 uint64_t rad:1;
714 uint64_t tim:1;
715 uint64_t zip:1;
716 uint64_t pko:1;
717 uint64_t pip:1;
718 uint64_t ipd:1;
719 uint64_t l2c:1;
720 uint64_t pow:1;
721 uint64_t fpa:1;
722 uint64_t iob:1;
723 uint64_t mio:1;
724 uint64_t nand:1;
725 uint64_t mii1:1;
726 uint64_t reserved_6_17:12;
727 uint64_t wdog:6;
728 } cn63xx;
729 struct cvmx_ciu_intx_en1_w1c_cn63xx cn63xxp1;
563}; 730};
564 731
565union cvmx_ciu_intx_en1_w1s { 732union cvmx_ciu_intx_en1_w1s {
566 uint64_t u64; 733 uint64_t u64;
567 struct cvmx_ciu_intx_en1_w1s_s { 734 struct cvmx_ciu_intx_en1_w1s_s {
568 uint64_t reserved_20_63:44; 735 uint64_t rst:1;
736 uint64_t reserved_57_62:6;
737 uint64_t dfm:1;
738 uint64_t reserved_53_55:3;
739 uint64_t lmc0:1;
740 uint64_t srio1:1;
741 uint64_t srio0:1;
742 uint64_t pem1:1;
743 uint64_t pem0:1;
744 uint64_t ptp:1;
745 uint64_t agl:1;
746 uint64_t reserved_37_45:9;
747 uint64_t agx0:1;
748 uint64_t dpi:1;
749 uint64_t sli:1;
750 uint64_t usb:1;
751 uint64_t dfa:1;
752 uint64_t key:1;
753 uint64_t rad:1;
754 uint64_t tim:1;
755 uint64_t zip:1;
756 uint64_t pko:1;
757 uint64_t pip:1;
758 uint64_t ipd:1;
759 uint64_t l2c:1;
760 uint64_t pow:1;
761 uint64_t fpa:1;
762 uint64_t iob:1;
763 uint64_t mio:1;
569 uint64_t nand:1; 764 uint64_t nand:1;
570 uint64_t mii1:1; 765 uint64_t mii1:1;
571 uint64_t usb1:1; 766 uint64_t usb1:1;
@@ -589,6 +784,42 @@ union cvmx_ciu_intx_en1_w1s {
589 uint64_t reserved_16_63:48; 784 uint64_t reserved_16_63:48;
590 uint64_t wdog:16; 785 uint64_t wdog:16;
591 } cn58xx; 786 } cn58xx;
787 struct cvmx_ciu_intx_en1_w1s_cn63xx {
788 uint64_t rst:1;
789 uint64_t reserved_57_62:6;
790 uint64_t dfm:1;
791 uint64_t reserved_53_55:3;
792 uint64_t lmc0:1;
793 uint64_t srio1:1;
794 uint64_t srio0:1;
795 uint64_t pem1:1;
796 uint64_t pem0:1;
797 uint64_t ptp:1;
798 uint64_t agl:1;
799 uint64_t reserved_37_45:9;
800 uint64_t agx0:1;
801 uint64_t dpi:1;
802 uint64_t sli:1;
803 uint64_t usb:1;
804 uint64_t dfa:1;
805 uint64_t key:1;
806 uint64_t rad:1;
807 uint64_t tim:1;
808 uint64_t zip:1;
809 uint64_t pko:1;
810 uint64_t pip:1;
811 uint64_t ipd:1;
812 uint64_t l2c:1;
813 uint64_t pow:1;
814 uint64_t fpa:1;
815 uint64_t iob:1;
816 uint64_t mio:1;
817 uint64_t nand:1;
818 uint64_t mii1:1;
819 uint64_t reserved_6_17:12;
820 uint64_t wdog:6;
821 } cn63xx;
822 struct cvmx_ciu_intx_en1_w1s_cn63xx cn63xxp1;
592}; 823};
593 824
594union cvmx_ciu_intx_en4_0 { 825union cvmx_ciu_intx_en4_0 {
@@ -705,6 +936,8 @@ union cvmx_ciu_intx_en4_0 {
705 uint64_t workq:16; 936 uint64_t workq:16;
706 } cn58xx; 937 } cn58xx;
707 struct cvmx_ciu_intx_en4_0_cn58xx cn58xxp1; 938 struct cvmx_ciu_intx_en4_0_cn58xx cn58xxp1;
939 struct cvmx_ciu_intx_en4_0_cn52xx cn63xx;
940 struct cvmx_ciu_intx_en4_0_cn52xx cn63xxp1;
708}; 941};
709 942
710union cvmx_ciu_intx_en4_0_w1c { 943union cvmx_ciu_intx_en4_0_w1c {
@@ -774,6 +1007,8 @@ union cvmx_ciu_intx_en4_0_w1c {
774 uint64_t gpio:16; 1007 uint64_t gpio:16;
775 uint64_t workq:16; 1008 uint64_t workq:16;
776 } cn58xx; 1009 } cn58xx;
1010 struct cvmx_ciu_intx_en4_0_w1c_cn52xx cn63xx;
1011 struct cvmx_ciu_intx_en4_0_w1c_cn52xx cn63xxp1;
777}; 1012};
778 1013
779union cvmx_ciu_intx_en4_0_w1s { 1014union cvmx_ciu_intx_en4_0_w1s {
@@ -843,12 +1078,42 @@ union cvmx_ciu_intx_en4_0_w1s {
843 uint64_t gpio:16; 1078 uint64_t gpio:16;
844 uint64_t workq:16; 1079 uint64_t workq:16;
845 } cn58xx; 1080 } cn58xx;
1081 struct cvmx_ciu_intx_en4_0_w1s_cn52xx cn63xx;
1082 struct cvmx_ciu_intx_en4_0_w1s_cn52xx cn63xxp1;
846}; 1083};
847 1084
848union cvmx_ciu_intx_en4_1 { 1085union cvmx_ciu_intx_en4_1 {
849 uint64_t u64; 1086 uint64_t u64;
850 struct cvmx_ciu_intx_en4_1_s { 1087 struct cvmx_ciu_intx_en4_1_s {
851 uint64_t reserved_20_63:44; 1088 uint64_t rst:1;
1089 uint64_t reserved_57_62:6;
1090 uint64_t dfm:1;
1091 uint64_t reserved_53_55:3;
1092 uint64_t lmc0:1;
1093 uint64_t srio1:1;
1094 uint64_t srio0:1;
1095 uint64_t pem1:1;
1096 uint64_t pem0:1;
1097 uint64_t ptp:1;
1098 uint64_t agl:1;
1099 uint64_t reserved_37_45:9;
1100 uint64_t agx0:1;
1101 uint64_t dpi:1;
1102 uint64_t sli:1;
1103 uint64_t usb:1;
1104 uint64_t dfa:1;
1105 uint64_t key:1;
1106 uint64_t rad:1;
1107 uint64_t tim:1;
1108 uint64_t zip:1;
1109 uint64_t pko:1;
1110 uint64_t pip:1;
1111 uint64_t ipd:1;
1112 uint64_t l2c:1;
1113 uint64_t pow:1;
1114 uint64_t fpa:1;
1115 uint64_t iob:1;
1116 uint64_t mio:1;
852 uint64_t nand:1; 1117 uint64_t nand:1;
853 uint64_t mii1:1; 1118 uint64_t mii1:1;
854 uint64_t usb1:1; 1119 uint64_t usb1:1;
@@ -886,12 +1151,76 @@ union cvmx_ciu_intx_en4_1 {
886 uint64_t wdog:16; 1151 uint64_t wdog:16;
887 } cn58xx; 1152 } cn58xx;
888 struct cvmx_ciu_intx_en4_1_cn58xx cn58xxp1; 1153 struct cvmx_ciu_intx_en4_1_cn58xx cn58xxp1;
1154 struct cvmx_ciu_intx_en4_1_cn63xx {
1155 uint64_t rst:1;
1156 uint64_t reserved_57_62:6;
1157 uint64_t dfm:1;
1158 uint64_t reserved_53_55:3;
1159 uint64_t lmc0:1;
1160 uint64_t srio1:1;
1161 uint64_t srio0:1;
1162 uint64_t pem1:1;
1163 uint64_t pem0:1;
1164 uint64_t ptp:1;
1165 uint64_t agl:1;
1166 uint64_t reserved_37_45:9;
1167 uint64_t agx0:1;
1168 uint64_t dpi:1;
1169 uint64_t sli:1;
1170 uint64_t usb:1;
1171 uint64_t dfa:1;
1172 uint64_t key:1;
1173 uint64_t rad:1;
1174 uint64_t tim:1;
1175 uint64_t zip:1;
1176 uint64_t pko:1;
1177 uint64_t pip:1;
1178 uint64_t ipd:1;
1179 uint64_t l2c:1;
1180 uint64_t pow:1;
1181 uint64_t fpa:1;
1182 uint64_t iob:1;
1183 uint64_t mio:1;
1184 uint64_t nand:1;
1185 uint64_t mii1:1;
1186 uint64_t reserved_6_17:12;
1187 uint64_t wdog:6;
1188 } cn63xx;
1189 struct cvmx_ciu_intx_en4_1_cn63xx cn63xxp1;
889}; 1190};
890 1191
891union cvmx_ciu_intx_en4_1_w1c { 1192union cvmx_ciu_intx_en4_1_w1c {
892 uint64_t u64; 1193 uint64_t u64;
893 struct cvmx_ciu_intx_en4_1_w1c_s { 1194 struct cvmx_ciu_intx_en4_1_w1c_s {
894 uint64_t reserved_20_63:44; 1195 uint64_t rst:1;
1196 uint64_t reserved_57_62:6;
1197 uint64_t dfm:1;
1198 uint64_t reserved_53_55:3;
1199 uint64_t lmc0:1;
1200 uint64_t srio1:1;
1201 uint64_t srio0:1;
1202 uint64_t pem1:1;
1203 uint64_t pem0:1;
1204 uint64_t ptp:1;
1205 uint64_t agl:1;
1206 uint64_t reserved_37_45:9;
1207 uint64_t agx0:1;
1208 uint64_t dpi:1;
1209 uint64_t sli:1;
1210 uint64_t usb:1;
1211 uint64_t dfa:1;
1212 uint64_t key:1;
1213 uint64_t rad:1;
1214 uint64_t tim:1;
1215 uint64_t zip:1;
1216 uint64_t pko:1;
1217 uint64_t pip:1;
1218 uint64_t ipd:1;
1219 uint64_t l2c:1;
1220 uint64_t pow:1;
1221 uint64_t fpa:1;
1222 uint64_t iob:1;
1223 uint64_t mio:1;
895 uint64_t nand:1; 1224 uint64_t nand:1;
896 uint64_t mii1:1; 1225 uint64_t mii1:1;
897 uint64_t usb1:1; 1226 uint64_t usb1:1;
@@ -915,12 +1244,76 @@ union cvmx_ciu_intx_en4_1_w1c {
915 uint64_t reserved_16_63:48; 1244 uint64_t reserved_16_63:48;
916 uint64_t wdog:16; 1245 uint64_t wdog:16;
917 } cn58xx; 1246 } cn58xx;
1247 struct cvmx_ciu_intx_en4_1_w1c_cn63xx {
1248 uint64_t rst:1;
1249 uint64_t reserved_57_62:6;
1250 uint64_t dfm:1;
1251 uint64_t reserved_53_55:3;
1252 uint64_t lmc0:1;
1253 uint64_t srio1:1;
1254 uint64_t srio0:1;
1255 uint64_t pem1:1;
1256 uint64_t pem0:1;
1257 uint64_t ptp:1;
1258 uint64_t agl:1;
1259 uint64_t reserved_37_45:9;
1260 uint64_t agx0:1;
1261 uint64_t dpi:1;
1262 uint64_t sli:1;
1263 uint64_t usb:1;
1264 uint64_t dfa:1;
1265 uint64_t key:1;
1266 uint64_t rad:1;
1267 uint64_t tim:1;
1268 uint64_t zip:1;
1269 uint64_t pko:1;
1270 uint64_t pip:1;
1271 uint64_t ipd:1;
1272 uint64_t l2c:1;
1273 uint64_t pow:1;
1274 uint64_t fpa:1;
1275 uint64_t iob:1;
1276 uint64_t mio:1;
1277 uint64_t nand:1;
1278 uint64_t mii1:1;
1279 uint64_t reserved_6_17:12;
1280 uint64_t wdog:6;
1281 } cn63xx;
1282 struct cvmx_ciu_intx_en4_1_w1c_cn63xx cn63xxp1;
918}; 1283};
919 1284
920union cvmx_ciu_intx_en4_1_w1s { 1285union cvmx_ciu_intx_en4_1_w1s {
921 uint64_t u64; 1286 uint64_t u64;
922 struct cvmx_ciu_intx_en4_1_w1s_s { 1287 struct cvmx_ciu_intx_en4_1_w1s_s {
923 uint64_t reserved_20_63:44; 1288 uint64_t rst:1;
1289 uint64_t reserved_57_62:6;
1290 uint64_t dfm:1;
1291 uint64_t reserved_53_55:3;
1292 uint64_t lmc0:1;
1293 uint64_t srio1:1;
1294 uint64_t srio0:1;
1295 uint64_t pem1:1;
1296 uint64_t pem0:1;
1297 uint64_t ptp:1;
1298 uint64_t agl:1;
1299 uint64_t reserved_37_45:9;
1300 uint64_t agx0:1;
1301 uint64_t dpi:1;
1302 uint64_t sli:1;
1303 uint64_t usb:1;
1304 uint64_t dfa:1;
1305 uint64_t key:1;
1306 uint64_t rad:1;
1307 uint64_t tim:1;
1308 uint64_t zip:1;
1309 uint64_t pko:1;
1310 uint64_t pip:1;
1311 uint64_t ipd:1;
1312 uint64_t l2c:1;
1313 uint64_t pow:1;
1314 uint64_t fpa:1;
1315 uint64_t iob:1;
1316 uint64_t mio:1;
924 uint64_t nand:1; 1317 uint64_t nand:1;
925 uint64_t mii1:1; 1318 uint64_t mii1:1;
926 uint64_t usb1:1; 1319 uint64_t usb1:1;
@@ -944,6 +1337,42 @@ union cvmx_ciu_intx_en4_1_w1s {
944 uint64_t reserved_16_63:48; 1337 uint64_t reserved_16_63:48;
945 uint64_t wdog:16; 1338 uint64_t wdog:16;
946 } cn58xx; 1339 } cn58xx;
1340 struct cvmx_ciu_intx_en4_1_w1s_cn63xx {
1341 uint64_t rst:1;
1342 uint64_t reserved_57_62:6;
1343 uint64_t dfm:1;
1344 uint64_t reserved_53_55:3;
1345 uint64_t lmc0:1;
1346 uint64_t srio1:1;
1347 uint64_t srio0:1;
1348 uint64_t pem1:1;
1349 uint64_t pem0:1;
1350 uint64_t ptp:1;
1351 uint64_t agl:1;
1352 uint64_t reserved_37_45:9;
1353 uint64_t agx0:1;
1354 uint64_t dpi:1;
1355 uint64_t sli:1;
1356 uint64_t usb:1;
1357 uint64_t dfa:1;
1358 uint64_t key:1;
1359 uint64_t rad:1;
1360 uint64_t tim:1;
1361 uint64_t zip:1;
1362 uint64_t pko:1;
1363 uint64_t pip:1;
1364 uint64_t ipd:1;
1365 uint64_t l2c:1;
1366 uint64_t pow:1;
1367 uint64_t fpa:1;
1368 uint64_t iob:1;
1369 uint64_t mio:1;
1370 uint64_t nand:1;
1371 uint64_t mii1:1;
1372 uint64_t reserved_6_17:12;
1373 uint64_t wdog:6;
1374 } cn63xx;
1375 struct cvmx_ciu_intx_en4_1_w1s_cn63xx cn63xxp1;
947}; 1376};
948 1377
949union cvmx_ciu_intx_sum0 { 1378union cvmx_ciu_intx_sum0 {
@@ -1084,6 +1513,8 @@ union cvmx_ciu_intx_sum0 {
1084 struct cvmx_ciu_intx_sum0_cn56xx cn56xxp1; 1513 struct cvmx_ciu_intx_sum0_cn56xx cn56xxp1;
1085 struct cvmx_ciu_intx_sum0_cn38xx cn58xx; 1514 struct cvmx_ciu_intx_sum0_cn38xx cn58xx;
1086 struct cvmx_ciu_intx_sum0_cn38xx cn58xxp1; 1515 struct cvmx_ciu_intx_sum0_cn38xx cn58xxp1;
1516 struct cvmx_ciu_intx_sum0_cn52xx cn63xx;
1517 struct cvmx_ciu_intx_sum0_cn52xx cn63xxp1;
1087}; 1518};
1088 1519
1089union cvmx_ciu_intx_sum4 { 1520union cvmx_ciu_intx_sum4 {
@@ -1200,12 +1631,85 @@ union cvmx_ciu_intx_sum4 {
1200 uint64_t workq:16; 1631 uint64_t workq:16;
1201 } cn58xx; 1632 } cn58xx;
1202 struct cvmx_ciu_intx_sum4_cn58xx cn58xxp1; 1633 struct cvmx_ciu_intx_sum4_cn58xx cn58xxp1;
1634 struct cvmx_ciu_intx_sum4_cn52xx cn63xx;
1635 struct cvmx_ciu_intx_sum4_cn52xx cn63xxp1;
1636};
1637
1638union cvmx_ciu_int33_sum0 {
1639 uint64_t u64;
1640 struct cvmx_ciu_int33_sum0_s {
1641 uint64_t bootdma:1;
1642 uint64_t mii:1;
1643 uint64_t ipdppthr:1;
1644 uint64_t powiq:1;
1645 uint64_t twsi2:1;
1646 uint64_t reserved_57_58:2;
1647 uint64_t usb:1;
1648 uint64_t timer:4;
1649 uint64_t reserved_51_51:1;
1650 uint64_t ipd_drp:1;
1651 uint64_t reserved_49_49:1;
1652 uint64_t gmx_drp:1;
1653 uint64_t trace:1;
1654 uint64_t rml:1;
1655 uint64_t twsi:1;
1656 uint64_t wdog_sum:1;
1657 uint64_t pci_msi:4;
1658 uint64_t pci_int:4;
1659 uint64_t uart:2;
1660 uint64_t mbox:2;
1661 uint64_t gpio:16;
1662 uint64_t workq:16;
1663 } s;
1664 struct cvmx_ciu_int33_sum0_s cn63xx;
1665 struct cvmx_ciu_int33_sum0_s cn63xxp1;
1666};
1667
1668union cvmx_ciu_int_dbg_sel {
1669 uint64_t u64;
1670 struct cvmx_ciu_int_dbg_sel_s {
1671 uint64_t reserved_19_63:45;
1672 uint64_t sel:3;
1673 uint64_t reserved_10_15:6;
1674 uint64_t irq:2;
1675 uint64_t reserved_3_7:5;
1676 uint64_t pp:3;
1677 } s;
1678 struct cvmx_ciu_int_dbg_sel_s cn63xx;
1203}; 1679};
1204 1680
1205union cvmx_ciu_int_sum1 { 1681union cvmx_ciu_int_sum1 {
1206 uint64_t u64; 1682 uint64_t u64;
1207 struct cvmx_ciu_int_sum1_s { 1683 struct cvmx_ciu_int_sum1_s {
1208 uint64_t reserved_20_63:44; 1684 uint64_t rst:1;
1685 uint64_t reserved_57_62:6;
1686 uint64_t dfm:1;
1687 uint64_t reserved_53_55:3;
1688 uint64_t lmc0:1;
1689 uint64_t srio1:1;
1690 uint64_t srio0:1;
1691 uint64_t pem1:1;
1692 uint64_t pem0:1;
1693 uint64_t ptp:1;
1694 uint64_t agl:1;
1695 uint64_t reserved_37_45:9;
1696 uint64_t agx0:1;
1697 uint64_t dpi:1;
1698 uint64_t sli:1;
1699 uint64_t usb:1;
1700 uint64_t dfa:1;
1701 uint64_t key:1;
1702 uint64_t rad:1;
1703 uint64_t tim:1;
1704 uint64_t zip:1;
1705 uint64_t pko:1;
1706 uint64_t pip:1;
1707 uint64_t ipd:1;
1708 uint64_t l2c:1;
1709 uint64_t pow:1;
1710 uint64_t fpa:1;
1711 uint64_t iob:1;
1712 uint64_t mio:1;
1209 uint64_t nand:1; 1713 uint64_t nand:1;
1210 uint64_t mii1:1; 1714 uint64_t mii1:1;
1211 uint64_t usb1:1; 1715 uint64_t usb1:1;
@@ -1250,6 +1754,42 @@ union cvmx_ciu_int_sum1 {
1250 struct cvmx_ciu_int_sum1_cn56xx cn56xxp1; 1754 struct cvmx_ciu_int_sum1_cn56xx cn56xxp1;
1251 struct cvmx_ciu_int_sum1_cn38xx cn58xx; 1755 struct cvmx_ciu_int_sum1_cn38xx cn58xx;
1252 struct cvmx_ciu_int_sum1_cn38xx cn58xxp1; 1756 struct cvmx_ciu_int_sum1_cn38xx cn58xxp1;
1757 struct cvmx_ciu_int_sum1_cn63xx {
1758 uint64_t rst:1;
1759 uint64_t reserved_57_62:6;
1760 uint64_t dfm:1;
1761 uint64_t reserved_53_55:3;
1762 uint64_t lmc0:1;
1763 uint64_t srio1:1;
1764 uint64_t srio0:1;
1765 uint64_t pem1:1;
1766 uint64_t pem0:1;
1767 uint64_t ptp:1;
1768 uint64_t agl:1;
1769 uint64_t reserved_37_45:9;
1770 uint64_t agx0:1;
1771 uint64_t dpi:1;
1772 uint64_t sli:1;
1773 uint64_t usb:1;
1774 uint64_t dfa:1;
1775 uint64_t key:1;
1776 uint64_t rad:1;
1777 uint64_t tim:1;
1778 uint64_t zip:1;
1779 uint64_t pko:1;
1780 uint64_t pip:1;
1781 uint64_t ipd:1;
1782 uint64_t l2c:1;
1783 uint64_t pow:1;
1784 uint64_t fpa:1;
1785 uint64_t iob:1;
1786 uint64_t mio:1;
1787 uint64_t nand:1;
1788 uint64_t mii1:1;
1789 uint64_t reserved_6_17:12;
1790 uint64_t wdog:6;
1791 } cn63xx;
1792 struct cvmx_ciu_int_sum1_cn63xx cn63xxp1;
1253}; 1793};
1254 1794
1255union cvmx_ciu_mbox_clrx { 1795union cvmx_ciu_mbox_clrx {
@@ -1269,6 +1809,8 @@ union cvmx_ciu_mbox_clrx {
1269 struct cvmx_ciu_mbox_clrx_s cn56xxp1; 1809 struct cvmx_ciu_mbox_clrx_s cn56xxp1;
1270 struct cvmx_ciu_mbox_clrx_s cn58xx; 1810 struct cvmx_ciu_mbox_clrx_s cn58xx;
1271 struct cvmx_ciu_mbox_clrx_s cn58xxp1; 1811 struct cvmx_ciu_mbox_clrx_s cn58xxp1;
1812 struct cvmx_ciu_mbox_clrx_s cn63xx;
1813 struct cvmx_ciu_mbox_clrx_s cn63xxp1;
1272}; 1814};
1273 1815
1274union cvmx_ciu_mbox_setx { 1816union cvmx_ciu_mbox_setx {
@@ -1288,6 +1830,8 @@ union cvmx_ciu_mbox_setx {
1288 struct cvmx_ciu_mbox_setx_s cn56xxp1; 1830 struct cvmx_ciu_mbox_setx_s cn56xxp1;
1289 struct cvmx_ciu_mbox_setx_s cn58xx; 1831 struct cvmx_ciu_mbox_setx_s cn58xx;
1290 struct cvmx_ciu_mbox_setx_s cn58xxp1; 1832 struct cvmx_ciu_mbox_setx_s cn58xxp1;
1833 struct cvmx_ciu_mbox_setx_s cn63xx;
1834 struct cvmx_ciu_mbox_setx_s cn63xxp1;
1291}; 1835};
1292 1836
1293union cvmx_ciu_nmi { 1837union cvmx_ciu_nmi {
@@ -1319,6 +1863,11 @@ union cvmx_ciu_nmi {
1319 struct cvmx_ciu_nmi_cn56xx cn56xxp1; 1863 struct cvmx_ciu_nmi_cn56xx cn56xxp1;
1320 struct cvmx_ciu_nmi_s cn58xx; 1864 struct cvmx_ciu_nmi_s cn58xx;
1321 struct cvmx_ciu_nmi_s cn58xxp1; 1865 struct cvmx_ciu_nmi_s cn58xxp1;
1866 struct cvmx_ciu_nmi_cn63xx {
1867 uint64_t reserved_6_63:58;
1868 uint64_t nmi:6;
1869 } cn63xx;
1870 struct cvmx_ciu_nmi_cn63xx cn63xxp1;
1322}; 1871};
1323 1872
1324union cvmx_ciu_pci_inta { 1873union cvmx_ciu_pci_inta {
@@ -1338,6 +1887,8 @@ union cvmx_ciu_pci_inta {
1338 struct cvmx_ciu_pci_inta_s cn56xxp1; 1887 struct cvmx_ciu_pci_inta_s cn56xxp1;
1339 struct cvmx_ciu_pci_inta_s cn58xx; 1888 struct cvmx_ciu_pci_inta_s cn58xx;
1340 struct cvmx_ciu_pci_inta_s cn58xxp1; 1889 struct cvmx_ciu_pci_inta_s cn58xxp1;
1890 struct cvmx_ciu_pci_inta_s cn63xx;
1891 struct cvmx_ciu_pci_inta_s cn63xxp1;
1341}; 1892};
1342 1893
1343union cvmx_ciu_pp_dbg { 1894union cvmx_ciu_pp_dbg {
@@ -1369,12 +1920,17 @@ union cvmx_ciu_pp_dbg {
1369 struct cvmx_ciu_pp_dbg_cn56xx cn56xxp1; 1920 struct cvmx_ciu_pp_dbg_cn56xx cn56xxp1;
1370 struct cvmx_ciu_pp_dbg_s cn58xx; 1921 struct cvmx_ciu_pp_dbg_s cn58xx;
1371 struct cvmx_ciu_pp_dbg_s cn58xxp1; 1922 struct cvmx_ciu_pp_dbg_s cn58xxp1;
1923 struct cvmx_ciu_pp_dbg_cn63xx {
1924 uint64_t reserved_6_63:58;
1925 uint64_t ppdbg:6;
1926 } cn63xx;
1927 struct cvmx_ciu_pp_dbg_cn63xx cn63xxp1;
1372}; 1928};
1373 1929
1374union cvmx_ciu_pp_pokex { 1930union cvmx_ciu_pp_pokex {
1375 uint64_t u64; 1931 uint64_t u64;
1376 struct cvmx_ciu_pp_pokex_s { 1932 struct cvmx_ciu_pp_pokex_s {
1377 uint64_t reserved_0_63:64; 1933 uint64_t poke:64;
1378 } s; 1934 } s;
1379 struct cvmx_ciu_pp_pokex_s cn30xx; 1935 struct cvmx_ciu_pp_pokex_s cn30xx;
1380 struct cvmx_ciu_pp_pokex_s cn31xx; 1936 struct cvmx_ciu_pp_pokex_s cn31xx;
@@ -1387,6 +1943,8 @@ union cvmx_ciu_pp_pokex {
1387 struct cvmx_ciu_pp_pokex_s cn56xxp1; 1943 struct cvmx_ciu_pp_pokex_s cn56xxp1;
1388 struct cvmx_ciu_pp_pokex_s cn58xx; 1944 struct cvmx_ciu_pp_pokex_s cn58xx;
1389 struct cvmx_ciu_pp_pokex_s cn58xxp1; 1945 struct cvmx_ciu_pp_pokex_s cn58xxp1;
1946 struct cvmx_ciu_pp_pokex_s cn63xx;
1947 struct cvmx_ciu_pp_pokex_s cn63xxp1;
1390}; 1948};
1391 1949
1392union cvmx_ciu_pp_rst { 1950union cvmx_ciu_pp_rst {
@@ -1422,6 +1980,97 @@ union cvmx_ciu_pp_rst {
1422 struct cvmx_ciu_pp_rst_cn56xx cn56xxp1; 1980 struct cvmx_ciu_pp_rst_cn56xx cn56xxp1;
1423 struct cvmx_ciu_pp_rst_s cn58xx; 1981 struct cvmx_ciu_pp_rst_s cn58xx;
1424 struct cvmx_ciu_pp_rst_s cn58xxp1; 1982 struct cvmx_ciu_pp_rst_s cn58xxp1;
1983 struct cvmx_ciu_pp_rst_cn63xx {
1984 uint64_t reserved_6_63:58;
1985 uint64_t rst:5;
1986 uint64_t rst0:1;
1987 } cn63xx;
1988 struct cvmx_ciu_pp_rst_cn63xx cn63xxp1;
1989};
1990
1991union cvmx_ciu_qlm0 {
1992 uint64_t u64;
1993 struct cvmx_ciu_qlm0_s {
1994 uint64_t g2bypass:1;
1995 uint64_t reserved_53_62:10;
1996 uint64_t g2deemph:5;
1997 uint64_t reserved_45_47:3;
1998 uint64_t g2margin:5;
1999 uint64_t reserved_32_39:8;
2000 uint64_t txbypass:1;
2001 uint64_t reserved_21_30:10;
2002 uint64_t txdeemph:5;
2003 uint64_t reserved_13_15:3;
2004 uint64_t txmargin:5;
2005 uint64_t reserved_4_7:4;
2006 uint64_t lane_en:4;
2007 } s;
2008 struct cvmx_ciu_qlm0_s cn63xx;
2009 struct cvmx_ciu_qlm0_cn63xxp1 {
2010 uint64_t reserved_32_63:32;
2011 uint64_t txbypass:1;
2012 uint64_t reserved_20_30:11;
2013 uint64_t txdeemph:4;
2014 uint64_t reserved_13_15:3;
2015 uint64_t txmargin:5;
2016 uint64_t reserved_4_7:4;
2017 uint64_t lane_en:4;
2018 } cn63xxp1;
2019};
2020
2021union cvmx_ciu_qlm1 {
2022 uint64_t u64;
2023 struct cvmx_ciu_qlm1_s {
2024 uint64_t g2bypass:1;
2025 uint64_t reserved_53_62:10;
2026 uint64_t g2deemph:5;
2027 uint64_t reserved_45_47:3;
2028 uint64_t g2margin:5;
2029 uint64_t reserved_32_39:8;
2030 uint64_t txbypass:1;
2031 uint64_t reserved_21_30:10;
2032 uint64_t txdeemph:5;
2033 uint64_t reserved_13_15:3;
2034 uint64_t txmargin:5;
2035 uint64_t reserved_4_7:4;
2036 uint64_t lane_en:4;
2037 } s;
2038 struct cvmx_ciu_qlm1_s cn63xx;
2039 struct cvmx_ciu_qlm1_cn63xxp1 {
2040 uint64_t reserved_32_63:32;
2041 uint64_t txbypass:1;
2042 uint64_t reserved_20_30:11;
2043 uint64_t txdeemph:4;
2044 uint64_t reserved_13_15:3;
2045 uint64_t txmargin:5;
2046 uint64_t reserved_4_7:4;
2047 uint64_t lane_en:4;
2048 } cn63xxp1;
2049};
2050
2051union cvmx_ciu_qlm2 {
2052 uint64_t u64;
2053 struct cvmx_ciu_qlm2_s {
2054 uint64_t reserved_32_63:32;
2055 uint64_t txbypass:1;
2056 uint64_t reserved_21_30:10;
2057 uint64_t txdeemph:5;
2058 uint64_t reserved_13_15:3;
2059 uint64_t txmargin:5;
2060 uint64_t reserved_4_7:4;
2061 uint64_t lane_en:4;
2062 } s;
2063 struct cvmx_ciu_qlm2_s cn63xx;
2064 struct cvmx_ciu_qlm2_cn63xxp1 {
2065 uint64_t reserved_32_63:32;
2066 uint64_t txbypass:1;
2067 uint64_t reserved_20_30:11;
2068 uint64_t txdeemph:4;
2069 uint64_t reserved_13_15:3;
2070 uint64_t txmargin:5;
2071 uint64_t reserved_4_7:4;
2072 uint64_t lane_en:4;
2073 } cn63xxp1;
1425}; 2074};
1426 2075
1427union cvmx_ciu_qlm_dcok { 2076union cvmx_ciu_qlm_dcok {
@@ -1459,6 +2108,15 @@ union cvmx_ciu_qlm_jtgc {
1459 struct cvmx_ciu_qlm_jtgc_cn52xx cn52xxp1; 2108 struct cvmx_ciu_qlm_jtgc_cn52xx cn52xxp1;
1460 struct cvmx_ciu_qlm_jtgc_s cn56xx; 2109 struct cvmx_ciu_qlm_jtgc_s cn56xx;
1461 struct cvmx_ciu_qlm_jtgc_s cn56xxp1; 2110 struct cvmx_ciu_qlm_jtgc_s cn56xxp1;
2111 struct cvmx_ciu_qlm_jtgc_cn63xx {
2112 uint64_t reserved_11_63:53;
2113 uint64_t clk_div:3;
2114 uint64_t reserved_6_7:2;
2115 uint64_t mux_sel:2;
2116 uint64_t reserved_3_3:1;
2117 uint64_t bypass:3;
2118 } cn63xx;
2119 struct cvmx_ciu_qlm_jtgc_cn63xx cn63xxp1;
1462}; 2120};
1463 2121
1464union cvmx_ciu_qlm_jtgd { 2122union cvmx_ciu_qlm_jtgd {
@@ -1493,6 +2151,17 @@ union cvmx_ciu_qlm_jtgd {
1493 uint64_t shft_cnt:5; 2151 uint64_t shft_cnt:5;
1494 uint64_t shft_reg:32; 2152 uint64_t shft_reg:32;
1495 } cn56xxp1; 2153 } cn56xxp1;
2154 struct cvmx_ciu_qlm_jtgd_cn63xx {
2155 uint64_t capture:1;
2156 uint64_t shift:1;
2157 uint64_t update:1;
2158 uint64_t reserved_43_60:18;
2159 uint64_t select:3;
2160 uint64_t reserved_37_39:3;
2161 uint64_t shft_cnt:5;
2162 uint64_t shft_reg:32;
2163 } cn63xx;
2164 struct cvmx_ciu_qlm_jtgd_cn63xx cn63xxp1;
1496}; 2165};
1497 2166
1498union cvmx_ciu_soft_bist { 2167union cvmx_ciu_soft_bist {
@@ -1512,6 +2181,8 @@ union cvmx_ciu_soft_bist {
1512 struct cvmx_ciu_soft_bist_s cn56xxp1; 2181 struct cvmx_ciu_soft_bist_s cn56xxp1;
1513 struct cvmx_ciu_soft_bist_s cn58xx; 2182 struct cvmx_ciu_soft_bist_s cn58xx;
1514 struct cvmx_ciu_soft_bist_s cn58xxp1; 2183 struct cvmx_ciu_soft_bist_s cn58xxp1;
2184 struct cvmx_ciu_soft_bist_s cn63xx;
2185 struct cvmx_ciu_soft_bist_s cn63xxp1;
1515}; 2186};
1516 2187
1517union cvmx_ciu_soft_prst { 2188union cvmx_ciu_soft_prst {
@@ -1536,6 +2207,8 @@ union cvmx_ciu_soft_prst {
1536 struct cvmx_ciu_soft_prst_cn52xx cn56xxp1; 2207 struct cvmx_ciu_soft_prst_cn52xx cn56xxp1;
1537 struct cvmx_ciu_soft_prst_s cn58xx; 2208 struct cvmx_ciu_soft_prst_s cn58xx;
1538 struct cvmx_ciu_soft_prst_s cn58xxp1; 2209 struct cvmx_ciu_soft_prst_s cn58xxp1;
2210 struct cvmx_ciu_soft_prst_cn52xx cn63xx;
2211 struct cvmx_ciu_soft_prst_cn52xx cn63xxp1;
1539}; 2212};
1540 2213
1541union cvmx_ciu_soft_prst1 { 2214union cvmx_ciu_soft_prst1 {
@@ -1548,6 +2221,8 @@ union cvmx_ciu_soft_prst1 {
1548 struct cvmx_ciu_soft_prst1_s cn52xxp1; 2221 struct cvmx_ciu_soft_prst1_s cn52xxp1;
1549 struct cvmx_ciu_soft_prst1_s cn56xx; 2222 struct cvmx_ciu_soft_prst1_s cn56xx;
1550 struct cvmx_ciu_soft_prst1_s cn56xxp1; 2223 struct cvmx_ciu_soft_prst1_s cn56xxp1;
2224 struct cvmx_ciu_soft_prst1_s cn63xx;
2225 struct cvmx_ciu_soft_prst1_s cn63xxp1;
1551}; 2226};
1552 2227
1553union cvmx_ciu_soft_rst { 2228union cvmx_ciu_soft_rst {
@@ -1567,6 +2242,8 @@ union cvmx_ciu_soft_rst {
1567 struct cvmx_ciu_soft_rst_s cn56xxp1; 2242 struct cvmx_ciu_soft_rst_s cn56xxp1;
1568 struct cvmx_ciu_soft_rst_s cn58xx; 2243 struct cvmx_ciu_soft_rst_s cn58xx;
1569 struct cvmx_ciu_soft_rst_s cn58xxp1; 2244 struct cvmx_ciu_soft_rst_s cn58xxp1;
2245 struct cvmx_ciu_soft_rst_s cn63xx;
2246 struct cvmx_ciu_soft_rst_s cn63xxp1;
1570}; 2247};
1571 2248
1572union cvmx_ciu_timx { 2249union cvmx_ciu_timx {
@@ -1587,6 +2264,8 @@ union cvmx_ciu_timx {
1587 struct cvmx_ciu_timx_s cn56xxp1; 2264 struct cvmx_ciu_timx_s cn56xxp1;
1588 struct cvmx_ciu_timx_s cn58xx; 2265 struct cvmx_ciu_timx_s cn58xx;
1589 struct cvmx_ciu_timx_s cn58xxp1; 2266 struct cvmx_ciu_timx_s cn58xxp1;
2267 struct cvmx_ciu_timx_s cn63xx;
2268 struct cvmx_ciu_timx_s cn63xxp1;
1590}; 2269};
1591 2270
1592union cvmx_ciu_wdogx { 2271union cvmx_ciu_wdogx {
@@ -1611,6 +2290,8 @@ union cvmx_ciu_wdogx {
1611 struct cvmx_ciu_wdogx_s cn56xxp1; 2290 struct cvmx_ciu_wdogx_s cn56xxp1;
1612 struct cvmx_ciu_wdogx_s cn58xx; 2291 struct cvmx_ciu_wdogx_s cn58xx;
1613 struct cvmx_ciu_wdogx_s cn58xxp1; 2292 struct cvmx_ciu_wdogx_s cn58xxp1;
2293 struct cvmx_ciu_wdogx_s cn63xx;
2294 struct cvmx_ciu_wdogx_s cn63xxp1;
1614}; 2295};
1615 2296
1616#endif 2297#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-gpio-defs.h b/arch/mips/include/asm/octeon/cvmx-gpio-defs.h
index 5fdd6ba48a05..395564e8d1f0 100644
--- a/arch/mips/include/asm/octeon/cvmx-gpio-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-gpio-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,29 +28,22 @@
28#ifndef __CVMX_GPIO_DEFS_H__ 28#ifndef __CVMX_GPIO_DEFS_H__
29#define __CVMX_GPIO_DEFS_H__ 29#define __CVMX_GPIO_DEFS_H__
30 30
31#define CVMX_GPIO_BIT_CFGX(offset) \ 31#define CVMX_GPIO_BIT_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001070000000800ull) + ((offset) & 15) * 8)
32 CVMX_ADD_IO_SEG(0x0001070000000800ull + (((offset) & 15) * 8)) 32#define CVMX_GPIO_BOOT_ENA (CVMX_ADD_IO_SEG(0x00010700000008A8ull))
33#define CVMX_GPIO_BOOT_ENA \ 33#define CVMX_GPIO_CLK_GENX(offset) (CVMX_ADD_IO_SEG(0x00010700000008C0ull) + ((offset) & 3) * 8)
34 CVMX_ADD_IO_SEG(0x00010700000008A8ull) 34#define CVMX_GPIO_CLK_QLMX(offset) (CVMX_ADD_IO_SEG(0x00010700000008E0ull) + ((offset) & 1) * 8)
35#define CVMX_GPIO_CLK_GENX(offset) \ 35#define CVMX_GPIO_DBG_ENA (CVMX_ADD_IO_SEG(0x00010700000008A0ull))
36 CVMX_ADD_IO_SEG(0x00010700000008C0ull + (((offset) & 3) * 8)) 36#define CVMX_GPIO_INT_CLR (CVMX_ADD_IO_SEG(0x0001070000000898ull))
37#define CVMX_GPIO_DBG_ENA \ 37#define CVMX_GPIO_RX_DAT (CVMX_ADD_IO_SEG(0x0001070000000880ull))
38 CVMX_ADD_IO_SEG(0x00010700000008A0ull) 38#define CVMX_GPIO_TX_CLR (CVMX_ADD_IO_SEG(0x0001070000000890ull))
39#define CVMX_GPIO_INT_CLR \ 39#define CVMX_GPIO_TX_SET (CVMX_ADD_IO_SEG(0x0001070000000888ull))
40 CVMX_ADD_IO_SEG(0x0001070000000898ull) 40#define CVMX_GPIO_XBIT_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001070000000900ull) + ((offset) & 31) * 8 - 8*16)
41#define CVMX_GPIO_RX_DAT \
42 CVMX_ADD_IO_SEG(0x0001070000000880ull)
43#define CVMX_GPIO_TX_CLR \
44 CVMX_ADD_IO_SEG(0x0001070000000890ull)
45#define CVMX_GPIO_TX_SET \
46 CVMX_ADD_IO_SEG(0x0001070000000888ull)
47#define CVMX_GPIO_XBIT_CFGX(offset) \
48 CVMX_ADD_IO_SEG(0x0001070000000900ull + (((offset) & 31) * 8) - 8 * 16)
49 41
50union cvmx_gpio_bit_cfgx { 42union cvmx_gpio_bit_cfgx {
51 uint64_t u64; 43 uint64_t u64;
52 struct cvmx_gpio_bit_cfgx_s { 44 struct cvmx_gpio_bit_cfgx_s {
53 uint64_t reserved_15_63:49; 45 uint64_t reserved_17_63:47;
46 uint64_t synce_sel:2;
54 uint64_t clk_gen:1; 47 uint64_t clk_gen:1;
55 uint64_t clk_sel:2; 48 uint64_t clk_sel:2;
56 uint64_t fil_sel:4; 49 uint64_t fil_sel:4;
@@ -73,12 +66,24 @@ union cvmx_gpio_bit_cfgx {
73 struct cvmx_gpio_bit_cfgx_cn30xx cn38xx; 66 struct cvmx_gpio_bit_cfgx_cn30xx cn38xx;
74 struct cvmx_gpio_bit_cfgx_cn30xx cn38xxp2; 67 struct cvmx_gpio_bit_cfgx_cn30xx cn38xxp2;
75 struct cvmx_gpio_bit_cfgx_cn30xx cn50xx; 68 struct cvmx_gpio_bit_cfgx_cn30xx cn50xx;
76 struct cvmx_gpio_bit_cfgx_s cn52xx; 69 struct cvmx_gpio_bit_cfgx_cn52xx {
77 struct cvmx_gpio_bit_cfgx_s cn52xxp1; 70 uint64_t reserved_15_63:49;
78 struct cvmx_gpio_bit_cfgx_s cn56xx; 71 uint64_t clk_gen:1;
79 struct cvmx_gpio_bit_cfgx_s cn56xxp1; 72 uint64_t clk_sel:2;
73 uint64_t fil_sel:4;
74 uint64_t fil_cnt:4;
75 uint64_t int_type:1;
76 uint64_t int_en:1;
77 uint64_t rx_xor:1;
78 uint64_t tx_oe:1;
79 } cn52xx;
80 struct cvmx_gpio_bit_cfgx_cn52xx cn52xxp1;
81 struct cvmx_gpio_bit_cfgx_cn52xx cn56xx;
82 struct cvmx_gpio_bit_cfgx_cn52xx cn56xxp1;
80 struct cvmx_gpio_bit_cfgx_cn30xx cn58xx; 83 struct cvmx_gpio_bit_cfgx_cn30xx cn58xx;
81 struct cvmx_gpio_bit_cfgx_cn30xx cn58xxp1; 84 struct cvmx_gpio_bit_cfgx_cn30xx cn58xxp1;
85 struct cvmx_gpio_bit_cfgx_s cn63xx;
86 struct cvmx_gpio_bit_cfgx_s cn63xxp1;
82}; 87};
83 88
84union cvmx_gpio_boot_ena { 89union cvmx_gpio_boot_ena {
@@ -103,6 +108,19 @@ union cvmx_gpio_clk_genx {
103 struct cvmx_gpio_clk_genx_s cn52xxp1; 108 struct cvmx_gpio_clk_genx_s cn52xxp1;
104 struct cvmx_gpio_clk_genx_s cn56xx; 109 struct cvmx_gpio_clk_genx_s cn56xx;
105 struct cvmx_gpio_clk_genx_s cn56xxp1; 110 struct cvmx_gpio_clk_genx_s cn56xxp1;
111 struct cvmx_gpio_clk_genx_s cn63xx;
112 struct cvmx_gpio_clk_genx_s cn63xxp1;
113};
114
115union cvmx_gpio_clk_qlmx {
116 uint64_t u64;
117 struct cvmx_gpio_clk_qlmx_s {
118 uint64_t reserved_3_63:61;
119 uint64_t div:1;
120 uint64_t lane_sel:2;
121 } s;
122 struct cvmx_gpio_clk_qlmx_s cn63xx;
123 struct cvmx_gpio_clk_qlmx_s cn63xxp1;
106}; 124};
107 125
108union cvmx_gpio_dbg_ena { 126union cvmx_gpio_dbg_ena {
@@ -133,6 +151,8 @@ union cvmx_gpio_int_clr {
133 struct cvmx_gpio_int_clr_s cn56xxp1; 151 struct cvmx_gpio_int_clr_s cn56xxp1;
134 struct cvmx_gpio_int_clr_s cn58xx; 152 struct cvmx_gpio_int_clr_s cn58xx;
135 struct cvmx_gpio_int_clr_s cn58xxp1; 153 struct cvmx_gpio_int_clr_s cn58xxp1;
154 struct cvmx_gpio_int_clr_s cn63xx;
155 struct cvmx_gpio_int_clr_s cn63xxp1;
136}; 156};
137 157
138union cvmx_gpio_rx_dat { 158union cvmx_gpio_rx_dat {
@@ -155,6 +175,8 @@ union cvmx_gpio_rx_dat {
155 struct cvmx_gpio_rx_dat_cn38xx cn56xxp1; 175 struct cvmx_gpio_rx_dat_cn38xx cn56xxp1;
156 struct cvmx_gpio_rx_dat_cn38xx cn58xx; 176 struct cvmx_gpio_rx_dat_cn38xx cn58xx;
157 struct cvmx_gpio_rx_dat_cn38xx cn58xxp1; 177 struct cvmx_gpio_rx_dat_cn38xx cn58xxp1;
178 struct cvmx_gpio_rx_dat_cn38xx cn63xx;
179 struct cvmx_gpio_rx_dat_cn38xx cn63xxp1;
158}; 180};
159 181
160union cvmx_gpio_tx_clr { 182union cvmx_gpio_tx_clr {
@@ -177,6 +199,8 @@ union cvmx_gpio_tx_clr {
177 struct cvmx_gpio_tx_clr_cn38xx cn56xxp1; 199 struct cvmx_gpio_tx_clr_cn38xx cn56xxp1;
178 struct cvmx_gpio_tx_clr_cn38xx cn58xx; 200 struct cvmx_gpio_tx_clr_cn38xx cn58xx;
179 struct cvmx_gpio_tx_clr_cn38xx cn58xxp1; 201 struct cvmx_gpio_tx_clr_cn38xx cn58xxp1;
202 struct cvmx_gpio_tx_clr_cn38xx cn63xx;
203 struct cvmx_gpio_tx_clr_cn38xx cn63xxp1;
180}; 204};
181 205
182union cvmx_gpio_tx_set { 206union cvmx_gpio_tx_set {
@@ -199,6 +223,8 @@ union cvmx_gpio_tx_set {
199 struct cvmx_gpio_tx_set_cn38xx cn56xxp1; 223 struct cvmx_gpio_tx_set_cn38xx cn56xxp1;
200 struct cvmx_gpio_tx_set_cn38xx cn58xx; 224 struct cvmx_gpio_tx_set_cn38xx cn58xx;
201 struct cvmx_gpio_tx_set_cn38xx cn58xxp1; 225 struct cvmx_gpio_tx_set_cn38xx cn58xxp1;
226 struct cvmx_gpio_tx_set_cn38xx cn63xx;
227 struct cvmx_gpio_tx_set_cn38xx cn63xxp1;
202}; 228};
203 229
204union cvmx_gpio_xbit_cfgx { 230union cvmx_gpio_xbit_cfgx {
diff --git a/arch/mips/include/asm/octeon/cvmx-iob-defs.h b/arch/mips/include/asm/octeon/cvmx-iob-defs.h
index 0ee36baec500..d7d856c2483d 100644
--- a/arch/mips/include/asm/octeon/cvmx-iob-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-iob-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,55 +28,39 @@
28#ifndef __CVMX_IOB_DEFS_H__ 28#ifndef __CVMX_IOB_DEFS_H__
29#define __CVMX_IOB_DEFS_H__ 29#define __CVMX_IOB_DEFS_H__
30 30
31#define CVMX_IOB_BIST_STATUS \ 31#define CVMX_IOB_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011800F00007F8ull))
32 CVMX_ADD_IO_SEG(0x00011800F00007F8ull) 32#define CVMX_IOB_CTL_STATUS (CVMX_ADD_IO_SEG(0x00011800F0000050ull))
33#define CVMX_IOB_CTL_STATUS \ 33#define CVMX_IOB_DWB_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000028ull))
34 CVMX_ADD_IO_SEG(0x00011800F0000050ull) 34#define CVMX_IOB_FAU_TIMEOUT (CVMX_ADD_IO_SEG(0x00011800F0000000ull))
35#define CVMX_IOB_DWB_PRI_CNT \ 35#define CVMX_IOB_I2C_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000010ull))
36 CVMX_ADD_IO_SEG(0x00011800F0000028ull) 36#define CVMX_IOB_INB_CONTROL_MATCH (CVMX_ADD_IO_SEG(0x00011800F0000078ull))
37#define CVMX_IOB_FAU_TIMEOUT \ 37#define CVMX_IOB_INB_CONTROL_MATCH_ENB (CVMX_ADD_IO_SEG(0x00011800F0000088ull))
38 CVMX_ADD_IO_SEG(0x00011800F0000000ull) 38#define CVMX_IOB_INB_DATA_MATCH (CVMX_ADD_IO_SEG(0x00011800F0000070ull))
39#define CVMX_IOB_I2C_PRI_CNT \ 39#define CVMX_IOB_INB_DATA_MATCH_ENB (CVMX_ADD_IO_SEG(0x00011800F0000080ull))
40 CVMX_ADD_IO_SEG(0x00011800F0000010ull) 40#define CVMX_IOB_INT_ENB (CVMX_ADD_IO_SEG(0x00011800F0000060ull))
41#define CVMX_IOB_INB_CONTROL_MATCH \ 41#define CVMX_IOB_INT_SUM (CVMX_ADD_IO_SEG(0x00011800F0000058ull))
42 CVMX_ADD_IO_SEG(0x00011800F0000078ull) 42#define CVMX_IOB_N2C_L2C_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000020ull))
43#define CVMX_IOB_INB_CONTROL_MATCH_ENB \ 43#define CVMX_IOB_N2C_RSP_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000008ull))
44 CVMX_ADD_IO_SEG(0x00011800F0000088ull) 44#define CVMX_IOB_OUTB_COM_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000040ull))
45#define CVMX_IOB_INB_DATA_MATCH \ 45#define CVMX_IOB_OUTB_CONTROL_MATCH (CVMX_ADD_IO_SEG(0x00011800F0000098ull))
46 CVMX_ADD_IO_SEG(0x00011800F0000070ull) 46#define CVMX_IOB_OUTB_CONTROL_MATCH_ENB (CVMX_ADD_IO_SEG(0x00011800F00000A8ull))
47#define CVMX_IOB_INB_DATA_MATCH_ENB \ 47#define CVMX_IOB_OUTB_DATA_MATCH (CVMX_ADD_IO_SEG(0x00011800F0000090ull))
48 CVMX_ADD_IO_SEG(0x00011800F0000080ull) 48#define CVMX_IOB_OUTB_DATA_MATCH_ENB (CVMX_ADD_IO_SEG(0x00011800F00000A0ull))
49#define CVMX_IOB_INT_ENB \ 49#define CVMX_IOB_OUTB_FPA_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000048ull))
50 CVMX_ADD_IO_SEG(0x00011800F0000060ull) 50#define CVMX_IOB_OUTB_REQ_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000038ull))
51#define CVMX_IOB_INT_SUM \ 51#define CVMX_IOB_P2C_REQ_PRI_CNT (CVMX_ADD_IO_SEG(0x00011800F0000018ull))
52 CVMX_ADD_IO_SEG(0x00011800F0000058ull) 52#define CVMX_IOB_PKT_ERR (CVMX_ADD_IO_SEG(0x00011800F0000068ull))
53#define CVMX_IOB_N2C_L2C_PRI_CNT \ 53#define CVMX_IOB_TO_CMB_CREDITS (CVMX_ADD_IO_SEG(0x00011800F00000B0ull))
54 CVMX_ADD_IO_SEG(0x00011800F0000020ull)
55#define CVMX_IOB_N2C_RSP_PRI_CNT \
56 CVMX_ADD_IO_SEG(0x00011800F0000008ull)
57#define CVMX_IOB_OUTB_COM_PRI_CNT \
58 CVMX_ADD_IO_SEG(0x00011800F0000040ull)
59#define CVMX_IOB_OUTB_CONTROL_MATCH \
60 CVMX_ADD_IO_SEG(0x00011800F0000098ull)
61#define CVMX_IOB_OUTB_CONTROL_MATCH_ENB \
62 CVMX_ADD_IO_SEG(0x00011800F00000A8ull)
63#define CVMX_IOB_OUTB_DATA_MATCH \
64 CVMX_ADD_IO_SEG(0x00011800F0000090ull)
65#define CVMX_IOB_OUTB_DATA_MATCH_ENB \
66 CVMX_ADD_IO_SEG(0x00011800F00000A0ull)
67#define CVMX_IOB_OUTB_FPA_PRI_CNT \
68 CVMX_ADD_IO_SEG(0x00011800F0000048ull)
69#define CVMX_IOB_OUTB_REQ_PRI_CNT \
70 CVMX_ADD_IO_SEG(0x00011800F0000038ull)
71#define CVMX_IOB_P2C_REQ_PRI_CNT \
72 CVMX_ADD_IO_SEG(0x00011800F0000018ull)
73#define CVMX_IOB_PKT_ERR \
74 CVMX_ADD_IO_SEG(0x00011800F0000068ull)
75 54
76union cvmx_iob_bist_status { 55union cvmx_iob_bist_status {
77 uint64_t u64; 56 uint64_t u64;
78 struct cvmx_iob_bist_status_s { 57 struct cvmx_iob_bist_status_s {
79 uint64_t reserved_18_63:46; 58 uint64_t reserved_23_63:41;
59 uint64_t xmdfif:1;
60 uint64_t xmcfif:1;
61 uint64_t iorfif:1;
62 uint64_t rsdfif:1;
63 uint64_t iocfif:1;
80 uint64_t icnrcb:1; 64 uint64_t icnrcb:1;
81 uint64_t icr0:1; 65 uint64_t icr0:1;
82 uint64_t icr1:1; 66 uint64_t icr1:1;
@@ -96,40 +80,81 @@ union cvmx_iob_bist_status {
96 uint64_t ibd:1; 80 uint64_t ibd:1;
97 uint64_t icd:1; 81 uint64_t icd:1;
98 } s; 82 } s;
99 struct cvmx_iob_bist_status_s cn30xx; 83 struct cvmx_iob_bist_status_cn30xx {
100 struct cvmx_iob_bist_status_s cn31xx; 84 uint64_t reserved_18_63:46;
101 struct cvmx_iob_bist_status_s cn38xx; 85 uint64_t icnrcb:1;
102 struct cvmx_iob_bist_status_s cn38xxp2; 86 uint64_t icr0:1;
103 struct cvmx_iob_bist_status_s cn50xx; 87 uint64_t icr1:1;
104 struct cvmx_iob_bist_status_s cn52xx; 88 uint64_t icnr1:1;
105 struct cvmx_iob_bist_status_s cn52xxp1; 89 uint64_t icnr0:1;
106 struct cvmx_iob_bist_status_s cn56xx; 90 uint64_t ibdr0:1;
107 struct cvmx_iob_bist_status_s cn56xxp1; 91 uint64_t ibdr1:1;
108 struct cvmx_iob_bist_status_s cn58xx; 92 uint64_t ibr0:1;
109 struct cvmx_iob_bist_status_s cn58xxp1; 93 uint64_t ibr1:1;
94 uint64_t icnrt:1;
95 uint64_t ibrq0:1;
96 uint64_t ibrq1:1;
97 uint64_t icrn0:1;
98 uint64_t icrn1:1;
99 uint64_t icrp0:1;
100 uint64_t icrp1:1;
101 uint64_t ibd:1;
102 uint64_t icd:1;
103 } cn30xx;
104 struct cvmx_iob_bist_status_cn30xx cn31xx;
105 struct cvmx_iob_bist_status_cn30xx cn38xx;
106 struct cvmx_iob_bist_status_cn30xx cn38xxp2;
107 struct cvmx_iob_bist_status_cn30xx cn50xx;
108 struct cvmx_iob_bist_status_cn30xx cn52xx;
109 struct cvmx_iob_bist_status_cn30xx cn52xxp1;
110 struct cvmx_iob_bist_status_cn30xx cn56xx;
111 struct cvmx_iob_bist_status_cn30xx cn56xxp1;
112 struct cvmx_iob_bist_status_cn30xx cn58xx;
113 struct cvmx_iob_bist_status_cn30xx cn58xxp1;
114 struct cvmx_iob_bist_status_s cn63xx;
115 struct cvmx_iob_bist_status_s cn63xxp1;
110}; 116};
111 117
112union cvmx_iob_ctl_status { 118union cvmx_iob_ctl_status {
113 uint64_t u64; 119 uint64_t u64;
114 struct cvmx_iob_ctl_status_s { 120 struct cvmx_iob_ctl_status_s {
115 uint64_t reserved_5_63:59; 121 uint64_t reserved_10_63:54;
122 uint64_t xmc_per:4;
123 uint64_t rr_mode:1;
116 uint64_t outb_mat:1; 124 uint64_t outb_mat:1;
117 uint64_t inb_mat:1; 125 uint64_t inb_mat:1;
118 uint64_t pko_enb:1; 126 uint64_t pko_enb:1;
119 uint64_t dwb_enb:1; 127 uint64_t dwb_enb:1;
120 uint64_t fau_end:1; 128 uint64_t fau_end:1;
121 } s; 129 } s;
122 struct cvmx_iob_ctl_status_s cn30xx; 130 struct cvmx_iob_ctl_status_cn30xx {
123 struct cvmx_iob_ctl_status_s cn31xx; 131 uint64_t reserved_5_63:59;
124 struct cvmx_iob_ctl_status_s cn38xx; 132 uint64_t outb_mat:1;
125 struct cvmx_iob_ctl_status_s cn38xxp2; 133 uint64_t inb_mat:1;
126 struct cvmx_iob_ctl_status_s cn50xx; 134 uint64_t pko_enb:1;
127 struct cvmx_iob_ctl_status_s cn52xx; 135 uint64_t dwb_enb:1;
128 struct cvmx_iob_ctl_status_s cn52xxp1; 136 uint64_t fau_end:1;
129 struct cvmx_iob_ctl_status_s cn56xx; 137 } cn30xx;
130 struct cvmx_iob_ctl_status_s cn56xxp1; 138 struct cvmx_iob_ctl_status_cn30xx cn31xx;
131 struct cvmx_iob_ctl_status_s cn58xx; 139 struct cvmx_iob_ctl_status_cn30xx cn38xx;
132 struct cvmx_iob_ctl_status_s cn58xxp1; 140 struct cvmx_iob_ctl_status_cn30xx cn38xxp2;
141 struct cvmx_iob_ctl_status_cn30xx cn50xx;
142 struct cvmx_iob_ctl_status_cn52xx {
143 uint64_t reserved_6_63:58;
144 uint64_t rr_mode:1;
145 uint64_t outb_mat:1;
146 uint64_t inb_mat:1;
147 uint64_t pko_enb:1;
148 uint64_t dwb_enb:1;
149 uint64_t fau_end:1;
150 } cn52xx;
151 struct cvmx_iob_ctl_status_cn30xx cn52xxp1;
152 struct cvmx_iob_ctl_status_cn30xx cn56xx;
153 struct cvmx_iob_ctl_status_cn30xx cn56xxp1;
154 struct cvmx_iob_ctl_status_cn30xx cn58xx;
155 struct cvmx_iob_ctl_status_cn30xx cn58xxp1;
156 struct cvmx_iob_ctl_status_s cn63xx;
157 struct cvmx_iob_ctl_status_s cn63xxp1;
133}; 158};
134 159
135union cvmx_iob_dwb_pri_cnt { 160union cvmx_iob_dwb_pri_cnt {
@@ -147,6 +172,8 @@ union cvmx_iob_dwb_pri_cnt {
147 struct cvmx_iob_dwb_pri_cnt_s cn56xxp1; 172 struct cvmx_iob_dwb_pri_cnt_s cn56xxp1;
148 struct cvmx_iob_dwb_pri_cnt_s cn58xx; 173 struct cvmx_iob_dwb_pri_cnt_s cn58xx;
149 struct cvmx_iob_dwb_pri_cnt_s cn58xxp1; 174 struct cvmx_iob_dwb_pri_cnt_s cn58xxp1;
175 struct cvmx_iob_dwb_pri_cnt_s cn63xx;
176 struct cvmx_iob_dwb_pri_cnt_s cn63xxp1;
150}; 177};
151 178
152union cvmx_iob_fau_timeout { 179union cvmx_iob_fau_timeout {
@@ -167,6 +194,8 @@ union cvmx_iob_fau_timeout {
167 struct cvmx_iob_fau_timeout_s cn56xxp1; 194 struct cvmx_iob_fau_timeout_s cn56xxp1;
168 struct cvmx_iob_fau_timeout_s cn58xx; 195 struct cvmx_iob_fau_timeout_s cn58xx;
169 struct cvmx_iob_fau_timeout_s cn58xxp1; 196 struct cvmx_iob_fau_timeout_s cn58xxp1;
197 struct cvmx_iob_fau_timeout_s cn63xx;
198 struct cvmx_iob_fau_timeout_s cn63xxp1;
170}; 199};
171 200
172union cvmx_iob_i2c_pri_cnt { 201union cvmx_iob_i2c_pri_cnt {
@@ -184,6 +213,8 @@ union cvmx_iob_i2c_pri_cnt {
184 struct cvmx_iob_i2c_pri_cnt_s cn56xxp1; 213 struct cvmx_iob_i2c_pri_cnt_s cn56xxp1;
185 struct cvmx_iob_i2c_pri_cnt_s cn58xx; 214 struct cvmx_iob_i2c_pri_cnt_s cn58xx;
186 struct cvmx_iob_i2c_pri_cnt_s cn58xxp1; 215 struct cvmx_iob_i2c_pri_cnt_s cn58xxp1;
216 struct cvmx_iob_i2c_pri_cnt_s cn63xx;
217 struct cvmx_iob_i2c_pri_cnt_s cn63xxp1;
187}; 218};
188 219
189union cvmx_iob_inb_control_match { 220union cvmx_iob_inb_control_match {
@@ -206,6 +237,8 @@ union cvmx_iob_inb_control_match {
206 struct cvmx_iob_inb_control_match_s cn56xxp1; 237 struct cvmx_iob_inb_control_match_s cn56xxp1;
207 struct cvmx_iob_inb_control_match_s cn58xx; 238 struct cvmx_iob_inb_control_match_s cn58xx;
208 struct cvmx_iob_inb_control_match_s cn58xxp1; 239 struct cvmx_iob_inb_control_match_s cn58xxp1;
240 struct cvmx_iob_inb_control_match_s cn63xx;
241 struct cvmx_iob_inb_control_match_s cn63xxp1;
209}; 242};
210 243
211union cvmx_iob_inb_control_match_enb { 244union cvmx_iob_inb_control_match_enb {
@@ -228,6 +261,8 @@ union cvmx_iob_inb_control_match_enb {
228 struct cvmx_iob_inb_control_match_enb_s cn56xxp1; 261 struct cvmx_iob_inb_control_match_enb_s cn56xxp1;
229 struct cvmx_iob_inb_control_match_enb_s cn58xx; 262 struct cvmx_iob_inb_control_match_enb_s cn58xx;
230 struct cvmx_iob_inb_control_match_enb_s cn58xxp1; 263 struct cvmx_iob_inb_control_match_enb_s cn58xxp1;
264 struct cvmx_iob_inb_control_match_enb_s cn63xx;
265 struct cvmx_iob_inb_control_match_enb_s cn63xxp1;
231}; 266};
232 267
233union cvmx_iob_inb_data_match { 268union cvmx_iob_inb_data_match {
@@ -246,6 +281,8 @@ union cvmx_iob_inb_data_match {
246 struct cvmx_iob_inb_data_match_s cn56xxp1; 281 struct cvmx_iob_inb_data_match_s cn56xxp1;
247 struct cvmx_iob_inb_data_match_s cn58xx; 282 struct cvmx_iob_inb_data_match_s cn58xx;
248 struct cvmx_iob_inb_data_match_s cn58xxp1; 283 struct cvmx_iob_inb_data_match_s cn58xxp1;
284 struct cvmx_iob_inb_data_match_s cn63xx;
285 struct cvmx_iob_inb_data_match_s cn63xxp1;
249}; 286};
250 287
251union cvmx_iob_inb_data_match_enb { 288union cvmx_iob_inb_data_match_enb {
@@ -264,6 +301,8 @@ union cvmx_iob_inb_data_match_enb {
264 struct cvmx_iob_inb_data_match_enb_s cn56xxp1; 301 struct cvmx_iob_inb_data_match_enb_s cn56xxp1;
265 struct cvmx_iob_inb_data_match_enb_s cn58xx; 302 struct cvmx_iob_inb_data_match_enb_s cn58xx;
266 struct cvmx_iob_inb_data_match_enb_s cn58xxp1; 303 struct cvmx_iob_inb_data_match_enb_s cn58xxp1;
304 struct cvmx_iob_inb_data_match_enb_s cn63xx;
305 struct cvmx_iob_inb_data_match_enb_s cn63xxp1;
267}; 306};
268 307
269union cvmx_iob_int_enb { 308union cvmx_iob_int_enb {
@@ -294,6 +333,8 @@ union cvmx_iob_int_enb {
294 struct cvmx_iob_int_enb_s cn56xxp1; 333 struct cvmx_iob_int_enb_s cn56xxp1;
295 struct cvmx_iob_int_enb_s cn58xx; 334 struct cvmx_iob_int_enb_s cn58xx;
296 struct cvmx_iob_int_enb_s cn58xxp1; 335 struct cvmx_iob_int_enb_s cn58xxp1;
336 struct cvmx_iob_int_enb_s cn63xx;
337 struct cvmx_iob_int_enb_s cn63xxp1;
297}; 338};
298 339
299union cvmx_iob_int_sum { 340union cvmx_iob_int_sum {
@@ -324,6 +365,8 @@ union cvmx_iob_int_sum {
324 struct cvmx_iob_int_sum_s cn56xxp1; 365 struct cvmx_iob_int_sum_s cn56xxp1;
325 struct cvmx_iob_int_sum_s cn58xx; 366 struct cvmx_iob_int_sum_s cn58xx;
326 struct cvmx_iob_int_sum_s cn58xxp1; 367 struct cvmx_iob_int_sum_s cn58xxp1;
368 struct cvmx_iob_int_sum_s cn63xx;
369 struct cvmx_iob_int_sum_s cn63xxp1;
327}; 370};
328 371
329union cvmx_iob_n2c_l2c_pri_cnt { 372union cvmx_iob_n2c_l2c_pri_cnt {
@@ -341,6 +384,8 @@ union cvmx_iob_n2c_l2c_pri_cnt {
341 struct cvmx_iob_n2c_l2c_pri_cnt_s cn56xxp1; 384 struct cvmx_iob_n2c_l2c_pri_cnt_s cn56xxp1;
342 struct cvmx_iob_n2c_l2c_pri_cnt_s cn58xx; 385 struct cvmx_iob_n2c_l2c_pri_cnt_s cn58xx;
343 struct cvmx_iob_n2c_l2c_pri_cnt_s cn58xxp1; 386 struct cvmx_iob_n2c_l2c_pri_cnt_s cn58xxp1;
387 struct cvmx_iob_n2c_l2c_pri_cnt_s cn63xx;
388 struct cvmx_iob_n2c_l2c_pri_cnt_s cn63xxp1;
344}; 389};
345 390
346union cvmx_iob_n2c_rsp_pri_cnt { 391union cvmx_iob_n2c_rsp_pri_cnt {
@@ -358,6 +403,8 @@ union cvmx_iob_n2c_rsp_pri_cnt {
358 struct cvmx_iob_n2c_rsp_pri_cnt_s cn56xxp1; 403 struct cvmx_iob_n2c_rsp_pri_cnt_s cn56xxp1;
359 struct cvmx_iob_n2c_rsp_pri_cnt_s cn58xx; 404 struct cvmx_iob_n2c_rsp_pri_cnt_s cn58xx;
360 struct cvmx_iob_n2c_rsp_pri_cnt_s cn58xxp1; 405 struct cvmx_iob_n2c_rsp_pri_cnt_s cn58xxp1;
406 struct cvmx_iob_n2c_rsp_pri_cnt_s cn63xx;
407 struct cvmx_iob_n2c_rsp_pri_cnt_s cn63xxp1;
361}; 408};
362 409
363union cvmx_iob_outb_com_pri_cnt { 410union cvmx_iob_outb_com_pri_cnt {
@@ -375,6 +422,8 @@ union cvmx_iob_outb_com_pri_cnt {
375 struct cvmx_iob_outb_com_pri_cnt_s cn56xxp1; 422 struct cvmx_iob_outb_com_pri_cnt_s cn56xxp1;
376 struct cvmx_iob_outb_com_pri_cnt_s cn58xx; 423 struct cvmx_iob_outb_com_pri_cnt_s cn58xx;
377 struct cvmx_iob_outb_com_pri_cnt_s cn58xxp1; 424 struct cvmx_iob_outb_com_pri_cnt_s cn58xxp1;
425 struct cvmx_iob_outb_com_pri_cnt_s cn63xx;
426 struct cvmx_iob_outb_com_pri_cnt_s cn63xxp1;
378}; 427};
379 428
380union cvmx_iob_outb_control_match { 429union cvmx_iob_outb_control_match {
@@ -397,6 +446,8 @@ union cvmx_iob_outb_control_match {
397 struct cvmx_iob_outb_control_match_s cn56xxp1; 446 struct cvmx_iob_outb_control_match_s cn56xxp1;
398 struct cvmx_iob_outb_control_match_s cn58xx; 447 struct cvmx_iob_outb_control_match_s cn58xx;
399 struct cvmx_iob_outb_control_match_s cn58xxp1; 448 struct cvmx_iob_outb_control_match_s cn58xxp1;
449 struct cvmx_iob_outb_control_match_s cn63xx;
450 struct cvmx_iob_outb_control_match_s cn63xxp1;
400}; 451};
401 452
402union cvmx_iob_outb_control_match_enb { 453union cvmx_iob_outb_control_match_enb {
@@ -419,6 +470,8 @@ union cvmx_iob_outb_control_match_enb {
419 struct cvmx_iob_outb_control_match_enb_s cn56xxp1; 470 struct cvmx_iob_outb_control_match_enb_s cn56xxp1;
420 struct cvmx_iob_outb_control_match_enb_s cn58xx; 471 struct cvmx_iob_outb_control_match_enb_s cn58xx;
421 struct cvmx_iob_outb_control_match_enb_s cn58xxp1; 472 struct cvmx_iob_outb_control_match_enb_s cn58xxp1;
473 struct cvmx_iob_outb_control_match_enb_s cn63xx;
474 struct cvmx_iob_outb_control_match_enb_s cn63xxp1;
422}; 475};
423 476
424union cvmx_iob_outb_data_match { 477union cvmx_iob_outb_data_match {
@@ -437,6 +490,8 @@ union cvmx_iob_outb_data_match {
437 struct cvmx_iob_outb_data_match_s cn56xxp1; 490 struct cvmx_iob_outb_data_match_s cn56xxp1;
438 struct cvmx_iob_outb_data_match_s cn58xx; 491 struct cvmx_iob_outb_data_match_s cn58xx;
439 struct cvmx_iob_outb_data_match_s cn58xxp1; 492 struct cvmx_iob_outb_data_match_s cn58xxp1;
493 struct cvmx_iob_outb_data_match_s cn63xx;
494 struct cvmx_iob_outb_data_match_s cn63xxp1;
440}; 495};
441 496
442union cvmx_iob_outb_data_match_enb { 497union cvmx_iob_outb_data_match_enb {
@@ -455,6 +510,8 @@ union cvmx_iob_outb_data_match_enb {
455 struct cvmx_iob_outb_data_match_enb_s cn56xxp1; 510 struct cvmx_iob_outb_data_match_enb_s cn56xxp1;
456 struct cvmx_iob_outb_data_match_enb_s cn58xx; 511 struct cvmx_iob_outb_data_match_enb_s cn58xx;
457 struct cvmx_iob_outb_data_match_enb_s cn58xxp1; 512 struct cvmx_iob_outb_data_match_enb_s cn58xxp1;
513 struct cvmx_iob_outb_data_match_enb_s cn63xx;
514 struct cvmx_iob_outb_data_match_enb_s cn63xxp1;
458}; 515};
459 516
460union cvmx_iob_outb_fpa_pri_cnt { 517union cvmx_iob_outb_fpa_pri_cnt {
@@ -472,6 +529,8 @@ union cvmx_iob_outb_fpa_pri_cnt {
472 struct cvmx_iob_outb_fpa_pri_cnt_s cn56xxp1; 529 struct cvmx_iob_outb_fpa_pri_cnt_s cn56xxp1;
473 struct cvmx_iob_outb_fpa_pri_cnt_s cn58xx; 530 struct cvmx_iob_outb_fpa_pri_cnt_s cn58xx;
474 struct cvmx_iob_outb_fpa_pri_cnt_s cn58xxp1; 531 struct cvmx_iob_outb_fpa_pri_cnt_s cn58xxp1;
532 struct cvmx_iob_outb_fpa_pri_cnt_s cn63xx;
533 struct cvmx_iob_outb_fpa_pri_cnt_s cn63xxp1;
475}; 534};
476 535
477union cvmx_iob_outb_req_pri_cnt { 536union cvmx_iob_outb_req_pri_cnt {
@@ -489,6 +548,8 @@ union cvmx_iob_outb_req_pri_cnt {
489 struct cvmx_iob_outb_req_pri_cnt_s cn56xxp1; 548 struct cvmx_iob_outb_req_pri_cnt_s cn56xxp1;
490 struct cvmx_iob_outb_req_pri_cnt_s cn58xx; 549 struct cvmx_iob_outb_req_pri_cnt_s cn58xx;
491 struct cvmx_iob_outb_req_pri_cnt_s cn58xxp1; 550 struct cvmx_iob_outb_req_pri_cnt_s cn58xxp1;
551 struct cvmx_iob_outb_req_pri_cnt_s cn63xx;
552 struct cvmx_iob_outb_req_pri_cnt_s cn63xxp1;
492}; 553};
493 554
494union cvmx_iob_p2c_req_pri_cnt { 555union cvmx_iob_p2c_req_pri_cnt {
@@ -506,25 +567,46 @@ union cvmx_iob_p2c_req_pri_cnt {
506 struct cvmx_iob_p2c_req_pri_cnt_s cn56xxp1; 567 struct cvmx_iob_p2c_req_pri_cnt_s cn56xxp1;
507 struct cvmx_iob_p2c_req_pri_cnt_s cn58xx; 568 struct cvmx_iob_p2c_req_pri_cnt_s cn58xx;
508 struct cvmx_iob_p2c_req_pri_cnt_s cn58xxp1; 569 struct cvmx_iob_p2c_req_pri_cnt_s cn58xxp1;
570 struct cvmx_iob_p2c_req_pri_cnt_s cn63xx;
571 struct cvmx_iob_p2c_req_pri_cnt_s cn63xxp1;
509}; 572};
510 573
511union cvmx_iob_pkt_err { 574union cvmx_iob_pkt_err {
512 uint64_t u64; 575 uint64_t u64;
513 struct cvmx_iob_pkt_err_s { 576 struct cvmx_iob_pkt_err_s {
577 uint64_t reserved_12_63:52;
578 uint64_t vport:6;
579 uint64_t port:6;
580 } s;
581 struct cvmx_iob_pkt_err_cn30xx {
514 uint64_t reserved_6_63:58; 582 uint64_t reserved_6_63:58;
515 uint64_t port:6; 583 uint64_t port:6;
584 } cn30xx;
585 struct cvmx_iob_pkt_err_cn30xx cn31xx;
586 struct cvmx_iob_pkt_err_cn30xx cn38xx;
587 struct cvmx_iob_pkt_err_cn30xx cn38xxp2;
588 struct cvmx_iob_pkt_err_cn30xx cn50xx;
589 struct cvmx_iob_pkt_err_cn30xx cn52xx;
590 struct cvmx_iob_pkt_err_cn30xx cn52xxp1;
591 struct cvmx_iob_pkt_err_cn30xx cn56xx;
592 struct cvmx_iob_pkt_err_cn30xx cn56xxp1;
593 struct cvmx_iob_pkt_err_cn30xx cn58xx;
594 struct cvmx_iob_pkt_err_cn30xx cn58xxp1;
595 struct cvmx_iob_pkt_err_s cn63xx;
596 struct cvmx_iob_pkt_err_s cn63xxp1;
597};
598
599union cvmx_iob_to_cmb_credits {
600 uint64_t u64;
601 struct cvmx_iob_to_cmb_credits_s {
602 uint64_t reserved_9_63:55;
603 uint64_t pko_rd:3;
604 uint64_t ncb_rd:3;
605 uint64_t ncb_wr:3;
516 } s; 606 } s;
517 struct cvmx_iob_pkt_err_s cn30xx; 607 struct cvmx_iob_to_cmb_credits_s cn52xx;
518 struct cvmx_iob_pkt_err_s cn31xx; 608 struct cvmx_iob_to_cmb_credits_s cn63xx;
519 struct cvmx_iob_pkt_err_s cn38xx; 609 struct cvmx_iob_to_cmb_credits_s cn63xxp1;
520 struct cvmx_iob_pkt_err_s cn38xxp2;
521 struct cvmx_iob_pkt_err_s cn50xx;
522 struct cvmx_iob_pkt_err_s cn52xx;
523 struct cvmx_iob_pkt_err_s cn52xxp1;
524 struct cvmx_iob_pkt_err_s cn56xx;
525 struct cvmx_iob_pkt_err_s cn56xxp1;
526 struct cvmx_iob_pkt_err_s cn58xx;
527 struct cvmx_iob_pkt_err_s cn58xxp1;
528}; 610};
529 611
530#endif 612#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-ipd-defs.h b/arch/mips/include/asm/octeon/cvmx-ipd-defs.h
index f8b8fc657d2c..e0a5bfe88d04 100644
--- a/arch/mips/include/asm/octeon/cvmx-ipd-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-ipd-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,104 +28,57 @@
28#ifndef __CVMX_IPD_DEFS_H__ 28#ifndef __CVMX_IPD_DEFS_H__
29#define __CVMX_IPD_DEFS_H__ 29#define __CVMX_IPD_DEFS_H__
30 30
31#define CVMX_IPD_1ST_MBUFF_SKIP \ 31#define CVMX_IPD_1ST_MBUFF_SKIP (CVMX_ADD_IO_SEG(0x00014F0000000000ull))
32 CVMX_ADD_IO_SEG(0x00014F0000000000ull) 32#define CVMX_IPD_1st_NEXT_PTR_BACK (CVMX_ADD_IO_SEG(0x00014F0000000150ull))
33#define CVMX_IPD_1st_NEXT_PTR_BACK \ 33#define CVMX_IPD_2nd_NEXT_PTR_BACK (CVMX_ADD_IO_SEG(0x00014F0000000158ull))
34 CVMX_ADD_IO_SEG(0x00014F0000000150ull) 34#define CVMX_IPD_BIST_STATUS (CVMX_ADD_IO_SEG(0x00014F00000007F8ull))
35#define CVMX_IPD_2nd_NEXT_PTR_BACK \ 35#define CVMX_IPD_BP_PRT_RED_END (CVMX_ADD_IO_SEG(0x00014F0000000328ull))
36 CVMX_ADD_IO_SEG(0x00014F0000000158ull) 36#define CVMX_IPD_CLK_COUNT (CVMX_ADD_IO_SEG(0x00014F0000000338ull))
37#define CVMX_IPD_BIST_STATUS \ 37#define CVMX_IPD_CTL_STATUS (CVMX_ADD_IO_SEG(0x00014F0000000018ull))
38 CVMX_ADD_IO_SEG(0x00014F00000007F8ull) 38#define CVMX_IPD_INT_ENB (CVMX_ADD_IO_SEG(0x00014F0000000160ull))
39#define CVMX_IPD_BP_PRT_RED_END \ 39#define CVMX_IPD_INT_SUM (CVMX_ADD_IO_SEG(0x00014F0000000168ull))
40 CVMX_ADD_IO_SEG(0x00014F0000000328ull) 40#define CVMX_IPD_NOT_1ST_MBUFF_SKIP (CVMX_ADD_IO_SEG(0x00014F0000000008ull))
41#define CVMX_IPD_CLK_COUNT \ 41#define CVMX_IPD_PACKET_MBUFF_SIZE (CVMX_ADD_IO_SEG(0x00014F0000000010ull))
42 CVMX_ADD_IO_SEG(0x00014F0000000338ull) 42#define CVMX_IPD_PKT_PTR_VALID (CVMX_ADD_IO_SEG(0x00014F0000000358ull))
43#define CVMX_IPD_CTL_STATUS \ 43#define CVMX_IPD_PORTX_BP_PAGE_CNT(offset) (CVMX_ADD_IO_SEG(0x00014F0000000028ull) + ((offset) & 63) * 8)
44 CVMX_ADD_IO_SEG(0x00014F0000000018ull) 44#define CVMX_IPD_PORTX_BP_PAGE_CNT2(offset) (CVMX_ADD_IO_SEG(0x00014F0000000368ull) + ((offset) & 63) * 8 - 8*36)
45#define CVMX_IPD_INT_ENB \ 45#define CVMX_IPD_PORTX_BP_PAGE_CNT3(offset) (CVMX_ADD_IO_SEG(0x00014F00000003D0ull) + ((offset) & 63) * 8 - 8*40)
46 CVMX_ADD_IO_SEG(0x00014F0000000160ull) 46#define CVMX_IPD_PORT_BP_COUNTERS2_PAIRX(offset) (CVMX_ADD_IO_SEG(0x00014F0000000388ull) + ((offset) & 63) * 8 - 8*36)
47#define CVMX_IPD_INT_SUM \ 47#define CVMX_IPD_PORT_BP_COUNTERS3_PAIRX(offset) (CVMX_ADD_IO_SEG(0x00014F00000003B0ull) + ((offset) & 63) * 8 - 8*40)
48 CVMX_ADD_IO_SEG(0x00014F0000000168ull) 48#define CVMX_IPD_PORT_BP_COUNTERS_PAIRX(offset) (CVMX_ADD_IO_SEG(0x00014F00000001B8ull) + ((offset) & 63) * 8)
49#define CVMX_IPD_NOT_1ST_MBUFF_SKIP \ 49#define CVMX_IPD_PORT_QOS_INTX(offset) (CVMX_ADD_IO_SEG(0x00014F0000000808ull) + ((offset) & 7) * 8)
50 CVMX_ADD_IO_SEG(0x00014F0000000008ull) 50#define CVMX_IPD_PORT_QOS_INT_ENBX(offset) (CVMX_ADD_IO_SEG(0x00014F0000000848ull) + ((offset) & 7) * 8)
51#define CVMX_IPD_PACKET_MBUFF_SIZE \ 51#define CVMX_IPD_PORT_QOS_X_CNT(offset) (CVMX_ADD_IO_SEG(0x00014F0000000888ull) + ((offset) & 511) * 8)
52 CVMX_ADD_IO_SEG(0x00014F0000000010ull) 52#define CVMX_IPD_PRC_HOLD_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000348ull))
53#define CVMX_IPD_PKT_PTR_VALID \ 53#define CVMX_IPD_PRC_PORT_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000350ull))
54 CVMX_ADD_IO_SEG(0x00014F0000000358ull) 54#define CVMX_IPD_PTR_COUNT (CVMX_ADD_IO_SEG(0x00014F0000000320ull))
55#define CVMX_IPD_PORTX_BP_PAGE_CNT(offset) \ 55#define CVMX_IPD_PWP_PTR_FIFO_CTL (CVMX_ADD_IO_SEG(0x00014F0000000340ull))
56 CVMX_ADD_IO_SEG(0x00014F0000000028ull + (((offset) & 63) * 8)) 56#define CVMX_IPD_QOS0_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(0)
57#define CVMX_IPD_PORTX_BP_PAGE_CNT2(offset) \ 57#define CVMX_IPD_QOS1_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(1)
58 CVMX_ADD_IO_SEG(0x00014F0000000368ull + (((offset) & 63) * 8) - 8 * 36) 58#define CVMX_IPD_QOS2_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(2)
59#define CVMX_IPD_PORT_BP_COUNTERS2_PAIRX(offset) \ 59#define CVMX_IPD_QOS3_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(3)
60 CVMX_ADD_IO_SEG(0x00014F0000000388ull + (((offset) & 63) * 8) - 8 * 36) 60#define CVMX_IPD_QOS4_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(4)
61#define CVMX_IPD_PORT_BP_COUNTERS_PAIRX(offset) \ 61#define CVMX_IPD_QOS5_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(5)
62 CVMX_ADD_IO_SEG(0x00014F00000001B8ull + (((offset) & 63) * 8)) 62#define CVMX_IPD_QOS6_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(6)
63#define CVMX_IPD_PORT_QOS_INTX(offset) \ 63#define CVMX_IPD_QOS7_RED_MARKS CVMX_IPD_QOSX_RED_MARKS(7)
64 CVMX_ADD_IO_SEG(0x00014F0000000808ull + (((offset) & 7) * 8)) 64#define CVMX_IPD_QOSX_RED_MARKS(offset) (CVMX_ADD_IO_SEG(0x00014F0000000178ull) + ((offset) & 7) * 8)
65#define CVMX_IPD_PORT_QOS_INT_ENBX(offset) \ 65#define CVMX_IPD_QUE0_FREE_PAGE_CNT (CVMX_ADD_IO_SEG(0x00014F0000000330ull))
66 CVMX_ADD_IO_SEG(0x00014F0000000848ull + (((offset) & 7) * 8)) 66#define CVMX_IPD_RED_PORT_ENABLE (CVMX_ADD_IO_SEG(0x00014F00000002D8ull))
67#define CVMX_IPD_PORT_QOS_X_CNT(offset) \ 67#define CVMX_IPD_RED_PORT_ENABLE2 (CVMX_ADD_IO_SEG(0x00014F00000003A8ull))
68 CVMX_ADD_IO_SEG(0x00014F0000000888ull + (((offset) & 511) * 8)) 68#define CVMX_IPD_RED_QUE0_PARAM CVMX_IPD_RED_QUEX_PARAM(0)
69#define CVMX_IPD_PRC_HOLD_PTR_FIFO_CTL \ 69#define CVMX_IPD_RED_QUE1_PARAM CVMX_IPD_RED_QUEX_PARAM(1)
70 CVMX_ADD_IO_SEG(0x00014F0000000348ull) 70#define CVMX_IPD_RED_QUE2_PARAM CVMX_IPD_RED_QUEX_PARAM(2)
71#define CVMX_IPD_PRC_PORT_PTR_FIFO_CTL \ 71#define CVMX_IPD_RED_QUE3_PARAM CVMX_IPD_RED_QUEX_PARAM(3)
72 CVMX_ADD_IO_SEG(0x00014F0000000350ull) 72#define CVMX_IPD_RED_QUE4_PARAM CVMX_IPD_RED_QUEX_PARAM(4)
73#define CVMX_IPD_PTR_COUNT \ 73#define CVMX_IPD_RED_QUE5_PARAM CVMX_IPD_RED_QUEX_PARAM(5)
74 CVMX_ADD_IO_SEG(0x00014F0000000320ull) 74#define CVMX_IPD_RED_QUE6_PARAM CVMX_IPD_RED_QUEX_PARAM(6)
75#define CVMX_IPD_PWP_PTR_FIFO_CTL \ 75#define CVMX_IPD_RED_QUE7_PARAM CVMX_IPD_RED_QUEX_PARAM(7)
76 CVMX_ADD_IO_SEG(0x00014F0000000340ull) 76#define CVMX_IPD_RED_QUEX_PARAM(offset) (CVMX_ADD_IO_SEG(0x00014F00000002E0ull) + ((offset) & 7) * 8)
77#define CVMX_IPD_QOS0_RED_MARKS \ 77#define CVMX_IPD_SUB_PORT_BP_PAGE_CNT (CVMX_ADD_IO_SEG(0x00014F0000000148ull))
78 CVMX_ADD_IO_SEG(0x00014F0000000178ull) 78#define CVMX_IPD_SUB_PORT_FCS (CVMX_ADD_IO_SEG(0x00014F0000000170ull))
79#define CVMX_IPD_QOS1_RED_MARKS \ 79#define CVMX_IPD_SUB_PORT_QOS_CNT (CVMX_ADD_IO_SEG(0x00014F0000000800ull))
80 CVMX_ADD_IO_SEG(0x00014F0000000180ull) 80#define CVMX_IPD_WQE_FPA_QUEUE (CVMX_ADD_IO_SEG(0x00014F0000000020ull))
81#define CVMX_IPD_QOS2_RED_MARKS \ 81#define CVMX_IPD_WQE_PTR_VALID (CVMX_ADD_IO_SEG(0x00014F0000000360ull))
82 CVMX_ADD_IO_SEG(0x00014F0000000188ull)
83#define CVMX_IPD_QOS3_RED_MARKS \
84 CVMX_ADD_IO_SEG(0x00014F0000000190ull)
85#define CVMX_IPD_QOS4_RED_MARKS \
86 CVMX_ADD_IO_SEG(0x00014F0000000198ull)
87#define CVMX_IPD_QOS5_RED_MARKS \
88 CVMX_ADD_IO_SEG(0x00014F00000001A0ull)
89#define CVMX_IPD_QOS6_RED_MARKS \
90 CVMX_ADD_IO_SEG(0x00014F00000001A8ull)
91#define CVMX_IPD_QOS7_RED_MARKS \
92 CVMX_ADD_IO_SEG(0x00014F00000001B0ull)
93#define CVMX_IPD_QOSX_RED_MARKS(offset) \
94 CVMX_ADD_IO_SEG(0x00014F0000000178ull + (((offset) & 7) * 8))
95#define CVMX_IPD_QUE0_FREE_PAGE_CNT \
96 CVMX_ADD_IO_SEG(0x00014F0000000330ull)
97#define CVMX_IPD_RED_PORT_ENABLE \
98 CVMX_ADD_IO_SEG(0x00014F00000002D8ull)
99#define CVMX_IPD_RED_PORT_ENABLE2 \
100 CVMX_ADD_IO_SEG(0x00014F00000003A8ull)
101#define CVMX_IPD_RED_QUE0_PARAM \
102 CVMX_ADD_IO_SEG(0x00014F00000002E0ull)
103#define CVMX_IPD_RED_QUE1_PARAM \
104 CVMX_ADD_IO_SEG(0x00014F00000002E8ull)
105#define CVMX_IPD_RED_QUE2_PARAM \
106 CVMX_ADD_IO_SEG(0x00014F00000002F0ull)
107#define CVMX_IPD_RED_QUE3_PARAM \
108 CVMX_ADD_IO_SEG(0x00014F00000002F8ull)
109#define CVMX_IPD_RED_QUE4_PARAM \
110 CVMX_ADD_IO_SEG(0x00014F0000000300ull)
111#define CVMX_IPD_RED_QUE5_PARAM \
112 CVMX_ADD_IO_SEG(0x00014F0000000308ull)
113#define CVMX_IPD_RED_QUE6_PARAM \
114 CVMX_ADD_IO_SEG(0x00014F0000000310ull)
115#define CVMX_IPD_RED_QUE7_PARAM \
116 CVMX_ADD_IO_SEG(0x00014F0000000318ull)
117#define CVMX_IPD_RED_QUEX_PARAM(offset) \
118 CVMX_ADD_IO_SEG(0x00014F00000002E0ull + (((offset) & 7) * 8))
119#define CVMX_IPD_SUB_PORT_BP_PAGE_CNT \
120 CVMX_ADD_IO_SEG(0x00014F0000000148ull)
121#define CVMX_IPD_SUB_PORT_FCS \
122 CVMX_ADD_IO_SEG(0x00014F0000000170ull)
123#define CVMX_IPD_SUB_PORT_QOS_CNT \
124 CVMX_ADD_IO_SEG(0x00014F0000000800ull)
125#define CVMX_IPD_WQE_FPA_QUEUE \
126 CVMX_ADD_IO_SEG(0x00014F0000000020ull)
127#define CVMX_IPD_WQE_PTR_VALID \
128 CVMX_ADD_IO_SEG(0x00014F0000000360ull)
129 82
130union cvmx_ipd_1st_mbuff_skip { 83union cvmx_ipd_1st_mbuff_skip {
131 uint64_t u64; 84 uint64_t u64;
@@ -144,6 +97,8 @@ union cvmx_ipd_1st_mbuff_skip {
144 struct cvmx_ipd_1st_mbuff_skip_s cn56xxp1; 97 struct cvmx_ipd_1st_mbuff_skip_s cn56xxp1;
145 struct cvmx_ipd_1st_mbuff_skip_s cn58xx; 98 struct cvmx_ipd_1st_mbuff_skip_s cn58xx;
146 struct cvmx_ipd_1st_mbuff_skip_s cn58xxp1; 99 struct cvmx_ipd_1st_mbuff_skip_s cn58xxp1;
100 struct cvmx_ipd_1st_mbuff_skip_s cn63xx;
101 struct cvmx_ipd_1st_mbuff_skip_s cn63xxp1;
147}; 102};
148 103
149union cvmx_ipd_1st_next_ptr_back { 104union cvmx_ipd_1st_next_ptr_back {
@@ -163,6 +118,8 @@ union cvmx_ipd_1st_next_ptr_back {
163 struct cvmx_ipd_1st_next_ptr_back_s cn56xxp1; 118 struct cvmx_ipd_1st_next_ptr_back_s cn56xxp1;
164 struct cvmx_ipd_1st_next_ptr_back_s cn58xx; 119 struct cvmx_ipd_1st_next_ptr_back_s cn58xx;
165 struct cvmx_ipd_1st_next_ptr_back_s cn58xxp1; 120 struct cvmx_ipd_1st_next_ptr_back_s cn58xxp1;
121 struct cvmx_ipd_1st_next_ptr_back_s cn63xx;
122 struct cvmx_ipd_1st_next_ptr_back_s cn63xxp1;
166}; 123};
167 124
168union cvmx_ipd_2nd_next_ptr_back { 125union cvmx_ipd_2nd_next_ptr_back {
@@ -182,6 +139,8 @@ union cvmx_ipd_2nd_next_ptr_back {
182 struct cvmx_ipd_2nd_next_ptr_back_s cn56xxp1; 139 struct cvmx_ipd_2nd_next_ptr_back_s cn56xxp1;
183 struct cvmx_ipd_2nd_next_ptr_back_s cn58xx; 140 struct cvmx_ipd_2nd_next_ptr_back_s cn58xx;
184 struct cvmx_ipd_2nd_next_ptr_back_s cn58xxp1; 141 struct cvmx_ipd_2nd_next_ptr_back_s cn58xxp1;
142 struct cvmx_ipd_2nd_next_ptr_back_s cn63xx;
143 struct cvmx_ipd_2nd_next_ptr_back_s cn63xxp1;
185}; 144};
186 145
187union cvmx_ipd_bist_status { 146union cvmx_ipd_bist_status {
@@ -236,13 +195,15 @@ union cvmx_ipd_bist_status {
236 struct cvmx_ipd_bist_status_s cn56xxp1; 195 struct cvmx_ipd_bist_status_s cn56xxp1;
237 struct cvmx_ipd_bist_status_cn30xx cn58xx; 196 struct cvmx_ipd_bist_status_cn30xx cn58xx;
238 struct cvmx_ipd_bist_status_cn30xx cn58xxp1; 197 struct cvmx_ipd_bist_status_cn30xx cn58xxp1;
198 struct cvmx_ipd_bist_status_s cn63xx;
199 struct cvmx_ipd_bist_status_s cn63xxp1;
239}; 200};
240 201
241union cvmx_ipd_bp_prt_red_end { 202union cvmx_ipd_bp_prt_red_end {
242 uint64_t u64; 203 uint64_t u64;
243 struct cvmx_ipd_bp_prt_red_end_s { 204 struct cvmx_ipd_bp_prt_red_end_s {
244 uint64_t reserved_40_63:24; 205 uint64_t reserved_44_63:20;
245 uint64_t prt_enb:40; 206 uint64_t prt_enb:44;
246 } s; 207 } s;
247 struct cvmx_ipd_bp_prt_red_end_cn30xx { 208 struct cvmx_ipd_bp_prt_red_end_cn30xx {
248 uint64_t reserved_36_63:28; 209 uint64_t reserved_36_63:28;
@@ -252,12 +213,17 @@ union cvmx_ipd_bp_prt_red_end {
252 struct cvmx_ipd_bp_prt_red_end_cn30xx cn38xx; 213 struct cvmx_ipd_bp_prt_red_end_cn30xx cn38xx;
253 struct cvmx_ipd_bp_prt_red_end_cn30xx cn38xxp2; 214 struct cvmx_ipd_bp_prt_red_end_cn30xx cn38xxp2;
254 struct cvmx_ipd_bp_prt_red_end_cn30xx cn50xx; 215 struct cvmx_ipd_bp_prt_red_end_cn30xx cn50xx;
255 struct cvmx_ipd_bp_prt_red_end_s cn52xx; 216 struct cvmx_ipd_bp_prt_red_end_cn52xx {
256 struct cvmx_ipd_bp_prt_red_end_s cn52xxp1; 217 uint64_t reserved_40_63:24;
257 struct cvmx_ipd_bp_prt_red_end_s cn56xx; 218 uint64_t prt_enb:40;
258 struct cvmx_ipd_bp_prt_red_end_s cn56xxp1; 219 } cn52xx;
220 struct cvmx_ipd_bp_prt_red_end_cn52xx cn52xxp1;
221 struct cvmx_ipd_bp_prt_red_end_cn52xx cn56xx;
222 struct cvmx_ipd_bp_prt_red_end_cn52xx cn56xxp1;
259 struct cvmx_ipd_bp_prt_red_end_cn30xx cn58xx; 223 struct cvmx_ipd_bp_prt_red_end_cn30xx cn58xx;
260 struct cvmx_ipd_bp_prt_red_end_cn30xx cn58xxp1; 224 struct cvmx_ipd_bp_prt_red_end_cn30xx cn58xxp1;
225 struct cvmx_ipd_bp_prt_red_end_s cn63xx;
226 struct cvmx_ipd_bp_prt_red_end_s cn63xxp1;
261}; 227};
262 228
263union cvmx_ipd_clk_count { 229union cvmx_ipd_clk_count {
@@ -276,12 +242,17 @@ union cvmx_ipd_clk_count {
276 struct cvmx_ipd_clk_count_s cn56xxp1; 242 struct cvmx_ipd_clk_count_s cn56xxp1;
277 struct cvmx_ipd_clk_count_s cn58xx; 243 struct cvmx_ipd_clk_count_s cn58xx;
278 struct cvmx_ipd_clk_count_s cn58xxp1; 244 struct cvmx_ipd_clk_count_s cn58xxp1;
245 struct cvmx_ipd_clk_count_s cn63xx;
246 struct cvmx_ipd_clk_count_s cn63xxp1;
279}; 247};
280 248
281union cvmx_ipd_ctl_status { 249union cvmx_ipd_ctl_status {
282 uint64_t u64; 250 uint64_t u64;
283 struct cvmx_ipd_ctl_status_s { 251 struct cvmx_ipd_ctl_status_s {
284 uint64_t reserved_15_63:49; 252 uint64_t reserved_18_63:46;
253 uint64_t use_sop:1;
254 uint64_t rst_done:1;
255 uint64_t clken:1;
285 uint64_t no_wptr:1; 256 uint64_t no_wptr:1;
286 uint64_t pq_apkt:1; 257 uint64_t pq_apkt:1;
287 uint64_t pq_nabuf:1; 258 uint64_t pq_nabuf:1;
@@ -322,11 +293,27 @@ union cvmx_ipd_ctl_status {
322 uint64_t opc_mode:2; 293 uint64_t opc_mode:2;
323 uint64_t ipd_en:1; 294 uint64_t ipd_en:1;
324 } cn38xxp2; 295 } cn38xxp2;
325 struct cvmx_ipd_ctl_status_s cn50xx; 296 struct cvmx_ipd_ctl_status_cn50xx {
326 struct cvmx_ipd_ctl_status_s cn52xx; 297 uint64_t reserved_15_63:49;
327 struct cvmx_ipd_ctl_status_s cn52xxp1; 298 uint64_t no_wptr:1;
328 struct cvmx_ipd_ctl_status_s cn56xx; 299 uint64_t pq_apkt:1;
329 struct cvmx_ipd_ctl_status_s cn56xxp1; 300 uint64_t pq_nabuf:1;
301 uint64_t ipd_full:1;
302 uint64_t pkt_off:1;
303 uint64_t len_m8:1;
304 uint64_t reset:1;
305 uint64_t addpkt:1;
306 uint64_t naddbuf:1;
307 uint64_t pkt_lend:1;
308 uint64_t wqe_lend:1;
309 uint64_t pbp_en:1;
310 uint64_t opc_mode:2;
311 uint64_t ipd_en:1;
312 } cn50xx;
313 struct cvmx_ipd_ctl_status_cn50xx cn52xx;
314 struct cvmx_ipd_ctl_status_cn50xx cn52xxp1;
315 struct cvmx_ipd_ctl_status_cn50xx cn56xx;
316 struct cvmx_ipd_ctl_status_cn50xx cn56xxp1;
330 struct cvmx_ipd_ctl_status_cn58xx { 317 struct cvmx_ipd_ctl_status_cn58xx {
331 uint64_t reserved_12_63:52; 318 uint64_t reserved_12_63:52;
332 uint64_t ipd_full:1; 319 uint64_t ipd_full:1;
@@ -342,6 +329,25 @@ union cvmx_ipd_ctl_status {
342 uint64_t ipd_en:1; 329 uint64_t ipd_en:1;
343 } cn58xx; 330 } cn58xx;
344 struct cvmx_ipd_ctl_status_cn58xx cn58xxp1; 331 struct cvmx_ipd_ctl_status_cn58xx cn58xxp1;
332 struct cvmx_ipd_ctl_status_s cn63xx;
333 struct cvmx_ipd_ctl_status_cn63xxp1 {
334 uint64_t reserved_16_63:48;
335 uint64_t clken:1;
336 uint64_t no_wptr:1;
337 uint64_t pq_apkt:1;
338 uint64_t pq_nabuf:1;
339 uint64_t ipd_full:1;
340 uint64_t pkt_off:1;
341 uint64_t len_m8:1;
342 uint64_t reset:1;
343 uint64_t addpkt:1;
344 uint64_t naddbuf:1;
345 uint64_t pkt_lend:1;
346 uint64_t wqe_lend:1;
347 uint64_t pbp_en:1;
348 uint64_t opc_mode:2;
349 uint64_t ipd_en:1;
350 } cn63xxp1;
345}; 351};
346 352
347union cvmx_ipd_int_enb { 353union cvmx_ipd_int_enb {
@@ -391,6 +397,8 @@ union cvmx_ipd_int_enb {
391 struct cvmx_ipd_int_enb_s cn56xxp1; 397 struct cvmx_ipd_int_enb_s cn56xxp1;
392 struct cvmx_ipd_int_enb_cn38xx cn58xx; 398 struct cvmx_ipd_int_enb_cn38xx cn58xx;
393 struct cvmx_ipd_int_enb_cn38xx cn58xxp1; 399 struct cvmx_ipd_int_enb_cn38xx cn58xxp1;
400 struct cvmx_ipd_int_enb_s cn63xx;
401 struct cvmx_ipd_int_enb_s cn63xxp1;
394}; 402};
395 403
396union cvmx_ipd_int_sum { 404union cvmx_ipd_int_sum {
@@ -440,6 +448,8 @@ union cvmx_ipd_int_sum {
440 struct cvmx_ipd_int_sum_s cn56xxp1; 448 struct cvmx_ipd_int_sum_s cn56xxp1;
441 struct cvmx_ipd_int_sum_cn38xx cn58xx; 449 struct cvmx_ipd_int_sum_cn38xx cn58xx;
442 struct cvmx_ipd_int_sum_cn38xx cn58xxp1; 450 struct cvmx_ipd_int_sum_cn38xx cn58xxp1;
451 struct cvmx_ipd_int_sum_s cn63xx;
452 struct cvmx_ipd_int_sum_s cn63xxp1;
443}; 453};
444 454
445union cvmx_ipd_not_1st_mbuff_skip { 455union cvmx_ipd_not_1st_mbuff_skip {
@@ -459,6 +469,8 @@ union cvmx_ipd_not_1st_mbuff_skip {
459 struct cvmx_ipd_not_1st_mbuff_skip_s cn56xxp1; 469 struct cvmx_ipd_not_1st_mbuff_skip_s cn56xxp1;
460 struct cvmx_ipd_not_1st_mbuff_skip_s cn58xx; 470 struct cvmx_ipd_not_1st_mbuff_skip_s cn58xx;
461 struct cvmx_ipd_not_1st_mbuff_skip_s cn58xxp1; 471 struct cvmx_ipd_not_1st_mbuff_skip_s cn58xxp1;
472 struct cvmx_ipd_not_1st_mbuff_skip_s cn63xx;
473 struct cvmx_ipd_not_1st_mbuff_skip_s cn63xxp1;
462}; 474};
463 475
464union cvmx_ipd_packet_mbuff_size { 476union cvmx_ipd_packet_mbuff_size {
@@ -478,6 +490,8 @@ union cvmx_ipd_packet_mbuff_size {
478 struct cvmx_ipd_packet_mbuff_size_s cn56xxp1; 490 struct cvmx_ipd_packet_mbuff_size_s cn56xxp1;
479 struct cvmx_ipd_packet_mbuff_size_s cn58xx; 491 struct cvmx_ipd_packet_mbuff_size_s cn58xx;
480 struct cvmx_ipd_packet_mbuff_size_s cn58xxp1; 492 struct cvmx_ipd_packet_mbuff_size_s cn58xxp1;
493 struct cvmx_ipd_packet_mbuff_size_s cn63xx;
494 struct cvmx_ipd_packet_mbuff_size_s cn63xxp1;
481}; 495};
482 496
483union cvmx_ipd_pkt_ptr_valid { 497union cvmx_ipd_pkt_ptr_valid {
@@ -496,6 +510,8 @@ union cvmx_ipd_pkt_ptr_valid {
496 struct cvmx_ipd_pkt_ptr_valid_s cn56xxp1; 510 struct cvmx_ipd_pkt_ptr_valid_s cn56xxp1;
497 struct cvmx_ipd_pkt_ptr_valid_s cn58xx; 511 struct cvmx_ipd_pkt_ptr_valid_s cn58xx;
498 struct cvmx_ipd_pkt_ptr_valid_s cn58xxp1; 512 struct cvmx_ipd_pkt_ptr_valid_s cn58xxp1;
513 struct cvmx_ipd_pkt_ptr_valid_s cn63xx;
514 struct cvmx_ipd_pkt_ptr_valid_s cn63xxp1;
499}; 515};
500 516
501union cvmx_ipd_portx_bp_page_cnt { 517union cvmx_ipd_portx_bp_page_cnt {
@@ -516,6 +532,8 @@ union cvmx_ipd_portx_bp_page_cnt {
516 struct cvmx_ipd_portx_bp_page_cnt_s cn56xxp1; 532 struct cvmx_ipd_portx_bp_page_cnt_s cn56xxp1;
517 struct cvmx_ipd_portx_bp_page_cnt_s cn58xx; 533 struct cvmx_ipd_portx_bp_page_cnt_s cn58xx;
518 struct cvmx_ipd_portx_bp_page_cnt_s cn58xxp1; 534 struct cvmx_ipd_portx_bp_page_cnt_s cn58xxp1;
535 struct cvmx_ipd_portx_bp_page_cnt_s cn63xx;
536 struct cvmx_ipd_portx_bp_page_cnt_s cn63xxp1;
519}; 537};
520 538
521union cvmx_ipd_portx_bp_page_cnt2 { 539union cvmx_ipd_portx_bp_page_cnt2 {
@@ -529,6 +547,19 @@ union cvmx_ipd_portx_bp_page_cnt2 {
529 struct cvmx_ipd_portx_bp_page_cnt2_s cn52xxp1; 547 struct cvmx_ipd_portx_bp_page_cnt2_s cn52xxp1;
530 struct cvmx_ipd_portx_bp_page_cnt2_s cn56xx; 548 struct cvmx_ipd_portx_bp_page_cnt2_s cn56xx;
531 struct cvmx_ipd_portx_bp_page_cnt2_s cn56xxp1; 549 struct cvmx_ipd_portx_bp_page_cnt2_s cn56xxp1;
550 struct cvmx_ipd_portx_bp_page_cnt2_s cn63xx;
551 struct cvmx_ipd_portx_bp_page_cnt2_s cn63xxp1;
552};
553
554union cvmx_ipd_portx_bp_page_cnt3 {
555 uint64_t u64;
556 struct cvmx_ipd_portx_bp_page_cnt3_s {
557 uint64_t reserved_18_63:46;
558 uint64_t bp_enb:1;
559 uint64_t page_cnt:17;
560 } s;
561 struct cvmx_ipd_portx_bp_page_cnt3_s cn63xx;
562 struct cvmx_ipd_portx_bp_page_cnt3_s cn63xxp1;
532}; 563};
533 564
534union cvmx_ipd_port_bp_counters2_pairx { 565union cvmx_ipd_port_bp_counters2_pairx {
@@ -541,6 +572,18 @@ union cvmx_ipd_port_bp_counters2_pairx {
541 struct cvmx_ipd_port_bp_counters2_pairx_s cn52xxp1; 572 struct cvmx_ipd_port_bp_counters2_pairx_s cn52xxp1;
542 struct cvmx_ipd_port_bp_counters2_pairx_s cn56xx; 573 struct cvmx_ipd_port_bp_counters2_pairx_s cn56xx;
543 struct cvmx_ipd_port_bp_counters2_pairx_s cn56xxp1; 574 struct cvmx_ipd_port_bp_counters2_pairx_s cn56xxp1;
575 struct cvmx_ipd_port_bp_counters2_pairx_s cn63xx;
576 struct cvmx_ipd_port_bp_counters2_pairx_s cn63xxp1;
577};
578
579union cvmx_ipd_port_bp_counters3_pairx {
580 uint64_t u64;
581 struct cvmx_ipd_port_bp_counters3_pairx_s {
582 uint64_t reserved_25_63:39;
583 uint64_t cnt_val:25;
584 } s;
585 struct cvmx_ipd_port_bp_counters3_pairx_s cn63xx;
586 struct cvmx_ipd_port_bp_counters3_pairx_s cn63xxp1;
544}; 587};
545 588
546union cvmx_ipd_port_bp_counters_pairx { 589union cvmx_ipd_port_bp_counters_pairx {
@@ -560,6 +603,8 @@ union cvmx_ipd_port_bp_counters_pairx {
560 struct cvmx_ipd_port_bp_counters_pairx_s cn56xxp1; 603 struct cvmx_ipd_port_bp_counters_pairx_s cn56xxp1;
561 struct cvmx_ipd_port_bp_counters_pairx_s cn58xx; 604 struct cvmx_ipd_port_bp_counters_pairx_s cn58xx;
562 struct cvmx_ipd_port_bp_counters_pairx_s cn58xxp1; 605 struct cvmx_ipd_port_bp_counters_pairx_s cn58xxp1;
606 struct cvmx_ipd_port_bp_counters_pairx_s cn63xx;
607 struct cvmx_ipd_port_bp_counters_pairx_s cn63xxp1;
563}; 608};
564 609
565union cvmx_ipd_port_qos_x_cnt { 610union cvmx_ipd_port_qos_x_cnt {
@@ -572,6 +617,8 @@ union cvmx_ipd_port_qos_x_cnt {
572 struct cvmx_ipd_port_qos_x_cnt_s cn52xxp1; 617 struct cvmx_ipd_port_qos_x_cnt_s cn52xxp1;
573 struct cvmx_ipd_port_qos_x_cnt_s cn56xx; 618 struct cvmx_ipd_port_qos_x_cnt_s cn56xx;
574 struct cvmx_ipd_port_qos_x_cnt_s cn56xxp1; 619 struct cvmx_ipd_port_qos_x_cnt_s cn56xxp1;
620 struct cvmx_ipd_port_qos_x_cnt_s cn63xx;
621 struct cvmx_ipd_port_qos_x_cnt_s cn63xxp1;
575}; 622};
576 623
577union cvmx_ipd_port_qos_intx { 624union cvmx_ipd_port_qos_intx {
@@ -583,6 +630,8 @@ union cvmx_ipd_port_qos_intx {
583 struct cvmx_ipd_port_qos_intx_s cn52xxp1; 630 struct cvmx_ipd_port_qos_intx_s cn52xxp1;
584 struct cvmx_ipd_port_qos_intx_s cn56xx; 631 struct cvmx_ipd_port_qos_intx_s cn56xx;
585 struct cvmx_ipd_port_qos_intx_s cn56xxp1; 632 struct cvmx_ipd_port_qos_intx_s cn56xxp1;
633 struct cvmx_ipd_port_qos_intx_s cn63xx;
634 struct cvmx_ipd_port_qos_intx_s cn63xxp1;
586}; 635};
587 636
588union cvmx_ipd_port_qos_int_enbx { 637union cvmx_ipd_port_qos_int_enbx {
@@ -594,6 +643,8 @@ union cvmx_ipd_port_qos_int_enbx {
594 struct cvmx_ipd_port_qos_int_enbx_s cn52xxp1; 643 struct cvmx_ipd_port_qos_int_enbx_s cn52xxp1;
595 struct cvmx_ipd_port_qos_int_enbx_s cn56xx; 644 struct cvmx_ipd_port_qos_int_enbx_s cn56xx;
596 struct cvmx_ipd_port_qos_int_enbx_s cn56xxp1; 645 struct cvmx_ipd_port_qos_int_enbx_s cn56xxp1;
646 struct cvmx_ipd_port_qos_int_enbx_s cn63xx;
647 struct cvmx_ipd_port_qos_int_enbx_s cn63xxp1;
597}; 648};
598 649
599union cvmx_ipd_prc_hold_ptr_fifo_ctl { 650union cvmx_ipd_prc_hold_ptr_fifo_ctl {
@@ -616,6 +667,8 @@ union cvmx_ipd_prc_hold_ptr_fifo_ctl {
616 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s cn56xxp1; 667 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s cn56xxp1;
617 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s cn58xx; 668 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s cn58xx;
618 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s cn58xxp1; 669 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s cn58xxp1;
670 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s cn63xx;
671 struct cvmx_ipd_prc_hold_ptr_fifo_ctl_s cn63xxp1;
619}; 672};
620 673
621union cvmx_ipd_prc_port_ptr_fifo_ctl { 674union cvmx_ipd_prc_port_ptr_fifo_ctl {
@@ -637,6 +690,8 @@ union cvmx_ipd_prc_port_ptr_fifo_ctl {
637 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s cn56xxp1; 690 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s cn56xxp1;
638 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s cn58xx; 691 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s cn58xx;
639 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s cn58xxp1; 692 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s cn58xxp1;
693 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s cn63xx;
694 struct cvmx_ipd_prc_port_ptr_fifo_ctl_s cn63xxp1;
640}; 695};
641 696
642union cvmx_ipd_ptr_count { 697union cvmx_ipd_ptr_count {
@@ -660,6 +715,8 @@ union cvmx_ipd_ptr_count {
660 struct cvmx_ipd_ptr_count_s cn56xxp1; 715 struct cvmx_ipd_ptr_count_s cn56xxp1;
661 struct cvmx_ipd_ptr_count_s cn58xx; 716 struct cvmx_ipd_ptr_count_s cn58xx;
662 struct cvmx_ipd_ptr_count_s cn58xxp1; 717 struct cvmx_ipd_ptr_count_s cn58xxp1;
718 struct cvmx_ipd_ptr_count_s cn63xx;
719 struct cvmx_ipd_ptr_count_s cn63xxp1;
663}; 720};
664 721
665union cvmx_ipd_pwp_ptr_fifo_ctl { 722union cvmx_ipd_pwp_ptr_fifo_ctl {
@@ -683,6 +740,8 @@ union cvmx_ipd_pwp_ptr_fifo_ctl {
683 struct cvmx_ipd_pwp_ptr_fifo_ctl_s cn56xxp1; 740 struct cvmx_ipd_pwp_ptr_fifo_ctl_s cn56xxp1;
684 struct cvmx_ipd_pwp_ptr_fifo_ctl_s cn58xx; 741 struct cvmx_ipd_pwp_ptr_fifo_ctl_s cn58xx;
685 struct cvmx_ipd_pwp_ptr_fifo_ctl_s cn58xxp1; 742 struct cvmx_ipd_pwp_ptr_fifo_ctl_s cn58xxp1;
743 struct cvmx_ipd_pwp_ptr_fifo_ctl_s cn63xx;
744 struct cvmx_ipd_pwp_ptr_fifo_ctl_s cn63xxp1;
686}; 745};
687 746
688union cvmx_ipd_qosx_red_marks { 747union cvmx_ipd_qosx_red_marks {
@@ -702,6 +761,8 @@ union cvmx_ipd_qosx_red_marks {
702 struct cvmx_ipd_qosx_red_marks_s cn56xxp1; 761 struct cvmx_ipd_qosx_red_marks_s cn56xxp1;
703 struct cvmx_ipd_qosx_red_marks_s cn58xx; 762 struct cvmx_ipd_qosx_red_marks_s cn58xx;
704 struct cvmx_ipd_qosx_red_marks_s cn58xxp1; 763 struct cvmx_ipd_qosx_red_marks_s cn58xxp1;
764 struct cvmx_ipd_qosx_red_marks_s cn63xx;
765 struct cvmx_ipd_qosx_red_marks_s cn63xxp1;
705}; 766};
706 767
707union cvmx_ipd_que0_free_page_cnt { 768union cvmx_ipd_que0_free_page_cnt {
@@ -721,6 +782,8 @@ union cvmx_ipd_que0_free_page_cnt {
721 struct cvmx_ipd_que0_free_page_cnt_s cn56xxp1; 782 struct cvmx_ipd_que0_free_page_cnt_s cn56xxp1;
722 struct cvmx_ipd_que0_free_page_cnt_s cn58xx; 783 struct cvmx_ipd_que0_free_page_cnt_s cn58xx;
723 struct cvmx_ipd_que0_free_page_cnt_s cn58xxp1; 784 struct cvmx_ipd_que0_free_page_cnt_s cn58xxp1;
785 struct cvmx_ipd_que0_free_page_cnt_s cn63xx;
786 struct cvmx_ipd_que0_free_page_cnt_s cn63xxp1;
724}; 787};
725 788
726union cvmx_ipd_red_port_enable { 789union cvmx_ipd_red_port_enable {
@@ -741,18 +804,25 @@ union cvmx_ipd_red_port_enable {
741 struct cvmx_ipd_red_port_enable_s cn56xxp1; 804 struct cvmx_ipd_red_port_enable_s cn56xxp1;
742 struct cvmx_ipd_red_port_enable_s cn58xx; 805 struct cvmx_ipd_red_port_enable_s cn58xx;
743 struct cvmx_ipd_red_port_enable_s cn58xxp1; 806 struct cvmx_ipd_red_port_enable_s cn58xxp1;
807 struct cvmx_ipd_red_port_enable_s cn63xx;
808 struct cvmx_ipd_red_port_enable_s cn63xxp1;
744}; 809};
745 810
746union cvmx_ipd_red_port_enable2 { 811union cvmx_ipd_red_port_enable2 {
747 uint64_t u64; 812 uint64_t u64;
748 struct cvmx_ipd_red_port_enable2_s { 813 struct cvmx_ipd_red_port_enable2_s {
814 uint64_t reserved_8_63:56;
815 uint64_t prt_enb:8;
816 } s;
817 struct cvmx_ipd_red_port_enable2_cn52xx {
749 uint64_t reserved_4_63:60; 818 uint64_t reserved_4_63:60;
750 uint64_t prt_enb:4; 819 uint64_t prt_enb:4;
751 } s; 820 } cn52xx;
752 struct cvmx_ipd_red_port_enable2_s cn52xx; 821 struct cvmx_ipd_red_port_enable2_cn52xx cn52xxp1;
753 struct cvmx_ipd_red_port_enable2_s cn52xxp1; 822 struct cvmx_ipd_red_port_enable2_cn52xx cn56xx;
754 struct cvmx_ipd_red_port_enable2_s cn56xx; 823 struct cvmx_ipd_red_port_enable2_cn52xx cn56xxp1;
755 struct cvmx_ipd_red_port_enable2_s cn56xxp1; 824 struct cvmx_ipd_red_port_enable2_s cn63xx;
825 struct cvmx_ipd_red_port_enable2_s cn63xxp1;
756}; 826};
757 827
758union cvmx_ipd_red_quex_param { 828union cvmx_ipd_red_quex_param {
@@ -775,6 +845,8 @@ union cvmx_ipd_red_quex_param {
775 struct cvmx_ipd_red_quex_param_s cn56xxp1; 845 struct cvmx_ipd_red_quex_param_s cn56xxp1;
776 struct cvmx_ipd_red_quex_param_s cn58xx; 846 struct cvmx_ipd_red_quex_param_s cn58xx;
777 struct cvmx_ipd_red_quex_param_s cn58xxp1; 847 struct cvmx_ipd_red_quex_param_s cn58xxp1;
848 struct cvmx_ipd_red_quex_param_s cn63xx;
849 struct cvmx_ipd_red_quex_param_s cn63xxp1;
778}; 850};
779 851
780union cvmx_ipd_sub_port_bp_page_cnt { 852union cvmx_ipd_sub_port_bp_page_cnt {
@@ -795,6 +867,8 @@ union cvmx_ipd_sub_port_bp_page_cnt {
795 struct cvmx_ipd_sub_port_bp_page_cnt_s cn56xxp1; 867 struct cvmx_ipd_sub_port_bp_page_cnt_s cn56xxp1;
796 struct cvmx_ipd_sub_port_bp_page_cnt_s cn58xx; 868 struct cvmx_ipd_sub_port_bp_page_cnt_s cn58xx;
797 struct cvmx_ipd_sub_port_bp_page_cnt_s cn58xxp1; 869 struct cvmx_ipd_sub_port_bp_page_cnt_s cn58xxp1;
870 struct cvmx_ipd_sub_port_bp_page_cnt_s cn63xx;
871 struct cvmx_ipd_sub_port_bp_page_cnt_s cn63xxp1;
798}; 872};
799 873
800union cvmx_ipd_sub_port_fcs { 874union cvmx_ipd_sub_port_fcs {
@@ -822,6 +896,8 @@ union cvmx_ipd_sub_port_fcs {
822 struct cvmx_ipd_sub_port_fcs_s cn56xxp1; 896 struct cvmx_ipd_sub_port_fcs_s cn56xxp1;
823 struct cvmx_ipd_sub_port_fcs_cn38xx cn58xx; 897 struct cvmx_ipd_sub_port_fcs_cn38xx cn58xx;
824 struct cvmx_ipd_sub_port_fcs_cn38xx cn58xxp1; 898 struct cvmx_ipd_sub_port_fcs_cn38xx cn58xxp1;
899 struct cvmx_ipd_sub_port_fcs_s cn63xx;
900 struct cvmx_ipd_sub_port_fcs_s cn63xxp1;
825}; 901};
826 902
827union cvmx_ipd_sub_port_qos_cnt { 903union cvmx_ipd_sub_port_qos_cnt {
@@ -835,6 +911,8 @@ union cvmx_ipd_sub_port_qos_cnt {
835 struct cvmx_ipd_sub_port_qos_cnt_s cn52xxp1; 911 struct cvmx_ipd_sub_port_qos_cnt_s cn52xxp1;
836 struct cvmx_ipd_sub_port_qos_cnt_s cn56xx; 912 struct cvmx_ipd_sub_port_qos_cnt_s cn56xx;
837 struct cvmx_ipd_sub_port_qos_cnt_s cn56xxp1; 913 struct cvmx_ipd_sub_port_qos_cnt_s cn56xxp1;
914 struct cvmx_ipd_sub_port_qos_cnt_s cn63xx;
915 struct cvmx_ipd_sub_port_qos_cnt_s cn63xxp1;
838}; 916};
839 917
840union cvmx_ipd_wqe_fpa_queue { 918union cvmx_ipd_wqe_fpa_queue {
@@ -854,6 +932,8 @@ union cvmx_ipd_wqe_fpa_queue {
854 struct cvmx_ipd_wqe_fpa_queue_s cn56xxp1; 932 struct cvmx_ipd_wqe_fpa_queue_s cn56xxp1;
855 struct cvmx_ipd_wqe_fpa_queue_s cn58xx; 933 struct cvmx_ipd_wqe_fpa_queue_s cn58xx;
856 struct cvmx_ipd_wqe_fpa_queue_s cn58xxp1; 934 struct cvmx_ipd_wqe_fpa_queue_s cn58xxp1;
935 struct cvmx_ipd_wqe_fpa_queue_s cn63xx;
936 struct cvmx_ipd_wqe_fpa_queue_s cn63xxp1;
857}; 937};
858 938
859union cvmx_ipd_wqe_ptr_valid { 939union cvmx_ipd_wqe_ptr_valid {
@@ -872,6 +952,8 @@ union cvmx_ipd_wqe_ptr_valid {
872 struct cvmx_ipd_wqe_ptr_valid_s cn56xxp1; 952 struct cvmx_ipd_wqe_ptr_valid_s cn56xxp1;
873 struct cvmx_ipd_wqe_ptr_valid_s cn58xx; 953 struct cvmx_ipd_wqe_ptr_valid_s cn58xx;
874 struct cvmx_ipd_wqe_ptr_valid_s cn58xxp1; 954 struct cvmx_ipd_wqe_ptr_valid_s cn58xxp1;
955 struct cvmx_ipd_wqe_ptr_valid_s cn63xx;
956 struct cvmx_ipd_wqe_ptr_valid_s cn63xxp1;
875}; 957};
876 958
877#endif 959#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-l2c-defs.h b/arch/mips/include/asm/octeon/cvmx-l2c-defs.h
index 337583842b51..7a50a0beb472 100644
--- a/arch/mips/include/asm/octeon/cvmx-l2c-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-l2c-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,70 +28,113 @@
28#ifndef __CVMX_L2C_DEFS_H__ 28#ifndef __CVMX_L2C_DEFS_H__
29#define __CVMX_L2C_DEFS_H__ 29#define __CVMX_L2C_DEFS_H__
30 30
31#define CVMX_L2C_BST0 \ 31#define CVMX_L2C_BIG_CTL (CVMX_ADD_IO_SEG(0x0001180080800030ull))
32 CVMX_ADD_IO_SEG(0x00011800800007F8ull) 32#define CVMX_L2C_BST (CVMX_ADD_IO_SEG(0x00011800808007F8ull))
33#define CVMX_L2C_BST1 \ 33#define CVMX_L2C_BST0 (CVMX_ADD_IO_SEG(0x00011800800007F8ull))
34 CVMX_ADD_IO_SEG(0x00011800800007F0ull) 34#define CVMX_L2C_BST1 (CVMX_ADD_IO_SEG(0x00011800800007F0ull))
35#define CVMX_L2C_BST2 \ 35#define CVMX_L2C_BST2 (CVMX_ADD_IO_SEG(0x00011800800007E8ull))
36 CVMX_ADD_IO_SEG(0x00011800800007E8ull) 36#define CVMX_L2C_BST_MEMX(block_id) (CVMX_ADD_IO_SEG(0x0001180080C007F8ull))
37#define CVMX_L2C_CFG \ 37#define CVMX_L2C_BST_TDTX(block_id) (CVMX_ADD_IO_SEG(0x0001180080A007F0ull))
38 CVMX_ADD_IO_SEG(0x0001180080000000ull) 38#define CVMX_L2C_BST_TTGX(block_id) (CVMX_ADD_IO_SEG(0x0001180080A007F8ull))
39#define CVMX_L2C_DBG \ 39#define CVMX_L2C_CFG (CVMX_ADD_IO_SEG(0x0001180080000000ull))
40 CVMX_ADD_IO_SEG(0x0001180080000030ull) 40#define CVMX_L2C_COP0_MAPX(offset) (CVMX_ADD_IO_SEG(0x0001180080940000ull) + ((offset) & 16383) * 8)
41#define CVMX_L2C_DUT \ 41#define CVMX_L2C_CTL (CVMX_ADD_IO_SEG(0x0001180080800000ull))
42 CVMX_ADD_IO_SEG(0x0001180080000050ull) 42#define CVMX_L2C_DBG (CVMX_ADD_IO_SEG(0x0001180080000030ull))
43#define CVMX_L2C_GRPWRR0 \ 43#define CVMX_L2C_DUT (CVMX_ADD_IO_SEG(0x0001180080000050ull))
44 CVMX_ADD_IO_SEG(0x00011800800000C8ull) 44#define CVMX_L2C_DUT_MAPX(offset) (CVMX_ADD_IO_SEG(0x0001180080E00000ull) + ((offset) & 2047) * 8)
45#define CVMX_L2C_GRPWRR1 \ 45#define CVMX_L2C_ERR_TDTX(block_id) (CVMX_ADD_IO_SEG(0x0001180080A007E0ull))
46 CVMX_ADD_IO_SEG(0x00011800800000D0ull) 46#define CVMX_L2C_ERR_TTGX(block_id) (CVMX_ADD_IO_SEG(0x0001180080A007E8ull))
47#define CVMX_L2C_INT_EN \ 47#define CVMX_L2C_ERR_VBFX(block_id) (CVMX_ADD_IO_SEG(0x0001180080C007F0ull))
48 CVMX_ADD_IO_SEG(0x0001180080000100ull) 48#define CVMX_L2C_ERR_XMC (CVMX_ADD_IO_SEG(0x00011800808007D8ull))
49#define CVMX_L2C_INT_STAT \ 49#define CVMX_L2C_GRPWRR0 (CVMX_ADD_IO_SEG(0x00011800800000C8ull))
50 CVMX_ADD_IO_SEG(0x00011800800000F8ull) 50#define CVMX_L2C_GRPWRR1 (CVMX_ADD_IO_SEG(0x00011800800000D0ull))
51#define CVMX_L2C_LCKBASE \ 51#define CVMX_L2C_INT_EN (CVMX_ADD_IO_SEG(0x0001180080000100ull))
52 CVMX_ADD_IO_SEG(0x0001180080000058ull) 52#define CVMX_L2C_INT_ENA (CVMX_ADD_IO_SEG(0x0001180080800020ull))
53#define CVMX_L2C_LCKOFF \ 53#define CVMX_L2C_INT_REG (CVMX_ADD_IO_SEG(0x0001180080800018ull))
54 CVMX_ADD_IO_SEG(0x0001180080000060ull) 54#define CVMX_L2C_INT_STAT (CVMX_ADD_IO_SEG(0x00011800800000F8ull))
55#define CVMX_L2C_LFB0 \ 55#define CVMX_L2C_IOCX_PFC(block_id) (CVMX_ADD_IO_SEG(0x0001180080800420ull))
56 CVMX_ADD_IO_SEG(0x0001180080000038ull) 56#define CVMX_L2C_IORX_PFC(block_id) (CVMX_ADD_IO_SEG(0x0001180080800428ull))
57#define CVMX_L2C_LFB1 \ 57#define CVMX_L2C_LCKBASE (CVMX_ADD_IO_SEG(0x0001180080000058ull))
58 CVMX_ADD_IO_SEG(0x0001180080000040ull) 58#define CVMX_L2C_LCKOFF (CVMX_ADD_IO_SEG(0x0001180080000060ull))
59#define CVMX_L2C_LFB2 \ 59#define CVMX_L2C_LFB0 (CVMX_ADD_IO_SEG(0x0001180080000038ull))
60 CVMX_ADD_IO_SEG(0x0001180080000048ull) 60#define CVMX_L2C_LFB1 (CVMX_ADD_IO_SEG(0x0001180080000040ull))
61#define CVMX_L2C_LFB3 \ 61#define CVMX_L2C_LFB2 (CVMX_ADD_IO_SEG(0x0001180080000048ull))
62 CVMX_ADD_IO_SEG(0x00011800800000B8ull) 62#define CVMX_L2C_LFB3 (CVMX_ADD_IO_SEG(0x00011800800000B8ull))
63#define CVMX_L2C_OOB \ 63#define CVMX_L2C_OOB (CVMX_ADD_IO_SEG(0x00011800800000D8ull))
64 CVMX_ADD_IO_SEG(0x00011800800000D8ull) 64#define CVMX_L2C_OOB1 (CVMX_ADD_IO_SEG(0x00011800800000E0ull))
65#define CVMX_L2C_OOB1 \ 65#define CVMX_L2C_OOB2 (CVMX_ADD_IO_SEG(0x00011800800000E8ull))
66 CVMX_ADD_IO_SEG(0x00011800800000E0ull) 66#define CVMX_L2C_OOB3 (CVMX_ADD_IO_SEG(0x00011800800000F0ull))
67#define CVMX_L2C_OOB2 \ 67#define CVMX_L2C_PFC0 CVMX_L2C_PFCX(0)
68 CVMX_ADD_IO_SEG(0x00011800800000E8ull) 68#define CVMX_L2C_PFC1 CVMX_L2C_PFCX(1)
69#define CVMX_L2C_OOB3 \ 69#define CVMX_L2C_PFC2 CVMX_L2C_PFCX(2)
70 CVMX_ADD_IO_SEG(0x00011800800000F0ull) 70#define CVMX_L2C_PFC3 CVMX_L2C_PFCX(3)
71#define CVMX_L2C_PFC0 \ 71#define CVMX_L2C_PFCTL (CVMX_ADD_IO_SEG(0x0001180080000090ull))
72 CVMX_ADD_IO_SEG(0x0001180080000098ull) 72#define CVMX_L2C_PFCX(offset) (CVMX_ADD_IO_SEG(0x0001180080000098ull) + ((offset) & 3) * 8)
73#define CVMX_L2C_PFC1 \ 73#define CVMX_L2C_PPGRP (CVMX_ADD_IO_SEG(0x00011800800000C0ull))
74 CVMX_ADD_IO_SEG(0x00011800800000A0ull) 74#define CVMX_L2C_QOS_IOBX(block_id) (CVMX_ADD_IO_SEG(0x0001180080880200ull))
75#define CVMX_L2C_PFC2 \ 75#define CVMX_L2C_QOS_PPX(offset) (CVMX_ADD_IO_SEG(0x0001180080880000ull) + ((offset) & 7) * 8)
76 CVMX_ADD_IO_SEG(0x00011800800000A8ull) 76#define CVMX_L2C_QOS_WGT (CVMX_ADD_IO_SEG(0x0001180080800008ull))
77#define CVMX_L2C_PFC3 \ 77#define CVMX_L2C_RSCX_PFC(block_id) (CVMX_ADD_IO_SEG(0x0001180080800410ull))
78 CVMX_ADD_IO_SEG(0x00011800800000B0ull) 78#define CVMX_L2C_RSDX_PFC(block_id) (CVMX_ADD_IO_SEG(0x0001180080800418ull))
79#define CVMX_L2C_PFCTL \ 79#define CVMX_L2C_SPAR0 (CVMX_ADD_IO_SEG(0x0001180080000068ull))
80 CVMX_ADD_IO_SEG(0x0001180080000090ull) 80#define CVMX_L2C_SPAR1 (CVMX_ADD_IO_SEG(0x0001180080000070ull))
81#define CVMX_L2C_PFCX(offset) \ 81#define CVMX_L2C_SPAR2 (CVMX_ADD_IO_SEG(0x0001180080000078ull))
82 CVMX_ADD_IO_SEG(0x0001180080000098ull + (((offset) & 3) * 8)) 82#define CVMX_L2C_SPAR3 (CVMX_ADD_IO_SEG(0x0001180080000080ull))
83#define CVMX_L2C_PPGRP \ 83#define CVMX_L2C_SPAR4 (CVMX_ADD_IO_SEG(0x0001180080000088ull))
84 CVMX_ADD_IO_SEG(0x00011800800000C0ull) 84#define CVMX_L2C_TADX_ECC0(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00018ull))
85#define CVMX_L2C_SPAR0 \ 85#define CVMX_L2C_TADX_ECC1(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00020ull))
86 CVMX_ADD_IO_SEG(0x0001180080000068ull) 86#define CVMX_L2C_TADX_IEN(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00000ull))
87#define CVMX_L2C_SPAR1 \ 87#define CVMX_L2C_TADX_INT(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00028ull))
88 CVMX_ADD_IO_SEG(0x0001180080000070ull) 88#define CVMX_L2C_TADX_PFC0(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00400ull))
89#define CVMX_L2C_SPAR2 \ 89#define CVMX_L2C_TADX_PFC1(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00408ull))
90 CVMX_ADD_IO_SEG(0x0001180080000078ull) 90#define CVMX_L2C_TADX_PFC2(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00410ull))
91#define CVMX_L2C_SPAR3 \ 91#define CVMX_L2C_TADX_PFC3(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00418ull))
92 CVMX_ADD_IO_SEG(0x0001180080000080ull) 92#define CVMX_L2C_TADX_PRF(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00008ull))
93#define CVMX_L2C_SPAR4 \ 93#define CVMX_L2C_TADX_TAG(block_id) (CVMX_ADD_IO_SEG(0x0001180080A00010ull))
94 CVMX_ADD_IO_SEG(0x0001180080000088ull) 94#define CVMX_L2C_VER_ID (CVMX_ADD_IO_SEG(0x00011800808007E0ull))
95#define CVMX_L2C_VER_IOB (CVMX_ADD_IO_SEG(0x00011800808007F0ull))
96#define CVMX_L2C_VER_MSC (CVMX_ADD_IO_SEG(0x00011800808007D0ull))
97#define CVMX_L2C_VER_PP (CVMX_ADD_IO_SEG(0x00011800808007E8ull))
98#define CVMX_L2C_VIRTID_IOBX(block_id) (CVMX_ADD_IO_SEG(0x00011800808C0200ull))
99#define CVMX_L2C_VIRTID_PPX(offset) (CVMX_ADD_IO_SEG(0x00011800808C0000ull) + ((offset) & 7) * 8)
100#define CVMX_L2C_VRT_CTL (CVMX_ADD_IO_SEG(0x0001180080800010ull))
101#define CVMX_L2C_VRT_MEMX(offset) (CVMX_ADD_IO_SEG(0x0001180080900000ull) + ((offset) & 1023) * 8)
102#define CVMX_L2C_WPAR_IOBX(block_id) (CVMX_ADD_IO_SEG(0x0001180080840200ull))
103#define CVMX_L2C_WPAR_PPX(offset) (CVMX_ADD_IO_SEG(0x0001180080840000ull) + ((offset) & 7) * 8)
104#define CVMX_L2C_XMCX_PFC(block_id) (CVMX_ADD_IO_SEG(0x0001180080800400ull))
105#define CVMX_L2C_XMC_CMD (CVMX_ADD_IO_SEG(0x0001180080800028ull))
106#define CVMX_L2C_XMDX_PFC(block_id) (CVMX_ADD_IO_SEG(0x0001180080800408ull))
107
108union cvmx_l2c_big_ctl {
109 uint64_t u64;
110 struct cvmx_l2c_big_ctl_s {
111 uint64_t reserved_8_63:56;
112 uint64_t maxdram:4;
113 uint64_t reserved_1_3:3;
114 uint64_t disable:1;
115 } s;
116 struct cvmx_l2c_big_ctl_s cn63xx;
117};
118
119union cvmx_l2c_bst {
120 uint64_t u64;
121 struct cvmx_l2c_bst_s {
122 uint64_t reserved_38_63:26;
123 uint64_t dutfl:6;
124 uint64_t reserved_17_31:15;
125 uint64_t ioccmdfl:1;
126 uint64_t reserved_13_15:3;
127 uint64_t iocdatfl:1;
128 uint64_t reserved_9_11:3;
129 uint64_t dutresfl:1;
130 uint64_t reserved_5_7:3;
131 uint64_t vrtfl:1;
132 uint64_t reserved_1_3:3;
133 uint64_t tdffl:1;
134 } s;
135 struct cvmx_l2c_bst_s cn63xx;
136 struct cvmx_l2c_bst_s cn63xxp1;
137};
95 138
96union cvmx_l2c_bst0 { 139union cvmx_l2c_bst0 {
97 uint64_t u64; 140 uint64_t u64;
@@ -253,6 +296,48 @@ union cvmx_l2c_bst2 {
253 struct cvmx_l2c_bst2_cn56xx cn58xxp1; 296 struct cvmx_l2c_bst2_cn56xx cn58xxp1;
254}; 297};
255 298
299union cvmx_l2c_bst_memx {
300 uint64_t u64;
301 struct cvmx_l2c_bst_memx_s {
302 uint64_t start_bist:1;
303 uint64_t clear_bist:1;
304 uint64_t reserved_5_61:57;
305 uint64_t rdffl:1;
306 uint64_t vbffl:4;
307 } s;
308 struct cvmx_l2c_bst_memx_s cn63xx;
309 struct cvmx_l2c_bst_memx_s cn63xxp1;
310};
311
312union cvmx_l2c_bst_tdtx {
313 uint64_t u64;
314 struct cvmx_l2c_bst_tdtx_s {
315 uint64_t reserved_32_63:32;
316 uint64_t fbfrspfl:8;
317 uint64_t sbffl:8;
318 uint64_t fbffl:8;
319 uint64_t l2dfl:8;
320 } s;
321 struct cvmx_l2c_bst_tdtx_s cn63xx;
322 struct cvmx_l2c_bst_tdtx_cn63xxp1 {
323 uint64_t reserved_24_63:40;
324 uint64_t sbffl:8;
325 uint64_t fbffl:8;
326 uint64_t l2dfl:8;
327 } cn63xxp1;
328};
329
330union cvmx_l2c_bst_ttgx {
331 uint64_t u64;
332 struct cvmx_l2c_bst_ttgx_s {
333 uint64_t reserved_17_63:47;
334 uint64_t lrufl:1;
335 uint64_t tagfl:16;
336 } s;
337 struct cvmx_l2c_bst_ttgx_s cn63xx;
338 struct cvmx_l2c_bst_ttgx_s cn63xxp1;
339};
340
256union cvmx_l2c_cfg { 341union cvmx_l2c_cfg {
257 uint64_t u64; 342 uint64_t u64;
258 struct cvmx_l2c_cfg_s { 343 struct cvmx_l2c_cfg_s {
@@ -333,6 +418,49 @@ union cvmx_l2c_cfg {
333 } cn58xxp1; 418 } cn58xxp1;
334}; 419};
335 420
421union cvmx_l2c_cop0_mapx {
422 uint64_t u64;
423 struct cvmx_l2c_cop0_mapx_s {
424 uint64_t data:64;
425 } s;
426 struct cvmx_l2c_cop0_mapx_s cn63xx;
427 struct cvmx_l2c_cop0_mapx_s cn63xxp1;
428};
429
430union cvmx_l2c_ctl {
431 uint64_t u64;
432 struct cvmx_l2c_ctl_s {
433 uint64_t reserved_28_63:36;
434 uint64_t disstgl2i:1;
435 uint64_t l2dfsbe:1;
436 uint64_t l2dfdbe:1;
437 uint64_t discclk:1;
438 uint64_t maxvab:4;
439 uint64_t maxlfb:4;
440 uint64_t rsp_arb_mode:1;
441 uint64_t xmc_arb_mode:1;
442 uint64_t ef_ena:1;
443 uint64_t ef_cnt:7;
444 uint64_t vab_thresh:4;
445 uint64_t disecc:1;
446 uint64_t disidxalias:1;
447 } s;
448 struct cvmx_l2c_ctl_s cn63xx;
449 struct cvmx_l2c_ctl_cn63xxp1 {
450 uint64_t reserved_25_63:39;
451 uint64_t discclk:1;
452 uint64_t maxvab:4;
453 uint64_t maxlfb:4;
454 uint64_t rsp_arb_mode:1;
455 uint64_t xmc_arb_mode:1;
456 uint64_t ef_ena:1;
457 uint64_t ef_cnt:7;
458 uint64_t vab_thresh:4;
459 uint64_t disecc:1;
460 uint64_t disidxalias:1;
461 } cn63xxp1;
462};
463
336union cvmx_l2c_dbg { 464union cvmx_l2c_dbg {
337 uint64_t u64; 465 uint64_t u64;
338 struct cvmx_l2c_dbg_s { 466 struct cvmx_l2c_dbg_s {
@@ -349,7 +477,9 @@ union cvmx_l2c_dbg {
349 uint64_t reserved_13_63:51; 477 uint64_t reserved_13_63:51;
350 uint64_t lfb_enum:2; 478 uint64_t lfb_enum:2;
351 uint64_t lfb_dmp:1; 479 uint64_t lfb_dmp:1;
352 uint64_t reserved_5_9:5; 480 uint64_t reserved_7_9:3;
481 uint64_t ppnum:1;
482 uint64_t reserved_5_5:1;
353 uint64_t set:2; 483 uint64_t set:2;
354 uint64_t finv:1; 484 uint64_t finv:1;
355 uint64_t l2d:1; 485 uint64_t l2d:1;
@@ -420,6 +550,79 @@ union cvmx_l2c_dut {
420 struct cvmx_l2c_dut_s cn58xxp1; 550 struct cvmx_l2c_dut_s cn58xxp1;
421}; 551};
422 552
553union cvmx_l2c_dut_mapx {
554 uint64_t u64;
555 struct cvmx_l2c_dut_mapx_s {
556 uint64_t reserved_38_63:26;
557 uint64_t tag:28;
558 uint64_t reserved_1_9:9;
559 uint64_t valid:1;
560 } s;
561 struct cvmx_l2c_dut_mapx_s cn63xx;
562 struct cvmx_l2c_dut_mapx_s cn63xxp1;
563};
564
565union cvmx_l2c_err_tdtx {
566 uint64_t u64;
567 struct cvmx_l2c_err_tdtx_s {
568 uint64_t dbe:1;
569 uint64_t sbe:1;
570 uint64_t vdbe:1;
571 uint64_t vsbe:1;
572 uint64_t syn:10;
573 uint64_t reserved_21_49:29;
574 uint64_t wayidx:17;
575 uint64_t reserved_2_3:2;
576 uint64_t type:2;
577 } s;
578 struct cvmx_l2c_err_tdtx_s cn63xx;
579 struct cvmx_l2c_err_tdtx_s cn63xxp1;
580};
581
582union cvmx_l2c_err_ttgx {
583 uint64_t u64;
584 struct cvmx_l2c_err_ttgx_s {
585 uint64_t dbe:1;
586 uint64_t sbe:1;
587 uint64_t noway:1;
588 uint64_t reserved_56_60:5;
589 uint64_t syn:6;
590 uint64_t reserved_21_49:29;
591 uint64_t wayidx:14;
592 uint64_t reserved_2_6:5;
593 uint64_t type:2;
594 } s;
595 struct cvmx_l2c_err_ttgx_s cn63xx;
596 struct cvmx_l2c_err_ttgx_s cn63xxp1;
597};
598
599union cvmx_l2c_err_vbfx {
600 uint64_t u64;
601 struct cvmx_l2c_err_vbfx_s {
602 uint64_t reserved_62_63:2;
603 uint64_t vdbe:1;
604 uint64_t vsbe:1;
605 uint64_t vsyn:10;
606 uint64_t reserved_2_49:48;
607 uint64_t type:2;
608 } s;
609 struct cvmx_l2c_err_vbfx_s cn63xx;
610 struct cvmx_l2c_err_vbfx_s cn63xxp1;
611};
612
613union cvmx_l2c_err_xmc {
614 uint64_t u64;
615 struct cvmx_l2c_err_xmc_s {
616 uint64_t cmd:6;
617 uint64_t reserved_52_57:6;
618 uint64_t sid:4;
619 uint64_t reserved_38_47:10;
620 uint64_t addr:38;
621 } s;
622 struct cvmx_l2c_err_xmc_s cn63xx;
623 struct cvmx_l2c_err_xmc_s cn63xxp1;
624};
625
423union cvmx_l2c_grpwrr0 { 626union cvmx_l2c_grpwrr0 {
424 uint64_t u64; 627 uint64_t u64;
425 struct cvmx_l2c_grpwrr0_s { 628 struct cvmx_l2c_grpwrr0_s {
@@ -464,6 +667,60 @@ union cvmx_l2c_int_en {
464 struct cvmx_l2c_int_en_s cn56xxp1; 667 struct cvmx_l2c_int_en_s cn56xxp1;
465}; 668};
466 669
670union cvmx_l2c_int_ena {
671 uint64_t u64;
672 struct cvmx_l2c_int_ena_s {
673 uint64_t reserved_8_63:56;
674 uint64_t bigrd:1;
675 uint64_t bigwr:1;
676 uint64_t vrtpe:1;
677 uint64_t vrtadrng:1;
678 uint64_t vrtidrng:1;
679 uint64_t vrtwr:1;
680 uint64_t holewr:1;
681 uint64_t holerd:1;
682 } s;
683 struct cvmx_l2c_int_ena_s cn63xx;
684 struct cvmx_l2c_int_ena_cn63xxp1 {
685 uint64_t reserved_6_63:58;
686 uint64_t vrtpe:1;
687 uint64_t vrtadrng:1;
688 uint64_t vrtidrng:1;
689 uint64_t vrtwr:1;
690 uint64_t holewr:1;
691 uint64_t holerd:1;
692 } cn63xxp1;
693};
694
695union cvmx_l2c_int_reg {
696 uint64_t u64;
697 struct cvmx_l2c_int_reg_s {
698 uint64_t reserved_17_63:47;
699 uint64_t tad0:1;
700 uint64_t reserved_8_15:8;
701 uint64_t bigrd:1;
702 uint64_t bigwr:1;
703 uint64_t vrtpe:1;
704 uint64_t vrtadrng:1;
705 uint64_t vrtidrng:1;
706 uint64_t vrtwr:1;
707 uint64_t holewr:1;
708 uint64_t holerd:1;
709 } s;
710 struct cvmx_l2c_int_reg_s cn63xx;
711 struct cvmx_l2c_int_reg_cn63xxp1 {
712 uint64_t reserved_17_63:47;
713 uint64_t tad0:1;
714 uint64_t reserved_6_15:10;
715 uint64_t vrtpe:1;
716 uint64_t vrtadrng:1;
717 uint64_t vrtidrng:1;
718 uint64_t vrtwr:1;
719 uint64_t holewr:1;
720 uint64_t holerd:1;
721 } cn63xxp1;
722};
723
467union cvmx_l2c_int_stat { 724union cvmx_l2c_int_stat {
468 uint64_t u64; 725 uint64_t u64;
469 struct cvmx_l2c_int_stat_s { 726 struct cvmx_l2c_int_stat_s {
@@ -484,6 +741,24 @@ union cvmx_l2c_int_stat {
484 struct cvmx_l2c_int_stat_s cn56xxp1; 741 struct cvmx_l2c_int_stat_s cn56xxp1;
485}; 742};
486 743
744union cvmx_l2c_iocx_pfc {
745 uint64_t u64;
746 struct cvmx_l2c_iocx_pfc_s {
747 uint64_t count:64;
748 } s;
749 struct cvmx_l2c_iocx_pfc_s cn63xx;
750 struct cvmx_l2c_iocx_pfc_s cn63xxp1;
751};
752
753union cvmx_l2c_iorx_pfc {
754 uint64_t u64;
755 struct cvmx_l2c_iorx_pfc_s {
756 uint64_t count:64;
757 } s;
758 struct cvmx_l2c_iorx_pfc_s cn63xx;
759 struct cvmx_l2c_iorx_pfc_s cn63xxp1;
760};
761
487union cvmx_l2c_lckbase { 762union cvmx_l2c_lckbase {
488 uint64_t u64; 763 uint64_t u64;
489 struct cvmx_l2c_lckbase_s { 764 struct cvmx_l2c_lckbase_s {
@@ -855,6 +1130,59 @@ union cvmx_l2c_ppgrp {
855 struct cvmx_l2c_ppgrp_s cn56xxp1; 1130 struct cvmx_l2c_ppgrp_s cn56xxp1;
856}; 1131};
857 1132
1133union cvmx_l2c_qos_iobx {
1134 uint64_t u64;
1135 struct cvmx_l2c_qos_iobx_s {
1136 uint64_t reserved_6_63:58;
1137 uint64_t dwblvl:2;
1138 uint64_t reserved_2_3:2;
1139 uint64_t lvl:2;
1140 } s;
1141 struct cvmx_l2c_qos_iobx_s cn63xx;
1142 struct cvmx_l2c_qos_iobx_s cn63xxp1;
1143};
1144
1145union cvmx_l2c_qos_ppx {
1146 uint64_t u64;
1147 struct cvmx_l2c_qos_ppx_s {
1148 uint64_t reserved_2_63:62;
1149 uint64_t lvl:2;
1150 } s;
1151 struct cvmx_l2c_qos_ppx_s cn63xx;
1152 struct cvmx_l2c_qos_ppx_s cn63xxp1;
1153};
1154
1155union cvmx_l2c_qos_wgt {
1156 uint64_t u64;
1157 struct cvmx_l2c_qos_wgt_s {
1158 uint64_t reserved_32_63:32;
1159 uint64_t wgt3:8;
1160 uint64_t wgt2:8;
1161 uint64_t wgt1:8;
1162 uint64_t wgt0:8;
1163 } s;
1164 struct cvmx_l2c_qos_wgt_s cn63xx;
1165 struct cvmx_l2c_qos_wgt_s cn63xxp1;
1166};
1167
1168union cvmx_l2c_rscx_pfc {
1169 uint64_t u64;
1170 struct cvmx_l2c_rscx_pfc_s {
1171 uint64_t count:64;
1172 } s;
1173 struct cvmx_l2c_rscx_pfc_s cn63xx;
1174 struct cvmx_l2c_rscx_pfc_s cn63xxp1;
1175};
1176
1177union cvmx_l2c_rsdx_pfc {
1178 uint64_t u64;
1179 struct cvmx_l2c_rsdx_pfc_s {
1180 uint64_t count:64;
1181 } s;
1182 struct cvmx_l2c_rsdx_pfc_s cn63xx;
1183 struct cvmx_l2c_rsdx_pfc_s cn63xxp1;
1184};
1185
858union cvmx_l2c_spar0 { 1186union cvmx_l2c_spar0 {
859 uint64_t u64; 1187 uint64_t u64;
860 struct cvmx_l2c_spar0_s { 1188 struct cvmx_l2c_spar0_s {
@@ -960,4 +1288,282 @@ union cvmx_l2c_spar4 {
960 struct cvmx_l2c_spar4_s cn58xxp1; 1288 struct cvmx_l2c_spar4_s cn58xxp1;
961}; 1289};
962 1290
1291union cvmx_l2c_tadx_ecc0 {
1292 uint64_t u64;
1293 struct cvmx_l2c_tadx_ecc0_s {
1294 uint64_t reserved_58_63:6;
1295 uint64_t ow3ecc:10;
1296 uint64_t reserved_42_47:6;
1297 uint64_t ow2ecc:10;
1298 uint64_t reserved_26_31:6;
1299 uint64_t ow1ecc:10;
1300 uint64_t reserved_10_15:6;
1301 uint64_t ow0ecc:10;
1302 } s;
1303 struct cvmx_l2c_tadx_ecc0_s cn63xx;
1304 struct cvmx_l2c_tadx_ecc0_s cn63xxp1;
1305};
1306
1307union cvmx_l2c_tadx_ecc1 {
1308 uint64_t u64;
1309 struct cvmx_l2c_tadx_ecc1_s {
1310 uint64_t reserved_58_63:6;
1311 uint64_t ow7ecc:10;
1312 uint64_t reserved_42_47:6;
1313 uint64_t ow6ecc:10;
1314 uint64_t reserved_26_31:6;
1315 uint64_t ow5ecc:10;
1316 uint64_t reserved_10_15:6;
1317 uint64_t ow4ecc:10;
1318 } s;
1319 struct cvmx_l2c_tadx_ecc1_s cn63xx;
1320 struct cvmx_l2c_tadx_ecc1_s cn63xxp1;
1321};
1322
1323union cvmx_l2c_tadx_ien {
1324 uint64_t u64;
1325 struct cvmx_l2c_tadx_ien_s {
1326 uint64_t reserved_9_63:55;
1327 uint64_t wrdislmc:1;
1328 uint64_t rddislmc:1;
1329 uint64_t noway:1;
1330 uint64_t vbfdbe:1;
1331 uint64_t vbfsbe:1;
1332 uint64_t tagdbe:1;
1333 uint64_t tagsbe:1;
1334 uint64_t l2ddbe:1;
1335 uint64_t l2dsbe:1;
1336 } s;
1337 struct cvmx_l2c_tadx_ien_s cn63xx;
1338 struct cvmx_l2c_tadx_ien_cn63xxp1 {
1339 uint64_t reserved_7_63:57;
1340 uint64_t noway:1;
1341 uint64_t vbfdbe:1;
1342 uint64_t vbfsbe:1;
1343 uint64_t tagdbe:1;
1344 uint64_t tagsbe:1;
1345 uint64_t l2ddbe:1;
1346 uint64_t l2dsbe:1;
1347 } cn63xxp1;
1348};
1349
1350union cvmx_l2c_tadx_int {
1351 uint64_t u64;
1352 struct cvmx_l2c_tadx_int_s {
1353 uint64_t reserved_9_63:55;
1354 uint64_t wrdislmc:1;
1355 uint64_t rddislmc:1;
1356 uint64_t noway:1;
1357 uint64_t vbfdbe:1;
1358 uint64_t vbfsbe:1;
1359 uint64_t tagdbe:1;
1360 uint64_t tagsbe:1;
1361 uint64_t l2ddbe:1;
1362 uint64_t l2dsbe:1;
1363 } s;
1364 struct cvmx_l2c_tadx_int_s cn63xx;
1365};
1366
1367union cvmx_l2c_tadx_pfc0 {
1368 uint64_t u64;
1369 struct cvmx_l2c_tadx_pfc0_s {
1370 uint64_t count:64;
1371 } s;
1372 struct cvmx_l2c_tadx_pfc0_s cn63xx;
1373 struct cvmx_l2c_tadx_pfc0_s cn63xxp1;
1374};
1375
1376union cvmx_l2c_tadx_pfc1 {
1377 uint64_t u64;
1378 struct cvmx_l2c_tadx_pfc1_s {
1379 uint64_t count:64;
1380 } s;
1381 struct cvmx_l2c_tadx_pfc1_s cn63xx;
1382 struct cvmx_l2c_tadx_pfc1_s cn63xxp1;
1383};
1384
1385union cvmx_l2c_tadx_pfc2 {
1386 uint64_t u64;
1387 struct cvmx_l2c_tadx_pfc2_s {
1388 uint64_t count:64;
1389 } s;
1390 struct cvmx_l2c_tadx_pfc2_s cn63xx;
1391 struct cvmx_l2c_tadx_pfc2_s cn63xxp1;
1392};
1393
1394union cvmx_l2c_tadx_pfc3 {
1395 uint64_t u64;
1396 struct cvmx_l2c_tadx_pfc3_s {
1397 uint64_t count:64;
1398 } s;
1399 struct cvmx_l2c_tadx_pfc3_s cn63xx;
1400 struct cvmx_l2c_tadx_pfc3_s cn63xxp1;
1401};
1402
1403union cvmx_l2c_tadx_prf {
1404 uint64_t u64;
1405 struct cvmx_l2c_tadx_prf_s {
1406 uint64_t reserved_32_63:32;
1407 uint64_t cnt3sel:8;
1408 uint64_t cnt2sel:8;
1409 uint64_t cnt1sel:8;
1410 uint64_t cnt0sel:8;
1411 } s;
1412 struct cvmx_l2c_tadx_prf_s cn63xx;
1413 struct cvmx_l2c_tadx_prf_s cn63xxp1;
1414};
1415
1416union cvmx_l2c_tadx_tag {
1417 uint64_t u64;
1418 struct cvmx_l2c_tadx_tag_s {
1419 uint64_t reserved_46_63:18;
1420 uint64_t ecc:6;
1421 uint64_t reserved_36_39:4;
1422 uint64_t tag:19;
1423 uint64_t reserved_4_16:13;
1424 uint64_t use:1;
1425 uint64_t valid:1;
1426 uint64_t dirty:1;
1427 uint64_t lock:1;
1428 } s;
1429 struct cvmx_l2c_tadx_tag_s cn63xx;
1430 struct cvmx_l2c_tadx_tag_s cn63xxp1;
1431};
1432
1433union cvmx_l2c_ver_id {
1434 uint64_t u64;
1435 struct cvmx_l2c_ver_id_s {
1436 uint64_t mask:64;
1437 } s;
1438 struct cvmx_l2c_ver_id_s cn63xx;
1439 struct cvmx_l2c_ver_id_s cn63xxp1;
1440};
1441
1442union cvmx_l2c_ver_iob {
1443 uint64_t u64;
1444 struct cvmx_l2c_ver_iob_s {
1445 uint64_t reserved_1_63:63;
1446 uint64_t mask:1;
1447 } s;
1448 struct cvmx_l2c_ver_iob_s cn63xx;
1449 struct cvmx_l2c_ver_iob_s cn63xxp1;
1450};
1451
1452union cvmx_l2c_ver_msc {
1453 uint64_t u64;
1454 struct cvmx_l2c_ver_msc_s {
1455 uint64_t reserved_2_63:62;
1456 uint64_t invl2:1;
1457 uint64_t dwb:1;
1458 } s;
1459 struct cvmx_l2c_ver_msc_s cn63xx;
1460};
1461
1462union cvmx_l2c_ver_pp {
1463 uint64_t u64;
1464 struct cvmx_l2c_ver_pp_s {
1465 uint64_t reserved_6_63:58;
1466 uint64_t mask:6;
1467 } s;
1468 struct cvmx_l2c_ver_pp_s cn63xx;
1469 struct cvmx_l2c_ver_pp_s cn63xxp1;
1470};
1471
1472union cvmx_l2c_virtid_iobx {
1473 uint64_t u64;
1474 struct cvmx_l2c_virtid_iobx_s {
1475 uint64_t reserved_14_63:50;
1476 uint64_t dwbid:6;
1477 uint64_t reserved_6_7:2;
1478 uint64_t id:6;
1479 } s;
1480 struct cvmx_l2c_virtid_iobx_s cn63xx;
1481 struct cvmx_l2c_virtid_iobx_s cn63xxp1;
1482};
1483
1484union cvmx_l2c_virtid_ppx {
1485 uint64_t u64;
1486 struct cvmx_l2c_virtid_ppx_s {
1487 uint64_t reserved_6_63:58;
1488 uint64_t id:6;
1489 } s;
1490 struct cvmx_l2c_virtid_ppx_s cn63xx;
1491 struct cvmx_l2c_virtid_ppx_s cn63xxp1;
1492};
1493
1494union cvmx_l2c_vrt_ctl {
1495 uint64_t u64;
1496 struct cvmx_l2c_vrt_ctl_s {
1497 uint64_t reserved_9_63:55;
1498 uint64_t ooberr:1;
1499 uint64_t reserved_7_7:1;
1500 uint64_t memsz:3;
1501 uint64_t numid:3;
1502 uint64_t enable:1;
1503 } s;
1504 struct cvmx_l2c_vrt_ctl_s cn63xx;
1505 struct cvmx_l2c_vrt_ctl_s cn63xxp1;
1506};
1507
1508union cvmx_l2c_vrt_memx {
1509 uint64_t u64;
1510 struct cvmx_l2c_vrt_memx_s {
1511 uint64_t reserved_36_63:28;
1512 uint64_t parity:4;
1513 uint64_t data:32;
1514 } s;
1515 struct cvmx_l2c_vrt_memx_s cn63xx;
1516 struct cvmx_l2c_vrt_memx_s cn63xxp1;
1517};
1518
1519union cvmx_l2c_wpar_iobx {
1520 uint64_t u64;
1521 struct cvmx_l2c_wpar_iobx_s {
1522 uint64_t reserved_16_63:48;
1523 uint64_t mask:16;
1524 } s;
1525 struct cvmx_l2c_wpar_iobx_s cn63xx;
1526 struct cvmx_l2c_wpar_iobx_s cn63xxp1;
1527};
1528
1529union cvmx_l2c_wpar_ppx {
1530 uint64_t u64;
1531 struct cvmx_l2c_wpar_ppx_s {
1532 uint64_t reserved_16_63:48;
1533 uint64_t mask:16;
1534 } s;
1535 struct cvmx_l2c_wpar_ppx_s cn63xx;
1536 struct cvmx_l2c_wpar_ppx_s cn63xxp1;
1537};
1538
1539union cvmx_l2c_xmcx_pfc {
1540 uint64_t u64;
1541 struct cvmx_l2c_xmcx_pfc_s {
1542 uint64_t count:64;
1543 } s;
1544 struct cvmx_l2c_xmcx_pfc_s cn63xx;
1545 struct cvmx_l2c_xmcx_pfc_s cn63xxp1;
1546};
1547
1548union cvmx_l2c_xmc_cmd {
1549 uint64_t u64;
1550 struct cvmx_l2c_xmc_cmd_s {
1551 uint64_t inuse:1;
1552 uint64_t cmd:6;
1553 uint64_t reserved_38_56:19;
1554 uint64_t addr:38;
1555 } s;
1556 struct cvmx_l2c_xmc_cmd_s cn63xx;
1557 struct cvmx_l2c_xmc_cmd_s cn63xxp1;
1558};
1559
1560union cvmx_l2c_xmdx_pfc {
1561 uint64_t u64;
1562 struct cvmx_l2c_xmdx_pfc_s {
1563 uint64_t count:64;
1564 } s;
1565 struct cvmx_l2c_xmdx_pfc_s cn63xx;
1566 struct cvmx_l2c_xmdx_pfc_s cn63xxp1;
1567};
1568
963#endif 1569#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-l2c.h b/arch/mips/include/asm/octeon/cvmx-l2c.h
index 2a8c0902ea50..0b32c5b118e2 100644
--- a/arch/mips/include/asm/octeon/cvmx-l2c.h
+++ b/arch/mips/include/asm/octeon/cvmx-l2c.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -26,7 +26,6 @@
26 ***********************license end**************************************/ 26 ***********************license end**************************************/
27 27
28/* 28/*
29 *
30 * Interface to the Level 2 Cache (L2C) control, measurement, and debugging 29 * Interface to the Level 2 Cache (L2C) control, measurement, and debugging
31 * facilities. 30 * facilities.
32 */ 31 */
@@ -34,93 +33,126 @@
34#ifndef __CVMX_L2C_H__ 33#ifndef __CVMX_L2C_H__
35#define __CVMX_L2C_H__ 34#define __CVMX_L2C_H__
36 35
37/* Deprecated macro, use function */ 36#define CVMX_L2_ASSOC cvmx_l2c_get_num_assoc() /* Deprecated macro, use function */
38#define CVMX_L2_ASSOC cvmx_l2c_get_num_assoc() 37#define CVMX_L2_SET_BITS cvmx_l2c_get_set_bits() /* Deprecated macro, use function */
39 38#define CVMX_L2_SETS cvmx_l2c_get_num_sets() /* Deprecated macro, use function */
40/* Deprecated macro, use function */
41#define CVMX_L2_SET_BITS cvmx_l2c_get_set_bits()
42 39
43/* Deprecated macro, use function */
44#define CVMX_L2_SETS cvmx_l2c_get_num_sets()
45 40
46#define CVMX_L2C_IDX_ADDR_SHIFT 7 /* based on 128 byte cache line size */ 41#define CVMX_L2C_IDX_ADDR_SHIFT 7 /* based on 128 byte cache line size */
47#define CVMX_L2C_IDX_MASK (cvmx_l2c_get_num_sets() - 1) 42#define CVMX_L2C_IDX_MASK (cvmx_l2c_get_num_sets() - 1)
48 43
49/* Defines for index aliasing computations */ 44/* Defines for index aliasing computations */
50#define CVMX_L2C_TAG_ADDR_ALIAS_SHIFT \ 45#define CVMX_L2C_TAG_ADDR_ALIAS_SHIFT (CVMX_L2C_IDX_ADDR_SHIFT + cvmx_l2c_get_set_bits())
51 (CVMX_L2C_IDX_ADDR_SHIFT + cvmx_l2c_get_set_bits()) 46#define CVMX_L2C_ALIAS_MASK (CVMX_L2C_IDX_MASK << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT)
47#define CVMX_L2C_MEMBANK_SELECT_SIZE 4096
52 48
53#define CVMX_L2C_ALIAS_MASK \ 49/* Defines for Virtualizations, valid only from Octeon II onwards. */
54 (CVMX_L2C_IDX_MASK << CVMX_L2C_TAG_ADDR_ALIAS_SHIFT) 50#define CVMX_L2C_VRT_MAX_VIRTID_ALLOWED ((OCTEON_IS_MODEL(OCTEON_CN63XX)) ? 64 : 0)
51#define CVMX_L2C_VRT_MAX_MEMSZ_ALLOWED ((OCTEON_IS_MODEL(OCTEON_CN63XX)) ? 32 : 0)
55 52
56union cvmx_l2c_tag { 53union cvmx_l2c_tag {
57 uint64_t u64; 54 uint64_t u64;
58 struct { 55 struct {
59 uint64_t reserved:28; 56 uint64_t reserved:28;
60 uint64_t V:1; /* Line valid */ 57 uint64_t V:1; /* Line valid */
61 uint64_t D:1; /* Line dirty */ 58 uint64_t D:1; /* Line dirty */
62 uint64_t L:1; /* Line locked */ 59 uint64_t L:1; /* Line locked */
63 uint64_t U:1; /* Use, LRU eviction */ 60 uint64_t U:1; /* Use, LRU eviction */
64 uint64_t addr:32; /* Phys mem (not all bits valid) */ 61 uint64_t addr:32; /* Phys mem (not all bits valid) */
65 } s; 62 } s;
66}; 63};
67 64
65/* Number of L2C Tag-and-data sections (TADs) that are connected to LMC. */
66#define CVMX_L2C_TADS 1
67
68 /* L2C Performance Counter events. */ 68 /* L2C Performance Counter events. */
69enum cvmx_l2c_event { 69enum cvmx_l2c_event {
70 CVMX_L2C_EVENT_CYCLES = 0, 70 CVMX_L2C_EVENT_CYCLES = 0,
71 CVMX_L2C_EVENT_INSTRUCTION_MISS = 1, 71 CVMX_L2C_EVENT_INSTRUCTION_MISS = 1,
72 CVMX_L2C_EVENT_INSTRUCTION_HIT = 2, 72 CVMX_L2C_EVENT_INSTRUCTION_HIT = 2,
73 CVMX_L2C_EVENT_DATA_MISS = 3, 73 CVMX_L2C_EVENT_DATA_MISS = 3,
74 CVMX_L2C_EVENT_DATA_HIT = 4, 74 CVMX_L2C_EVENT_DATA_HIT = 4,
75 CVMX_L2C_EVENT_MISS = 5, 75 CVMX_L2C_EVENT_MISS = 5,
76 CVMX_L2C_EVENT_HIT = 6, 76 CVMX_L2C_EVENT_HIT = 6,
77 CVMX_L2C_EVENT_VICTIM_HIT = 7, 77 CVMX_L2C_EVENT_VICTIM_HIT = 7,
78 CVMX_L2C_EVENT_INDEX_CONFLICT = 8, 78 CVMX_L2C_EVENT_INDEX_CONFLICT = 8,
79 CVMX_L2C_EVENT_TAG_PROBE = 9, 79 CVMX_L2C_EVENT_TAG_PROBE = 9,
80 CVMX_L2C_EVENT_TAG_UPDATE = 10, 80 CVMX_L2C_EVENT_TAG_UPDATE = 10,
81 CVMX_L2C_EVENT_TAG_COMPLETE = 11, 81 CVMX_L2C_EVENT_TAG_COMPLETE = 11,
82 CVMX_L2C_EVENT_TAG_DIRTY = 12, 82 CVMX_L2C_EVENT_TAG_DIRTY = 12,
83 CVMX_L2C_EVENT_DATA_STORE_NOP = 13, 83 CVMX_L2C_EVENT_DATA_STORE_NOP = 13,
84 CVMX_L2C_EVENT_DATA_STORE_READ = 14, 84 CVMX_L2C_EVENT_DATA_STORE_READ = 14,
85 CVMX_L2C_EVENT_DATA_STORE_WRITE = 15, 85 CVMX_L2C_EVENT_DATA_STORE_WRITE = 15,
86 CVMX_L2C_EVENT_FILL_DATA_VALID = 16, 86 CVMX_L2C_EVENT_FILL_DATA_VALID = 16,
87 CVMX_L2C_EVENT_WRITE_REQUEST = 17, 87 CVMX_L2C_EVENT_WRITE_REQUEST = 17,
88 CVMX_L2C_EVENT_READ_REQUEST = 18, 88 CVMX_L2C_EVENT_READ_REQUEST = 18,
89 CVMX_L2C_EVENT_WRITE_DATA_VALID = 19, 89 CVMX_L2C_EVENT_WRITE_DATA_VALID = 19,
90 CVMX_L2C_EVENT_XMC_NOP = 20, 90 CVMX_L2C_EVENT_XMC_NOP = 20,
91 CVMX_L2C_EVENT_XMC_LDT = 21, 91 CVMX_L2C_EVENT_XMC_LDT = 21,
92 CVMX_L2C_EVENT_XMC_LDI = 22, 92 CVMX_L2C_EVENT_XMC_LDI = 22,
93 CVMX_L2C_EVENT_XMC_LDD = 23, 93 CVMX_L2C_EVENT_XMC_LDD = 23,
94 CVMX_L2C_EVENT_XMC_STF = 24, 94 CVMX_L2C_EVENT_XMC_STF = 24,
95 CVMX_L2C_EVENT_XMC_STT = 25, 95 CVMX_L2C_EVENT_XMC_STT = 25,
96 CVMX_L2C_EVENT_XMC_STP = 26, 96 CVMX_L2C_EVENT_XMC_STP = 26,
97 CVMX_L2C_EVENT_XMC_STC = 27, 97 CVMX_L2C_EVENT_XMC_STC = 27,
98 CVMX_L2C_EVENT_XMC_DWB = 28, 98 CVMX_L2C_EVENT_XMC_DWB = 28,
99 CVMX_L2C_EVENT_XMC_PL2 = 29, 99 CVMX_L2C_EVENT_XMC_PL2 = 29,
100 CVMX_L2C_EVENT_XMC_PSL1 = 30, 100 CVMX_L2C_EVENT_XMC_PSL1 = 30,
101 CVMX_L2C_EVENT_XMC_IOBLD = 31, 101 CVMX_L2C_EVENT_XMC_IOBLD = 31,
102 CVMX_L2C_EVENT_XMC_IOBST = 32, 102 CVMX_L2C_EVENT_XMC_IOBST = 32,
103 CVMX_L2C_EVENT_XMC_IOBDMA = 33, 103 CVMX_L2C_EVENT_XMC_IOBDMA = 33,
104 CVMX_L2C_EVENT_XMC_IOBRSP = 34, 104 CVMX_L2C_EVENT_XMC_IOBRSP = 34,
105 CVMX_L2C_EVENT_XMC_BUS_VALID = 35, 105 CVMX_L2C_EVENT_XMC_BUS_VALID = 35,
106 CVMX_L2C_EVENT_XMC_MEM_DATA = 36, 106 CVMX_L2C_EVENT_XMC_MEM_DATA = 36,
107 CVMX_L2C_EVENT_XMC_REFL_DATA = 37, 107 CVMX_L2C_EVENT_XMC_REFL_DATA = 37,
108 CVMX_L2C_EVENT_XMC_IOBRSP_DATA = 38, 108 CVMX_L2C_EVENT_XMC_IOBRSP_DATA = 38,
109 CVMX_L2C_EVENT_RSC_NOP = 39, 109 CVMX_L2C_EVENT_RSC_NOP = 39,
110 CVMX_L2C_EVENT_RSC_STDN = 40, 110 CVMX_L2C_EVENT_RSC_STDN = 40,
111 CVMX_L2C_EVENT_RSC_FILL = 41, 111 CVMX_L2C_EVENT_RSC_FILL = 41,
112 CVMX_L2C_EVENT_RSC_REFL = 42, 112 CVMX_L2C_EVENT_RSC_REFL = 42,
113 CVMX_L2C_EVENT_RSC_STIN = 43, 113 CVMX_L2C_EVENT_RSC_STIN = 43,
114 CVMX_L2C_EVENT_RSC_SCIN = 44, 114 CVMX_L2C_EVENT_RSC_SCIN = 44,
115 CVMX_L2C_EVENT_RSC_SCFL = 45, 115 CVMX_L2C_EVENT_RSC_SCFL = 45,
116 CVMX_L2C_EVENT_RSC_SCDN = 46, 116 CVMX_L2C_EVENT_RSC_SCDN = 46,
117 CVMX_L2C_EVENT_RSC_DATA_VALID = 47, 117 CVMX_L2C_EVENT_RSC_DATA_VALID = 47,
118 CVMX_L2C_EVENT_RSC_VALID_FILL = 48, 118 CVMX_L2C_EVENT_RSC_VALID_FILL = 48,
119 CVMX_L2C_EVENT_RSC_VALID_STRSP = 49, 119 CVMX_L2C_EVENT_RSC_VALID_STRSP = 49,
120 CVMX_L2C_EVENT_RSC_VALID_REFL = 50, 120 CVMX_L2C_EVENT_RSC_VALID_REFL = 50,
121 CVMX_L2C_EVENT_LRF_REQ = 51, 121 CVMX_L2C_EVENT_LRF_REQ = 51,
122 CVMX_L2C_EVENT_DT_RD_ALLOC = 52, 122 CVMX_L2C_EVENT_DT_RD_ALLOC = 52,
123 CVMX_L2C_EVENT_DT_WR_INVAL = 53 123 CVMX_L2C_EVENT_DT_WR_INVAL = 53,
124 CVMX_L2C_EVENT_MAX
125};
126
127/* L2C Performance Counter events for Octeon2. */
128enum cvmx_l2c_tad_event {
129 CVMX_L2C_TAD_EVENT_NONE = 0,
130 CVMX_L2C_TAD_EVENT_TAG_HIT = 1,
131 CVMX_L2C_TAD_EVENT_TAG_MISS = 2,
132 CVMX_L2C_TAD_EVENT_TAG_NOALLOC = 3,
133 CVMX_L2C_TAD_EVENT_TAG_VICTIM = 4,
134 CVMX_L2C_TAD_EVENT_SC_FAIL = 5,
135 CVMX_L2C_TAD_EVENT_SC_PASS = 6,
136 CVMX_L2C_TAD_EVENT_LFB_VALID = 7,
137 CVMX_L2C_TAD_EVENT_LFB_WAIT_LFB = 8,
138 CVMX_L2C_TAD_EVENT_LFB_WAIT_VAB = 9,
139 CVMX_L2C_TAD_EVENT_QUAD0_INDEX = 128,
140 CVMX_L2C_TAD_EVENT_QUAD0_READ = 129,
141 CVMX_L2C_TAD_EVENT_QUAD0_BANK = 130,
142 CVMX_L2C_TAD_EVENT_QUAD0_WDAT = 131,
143 CVMX_L2C_TAD_EVENT_QUAD1_INDEX = 144,
144 CVMX_L2C_TAD_EVENT_QUAD1_READ = 145,
145 CVMX_L2C_TAD_EVENT_QUAD1_BANK = 146,
146 CVMX_L2C_TAD_EVENT_QUAD1_WDAT = 147,
147 CVMX_L2C_TAD_EVENT_QUAD2_INDEX = 160,
148 CVMX_L2C_TAD_EVENT_QUAD2_READ = 161,
149 CVMX_L2C_TAD_EVENT_QUAD2_BANK = 162,
150 CVMX_L2C_TAD_EVENT_QUAD2_WDAT = 163,
151 CVMX_L2C_TAD_EVENT_QUAD3_INDEX = 176,
152 CVMX_L2C_TAD_EVENT_QUAD3_READ = 177,
153 CVMX_L2C_TAD_EVENT_QUAD3_BANK = 178,
154 CVMX_L2C_TAD_EVENT_QUAD3_WDAT = 179,
155 CVMX_L2C_TAD_EVENT_MAX
124}; 156};
125 157
126/** 158/**
@@ -132,10 +164,10 @@ enum cvmx_l2c_event {
132 * @clear_on_read: When asserted, any read of the performance counter 164 * @clear_on_read: When asserted, any read of the performance counter
133 * clears the counter. 165 * clears the counter.
134 * 166 *
135 * The routine does not clear the counter. 167 * @note The routine does not clear the counter.
136 */ 168 */
137void cvmx_l2c_config_perf(uint32_t counter, 169void cvmx_l2c_config_perf(uint32_t counter, enum cvmx_l2c_event event, uint32_t clear_on_read);
138 enum cvmx_l2c_event event, uint32_t clear_on_read); 170
139/** 171/**
140 * Read the given L2 Cache performance counter. The counter must be configured 172 * Read the given L2 Cache performance counter. The counter must be configured
141 * before reading, but this routine does not enforce this requirement. 173 * before reading, but this routine does not enforce this requirement.
@@ -160,18 +192,18 @@ int cvmx_l2c_get_core_way_partition(uint32_t core);
160/** 192/**
161 * Partitions the L2 cache for a core 193 * Partitions the L2 cache for a core
162 * 194 *
163 * @core: The core that the partitioning applies to. 195 * @core: The core that the partitioning applies to.
196 * @mask: The partitioning of the ways expressed as a binary
197 * mask. A 0 bit allows the core to evict cache lines from
198 * a way, while a 1 bit blocks the core from evicting any
199 * lines from that way. There must be at least one allowed
200 * way (0 bit) in the mask.
164 * 201 *
165 * @mask: The partitioning of the ways expressed as a binary mask. A 0 202
166 * bit allows the core to evict cache lines from a way, while a 203 * @note If any ways are blocked for all cores and the HW blocks, then
167 * 1 bit blocks the core from evicting any lines from that 204 * those ways will never have any cache lines evicted from them.
168 * way. There must be at least one allowed way (0 bit) in the 205 * All cores and the hardware blocks are free to read from all
169 * mask. 206 * ways regardless of the partitioning.
170 *
171 * If any ways are blocked for all cores and the HW blocks, then those
172 * ways will never have any cache lines evicted from them. All cores
173 * and the hardware blocks are free to read from all ways regardless
174 * of the partitioning.
175 */ 207 */
176int cvmx_l2c_set_core_way_partition(uint32_t core, uint32_t mask); 208int cvmx_l2c_set_core_way_partition(uint32_t core, uint32_t mask);
177 209
@@ -187,19 +219,21 @@ int cvmx_l2c_get_hw_way_partition(void);
187/** 219/**
188 * Partitions the L2 cache for the hardware blocks. 220 * Partitions the L2 cache for the hardware blocks.
189 * 221 *
190 * @mask: The partitioning of the ways expressed as a binary mask. A 0 222 * @mask: The partitioning of the ways expressed as a binary
191 * bit allows the core to evict cache lines from a way, while a 223 * mask. A 0 bit allows the core to evict cache lines from
192 * 1 bit blocks the core from evicting any lines from that 224 * a way, while a 1 bit blocks the core from evicting any
193 * way. There must be at least one allowed way (0 bit) in the 225 * lines from that way. There must be at least one allowed
194 * mask. 226 * way (0 bit) in the mask.
195 * 227 *
196 * If any ways are blocked for all cores and the HW blocks, then those 228
197 * ways will never have any cache lines evicted from them. All cores 229 * @note If any ways are blocked for all cores and the HW blocks, then
198 * and the hardware blocks are free to read from all ways regardless 230 * those ways will never have any cache lines evicted from them.
199 * of the partitioning. 231 * All cores and the hardware blocks are free to read from all
232 * ways regardless of the partitioning.
200 */ 233 */
201int cvmx_l2c_set_hw_way_partition(uint32_t mask); 234int cvmx_l2c_set_hw_way_partition(uint32_t mask);
202 235
236
203/** 237/**
204 * Locks a line in the L2 cache at the specified physical address 238 * Locks a line in the L2 cache at the specified physical address
205 * 239 *
@@ -263,13 +297,14 @@ int cvmx_l2c_unlock_mem_region(uint64_t start, uint64_t len);
263 */ 297 */
264union cvmx_l2c_tag cvmx_l2c_get_tag(uint32_t association, uint32_t index); 298union cvmx_l2c_tag cvmx_l2c_get_tag(uint32_t association, uint32_t index);
265 299
266/* Wrapper around deprecated old function name */ 300/* Wrapper providing a deprecated old function name */
267static inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association, 301static inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association, uint32_t index) __attribute__((deprecated));
268 uint32_t index) 302static inline union cvmx_l2c_tag cvmx_get_l2c_tag(uint32_t association, uint32_t index)
269{ 303{
270 return cvmx_l2c_get_tag(association, index); 304 return cvmx_l2c_get_tag(association, index);
271} 305}
272 306
307
273/** 308/**
274 * Returns the cache index for a given physical address 309 * Returns the cache index for a given physical address
275 * 310 *
diff --git a/arch/mips/include/asm/octeon/cvmx-l2d-defs.h b/arch/mips/include/asm/octeon/cvmx-l2d-defs.h
index d7102d455e1b..60543e0e77fc 100644
--- a/arch/mips/include/asm/octeon/cvmx-l2d-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-l2d-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,30 +28,18 @@
28#ifndef __CVMX_L2D_DEFS_H__ 28#ifndef __CVMX_L2D_DEFS_H__
29#define __CVMX_L2D_DEFS_H__ 29#define __CVMX_L2D_DEFS_H__
30 30
31#define CVMX_L2D_BST0 \ 31#define CVMX_L2D_BST0 (CVMX_ADD_IO_SEG(0x0001180080000780ull))
32 CVMX_ADD_IO_SEG(0x0001180080000780ull) 32#define CVMX_L2D_BST1 (CVMX_ADD_IO_SEG(0x0001180080000788ull))
33#define CVMX_L2D_BST1 \ 33#define CVMX_L2D_BST2 (CVMX_ADD_IO_SEG(0x0001180080000790ull))
34 CVMX_ADD_IO_SEG(0x0001180080000788ull) 34#define CVMX_L2D_BST3 (CVMX_ADD_IO_SEG(0x0001180080000798ull))
35#define CVMX_L2D_BST2 \ 35#define CVMX_L2D_ERR (CVMX_ADD_IO_SEG(0x0001180080000010ull))
36 CVMX_ADD_IO_SEG(0x0001180080000790ull) 36#define CVMX_L2D_FADR (CVMX_ADD_IO_SEG(0x0001180080000018ull))
37#define CVMX_L2D_BST3 \ 37#define CVMX_L2D_FSYN0 (CVMX_ADD_IO_SEG(0x0001180080000020ull))
38 CVMX_ADD_IO_SEG(0x0001180080000798ull) 38#define CVMX_L2D_FSYN1 (CVMX_ADD_IO_SEG(0x0001180080000028ull))
39#define CVMX_L2D_ERR \ 39#define CVMX_L2D_FUS0 (CVMX_ADD_IO_SEG(0x00011800800007A0ull))
40 CVMX_ADD_IO_SEG(0x0001180080000010ull) 40#define CVMX_L2D_FUS1 (CVMX_ADD_IO_SEG(0x00011800800007A8ull))
41#define CVMX_L2D_FADR \ 41#define CVMX_L2D_FUS2 (CVMX_ADD_IO_SEG(0x00011800800007B0ull))
42 CVMX_ADD_IO_SEG(0x0001180080000018ull) 42#define CVMX_L2D_FUS3 (CVMX_ADD_IO_SEG(0x00011800800007B8ull))
43#define CVMX_L2D_FSYN0 \
44 CVMX_ADD_IO_SEG(0x0001180080000020ull)
45#define CVMX_L2D_FSYN1 \
46 CVMX_ADD_IO_SEG(0x0001180080000028ull)
47#define CVMX_L2D_FUS0 \
48 CVMX_ADD_IO_SEG(0x00011800800007A0ull)
49#define CVMX_L2D_FUS1 \
50 CVMX_ADD_IO_SEG(0x00011800800007A8ull)
51#define CVMX_L2D_FUS2 \
52 CVMX_ADD_IO_SEG(0x00011800800007B0ull)
53#define CVMX_L2D_FUS3 \
54 CVMX_ADD_IO_SEG(0x00011800800007B8ull)
55 43
56union cvmx_l2d_bst0 { 44union cvmx_l2d_bst0 {
57 uint64_t u64; 45 uint64_t u64;
diff --git a/arch/mips/include/asm/octeon/cvmx-l2t-defs.h b/arch/mips/include/asm/octeon/cvmx-l2t-defs.h
index 2639a3f5ffc2..873968f55eeb 100644
--- a/arch/mips/include/asm/octeon/cvmx-l2t-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-l2t-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,8 +28,7 @@
28#ifndef __CVMX_L2T_DEFS_H__ 28#ifndef __CVMX_L2T_DEFS_H__
29#define __CVMX_L2T_DEFS_H__ 29#define __CVMX_L2T_DEFS_H__
30 30
31#define CVMX_L2T_ERR \ 31#define CVMX_L2T_ERR (CVMX_ADD_IO_SEG(0x0001180080000008ull))
32 CVMX_ADD_IO_SEG(0x0001180080000008ull)
33 32
34union cvmx_l2t_err { 33union cvmx_l2t_err {
35 uint64_t u64; 34 uint64_t u64;
diff --git a/arch/mips/include/asm/octeon/cvmx-led-defs.h b/arch/mips/include/asm/octeon/cvmx-led-defs.h
index 16f174a4dadf..e25173bb8bb7 100644
--- a/arch/mips/include/asm/octeon/cvmx-led-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-led-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,32 +28,19 @@
28#ifndef __CVMX_LED_DEFS_H__ 28#ifndef __CVMX_LED_DEFS_H__
29#define __CVMX_LED_DEFS_H__ 29#define __CVMX_LED_DEFS_H__
30 30
31#define CVMX_LED_BLINK \ 31#define CVMX_LED_BLINK (CVMX_ADD_IO_SEG(0x0001180000001A48ull))
32 CVMX_ADD_IO_SEG(0x0001180000001A48ull) 32#define CVMX_LED_CLK_PHASE (CVMX_ADD_IO_SEG(0x0001180000001A08ull))
33#define CVMX_LED_CLK_PHASE \ 33#define CVMX_LED_CYLON (CVMX_ADD_IO_SEG(0x0001180000001AF8ull))
34 CVMX_ADD_IO_SEG(0x0001180000001A08ull) 34#define CVMX_LED_DBG (CVMX_ADD_IO_SEG(0x0001180000001A18ull))
35#define CVMX_LED_CYLON \ 35#define CVMX_LED_EN (CVMX_ADD_IO_SEG(0x0001180000001A00ull))
36 CVMX_ADD_IO_SEG(0x0001180000001AF8ull) 36#define CVMX_LED_POLARITY (CVMX_ADD_IO_SEG(0x0001180000001A50ull))
37#define CVMX_LED_DBG \ 37#define CVMX_LED_PRT (CVMX_ADD_IO_SEG(0x0001180000001A10ull))
38 CVMX_ADD_IO_SEG(0x0001180000001A18ull) 38#define CVMX_LED_PRT_FMT (CVMX_ADD_IO_SEG(0x0001180000001A30ull))
39#define CVMX_LED_EN \ 39#define CVMX_LED_PRT_STATUSX(offset) (CVMX_ADD_IO_SEG(0x0001180000001A80ull) + ((offset) & 7) * 8)
40 CVMX_ADD_IO_SEG(0x0001180000001A00ull) 40#define CVMX_LED_UDD_CNTX(offset) (CVMX_ADD_IO_SEG(0x0001180000001A20ull) + ((offset) & 1) * 8)
41#define CVMX_LED_POLARITY \ 41#define CVMX_LED_UDD_DATX(offset) (CVMX_ADD_IO_SEG(0x0001180000001A38ull) + ((offset) & 1) * 8)
42 CVMX_ADD_IO_SEG(0x0001180000001A50ull) 42#define CVMX_LED_UDD_DAT_CLRX(offset) (CVMX_ADD_IO_SEG(0x0001180000001AC8ull) + ((offset) & 1) * 16)
43#define CVMX_LED_PRT \ 43#define CVMX_LED_UDD_DAT_SETX(offset) (CVMX_ADD_IO_SEG(0x0001180000001AC0ull) + ((offset) & 1) * 16)
44 CVMX_ADD_IO_SEG(0x0001180000001A10ull)
45#define CVMX_LED_PRT_FMT \
46 CVMX_ADD_IO_SEG(0x0001180000001A30ull)
47#define CVMX_LED_PRT_STATUSX(offset) \
48 CVMX_ADD_IO_SEG(0x0001180000001A80ull + (((offset) & 7) * 8))
49#define CVMX_LED_UDD_CNTX(offset) \
50 CVMX_ADD_IO_SEG(0x0001180000001A20ull + (((offset) & 1) * 8))
51#define CVMX_LED_UDD_DATX(offset) \
52 CVMX_ADD_IO_SEG(0x0001180000001A38ull + (((offset) & 1) * 8))
53#define CVMX_LED_UDD_DAT_CLRX(offset) \
54 CVMX_ADD_IO_SEG(0x0001180000001AC8ull + (((offset) & 1) * 16))
55#define CVMX_LED_UDD_DAT_SETX(offset) \
56 CVMX_ADD_IO_SEG(0x0001180000001AC0ull + (((offset) & 1) * 16))
57 44
58union cvmx_led_blink { 45union cvmx_led_blink {
59 uint64_t u64; 46 uint64_t u64;
diff --git a/arch/mips/include/asm/octeon/cvmx-mio-defs.h b/arch/mips/include/asm/octeon/cvmx-mio-defs.h
index 6555f0530988..52b14a333ad4 100644
--- a/arch/mips/include/asm/octeon/cvmx-mio-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-mio-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,191 +28,117 @@
28#ifndef __CVMX_MIO_DEFS_H__ 28#ifndef __CVMX_MIO_DEFS_H__
29#define __CVMX_MIO_DEFS_H__ 29#define __CVMX_MIO_DEFS_H__
30 30
31#define CVMX_MIO_BOOT_BIST_STAT \ 31#define CVMX_MIO_BOOT_BIST_STAT (CVMX_ADD_IO_SEG(0x00011800000000F8ull))
32 CVMX_ADD_IO_SEG(0x00011800000000F8ull) 32#define CVMX_MIO_BOOT_COMP (CVMX_ADD_IO_SEG(0x00011800000000B8ull))
33#define CVMX_MIO_BOOT_COMP \ 33#define CVMX_MIO_BOOT_DMA_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001180000000100ull) + ((offset) & 3) * 8)
34 CVMX_ADD_IO_SEG(0x00011800000000B8ull) 34#define CVMX_MIO_BOOT_DMA_INTX(offset) (CVMX_ADD_IO_SEG(0x0001180000000138ull) + ((offset) & 3) * 8)
35#define CVMX_MIO_BOOT_DMA_CFGX(offset) \ 35#define CVMX_MIO_BOOT_DMA_INT_ENX(offset) (CVMX_ADD_IO_SEG(0x0001180000000150ull) + ((offset) & 3) * 8)
36 CVMX_ADD_IO_SEG(0x0001180000000100ull + (((offset) & 3) * 8)) 36#define CVMX_MIO_BOOT_DMA_TIMX(offset) (CVMX_ADD_IO_SEG(0x0001180000000120ull) + ((offset) & 3) * 8)
37#define CVMX_MIO_BOOT_DMA_INTX(offset) \ 37#define CVMX_MIO_BOOT_ERR (CVMX_ADD_IO_SEG(0x00011800000000A0ull))
38 CVMX_ADD_IO_SEG(0x0001180000000138ull + (((offset) & 3) * 8)) 38#define CVMX_MIO_BOOT_INT (CVMX_ADD_IO_SEG(0x00011800000000A8ull))
39#define CVMX_MIO_BOOT_DMA_INT_ENX(offset) \ 39#define CVMX_MIO_BOOT_LOC_ADR (CVMX_ADD_IO_SEG(0x0001180000000090ull))
40 CVMX_ADD_IO_SEG(0x0001180000000150ull + (((offset) & 3) * 8)) 40#define CVMX_MIO_BOOT_LOC_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001180000000080ull) + ((offset) & 1) * 8)
41#define CVMX_MIO_BOOT_DMA_TIMX(offset) \ 41#define CVMX_MIO_BOOT_LOC_DAT (CVMX_ADD_IO_SEG(0x0001180000000098ull))
42 CVMX_ADD_IO_SEG(0x0001180000000120ull + (((offset) & 3) * 8)) 42#define CVMX_MIO_BOOT_PIN_DEFS (CVMX_ADD_IO_SEG(0x00011800000000C0ull))
43#define CVMX_MIO_BOOT_ERR \ 43#define CVMX_MIO_BOOT_REG_CFGX(offset) (CVMX_ADD_IO_SEG(0x0001180000000000ull) + ((offset) & 7) * 8)
44 CVMX_ADD_IO_SEG(0x00011800000000A0ull) 44#define CVMX_MIO_BOOT_REG_TIMX(offset) (CVMX_ADD_IO_SEG(0x0001180000000040ull) + ((offset) & 7) * 8)
45#define CVMX_MIO_BOOT_INT \ 45#define CVMX_MIO_BOOT_THR (CVMX_ADD_IO_SEG(0x00011800000000B0ull))
46 CVMX_ADD_IO_SEG(0x00011800000000A8ull) 46#define CVMX_MIO_FUS_BNK_DATX(offset) (CVMX_ADD_IO_SEG(0x0001180000001520ull) + ((offset) & 3) * 8)
47#define CVMX_MIO_BOOT_LOC_ADR \ 47#define CVMX_MIO_FUS_DAT0 (CVMX_ADD_IO_SEG(0x0001180000001400ull))
48 CVMX_ADD_IO_SEG(0x0001180000000090ull) 48#define CVMX_MIO_FUS_DAT1 (CVMX_ADD_IO_SEG(0x0001180000001408ull))
49#define CVMX_MIO_BOOT_LOC_CFGX(offset) \ 49#define CVMX_MIO_FUS_DAT2 (CVMX_ADD_IO_SEG(0x0001180000001410ull))
50 CVMX_ADD_IO_SEG(0x0001180000000080ull + (((offset) & 1) * 8)) 50#define CVMX_MIO_FUS_DAT3 (CVMX_ADD_IO_SEG(0x0001180000001418ull))
51#define CVMX_MIO_BOOT_LOC_DAT \ 51#define CVMX_MIO_FUS_EMA (CVMX_ADD_IO_SEG(0x0001180000001550ull))
52 CVMX_ADD_IO_SEG(0x0001180000000098ull) 52#define CVMX_MIO_FUS_PDF (CVMX_ADD_IO_SEG(0x0001180000001420ull))
53#define CVMX_MIO_BOOT_PIN_DEFS \ 53#define CVMX_MIO_FUS_PLL (CVMX_ADD_IO_SEG(0x0001180000001580ull))
54 CVMX_ADD_IO_SEG(0x00011800000000C0ull) 54#define CVMX_MIO_FUS_PROG (CVMX_ADD_IO_SEG(0x0001180000001510ull))
55#define CVMX_MIO_BOOT_REG_CFGX(offset) \ 55#define CVMX_MIO_FUS_PROG_TIMES (CVMX_ADD_IO_SEG(0x0001180000001518ull))
56 CVMX_ADD_IO_SEG(0x0001180000000000ull + (((offset) & 7) * 8)) 56#define CVMX_MIO_FUS_RCMD (CVMX_ADD_IO_SEG(0x0001180000001500ull))
57#define CVMX_MIO_BOOT_REG_TIMX(offset) \ 57#define CVMX_MIO_FUS_READ_TIMES (CVMX_ADD_IO_SEG(0x0001180000001570ull))
58 CVMX_ADD_IO_SEG(0x0001180000000040ull + (((offset) & 7) * 8)) 58#define CVMX_MIO_FUS_REPAIR_RES0 (CVMX_ADD_IO_SEG(0x0001180000001558ull))
59#define CVMX_MIO_BOOT_THR \ 59#define CVMX_MIO_FUS_REPAIR_RES1 (CVMX_ADD_IO_SEG(0x0001180000001560ull))
60 CVMX_ADD_IO_SEG(0x00011800000000B0ull) 60#define CVMX_MIO_FUS_REPAIR_RES2 (CVMX_ADD_IO_SEG(0x0001180000001568ull))
61#define CVMX_MIO_FUS_BNK_DATX(offset) \ 61#define CVMX_MIO_FUS_SPR_REPAIR_RES (CVMX_ADD_IO_SEG(0x0001180000001548ull))
62 CVMX_ADD_IO_SEG(0x0001180000001520ull + (((offset) & 3) * 8)) 62#define CVMX_MIO_FUS_SPR_REPAIR_SUM (CVMX_ADD_IO_SEG(0x0001180000001540ull))
63#define CVMX_MIO_FUS_DAT0 \ 63#define CVMX_MIO_FUS_UNLOCK (CVMX_ADD_IO_SEG(0x0001180000001578ull))
64 CVMX_ADD_IO_SEG(0x0001180000001400ull) 64#define CVMX_MIO_FUS_WADR (CVMX_ADD_IO_SEG(0x0001180000001508ull))
65#define CVMX_MIO_FUS_DAT1 \ 65#define CVMX_MIO_GPIO_COMP (CVMX_ADD_IO_SEG(0x00011800000000C8ull))
66 CVMX_ADD_IO_SEG(0x0001180000001408ull) 66#define CVMX_MIO_NDF_DMA_CFG (CVMX_ADD_IO_SEG(0x0001180000000168ull))
67#define CVMX_MIO_FUS_DAT2 \ 67#define CVMX_MIO_NDF_DMA_INT (CVMX_ADD_IO_SEG(0x0001180000000170ull))
68 CVMX_ADD_IO_SEG(0x0001180000001410ull) 68#define CVMX_MIO_NDF_DMA_INT_EN (CVMX_ADD_IO_SEG(0x0001180000000178ull))
69#define CVMX_MIO_FUS_DAT3 \ 69#define CVMX_MIO_PLL_CTL (CVMX_ADD_IO_SEG(0x0001180000001448ull))
70 CVMX_ADD_IO_SEG(0x0001180000001418ull) 70#define CVMX_MIO_PLL_SETTING (CVMX_ADD_IO_SEG(0x0001180000001440ull))
71#define CVMX_MIO_FUS_EMA \ 71#define CVMX_MIO_PTP_CLOCK_CFG (CVMX_ADD_IO_SEG(0x0001070000000F00ull))
72 CVMX_ADD_IO_SEG(0x0001180000001550ull) 72#define CVMX_MIO_PTP_CLOCK_COMP (CVMX_ADD_IO_SEG(0x0001070000000F18ull))
73#define CVMX_MIO_FUS_PDF \ 73#define CVMX_MIO_PTP_CLOCK_HI (CVMX_ADD_IO_SEG(0x0001070000000F10ull))
74 CVMX_ADD_IO_SEG(0x0001180000001420ull) 74#define CVMX_MIO_PTP_CLOCK_LO (CVMX_ADD_IO_SEG(0x0001070000000F08ull))
75#define CVMX_MIO_FUS_PLL \ 75#define CVMX_MIO_PTP_EVT_CNT (CVMX_ADD_IO_SEG(0x0001070000000F28ull))
76 CVMX_ADD_IO_SEG(0x0001180000001580ull) 76#define CVMX_MIO_PTP_TIMESTAMP (CVMX_ADD_IO_SEG(0x0001070000000F20ull))
77#define CVMX_MIO_FUS_PROG \ 77#define CVMX_MIO_RST_BOOT (CVMX_ADD_IO_SEG(0x0001180000001600ull))
78 CVMX_ADD_IO_SEG(0x0001180000001510ull) 78#define CVMX_MIO_RST_CFG (CVMX_ADD_IO_SEG(0x0001180000001610ull))
79#define CVMX_MIO_FUS_PROG_TIMES \ 79#define CVMX_MIO_RST_CTLX(offset) (CVMX_ADD_IO_SEG(0x0001180000001618ull) + ((offset) & 1) * 8)
80 CVMX_ADD_IO_SEG(0x0001180000001518ull) 80#define CVMX_MIO_RST_DELAY (CVMX_ADD_IO_SEG(0x0001180000001608ull))
81#define CVMX_MIO_FUS_RCMD \ 81#define CVMX_MIO_RST_INT (CVMX_ADD_IO_SEG(0x0001180000001628ull))
82 CVMX_ADD_IO_SEG(0x0001180000001500ull) 82#define CVMX_MIO_RST_INT_EN (CVMX_ADD_IO_SEG(0x0001180000001630ull))
83#define CVMX_MIO_FUS_SPR_REPAIR_RES \ 83#define CVMX_MIO_TWSX_INT(offset) (CVMX_ADD_IO_SEG(0x0001180000001010ull) + ((offset) & 1) * 512)
84 CVMX_ADD_IO_SEG(0x0001180000001548ull) 84#define CVMX_MIO_TWSX_SW_TWSI(offset) (CVMX_ADD_IO_SEG(0x0001180000001000ull) + ((offset) & 1) * 512)
85#define CVMX_MIO_FUS_SPR_REPAIR_SUM \ 85#define CVMX_MIO_TWSX_SW_TWSI_EXT(offset) (CVMX_ADD_IO_SEG(0x0001180000001018ull) + ((offset) & 1) * 512)
86 CVMX_ADD_IO_SEG(0x0001180000001540ull) 86#define CVMX_MIO_TWSX_TWSI_SW(offset) (CVMX_ADD_IO_SEG(0x0001180000001008ull) + ((offset) & 1) * 512)
87#define CVMX_MIO_FUS_UNLOCK \ 87#define CVMX_MIO_UART2_DLH (CVMX_ADD_IO_SEG(0x0001180000000488ull))
88 CVMX_ADD_IO_SEG(0x0001180000001578ull) 88#define CVMX_MIO_UART2_DLL (CVMX_ADD_IO_SEG(0x0001180000000480ull))
89#define CVMX_MIO_FUS_WADR \ 89#define CVMX_MIO_UART2_FAR (CVMX_ADD_IO_SEG(0x0001180000000520ull))
90 CVMX_ADD_IO_SEG(0x0001180000001508ull) 90#define CVMX_MIO_UART2_FCR (CVMX_ADD_IO_SEG(0x0001180000000450ull))
91#define CVMX_MIO_NDF_DMA_CFG \ 91#define CVMX_MIO_UART2_HTX (CVMX_ADD_IO_SEG(0x0001180000000708ull))
92 CVMX_ADD_IO_SEG(0x0001180000000168ull) 92#define CVMX_MIO_UART2_IER (CVMX_ADD_IO_SEG(0x0001180000000408ull))
93#define CVMX_MIO_NDF_DMA_INT \ 93#define CVMX_MIO_UART2_IIR (CVMX_ADD_IO_SEG(0x0001180000000410ull))
94 CVMX_ADD_IO_SEG(0x0001180000000170ull) 94#define CVMX_MIO_UART2_LCR (CVMX_ADD_IO_SEG(0x0001180000000418ull))
95#define CVMX_MIO_NDF_DMA_INT_EN \ 95#define CVMX_MIO_UART2_LSR (CVMX_ADD_IO_SEG(0x0001180000000428ull))
96 CVMX_ADD_IO_SEG(0x0001180000000178ull) 96#define CVMX_MIO_UART2_MCR (CVMX_ADD_IO_SEG(0x0001180000000420ull))
97#define CVMX_MIO_PLL_CTL \ 97#define CVMX_MIO_UART2_MSR (CVMX_ADD_IO_SEG(0x0001180000000430ull))
98 CVMX_ADD_IO_SEG(0x0001180000001448ull) 98#define CVMX_MIO_UART2_RBR (CVMX_ADD_IO_SEG(0x0001180000000400ull))
99#define CVMX_MIO_PLL_SETTING \ 99#define CVMX_MIO_UART2_RFL (CVMX_ADD_IO_SEG(0x0001180000000608ull))
100 CVMX_ADD_IO_SEG(0x0001180000001440ull) 100#define CVMX_MIO_UART2_RFW (CVMX_ADD_IO_SEG(0x0001180000000530ull))
101#define CVMX_MIO_TWSX_INT(offset) \ 101#define CVMX_MIO_UART2_SBCR (CVMX_ADD_IO_SEG(0x0001180000000620ull))
102 CVMX_ADD_IO_SEG(0x0001180000001010ull + (((offset) & 1) * 512)) 102#define CVMX_MIO_UART2_SCR (CVMX_ADD_IO_SEG(0x0001180000000438ull))
103#define CVMX_MIO_TWSX_SW_TWSI(offset) \ 103#define CVMX_MIO_UART2_SFE (CVMX_ADD_IO_SEG(0x0001180000000630ull))
104 CVMX_ADD_IO_SEG(0x0001180000001000ull + (((offset) & 1) * 512)) 104#define CVMX_MIO_UART2_SRR (CVMX_ADD_IO_SEG(0x0001180000000610ull))
105#define CVMX_MIO_TWSX_SW_TWSI_EXT(offset) \ 105#define CVMX_MIO_UART2_SRT (CVMX_ADD_IO_SEG(0x0001180000000638ull))
106 CVMX_ADD_IO_SEG(0x0001180000001018ull + (((offset) & 1) * 512)) 106#define CVMX_MIO_UART2_SRTS (CVMX_ADD_IO_SEG(0x0001180000000618ull))
107#define CVMX_MIO_TWSX_TWSI_SW(offset) \ 107#define CVMX_MIO_UART2_STT (CVMX_ADD_IO_SEG(0x0001180000000700ull))
108 CVMX_ADD_IO_SEG(0x0001180000001008ull + (((offset) & 1) * 512)) 108#define CVMX_MIO_UART2_TFL (CVMX_ADD_IO_SEG(0x0001180000000600ull))
109#define CVMX_MIO_UART2_DLH \ 109#define CVMX_MIO_UART2_TFR (CVMX_ADD_IO_SEG(0x0001180000000528ull))
110 CVMX_ADD_IO_SEG(0x0001180000000488ull) 110#define CVMX_MIO_UART2_THR (CVMX_ADD_IO_SEG(0x0001180000000440ull))
111#define CVMX_MIO_UART2_DLL \ 111#define CVMX_MIO_UART2_USR (CVMX_ADD_IO_SEG(0x0001180000000538ull))
112 CVMX_ADD_IO_SEG(0x0001180000000480ull) 112#define CVMX_MIO_UARTX_DLH(offset) (CVMX_ADD_IO_SEG(0x0001180000000888ull) + ((offset) & 1) * 1024)
113#define CVMX_MIO_UART2_FAR \ 113#define CVMX_MIO_UARTX_DLL(offset) (CVMX_ADD_IO_SEG(0x0001180000000880ull) + ((offset) & 1) * 1024)
114 CVMX_ADD_IO_SEG(0x0001180000000520ull) 114#define CVMX_MIO_UARTX_FAR(offset) (CVMX_ADD_IO_SEG(0x0001180000000920ull) + ((offset) & 1) * 1024)
115#define CVMX_MIO_UART2_FCR \ 115#define CVMX_MIO_UARTX_FCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000850ull) + ((offset) & 1) * 1024)
116 CVMX_ADD_IO_SEG(0x0001180000000450ull) 116#define CVMX_MIO_UARTX_HTX(offset) (CVMX_ADD_IO_SEG(0x0001180000000B08ull) + ((offset) & 1) * 1024)
117#define CVMX_MIO_UART2_HTX \ 117#define CVMX_MIO_UARTX_IER(offset) (CVMX_ADD_IO_SEG(0x0001180000000808ull) + ((offset) & 1) * 1024)
118 CVMX_ADD_IO_SEG(0x0001180000000708ull) 118#define CVMX_MIO_UARTX_IIR(offset) (CVMX_ADD_IO_SEG(0x0001180000000810ull) + ((offset) & 1) * 1024)
119#define CVMX_MIO_UART2_IER \ 119#define CVMX_MIO_UARTX_LCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000818ull) + ((offset) & 1) * 1024)
120 CVMX_ADD_IO_SEG(0x0001180000000408ull) 120#define CVMX_MIO_UARTX_LSR(offset) (CVMX_ADD_IO_SEG(0x0001180000000828ull) + ((offset) & 1) * 1024)
121#define CVMX_MIO_UART2_IIR \ 121#define CVMX_MIO_UARTX_MCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000820ull) + ((offset) & 1) * 1024)
122 CVMX_ADD_IO_SEG(0x0001180000000410ull) 122#define CVMX_MIO_UARTX_MSR(offset) (CVMX_ADD_IO_SEG(0x0001180000000830ull) + ((offset) & 1) * 1024)
123#define CVMX_MIO_UART2_LCR \ 123#define CVMX_MIO_UARTX_RBR(offset) (CVMX_ADD_IO_SEG(0x0001180000000800ull) + ((offset) & 1) * 1024)
124 CVMX_ADD_IO_SEG(0x0001180000000418ull) 124#define CVMX_MIO_UARTX_RFL(offset) (CVMX_ADD_IO_SEG(0x0001180000000A08ull) + ((offset) & 1) * 1024)
125#define CVMX_MIO_UART2_LSR \ 125#define CVMX_MIO_UARTX_RFW(offset) (CVMX_ADD_IO_SEG(0x0001180000000930ull) + ((offset) & 1) * 1024)
126 CVMX_ADD_IO_SEG(0x0001180000000428ull) 126#define CVMX_MIO_UARTX_SBCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000A20ull) + ((offset) & 1) * 1024)
127#define CVMX_MIO_UART2_MCR \ 127#define CVMX_MIO_UARTX_SCR(offset) (CVMX_ADD_IO_SEG(0x0001180000000838ull) + ((offset) & 1) * 1024)
128 CVMX_ADD_IO_SEG(0x0001180000000420ull) 128#define CVMX_MIO_UARTX_SFE(offset) (CVMX_ADD_IO_SEG(0x0001180000000A30ull) + ((offset) & 1) * 1024)
129#define CVMX_MIO_UART2_MSR \ 129#define CVMX_MIO_UARTX_SRR(offset) (CVMX_ADD_IO_SEG(0x0001180000000A10ull) + ((offset) & 1) * 1024)
130 CVMX_ADD_IO_SEG(0x0001180000000430ull) 130#define CVMX_MIO_UARTX_SRT(offset) (CVMX_ADD_IO_SEG(0x0001180000000A38ull) + ((offset) & 1) * 1024)
131#define CVMX_MIO_UART2_RBR \ 131#define CVMX_MIO_UARTX_SRTS(offset) (CVMX_ADD_IO_SEG(0x0001180000000A18ull) + ((offset) & 1) * 1024)
132 CVMX_ADD_IO_SEG(0x0001180000000400ull) 132#define CVMX_MIO_UARTX_STT(offset) (CVMX_ADD_IO_SEG(0x0001180000000B00ull) + ((offset) & 1) * 1024)
133#define CVMX_MIO_UART2_RFL \ 133#define CVMX_MIO_UARTX_TFL(offset) (CVMX_ADD_IO_SEG(0x0001180000000A00ull) + ((offset) & 1) * 1024)
134 CVMX_ADD_IO_SEG(0x0001180000000608ull) 134#define CVMX_MIO_UARTX_TFR(offset) (CVMX_ADD_IO_SEG(0x0001180000000928ull) + ((offset) & 1) * 1024)
135#define CVMX_MIO_UART2_RFW \ 135#define CVMX_MIO_UARTX_THR(offset) (CVMX_ADD_IO_SEG(0x0001180000000840ull) + ((offset) & 1) * 1024)
136 CVMX_ADD_IO_SEG(0x0001180000000530ull) 136#define CVMX_MIO_UARTX_USR(offset) (CVMX_ADD_IO_SEG(0x0001180000000938ull) + ((offset) & 1) * 1024)
137#define CVMX_MIO_UART2_SBCR \
138 CVMX_ADD_IO_SEG(0x0001180000000620ull)
139#define CVMX_MIO_UART2_SCR \
140 CVMX_ADD_IO_SEG(0x0001180000000438ull)
141#define CVMX_MIO_UART2_SFE \
142 CVMX_ADD_IO_SEG(0x0001180000000630ull)
143#define CVMX_MIO_UART2_SRR \
144 CVMX_ADD_IO_SEG(0x0001180000000610ull)
145#define CVMX_MIO_UART2_SRT \
146 CVMX_ADD_IO_SEG(0x0001180000000638ull)
147#define CVMX_MIO_UART2_SRTS \
148 CVMX_ADD_IO_SEG(0x0001180000000618ull)
149#define CVMX_MIO_UART2_STT \
150 CVMX_ADD_IO_SEG(0x0001180000000700ull)
151#define CVMX_MIO_UART2_TFL \
152 CVMX_ADD_IO_SEG(0x0001180000000600ull)
153#define CVMX_MIO_UART2_TFR \
154 CVMX_ADD_IO_SEG(0x0001180000000528ull)
155#define CVMX_MIO_UART2_THR \
156 CVMX_ADD_IO_SEG(0x0001180000000440ull)
157#define CVMX_MIO_UART2_USR \
158 CVMX_ADD_IO_SEG(0x0001180000000538ull)
159#define CVMX_MIO_UARTX_DLH(offset) \
160 CVMX_ADD_IO_SEG(0x0001180000000888ull + (((offset) & 1) * 1024))
161#define CVMX_MIO_UARTX_DLL(offset) \
162 CVMX_ADD_IO_SEG(0x0001180000000880ull + (((offset) & 1) * 1024))
163#define CVMX_MIO_UARTX_FAR(offset) \
164 CVMX_ADD_IO_SEG(0x0001180000000920ull + (((offset) & 1) * 1024))
165#define CVMX_MIO_UARTX_FCR(offset) \
166 CVMX_ADD_IO_SEG(0x0001180000000850ull + (((offset) & 1) * 1024))
167#define CVMX_MIO_UARTX_HTX(offset) \
168 CVMX_ADD_IO_SEG(0x0001180000000B08ull + (((offset) & 1) * 1024))
169#define CVMX_MIO_UARTX_IER(offset) \
170 CVMX_ADD_IO_SEG(0x0001180000000808ull + (((offset) & 1) * 1024))
171#define CVMX_MIO_UARTX_IIR(offset) \
172 CVMX_ADD_IO_SEG(0x0001180000000810ull + (((offset) & 1) * 1024))
173#define CVMX_MIO_UARTX_LCR(offset) \
174 CVMX_ADD_IO_SEG(0x0001180000000818ull + (((offset) & 1) * 1024))
175#define CVMX_MIO_UARTX_LSR(offset) \
176 CVMX_ADD_IO_SEG(0x0001180000000828ull + (((offset) & 1) * 1024))
177#define CVMX_MIO_UARTX_MCR(offset) \
178 CVMX_ADD_IO_SEG(0x0001180000000820ull + (((offset) & 1) * 1024))
179#define CVMX_MIO_UARTX_MSR(offset) \
180 CVMX_ADD_IO_SEG(0x0001180000000830ull + (((offset) & 1) * 1024))
181#define CVMX_MIO_UARTX_RBR(offset) \
182 CVMX_ADD_IO_SEG(0x0001180000000800ull + (((offset) & 1) * 1024))
183#define CVMX_MIO_UARTX_RFL(offset) \
184 CVMX_ADD_IO_SEG(0x0001180000000A08ull + (((offset) & 1) * 1024))
185#define CVMX_MIO_UARTX_RFW(offset) \
186 CVMX_ADD_IO_SEG(0x0001180000000930ull + (((offset) & 1) * 1024))
187#define CVMX_MIO_UARTX_SBCR(offset) \
188 CVMX_ADD_IO_SEG(0x0001180000000A20ull + (((offset) & 1) * 1024))
189#define CVMX_MIO_UARTX_SCR(offset) \
190 CVMX_ADD_IO_SEG(0x0001180000000838ull + (((offset) & 1) * 1024))
191#define CVMX_MIO_UARTX_SFE(offset) \
192 CVMX_ADD_IO_SEG(0x0001180000000A30ull + (((offset) & 1) * 1024))
193#define CVMX_MIO_UARTX_SRR(offset) \
194 CVMX_ADD_IO_SEG(0x0001180000000A10ull + (((offset) & 1) * 1024))
195#define CVMX_MIO_UARTX_SRT(offset) \
196 CVMX_ADD_IO_SEG(0x0001180000000A38ull + (((offset) & 1) * 1024))
197#define CVMX_MIO_UARTX_SRTS(offset) \
198 CVMX_ADD_IO_SEG(0x0001180000000A18ull + (((offset) & 1) * 1024))
199#define CVMX_MIO_UARTX_STT(offset) \
200 CVMX_ADD_IO_SEG(0x0001180000000B00ull + (((offset) & 1) * 1024))
201#define CVMX_MIO_UARTX_TFL(offset) \
202 CVMX_ADD_IO_SEG(0x0001180000000A00ull + (((offset) & 1) * 1024))
203#define CVMX_MIO_UARTX_TFR(offset) \
204 CVMX_ADD_IO_SEG(0x0001180000000928ull + (((offset) & 1) * 1024))
205#define CVMX_MIO_UARTX_THR(offset) \
206 CVMX_ADD_IO_SEG(0x0001180000000840ull + (((offset) & 1) * 1024))
207#define CVMX_MIO_UARTX_USR(offset) \
208 CVMX_ADD_IO_SEG(0x0001180000000938ull + (((offset) & 1) * 1024))
209 137
210union cvmx_mio_boot_bist_stat { 138union cvmx_mio_boot_bist_stat {
211 uint64_t u64; 139 uint64_t u64;
212 struct cvmx_mio_boot_bist_stat_s { 140 struct cvmx_mio_boot_bist_stat_s {
213 uint64_t reserved_2_63:62; 141 uint64_t reserved_0_63:64;
214 uint64_t loc:1;
215 uint64_t ncbi:1;
216 } s; 142 } s;
217 struct cvmx_mio_boot_bist_stat_cn30xx { 143 struct cvmx_mio_boot_bist_stat_cn30xx {
218 uint64_t reserved_4_63:60; 144 uint64_t reserved_4_63:60;
@@ -257,20 +183,33 @@ union cvmx_mio_boot_bist_stat {
257 struct cvmx_mio_boot_bist_stat_cn52xxp1 cn56xxp1; 183 struct cvmx_mio_boot_bist_stat_cn52xxp1 cn56xxp1;
258 struct cvmx_mio_boot_bist_stat_cn38xx cn58xx; 184 struct cvmx_mio_boot_bist_stat_cn38xx cn58xx;
259 struct cvmx_mio_boot_bist_stat_cn38xx cn58xxp1; 185 struct cvmx_mio_boot_bist_stat_cn38xx cn58xxp1;
186 struct cvmx_mio_boot_bist_stat_cn63xx {
187 uint64_t reserved_9_63:55;
188 uint64_t stat:9;
189 } cn63xx;
190 struct cvmx_mio_boot_bist_stat_cn63xx cn63xxp1;
260}; 191};
261 192
262union cvmx_mio_boot_comp { 193union cvmx_mio_boot_comp {
263 uint64_t u64; 194 uint64_t u64;
264 struct cvmx_mio_boot_comp_s { 195 struct cvmx_mio_boot_comp_s {
196 uint64_t reserved_0_63:64;
197 } s;
198 struct cvmx_mio_boot_comp_cn50xx {
265 uint64_t reserved_10_63:54; 199 uint64_t reserved_10_63:54;
266 uint64_t pctl:5; 200 uint64_t pctl:5;
267 uint64_t nctl:5; 201 uint64_t nctl:5;
268 } s; 202 } cn50xx;
269 struct cvmx_mio_boot_comp_s cn50xx; 203 struct cvmx_mio_boot_comp_cn50xx cn52xx;
270 struct cvmx_mio_boot_comp_s cn52xx; 204 struct cvmx_mio_boot_comp_cn50xx cn52xxp1;
271 struct cvmx_mio_boot_comp_s cn52xxp1; 205 struct cvmx_mio_boot_comp_cn50xx cn56xx;
272 struct cvmx_mio_boot_comp_s cn56xx; 206 struct cvmx_mio_boot_comp_cn50xx cn56xxp1;
273 struct cvmx_mio_boot_comp_s cn56xxp1; 207 struct cvmx_mio_boot_comp_cn63xx {
208 uint64_t reserved_12_63:52;
209 uint64_t pctl:6;
210 uint64_t nctl:6;
211 } cn63xx;
212 struct cvmx_mio_boot_comp_cn63xx cn63xxp1;
274}; 213};
275 214
276union cvmx_mio_boot_dma_cfgx { 215union cvmx_mio_boot_dma_cfgx {
@@ -291,6 +230,8 @@ union cvmx_mio_boot_dma_cfgx {
291 struct cvmx_mio_boot_dma_cfgx_s cn52xxp1; 230 struct cvmx_mio_boot_dma_cfgx_s cn52xxp1;
292 struct cvmx_mio_boot_dma_cfgx_s cn56xx; 231 struct cvmx_mio_boot_dma_cfgx_s cn56xx;
293 struct cvmx_mio_boot_dma_cfgx_s cn56xxp1; 232 struct cvmx_mio_boot_dma_cfgx_s cn56xxp1;
233 struct cvmx_mio_boot_dma_cfgx_s cn63xx;
234 struct cvmx_mio_boot_dma_cfgx_s cn63xxp1;
294}; 235};
295 236
296union cvmx_mio_boot_dma_intx { 237union cvmx_mio_boot_dma_intx {
@@ -304,6 +245,8 @@ union cvmx_mio_boot_dma_intx {
304 struct cvmx_mio_boot_dma_intx_s cn52xxp1; 245 struct cvmx_mio_boot_dma_intx_s cn52xxp1;
305 struct cvmx_mio_boot_dma_intx_s cn56xx; 246 struct cvmx_mio_boot_dma_intx_s cn56xx;
306 struct cvmx_mio_boot_dma_intx_s cn56xxp1; 247 struct cvmx_mio_boot_dma_intx_s cn56xxp1;
248 struct cvmx_mio_boot_dma_intx_s cn63xx;
249 struct cvmx_mio_boot_dma_intx_s cn63xxp1;
307}; 250};
308 251
309union cvmx_mio_boot_dma_int_enx { 252union cvmx_mio_boot_dma_int_enx {
@@ -317,6 +260,8 @@ union cvmx_mio_boot_dma_int_enx {
317 struct cvmx_mio_boot_dma_int_enx_s cn52xxp1; 260 struct cvmx_mio_boot_dma_int_enx_s cn52xxp1;
318 struct cvmx_mio_boot_dma_int_enx_s cn56xx; 261 struct cvmx_mio_boot_dma_int_enx_s cn56xx;
319 struct cvmx_mio_boot_dma_int_enx_s cn56xxp1; 262 struct cvmx_mio_boot_dma_int_enx_s cn56xxp1;
263 struct cvmx_mio_boot_dma_int_enx_s cn63xx;
264 struct cvmx_mio_boot_dma_int_enx_s cn63xxp1;
320}; 265};
321 266
322union cvmx_mio_boot_dma_timx { 267union cvmx_mio_boot_dma_timx {
@@ -342,6 +287,8 @@ union cvmx_mio_boot_dma_timx {
342 struct cvmx_mio_boot_dma_timx_s cn52xxp1; 287 struct cvmx_mio_boot_dma_timx_s cn52xxp1;
343 struct cvmx_mio_boot_dma_timx_s cn56xx; 288 struct cvmx_mio_boot_dma_timx_s cn56xx;
344 struct cvmx_mio_boot_dma_timx_s cn56xxp1; 289 struct cvmx_mio_boot_dma_timx_s cn56xxp1;
290 struct cvmx_mio_boot_dma_timx_s cn63xx;
291 struct cvmx_mio_boot_dma_timx_s cn63xxp1;
345}; 292};
346 293
347union cvmx_mio_boot_err { 294union cvmx_mio_boot_err {
@@ -362,6 +309,8 @@ union cvmx_mio_boot_err {
362 struct cvmx_mio_boot_err_s cn56xxp1; 309 struct cvmx_mio_boot_err_s cn56xxp1;
363 struct cvmx_mio_boot_err_s cn58xx; 310 struct cvmx_mio_boot_err_s cn58xx;
364 struct cvmx_mio_boot_err_s cn58xxp1; 311 struct cvmx_mio_boot_err_s cn58xxp1;
312 struct cvmx_mio_boot_err_s cn63xx;
313 struct cvmx_mio_boot_err_s cn63xxp1;
365}; 314};
366 315
367union cvmx_mio_boot_int { 316union cvmx_mio_boot_int {
@@ -382,6 +331,8 @@ union cvmx_mio_boot_int {
382 struct cvmx_mio_boot_int_s cn56xxp1; 331 struct cvmx_mio_boot_int_s cn56xxp1;
383 struct cvmx_mio_boot_int_s cn58xx; 332 struct cvmx_mio_boot_int_s cn58xx;
384 struct cvmx_mio_boot_int_s cn58xxp1; 333 struct cvmx_mio_boot_int_s cn58xxp1;
334 struct cvmx_mio_boot_int_s cn63xx;
335 struct cvmx_mio_boot_int_s cn63xxp1;
385}; 336};
386 337
387union cvmx_mio_boot_loc_adr { 338union cvmx_mio_boot_loc_adr {
@@ -402,6 +353,8 @@ union cvmx_mio_boot_loc_adr {
402 struct cvmx_mio_boot_loc_adr_s cn56xxp1; 353 struct cvmx_mio_boot_loc_adr_s cn56xxp1;
403 struct cvmx_mio_boot_loc_adr_s cn58xx; 354 struct cvmx_mio_boot_loc_adr_s cn58xx;
404 struct cvmx_mio_boot_loc_adr_s cn58xxp1; 355 struct cvmx_mio_boot_loc_adr_s cn58xxp1;
356 struct cvmx_mio_boot_loc_adr_s cn63xx;
357 struct cvmx_mio_boot_loc_adr_s cn63xxp1;
405}; 358};
406 359
407union cvmx_mio_boot_loc_cfgx { 360union cvmx_mio_boot_loc_cfgx {
@@ -424,6 +377,8 @@ union cvmx_mio_boot_loc_cfgx {
424 struct cvmx_mio_boot_loc_cfgx_s cn56xxp1; 377 struct cvmx_mio_boot_loc_cfgx_s cn56xxp1;
425 struct cvmx_mio_boot_loc_cfgx_s cn58xx; 378 struct cvmx_mio_boot_loc_cfgx_s cn58xx;
426 struct cvmx_mio_boot_loc_cfgx_s cn58xxp1; 379 struct cvmx_mio_boot_loc_cfgx_s cn58xxp1;
380 struct cvmx_mio_boot_loc_cfgx_s cn63xx;
381 struct cvmx_mio_boot_loc_cfgx_s cn63xxp1;
427}; 382};
428 383
429union cvmx_mio_boot_loc_dat { 384union cvmx_mio_boot_loc_dat {
@@ -442,6 +397,8 @@ union cvmx_mio_boot_loc_dat {
442 struct cvmx_mio_boot_loc_dat_s cn56xxp1; 397 struct cvmx_mio_boot_loc_dat_s cn56xxp1;
443 struct cvmx_mio_boot_loc_dat_s cn58xx; 398 struct cvmx_mio_boot_loc_dat_s cn58xx;
444 struct cvmx_mio_boot_loc_dat_s cn58xxp1; 399 struct cvmx_mio_boot_loc_dat_s cn58xxp1;
400 struct cvmx_mio_boot_loc_dat_s cn63xx;
401 struct cvmx_mio_boot_loc_dat_s cn63xxp1;
445}; 402};
446 403
447union cvmx_mio_boot_pin_defs { 404union cvmx_mio_boot_pin_defs {
@@ -478,6 +435,8 @@ union cvmx_mio_boot_pin_defs {
478 uint64_t term:2; 435 uint64_t term:2;
479 uint64_t reserved_0_8:9; 436 uint64_t reserved_0_8:9;
480 } cn56xx; 437 } cn56xx;
438 struct cvmx_mio_boot_pin_defs_cn52xx cn63xx;
439 struct cvmx_mio_boot_pin_defs_cn52xx cn63xxp1;
481}; 440};
482 441
483union cvmx_mio_boot_reg_cfgx { 442union cvmx_mio_boot_reg_cfgx {
@@ -539,6 +498,8 @@ union cvmx_mio_boot_reg_cfgx {
539 struct cvmx_mio_boot_reg_cfgx_s cn56xxp1; 498 struct cvmx_mio_boot_reg_cfgx_s cn56xxp1;
540 struct cvmx_mio_boot_reg_cfgx_cn30xx cn58xx; 499 struct cvmx_mio_boot_reg_cfgx_cn30xx cn58xx;
541 struct cvmx_mio_boot_reg_cfgx_cn30xx cn58xxp1; 500 struct cvmx_mio_boot_reg_cfgx_cn30xx cn58xxp1;
501 struct cvmx_mio_boot_reg_cfgx_s cn63xx;
502 struct cvmx_mio_boot_reg_cfgx_s cn63xxp1;
542}; 503};
543 504
544union cvmx_mio_boot_reg_timx { 505union cvmx_mio_boot_reg_timx {
@@ -583,6 +544,8 @@ union cvmx_mio_boot_reg_timx {
583 struct cvmx_mio_boot_reg_timx_s cn56xxp1; 544 struct cvmx_mio_boot_reg_timx_s cn56xxp1;
584 struct cvmx_mio_boot_reg_timx_s cn58xx; 545 struct cvmx_mio_boot_reg_timx_s cn58xx;
585 struct cvmx_mio_boot_reg_timx_s cn58xxp1; 546 struct cvmx_mio_boot_reg_timx_s cn58xxp1;
547 struct cvmx_mio_boot_reg_timx_s cn63xx;
548 struct cvmx_mio_boot_reg_timx_s cn63xxp1;
586}; 549};
587 550
588union cvmx_mio_boot_thr { 551union cvmx_mio_boot_thr {
@@ -611,6 +574,8 @@ union cvmx_mio_boot_thr {
611 struct cvmx_mio_boot_thr_s cn56xxp1; 574 struct cvmx_mio_boot_thr_s cn56xxp1;
612 struct cvmx_mio_boot_thr_cn30xx cn58xx; 575 struct cvmx_mio_boot_thr_cn30xx cn58xx;
613 struct cvmx_mio_boot_thr_cn30xx cn58xxp1; 576 struct cvmx_mio_boot_thr_cn30xx cn58xxp1;
577 struct cvmx_mio_boot_thr_s cn63xx;
578 struct cvmx_mio_boot_thr_s cn63xxp1;
614}; 579};
615 580
616union cvmx_mio_fus_bnk_datx { 581union cvmx_mio_fus_bnk_datx {
@@ -625,6 +590,8 @@ union cvmx_mio_fus_bnk_datx {
625 struct cvmx_mio_fus_bnk_datx_s cn56xxp1; 590 struct cvmx_mio_fus_bnk_datx_s cn56xxp1;
626 struct cvmx_mio_fus_bnk_datx_s cn58xx; 591 struct cvmx_mio_fus_bnk_datx_s cn58xx;
627 struct cvmx_mio_fus_bnk_datx_s cn58xxp1; 592 struct cvmx_mio_fus_bnk_datx_s cn58xxp1;
593 struct cvmx_mio_fus_bnk_datx_s cn63xx;
594 struct cvmx_mio_fus_bnk_datx_s cn63xxp1;
628}; 595};
629 596
630union cvmx_mio_fus_dat0 { 597union cvmx_mio_fus_dat0 {
@@ -644,6 +611,8 @@ union cvmx_mio_fus_dat0 {
644 struct cvmx_mio_fus_dat0_s cn56xxp1; 611 struct cvmx_mio_fus_dat0_s cn56xxp1;
645 struct cvmx_mio_fus_dat0_s cn58xx; 612 struct cvmx_mio_fus_dat0_s cn58xx;
646 struct cvmx_mio_fus_dat0_s cn58xxp1; 613 struct cvmx_mio_fus_dat0_s cn58xxp1;
614 struct cvmx_mio_fus_dat0_s cn63xx;
615 struct cvmx_mio_fus_dat0_s cn63xxp1;
647}; 616};
648 617
649union cvmx_mio_fus_dat1 { 618union cvmx_mio_fus_dat1 {
@@ -663,12 +632,15 @@ union cvmx_mio_fus_dat1 {
663 struct cvmx_mio_fus_dat1_s cn56xxp1; 632 struct cvmx_mio_fus_dat1_s cn56xxp1;
664 struct cvmx_mio_fus_dat1_s cn58xx; 633 struct cvmx_mio_fus_dat1_s cn58xx;
665 struct cvmx_mio_fus_dat1_s cn58xxp1; 634 struct cvmx_mio_fus_dat1_s cn58xxp1;
635 struct cvmx_mio_fus_dat1_s cn63xx;
636 struct cvmx_mio_fus_dat1_s cn63xxp1;
666}; 637};
667 638
668union cvmx_mio_fus_dat2 { 639union cvmx_mio_fus_dat2 {
669 uint64_t u64; 640 uint64_t u64;
670 struct cvmx_mio_fus_dat2_s { 641 struct cvmx_mio_fus_dat2_s {
671 uint64_t reserved_34_63:30; 642 uint64_t reserved_35_63:29;
643 uint64_t dorm_crypto:1;
672 uint64_t fus318:1; 644 uint64_t fus318:1;
673 uint64_t raid_en:1; 645 uint64_t raid_en:1;
674 uint64_t reserved_30_31:2; 646 uint64_t reserved_30_31:2;
@@ -775,14 +747,38 @@ union cvmx_mio_fus_dat2 {
775 uint64_t pp_dis:16; 747 uint64_t pp_dis:16;
776 } cn58xx; 748 } cn58xx;
777 struct cvmx_mio_fus_dat2_cn58xx cn58xxp1; 749 struct cvmx_mio_fus_dat2_cn58xx cn58xxp1;
750 struct cvmx_mio_fus_dat2_cn63xx {
751 uint64_t reserved_35_63:29;
752 uint64_t dorm_crypto:1;
753 uint64_t fus318:1;
754 uint64_t raid_en:1;
755 uint64_t reserved_29_31:3;
756 uint64_t nodfa_cp2:1;
757 uint64_t nomul:1;
758 uint64_t nocrypto:1;
759 uint64_t reserved_24_25:2;
760 uint64_t chip_id:8;
761 uint64_t reserved_6_15:10;
762 uint64_t pp_dis:6;
763 } cn63xx;
764 struct cvmx_mio_fus_dat2_cn63xx cn63xxp1;
778}; 765};
779 766
780union cvmx_mio_fus_dat3 { 767union cvmx_mio_fus_dat3 {
781 uint64_t u64; 768 uint64_t u64;
782 struct cvmx_mio_fus_dat3_s { 769 struct cvmx_mio_fus_dat3_s {
783 uint64_t reserved_32_63:32; 770 uint64_t reserved_58_63:6;
771 uint64_t pll_ctl:10;
772 uint64_t dfa_info_dte:3;
773 uint64_t dfa_info_clm:4;
774 uint64_t reserved_40_40:1;
775 uint64_t ema:2;
776 uint64_t efus_lck_rsv:1;
777 uint64_t efus_lck_man:1;
778 uint64_t pll_half_dis:1;
779 uint64_t l2c_crip:3;
784 uint64_t pll_div4:1; 780 uint64_t pll_div4:1;
785 uint64_t zip_crip:2; 781 uint64_t reserved_29_30:2;
786 uint64_t bar2_en:1; 782 uint64_t bar2_en:1;
787 uint64_t efus_lck:1; 783 uint64_t efus_lck:1;
788 uint64_t efus_ign:1; 784 uint64_t efus_ign:1;
@@ -801,7 +797,17 @@ union cvmx_mio_fus_dat3 {
801 uint64_t nodfa_dte:1; 797 uint64_t nodfa_dte:1;
802 uint64_t icache:24; 798 uint64_t icache:24;
803 } cn30xx; 799 } cn30xx;
804 struct cvmx_mio_fus_dat3_s cn31xx; 800 struct cvmx_mio_fus_dat3_cn31xx {
801 uint64_t reserved_32_63:32;
802 uint64_t pll_div4:1;
803 uint64_t zip_crip:2;
804 uint64_t bar2_en:1;
805 uint64_t efus_lck:1;
806 uint64_t efus_ign:1;
807 uint64_t nozip:1;
808 uint64_t nodfa_dte:1;
809 uint64_t icache:24;
810 } cn31xx;
805 struct cvmx_mio_fus_dat3_cn38xx { 811 struct cvmx_mio_fus_dat3_cn38xx {
806 uint64_t reserved_31_63:33; 812 uint64_t reserved_31_63:33;
807 uint64_t zip_crip:2; 813 uint64_t zip_crip:2;
@@ -828,6 +834,27 @@ union cvmx_mio_fus_dat3 {
828 struct cvmx_mio_fus_dat3_cn38xx cn56xxp1; 834 struct cvmx_mio_fus_dat3_cn38xx cn56xxp1;
829 struct cvmx_mio_fus_dat3_cn38xx cn58xx; 835 struct cvmx_mio_fus_dat3_cn38xx cn58xx;
830 struct cvmx_mio_fus_dat3_cn38xx cn58xxp1; 836 struct cvmx_mio_fus_dat3_cn38xx cn58xxp1;
837 struct cvmx_mio_fus_dat3_cn63xx {
838 uint64_t reserved_58_63:6;
839 uint64_t pll_ctl:10;
840 uint64_t dfa_info_dte:3;
841 uint64_t dfa_info_clm:4;
842 uint64_t reserved_40_40:1;
843 uint64_t ema:2;
844 uint64_t efus_lck_rsv:1;
845 uint64_t efus_lck_man:1;
846 uint64_t pll_half_dis:1;
847 uint64_t l2c_crip:3;
848 uint64_t reserved_31_31:1;
849 uint64_t zip_info:2;
850 uint64_t bar2_en:1;
851 uint64_t efus_lck:1;
852 uint64_t efus_ign:1;
853 uint64_t nozip:1;
854 uint64_t nodfa_dte:1;
855 uint64_t reserved_0_23:24;
856 } cn63xx;
857 struct cvmx_mio_fus_dat3_cn63xx cn63xxp1;
831}; 858};
832 859
833union cvmx_mio_fus_ema { 860union cvmx_mio_fus_ema {
@@ -848,6 +875,8 @@ union cvmx_mio_fus_ema {
848 uint64_t ema:2; 875 uint64_t ema:2;
849 } cn58xx; 876 } cn58xx;
850 struct cvmx_mio_fus_ema_cn58xx cn58xxp1; 877 struct cvmx_mio_fus_ema_cn58xx cn58xxp1;
878 struct cvmx_mio_fus_ema_s cn63xx;
879 struct cvmx_mio_fus_ema_s cn63xxp1;
851}; 880};
852 881
853union cvmx_mio_fus_pdf { 882union cvmx_mio_fus_pdf {
@@ -861,60 +890,96 @@ union cvmx_mio_fus_pdf {
861 struct cvmx_mio_fus_pdf_s cn56xx; 890 struct cvmx_mio_fus_pdf_s cn56xx;
862 struct cvmx_mio_fus_pdf_s cn56xxp1; 891 struct cvmx_mio_fus_pdf_s cn56xxp1;
863 struct cvmx_mio_fus_pdf_s cn58xx; 892 struct cvmx_mio_fus_pdf_s cn58xx;
893 struct cvmx_mio_fus_pdf_s cn63xx;
894 struct cvmx_mio_fus_pdf_s cn63xxp1;
864}; 895};
865 896
866union cvmx_mio_fus_pll { 897union cvmx_mio_fus_pll {
867 uint64_t u64; 898 uint64_t u64;
868 struct cvmx_mio_fus_pll_s { 899 struct cvmx_mio_fus_pll_s {
869 uint64_t reserved_2_63:62; 900 uint64_t reserved_8_63:56;
901 uint64_t c_cout_rst:1;
902 uint64_t c_cout_sel:2;
903 uint64_t pnr_cout_rst:1;
904 uint64_t pnr_cout_sel:2;
870 uint64_t rfslip:1; 905 uint64_t rfslip:1;
871 uint64_t fbslip:1; 906 uint64_t fbslip:1;
872 } s; 907 } s;
873 struct cvmx_mio_fus_pll_s cn50xx; 908 struct cvmx_mio_fus_pll_cn50xx {
874 struct cvmx_mio_fus_pll_s cn52xx; 909 uint64_t reserved_2_63:62;
875 struct cvmx_mio_fus_pll_s cn52xxp1; 910 uint64_t rfslip:1;
876 struct cvmx_mio_fus_pll_s cn56xx; 911 uint64_t fbslip:1;
877 struct cvmx_mio_fus_pll_s cn56xxp1; 912 } cn50xx;
878 struct cvmx_mio_fus_pll_s cn58xx; 913 struct cvmx_mio_fus_pll_cn50xx cn52xx;
879 struct cvmx_mio_fus_pll_s cn58xxp1; 914 struct cvmx_mio_fus_pll_cn50xx cn52xxp1;
915 struct cvmx_mio_fus_pll_cn50xx cn56xx;
916 struct cvmx_mio_fus_pll_cn50xx cn56xxp1;
917 struct cvmx_mio_fus_pll_cn50xx cn58xx;
918 struct cvmx_mio_fus_pll_cn50xx cn58xxp1;
919 struct cvmx_mio_fus_pll_s cn63xx;
920 struct cvmx_mio_fus_pll_s cn63xxp1;
880}; 921};
881 922
882union cvmx_mio_fus_prog { 923union cvmx_mio_fus_prog {
883 uint64_t u64; 924 uint64_t u64;
884 struct cvmx_mio_fus_prog_s { 925 struct cvmx_mio_fus_prog_s {
885 uint64_t reserved_1_63:63; 926 uint64_t reserved_2_63:62;
927 uint64_t soft:1;
886 uint64_t prog:1; 928 uint64_t prog:1;
887 } s; 929 } s;
888 struct cvmx_mio_fus_prog_s cn30xx; 930 struct cvmx_mio_fus_prog_cn30xx {
889 struct cvmx_mio_fus_prog_s cn31xx; 931 uint64_t reserved_1_63:63;
890 struct cvmx_mio_fus_prog_s cn38xx; 932 uint64_t prog:1;
891 struct cvmx_mio_fus_prog_s cn38xxp2; 933 } cn30xx;
892 struct cvmx_mio_fus_prog_s cn50xx; 934 struct cvmx_mio_fus_prog_cn30xx cn31xx;
893 struct cvmx_mio_fus_prog_s cn52xx; 935 struct cvmx_mio_fus_prog_cn30xx cn38xx;
894 struct cvmx_mio_fus_prog_s cn52xxp1; 936 struct cvmx_mio_fus_prog_cn30xx cn38xxp2;
895 struct cvmx_mio_fus_prog_s cn56xx; 937 struct cvmx_mio_fus_prog_cn30xx cn50xx;
896 struct cvmx_mio_fus_prog_s cn56xxp1; 938 struct cvmx_mio_fus_prog_cn30xx cn52xx;
897 struct cvmx_mio_fus_prog_s cn58xx; 939 struct cvmx_mio_fus_prog_cn30xx cn52xxp1;
898 struct cvmx_mio_fus_prog_s cn58xxp1; 940 struct cvmx_mio_fus_prog_cn30xx cn56xx;
941 struct cvmx_mio_fus_prog_cn30xx cn56xxp1;
942 struct cvmx_mio_fus_prog_cn30xx cn58xx;
943 struct cvmx_mio_fus_prog_cn30xx cn58xxp1;
944 struct cvmx_mio_fus_prog_s cn63xx;
945 struct cvmx_mio_fus_prog_s cn63xxp1;
899}; 946};
900 947
901union cvmx_mio_fus_prog_times { 948union cvmx_mio_fus_prog_times {
902 uint64_t u64; 949 uint64_t u64;
903 struct cvmx_mio_fus_prog_times_s { 950 struct cvmx_mio_fus_prog_times_s {
951 uint64_t reserved_35_63:29;
952 uint64_t vgate_pin:1;
953 uint64_t fsrc_pin:1;
954 uint64_t prog_pin:1;
955 uint64_t reserved_6_31:26;
956 uint64_t setup:6;
957 } s;
958 struct cvmx_mio_fus_prog_times_cn50xx {
904 uint64_t reserved_33_63:31; 959 uint64_t reserved_33_63:31;
905 uint64_t prog_pin:1; 960 uint64_t prog_pin:1;
906 uint64_t out:8; 961 uint64_t out:8;
907 uint64_t sclk_lo:4; 962 uint64_t sclk_lo:4;
908 uint64_t sclk_hi:12; 963 uint64_t sclk_hi:12;
909 uint64_t setup:8; 964 uint64_t setup:8;
910 } s; 965 } cn50xx;
911 struct cvmx_mio_fus_prog_times_s cn50xx; 966 struct cvmx_mio_fus_prog_times_cn50xx cn52xx;
912 struct cvmx_mio_fus_prog_times_s cn52xx; 967 struct cvmx_mio_fus_prog_times_cn50xx cn52xxp1;
913 struct cvmx_mio_fus_prog_times_s cn52xxp1; 968 struct cvmx_mio_fus_prog_times_cn50xx cn56xx;
914 struct cvmx_mio_fus_prog_times_s cn56xx; 969 struct cvmx_mio_fus_prog_times_cn50xx cn56xxp1;
915 struct cvmx_mio_fus_prog_times_s cn56xxp1; 970 struct cvmx_mio_fus_prog_times_cn50xx cn58xx;
916 struct cvmx_mio_fus_prog_times_s cn58xx; 971 struct cvmx_mio_fus_prog_times_cn50xx cn58xxp1;
917 struct cvmx_mio_fus_prog_times_s cn58xxp1; 972 struct cvmx_mio_fus_prog_times_cn63xx {
973 uint64_t reserved_35_63:29;
974 uint64_t vgate_pin:1;
975 uint64_t fsrc_pin:1;
976 uint64_t prog_pin:1;
977 uint64_t out:7;
978 uint64_t sclk_lo:4;
979 uint64_t sclk_hi:15;
980 uint64_t setup:6;
981 } cn63xx;
982 struct cvmx_mio_fus_prog_times_cn63xx cn63xxp1;
918}; 983};
919 984
920union cvmx_mio_fus_rcmd { 985union cvmx_mio_fus_rcmd {
@@ -948,6 +1013,57 @@ union cvmx_mio_fus_rcmd {
948 struct cvmx_mio_fus_rcmd_s cn56xxp1; 1013 struct cvmx_mio_fus_rcmd_s cn56xxp1;
949 struct cvmx_mio_fus_rcmd_cn30xx cn58xx; 1014 struct cvmx_mio_fus_rcmd_cn30xx cn58xx;
950 struct cvmx_mio_fus_rcmd_cn30xx cn58xxp1; 1015 struct cvmx_mio_fus_rcmd_cn30xx cn58xxp1;
1016 struct cvmx_mio_fus_rcmd_s cn63xx;
1017 struct cvmx_mio_fus_rcmd_s cn63xxp1;
1018};
1019
1020union cvmx_mio_fus_read_times {
1021 uint64_t u64;
1022 struct cvmx_mio_fus_read_times_s {
1023 uint64_t reserved_26_63:38;
1024 uint64_t sch:4;
1025 uint64_t fsh:4;
1026 uint64_t prh:4;
1027 uint64_t sdh:4;
1028 uint64_t setup:10;
1029 } s;
1030 struct cvmx_mio_fus_read_times_s cn63xx;
1031 struct cvmx_mio_fus_read_times_s cn63xxp1;
1032};
1033
1034union cvmx_mio_fus_repair_res0 {
1035 uint64_t u64;
1036 struct cvmx_mio_fus_repair_res0_s {
1037 uint64_t reserved_55_63:9;
1038 uint64_t too_many:1;
1039 uint64_t repair2:18;
1040 uint64_t repair1:18;
1041 uint64_t repair0:18;
1042 } s;
1043 struct cvmx_mio_fus_repair_res0_s cn63xx;
1044 struct cvmx_mio_fus_repair_res0_s cn63xxp1;
1045};
1046
1047union cvmx_mio_fus_repair_res1 {
1048 uint64_t u64;
1049 struct cvmx_mio_fus_repair_res1_s {
1050 uint64_t reserved_54_63:10;
1051 uint64_t repair5:18;
1052 uint64_t repair4:18;
1053 uint64_t repair3:18;
1054 } s;
1055 struct cvmx_mio_fus_repair_res1_s cn63xx;
1056 struct cvmx_mio_fus_repair_res1_s cn63xxp1;
1057};
1058
1059union cvmx_mio_fus_repair_res2 {
1060 uint64_t u64;
1061 struct cvmx_mio_fus_repair_res2_s {
1062 uint64_t reserved_18_63:46;
1063 uint64_t repair6:18;
1064 } s;
1065 struct cvmx_mio_fus_repair_res2_s cn63xx;
1066 struct cvmx_mio_fus_repair_res2_s cn63xxp1;
951}; 1067};
952 1068
953union cvmx_mio_fus_spr_repair_res { 1069union cvmx_mio_fus_spr_repair_res {
@@ -968,6 +1084,8 @@ union cvmx_mio_fus_spr_repair_res {
968 struct cvmx_mio_fus_spr_repair_res_s cn56xxp1; 1084 struct cvmx_mio_fus_spr_repair_res_s cn56xxp1;
969 struct cvmx_mio_fus_spr_repair_res_s cn58xx; 1085 struct cvmx_mio_fus_spr_repair_res_s cn58xx;
970 struct cvmx_mio_fus_spr_repair_res_s cn58xxp1; 1086 struct cvmx_mio_fus_spr_repair_res_s cn58xxp1;
1087 struct cvmx_mio_fus_spr_repair_res_s cn63xx;
1088 struct cvmx_mio_fus_spr_repair_res_s cn63xxp1;
971}; 1089};
972 1090
973union cvmx_mio_fus_spr_repair_sum { 1091union cvmx_mio_fus_spr_repair_sum {
@@ -986,6 +1104,8 @@ union cvmx_mio_fus_spr_repair_sum {
986 struct cvmx_mio_fus_spr_repair_sum_s cn56xxp1; 1104 struct cvmx_mio_fus_spr_repair_sum_s cn56xxp1;
987 struct cvmx_mio_fus_spr_repair_sum_s cn58xx; 1105 struct cvmx_mio_fus_spr_repair_sum_s cn58xx;
988 struct cvmx_mio_fus_spr_repair_sum_s cn58xxp1; 1106 struct cvmx_mio_fus_spr_repair_sum_s cn58xxp1;
1107 struct cvmx_mio_fus_spr_repair_sum_s cn63xx;
1108 struct cvmx_mio_fus_spr_repair_sum_s cn63xxp1;
989}; 1109};
990 1110
991union cvmx_mio_fus_unlock { 1111union cvmx_mio_fus_unlock {
@@ -1021,6 +1141,22 @@ union cvmx_mio_fus_wadr {
1021 struct cvmx_mio_fus_wadr_cn52xx cn56xxp1; 1141 struct cvmx_mio_fus_wadr_cn52xx cn56xxp1;
1022 struct cvmx_mio_fus_wadr_cn50xx cn58xx; 1142 struct cvmx_mio_fus_wadr_cn50xx cn58xx;
1023 struct cvmx_mio_fus_wadr_cn50xx cn58xxp1; 1143 struct cvmx_mio_fus_wadr_cn50xx cn58xxp1;
1144 struct cvmx_mio_fus_wadr_cn63xx {
1145 uint64_t reserved_4_63:60;
1146 uint64_t addr:4;
1147 } cn63xx;
1148 struct cvmx_mio_fus_wadr_cn63xx cn63xxp1;
1149};
1150
1151union cvmx_mio_gpio_comp {
1152 uint64_t u64;
1153 struct cvmx_mio_gpio_comp_s {
1154 uint64_t reserved_12_63:52;
1155 uint64_t pctl:6;
1156 uint64_t nctl:6;
1157 } s;
1158 struct cvmx_mio_gpio_comp_s cn63xx;
1159 struct cvmx_mio_gpio_comp_s cn63xxp1;
1024}; 1160};
1025 1161
1026union cvmx_mio_ndf_dma_cfg { 1162union cvmx_mio_ndf_dma_cfg {
@@ -1038,6 +1174,8 @@ union cvmx_mio_ndf_dma_cfg {
1038 uint64_t adr:36; 1174 uint64_t adr:36;
1039 } s; 1175 } s;
1040 struct cvmx_mio_ndf_dma_cfg_s cn52xx; 1176 struct cvmx_mio_ndf_dma_cfg_s cn52xx;
1177 struct cvmx_mio_ndf_dma_cfg_s cn63xx;
1178 struct cvmx_mio_ndf_dma_cfg_s cn63xxp1;
1041}; 1179};
1042 1180
1043union cvmx_mio_ndf_dma_int { 1181union cvmx_mio_ndf_dma_int {
@@ -1047,6 +1185,8 @@ union cvmx_mio_ndf_dma_int {
1047 uint64_t done:1; 1185 uint64_t done:1;
1048 } s; 1186 } s;
1049 struct cvmx_mio_ndf_dma_int_s cn52xx; 1187 struct cvmx_mio_ndf_dma_int_s cn52xx;
1188 struct cvmx_mio_ndf_dma_int_s cn63xx;
1189 struct cvmx_mio_ndf_dma_int_s cn63xxp1;
1050}; 1190};
1051 1191
1052union cvmx_mio_ndf_dma_int_en { 1192union cvmx_mio_ndf_dma_int_en {
@@ -1056,6 +1196,8 @@ union cvmx_mio_ndf_dma_int_en {
1056 uint64_t done:1; 1196 uint64_t done:1;
1057 } s; 1197 } s;
1058 struct cvmx_mio_ndf_dma_int_en_s cn52xx; 1198 struct cvmx_mio_ndf_dma_int_en_s cn52xx;
1199 struct cvmx_mio_ndf_dma_int_en_s cn63xx;
1200 struct cvmx_mio_ndf_dma_int_en_s cn63xxp1;
1059}; 1201};
1060 1202
1061union cvmx_mio_pll_ctl { 1203union cvmx_mio_pll_ctl {
@@ -1078,6 +1220,173 @@ union cvmx_mio_pll_setting {
1078 struct cvmx_mio_pll_setting_s cn31xx; 1220 struct cvmx_mio_pll_setting_s cn31xx;
1079}; 1221};
1080 1222
1223union cvmx_mio_ptp_clock_cfg {
1224 uint64_t u64;
1225 struct cvmx_mio_ptp_clock_cfg_s {
1226 uint64_t reserved_24_63:40;
1227 uint64_t evcnt_in:6;
1228 uint64_t evcnt_edge:1;
1229 uint64_t evcnt_en:1;
1230 uint64_t tstmp_in:6;
1231 uint64_t tstmp_edge:1;
1232 uint64_t tstmp_en:1;
1233 uint64_t ext_clk_in:6;
1234 uint64_t ext_clk_en:1;
1235 uint64_t ptp_en:1;
1236 } s;
1237 struct cvmx_mio_ptp_clock_cfg_s cn63xx;
1238 struct cvmx_mio_ptp_clock_cfg_s cn63xxp1;
1239};
1240
1241union cvmx_mio_ptp_clock_comp {
1242 uint64_t u64;
1243 struct cvmx_mio_ptp_clock_comp_s {
1244 uint64_t nanosec:32;
1245 uint64_t frnanosec:32;
1246 } s;
1247 struct cvmx_mio_ptp_clock_comp_s cn63xx;
1248 struct cvmx_mio_ptp_clock_comp_s cn63xxp1;
1249};
1250
1251union cvmx_mio_ptp_clock_hi {
1252 uint64_t u64;
1253 struct cvmx_mio_ptp_clock_hi_s {
1254 uint64_t nanosec:64;
1255 } s;
1256 struct cvmx_mio_ptp_clock_hi_s cn63xx;
1257 struct cvmx_mio_ptp_clock_hi_s cn63xxp1;
1258};
1259
1260union cvmx_mio_ptp_clock_lo {
1261 uint64_t u64;
1262 struct cvmx_mio_ptp_clock_lo_s {
1263 uint64_t reserved_32_63:32;
1264 uint64_t frnanosec:32;
1265 } s;
1266 struct cvmx_mio_ptp_clock_lo_s cn63xx;
1267 struct cvmx_mio_ptp_clock_lo_s cn63xxp1;
1268};
1269
1270union cvmx_mio_ptp_evt_cnt {
1271 uint64_t u64;
1272 struct cvmx_mio_ptp_evt_cnt_s {
1273 uint64_t cntr:64;
1274 } s;
1275 struct cvmx_mio_ptp_evt_cnt_s cn63xx;
1276 struct cvmx_mio_ptp_evt_cnt_s cn63xxp1;
1277};
1278
1279union cvmx_mio_ptp_timestamp {
1280 uint64_t u64;
1281 struct cvmx_mio_ptp_timestamp_s {
1282 uint64_t nanosec:64;
1283 } s;
1284 struct cvmx_mio_ptp_timestamp_s cn63xx;
1285 struct cvmx_mio_ptp_timestamp_s cn63xxp1;
1286};
1287
1288union cvmx_mio_rst_boot {
1289 uint64_t u64;
1290 struct cvmx_mio_rst_boot_s {
1291 uint64_t reserved_36_63:28;
1292 uint64_t c_mul:6;
1293 uint64_t pnr_mul:6;
1294 uint64_t qlm2_spd:4;
1295 uint64_t qlm1_spd:4;
1296 uint64_t qlm0_spd:4;
1297 uint64_t lboot:10;
1298 uint64_t rboot:1;
1299 uint64_t rboot_pin:1;
1300 } s;
1301 struct cvmx_mio_rst_boot_s cn63xx;
1302 struct cvmx_mio_rst_boot_s cn63xxp1;
1303};
1304
1305union cvmx_mio_rst_cfg {
1306 uint64_t u64;
1307 struct cvmx_mio_rst_cfg_s {
1308 uint64_t bist_delay:58;
1309 uint64_t reserved_3_5:3;
1310 uint64_t cntl_clr_bist:1;
1311 uint64_t warm_clr_bist:1;
1312 uint64_t soft_clr_bist:1;
1313 } s;
1314 struct cvmx_mio_rst_cfg_s cn63xx;
1315 struct cvmx_mio_rst_cfg_cn63xxp1 {
1316 uint64_t bist_delay:58;
1317 uint64_t reserved_2_5:4;
1318 uint64_t warm_clr_bist:1;
1319 uint64_t soft_clr_bist:1;
1320 } cn63xxp1;
1321};
1322
1323union cvmx_mio_rst_ctlx {
1324 uint64_t u64;
1325 struct cvmx_mio_rst_ctlx_s {
1326 uint64_t reserved_10_63:54;
1327 uint64_t prst_link:1;
1328 uint64_t rst_done:1;
1329 uint64_t rst_link:1;
1330 uint64_t host_mode:1;
1331 uint64_t prtmode:2;
1332 uint64_t rst_drv:1;
1333 uint64_t rst_rcv:1;
1334 uint64_t rst_chip:1;
1335 uint64_t rst_val:1;
1336 } s;
1337 struct cvmx_mio_rst_ctlx_s cn63xx;
1338 struct cvmx_mio_rst_ctlx_cn63xxp1 {
1339 uint64_t reserved_9_63:55;
1340 uint64_t rst_done:1;
1341 uint64_t rst_link:1;
1342 uint64_t host_mode:1;
1343 uint64_t prtmode:2;
1344 uint64_t rst_drv:1;
1345 uint64_t rst_rcv:1;
1346 uint64_t rst_chip:1;
1347 uint64_t rst_val:1;
1348 } cn63xxp1;
1349};
1350
1351union cvmx_mio_rst_delay {
1352 uint64_t u64;
1353 struct cvmx_mio_rst_delay_s {
1354 uint64_t reserved_32_63:32;
1355 uint64_t soft_rst_dly:16;
1356 uint64_t warm_rst_dly:16;
1357 } s;
1358 struct cvmx_mio_rst_delay_s cn63xx;
1359 struct cvmx_mio_rst_delay_s cn63xxp1;
1360};
1361
1362union cvmx_mio_rst_int {
1363 uint64_t u64;
1364 struct cvmx_mio_rst_int_s {
1365 uint64_t reserved_10_63:54;
1366 uint64_t perst1:1;
1367 uint64_t perst0:1;
1368 uint64_t reserved_2_7:6;
1369 uint64_t rst_link1:1;
1370 uint64_t rst_link0:1;
1371 } s;
1372 struct cvmx_mio_rst_int_s cn63xx;
1373 struct cvmx_mio_rst_int_s cn63xxp1;
1374};
1375
1376union cvmx_mio_rst_int_en {
1377 uint64_t u64;
1378 struct cvmx_mio_rst_int_en_s {
1379 uint64_t reserved_10_63:54;
1380 uint64_t perst1:1;
1381 uint64_t perst0:1;
1382 uint64_t reserved_2_7:6;
1383 uint64_t rst_link1:1;
1384 uint64_t rst_link0:1;
1385 } s;
1386 struct cvmx_mio_rst_int_en_s cn63xx;
1387 struct cvmx_mio_rst_int_en_s cn63xxp1;
1388};
1389
1081union cvmx_mio_twsx_int { 1390union cvmx_mio_twsx_int {
1082 uint64_t u64; 1391 uint64_t u64;
1083 struct cvmx_mio_twsx_int_s { 1392 struct cvmx_mio_twsx_int_s {
@@ -1115,6 +1424,8 @@ union cvmx_mio_twsx_int {
1115 struct cvmx_mio_twsx_int_s cn56xxp1; 1424 struct cvmx_mio_twsx_int_s cn56xxp1;
1116 struct cvmx_mio_twsx_int_s cn58xx; 1425 struct cvmx_mio_twsx_int_s cn58xx;
1117 struct cvmx_mio_twsx_int_s cn58xxp1; 1426 struct cvmx_mio_twsx_int_s cn58xxp1;
1427 struct cvmx_mio_twsx_int_s cn63xx;
1428 struct cvmx_mio_twsx_int_s cn63xxp1;
1118}; 1429};
1119 1430
1120union cvmx_mio_twsx_sw_twsi { 1431union cvmx_mio_twsx_sw_twsi {
@@ -1144,6 +1455,8 @@ union cvmx_mio_twsx_sw_twsi {
1144 struct cvmx_mio_twsx_sw_twsi_s cn56xxp1; 1455 struct cvmx_mio_twsx_sw_twsi_s cn56xxp1;
1145 struct cvmx_mio_twsx_sw_twsi_s cn58xx; 1456 struct cvmx_mio_twsx_sw_twsi_s cn58xx;
1146 struct cvmx_mio_twsx_sw_twsi_s cn58xxp1; 1457 struct cvmx_mio_twsx_sw_twsi_s cn58xxp1;
1458 struct cvmx_mio_twsx_sw_twsi_s cn63xx;
1459 struct cvmx_mio_twsx_sw_twsi_s cn63xxp1;
1147}; 1460};
1148 1461
1149union cvmx_mio_twsx_sw_twsi_ext { 1462union cvmx_mio_twsx_sw_twsi_ext {
@@ -1164,6 +1477,8 @@ union cvmx_mio_twsx_sw_twsi_ext {
1164 struct cvmx_mio_twsx_sw_twsi_ext_s cn56xxp1; 1477 struct cvmx_mio_twsx_sw_twsi_ext_s cn56xxp1;
1165 struct cvmx_mio_twsx_sw_twsi_ext_s cn58xx; 1478 struct cvmx_mio_twsx_sw_twsi_ext_s cn58xx;
1166 struct cvmx_mio_twsx_sw_twsi_ext_s cn58xxp1; 1479 struct cvmx_mio_twsx_sw_twsi_ext_s cn58xxp1;
1480 struct cvmx_mio_twsx_sw_twsi_ext_s cn63xx;
1481 struct cvmx_mio_twsx_sw_twsi_ext_s cn63xxp1;
1167}; 1482};
1168 1483
1169union cvmx_mio_twsx_twsi_sw { 1484union cvmx_mio_twsx_twsi_sw {
@@ -1184,6 +1499,8 @@ union cvmx_mio_twsx_twsi_sw {
1184 struct cvmx_mio_twsx_twsi_sw_s cn56xxp1; 1499 struct cvmx_mio_twsx_twsi_sw_s cn56xxp1;
1185 struct cvmx_mio_twsx_twsi_sw_s cn58xx; 1500 struct cvmx_mio_twsx_twsi_sw_s cn58xx;
1186 struct cvmx_mio_twsx_twsi_sw_s cn58xxp1; 1501 struct cvmx_mio_twsx_twsi_sw_s cn58xxp1;
1502 struct cvmx_mio_twsx_twsi_sw_s cn63xx;
1503 struct cvmx_mio_twsx_twsi_sw_s cn63xxp1;
1187}; 1504};
1188 1505
1189union cvmx_mio_uartx_dlh { 1506union cvmx_mio_uartx_dlh {
@@ -1203,6 +1520,8 @@ union cvmx_mio_uartx_dlh {
1203 struct cvmx_mio_uartx_dlh_s cn56xxp1; 1520 struct cvmx_mio_uartx_dlh_s cn56xxp1;
1204 struct cvmx_mio_uartx_dlh_s cn58xx; 1521 struct cvmx_mio_uartx_dlh_s cn58xx;
1205 struct cvmx_mio_uartx_dlh_s cn58xxp1; 1522 struct cvmx_mio_uartx_dlh_s cn58xxp1;
1523 struct cvmx_mio_uartx_dlh_s cn63xx;
1524 struct cvmx_mio_uartx_dlh_s cn63xxp1;
1206}; 1525};
1207 1526
1208union cvmx_mio_uartx_dll { 1527union cvmx_mio_uartx_dll {
@@ -1222,6 +1541,8 @@ union cvmx_mio_uartx_dll {
1222 struct cvmx_mio_uartx_dll_s cn56xxp1; 1541 struct cvmx_mio_uartx_dll_s cn56xxp1;
1223 struct cvmx_mio_uartx_dll_s cn58xx; 1542 struct cvmx_mio_uartx_dll_s cn58xx;
1224 struct cvmx_mio_uartx_dll_s cn58xxp1; 1543 struct cvmx_mio_uartx_dll_s cn58xxp1;
1544 struct cvmx_mio_uartx_dll_s cn63xx;
1545 struct cvmx_mio_uartx_dll_s cn63xxp1;
1225}; 1546};
1226 1547
1227union cvmx_mio_uartx_far { 1548union cvmx_mio_uartx_far {
@@ -1241,6 +1562,8 @@ union cvmx_mio_uartx_far {
1241 struct cvmx_mio_uartx_far_s cn56xxp1; 1562 struct cvmx_mio_uartx_far_s cn56xxp1;
1242 struct cvmx_mio_uartx_far_s cn58xx; 1563 struct cvmx_mio_uartx_far_s cn58xx;
1243 struct cvmx_mio_uartx_far_s cn58xxp1; 1564 struct cvmx_mio_uartx_far_s cn58xxp1;
1565 struct cvmx_mio_uartx_far_s cn63xx;
1566 struct cvmx_mio_uartx_far_s cn63xxp1;
1244}; 1567};
1245 1568
1246union cvmx_mio_uartx_fcr { 1569union cvmx_mio_uartx_fcr {
@@ -1265,6 +1588,8 @@ union cvmx_mio_uartx_fcr {
1265 struct cvmx_mio_uartx_fcr_s cn56xxp1; 1588 struct cvmx_mio_uartx_fcr_s cn56xxp1;
1266 struct cvmx_mio_uartx_fcr_s cn58xx; 1589 struct cvmx_mio_uartx_fcr_s cn58xx;
1267 struct cvmx_mio_uartx_fcr_s cn58xxp1; 1590 struct cvmx_mio_uartx_fcr_s cn58xxp1;
1591 struct cvmx_mio_uartx_fcr_s cn63xx;
1592 struct cvmx_mio_uartx_fcr_s cn63xxp1;
1268}; 1593};
1269 1594
1270union cvmx_mio_uartx_htx { 1595union cvmx_mio_uartx_htx {
@@ -1284,6 +1609,8 @@ union cvmx_mio_uartx_htx {
1284 struct cvmx_mio_uartx_htx_s cn56xxp1; 1609 struct cvmx_mio_uartx_htx_s cn56xxp1;
1285 struct cvmx_mio_uartx_htx_s cn58xx; 1610 struct cvmx_mio_uartx_htx_s cn58xx;
1286 struct cvmx_mio_uartx_htx_s cn58xxp1; 1611 struct cvmx_mio_uartx_htx_s cn58xxp1;
1612 struct cvmx_mio_uartx_htx_s cn63xx;
1613 struct cvmx_mio_uartx_htx_s cn63xxp1;
1287}; 1614};
1288 1615
1289union cvmx_mio_uartx_ier { 1616union cvmx_mio_uartx_ier {
@@ -1308,6 +1635,8 @@ union cvmx_mio_uartx_ier {
1308 struct cvmx_mio_uartx_ier_s cn56xxp1; 1635 struct cvmx_mio_uartx_ier_s cn56xxp1;
1309 struct cvmx_mio_uartx_ier_s cn58xx; 1636 struct cvmx_mio_uartx_ier_s cn58xx;
1310 struct cvmx_mio_uartx_ier_s cn58xxp1; 1637 struct cvmx_mio_uartx_ier_s cn58xxp1;
1638 struct cvmx_mio_uartx_ier_s cn63xx;
1639 struct cvmx_mio_uartx_ier_s cn63xxp1;
1311}; 1640};
1312 1641
1313union cvmx_mio_uartx_iir { 1642union cvmx_mio_uartx_iir {
@@ -1329,6 +1658,8 @@ union cvmx_mio_uartx_iir {
1329 struct cvmx_mio_uartx_iir_s cn56xxp1; 1658 struct cvmx_mio_uartx_iir_s cn56xxp1;
1330 struct cvmx_mio_uartx_iir_s cn58xx; 1659 struct cvmx_mio_uartx_iir_s cn58xx;
1331 struct cvmx_mio_uartx_iir_s cn58xxp1; 1660 struct cvmx_mio_uartx_iir_s cn58xxp1;
1661 struct cvmx_mio_uartx_iir_s cn63xx;
1662 struct cvmx_mio_uartx_iir_s cn63xxp1;
1332}; 1663};
1333 1664
1334union cvmx_mio_uartx_lcr { 1665union cvmx_mio_uartx_lcr {
@@ -1354,6 +1685,8 @@ union cvmx_mio_uartx_lcr {
1354 struct cvmx_mio_uartx_lcr_s cn56xxp1; 1685 struct cvmx_mio_uartx_lcr_s cn56xxp1;
1355 struct cvmx_mio_uartx_lcr_s cn58xx; 1686 struct cvmx_mio_uartx_lcr_s cn58xx;
1356 struct cvmx_mio_uartx_lcr_s cn58xxp1; 1687 struct cvmx_mio_uartx_lcr_s cn58xxp1;
1688 struct cvmx_mio_uartx_lcr_s cn63xx;
1689 struct cvmx_mio_uartx_lcr_s cn63xxp1;
1357}; 1690};
1358 1691
1359union cvmx_mio_uartx_lsr { 1692union cvmx_mio_uartx_lsr {
@@ -1380,6 +1713,8 @@ union cvmx_mio_uartx_lsr {
1380 struct cvmx_mio_uartx_lsr_s cn56xxp1; 1713 struct cvmx_mio_uartx_lsr_s cn56xxp1;
1381 struct cvmx_mio_uartx_lsr_s cn58xx; 1714 struct cvmx_mio_uartx_lsr_s cn58xx;
1382 struct cvmx_mio_uartx_lsr_s cn58xxp1; 1715 struct cvmx_mio_uartx_lsr_s cn58xxp1;
1716 struct cvmx_mio_uartx_lsr_s cn63xx;
1717 struct cvmx_mio_uartx_lsr_s cn63xxp1;
1383}; 1718};
1384 1719
1385union cvmx_mio_uartx_mcr { 1720union cvmx_mio_uartx_mcr {
@@ -1404,6 +1739,8 @@ union cvmx_mio_uartx_mcr {
1404 struct cvmx_mio_uartx_mcr_s cn56xxp1; 1739 struct cvmx_mio_uartx_mcr_s cn56xxp1;
1405 struct cvmx_mio_uartx_mcr_s cn58xx; 1740 struct cvmx_mio_uartx_mcr_s cn58xx;
1406 struct cvmx_mio_uartx_mcr_s cn58xxp1; 1741 struct cvmx_mio_uartx_mcr_s cn58xxp1;
1742 struct cvmx_mio_uartx_mcr_s cn63xx;
1743 struct cvmx_mio_uartx_mcr_s cn63xxp1;
1407}; 1744};
1408 1745
1409union cvmx_mio_uartx_msr { 1746union cvmx_mio_uartx_msr {
@@ -1430,6 +1767,8 @@ union cvmx_mio_uartx_msr {
1430 struct cvmx_mio_uartx_msr_s cn56xxp1; 1767 struct cvmx_mio_uartx_msr_s cn56xxp1;
1431 struct cvmx_mio_uartx_msr_s cn58xx; 1768 struct cvmx_mio_uartx_msr_s cn58xx;
1432 struct cvmx_mio_uartx_msr_s cn58xxp1; 1769 struct cvmx_mio_uartx_msr_s cn58xxp1;
1770 struct cvmx_mio_uartx_msr_s cn63xx;
1771 struct cvmx_mio_uartx_msr_s cn63xxp1;
1433}; 1772};
1434 1773
1435union cvmx_mio_uartx_rbr { 1774union cvmx_mio_uartx_rbr {
@@ -1449,6 +1788,8 @@ union cvmx_mio_uartx_rbr {
1449 struct cvmx_mio_uartx_rbr_s cn56xxp1; 1788 struct cvmx_mio_uartx_rbr_s cn56xxp1;
1450 struct cvmx_mio_uartx_rbr_s cn58xx; 1789 struct cvmx_mio_uartx_rbr_s cn58xx;
1451 struct cvmx_mio_uartx_rbr_s cn58xxp1; 1790 struct cvmx_mio_uartx_rbr_s cn58xxp1;
1791 struct cvmx_mio_uartx_rbr_s cn63xx;
1792 struct cvmx_mio_uartx_rbr_s cn63xxp1;
1452}; 1793};
1453 1794
1454union cvmx_mio_uartx_rfl { 1795union cvmx_mio_uartx_rfl {
@@ -1468,6 +1809,8 @@ union cvmx_mio_uartx_rfl {
1468 struct cvmx_mio_uartx_rfl_s cn56xxp1; 1809 struct cvmx_mio_uartx_rfl_s cn56xxp1;
1469 struct cvmx_mio_uartx_rfl_s cn58xx; 1810 struct cvmx_mio_uartx_rfl_s cn58xx;
1470 struct cvmx_mio_uartx_rfl_s cn58xxp1; 1811 struct cvmx_mio_uartx_rfl_s cn58xxp1;
1812 struct cvmx_mio_uartx_rfl_s cn63xx;
1813 struct cvmx_mio_uartx_rfl_s cn63xxp1;
1471}; 1814};
1472 1815
1473union cvmx_mio_uartx_rfw { 1816union cvmx_mio_uartx_rfw {
@@ -1489,6 +1832,8 @@ union cvmx_mio_uartx_rfw {
1489 struct cvmx_mio_uartx_rfw_s cn56xxp1; 1832 struct cvmx_mio_uartx_rfw_s cn56xxp1;
1490 struct cvmx_mio_uartx_rfw_s cn58xx; 1833 struct cvmx_mio_uartx_rfw_s cn58xx;
1491 struct cvmx_mio_uartx_rfw_s cn58xxp1; 1834 struct cvmx_mio_uartx_rfw_s cn58xxp1;
1835 struct cvmx_mio_uartx_rfw_s cn63xx;
1836 struct cvmx_mio_uartx_rfw_s cn63xxp1;
1492}; 1837};
1493 1838
1494union cvmx_mio_uartx_sbcr { 1839union cvmx_mio_uartx_sbcr {
@@ -1508,6 +1853,8 @@ union cvmx_mio_uartx_sbcr {
1508 struct cvmx_mio_uartx_sbcr_s cn56xxp1; 1853 struct cvmx_mio_uartx_sbcr_s cn56xxp1;
1509 struct cvmx_mio_uartx_sbcr_s cn58xx; 1854 struct cvmx_mio_uartx_sbcr_s cn58xx;
1510 struct cvmx_mio_uartx_sbcr_s cn58xxp1; 1855 struct cvmx_mio_uartx_sbcr_s cn58xxp1;
1856 struct cvmx_mio_uartx_sbcr_s cn63xx;
1857 struct cvmx_mio_uartx_sbcr_s cn63xxp1;
1511}; 1858};
1512 1859
1513union cvmx_mio_uartx_scr { 1860union cvmx_mio_uartx_scr {
@@ -1527,6 +1874,8 @@ union cvmx_mio_uartx_scr {
1527 struct cvmx_mio_uartx_scr_s cn56xxp1; 1874 struct cvmx_mio_uartx_scr_s cn56xxp1;
1528 struct cvmx_mio_uartx_scr_s cn58xx; 1875 struct cvmx_mio_uartx_scr_s cn58xx;
1529 struct cvmx_mio_uartx_scr_s cn58xxp1; 1876 struct cvmx_mio_uartx_scr_s cn58xxp1;
1877 struct cvmx_mio_uartx_scr_s cn63xx;
1878 struct cvmx_mio_uartx_scr_s cn63xxp1;
1530}; 1879};
1531 1880
1532union cvmx_mio_uartx_sfe { 1881union cvmx_mio_uartx_sfe {
@@ -1546,6 +1895,8 @@ union cvmx_mio_uartx_sfe {
1546 struct cvmx_mio_uartx_sfe_s cn56xxp1; 1895 struct cvmx_mio_uartx_sfe_s cn56xxp1;
1547 struct cvmx_mio_uartx_sfe_s cn58xx; 1896 struct cvmx_mio_uartx_sfe_s cn58xx;
1548 struct cvmx_mio_uartx_sfe_s cn58xxp1; 1897 struct cvmx_mio_uartx_sfe_s cn58xxp1;
1898 struct cvmx_mio_uartx_sfe_s cn63xx;
1899 struct cvmx_mio_uartx_sfe_s cn63xxp1;
1549}; 1900};
1550 1901
1551union cvmx_mio_uartx_srr { 1902union cvmx_mio_uartx_srr {
@@ -1567,6 +1918,8 @@ union cvmx_mio_uartx_srr {
1567 struct cvmx_mio_uartx_srr_s cn56xxp1; 1918 struct cvmx_mio_uartx_srr_s cn56xxp1;
1568 struct cvmx_mio_uartx_srr_s cn58xx; 1919 struct cvmx_mio_uartx_srr_s cn58xx;
1569 struct cvmx_mio_uartx_srr_s cn58xxp1; 1920 struct cvmx_mio_uartx_srr_s cn58xxp1;
1921 struct cvmx_mio_uartx_srr_s cn63xx;
1922 struct cvmx_mio_uartx_srr_s cn63xxp1;
1570}; 1923};
1571 1924
1572union cvmx_mio_uartx_srt { 1925union cvmx_mio_uartx_srt {
@@ -1586,6 +1939,8 @@ union cvmx_mio_uartx_srt {
1586 struct cvmx_mio_uartx_srt_s cn56xxp1; 1939 struct cvmx_mio_uartx_srt_s cn56xxp1;
1587 struct cvmx_mio_uartx_srt_s cn58xx; 1940 struct cvmx_mio_uartx_srt_s cn58xx;
1588 struct cvmx_mio_uartx_srt_s cn58xxp1; 1941 struct cvmx_mio_uartx_srt_s cn58xxp1;
1942 struct cvmx_mio_uartx_srt_s cn63xx;
1943 struct cvmx_mio_uartx_srt_s cn63xxp1;
1589}; 1944};
1590 1945
1591union cvmx_mio_uartx_srts { 1946union cvmx_mio_uartx_srts {
@@ -1605,6 +1960,8 @@ union cvmx_mio_uartx_srts {
1605 struct cvmx_mio_uartx_srts_s cn56xxp1; 1960 struct cvmx_mio_uartx_srts_s cn56xxp1;
1606 struct cvmx_mio_uartx_srts_s cn58xx; 1961 struct cvmx_mio_uartx_srts_s cn58xx;
1607 struct cvmx_mio_uartx_srts_s cn58xxp1; 1962 struct cvmx_mio_uartx_srts_s cn58xxp1;
1963 struct cvmx_mio_uartx_srts_s cn63xx;
1964 struct cvmx_mio_uartx_srts_s cn63xxp1;
1608}; 1965};
1609 1966
1610union cvmx_mio_uartx_stt { 1967union cvmx_mio_uartx_stt {
@@ -1624,6 +1981,8 @@ union cvmx_mio_uartx_stt {
1624 struct cvmx_mio_uartx_stt_s cn56xxp1; 1981 struct cvmx_mio_uartx_stt_s cn56xxp1;
1625 struct cvmx_mio_uartx_stt_s cn58xx; 1982 struct cvmx_mio_uartx_stt_s cn58xx;
1626 struct cvmx_mio_uartx_stt_s cn58xxp1; 1983 struct cvmx_mio_uartx_stt_s cn58xxp1;
1984 struct cvmx_mio_uartx_stt_s cn63xx;
1985 struct cvmx_mio_uartx_stt_s cn63xxp1;
1627}; 1986};
1628 1987
1629union cvmx_mio_uartx_tfl { 1988union cvmx_mio_uartx_tfl {
@@ -1643,6 +2002,8 @@ union cvmx_mio_uartx_tfl {
1643 struct cvmx_mio_uartx_tfl_s cn56xxp1; 2002 struct cvmx_mio_uartx_tfl_s cn56xxp1;
1644 struct cvmx_mio_uartx_tfl_s cn58xx; 2003 struct cvmx_mio_uartx_tfl_s cn58xx;
1645 struct cvmx_mio_uartx_tfl_s cn58xxp1; 2004 struct cvmx_mio_uartx_tfl_s cn58xxp1;
2005 struct cvmx_mio_uartx_tfl_s cn63xx;
2006 struct cvmx_mio_uartx_tfl_s cn63xxp1;
1646}; 2007};
1647 2008
1648union cvmx_mio_uartx_tfr { 2009union cvmx_mio_uartx_tfr {
@@ -1662,6 +2023,8 @@ union cvmx_mio_uartx_tfr {
1662 struct cvmx_mio_uartx_tfr_s cn56xxp1; 2023 struct cvmx_mio_uartx_tfr_s cn56xxp1;
1663 struct cvmx_mio_uartx_tfr_s cn58xx; 2024 struct cvmx_mio_uartx_tfr_s cn58xx;
1664 struct cvmx_mio_uartx_tfr_s cn58xxp1; 2025 struct cvmx_mio_uartx_tfr_s cn58xxp1;
2026 struct cvmx_mio_uartx_tfr_s cn63xx;
2027 struct cvmx_mio_uartx_tfr_s cn63xxp1;
1665}; 2028};
1666 2029
1667union cvmx_mio_uartx_thr { 2030union cvmx_mio_uartx_thr {
@@ -1681,6 +2044,8 @@ union cvmx_mio_uartx_thr {
1681 struct cvmx_mio_uartx_thr_s cn56xxp1; 2044 struct cvmx_mio_uartx_thr_s cn56xxp1;
1682 struct cvmx_mio_uartx_thr_s cn58xx; 2045 struct cvmx_mio_uartx_thr_s cn58xx;
1683 struct cvmx_mio_uartx_thr_s cn58xxp1; 2046 struct cvmx_mio_uartx_thr_s cn58xxp1;
2047 struct cvmx_mio_uartx_thr_s cn63xx;
2048 struct cvmx_mio_uartx_thr_s cn63xxp1;
1684}; 2049};
1685 2050
1686union cvmx_mio_uartx_usr { 2051union cvmx_mio_uartx_usr {
@@ -1704,6 +2069,8 @@ union cvmx_mio_uartx_usr {
1704 struct cvmx_mio_uartx_usr_s cn56xxp1; 2069 struct cvmx_mio_uartx_usr_s cn56xxp1;
1705 struct cvmx_mio_uartx_usr_s cn58xx; 2070 struct cvmx_mio_uartx_usr_s cn58xx;
1706 struct cvmx_mio_uartx_usr_s cn58xxp1; 2071 struct cvmx_mio_uartx_usr_s cn58xxp1;
2072 struct cvmx_mio_uartx_usr_s cn63xx;
2073 struct cvmx_mio_uartx_usr_s cn63xxp1;
1707}; 2074};
1708 2075
1709union cvmx_mio_uart2_dlh { 2076union cvmx_mio_uart2_dlh {
diff --git a/arch/mips/include/asm/octeon/cvmx-mixx-defs.h b/arch/mips/include/asm/octeon/cvmx-mixx-defs.h
index dab6dca492f9..7057c447e69e 100644
--- a/arch/mips/include/asm/octeon/cvmx-mixx-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-mixx-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,52 +28,52 @@
28#ifndef __CVMX_MIXX_DEFS_H__ 28#ifndef __CVMX_MIXX_DEFS_H__
29#define __CVMX_MIXX_DEFS_H__ 29#define __CVMX_MIXX_DEFS_H__
30 30
31#define CVMX_MIXX_BIST(offset) \ 31#define CVMX_MIXX_BIST(offset) (CVMX_ADD_IO_SEG(0x0001070000100078ull) + ((offset) & 1) * 2048)
32 CVMX_ADD_IO_SEG(0x0001070000100078ull + (((offset) & 1) * 2048)) 32#define CVMX_MIXX_CTL(offset) (CVMX_ADD_IO_SEG(0x0001070000100020ull) + ((offset) & 1) * 2048)
33#define CVMX_MIXX_CTL(offset) \ 33#define CVMX_MIXX_INTENA(offset) (CVMX_ADD_IO_SEG(0x0001070000100050ull) + ((offset) & 1) * 2048)
34 CVMX_ADD_IO_SEG(0x0001070000100020ull + (((offset) & 1) * 2048)) 34#define CVMX_MIXX_IRCNT(offset) (CVMX_ADD_IO_SEG(0x0001070000100030ull) + ((offset) & 1) * 2048)
35#define CVMX_MIXX_INTENA(offset) \ 35#define CVMX_MIXX_IRHWM(offset) (CVMX_ADD_IO_SEG(0x0001070000100028ull) + ((offset) & 1) * 2048)
36 CVMX_ADD_IO_SEG(0x0001070000100050ull + (((offset) & 1) * 2048)) 36#define CVMX_MIXX_IRING1(offset) (CVMX_ADD_IO_SEG(0x0001070000100010ull) + ((offset) & 1) * 2048)
37#define CVMX_MIXX_IRCNT(offset) \ 37#define CVMX_MIXX_IRING2(offset) (CVMX_ADD_IO_SEG(0x0001070000100018ull) + ((offset) & 1) * 2048)
38 CVMX_ADD_IO_SEG(0x0001070000100030ull + (((offset) & 1) * 2048)) 38#define CVMX_MIXX_ISR(offset) (CVMX_ADD_IO_SEG(0x0001070000100048ull) + ((offset) & 1) * 2048)
39#define CVMX_MIXX_IRHWM(offset) \ 39#define CVMX_MIXX_ORCNT(offset) (CVMX_ADD_IO_SEG(0x0001070000100040ull) + ((offset) & 1) * 2048)
40 CVMX_ADD_IO_SEG(0x0001070000100028ull + (((offset) & 1) * 2048)) 40#define CVMX_MIXX_ORHWM(offset) (CVMX_ADD_IO_SEG(0x0001070000100038ull) + ((offset) & 1) * 2048)
41#define CVMX_MIXX_IRING1(offset) \ 41#define CVMX_MIXX_ORING1(offset) (CVMX_ADD_IO_SEG(0x0001070000100000ull) + ((offset) & 1) * 2048)
42 CVMX_ADD_IO_SEG(0x0001070000100010ull + (((offset) & 1) * 2048)) 42#define CVMX_MIXX_ORING2(offset) (CVMX_ADD_IO_SEG(0x0001070000100008ull) + ((offset) & 1) * 2048)
43#define CVMX_MIXX_IRING2(offset) \ 43#define CVMX_MIXX_REMCNT(offset) (CVMX_ADD_IO_SEG(0x0001070000100058ull) + ((offset) & 1) * 2048)
44 CVMX_ADD_IO_SEG(0x0001070000100018ull + (((offset) & 1) * 2048)) 44#define CVMX_MIXX_TSCTL(offset) (CVMX_ADD_IO_SEG(0x0001070000100068ull) + ((offset) & 1) * 2048)
45#define CVMX_MIXX_ISR(offset) \ 45#define CVMX_MIXX_TSTAMP(offset) (CVMX_ADD_IO_SEG(0x0001070000100060ull) + ((offset) & 1) * 2048)
46 CVMX_ADD_IO_SEG(0x0001070000100048ull + (((offset) & 1) * 2048))
47#define CVMX_MIXX_ORCNT(offset) \
48 CVMX_ADD_IO_SEG(0x0001070000100040ull + (((offset) & 1) * 2048))
49#define CVMX_MIXX_ORHWM(offset) \
50 CVMX_ADD_IO_SEG(0x0001070000100038ull + (((offset) & 1) * 2048))
51#define CVMX_MIXX_ORING1(offset) \
52 CVMX_ADD_IO_SEG(0x0001070000100000ull + (((offset) & 1) * 2048))
53#define CVMX_MIXX_ORING2(offset) \
54 CVMX_ADD_IO_SEG(0x0001070000100008ull + (((offset) & 1) * 2048))
55#define CVMX_MIXX_REMCNT(offset) \
56 CVMX_ADD_IO_SEG(0x0001070000100058ull + (((offset) & 1) * 2048))
57 46
58union cvmx_mixx_bist { 47union cvmx_mixx_bist {
59 uint64_t u64; 48 uint64_t u64;
60 struct cvmx_mixx_bist_s { 49 struct cvmx_mixx_bist_s {
61 uint64_t reserved_4_63:60; 50 uint64_t reserved_6_63:58;
51 uint64_t opfdat:1;
52 uint64_t mrgdat:1;
62 uint64_t mrqdat:1; 53 uint64_t mrqdat:1;
63 uint64_t ipfdat:1; 54 uint64_t ipfdat:1;
64 uint64_t irfdat:1; 55 uint64_t irfdat:1;
65 uint64_t orfdat:1; 56 uint64_t orfdat:1;
66 } s; 57 } s;
67 struct cvmx_mixx_bist_s cn52xx; 58 struct cvmx_mixx_bist_cn52xx {
68 struct cvmx_mixx_bist_s cn52xxp1; 59 uint64_t reserved_4_63:60;
69 struct cvmx_mixx_bist_s cn56xx; 60 uint64_t mrqdat:1;
70 struct cvmx_mixx_bist_s cn56xxp1; 61 uint64_t ipfdat:1;
62 uint64_t irfdat:1;
63 uint64_t orfdat:1;
64 } cn52xx;
65 struct cvmx_mixx_bist_cn52xx cn52xxp1;
66 struct cvmx_mixx_bist_cn52xx cn56xx;
67 struct cvmx_mixx_bist_cn52xx cn56xxp1;
68 struct cvmx_mixx_bist_s cn63xx;
69 struct cvmx_mixx_bist_s cn63xxp1;
71}; 70};
72 71
73union cvmx_mixx_ctl { 72union cvmx_mixx_ctl {
74 uint64_t u64; 73 uint64_t u64;
75 struct cvmx_mixx_ctl_s { 74 struct cvmx_mixx_ctl_s {
76 uint64_t reserved_8_63:56; 75 uint64_t reserved_12_63:52;
76 uint64_t ts_thresh:4;
77 uint64_t crc_strip:1; 77 uint64_t crc_strip:1;
78 uint64_t busy:1; 78 uint64_t busy:1;
79 uint64_t en:1; 79 uint64_t en:1;
@@ -82,16 +82,28 @@ union cvmx_mixx_ctl {
82 uint64_t nbtarb:1; 82 uint64_t nbtarb:1;
83 uint64_t mrq_hwm:2; 83 uint64_t mrq_hwm:2;
84 } s; 84 } s;
85 struct cvmx_mixx_ctl_s cn52xx; 85 struct cvmx_mixx_ctl_cn52xx {
86 struct cvmx_mixx_ctl_s cn52xxp1; 86 uint64_t reserved_8_63:56;
87 struct cvmx_mixx_ctl_s cn56xx; 87 uint64_t crc_strip:1;
88 struct cvmx_mixx_ctl_s cn56xxp1; 88 uint64_t busy:1;
89 uint64_t en:1;
90 uint64_t reset:1;
91 uint64_t lendian:1;
92 uint64_t nbtarb:1;
93 uint64_t mrq_hwm:2;
94 } cn52xx;
95 struct cvmx_mixx_ctl_cn52xx cn52xxp1;
96 struct cvmx_mixx_ctl_cn52xx cn56xx;
97 struct cvmx_mixx_ctl_cn52xx cn56xxp1;
98 struct cvmx_mixx_ctl_s cn63xx;
99 struct cvmx_mixx_ctl_s cn63xxp1;
89}; 100};
90 101
91union cvmx_mixx_intena { 102union cvmx_mixx_intena {
92 uint64_t u64; 103 uint64_t u64;
93 struct cvmx_mixx_intena_s { 104 struct cvmx_mixx_intena_s {
94 uint64_t reserved_7_63:57; 105 uint64_t reserved_8_63:56;
106 uint64_t tsena:1;
95 uint64_t orunena:1; 107 uint64_t orunena:1;
96 uint64_t irunena:1; 108 uint64_t irunena:1;
97 uint64_t data_drpena:1; 109 uint64_t data_drpena:1;
@@ -100,10 +112,21 @@ union cvmx_mixx_intena {
100 uint64_t ivfena:1; 112 uint64_t ivfena:1;
101 uint64_t ovfena:1; 113 uint64_t ovfena:1;
102 } s; 114 } s;
103 struct cvmx_mixx_intena_s cn52xx; 115 struct cvmx_mixx_intena_cn52xx {
104 struct cvmx_mixx_intena_s cn52xxp1; 116 uint64_t reserved_7_63:57;
105 struct cvmx_mixx_intena_s cn56xx; 117 uint64_t orunena:1;
106 struct cvmx_mixx_intena_s cn56xxp1; 118 uint64_t irunena:1;
119 uint64_t data_drpena:1;
120 uint64_t ithena:1;
121 uint64_t othena:1;
122 uint64_t ivfena:1;
123 uint64_t ovfena:1;
124 } cn52xx;
125 struct cvmx_mixx_intena_cn52xx cn52xxp1;
126 struct cvmx_mixx_intena_cn52xx cn56xx;
127 struct cvmx_mixx_intena_cn52xx cn56xxp1;
128 struct cvmx_mixx_intena_s cn63xx;
129 struct cvmx_mixx_intena_s cn63xxp1;
107}; 130};
108 131
109union cvmx_mixx_ircnt { 132union cvmx_mixx_ircnt {
@@ -116,6 +139,8 @@ union cvmx_mixx_ircnt {
116 struct cvmx_mixx_ircnt_s cn52xxp1; 139 struct cvmx_mixx_ircnt_s cn52xxp1;
117 struct cvmx_mixx_ircnt_s cn56xx; 140 struct cvmx_mixx_ircnt_s cn56xx;
118 struct cvmx_mixx_ircnt_s cn56xxp1; 141 struct cvmx_mixx_ircnt_s cn56xxp1;
142 struct cvmx_mixx_ircnt_s cn63xx;
143 struct cvmx_mixx_ircnt_s cn63xxp1;
119}; 144};
120 145
121union cvmx_mixx_irhwm { 146union cvmx_mixx_irhwm {
@@ -129,6 +154,8 @@ union cvmx_mixx_irhwm {
129 struct cvmx_mixx_irhwm_s cn52xxp1; 154 struct cvmx_mixx_irhwm_s cn52xxp1;
130 struct cvmx_mixx_irhwm_s cn56xx; 155 struct cvmx_mixx_irhwm_s cn56xx;
131 struct cvmx_mixx_irhwm_s cn56xxp1; 156 struct cvmx_mixx_irhwm_s cn56xxp1;
157 struct cvmx_mixx_irhwm_s cn63xx;
158 struct cvmx_mixx_irhwm_s cn63xxp1;
132}; 159};
133 160
134union cvmx_mixx_iring1 { 161union cvmx_mixx_iring1 {
@@ -136,14 +163,21 @@ union cvmx_mixx_iring1 {
136 struct cvmx_mixx_iring1_s { 163 struct cvmx_mixx_iring1_s {
137 uint64_t reserved_60_63:4; 164 uint64_t reserved_60_63:4;
138 uint64_t isize:20; 165 uint64_t isize:20;
166 uint64_t ibase:37;
167 uint64_t reserved_0_2:3;
168 } s;
169 struct cvmx_mixx_iring1_cn52xx {
170 uint64_t reserved_60_63:4;
171 uint64_t isize:20;
139 uint64_t reserved_36_39:4; 172 uint64_t reserved_36_39:4;
140 uint64_t ibase:33; 173 uint64_t ibase:33;
141 uint64_t reserved_0_2:3; 174 uint64_t reserved_0_2:3;
142 } s; 175 } cn52xx;
143 struct cvmx_mixx_iring1_s cn52xx; 176 struct cvmx_mixx_iring1_cn52xx cn52xxp1;
144 struct cvmx_mixx_iring1_s cn52xxp1; 177 struct cvmx_mixx_iring1_cn52xx cn56xx;
145 struct cvmx_mixx_iring1_s cn56xx; 178 struct cvmx_mixx_iring1_cn52xx cn56xxp1;
146 struct cvmx_mixx_iring1_s cn56xxp1; 179 struct cvmx_mixx_iring1_s cn63xx;
180 struct cvmx_mixx_iring1_s cn63xxp1;
147}; 181};
148 182
149union cvmx_mixx_iring2 { 183union cvmx_mixx_iring2 {
@@ -158,12 +192,15 @@ union cvmx_mixx_iring2 {
158 struct cvmx_mixx_iring2_s cn52xxp1; 192 struct cvmx_mixx_iring2_s cn52xxp1;
159 struct cvmx_mixx_iring2_s cn56xx; 193 struct cvmx_mixx_iring2_s cn56xx;
160 struct cvmx_mixx_iring2_s cn56xxp1; 194 struct cvmx_mixx_iring2_s cn56xxp1;
195 struct cvmx_mixx_iring2_s cn63xx;
196 struct cvmx_mixx_iring2_s cn63xxp1;
161}; 197};
162 198
163union cvmx_mixx_isr { 199union cvmx_mixx_isr {
164 uint64_t u64; 200 uint64_t u64;
165 struct cvmx_mixx_isr_s { 201 struct cvmx_mixx_isr_s {
166 uint64_t reserved_7_63:57; 202 uint64_t reserved_8_63:56;
203 uint64_t ts:1;
167 uint64_t orun:1; 204 uint64_t orun:1;
168 uint64_t irun:1; 205 uint64_t irun:1;
169 uint64_t data_drp:1; 206 uint64_t data_drp:1;
@@ -172,10 +209,21 @@ union cvmx_mixx_isr {
172 uint64_t idblovf:1; 209 uint64_t idblovf:1;
173 uint64_t odblovf:1; 210 uint64_t odblovf:1;
174 } s; 211 } s;
175 struct cvmx_mixx_isr_s cn52xx; 212 struct cvmx_mixx_isr_cn52xx {
176 struct cvmx_mixx_isr_s cn52xxp1; 213 uint64_t reserved_7_63:57;
177 struct cvmx_mixx_isr_s cn56xx; 214 uint64_t orun:1;
178 struct cvmx_mixx_isr_s cn56xxp1; 215 uint64_t irun:1;
216 uint64_t data_drp:1;
217 uint64_t irthresh:1;
218 uint64_t orthresh:1;
219 uint64_t idblovf:1;
220 uint64_t odblovf:1;
221 } cn52xx;
222 struct cvmx_mixx_isr_cn52xx cn52xxp1;
223 struct cvmx_mixx_isr_cn52xx cn56xx;
224 struct cvmx_mixx_isr_cn52xx cn56xxp1;
225 struct cvmx_mixx_isr_s cn63xx;
226 struct cvmx_mixx_isr_s cn63xxp1;
179}; 227};
180 228
181union cvmx_mixx_orcnt { 229union cvmx_mixx_orcnt {
@@ -188,6 +236,8 @@ union cvmx_mixx_orcnt {
188 struct cvmx_mixx_orcnt_s cn52xxp1; 236 struct cvmx_mixx_orcnt_s cn52xxp1;
189 struct cvmx_mixx_orcnt_s cn56xx; 237 struct cvmx_mixx_orcnt_s cn56xx;
190 struct cvmx_mixx_orcnt_s cn56xxp1; 238 struct cvmx_mixx_orcnt_s cn56xxp1;
239 struct cvmx_mixx_orcnt_s cn63xx;
240 struct cvmx_mixx_orcnt_s cn63xxp1;
191}; 241};
192 242
193union cvmx_mixx_orhwm { 243union cvmx_mixx_orhwm {
@@ -200,6 +250,8 @@ union cvmx_mixx_orhwm {
200 struct cvmx_mixx_orhwm_s cn52xxp1; 250 struct cvmx_mixx_orhwm_s cn52xxp1;
201 struct cvmx_mixx_orhwm_s cn56xx; 251 struct cvmx_mixx_orhwm_s cn56xx;
202 struct cvmx_mixx_orhwm_s cn56xxp1; 252 struct cvmx_mixx_orhwm_s cn56xxp1;
253 struct cvmx_mixx_orhwm_s cn63xx;
254 struct cvmx_mixx_orhwm_s cn63xxp1;
203}; 255};
204 256
205union cvmx_mixx_oring1 { 257union cvmx_mixx_oring1 {
@@ -207,14 +259,21 @@ union cvmx_mixx_oring1 {
207 struct cvmx_mixx_oring1_s { 259 struct cvmx_mixx_oring1_s {
208 uint64_t reserved_60_63:4; 260 uint64_t reserved_60_63:4;
209 uint64_t osize:20; 261 uint64_t osize:20;
262 uint64_t obase:37;
263 uint64_t reserved_0_2:3;
264 } s;
265 struct cvmx_mixx_oring1_cn52xx {
266 uint64_t reserved_60_63:4;
267 uint64_t osize:20;
210 uint64_t reserved_36_39:4; 268 uint64_t reserved_36_39:4;
211 uint64_t obase:33; 269 uint64_t obase:33;
212 uint64_t reserved_0_2:3; 270 uint64_t reserved_0_2:3;
213 } s; 271 } cn52xx;
214 struct cvmx_mixx_oring1_s cn52xx; 272 struct cvmx_mixx_oring1_cn52xx cn52xxp1;
215 struct cvmx_mixx_oring1_s cn52xxp1; 273 struct cvmx_mixx_oring1_cn52xx cn56xx;
216 struct cvmx_mixx_oring1_s cn56xx; 274 struct cvmx_mixx_oring1_cn52xx cn56xxp1;
217 struct cvmx_mixx_oring1_s cn56xxp1; 275 struct cvmx_mixx_oring1_s cn63xx;
276 struct cvmx_mixx_oring1_s cn63xxp1;
218}; 277};
219 278
220union cvmx_mixx_oring2 { 279union cvmx_mixx_oring2 {
@@ -229,6 +288,8 @@ union cvmx_mixx_oring2 {
229 struct cvmx_mixx_oring2_s cn52xxp1; 288 struct cvmx_mixx_oring2_s cn52xxp1;
230 struct cvmx_mixx_oring2_s cn56xx; 289 struct cvmx_mixx_oring2_s cn56xx;
231 struct cvmx_mixx_oring2_s cn56xxp1; 290 struct cvmx_mixx_oring2_s cn56xxp1;
291 struct cvmx_mixx_oring2_s cn63xx;
292 struct cvmx_mixx_oring2_s cn63xxp1;
232}; 293};
233 294
234union cvmx_mixx_remcnt { 295union cvmx_mixx_remcnt {
@@ -243,6 +304,31 @@ union cvmx_mixx_remcnt {
243 struct cvmx_mixx_remcnt_s cn52xxp1; 304 struct cvmx_mixx_remcnt_s cn52xxp1;
244 struct cvmx_mixx_remcnt_s cn56xx; 305 struct cvmx_mixx_remcnt_s cn56xx;
245 struct cvmx_mixx_remcnt_s cn56xxp1; 306 struct cvmx_mixx_remcnt_s cn56xxp1;
307 struct cvmx_mixx_remcnt_s cn63xx;
308 struct cvmx_mixx_remcnt_s cn63xxp1;
309};
310
311union cvmx_mixx_tsctl {
312 uint64_t u64;
313 struct cvmx_mixx_tsctl_s {
314 uint64_t reserved_21_63:43;
315 uint64_t tsavl:5;
316 uint64_t reserved_13_15:3;
317 uint64_t tstot:5;
318 uint64_t reserved_5_7:3;
319 uint64_t tscnt:5;
320 } s;
321 struct cvmx_mixx_tsctl_s cn63xx;
322 struct cvmx_mixx_tsctl_s cn63xxp1;
323};
324
325union cvmx_mixx_tstamp {
326 uint64_t u64;
327 struct cvmx_mixx_tstamp_s {
328 uint64_t tstamp:64;
329 } s;
330 struct cvmx_mixx_tstamp_s cn63xx;
331 struct cvmx_mixx_tstamp_s cn63xxp1;
246}; 332};
247 333
248#endif 334#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-npei-defs.h b/arch/mips/include/asm/octeon/cvmx-npei-defs.h
index 4b347bb8ce80..9899a9d2ba72 100644
--- a/arch/mips/include/asm/octeon/cvmx-npei-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-npei-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,206 +28,114 @@
28#ifndef __CVMX_NPEI_DEFS_H__ 28#ifndef __CVMX_NPEI_DEFS_H__
29#define __CVMX_NPEI_DEFS_H__ 29#define __CVMX_NPEI_DEFS_H__
30 30
31#define CVMX_NPEI_BAR1_INDEXX(offset) \ 31#define CVMX_NPEI_BAR1_INDEXX(offset) (0x0000000000000000ull + ((offset) & 31) * 16)
32 (0x0000000000000000ull + (((offset) & 31) * 16)) 32#define CVMX_NPEI_BIST_STATUS (0x0000000000000580ull)
33#define CVMX_NPEI_BIST_STATUS \ 33#define CVMX_NPEI_BIST_STATUS2 (0x0000000000000680ull)
34 (0x0000000000000580ull) 34#define CVMX_NPEI_CTL_PORT0 (0x0000000000000250ull)
35#define CVMX_NPEI_BIST_STATUS2 \ 35#define CVMX_NPEI_CTL_PORT1 (0x0000000000000260ull)
36 (0x0000000000000680ull) 36#define CVMX_NPEI_CTL_STATUS (0x0000000000000570ull)
37#define CVMX_NPEI_CTL_PORT0 \ 37#define CVMX_NPEI_CTL_STATUS2 (0x0000000000003C00ull)
38 (0x0000000000000250ull) 38#define CVMX_NPEI_DATA_OUT_CNT (0x00000000000005F0ull)
39#define CVMX_NPEI_CTL_PORT1 \ 39#define CVMX_NPEI_DBG_DATA (0x0000000000000510ull)
40 (0x0000000000000260ull) 40#define CVMX_NPEI_DBG_SELECT (0x0000000000000500ull)
41#define CVMX_NPEI_CTL_STATUS \ 41#define CVMX_NPEI_DMA0_INT_LEVEL (0x00000000000005C0ull)
42 (0x0000000000000570ull) 42#define CVMX_NPEI_DMA1_INT_LEVEL (0x00000000000005D0ull)
43#define CVMX_NPEI_CTL_STATUS2 \ 43#define CVMX_NPEI_DMAX_COUNTS(offset) (0x0000000000000450ull + ((offset) & 7) * 16)
44 (0x0000000000003C00ull) 44#define CVMX_NPEI_DMAX_DBELL(offset) (0x00000000000003B0ull + ((offset) & 7) * 16)
45#define CVMX_NPEI_DATA_OUT_CNT \ 45#define CVMX_NPEI_DMAX_IBUFF_SADDR(offset) (0x0000000000000400ull + ((offset) & 7) * 16)
46 (0x00000000000005F0ull) 46#define CVMX_NPEI_DMAX_NADDR(offset) (0x00000000000004A0ull + ((offset) & 7) * 16)
47#define CVMX_NPEI_DBG_DATA \ 47#define CVMX_NPEI_DMA_CNTS (0x00000000000005E0ull)
48 (0x0000000000000510ull) 48#define CVMX_NPEI_DMA_CONTROL (0x00000000000003A0ull)
49#define CVMX_NPEI_DBG_SELECT \ 49#define CVMX_NPEI_DMA_PCIE_REQ_NUM (0x00000000000005B0ull)
50 (0x0000000000000500ull) 50#define CVMX_NPEI_DMA_STATE1 (0x00000000000006C0ull)
51#define CVMX_NPEI_DMA0_INT_LEVEL \ 51#define CVMX_NPEI_DMA_STATE1_P1 (0x0000000000000680ull)
52 (0x00000000000005C0ull) 52#define CVMX_NPEI_DMA_STATE2 (0x00000000000006D0ull)
53#define CVMX_NPEI_DMA1_INT_LEVEL \ 53#define CVMX_NPEI_DMA_STATE2_P1 (0x0000000000000690ull)
54 (0x00000000000005D0ull) 54#define CVMX_NPEI_DMA_STATE3_P1 (0x00000000000006A0ull)
55#define CVMX_NPEI_DMAX_COUNTS(offset) \ 55#define CVMX_NPEI_DMA_STATE4_P1 (0x00000000000006B0ull)
56 (0x0000000000000450ull + (((offset) & 7) * 16)) 56#define CVMX_NPEI_DMA_STATE5_P1 (0x00000000000006C0ull)
57#define CVMX_NPEI_DMAX_DBELL(offset) \ 57#define CVMX_NPEI_INT_A_ENB (0x0000000000000560ull)
58 (0x00000000000003B0ull + (((offset) & 7) * 16)) 58#define CVMX_NPEI_INT_A_ENB2 (0x0000000000003CE0ull)
59#define CVMX_NPEI_DMAX_IBUFF_SADDR(offset) \ 59#define CVMX_NPEI_INT_A_SUM (0x0000000000000550ull)
60 (0x0000000000000400ull + (((offset) & 7) * 16)) 60#define CVMX_NPEI_INT_ENB (0x0000000000000540ull)
61#define CVMX_NPEI_DMAX_NADDR(offset) \ 61#define CVMX_NPEI_INT_ENB2 (0x0000000000003CD0ull)
62 (0x00000000000004A0ull + (((offset) & 7) * 16)) 62#define CVMX_NPEI_INT_INFO (0x0000000000000590ull)
63#define CVMX_NPEI_DMA_CNTS \ 63#define CVMX_NPEI_INT_SUM (0x0000000000000530ull)
64 (0x00000000000005E0ull) 64#define CVMX_NPEI_INT_SUM2 (0x0000000000003CC0ull)
65#define CVMX_NPEI_DMA_CONTROL \ 65#define CVMX_NPEI_LAST_WIN_RDATA0 (0x0000000000000600ull)
66 (0x00000000000003A0ull) 66#define CVMX_NPEI_LAST_WIN_RDATA1 (0x0000000000000610ull)
67#define CVMX_NPEI_INT_A_ENB \ 67#define CVMX_NPEI_MEM_ACCESS_CTL (0x00000000000004F0ull)
68 (0x0000000000000560ull) 68#define CVMX_NPEI_MEM_ACCESS_SUBIDX(offset) (0x0000000000000340ull + ((offset) & 31) * 16 - 16*12)
69#define CVMX_NPEI_INT_A_ENB2 \ 69#define CVMX_NPEI_MSI_ENB0 (0x0000000000003C50ull)
70 (0x0000000000003CE0ull) 70#define CVMX_NPEI_MSI_ENB1 (0x0000000000003C60ull)
71#define CVMX_NPEI_INT_A_SUM \ 71#define CVMX_NPEI_MSI_ENB2 (0x0000000000003C70ull)
72 (0x0000000000000550ull) 72#define CVMX_NPEI_MSI_ENB3 (0x0000000000003C80ull)
73#define CVMX_NPEI_INT_ENB \ 73#define CVMX_NPEI_MSI_RCV0 (0x0000000000003C10ull)
74 (0x0000000000000540ull) 74#define CVMX_NPEI_MSI_RCV1 (0x0000000000003C20ull)
75#define CVMX_NPEI_INT_ENB2 \ 75#define CVMX_NPEI_MSI_RCV2 (0x0000000000003C30ull)
76 (0x0000000000003CD0ull) 76#define CVMX_NPEI_MSI_RCV3 (0x0000000000003C40ull)
77#define CVMX_NPEI_INT_INFO \ 77#define CVMX_NPEI_MSI_RD_MAP (0x0000000000003CA0ull)
78 (0x0000000000000590ull) 78#define CVMX_NPEI_MSI_W1C_ENB0 (0x0000000000003CF0ull)
79#define CVMX_NPEI_INT_SUM \ 79#define CVMX_NPEI_MSI_W1C_ENB1 (0x0000000000003D00ull)
80 (0x0000000000000530ull) 80#define CVMX_NPEI_MSI_W1C_ENB2 (0x0000000000003D10ull)
81#define CVMX_NPEI_INT_SUM2 \ 81#define CVMX_NPEI_MSI_W1C_ENB3 (0x0000000000003D20ull)
82 (0x0000000000003CC0ull) 82#define CVMX_NPEI_MSI_W1S_ENB0 (0x0000000000003D30ull)
83#define CVMX_NPEI_LAST_WIN_RDATA0 \ 83#define CVMX_NPEI_MSI_W1S_ENB1 (0x0000000000003D40ull)
84 (0x0000000000000600ull) 84#define CVMX_NPEI_MSI_W1S_ENB2 (0x0000000000003D50ull)
85#define CVMX_NPEI_LAST_WIN_RDATA1 \ 85#define CVMX_NPEI_MSI_W1S_ENB3 (0x0000000000003D60ull)
86 (0x0000000000000610ull) 86#define CVMX_NPEI_MSI_WR_MAP (0x0000000000003C90ull)
87#define CVMX_NPEI_MEM_ACCESS_CTL \ 87#define CVMX_NPEI_PCIE_CREDIT_CNT (0x0000000000003D70ull)
88 (0x00000000000004F0ull) 88#define CVMX_NPEI_PCIE_MSI_RCV (0x0000000000003CB0ull)
89#define CVMX_NPEI_MEM_ACCESS_SUBIDX(offset) \ 89#define CVMX_NPEI_PCIE_MSI_RCV_B1 (0x0000000000000650ull)
90 (0x0000000000000340ull + (((offset) & 31) * 16) - 16 * 12) 90#define CVMX_NPEI_PCIE_MSI_RCV_B2 (0x0000000000000660ull)
91#define CVMX_NPEI_MSI_ENB0 \ 91#define CVMX_NPEI_PCIE_MSI_RCV_B3 (0x0000000000000670ull)
92 (0x0000000000003C50ull) 92#define CVMX_NPEI_PKTX_CNTS(offset) (0x0000000000002400ull + ((offset) & 31) * 16)
93#define CVMX_NPEI_MSI_ENB1 \ 93#define CVMX_NPEI_PKTX_INSTR_BADDR(offset) (0x0000000000002800ull + ((offset) & 31) * 16)
94 (0x0000000000003C60ull) 94#define CVMX_NPEI_PKTX_INSTR_BAOFF_DBELL(offset) (0x0000000000002C00ull + ((offset) & 31) * 16)
95#define CVMX_NPEI_MSI_ENB2 \ 95#define CVMX_NPEI_PKTX_INSTR_FIFO_RSIZE(offset) (0x0000000000003000ull + ((offset) & 31) * 16)
96 (0x0000000000003C70ull) 96#define CVMX_NPEI_PKTX_INSTR_HEADER(offset) (0x0000000000003400ull + ((offset) & 31) * 16)
97#define CVMX_NPEI_MSI_ENB3 \ 97#define CVMX_NPEI_PKTX_IN_BP(offset) (0x0000000000003800ull + ((offset) & 31) * 16)
98 (0x0000000000003C80ull) 98#define CVMX_NPEI_PKTX_SLIST_BADDR(offset) (0x0000000000001400ull + ((offset) & 31) * 16)
99#define CVMX_NPEI_MSI_RCV0 \ 99#define CVMX_NPEI_PKTX_SLIST_BAOFF_DBELL(offset) (0x0000000000001800ull + ((offset) & 31) * 16)
100 (0x0000000000003C10ull) 100#define CVMX_NPEI_PKTX_SLIST_FIFO_RSIZE(offset) (0x0000000000001C00ull + ((offset) & 31) * 16)
101#define CVMX_NPEI_MSI_RCV1 \ 101#define CVMX_NPEI_PKT_CNT_INT (0x0000000000001110ull)
102 (0x0000000000003C20ull) 102#define CVMX_NPEI_PKT_CNT_INT_ENB (0x0000000000001130ull)
103#define CVMX_NPEI_MSI_RCV2 \ 103#define CVMX_NPEI_PKT_DATA_OUT_ES (0x00000000000010B0ull)
104 (0x0000000000003C30ull) 104#define CVMX_NPEI_PKT_DATA_OUT_NS (0x00000000000010A0ull)
105#define CVMX_NPEI_MSI_RCV3 \ 105#define CVMX_NPEI_PKT_DATA_OUT_ROR (0x0000000000001090ull)
106 (0x0000000000003C40ull) 106#define CVMX_NPEI_PKT_DPADDR (0x0000000000001080ull)
107#define CVMX_NPEI_MSI_RD_MAP \ 107#define CVMX_NPEI_PKT_INPUT_CONTROL (0x0000000000001150ull)
108 (0x0000000000003CA0ull) 108#define CVMX_NPEI_PKT_INSTR_ENB (0x0000000000001000ull)
109#define CVMX_NPEI_MSI_W1C_ENB0 \ 109#define CVMX_NPEI_PKT_INSTR_RD_SIZE (0x0000000000001190ull)
110 (0x0000000000003CF0ull) 110#define CVMX_NPEI_PKT_INSTR_SIZE (0x0000000000001020ull)
111#define CVMX_NPEI_MSI_W1C_ENB1 \ 111#define CVMX_NPEI_PKT_INT_LEVELS (0x0000000000001100ull)
112 (0x0000000000003D00ull) 112#define CVMX_NPEI_PKT_IN_BP (0x00000000000006B0ull)
113#define CVMX_NPEI_MSI_W1C_ENB2 \ 113#define CVMX_NPEI_PKT_IN_DONEX_CNTS(offset) (0x0000000000002000ull + ((offset) & 31) * 16)
114 (0x0000000000003D10ull) 114#define CVMX_NPEI_PKT_IN_INSTR_COUNTS (0x00000000000006A0ull)
115#define CVMX_NPEI_MSI_W1C_ENB3 \ 115#define CVMX_NPEI_PKT_IN_PCIE_PORT (0x00000000000011A0ull)
116 (0x0000000000003D20ull) 116#define CVMX_NPEI_PKT_IPTR (0x0000000000001070ull)
117#define CVMX_NPEI_MSI_W1S_ENB0 \ 117#define CVMX_NPEI_PKT_OUTPUT_WMARK (0x0000000000001160ull)
118 (0x0000000000003D30ull) 118#define CVMX_NPEI_PKT_OUT_BMODE (0x00000000000010D0ull)
119#define CVMX_NPEI_MSI_W1S_ENB1 \ 119#define CVMX_NPEI_PKT_OUT_ENB (0x0000000000001010ull)
120 (0x0000000000003D40ull) 120#define CVMX_NPEI_PKT_PCIE_PORT (0x00000000000010E0ull)
121#define CVMX_NPEI_MSI_W1S_ENB2 \ 121#define CVMX_NPEI_PKT_PORT_IN_RST (0x0000000000000690ull)
122 (0x0000000000003D50ull) 122#define CVMX_NPEI_PKT_SLIST_ES (0x0000000000001050ull)
123#define CVMX_NPEI_MSI_W1S_ENB3 \ 123#define CVMX_NPEI_PKT_SLIST_ID_SIZE (0x0000000000001180ull)
124 (0x0000000000003D60ull) 124#define CVMX_NPEI_PKT_SLIST_NS (0x0000000000001040ull)
125#define CVMX_NPEI_MSI_WR_MAP \ 125#define CVMX_NPEI_PKT_SLIST_ROR (0x0000000000001030ull)
126 (0x0000000000003C90ull) 126#define CVMX_NPEI_PKT_TIME_INT (0x0000000000001120ull)
127#define CVMX_NPEI_PCIE_CREDIT_CNT \ 127#define CVMX_NPEI_PKT_TIME_INT_ENB (0x0000000000001140ull)
128 (0x0000000000003D70ull) 128#define CVMX_NPEI_RSL_INT_BLOCKS (0x0000000000000520ull)
129#define CVMX_NPEI_PCIE_MSI_RCV \ 129#define CVMX_NPEI_SCRATCH_1 (0x0000000000000270ull)
130 (0x0000000000003CB0ull) 130#define CVMX_NPEI_STATE1 (0x0000000000000620ull)
131#define CVMX_NPEI_PCIE_MSI_RCV_B1 \ 131#define CVMX_NPEI_STATE2 (0x0000000000000630ull)
132 (0x0000000000000650ull) 132#define CVMX_NPEI_STATE3 (0x0000000000000640ull)
133#define CVMX_NPEI_PCIE_MSI_RCV_B2 \ 133#define CVMX_NPEI_WINDOW_CTL (0x0000000000000380ull)
134 (0x0000000000000660ull) 134#define CVMX_NPEI_WIN_RD_ADDR (0x0000000000000210ull)
135#define CVMX_NPEI_PCIE_MSI_RCV_B3 \ 135#define CVMX_NPEI_WIN_RD_DATA (0x0000000000000240ull)
136 (0x0000000000000670ull) 136#define CVMX_NPEI_WIN_WR_ADDR (0x0000000000000200ull)
137#define CVMX_NPEI_PKTX_CNTS(offset) \ 137#define CVMX_NPEI_WIN_WR_DATA (0x0000000000000220ull)
138 (0x0000000000002400ull + (((offset) & 31) * 16)) 138#define CVMX_NPEI_WIN_WR_MASK (0x0000000000000230ull)
139#define CVMX_NPEI_PKTX_INSTR_BADDR(offset) \
140 (0x0000000000002800ull + (((offset) & 31) * 16))
141#define CVMX_NPEI_PKTX_INSTR_BAOFF_DBELL(offset) \
142 (0x0000000000002C00ull + (((offset) & 31) * 16))
143#define CVMX_NPEI_PKTX_INSTR_FIFO_RSIZE(offset) \
144 (0x0000000000003000ull + (((offset) & 31) * 16))
145#define CVMX_NPEI_PKTX_INSTR_HEADER(offset) \
146 (0x0000000000003400ull + (((offset) & 31) * 16))
147#define CVMX_NPEI_PKTX_IN_BP(offset) \
148 (0x0000000000003800ull + (((offset) & 31) * 16))
149#define CVMX_NPEI_PKTX_SLIST_BADDR(offset) \
150 (0x0000000000001400ull + (((offset) & 31) * 16))
151#define CVMX_NPEI_PKTX_SLIST_BAOFF_DBELL(offset) \
152 (0x0000000000001800ull + (((offset) & 31) * 16))
153#define CVMX_NPEI_PKTX_SLIST_FIFO_RSIZE(offset) \
154 (0x0000000000001C00ull + (((offset) & 31) * 16))
155#define CVMX_NPEI_PKT_CNT_INT \
156 (0x0000000000001110ull)
157#define CVMX_NPEI_PKT_CNT_INT_ENB \
158 (0x0000000000001130ull)
159#define CVMX_NPEI_PKT_DATA_OUT_ES \
160 (0x00000000000010B0ull)
161#define CVMX_NPEI_PKT_DATA_OUT_NS \
162 (0x00000000000010A0ull)
163#define CVMX_NPEI_PKT_DATA_OUT_ROR \
164 (0x0000000000001090ull)
165#define CVMX_NPEI_PKT_DPADDR \
166 (0x0000000000001080ull)
167#define CVMX_NPEI_PKT_INPUT_CONTROL \
168 (0x0000000000001150ull)
169#define CVMX_NPEI_PKT_INSTR_ENB \
170 (0x0000000000001000ull)
171#define CVMX_NPEI_PKT_INSTR_RD_SIZE \
172 (0x0000000000001190ull)
173#define CVMX_NPEI_PKT_INSTR_SIZE \
174 (0x0000000000001020ull)
175#define CVMX_NPEI_PKT_INT_LEVELS \
176 (0x0000000000001100ull)
177#define CVMX_NPEI_PKT_IN_BP \
178 (0x00000000000006B0ull)
179#define CVMX_NPEI_PKT_IN_DONEX_CNTS(offset) \
180 (0x0000000000002000ull + (((offset) & 31) * 16))
181#define CVMX_NPEI_PKT_IN_INSTR_COUNTS \
182 (0x00000000000006A0ull)
183#define CVMX_NPEI_PKT_IN_PCIE_PORT \
184 (0x00000000000011A0ull)
185#define CVMX_NPEI_PKT_IPTR \
186 (0x0000000000001070ull)
187#define CVMX_NPEI_PKT_OUTPUT_WMARK \
188 (0x0000000000001160ull)
189#define CVMX_NPEI_PKT_OUT_BMODE \
190 (0x00000000000010D0ull)
191#define CVMX_NPEI_PKT_OUT_ENB \
192 (0x0000000000001010ull)
193#define CVMX_NPEI_PKT_PCIE_PORT \
194 (0x00000000000010E0ull)
195#define CVMX_NPEI_PKT_PORT_IN_RST \
196 (0x0000000000000690ull)
197#define CVMX_NPEI_PKT_SLIST_ES \
198 (0x0000000000001050ull)
199#define CVMX_NPEI_PKT_SLIST_ID_SIZE \
200 (0x0000000000001180ull)
201#define CVMX_NPEI_PKT_SLIST_NS \
202 (0x0000000000001040ull)
203#define CVMX_NPEI_PKT_SLIST_ROR \
204 (0x0000000000001030ull)
205#define CVMX_NPEI_PKT_TIME_INT \
206 (0x0000000000001120ull)
207#define CVMX_NPEI_PKT_TIME_INT_ENB \
208 (0x0000000000001140ull)
209#define CVMX_NPEI_RSL_INT_BLOCKS \
210 (0x0000000000000520ull)
211#define CVMX_NPEI_SCRATCH_1 \
212 (0x0000000000000270ull)
213#define CVMX_NPEI_STATE1 \
214 (0x0000000000000620ull)
215#define CVMX_NPEI_STATE2 \
216 (0x0000000000000630ull)
217#define CVMX_NPEI_STATE3 \
218 (0x0000000000000640ull)
219#define CVMX_NPEI_WINDOW_CTL \
220 (0x0000000000000380ull)
221#define CVMX_NPEI_WIN_RD_ADDR \
222 (0x0000000000000210ull)
223#define CVMX_NPEI_WIN_RD_DATA \
224 (0x0000000000000240ull)
225#define CVMX_NPEI_WIN_WR_ADDR \
226 (0x0000000000000200ull)
227#define CVMX_NPEI_WIN_WR_DATA \
228 (0x0000000000000220ull)
229#define CVMX_NPEI_WIN_WR_MASK \
230 (0x0000000000000230ull)
231 139
232union cvmx_npei_bar1_indexx { 140union cvmx_npei_bar1_indexx {
233 uint32_t u32; 141 uint32_t u32;
@@ -248,9 +156,7 @@ union cvmx_npei_bist_status {
248 uint64_t u64; 156 uint64_t u64;
249 struct cvmx_npei_bist_status_s { 157 struct cvmx_npei_bist_status_s {
250 uint64_t pkt_rdf:1; 158 uint64_t pkt_rdf:1;
251 uint64_t pkt_pmem:1; 159 uint64_t reserved_60_62:3;
252 uint64_t pkt_p1:1;
253 uint64_t reserved_60_60:1;
254 uint64_t pcr_gim:1; 160 uint64_t pcr_gim:1;
255 uint64_t pkt_pif:1; 161 uint64_t pkt_pif:1;
256 uint64_t pcsr_int:1; 162 uint64_t pcsr_int:1;
@@ -301,9 +207,7 @@ union cvmx_npei_bist_status {
301 } s; 207 } s;
302 struct cvmx_npei_bist_status_cn52xx { 208 struct cvmx_npei_bist_status_cn52xx {
303 uint64_t pkt_rdf:1; 209 uint64_t pkt_rdf:1;
304 uint64_t pkt_pmem:1; 210 uint64_t reserved_60_62:3;
305 uint64_t pkt_p1:1;
306 uint64_t reserved_60_60:1;
307 uint64_t pcr_gim:1; 211 uint64_t pcr_gim:1;
308 uint64_t pkt_pif:1; 212 uint64_t pkt_pif:1;
309 uint64_t pcsr_int:1; 213 uint64_t pcsr_int:1;
@@ -410,66 +314,7 @@ union cvmx_npei_bist_status {
410 uint64_t msi:1; 314 uint64_t msi:1;
411 uint64_t ncb_cmd:1; 315 uint64_t ncb_cmd:1;
412 } cn52xxp1; 316 } cn52xxp1;
413 struct cvmx_npei_bist_status_cn56xx { 317 struct cvmx_npei_bist_status_cn52xx cn56xx;
414 uint64_t pkt_rdf:1;
415 uint64_t reserved_60_62:3;
416 uint64_t pcr_gim:1;
417 uint64_t pkt_pif:1;
418 uint64_t pcsr_int:1;
419 uint64_t pcsr_im:1;
420 uint64_t pcsr_cnt:1;
421 uint64_t pcsr_id:1;
422 uint64_t pcsr_sl:1;
423 uint64_t pkt_imem:1;
424 uint64_t pkt_pfm:1;
425 uint64_t pkt_pof:1;
426 uint64_t reserved_48_49:2;
427 uint64_t pkt_pop0:1;
428 uint64_t pkt_pop1:1;
429 uint64_t d0_mem:1;
430 uint64_t d1_mem:1;
431 uint64_t d2_mem:1;
432 uint64_t d3_mem:1;
433 uint64_t d4_mem:1;
434 uint64_t ds_mem:1;
435 uint64_t reserved_36_39:4;
436 uint64_t d0_pst:1;
437 uint64_t d1_pst:1;
438 uint64_t d2_pst:1;
439 uint64_t d3_pst:1;
440 uint64_t d4_pst:1;
441 uint64_t n2p0_c:1;
442 uint64_t n2p0_o:1;
443 uint64_t n2p1_c:1;
444 uint64_t n2p1_o:1;
445 uint64_t cpl_p0:1;
446 uint64_t cpl_p1:1;
447 uint64_t p2n1_po:1;
448 uint64_t p2n1_no:1;
449 uint64_t p2n1_co:1;
450 uint64_t p2n0_po:1;
451 uint64_t p2n0_no:1;
452 uint64_t p2n0_co:1;
453 uint64_t p2n0_c0:1;
454 uint64_t p2n0_c1:1;
455 uint64_t p2n0_n:1;
456 uint64_t p2n0_p0:1;
457 uint64_t p2n0_p1:1;
458 uint64_t p2n1_c0:1;
459 uint64_t p2n1_c1:1;
460 uint64_t p2n1_n:1;
461 uint64_t p2n1_p0:1;
462 uint64_t p2n1_p1:1;
463 uint64_t csm0:1;
464 uint64_t csm1:1;
465 uint64_t dif0:1;
466 uint64_t dif1:1;
467 uint64_t dif2:1;
468 uint64_t dif3:1;
469 uint64_t dif4:1;
470 uint64_t msi:1;
471 uint64_t ncb_cmd:1;
472 } cn56xx;
473 struct cvmx_npei_bist_status_cn56xxp1 { 318 struct cvmx_npei_bist_status_cn56xxp1 {
474 uint64_t reserved_58_63:6; 319 uint64_t reserved_58_63:6;
475 uint64_t pcsr_int:1; 320 uint64_t pcsr_int:1;
@@ -536,7 +381,16 @@ union cvmx_npei_bist_status {
536union cvmx_npei_bist_status2 { 381union cvmx_npei_bist_status2 {
537 uint64_t u64; 382 uint64_t u64;
538 struct cvmx_npei_bist_status2_s { 383 struct cvmx_npei_bist_status2_s {
539 uint64_t reserved_5_63:59; 384 uint64_t reserved_14_63:50;
385 uint64_t prd_tag:1;
386 uint64_t prd_st0:1;
387 uint64_t prd_st1:1;
388 uint64_t prd_err:1;
389 uint64_t nrd_st:1;
390 uint64_t nwe_st:1;
391 uint64_t nwe_wr0:1;
392 uint64_t nwe_wr1:1;
393 uint64_t pkt_rd:1;
540 uint64_t psc_p0:1; 394 uint64_t psc_p0:1;
541 uint64_t psc_p1:1; 395 uint64_t psc_p1:1;
542 uint64_t pkt_gd:1; 396 uint64_t pkt_gd:1;
@@ -630,8 +484,7 @@ union cvmx_npei_ctl_status {
630 } cn52xxp1; 484 } cn52xxp1;
631 struct cvmx_npei_ctl_status_s cn56xx; 485 struct cvmx_npei_ctl_status_s cn56xx;
632 struct cvmx_npei_ctl_status_cn56xxp1 { 486 struct cvmx_npei_ctl_status_cn56xxp1 {
633 uint64_t reserved_16_63:48; 487 uint64_t reserved_15_63:49;
634 uint64_t ring_en:1;
635 uint64_t lnk_rst:1; 488 uint64_t lnk_rst:1;
636 uint64_t arb:1; 489 uint64_t arb:1;
637 uint64_t pkt_bp:4; 490 uint64_t pkt_bp:4;
@@ -756,14 +609,14 @@ union cvmx_npei_dmax_ibuff_saddr {
756 uint64_t saddr:29; 609 uint64_t saddr:29;
757 uint64_t reserved_0_6:7; 610 uint64_t reserved_0_6:7;
758 } s; 611 } s;
759 struct cvmx_npei_dmax_ibuff_saddr_cn52xx { 612 struct cvmx_npei_dmax_ibuff_saddr_s cn52xx;
613 struct cvmx_npei_dmax_ibuff_saddr_cn52xxp1 {
760 uint64_t reserved_36_63:28; 614 uint64_t reserved_36_63:28;
761 uint64_t saddr:29; 615 uint64_t saddr:29;
762 uint64_t reserved_0_6:7; 616 uint64_t reserved_0_6:7;
763 } cn52xx; 617 } cn52xxp1;
764 struct cvmx_npei_dmax_ibuff_saddr_cn52xx cn52xxp1;
765 struct cvmx_npei_dmax_ibuff_saddr_s cn56xx; 618 struct cvmx_npei_dmax_ibuff_saddr_s cn56xx;
766 struct cvmx_npei_dmax_ibuff_saddr_cn52xx cn56xxp1; 619 struct cvmx_npei_dmax_ibuff_saddr_cn52xxp1 cn56xxp1;
767}; 620};
768 621
769union cvmx_npei_dmax_naddr { 622union cvmx_npei_dmax_naddr {
@@ -817,7 +670,8 @@ union cvmx_npei_dma_cnts {
817union cvmx_npei_dma_control { 670union cvmx_npei_dma_control {
818 uint64_t u64; 671 uint64_t u64;
819 struct cvmx_npei_dma_control_s { 672 struct cvmx_npei_dma_control_s {
820 uint64_t reserved_39_63:25; 673 uint64_t reserved_40_63:24;
674 uint64_t p_32b_m:1;
821 uint64_t dma4_enb:1; 675 uint64_t dma4_enb:1;
822 uint64_t dma3_enb:1; 676 uint64_t dma3_enb:1;
823 uint64_t dma2_enb:1; 677 uint64_t dma2_enb:1;
@@ -853,7 +707,161 @@ union cvmx_npei_dma_control {
853 uint64_t csize:14; 707 uint64_t csize:14;
854 } cn52xxp1; 708 } cn52xxp1;
855 struct cvmx_npei_dma_control_s cn56xx; 709 struct cvmx_npei_dma_control_s cn56xx;
856 struct cvmx_npei_dma_control_s cn56xxp1; 710 struct cvmx_npei_dma_control_cn56xxp1 {
711 uint64_t reserved_39_63:25;
712 uint64_t dma4_enb:1;
713 uint64_t dma3_enb:1;
714 uint64_t dma2_enb:1;
715 uint64_t dma1_enb:1;
716 uint64_t dma0_enb:1;
717 uint64_t b0_lend:1;
718 uint64_t dwb_denb:1;
719 uint64_t dwb_ichk:9;
720 uint64_t fpa_que:3;
721 uint64_t o_add1:1;
722 uint64_t o_ro:1;
723 uint64_t o_ns:1;
724 uint64_t o_es:2;
725 uint64_t o_mode:1;
726 uint64_t csize:14;
727 } cn56xxp1;
728};
729
730union cvmx_npei_dma_pcie_req_num {
731 uint64_t u64;
732 struct cvmx_npei_dma_pcie_req_num_s {
733 uint64_t dma_arb:1;
734 uint64_t reserved_53_62:10;
735 uint64_t pkt_cnt:5;
736 uint64_t reserved_45_47:3;
737 uint64_t dma4_cnt:5;
738 uint64_t reserved_37_39:3;
739 uint64_t dma3_cnt:5;
740 uint64_t reserved_29_31:3;
741 uint64_t dma2_cnt:5;
742 uint64_t reserved_21_23:3;
743 uint64_t dma1_cnt:5;
744 uint64_t reserved_13_15:3;
745 uint64_t dma0_cnt:5;
746 uint64_t reserved_5_7:3;
747 uint64_t dma_cnt:5;
748 } s;
749 struct cvmx_npei_dma_pcie_req_num_s cn52xx;
750 struct cvmx_npei_dma_pcie_req_num_s cn56xx;
751};
752
753union cvmx_npei_dma_state1 {
754 uint64_t u64;
755 struct cvmx_npei_dma_state1_s {
756 uint64_t reserved_40_63:24;
757 uint64_t d4_dwe:8;
758 uint64_t d3_dwe:8;
759 uint64_t d2_dwe:8;
760 uint64_t d1_dwe:8;
761 uint64_t d0_dwe:8;
762 } s;
763 struct cvmx_npei_dma_state1_s cn52xx;
764};
765
766union cvmx_npei_dma_state1_p1 {
767 uint64_t u64;
768 struct cvmx_npei_dma_state1_p1_s {
769 uint64_t reserved_60_63:4;
770 uint64_t d0_difst:7;
771 uint64_t d1_difst:7;
772 uint64_t d2_difst:7;
773 uint64_t d3_difst:7;
774 uint64_t d4_difst:7;
775 uint64_t d0_reqst:5;
776 uint64_t d1_reqst:5;
777 uint64_t d2_reqst:5;
778 uint64_t d3_reqst:5;
779 uint64_t d4_reqst:5;
780 } s;
781 struct cvmx_npei_dma_state1_p1_cn52xxp1 {
782 uint64_t reserved_60_63:4;
783 uint64_t d0_difst:7;
784 uint64_t d1_difst:7;
785 uint64_t d2_difst:7;
786 uint64_t d3_difst:7;
787 uint64_t reserved_25_31:7;
788 uint64_t d0_reqst:5;
789 uint64_t d1_reqst:5;
790 uint64_t d2_reqst:5;
791 uint64_t d3_reqst:5;
792 uint64_t reserved_0_4:5;
793 } cn52xxp1;
794 struct cvmx_npei_dma_state1_p1_s cn56xxp1;
795};
796
797union cvmx_npei_dma_state2 {
798 uint64_t u64;
799 struct cvmx_npei_dma_state2_s {
800 uint64_t reserved_28_63:36;
801 uint64_t ndwe:4;
802 uint64_t reserved_21_23:3;
803 uint64_t ndre:5;
804 uint64_t reserved_10_15:6;
805 uint64_t prd:10;
806 } s;
807 struct cvmx_npei_dma_state2_s cn52xx;
808};
809
810union cvmx_npei_dma_state2_p1 {
811 uint64_t u64;
812 struct cvmx_npei_dma_state2_p1_s {
813 uint64_t reserved_45_63:19;
814 uint64_t d0_dffst:9;
815 uint64_t d1_dffst:9;
816 uint64_t d2_dffst:9;
817 uint64_t d3_dffst:9;
818 uint64_t d4_dffst:9;
819 } s;
820 struct cvmx_npei_dma_state2_p1_cn52xxp1 {
821 uint64_t reserved_45_63:19;
822 uint64_t d0_dffst:9;
823 uint64_t d1_dffst:9;
824 uint64_t d2_dffst:9;
825 uint64_t d3_dffst:9;
826 uint64_t reserved_0_8:9;
827 } cn52xxp1;
828 struct cvmx_npei_dma_state2_p1_s cn56xxp1;
829};
830
831union cvmx_npei_dma_state3_p1 {
832 uint64_t u64;
833 struct cvmx_npei_dma_state3_p1_s {
834 uint64_t reserved_60_63:4;
835 uint64_t d0_drest:15;
836 uint64_t d1_drest:15;
837 uint64_t d2_drest:15;
838 uint64_t d3_drest:15;
839 } s;
840 struct cvmx_npei_dma_state3_p1_s cn52xxp1;
841 struct cvmx_npei_dma_state3_p1_s cn56xxp1;
842};
843
844union cvmx_npei_dma_state4_p1 {
845 uint64_t u64;
846 struct cvmx_npei_dma_state4_p1_s {
847 uint64_t reserved_52_63:12;
848 uint64_t d0_dwest:13;
849 uint64_t d1_dwest:13;
850 uint64_t d2_dwest:13;
851 uint64_t d3_dwest:13;
852 } s;
853 struct cvmx_npei_dma_state4_p1_s cn52xxp1;
854 struct cvmx_npei_dma_state4_p1_s cn56xxp1;
855};
856
857union cvmx_npei_dma_state5_p1 {
858 uint64_t u64;
859 struct cvmx_npei_dma_state5_p1_s {
860 uint64_t reserved_28_63:36;
861 uint64_t d4_drest:15;
862 uint64_t d4_dwest:13;
863 } s;
864 struct cvmx_npei_dma_state5_p1_s cn56xxp1;
857}; 865};
858 866
859union cvmx_npei_int_a_enb { 867union cvmx_npei_int_a_enb {
@@ -871,17 +879,7 @@ union cvmx_npei_int_a_enb {
871 uint64_t dma1_cpl:1; 879 uint64_t dma1_cpl:1;
872 uint64_t dma0_cpl:1; 880 uint64_t dma0_cpl:1;
873 } s; 881 } s;
874 struct cvmx_npei_int_a_enb_cn52xx { 882 struct cvmx_npei_int_a_enb_s cn52xx;
875 uint64_t reserved_8_63:56;
876 uint64_t p1_rdlk:1;
877 uint64_t p0_rdlk:1;
878 uint64_t pgl_err:1;
879 uint64_t pdi_err:1;
880 uint64_t pop_err:1;
881 uint64_t pins_err:1;
882 uint64_t dma1_cpl:1;
883 uint64_t dma0_cpl:1;
884 } cn52xx;
885 struct cvmx_npei_int_a_enb_cn52xxp1 { 883 struct cvmx_npei_int_a_enb_cn52xxp1 {
886 uint64_t reserved_2_63:62; 884 uint64_t reserved_2_63:62;
887 uint64_t dma1_cpl:1; 885 uint64_t dma1_cpl:1;
@@ -905,16 +903,7 @@ union cvmx_npei_int_a_enb2 {
905 uint64_t dma1_cpl:1; 903 uint64_t dma1_cpl:1;
906 uint64_t dma0_cpl:1; 904 uint64_t dma0_cpl:1;
907 } s; 905 } s;
908 struct cvmx_npei_int_a_enb2_cn52xx { 906 struct cvmx_npei_int_a_enb2_s cn52xx;
909 uint64_t reserved_8_63:56;
910 uint64_t p1_rdlk:1;
911 uint64_t p0_rdlk:1;
912 uint64_t pgl_err:1;
913 uint64_t pdi_err:1;
914 uint64_t pop_err:1;
915 uint64_t pins_err:1;
916 uint64_t reserved_0_1:2;
917 } cn52xx;
918 struct cvmx_npei_int_a_enb2_cn52xxp1 { 907 struct cvmx_npei_int_a_enb2_cn52xxp1 {
919 uint64_t reserved_2_63:62; 908 uint64_t reserved_2_63:62;
920 uint64_t dma1_cpl:1; 909 uint64_t dma1_cpl:1;
@@ -938,17 +927,7 @@ union cvmx_npei_int_a_sum {
938 uint64_t dma1_cpl:1; 927 uint64_t dma1_cpl:1;
939 uint64_t dma0_cpl:1; 928 uint64_t dma0_cpl:1;
940 } s; 929 } s;
941 struct cvmx_npei_int_a_sum_cn52xx { 930 struct cvmx_npei_int_a_sum_s cn52xx;
942 uint64_t reserved_8_63:56;
943 uint64_t p1_rdlk:1;
944 uint64_t p0_rdlk:1;
945 uint64_t pgl_err:1;
946 uint64_t pdi_err:1;
947 uint64_t pop_err:1;
948 uint64_t pins_err:1;
949 uint64_t dma1_cpl:1;
950 uint64_t dma0_cpl:1;
951 } cn52xx;
952 struct cvmx_npei_int_a_sum_cn52xxp1 { 931 struct cvmx_npei_int_a_sum_cn52xxp1 {
953 uint64_t reserved_2_63:62; 932 uint64_t reserved_2_63:62;
954 uint64_t dma1_cpl:1; 933 uint64_t dma1_cpl:1;
@@ -1550,10 +1529,7 @@ union cvmx_npei_int_sum {
1550 uint64_t c0_se:1; 1529 uint64_t c0_se:1;
1551 uint64_t reserved_20_20:1; 1530 uint64_t reserved_20_20:1;
1552 uint64_t c0_aeri:1; 1531 uint64_t c0_aeri:1;
1553 uint64_t ptime:1; 1532 uint64_t reserved_15_18:4;
1554 uint64_t pcnt:1;
1555 uint64_t pidbof:1;
1556 uint64_t psldbof:1;
1557 uint64_t dtime1:1; 1533 uint64_t dtime1:1;
1558 uint64_t dtime0:1; 1534 uint64_t dtime0:1;
1559 uint64_t dcnt1:1; 1535 uint64_t dcnt1:1;
@@ -1959,7 +1935,6 @@ union cvmx_npei_pktx_cnts {
1959 } s; 1935 } s;
1960 struct cvmx_npei_pktx_cnts_s cn52xx; 1936 struct cvmx_npei_pktx_cnts_s cn52xx;
1961 struct cvmx_npei_pktx_cnts_s cn56xx; 1937 struct cvmx_npei_pktx_cnts_s cn56xx;
1962 struct cvmx_npei_pktx_cnts_s cn56xxp1;
1963}; 1938};
1964 1939
1965union cvmx_npei_pktx_in_bp { 1940union cvmx_npei_pktx_in_bp {
@@ -1970,7 +1945,6 @@ union cvmx_npei_pktx_in_bp {
1970 } s; 1945 } s;
1971 struct cvmx_npei_pktx_in_bp_s cn52xx; 1946 struct cvmx_npei_pktx_in_bp_s cn52xx;
1972 struct cvmx_npei_pktx_in_bp_s cn56xx; 1947 struct cvmx_npei_pktx_in_bp_s cn56xx;
1973 struct cvmx_npei_pktx_in_bp_s cn56xxp1;
1974}; 1948};
1975 1949
1976union cvmx_npei_pktx_instr_baddr { 1950union cvmx_npei_pktx_instr_baddr {
@@ -1981,7 +1955,6 @@ union cvmx_npei_pktx_instr_baddr {
1981 } s; 1955 } s;
1982 struct cvmx_npei_pktx_instr_baddr_s cn52xx; 1956 struct cvmx_npei_pktx_instr_baddr_s cn52xx;
1983 struct cvmx_npei_pktx_instr_baddr_s cn56xx; 1957 struct cvmx_npei_pktx_instr_baddr_s cn56xx;
1984 struct cvmx_npei_pktx_instr_baddr_s cn56xxp1;
1985}; 1958};
1986 1959
1987union cvmx_npei_pktx_instr_baoff_dbell { 1960union cvmx_npei_pktx_instr_baoff_dbell {
@@ -1992,7 +1965,6 @@ union cvmx_npei_pktx_instr_baoff_dbell {
1992 } s; 1965 } s;
1993 struct cvmx_npei_pktx_instr_baoff_dbell_s cn52xx; 1966 struct cvmx_npei_pktx_instr_baoff_dbell_s cn52xx;
1994 struct cvmx_npei_pktx_instr_baoff_dbell_s cn56xx; 1967 struct cvmx_npei_pktx_instr_baoff_dbell_s cn56xx;
1995 struct cvmx_npei_pktx_instr_baoff_dbell_s cn56xxp1;
1996}; 1968};
1997 1969
1998union cvmx_npei_pktx_instr_fifo_rsize { 1970union cvmx_npei_pktx_instr_fifo_rsize {
@@ -2006,7 +1978,6 @@ union cvmx_npei_pktx_instr_fifo_rsize {
2006 } s; 1978 } s;
2007 struct cvmx_npei_pktx_instr_fifo_rsize_s cn52xx; 1979 struct cvmx_npei_pktx_instr_fifo_rsize_s cn52xx;
2008 struct cvmx_npei_pktx_instr_fifo_rsize_s cn56xx; 1980 struct cvmx_npei_pktx_instr_fifo_rsize_s cn56xx;
2009 struct cvmx_npei_pktx_instr_fifo_rsize_s cn56xxp1;
2010}; 1981};
2011 1982
2012union cvmx_npei_pktx_instr_header { 1983union cvmx_npei_pktx_instr_header {
@@ -2014,21 +1985,20 @@ union cvmx_npei_pktx_instr_header {
2014 struct cvmx_npei_pktx_instr_header_s { 1985 struct cvmx_npei_pktx_instr_header_s {
2015 uint64_t reserved_44_63:20; 1986 uint64_t reserved_44_63:20;
2016 uint64_t pbp:1; 1987 uint64_t pbp:1;
2017 uint64_t rsv_f:5; 1988 uint64_t reserved_38_42:5;
2018 uint64_t rparmode:2; 1989 uint64_t rparmode:2;
2019 uint64_t rsv_e:1; 1990 uint64_t reserved_35_35:1;
2020 uint64_t rskp_len:7; 1991 uint64_t rskp_len:7;
2021 uint64_t rsv_d:6; 1992 uint64_t reserved_22_27:6;
2022 uint64_t use_ihdr:1; 1993 uint64_t use_ihdr:1;
2023 uint64_t rsv_c:5; 1994 uint64_t reserved_16_20:5;
2024 uint64_t par_mode:2; 1995 uint64_t par_mode:2;
2025 uint64_t rsv_b:1; 1996 uint64_t reserved_13_13:1;
2026 uint64_t skp_len:7; 1997 uint64_t skp_len:7;
2027 uint64_t rsv_a:6; 1998 uint64_t reserved_0_5:6;
2028 } s; 1999 } s;
2029 struct cvmx_npei_pktx_instr_header_s cn52xx; 2000 struct cvmx_npei_pktx_instr_header_s cn52xx;
2030 struct cvmx_npei_pktx_instr_header_s cn56xx; 2001 struct cvmx_npei_pktx_instr_header_s cn56xx;
2031 struct cvmx_npei_pktx_instr_header_s cn56xxp1;
2032}; 2002};
2033 2003
2034union cvmx_npei_pktx_slist_baddr { 2004union cvmx_npei_pktx_slist_baddr {
@@ -2039,7 +2009,6 @@ union cvmx_npei_pktx_slist_baddr {
2039 } s; 2009 } s;
2040 struct cvmx_npei_pktx_slist_baddr_s cn52xx; 2010 struct cvmx_npei_pktx_slist_baddr_s cn52xx;
2041 struct cvmx_npei_pktx_slist_baddr_s cn56xx; 2011 struct cvmx_npei_pktx_slist_baddr_s cn56xx;
2042 struct cvmx_npei_pktx_slist_baddr_s cn56xxp1;
2043}; 2012};
2044 2013
2045union cvmx_npei_pktx_slist_baoff_dbell { 2014union cvmx_npei_pktx_slist_baoff_dbell {
@@ -2050,7 +2019,6 @@ union cvmx_npei_pktx_slist_baoff_dbell {
2050 } s; 2019 } s;
2051 struct cvmx_npei_pktx_slist_baoff_dbell_s cn52xx; 2020 struct cvmx_npei_pktx_slist_baoff_dbell_s cn52xx;
2052 struct cvmx_npei_pktx_slist_baoff_dbell_s cn56xx; 2021 struct cvmx_npei_pktx_slist_baoff_dbell_s cn56xx;
2053 struct cvmx_npei_pktx_slist_baoff_dbell_s cn56xxp1;
2054}; 2022};
2055 2023
2056union cvmx_npei_pktx_slist_fifo_rsize { 2024union cvmx_npei_pktx_slist_fifo_rsize {
@@ -2061,7 +2029,6 @@ union cvmx_npei_pktx_slist_fifo_rsize {
2061 } s; 2029 } s;
2062 struct cvmx_npei_pktx_slist_fifo_rsize_s cn52xx; 2030 struct cvmx_npei_pktx_slist_fifo_rsize_s cn52xx;
2063 struct cvmx_npei_pktx_slist_fifo_rsize_s cn56xx; 2031 struct cvmx_npei_pktx_slist_fifo_rsize_s cn56xx;
2064 struct cvmx_npei_pktx_slist_fifo_rsize_s cn56xxp1;
2065}; 2032};
2066 2033
2067union cvmx_npei_pkt_cnt_int { 2034union cvmx_npei_pkt_cnt_int {
@@ -2072,7 +2039,6 @@ union cvmx_npei_pkt_cnt_int {
2072 } s; 2039 } s;
2073 struct cvmx_npei_pkt_cnt_int_s cn52xx; 2040 struct cvmx_npei_pkt_cnt_int_s cn52xx;
2074 struct cvmx_npei_pkt_cnt_int_s cn56xx; 2041 struct cvmx_npei_pkt_cnt_int_s cn56xx;
2075 struct cvmx_npei_pkt_cnt_int_s cn56xxp1;
2076}; 2042};
2077 2043
2078union cvmx_npei_pkt_cnt_int_enb { 2044union cvmx_npei_pkt_cnt_int_enb {
@@ -2083,7 +2049,6 @@ union cvmx_npei_pkt_cnt_int_enb {
2083 } s; 2049 } s;
2084 struct cvmx_npei_pkt_cnt_int_enb_s cn52xx; 2050 struct cvmx_npei_pkt_cnt_int_enb_s cn52xx;
2085 struct cvmx_npei_pkt_cnt_int_enb_s cn56xx; 2051 struct cvmx_npei_pkt_cnt_int_enb_s cn56xx;
2086 struct cvmx_npei_pkt_cnt_int_enb_s cn56xxp1;
2087}; 2052};
2088 2053
2089union cvmx_npei_pkt_data_out_es { 2054union cvmx_npei_pkt_data_out_es {
@@ -2093,7 +2058,6 @@ union cvmx_npei_pkt_data_out_es {
2093 } s; 2058 } s;
2094 struct cvmx_npei_pkt_data_out_es_s cn52xx; 2059 struct cvmx_npei_pkt_data_out_es_s cn52xx;
2095 struct cvmx_npei_pkt_data_out_es_s cn56xx; 2060 struct cvmx_npei_pkt_data_out_es_s cn56xx;
2096 struct cvmx_npei_pkt_data_out_es_s cn56xxp1;
2097}; 2061};
2098 2062
2099union cvmx_npei_pkt_data_out_ns { 2063union cvmx_npei_pkt_data_out_ns {
@@ -2104,7 +2068,6 @@ union cvmx_npei_pkt_data_out_ns {
2104 } s; 2068 } s;
2105 struct cvmx_npei_pkt_data_out_ns_s cn52xx; 2069 struct cvmx_npei_pkt_data_out_ns_s cn52xx;
2106 struct cvmx_npei_pkt_data_out_ns_s cn56xx; 2070 struct cvmx_npei_pkt_data_out_ns_s cn56xx;
2107 struct cvmx_npei_pkt_data_out_ns_s cn56xxp1;
2108}; 2071};
2109 2072
2110union cvmx_npei_pkt_data_out_ror { 2073union cvmx_npei_pkt_data_out_ror {
@@ -2115,7 +2078,6 @@ union cvmx_npei_pkt_data_out_ror {
2115 } s; 2078 } s;
2116 struct cvmx_npei_pkt_data_out_ror_s cn52xx; 2079 struct cvmx_npei_pkt_data_out_ror_s cn52xx;
2117 struct cvmx_npei_pkt_data_out_ror_s cn56xx; 2080 struct cvmx_npei_pkt_data_out_ror_s cn56xx;
2118 struct cvmx_npei_pkt_data_out_ror_s cn56xxp1;
2119}; 2081};
2120 2082
2121union cvmx_npei_pkt_dpaddr { 2083union cvmx_npei_pkt_dpaddr {
@@ -2126,7 +2088,6 @@ union cvmx_npei_pkt_dpaddr {
2126 } s; 2088 } s;
2127 struct cvmx_npei_pkt_dpaddr_s cn52xx; 2089 struct cvmx_npei_pkt_dpaddr_s cn52xx;
2128 struct cvmx_npei_pkt_dpaddr_s cn56xx; 2090 struct cvmx_npei_pkt_dpaddr_s cn56xx;
2129 struct cvmx_npei_pkt_dpaddr_s cn56xxp1;
2130}; 2091};
2131 2092
2132union cvmx_npei_pkt_in_bp { 2093union cvmx_npei_pkt_in_bp {
@@ -2135,6 +2096,7 @@ union cvmx_npei_pkt_in_bp {
2135 uint64_t reserved_32_63:32; 2096 uint64_t reserved_32_63:32;
2136 uint64_t bp:32; 2097 uint64_t bp:32;
2137 } s; 2098 } s;
2099 struct cvmx_npei_pkt_in_bp_s cn52xx;
2138 struct cvmx_npei_pkt_in_bp_s cn56xx; 2100 struct cvmx_npei_pkt_in_bp_s cn56xx;
2139}; 2101};
2140 2102
@@ -2146,7 +2108,6 @@ union cvmx_npei_pkt_in_donex_cnts {
2146 } s; 2108 } s;
2147 struct cvmx_npei_pkt_in_donex_cnts_s cn52xx; 2109 struct cvmx_npei_pkt_in_donex_cnts_s cn52xx;
2148 struct cvmx_npei_pkt_in_donex_cnts_s cn56xx; 2110 struct cvmx_npei_pkt_in_donex_cnts_s cn56xx;
2149 struct cvmx_npei_pkt_in_donex_cnts_s cn56xxp1;
2150}; 2111};
2151 2112
2152union cvmx_npei_pkt_in_instr_counts { 2113union cvmx_npei_pkt_in_instr_counts {
@@ -2184,7 +2145,6 @@ union cvmx_npei_pkt_input_control {
2184 } s; 2145 } s;
2185 struct cvmx_npei_pkt_input_control_s cn52xx; 2146 struct cvmx_npei_pkt_input_control_s cn52xx;
2186 struct cvmx_npei_pkt_input_control_s cn56xx; 2147 struct cvmx_npei_pkt_input_control_s cn56xx;
2187 struct cvmx_npei_pkt_input_control_s cn56xxp1;
2188}; 2148};
2189 2149
2190union cvmx_npei_pkt_instr_enb { 2150union cvmx_npei_pkt_instr_enb {
@@ -2195,7 +2155,6 @@ union cvmx_npei_pkt_instr_enb {
2195 } s; 2155 } s;
2196 struct cvmx_npei_pkt_instr_enb_s cn52xx; 2156 struct cvmx_npei_pkt_instr_enb_s cn52xx;
2197 struct cvmx_npei_pkt_instr_enb_s cn56xx; 2157 struct cvmx_npei_pkt_instr_enb_s cn56xx;
2198 struct cvmx_npei_pkt_instr_enb_s cn56xxp1;
2199}; 2158};
2200 2159
2201union cvmx_npei_pkt_instr_rd_size { 2160union cvmx_npei_pkt_instr_rd_size {
@@ -2215,7 +2174,6 @@ union cvmx_npei_pkt_instr_size {
2215 } s; 2174 } s;
2216 struct cvmx_npei_pkt_instr_size_s cn52xx; 2175 struct cvmx_npei_pkt_instr_size_s cn52xx;
2217 struct cvmx_npei_pkt_instr_size_s cn56xx; 2176 struct cvmx_npei_pkt_instr_size_s cn56xx;
2218 struct cvmx_npei_pkt_instr_size_s cn56xxp1;
2219}; 2177};
2220 2178
2221union cvmx_npei_pkt_int_levels { 2179union cvmx_npei_pkt_int_levels {
@@ -2227,7 +2185,6 @@ union cvmx_npei_pkt_int_levels {
2227 } s; 2185 } s;
2228 struct cvmx_npei_pkt_int_levels_s cn52xx; 2186 struct cvmx_npei_pkt_int_levels_s cn52xx;
2229 struct cvmx_npei_pkt_int_levels_s cn56xx; 2187 struct cvmx_npei_pkt_int_levels_s cn56xx;
2230 struct cvmx_npei_pkt_int_levels_s cn56xxp1;
2231}; 2188};
2232 2189
2233union cvmx_npei_pkt_iptr { 2190union cvmx_npei_pkt_iptr {
@@ -2238,7 +2195,6 @@ union cvmx_npei_pkt_iptr {
2238 } s; 2195 } s;
2239 struct cvmx_npei_pkt_iptr_s cn52xx; 2196 struct cvmx_npei_pkt_iptr_s cn52xx;
2240 struct cvmx_npei_pkt_iptr_s cn56xx; 2197 struct cvmx_npei_pkt_iptr_s cn56xx;
2241 struct cvmx_npei_pkt_iptr_s cn56xxp1;
2242}; 2198};
2243 2199
2244union cvmx_npei_pkt_out_bmode { 2200union cvmx_npei_pkt_out_bmode {
@@ -2249,7 +2205,6 @@ union cvmx_npei_pkt_out_bmode {
2249 } s; 2205 } s;
2250 struct cvmx_npei_pkt_out_bmode_s cn52xx; 2206 struct cvmx_npei_pkt_out_bmode_s cn52xx;
2251 struct cvmx_npei_pkt_out_bmode_s cn56xx; 2207 struct cvmx_npei_pkt_out_bmode_s cn56xx;
2252 struct cvmx_npei_pkt_out_bmode_s cn56xxp1;
2253}; 2208};
2254 2209
2255union cvmx_npei_pkt_out_enb { 2210union cvmx_npei_pkt_out_enb {
@@ -2260,7 +2215,6 @@ union cvmx_npei_pkt_out_enb {
2260 } s; 2215 } s;
2261 struct cvmx_npei_pkt_out_enb_s cn52xx; 2216 struct cvmx_npei_pkt_out_enb_s cn52xx;
2262 struct cvmx_npei_pkt_out_enb_s cn56xx; 2217 struct cvmx_npei_pkt_out_enb_s cn56xx;
2263 struct cvmx_npei_pkt_out_enb_s cn56xxp1;
2264}; 2218};
2265 2219
2266union cvmx_npei_pkt_output_wmark { 2220union cvmx_npei_pkt_output_wmark {
@@ -2280,7 +2234,6 @@ union cvmx_npei_pkt_pcie_port {
2280 } s; 2234 } s;
2281 struct cvmx_npei_pkt_pcie_port_s cn52xx; 2235 struct cvmx_npei_pkt_pcie_port_s cn52xx;
2282 struct cvmx_npei_pkt_pcie_port_s cn56xx; 2236 struct cvmx_npei_pkt_pcie_port_s cn56xx;
2283 struct cvmx_npei_pkt_pcie_port_s cn56xxp1;
2284}; 2237};
2285 2238
2286union cvmx_npei_pkt_port_in_rst { 2239union cvmx_npei_pkt_port_in_rst {
@@ -2300,7 +2253,6 @@ union cvmx_npei_pkt_slist_es {
2300 } s; 2253 } s;
2301 struct cvmx_npei_pkt_slist_es_s cn52xx; 2254 struct cvmx_npei_pkt_slist_es_s cn52xx;
2302 struct cvmx_npei_pkt_slist_es_s cn56xx; 2255 struct cvmx_npei_pkt_slist_es_s cn56xx;
2303 struct cvmx_npei_pkt_slist_es_s cn56xxp1;
2304}; 2256};
2305 2257
2306union cvmx_npei_pkt_slist_id_size { 2258union cvmx_npei_pkt_slist_id_size {
@@ -2312,7 +2264,6 @@ union cvmx_npei_pkt_slist_id_size {
2312 } s; 2264 } s;
2313 struct cvmx_npei_pkt_slist_id_size_s cn52xx; 2265 struct cvmx_npei_pkt_slist_id_size_s cn52xx;
2314 struct cvmx_npei_pkt_slist_id_size_s cn56xx; 2266 struct cvmx_npei_pkt_slist_id_size_s cn56xx;
2315 struct cvmx_npei_pkt_slist_id_size_s cn56xxp1;
2316}; 2267};
2317 2268
2318union cvmx_npei_pkt_slist_ns { 2269union cvmx_npei_pkt_slist_ns {
@@ -2323,7 +2274,6 @@ union cvmx_npei_pkt_slist_ns {
2323 } s; 2274 } s;
2324 struct cvmx_npei_pkt_slist_ns_s cn52xx; 2275 struct cvmx_npei_pkt_slist_ns_s cn52xx;
2325 struct cvmx_npei_pkt_slist_ns_s cn56xx; 2276 struct cvmx_npei_pkt_slist_ns_s cn56xx;
2326 struct cvmx_npei_pkt_slist_ns_s cn56xxp1;
2327}; 2277};
2328 2278
2329union cvmx_npei_pkt_slist_ror { 2279union cvmx_npei_pkt_slist_ror {
@@ -2334,7 +2284,6 @@ union cvmx_npei_pkt_slist_ror {
2334 } s; 2284 } s;
2335 struct cvmx_npei_pkt_slist_ror_s cn52xx; 2285 struct cvmx_npei_pkt_slist_ror_s cn52xx;
2336 struct cvmx_npei_pkt_slist_ror_s cn56xx; 2286 struct cvmx_npei_pkt_slist_ror_s cn56xx;
2337 struct cvmx_npei_pkt_slist_ror_s cn56xxp1;
2338}; 2287};
2339 2288
2340union cvmx_npei_pkt_time_int { 2289union cvmx_npei_pkt_time_int {
@@ -2345,7 +2294,6 @@ union cvmx_npei_pkt_time_int {
2345 } s; 2294 } s;
2346 struct cvmx_npei_pkt_time_int_s cn52xx; 2295 struct cvmx_npei_pkt_time_int_s cn52xx;
2347 struct cvmx_npei_pkt_time_int_s cn56xx; 2296 struct cvmx_npei_pkt_time_int_s cn56xx;
2348 struct cvmx_npei_pkt_time_int_s cn56xxp1;
2349}; 2297};
2350 2298
2351union cvmx_npei_pkt_time_int_enb { 2299union cvmx_npei_pkt_time_int_enb {
@@ -2356,7 +2304,6 @@ union cvmx_npei_pkt_time_int_enb {
2356 } s; 2304 } s;
2357 struct cvmx_npei_pkt_time_int_enb_s cn52xx; 2305 struct cvmx_npei_pkt_time_int_enb_s cn52xx;
2358 struct cvmx_npei_pkt_time_int_enb_s cn56xx; 2306 struct cvmx_npei_pkt_time_int_enb_s cn56xx;
2359 struct cvmx_npei_pkt_time_int_enb_s cn56xxp1;
2360}; 2307};
2361 2308
2362union cvmx_npei_rsl_int_blocks { 2309union cvmx_npei_rsl_int_blocks {
@@ -2371,7 +2318,8 @@ union cvmx_npei_rsl_int_blocks {
2371 uint64_t asxpcs0:1; 2318 uint64_t asxpcs0:1;
2372 uint64_t reserved_21_21:1; 2319 uint64_t reserved_21_21:1;
2373 uint64_t pip:1; 2320 uint64_t pip:1;
2374 uint64_t reserved_18_19:2; 2321 uint64_t spx1:1;
2322 uint64_t spx0:1;
2375 uint64_t lmc0:1; 2323 uint64_t lmc0:1;
2376 uint64_t l2c:1; 2324 uint64_t l2c:1;
2377 uint64_t usb1:1; 2325 uint64_t usb1:1;
@@ -2383,7 +2331,7 @@ union cvmx_npei_rsl_int_blocks {
2383 uint64_t ipd:1; 2331 uint64_t ipd:1;
2384 uint64_t reserved_8_8:1; 2332 uint64_t reserved_8_8:1;
2385 uint64_t zip:1; 2333 uint64_t zip:1;
2386 uint64_t reserved_6_6:1; 2334 uint64_t dfa:1;
2387 uint64_t fpa:1; 2335 uint64_t fpa:1;
2388 uint64_t key:1; 2336 uint64_t key:1;
2389 uint64_t npei:1; 2337 uint64_t npei:1;
@@ -2393,37 +2341,8 @@ union cvmx_npei_rsl_int_blocks {
2393 } s; 2341 } s;
2394 struct cvmx_npei_rsl_int_blocks_s cn52xx; 2342 struct cvmx_npei_rsl_int_blocks_s cn52xx;
2395 struct cvmx_npei_rsl_int_blocks_s cn52xxp1; 2343 struct cvmx_npei_rsl_int_blocks_s cn52xxp1;
2396 struct cvmx_npei_rsl_int_blocks_cn56xx { 2344 struct cvmx_npei_rsl_int_blocks_s cn56xx;
2397 uint64_t reserved_31_63:33; 2345 struct cvmx_npei_rsl_int_blocks_s cn56xxp1;
2398 uint64_t iob:1;
2399 uint64_t lmc1:1;
2400 uint64_t agl:1;
2401 uint64_t reserved_24_27:4;
2402 uint64_t asxpcs1:1;
2403 uint64_t asxpcs0:1;
2404 uint64_t reserved_21_21:1;
2405 uint64_t pip:1;
2406 uint64_t reserved_18_19:2;
2407 uint64_t lmc0:1;
2408 uint64_t l2c:1;
2409 uint64_t reserved_15_15:1;
2410 uint64_t rad:1;
2411 uint64_t usb:1;
2412 uint64_t pow:1;
2413 uint64_t tim:1;
2414 uint64_t pko:1;
2415 uint64_t ipd:1;
2416 uint64_t reserved_8_8:1;
2417 uint64_t zip:1;
2418 uint64_t reserved_6_6:1;
2419 uint64_t fpa:1;
2420 uint64_t key:1;
2421 uint64_t npei:1;
2422 uint64_t gmx1:1;
2423 uint64_t gmx0:1;
2424 uint64_t mio:1;
2425 } cn56xx;
2426 struct cvmx_npei_rsl_int_blocks_cn56xx cn56xxp1;
2427}; 2346};
2428 2347
2429union cvmx_npei_scratch_1 { 2348union cvmx_npei_scratch_1 {
diff --git a/arch/mips/include/asm/octeon/cvmx-npi-defs.h b/arch/mips/include/asm/octeon/cvmx-npi-defs.h
index 4e03cd8561e3..f089c780060f 100644
--- a/arch/mips/include/asm/octeon/cvmx-npi-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-npi-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,246 +28,126 @@
28#ifndef __CVMX_NPI_DEFS_H__ 28#ifndef __CVMX_NPI_DEFS_H__
29#define __CVMX_NPI_DEFS_H__ 29#define __CVMX_NPI_DEFS_H__
30 30
31#define CVMX_NPI_BASE_ADDR_INPUT0 \ 31#define CVMX_NPI_BASE_ADDR_INPUT0 CVMX_NPI_BASE_ADDR_INPUTX(0)
32 CVMX_ADD_IO_SEG(0x00011F0000000070ull) 32#define CVMX_NPI_BASE_ADDR_INPUT1 CVMX_NPI_BASE_ADDR_INPUTX(1)
33#define CVMX_NPI_BASE_ADDR_INPUT1 \ 33#define CVMX_NPI_BASE_ADDR_INPUT2 CVMX_NPI_BASE_ADDR_INPUTX(2)
34 CVMX_ADD_IO_SEG(0x00011F0000000080ull) 34#define CVMX_NPI_BASE_ADDR_INPUT3 CVMX_NPI_BASE_ADDR_INPUTX(3)
35#define CVMX_NPI_BASE_ADDR_INPUT2 \ 35#define CVMX_NPI_BASE_ADDR_INPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000000070ull) + ((offset) & 3) * 16)
36 CVMX_ADD_IO_SEG(0x00011F0000000090ull) 36#define CVMX_NPI_BASE_ADDR_OUTPUT0 CVMX_NPI_BASE_ADDR_OUTPUTX(0)
37#define CVMX_NPI_BASE_ADDR_INPUT3 \ 37#define CVMX_NPI_BASE_ADDR_OUTPUT1 CVMX_NPI_BASE_ADDR_OUTPUTX(1)
38 CVMX_ADD_IO_SEG(0x00011F00000000A0ull) 38#define CVMX_NPI_BASE_ADDR_OUTPUT2 CVMX_NPI_BASE_ADDR_OUTPUTX(2)
39#define CVMX_NPI_BASE_ADDR_INPUTX(offset) \ 39#define CVMX_NPI_BASE_ADDR_OUTPUT3 CVMX_NPI_BASE_ADDR_OUTPUTX(3)
40 CVMX_ADD_IO_SEG(0x00011F0000000070ull + (((offset) & 3) * 16)) 40#define CVMX_NPI_BASE_ADDR_OUTPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F00000000B8ull) + ((offset) & 3) * 8)
41#define CVMX_NPI_BASE_ADDR_OUTPUT0 \ 41#define CVMX_NPI_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011F00000003F8ull))
42 CVMX_ADD_IO_SEG(0x00011F00000000B8ull) 42#define CVMX_NPI_BUFF_SIZE_OUTPUT0 CVMX_NPI_BUFF_SIZE_OUTPUTX(0)
43#define CVMX_NPI_BASE_ADDR_OUTPUT1 \ 43#define CVMX_NPI_BUFF_SIZE_OUTPUT1 CVMX_NPI_BUFF_SIZE_OUTPUTX(1)
44 CVMX_ADD_IO_SEG(0x00011F00000000C0ull) 44#define CVMX_NPI_BUFF_SIZE_OUTPUT2 CVMX_NPI_BUFF_SIZE_OUTPUTX(2)
45#define CVMX_NPI_BASE_ADDR_OUTPUT2 \ 45#define CVMX_NPI_BUFF_SIZE_OUTPUT3 CVMX_NPI_BUFF_SIZE_OUTPUTX(3)
46 CVMX_ADD_IO_SEG(0x00011F00000000C8ull) 46#define CVMX_NPI_BUFF_SIZE_OUTPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F00000000E0ull) + ((offset) & 3) * 8)
47#define CVMX_NPI_BASE_ADDR_OUTPUT3 \ 47#define CVMX_NPI_COMP_CTL (CVMX_ADD_IO_SEG(0x00011F0000000218ull))
48 CVMX_ADD_IO_SEG(0x00011F00000000D0ull) 48#define CVMX_NPI_CTL_STATUS (CVMX_ADD_IO_SEG(0x00011F0000000010ull))
49#define CVMX_NPI_BASE_ADDR_OUTPUTX(offset) \ 49#define CVMX_NPI_DBG_SELECT (CVMX_ADD_IO_SEG(0x00011F0000000008ull))
50 CVMX_ADD_IO_SEG(0x00011F00000000B8ull + (((offset) & 3) * 8)) 50#define CVMX_NPI_DMA_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000000128ull))
51#define CVMX_NPI_BIST_STATUS \ 51#define CVMX_NPI_DMA_HIGHP_COUNTS (CVMX_ADD_IO_SEG(0x00011F0000000148ull))
52 CVMX_ADD_IO_SEG(0x00011F00000003F8ull) 52#define CVMX_NPI_DMA_HIGHP_NADDR (CVMX_ADD_IO_SEG(0x00011F0000000158ull))
53#define CVMX_NPI_BUFF_SIZE_OUTPUT0 \ 53#define CVMX_NPI_DMA_LOWP_COUNTS (CVMX_ADD_IO_SEG(0x00011F0000000140ull))
54 CVMX_ADD_IO_SEG(0x00011F00000000E0ull) 54#define CVMX_NPI_DMA_LOWP_NADDR (CVMX_ADD_IO_SEG(0x00011F0000000150ull))
55#define CVMX_NPI_BUFF_SIZE_OUTPUT1 \ 55#define CVMX_NPI_HIGHP_DBELL (CVMX_ADD_IO_SEG(0x00011F0000000120ull))
56 CVMX_ADD_IO_SEG(0x00011F00000000E8ull) 56#define CVMX_NPI_HIGHP_IBUFF_SADDR (CVMX_ADD_IO_SEG(0x00011F0000000110ull))
57#define CVMX_NPI_BUFF_SIZE_OUTPUT2 \ 57#define CVMX_NPI_INPUT_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000000138ull))
58 CVMX_ADD_IO_SEG(0x00011F00000000F0ull) 58#define CVMX_NPI_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000000020ull))
59#define CVMX_NPI_BUFF_SIZE_OUTPUT3 \ 59#define CVMX_NPI_INT_SUM (CVMX_ADD_IO_SEG(0x00011F0000000018ull))
60 CVMX_ADD_IO_SEG(0x00011F00000000F8ull) 60#define CVMX_NPI_LOWP_DBELL (CVMX_ADD_IO_SEG(0x00011F0000000118ull))
61#define CVMX_NPI_BUFF_SIZE_OUTPUTX(offset) \ 61#define CVMX_NPI_LOWP_IBUFF_SADDR (CVMX_ADD_IO_SEG(0x00011F0000000108ull))
62 CVMX_ADD_IO_SEG(0x00011F00000000E0ull + (((offset) & 3) * 8)) 62#define CVMX_NPI_MEM_ACCESS_SUBID3 CVMX_NPI_MEM_ACCESS_SUBIDX(3)
63#define CVMX_NPI_COMP_CTL \ 63#define CVMX_NPI_MEM_ACCESS_SUBID4 CVMX_NPI_MEM_ACCESS_SUBIDX(4)
64 CVMX_ADD_IO_SEG(0x00011F0000000218ull) 64#define CVMX_NPI_MEM_ACCESS_SUBID5 CVMX_NPI_MEM_ACCESS_SUBIDX(5)
65#define CVMX_NPI_CTL_STATUS \ 65#define CVMX_NPI_MEM_ACCESS_SUBID6 CVMX_NPI_MEM_ACCESS_SUBIDX(6)
66 CVMX_ADD_IO_SEG(0x00011F0000000010ull) 66#define CVMX_NPI_MEM_ACCESS_SUBIDX(offset) (CVMX_ADD_IO_SEG(0x00011F0000000028ull) + ((offset) & 7) * 8 - 8*3)
67#define CVMX_NPI_DBG_SELECT \ 67#define CVMX_NPI_MSI_RCV (0x0000000000000190ull)
68 CVMX_ADD_IO_SEG(0x00011F0000000008ull) 68#define CVMX_NPI_NPI_MSI_RCV (CVMX_ADD_IO_SEG(0x00011F0000001190ull))
69#define CVMX_NPI_DMA_CONTROL \ 69#define CVMX_NPI_NUM_DESC_OUTPUT0 CVMX_NPI_NUM_DESC_OUTPUTX(0)
70 CVMX_ADD_IO_SEG(0x00011F0000000128ull) 70#define CVMX_NPI_NUM_DESC_OUTPUT1 CVMX_NPI_NUM_DESC_OUTPUTX(1)
71#define CVMX_NPI_DMA_HIGHP_COUNTS \ 71#define CVMX_NPI_NUM_DESC_OUTPUT2 CVMX_NPI_NUM_DESC_OUTPUTX(2)
72 CVMX_ADD_IO_SEG(0x00011F0000000148ull) 72#define CVMX_NPI_NUM_DESC_OUTPUT3 CVMX_NPI_NUM_DESC_OUTPUTX(3)
73#define CVMX_NPI_DMA_HIGHP_NADDR \ 73#define CVMX_NPI_NUM_DESC_OUTPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000000050ull) + ((offset) & 3) * 8)
74 CVMX_ADD_IO_SEG(0x00011F0000000158ull) 74#define CVMX_NPI_OUTPUT_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000000100ull))
75#define CVMX_NPI_DMA_LOWP_COUNTS \ 75#define CVMX_NPI_P0_DBPAIR_ADDR CVMX_NPI_PX_DBPAIR_ADDR(0)
76 CVMX_ADD_IO_SEG(0x00011F0000000140ull) 76#define CVMX_NPI_P0_INSTR_ADDR CVMX_NPI_PX_INSTR_ADDR(0)
77#define CVMX_NPI_DMA_LOWP_NADDR \ 77#define CVMX_NPI_P0_INSTR_CNTS CVMX_NPI_PX_INSTR_CNTS(0)
78 CVMX_ADD_IO_SEG(0x00011F0000000150ull) 78#define CVMX_NPI_P0_PAIR_CNTS CVMX_NPI_PX_PAIR_CNTS(0)
79#define CVMX_NPI_HIGHP_DBELL \ 79#define CVMX_NPI_P1_DBPAIR_ADDR CVMX_NPI_PX_DBPAIR_ADDR(1)
80 CVMX_ADD_IO_SEG(0x00011F0000000120ull) 80#define CVMX_NPI_P1_INSTR_ADDR CVMX_NPI_PX_INSTR_ADDR(1)
81#define CVMX_NPI_HIGHP_IBUFF_SADDR \ 81#define CVMX_NPI_P1_INSTR_CNTS CVMX_NPI_PX_INSTR_CNTS(1)
82 CVMX_ADD_IO_SEG(0x00011F0000000110ull) 82#define CVMX_NPI_P1_PAIR_CNTS CVMX_NPI_PX_PAIR_CNTS(1)
83#define CVMX_NPI_INPUT_CONTROL \ 83#define CVMX_NPI_P2_DBPAIR_ADDR CVMX_NPI_PX_DBPAIR_ADDR(2)
84 CVMX_ADD_IO_SEG(0x00011F0000000138ull) 84#define CVMX_NPI_P2_INSTR_ADDR CVMX_NPI_PX_INSTR_ADDR(2)
85#define CVMX_NPI_INT_ENB \ 85#define CVMX_NPI_P2_INSTR_CNTS CVMX_NPI_PX_INSTR_CNTS(2)
86 CVMX_ADD_IO_SEG(0x00011F0000000020ull) 86#define CVMX_NPI_P2_PAIR_CNTS CVMX_NPI_PX_PAIR_CNTS(2)
87#define CVMX_NPI_INT_SUM \ 87#define CVMX_NPI_P3_DBPAIR_ADDR CVMX_NPI_PX_DBPAIR_ADDR(3)
88 CVMX_ADD_IO_SEG(0x00011F0000000018ull) 88#define CVMX_NPI_P3_INSTR_ADDR CVMX_NPI_PX_INSTR_ADDR(3)
89#define CVMX_NPI_LOWP_DBELL \ 89#define CVMX_NPI_P3_INSTR_CNTS CVMX_NPI_PX_INSTR_CNTS(3)
90 CVMX_ADD_IO_SEG(0x00011F0000000118ull) 90#define CVMX_NPI_P3_PAIR_CNTS CVMX_NPI_PX_PAIR_CNTS(3)
91#define CVMX_NPI_LOWP_IBUFF_SADDR \ 91#define CVMX_NPI_PCI_BAR1_INDEXX(offset) (CVMX_ADD_IO_SEG(0x00011F0000001100ull) + ((offset) & 31) * 4)
92 CVMX_ADD_IO_SEG(0x00011F0000000108ull) 92#define CVMX_NPI_PCI_BIST_REG (CVMX_ADD_IO_SEG(0x00011F00000011C0ull))
93#define CVMX_NPI_MEM_ACCESS_SUBID3 \ 93#define CVMX_NPI_PCI_BURST_SIZE (CVMX_ADD_IO_SEG(0x00011F00000000D8ull))
94 CVMX_ADD_IO_SEG(0x00011F0000000028ull) 94#define CVMX_NPI_PCI_CFG00 (CVMX_ADD_IO_SEG(0x00011F0000001800ull))
95#define CVMX_NPI_MEM_ACCESS_SUBID4 \ 95#define CVMX_NPI_PCI_CFG01 (CVMX_ADD_IO_SEG(0x00011F0000001804ull))
96 CVMX_ADD_IO_SEG(0x00011F0000000030ull) 96#define CVMX_NPI_PCI_CFG02 (CVMX_ADD_IO_SEG(0x00011F0000001808ull))
97#define CVMX_NPI_MEM_ACCESS_SUBID5 \ 97#define CVMX_NPI_PCI_CFG03 (CVMX_ADD_IO_SEG(0x00011F000000180Cull))
98 CVMX_ADD_IO_SEG(0x00011F0000000038ull) 98#define CVMX_NPI_PCI_CFG04 (CVMX_ADD_IO_SEG(0x00011F0000001810ull))
99#define CVMX_NPI_MEM_ACCESS_SUBID6 \ 99#define CVMX_NPI_PCI_CFG05 (CVMX_ADD_IO_SEG(0x00011F0000001814ull))
100 CVMX_ADD_IO_SEG(0x00011F0000000040ull) 100#define CVMX_NPI_PCI_CFG06 (CVMX_ADD_IO_SEG(0x00011F0000001818ull))
101#define CVMX_NPI_MEM_ACCESS_SUBIDX(offset) \ 101#define CVMX_NPI_PCI_CFG07 (CVMX_ADD_IO_SEG(0x00011F000000181Cull))
102 CVMX_ADD_IO_SEG(0x00011F0000000028ull + (((offset) & 7) * 8) - 8 * 3) 102#define CVMX_NPI_PCI_CFG08 (CVMX_ADD_IO_SEG(0x00011F0000001820ull))
103#define CVMX_NPI_MSI_RCV \ 103#define CVMX_NPI_PCI_CFG09 (CVMX_ADD_IO_SEG(0x00011F0000001824ull))
104 (0x0000000000000190ull) 104#define CVMX_NPI_PCI_CFG10 (CVMX_ADD_IO_SEG(0x00011F0000001828ull))
105#define CVMX_NPI_NPI_MSI_RCV \ 105#define CVMX_NPI_PCI_CFG11 (CVMX_ADD_IO_SEG(0x00011F000000182Cull))
106 CVMX_ADD_IO_SEG(0x00011F0000001190ull) 106#define CVMX_NPI_PCI_CFG12 (CVMX_ADD_IO_SEG(0x00011F0000001830ull))
107#define CVMX_NPI_NUM_DESC_OUTPUT0 \ 107#define CVMX_NPI_PCI_CFG13 (CVMX_ADD_IO_SEG(0x00011F0000001834ull))
108 CVMX_ADD_IO_SEG(0x00011F0000000050ull) 108#define CVMX_NPI_PCI_CFG15 (CVMX_ADD_IO_SEG(0x00011F000000183Cull))
109#define CVMX_NPI_NUM_DESC_OUTPUT1 \ 109#define CVMX_NPI_PCI_CFG16 (CVMX_ADD_IO_SEG(0x00011F0000001840ull))
110 CVMX_ADD_IO_SEG(0x00011F0000000058ull) 110#define CVMX_NPI_PCI_CFG17 (CVMX_ADD_IO_SEG(0x00011F0000001844ull))
111#define CVMX_NPI_NUM_DESC_OUTPUT2 \ 111#define CVMX_NPI_PCI_CFG18 (CVMX_ADD_IO_SEG(0x00011F0000001848ull))
112 CVMX_ADD_IO_SEG(0x00011F0000000060ull) 112#define CVMX_NPI_PCI_CFG19 (CVMX_ADD_IO_SEG(0x00011F000000184Cull))
113#define CVMX_NPI_NUM_DESC_OUTPUT3 \ 113#define CVMX_NPI_PCI_CFG20 (CVMX_ADD_IO_SEG(0x00011F0000001850ull))
114 CVMX_ADD_IO_SEG(0x00011F0000000068ull) 114#define CVMX_NPI_PCI_CFG21 (CVMX_ADD_IO_SEG(0x00011F0000001854ull))
115#define CVMX_NPI_NUM_DESC_OUTPUTX(offset) \ 115#define CVMX_NPI_PCI_CFG22 (CVMX_ADD_IO_SEG(0x00011F0000001858ull))
116 CVMX_ADD_IO_SEG(0x00011F0000000050ull + (((offset) & 3) * 8)) 116#define CVMX_NPI_PCI_CFG56 (CVMX_ADD_IO_SEG(0x00011F00000018E0ull))
117#define CVMX_NPI_OUTPUT_CONTROL \ 117#define CVMX_NPI_PCI_CFG57 (CVMX_ADD_IO_SEG(0x00011F00000018E4ull))
118 CVMX_ADD_IO_SEG(0x00011F0000000100ull) 118#define CVMX_NPI_PCI_CFG58 (CVMX_ADD_IO_SEG(0x00011F00000018E8ull))
119#define CVMX_NPI_P0_DBPAIR_ADDR \ 119#define CVMX_NPI_PCI_CFG59 (CVMX_ADD_IO_SEG(0x00011F00000018ECull))
120 CVMX_ADD_IO_SEG(0x00011F0000000180ull) 120#define CVMX_NPI_PCI_CFG60 (CVMX_ADD_IO_SEG(0x00011F00000018F0ull))
121#define CVMX_NPI_P0_INSTR_ADDR \ 121#define CVMX_NPI_PCI_CFG61 (CVMX_ADD_IO_SEG(0x00011F00000018F4ull))
122 CVMX_ADD_IO_SEG(0x00011F00000001C0ull) 122#define CVMX_NPI_PCI_CFG62 (CVMX_ADD_IO_SEG(0x00011F00000018F8ull))
123#define CVMX_NPI_P0_INSTR_CNTS \ 123#define CVMX_NPI_PCI_CFG63 (CVMX_ADD_IO_SEG(0x00011F00000018FCull))
124 CVMX_ADD_IO_SEG(0x00011F00000001A0ull) 124#define CVMX_NPI_PCI_CNT_REG (CVMX_ADD_IO_SEG(0x00011F00000011B8ull))
125#define CVMX_NPI_P0_PAIR_CNTS \ 125#define CVMX_NPI_PCI_CTL_STATUS_2 (CVMX_ADD_IO_SEG(0x00011F000000118Cull))
126 CVMX_ADD_IO_SEG(0x00011F0000000160ull) 126#define CVMX_NPI_PCI_INT_ARB_CFG (CVMX_ADD_IO_SEG(0x00011F0000000130ull))
127#define CVMX_NPI_P1_DBPAIR_ADDR \ 127#define CVMX_NPI_PCI_INT_ENB2 (CVMX_ADD_IO_SEG(0x00011F00000011A0ull))
128 CVMX_ADD_IO_SEG(0x00011F0000000188ull) 128#define CVMX_NPI_PCI_INT_SUM2 (CVMX_ADD_IO_SEG(0x00011F0000001198ull))
129#define CVMX_NPI_P1_INSTR_ADDR \ 129#define CVMX_NPI_PCI_READ_CMD (CVMX_ADD_IO_SEG(0x00011F0000000048ull))
130 CVMX_ADD_IO_SEG(0x00011F00000001C8ull) 130#define CVMX_NPI_PCI_READ_CMD_6 (CVMX_ADD_IO_SEG(0x00011F0000001180ull))
131#define CVMX_NPI_P1_INSTR_CNTS \ 131#define CVMX_NPI_PCI_READ_CMD_C (CVMX_ADD_IO_SEG(0x00011F0000001184ull))
132 CVMX_ADD_IO_SEG(0x00011F00000001A8ull) 132#define CVMX_NPI_PCI_READ_CMD_E (CVMX_ADD_IO_SEG(0x00011F0000001188ull))
133#define CVMX_NPI_P1_PAIR_CNTS \ 133#define CVMX_NPI_PCI_SCM_REG (CVMX_ADD_IO_SEG(0x00011F00000011A8ull))
134 CVMX_ADD_IO_SEG(0x00011F0000000168ull) 134#define CVMX_NPI_PCI_TSR_REG (CVMX_ADD_IO_SEG(0x00011F00000011B0ull))
135#define CVMX_NPI_P2_DBPAIR_ADDR \ 135#define CVMX_NPI_PORT32_INSTR_HDR (CVMX_ADD_IO_SEG(0x00011F00000001F8ull))
136 CVMX_ADD_IO_SEG(0x00011F0000000190ull) 136#define CVMX_NPI_PORT33_INSTR_HDR (CVMX_ADD_IO_SEG(0x00011F0000000200ull))
137#define CVMX_NPI_P2_INSTR_ADDR \ 137#define CVMX_NPI_PORT34_INSTR_HDR (CVMX_ADD_IO_SEG(0x00011F0000000208ull))
138 CVMX_ADD_IO_SEG(0x00011F00000001D0ull) 138#define CVMX_NPI_PORT35_INSTR_HDR (CVMX_ADD_IO_SEG(0x00011F0000000210ull))
139#define CVMX_NPI_P2_INSTR_CNTS \ 139#define CVMX_NPI_PORT_BP_CONTROL (CVMX_ADD_IO_SEG(0x00011F00000001F0ull))
140 CVMX_ADD_IO_SEG(0x00011F00000001B0ull) 140#define CVMX_NPI_PX_DBPAIR_ADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000000180ull) + ((offset) & 3) * 8)
141#define CVMX_NPI_P2_PAIR_CNTS \ 141#define CVMX_NPI_PX_INSTR_ADDR(offset) (CVMX_ADD_IO_SEG(0x00011F00000001C0ull) + ((offset) & 3) * 8)
142 CVMX_ADD_IO_SEG(0x00011F0000000170ull) 142#define CVMX_NPI_PX_INSTR_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F00000001A0ull) + ((offset) & 3) * 8)
143#define CVMX_NPI_P3_DBPAIR_ADDR \ 143#define CVMX_NPI_PX_PAIR_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F0000000160ull) + ((offset) & 3) * 8)
144 CVMX_ADD_IO_SEG(0x00011F0000000198ull) 144#define CVMX_NPI_RSL_INT_BLOCKS (CVMX_ADD_IO_SEG(0x00011F0000000000ull))
145#define CVMX_NPI_P3_INSTR_ADDR \ 145#define CVMX_NPI_SIZE_INPUT0 CVMX_NPI_SIZE_INPUTX(0)
146 CVMX_ADD_IO_SEG(0x00011F00000001D8ull) 146#define CVMX_NPI_SIZE_INPUT1 CVMX_NPI_SIZE_INPUTX(1)
147#define CVMX_NPI_P3_INSTR_CNTS \ 147#define CVMX_NPI_SIZE_INPUT2 CVMX_NPI_SIZE_INPUTX(2)
148 CVMX_ADD_IO_SEG(0x00011F00000001B8ull) 148#define CVMX_NPI_SIZE_INPUT3 CVMX_NPI_SIZE_INPUTX(3)
149#define CVMX_NPI_P3_PAIR_CNTS \ 149#define CVMX_NPI_SIZE_INPUTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000000078ull) + ((offset) & 3) * 16)
150 CVMX_ADD_IO_SEG(0x00011F0000000178ull) 150#define CVMX_NPI_WIN_READ_TO (CVMX_ADD_IO_SEG(0x00011F00000001E0ull))
151#define CVMX_NPI_PCI_BAR1_INDEXX(offset) \
152 CVMX_ADD_IO_SEG(0x00011F0000001100ull + (((offset) & 31) * 4))
153#define CVMX_NPI_PCI_BIST_REG \
154 CVMX_ADD_IO_SEG(0x00011F00000011C0ull)
155#define CVMX_NPI_PCI_BURST_SIZE \
156 CVMX_ADD_IO_SEG(0x00011F00000000D8ull)
157#define CVMX_NPI_PCI_CFG00 \
158 CVMX_ADD_IO_SEG(0x00011F0000001800ull)
159#define CVMX_NPI_PCI_CFG01 \
160 CVMX_ADD_IO_SEG(0x00011F0000001804ull)
161#define CVMX_NPI_PCI_CFG02 \
162 CVMX_ADD_IO_SEG(0x00011F0000001808ull)
163#define CVMX_NPI_PCI_CFG03 \
164 CVMX_ADD_IO_SEG(0x00011F000000180Cull)
165#define CVMX_NPI_PCI_CFG04 \
166 CVMX_ADD_IO_SEG(0x00011F0000001810ull)
167#define CVMX_NPI_PCI_CFG05 \
168 CVMX_ADD_IO_SEG(0x00011F0000001814ull)
169#define CVMX_NPI_PCI_CFG06 \
170 CVMX_ADD_IO_SEG(0x00011F0000001818ull)
171#define CVMX_NPI_PCI_CFG07 \
172 CVMX_ADD_IO_SEG(0x00011F000000181Cull)
173#define CVMX_NPI_PCI_CFG08 \
174 CVMX_ADD_IO_SEG(0x00011F0000001820ull)
175#define CVMX_NPI_PCI_CFG09 \
176 CVMX_ADD_IO_SEG(0x00011F0000001824ull)
177#define CVMX_NPI_PCI_CFG10 \
178 CVMX_ADD_IO_SEG(0x00011F0000001828ull)
179#define CVMX_NPI_PCI_CFG11 \
180 CVMX_ADD_IO_SEG(0x00011F000000182Cull)
181#define CVMX_NPI_PCI_CFG12 \
182 CVMX_ADD_IO_SEG(0x00011F0000001830ull)
183#define CVMX_NPI_PCI_CFG13 \
184 CVMX_ADD_IO_SEG(0x00011F0000001834ull)
185#define CVMX_NPI_PCI_CFG15 \
186 CVMX_ADD_IO_SEG(0x00011F000000183Cull)
187#define CVMX_NPI_PCI_CFG16 \
188 CVMX_ADD_IO_SEG(0x00011F0000001840ull)
189#define CVMX_NPI_PCI_CFG17 \
190 CVMX_ADD_IO_SEG(0x00011F0000001844ull)
191#define CVMX_NPI_PCI_CFG18 \
192 CVMX_ADD_IO_SEG(0x00011F0000001848ull)
193#define CVMX_NPI_PCI_CFG19 \
194 CVMX_ADD_IO_SEG(0x00011F000000184Cull)
195#define CVMX_NPI_PCI_CFG20 \
196 CVMX_ADD_IO_SEG(0x00011F0000001850ull)
197#define CVMX_NPI_PCI_CFG21 \
198 CVMX_ADD_IO_SEG(0x00011F0000001854ull)
199#define CVMX_NPI_PCI_CFG22 \
200 CVMX_ADD_IO_SEG(0x00011F0000001858ull)
201#define CVMX_NPI_PCI_CFG56 \
202 CVMX_ADD_IO_SEG(0x00011F00000018E0ull)
203#define CVMX_NPI_PCI_CFG57 \
204 CVMX_ADD_IO_SEG(0x00011F00000018E4ull)
205#define CVMX_NPI_PCI_CFG58 \
206 CVMX_ADD_IO_SEG(0x00011F00000018E8ull)
207#define CVMX_NPI_PCI_CFG59 \
208 CVMX_ADD_IO_SEG(0x00011F00000018ECull)
209#define CVMX_NPI_PCI_CFG60 \
210 CVMX_ADD_IO_SEG(0x00011F00000018F0ull)
211#define CVMX_NPI_PCI_CFG61 \
212 CVMX_ADD_IO_SEG(0x00011F00000018F4ull)
213#define CVMX_NPI_PCI_CFG62 \
214 CVMX_ADD_IO_SEG(0x00011F00000018F8ull)
215#define CVMX_NPI_PCI_CFG63 \
216 CVMX_ADD_IO_SEG(0x00011F00000018FCull)
217#define CVMX_NPI_PCI_CNT_REG \
218 CVMX_ADD_IO_SEG(0x00011F00000011B8ull)
219#define CVMX_NPI_PCI_CTL_STATUS_2 \
220 CVMX_ADD_IO_SEG(0x00011F000000118Cull)
221#define CVMX_NPI_PCI_INT_ARB_CFG \
222 CVMX_ADD_IO_SEG(0x00011F0000000130ull)
223#define CVMX_NPI_PCI_INT_ENB2 \
224 CVMX_ADD_IO_SEG(0x00011F00000011A0ull)
225#define CVMX_NPI_PCI_INT_SUM2 \
226 CVMX_ADD_IO_SEG(0x00011F0000001198ull)
227#define CVMX_NPI_PCI_READ_CMD \
228 CVMX_ADD_IO_SEG(0x00011F0000000048ull)
229#define CVMX_NPI_PCI_READ_CMD_6 \
230 CVMX_ADD_IO_SEG(0x00011F0000001180ull)
231#define CVMX_NPI_PCI_READ_CMD_C \
232 CVMX_ADD_IO_SEG(0x00011F0000001184ull)
233#define CVMX_NPI_PCI_READ_CMD_E \
234 CVMX_ADD_IO_SEG(0x00011F0000001188ull)
235#define CVMX_NPI_PCI_SCM_REG \
236 CVMX_ADD_IO_SEG(0x00011F00000011A8ull)
237#define CVMX_NPI_PCI_TSR_REG \
238 CVMX_ADD_IO_SEG(0x00011F00000011B0ull)
239#define CVMX_NPI_PORT32_INSTR_HDR \
240 CVMX_ADD_IO_SEG(0x00011F00000001F8ull)
241#define CVMX_NPI_PORT33_INSTR_HDR \
242 CVMX_ADD_IO_SEG(0x00011F0000000200ull)
243#define CVMX_NPI_PORT34_INSTR_HDR \
244 CVMX_ADD_IO_SEG(0x00011F0000000208ull)
245#define CVMX_NPI_PORT35_INSTR_HDR \
246 CVMX_ADD_IO_SEG(0x00011F0000000210ull)
247#define CVMX_NPI_PORT_BP_CONTROL \
248 CVMX_ADD_IO_SEG(0x00011F00000001F0ull)
249#define CVMX_NPI_PX_DBPAIR_ADDR(offset) \
250 CVMX_ADD_IO_SEG(0x00011F0000000180ull + (((offset) & 3) * 8))
251#define CVMX_NPI_PX_INSTR_ADDR(offset) \
252 CVMX_ADD_IO_SEG(0x00011F00000001C0ull + (((offset) & 3) * 8))
253#define CVMX_NPI_PX_INSTR_CNTS(offset) \
254 CVMX_ADD_IO_SEG(0x00011F00000001A0ull + (((offset) & 3) * 8))
255#define CVMX_NPI_PX_PAIR_CNTS(offset) \
256 CVMX_ADD_IO_SEG(0x00011F0000000160ull + (((offset) & 3) * 8))
257#define CVMX_NPI_RSL_INT_BLOCKS \
258 CVMX_ADD_IO_SEG(0x00011F0000000000ull)
259#define CVMX_NPI_SIZE_INPUT0 \
260 CVMX_ADD_IO_SEG(0x00011F0000000078ull)
261#define CVMX_NPI_SIZE_INPUT1 \
262 CVMX_ADD_IO_SEG(0x00011F0000000088ull)
263#define CVMX_NPI_SIZE_INPUT2 \
264 CVMX_ADD_IO_SEG(0x00011F0000000098ull)
265#define CVMX_NPI_SIZE_INPUT3 \
266 CVMX_ADD_IO_SEG(0x00011F00000000A8ull)
267#define CVMX_NPI_SIZE_INPUTX(offset) \
268 CVMX_ADD_IO_SEG(0x00011F0000000078ull + (((offset) & 3) * 16))
269#define CVMX_NPI_WIN_READ_TO \
270 CVMX_ADD_IO_SEG(0x00011F00000001E0ull)
271 151
272union cvmx_npi_base_addr_inputx { 152union cvmx_npi_base_addr_inputx {
273 uint64_t u64; 153 uint64_t u64;
diff --git a/arch/mips/include/asm/octeon/cvmx-pci-defs.h b/arch/mips/include/asm/octeon/cvmx-pci-defs.h
index 90f8d6535753..6ff6d9d357ba 100644
--- a/arch/mips/include/asm/octeon/cvmx-pci-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-pci-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,184 +28,91 @@
28#ifndef __CVMX_PCI_DEFS_H__ 28#ifndef __CVMX_PCI_DEFS_H__
29#define __CVMX_PCI_DEFS_H__ 29#define __CVMX_PCI_DEFS_H__
30 30
31#define CVMX_PCI_BAR1_INDEXX(offset) \ 31#define CVMX_PCI_BAR1_INDEXX(offset) (0x0000000000000100ull + ((offset) & 31) * 4)
32 (0x0000000000000100ull + (((offset) & 31) * 4)) 32#define CVMX_PCI_BIST_REG (0x00000000000001C0ull)
33#define CVMX_PCI_BIST_REG \ 33#define CVMX_PCI_CFG00 (0x0000000000000000ull)
34 (0x00000000000001C0ull) 34#define CVMX_PCI_CFG01 (0x0000000000000004ull)
35#define CVMX_PCI_CFG00 \ 35#define CVMX_PCI_CFG02 (0x0000000000000008ull)
36 (0x0000000000000000ull) 36#define CVMX_PCI_CFG03 (0x000000000000000Cull)
37#define CVMX_PCI_CFG01 \ 37#define CVMX_PCI_CFG04 (0x0000000000000010ull)
38 (0x0000000000000004ull) 38#define CVMX_PCI_CFG05 (0x0000000000000014ull)
39#define CVMX_PCI_CFG02 \ 39#define CVMX_PCI_CFG06 (0x0000000000000018ull)
40 (0x0000000000000008ull) 40#define CVMX_PCI_CFG07 (0x000000000000001Cull)
41#define CVMX_PCI_CFG03 \ 41#define CVMX_PCI_CFG08 (0x0000000000000020ull)
42 (0x000000000000000Cull) 42#define CVMX_PCI_CFG09 (0x0000000000000024ull)
43#define CVMX_PCI_CFG04 \ 43#define CVMX_PCI_CFG10 (0x0000000000000028ull)
44 (0x0000000000000010ull) 44#define CVMX_PCI_CFG11 (0x000000000000002Cull)
45#define CVMX_PCI_CFG05 \ 45#define CVMX_PCI_CFG12 (0x0000000000000030ull)
46 (0x0000000000000014ull) 46#define CVMX_PCI_CFG13 (0x0000000000000034ull)
47#define CVMX_PCI_CFG06 \ 47#define CVMX_PCI_CFG15 (0x000000000000003Cull)
48 (0x0000000000000018ull) 48#define CVMX_PCI_CFG16 (0x0000000000000040ull)
49#define CVMX_PCI_CFG07 \ 49#define CVMX_PCI_CFG17 (0x0000000000000044ull)
50 (0x000000000000001Cull) 50#define CVMX_PCI_CFG18 (0x0000000000000048ull)
51#define CVMX_PCI_CFG08 \ 51#define CVMX_PCI_CFG19 (0x000000000000004Cull)
52 (0x0000000000000020ull) 52#define CVMX_PCI_CFG20 (0x0000000000000050ull)
53#define CVMX_PCI_CFG09 \ 53#define CVMX_PCI_CFG21 (0x0000000000000054ull)
54 (0x0000000000000024ull) 54#define CVMX_PCI_CFG22 (0x0000000000000058ull)
55#define CVMX_PCI_CFG10 \ 55#define CVMX_PCI_CFG56 (0x00000000000000E0ull)
56 (0x0000000000000028ull) 56#define CVMX_PCI_CFG57 (0x00000000000000E4ull)
57#define CVMX_PCI_CFG11 \ 57#define CVMX_PCI_CFG58 (0x00000000000000E8ull)
58 (0x000000000000002Cull) 58#define CVMX_PCI_CFG59 (0x00000000000000ECull)
59#define CVMX_PCI_CFG12 \ 59#define CVMX_PCI_CFG60 (0x00000000000000F0ull)
60 (0x0000000000000030ull) 60#define CVMX_PCI_CFG61 (0x00000000000000F4ull)
61#define CVMX_PCI_CFG13 \ 61#define CVMX_PCI_CFG62 (0x00000000000000F8ull)
62 (0x0000000000000034ull) 62#define CVMX_PCI_CFG63 (0x00000000000000FCull)
63#define CVMX_PCI_CFG15 \ 63#define CVMX_PCI_CNT_REG (0x00000000000001B8ull)
64 (0x000000000000003Cull) 64#define CVMX_PCI_CTL_STATUS_2 (0x000000000000018Cull)
65#define CVMX_PCI_CFG16 \ 65#define CVMX_PCI_DBELL_X(offset) (0x0000000000000080ull + ((offset) & 3) * 8)
66 (0x0000000000000040ull) 66#define CVMX_PCI_DMA_CNT0 CVMX_PCI_DMA_CNTX(0)
67#define CVMX_PCI_CFG17 \ 67#define CVMX_PCI_DMA_CNT1 CVMX_PCI_DMA_CNTX(1)
68 (0x0000000000000044ull) 68#define CVMX_PCI_DMA_CNTX(offset) (0x00000000000000A0ull + ((offset) & 1) * 8)
69#define CVMX_PCI_CFG18 \ 69#define CVMX_PCI_DMA_INT_LEV0 CVMX_PCI_DMA_INT_LEVX(0)
70 (0x0000000000000048ull) 70#define CVMX_PCI_DMA_INT_LEV1 CVMX_PCI_DMA_INT_LEVX(1)
71#define CVMX_PCI_CFG19 \ 71#define CVMX_PCI_DMA_INT_LEVX(offset) (0x00000000000000A4ull + ((offset) & 1) * 8)
72 (0x000000000000004Cull) 72#define CVMX_PCI_DMA_TIME0 CVMX_PCI_DMA_TIMEX(0)
73#define CVMX_PCI_CFG20 \ 73#define CVMX_PCI_DMA_TIME1 CVMX_PCI_DMA_TIMEX(1)
74 (0x0000000000000050ull) 74#define CVMX_PCI_DMA_TIMEX(offset) (0x00000000000000B0ull + ((offset) & 1) * 4)
75#define CVMX_PCI_CFG21 \ 75#define CVMX_PCI_INSTR_COUNT0 CVMX_PCI_INSTR_COUNTX(0)
76 (0x0000000000000054ull) 76#define CVMX_PCI_INSTR_COUNT1 CVMX_PCI_INSTR_COUNTX(1)
77#define CVMX_PCI_CFG22 \ 77#define CVMX_PCI_INSTR_COUNT2 CVMX_PCI_INSTR_COUNTX(2)
78 (0x0000000000000058ull) 78#define CVMX_PCI_INSTR_COUNT3 CVMX_PCI_INSTR_COUNTX(3)
79#define CVMX_PCI_CFG56 \ 79#define CVMX_PCI_INSTR_COUNTX(offset) (0x0000000000000084ull + ((offset) & 3) * 8)
80 (0x00000000000000E0ull) 80#define CVMX_PCI_INT_ENB (0x0000000000000038ull)
81#define CVMX_PCI_CFG57 \ 81#define CVMX_PCI_INT_ENB2 (0x00000000000001A0ull)
82 (0x00000000000000E4ull) 82#define CVMX_PCI_INT_SUM (0x0000000000000030ull)
83#define CVMX_PCI_CFG58 \ 83#define CVMX_PCI_INT_SUM2 (0x0000000000000198ull)
84 (0x00000000000000E8ull) 84#define CVMX_PCI_MSI_RCV (0x00000000000000F0ull)
85#define CVMX_PCI_CFG59 \ 85#define CVMX_PCI_PKTS_SENT0 CVMX_PCI_PKTS_SENTX(0)
86 (0x00000000000000ECull) 86#define CVMX_PCI_PKTS_SENT1 CVMX_PCI_PKTS_SENTX(1)
87#define CVMX_PCI_CFG60 \ 87#define CVMX_PCI_PKTS_SENT2 CVMX_PCI_PKTS_SENTX(2)
88 (0x00000000000000F0ull) 88#define CVMX_PCI_PKTS_SENT3 CVMX_PCI_PKTS_SENTX(3)
89#define CVMX_PCI_CFG61 \ 89#define CVMX_PCI_PKTS_SENTX(offset) (0x0000000000000040ull + ((offset) & 3) * 16)
90 (0x00000000000000F4ull) 90#define CVMX_PCI_PKTS_SENT_INT_LEV0 CVMX_PCI_PKTS_SENT_INT_LEVX(0)
91#define CVMX_PCI_CFG62 \ 91#define CVMX_PCI_PKTS_SENT_INT_LEV1 CVMX_PCI_PKTS_SENT_INT_LEVX(1)
92 (0x00000000000000F8ull) 92#define CVMX_PCI_PKTS_SENT_INT_LEV2 CVMX_PCI_PKTS_SENT_INT_LEVX(2)
93#define CVMX_PCI_CFG63 \ 93#define CVMX_PCI_PKTS_SENT_INT_LEV3 CVMX_PCI_PKTS_SENT_INT_LEVX(3)
94 (0x00000000000000FCull) 94#define CVMX_PCI_PKTS_SENT_INT_LEVX(offset) (0x0000000000000048ull + ((offset) & 3) * 16)
95#define CVMX_PCI_CNT_REG \ 95#define CVMX_PCI_PKTS_SENT_TIME0 CVMX_PCI_PKTS_SENT_TIMEX(0)
96 (0x00000000000001B8ull) 96#define CVMX_PCI_PKTS_SENT_TIME1 CVMX_PCI_PKTS_SENT_TIMEX(1)
97#define CVMX_PCI_CTL_STATUS_2 \ 97#define CVMX_PCI_PKTS_SENT_TIME2 CVMX_PCI_PKTS_SENT_TIMEX(2)
98 (0x000000000000018Cull) 98#define CVMX_PCI_PKTS_SENT_TIME3 CVMX_PCI_PKTS_SENT_TIMEX(3)
99#define CVMX_PCI_DBELL_0 \ 99#define CVMX_PCI_PKTS_SENT_TIMEX(offset) (0x000000000000004Cull + ((offset) & 3) * 16)
100 (0x0000000000000080ull) 100#define CVMX_PCI_PKT_CREDITS0 CVMX_PCI_PKT_CREDITSX(0)
101#define CVMX_PCI_DBELL_1 \ 101#define CVMX_PCI_PKT_CREDITS1 CVMX_PCI_PKT_CREDITSX(1)
102 (0x0000000000000088ull) 102#define CVMX_PCI_PKT_CREDITS2 CVMX_PCI_PKT_CREDITSX(2)
103#define CVMX_PCI_DBELL_2 \ 103#define CVMX_PCI_PKT_CREDITS3 CVMX_PCI_PKT_CREDITSX(3)
104 (0x0000000000000090ull) 104#define CVMX_PCI_PKT_CREDITSX(offset) (0x0000000000000044ull + ((offset) & 3) * 16)
105#define CVMX_PCI_DBELL_3 \ 105#define CVMX_PCI_READ_CMD_6 (0x0000000000000180ull)
106 (0x0000000000000098ull) 106#define CVMX_PCI_READ_CMD_C (0x0000000000000184ull)
107#define CVMX_PCI_DBELL_X(offset) \ 107#define CVMX_PCI_READ_CMD_E (0x0000000000000188ull)
108 (0x0000000000000080ull + (((offset) & 3) * 8)) 108#define CVMX_PCI_READ_TIMEOUT (CVMX_ADD_IO_SEG(0x00011F00000000B0ull))
109#define CVMX_PCI_DMA_CNT0 \ 109#define CVMX_PCI_SCM_REG (0x00000000000001A8ull)
110 (0x00000000000000A0ull) 110#define CVMX_PCI_TSR_REG (0x00000000000001B0ull)
111#define CVMX_PCI_DMA_CNT1 \ 111#define CVMX_PCI_WIN_RD_ADDR (0x0000000000000008ull)
112 (0x00000000000000A8ull) 112#define CVMX_PCI_WIN_RD_DATA (0x0000000000000020ull)
113#define CVMX_PCI_DMA_CNTX(offset) \ 113#define CVMX_PCI_WIN_WR_ADDR (0x0000000000000000ull)
114 (0x00000000000000A0ull + (((offset) & 1) * 8)) 114#define CVMX_PCI_WIN_WR_DATA (0x0000000000000010ull)
115#define CVMX_PCI_DMA_INT_LEV0 \ 115#define CVMX_PCI_WIN_WR_MASK (0x0000000000000018ull)
116 (0x00000000000000A4ull)
117#define CVMX_PCI_DMA_INT_LEV1 \
118 (0x00000000000000ACull)
119#define CVMX_PCI_DMA_INT_LEVX(offset) \
120 (0x00000000000000A4ull + (((offset) & 1) * 8))
121#define CVMX_PCI_DMA_TIME0 \
122 (0x00000000000000B0ull)
123#define CVMX_PCI_DMA_TIME1 \
124 (0x00000000000000B4ull)
125#define CVMX_PCI_DMA_TIMEX(offset) \
126 (0x00000000000000B0ull + (((offset) & 1) * 4))
127#define CVMX_PCI_INSTR_COUNT0 \
128 (0x0000000000000084ull)
129#define CVMX_PCI_INSTR_COUNT1 \
130 (0x000000000000008Cull)
131#define CVMX_PCI_INSTR_COUNT2 \
132 (0x0000000000000094ull)
133#define CVMX_PCI_INSTR_COUNT3 \
134 (0x000000000000009Cull)
135#define CVMX_PCI_INSTR_COUNTX(offset) \
136 (0x0000000000000084ull + (((offset) & 3) * 8))
137#define CVMX_PCI_INT_ENB \
138 (0x0000000000000038ull)
139#define CVMX_PCI_INT_ENB2 \
140 (0x00000000000001A0ull)
141#define CVMX_PCI_INT_SUM \
142 (0x0000000000000030ull)
143#define CVMX_PCI_INT_SUM2 \
144 (0x0000000000000198ull)
145#define CVMX_PCI_MSI_RCV \
146 (0x00000000000000F0ull)
147#define CVMX_PCI_PKTS_SENT0 \
148 (0x0000000000000040ull)
149#define CVMX_PCI_PKTS_SENT1 \
150 (0x0000000000000050ull)
151#define CVMX_PCI_PKTS_SENT2 \
152 (0x0000000000000060ull)
153#define CVMX_PCI_PKTS_SENT3 \
154 (0x0000000000000070ull)
155#define CVMX_PCI_PKTS_SENTX(offset) \
156 (0x0000000000000040ull + (((offset) & 3) * 16))
157#define CVMX_PCI_PKTS_SENT_INT_LEV0 \
158 (0x0000000000000048ull)
159#define CVMX_PCI_PKTS_SENT_INT_LEV1 \
160 (0x0000000000000058ull)
161#define CVMX_PCI_PKTS_SENT_INT_LEV2 \
162 (0x0000000000000068ull)
163#define CVMX_PCI_PKTS_SENT_INT_LEV3 \
164 (0x0000000000000078ull)
165#define CVMX_PCI_PKTS_SENT_INT_LEVX(offset) \
166 (0x0000000000000048ull + (((offset) & 3) * 16))
167#define CVMX_PCI_PKTS_SENT_TIME0 \
168 (0x000000000000004Cull)
169#define CVMX_PCI_PKTS_SENT_TIME1 \
170 (0x000000000000005Cull)
171#define CVMX_PCI_PKTS_SENT_TIME2 \
172 (0x000000000000006Cull)
173#define CVMX_PCI_PKTS_SENT_TIME3 \
174 (0x000000000000007Cull)
175#define CVMX_PCI_PKTS_SENT_TIMEX(offset) \
176 (0x000000000000004Cull + (((offset) & 3) * 16))
177#define CVMX_PCI_PKT_CREDITS0 \
178 (0x0000000000000044ull)
179#define CVMX_PCI_PKT_CREDITS1 \
180 (0x0000000000000054ull)
181#define CVMX_PCI_PKT_CREDITS2 \
182 (0x0000000000000064ull)
183#define CVMX_PCI_PKT_CREDITS3 \
184 (0x0000000000000074ull)
185#define CVMX_PCI_PKT_CREDITSX(offset) \
186 (0x0000000000000044ull + (((offset) & 3) * 16))
187#define CVMX_PCI_READ_CMD_6 \
188 (0x0000000000000180ull)
189#define CVMX_PCI_READ_CMD_C \
190 (0x0000000000000184ull)
191#define CVMX_PCI_READ_CMD_E \
192 (0x0000000000000188ull)
193#define CVMX_PCI_READ_TIMEOUT \
194 CVMX_ADD_IO_SEG(0x00011F00000000B0ull)
195#define CVMX_PCI_SCM_REG \
196 (0x00000000000001A8ull)
197#define CVMX_PCI_TSR_REG \
198 (0x00000000000001B0ull)
199#define CVMX_PCI_WIN_RD_ADDR \
200 (0x0000000000000008ull)
201#define CVMX_PCI_WIN_RD_DATA \
202 (0x0000000000000020ull)
203#define CVMX_PCI_WIN_WR_ADDR \
204 (0x0000000000000000ull)
205#define CVMX_PCI_WIN_WR_DATA \
206 (0x0000000000000010ull)
207#define CVMX_PCI_WIN_WR_MASK \
208 (0x0000000000000018ull)
209 116
210union cvmx_pci_bar1_indexx { 117union cvmx_pci_bar1_indexx {
211 uint32_t u32; 118 uint32_t u32;
diff --git a/arch/mips/include/asm/octeon/cvmx-pciercx-defs.h b/arch/mips/include/asm/octeon/cvmx-pciercx-defs.h
index 75574c918942..f8cb88902efb 100644
--- a/arch/mips/include/asm/octeon/cvmx-pciercx-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-pciercx-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,158 +28,83 @@
28#ifndef __CVMX_PCIERCX_DEFS_H__ 28#ifndef __CVMX_PCIERCX_DEFS_H__
29#define __CVMX_PCIERCX_DEFS_H__ 29#define __CVMX_PCIERCX_DEFS_H__
30 30
31#define CVMX_PCIERCX_CFG000(offset) \ 31#define CVMX_PCIERCX_CFG000(block_id) (0x0000000000000000ull)
32 (0x0000000000000000ull + (((offset) & 1) * 0)) 32#define CVMX_PCIERCX_CFG001(block_id) (0x0000000000000004ull)
33#define CVMX_PCIERCX_CFG001(offset) \ 33#define CVMX_PCIERCX_CFG002(block_id) (0x0000000000000008ull)
34 (0x0000000000000004ull + (((offset) & 1) * 0)) 34#define CVMX_PCIERCX_CFG003(block_id) (0x000000000000000Cull)
35#define CVMX_PCIERCX_CFG002(offset) \ 35#define CVMX_PCIERCX_CFG004(block_id) (0x0000000000000010ull)
36 (0x0000000000000008ull + (((offset) & 1) * 0)) 36#define CVMX_PCIERCX_CFG005(block_id) (0x0000000000000014ull)
37#define CVMX_PCIERCX_CFG003(offset) \ 37#define CVMX_PCIERCX_CFG006(block_id) (0x0000000000000018ull)
38 (0x000000000000000Cull + (((offset) & 1) * 0)) 38#define CVMX_PCIERCX_CFG007(block_id) (0x000000000000001Cull)
39#define CVMX_PCIERCX_CFG004(offset) \ 39#define CVMX_PCIERCX_CFG008(block_id) (0x0000000000000020ull)
40 (0x0000000000000010ull + (((offset) & 1) * 0)) 40#define CVMX_PCIERCX_CFG009(block_id) (0x0000000000000024ull)
41#define CVMX_PCIERCX_CFG005(offset) \ 41#define CVMX_PCIERCX_CFG010(block_id) (0x0000000000000028ull)
42 (0x0000000000000014ull + (((offset) & 1) * 0)) 42#define CVMX_PCIERCX_CFG011(block_id) (0x000000000000002Cull)
43#define CVMX_PCIERCX_CFG006(offset) \ 43#define CVMX_PCIERCX_CFG012(block_id) (0x0000000000000030ull)
44 (0x0000000000000018ull + (((offset) & 1) * 0)) 44#define CVMX_PCIERCX_CFG013(block_id) (0x0000000000000034ull)
45#define CVMX_PCIERCX_CFG007(offset) \ 45#define CVMX_PCIERCX_CFG014(block_id) (0x0000000000000038ull)
46 (0x000000000000001Cull + (((offset) & 1) * 0)) 46#define CVMX_PCIERCX_CFG015(block_id) (0x000000000000003Cull)
47#define CVMX_PCIERCX_CFG008(offset) \ 47#define CVMX_PCIERCX_CFG016(block_id) (0x0000000000000040ull)
48 (0x0000000000000020ull + (((offset) & 1) * 0)) 48#define CVMX_PCIERCX_CFG017(block_id) (0x0000000000000044ull)
49#define CVMX_PCIERCX_CFG009(offset) \ 49#define CVMX_PCIERCX_CFG020(block_id) (0x0000000000000050ull)
50 (0x0000000000000024ull + (((offset) & 1) * 0)) 50#define CVMX_PCIERCX_CFG021(block_id) (0x0000000000000054ull)
51#define CVMX_PCIERCX_CFG010(offset) \ 51#define CVMX_PCIERCX_CFG022(block_id) (0x0000000000000058ull)
52 (0x0000000000000028ull + (((offset) & 1) * 0)) 52#define CVMX_PCIERCX_CFG023(block_id) (0x000000000000005Cull)
53#define CVMX_PCIERCX_CFG011(offset) \ 53#define CVMX_PCIERCX_CFG028(block_id) (0x0000000000000070ull)
54 (0x000000000000002Cull + (((offset) & 1) * 0)) 54#define CVMX_PCIERCX_CFG029(block_id) (0x0000000000000074ull)
55#define CVMX_PCIERCX_CFG012(offset) \ 55#define CVMX_PCIERCX_CFG030(block_id) (0x0000000000000078ull)
56 (0x0000000000000030ull + (((offset) & 1) * 0)) 56#define CVMX_PCIERCX_CFG031(block_id) (0x000000000000007Cull)
57#define CVMX_PCIERCX_CFG013(offset) \ 57#define CVMX_PCIERCX_CFG032(block_id) (0x0000000000000080ull)
58 (0x0000000000000034ull + (((offset) & 1) * 0)) 58#define CVMX_PCIERCX_CFG033(block_id) (0x0000000000000084ull)
59#define CVMX_PCIERCX_CFG014(offset) \ 59#define CVMX_PCIERCX_CFG034(block_id) (0x0000000000000088ull)
60 (0x0000000000000038ull + (((offset) & 1) * 0)) 60#define CVMX_PCIERCX_CFG035(block_id) (0x000000000000008Cull)
61#define CVMX_PCIERCX_CFG015(offset) \ 61#define CVMX_PCIERCX_CFG036(block_id) (0x0000000000000090ull)
62 (0x000000000000003Cull + (((offset) & 1) * 0)) 62#define CVMX_PCIERCX_CFG037(block_id) (0x0000000000000094ull)
63#define CVMX_PCIERCX_CFG016(offset) \ 63#define CVMX_PCIERCX_CFG038(block_id) (0x0000000000000098ull)
64 (0x0000000000000040ull + (((offset) & 1) * 0)) 64#define CVMX_PCIERCX_CFG039(block_id) (0x000000000000009Cull)
65#define CVMX_PCIERCX_CFG017(offset) \ 65#define CVMX_PCIERCX_CFG040(block_id) (0x00000000000000A0ull)
66 (0x0000000000000044ull + (((offset) & 1) * 0)) 66#define CVMX_PCIERCX_CFG041(block_id) (0x00000000000000A4ull)
67#define CVMX_PCIERCX_CFG020(offset) \ 67#define CVMX_PCIERCX_CFG042(block_id) (0x00000000000000A8ull)
68 (0x0000000000000050ull + (((offset) & 1) * 0)) 68#define CVMX_PCIERCX_CFG064(block_id) (0x0000000000000100ull)
69#define CVMX_PCIERCX_CFG021(offset) \ 69#define CVMX_PCIERCX_CFG065(block_id) (0x0000000000000104ull)
70 (0x0000000000000054ull + (((offset) & 1) * 0)) 70#define CVMX_PCIERCX_CFG066(block_id) (0x0000000000000108ull)
71#define CVMX_PCIERCX_CFG022(offset) \ 71#define CVMX_PCIERCX_CFG067(block_id) (0x000000000000010Cull)
72 (0x0000000000000058ull + (((offset) & 1) * 0)) 72#define CVMX_PCIERCX_CFG068(block_id) (0x0000000000000110ull)
73#define CVMX_PCIERCX_CFG023(offset) \ 73#define CVMX_PCIERCX_CFG069(block_id) (0x0000000000000114ull)
74 (0x000000000000005Cull + (((offset) & 1) * 0)) 74#define CVMX_PCIERCX_CFG070(block_id) (0x0000000000000118ull)
75#define CVMX_PCIERCX_CFG028(offset) \ 75#define CVMX_PCIERCX_CFG071(block_id) (0x000000000000011Cull)
76 (0x0000000000000070ull + (((offset) & 1) * 0)) 76#define CVMX_PCIERCX_CFG072(block_id) (0x0000000000000120ull)
77#define CVMX_PCIERCX_CFG029(offset) \ 77#define CVMX_PCIERCX_CFG073(block_id) (0x0000000000000124ull)
78 (0x0000000000000074ull + (((offset) & 1) * 0)) 78#define CVMX_PCIERCX_CFG074(block_id) (0x0000000000000128ull)
79#define CVMX_PCIERCX_CFG030(offset) \ 79#define CVMX_PCIERCX_CFG075(block_id) (0x000000000000012Cull)
80 (0x0000000000000078ull + (((offset) & 1) * 0)) 80#define CVMX_PCIERCX_CFG076(block_id) (0x0000000000000130ull)
81#define CVMX_PCIERCX_CFG031(offset) \ 81#define CVMX_PCIERCX_CFG077(block_id) (0x0000000000000134ull)
82 (0x000000000000007Cull + (((offset) & 1) * 0)) 82#define CVMX_PCIERCX_CFG448(block_id) (0x0000000000000700ull)
83#define CVMX_PCIERCX_CFG032(offset) \ 83#define CVMX_PCIERCX_CFG449(block_id) (0x0000000000000704ull)
84 (0x0000000000000080ull + (((offset) & 1) * 0)) 84#define CVMX_PCIERCX_CFG450(block_id) (0x0000000000000708ull)
85#define CVMX_PCIERCX_CFG033(offset) \ 85#define CVMX_PCIERCX_CFG451(block_id) (0x000000000000070Cull)
86 (0x0000000000000084ull + (((offset) & 1) * 0)) 86#define CVMX_PCIERCX_CFG452(block_id) (0x0000000000000710ull)
87#define CVMX_PCIERCX_CFG034(offset) \ 87#define CVMX_PCIERCX_CFG453(block_id) (0x0000000000000714ull)
88 (0x0000000000000088ull + (((offset) & 1) * 0)) 88#define CVMX_PCIERCX_CFG454(block_id) (0x0000000000000718ull)
89#define CVMX_PCIERCX_CFG035(offset) \ 89#define CVMX_PCIERCX_CFG455(block_id) (0x000000000000071Cull)
90 (0x000000000000008Cull + (((offset) & 1) * 0)) 90#define CVMX_PCIERCX_CFG456(block_id) (0x0000000000000720ull)
91#define CVMX_PCIERCX_CFG036(offset) \ 91#define CVMX_PCIERCX_CFG458(block_id) (0x0000000000000728ull)
92 (0x0000000000000090ull + (((offset) & 1) * 0)) 92#define CVMX_PCIERCX_CFG459(block_id) (0x000000000000072Cull)
93#define CVMX_PCIERCX_CFG037(offset) \ 93#define CVMX_PCIERCX_CFG460(block_id) (0x0000000000000730ull)
94 (0x0000000000000094ull + (((offset) & 1) * 0)) 94#define CVMX_PCIERCX_CFG461(block_id) (0x0000000000000734ull)
95#define CVMX_PCIERCX_CFG038(offset) \ 95#define CVMX_PCIERCX_CFG462(block_id) (0x0000000000000738ull)
96 (0x0000000000000098ull + (((offset) & 1) * 0)) 96#define CVMX_PCIERCX_CFG463(block_id) (0x000000000000073Cull)
97#define CVMX_PCIERCX_CFG039(offset) \ 97#define CVMX_PCIERCX_CFG464(block_id) (0x0000000000000740ull)
98 (0x000000000000009Cull + (((offset) & 1) * 0)) 98#define CVMX_PCIERCX_CFG465(block_id) (0x0000000000000744ull)
99#define CVMX_PCIERCX_CFG040(offset) \ 99#define CVMX_PCIERCX_CFG466(block_id) (0x0000000000000748ull)
100 (0x00000000000000A0ull + (((offset) & 1) * 0)) 100#define CVMX_PCIERCX_CFG467(block_id) (0x000000000000074Cull)
101#define CVMX_PCIERCX_CFG041(offset) \ 101#define CVMX_PCIERCX_CFG468(block_id) (0x0000000000000750ull)
102 (0x00000000000000A4ull + (((offset) & 1) * 0)) 102#define CVMX_PCIERCX_CFG490(block_id) (0x00000000000007A8ull)
103#define CVMX_PCIERCX_CFG042(offset) \ 103#define CVMX_PCIERCX_CFG491(block_id) (0x00000000000007ACull)
104 (0x00000000000000A8ull + (((offset) & 1) * 0)) 104#define CVMX_PCIERCX_CFG492(block_id) (0x00000000000007B0ull)
105#define CVMX_PCIERCX_CFG064(offset) \ 105#define CVMX_PCIERCX_CFG515(block_id) (0x000000000000080Cull)
106 (0x0000000000000100ull + (((offset) & 1) * 0)) 106#define CVMX_PCIERCX_CFG516(block_id) (0x0000000000000810ull)
107#define CVMX_PCIERCX_CFG065(offset) \ 107#define CVMX_PCIERCX_CFG517(block_id) (0x0000000000000814ull)
108 (0x0000000000000104ull + (((offset) & 1) * 0))
109#define CVMX_PCIERCX_CFG066(offset) \
110 (0x0000000000000108ull + (((offset) & 1) * 0))
111#define CVMX_PCIERCX_CFG067(offset) \
112 (0x000000000000010Cull + (((offset) & 1) * 0))
113#define CVMX_PCIERCX_CFG068(offset) \
114 (0x0000000000000110ull + (((offset) & 1) * 0))
115#define CVMX_PCIERCX_CFG069(offset) \
116 (0x0000000000000114ull + (((offset) & 1) * 0))
117#define CVMX_PCIERCX_CFG070(offset) \
118 (0x0000000000000118ull + (((offset) & 1) * 0))
119#define CVMX_PCIERCX_CFG071(offset) \
120 (0x000000000000011Cull + (((offset) & 1) * 0))
121#define CVMX_PCIERCX_CFG072(offset) \
122 (0x0000000000000120ull + (((offset) & 1) * 0))
123#define CVMX_PCIERCX_CFG073(offset) \
124 (0x0000000000000124ull + (((offset) & 1) * 0))
125#define CVMX_PCIERCX_CFG074(offset) \
126 (0x0000000000000128ull + (((offset) & 1) * 0))
127#define CVMX_PCIERCX_CFG075(offset) \
128 (0x000000000000012Cull + (((offset) & 1) * 0))
129#define CVMX_PCIERCX_CFG076(offset) \
130 (0x0000000000000130ull + (((offset) & 1) * 0))
131#define CVMX_PCIERCX_CFG077(offset) \
132 (0x0000000000000134ull + (((offset) & 1) * 0))
133#define CVMX_PCIERCX_CFG448(offset) \
134 (0x0000000000000700ull + (((offset) & 1) * 0))
135#define CVMX_PCIERCX_CFG449(offset) \
136 (0x0000000000000704ull + (((offset) & 1) * 0))
137#define CVMX_PCIERCX_CFG450(offset) \
138 (0x0000000000000708ull + (((offset) & 1) * 0))
139#define CVMX_PCIERCX_CFG451(offset) \
140 (0x000000000000070Cull + (((offset) & 1) * 0))
141#define CVMX_PCIERCX_CFG452(offset) \
142 (0x0000000000000710ull + (((offset) & 1) * 0))
143#define CVMX_PCIERCX_CFG453(offset) \
144 (0x0000000000000714ull + (((offset) & 1) * 0))
145#define CVMX_PCIERCX_CFG454(offset) \
146 (0x0000000000000718ull + (((offset) & 1) * 0))
147#define CVMX_PCIERCX_CFG455(offset) \
148 (0x000000000000071Cull + (((offset) & 1) * 0))
149#define CVMX_PCIERCX_CFG456(offset) \
150 (0x0000000000000720ull + (((offset) & 1) * 0))
151#define CVMX_PCIERCX_CFG458(offset) \
152 (0x0000000000000728ull + (((offset) & 1) * 0))
153#define CVMX_PCIERCX_CFG459(offset) \
154 (0x000000000000072Cull + (((offset) & 1) * 0))
155#define CVMX_PCIERCX_CFG460(offset) \
156 (0x0000000000000730ull + (((offset) & 1) * 0))
157#define CVMX_PCIERCX_CFG461(offset) \
158 (0x0000000000000734ull + (((offset) & 1) * 0))
159#define CVMX_PCIERCX_CFG462(offset) \
160 (0x0000000000000738ull + (((offset) & 1) * 0))
161#define CVMX_PCIERCX_CFG463(offset) \
162 (0x000000000000073Cull + (((offset) & 1) * 0))
163#define CVMX_PCIERCX_CFG464(offset) \
164 (0x0000000000000740ull + (((offset) & 1) * 0))
165#define CVMX_PCIERCX_CFG465(offset) \
166 (0x0000000000000744ull + (((offset) & 1) * 0))
167#define CVMX_PCIERCX_CFG466(offset) \
168 (0x0000000000000748ull + (((offset) & 1) * 0))
169#define CVMX_PCIERCX_CFG467(offset) \
170 (0x000000000000074Cull + (((offset) & 1) * 0))
171#define CVMX_PCIERCX_CFG468(offset) \
172 (0x0000000000000750ull + (((offset) & 1) * 0))
173#define CVMX_PCIERCX_CFG490(offset) \
174 (0x00000000000007A8ull + (((offset) & 1) * 0))
175#define CVMX_PCIERCX_CFG491(offset) \
176 (0x00000000000007ACull + (((offset) & 1) * 0))
177#define CVMX_PCIERCX_CFG492(offset) \
178 (0x00000000000007B0ull + (((offset) & 1) * 0))
179#define CVMX_PCIERCX_CFG516(offset) \
180 (0x0000000000000810ull + (((offset) & 1) * 0))
181#define CVMX_PCIERCX_CFG517(offset) \
182 (0x0000000000000814ull + (((offset) & 1) * 0))
183 108
184union cvmx_pciercx_cfg000 { 109union cvmx_pciercx_cfg000 {
185 uint32_t u32; 110 uint32_t u32;
@@ -191,6 +116,8 @@ union cvmx_pciercx_cfg000 {
191 struct cvmx_pciercx_cfg000_s cn52xxp1; 116 struct cvmx_pciercx_cfg000_s cn52xxp1;
192 struct cvmx_pciercx_cfg000_s cn56xx; 117 struct cvmx_pciercx_cfg000_s cn56xx;
193 struct cvmx_pciercx_cfg000_s cn56xxp1; 118 struct cvmx_pciercx_cfg000_s cn56xxp1;
119 struct cvmx_pciercx_cfg000_s cn63xx;
120 struct cvmx_pciercx_cfg000_s cn63xxp1;
194}; 121};
195 122
196union cvmx_pciercx_cfg001 { 123union cvmx_pciercx_cfg001 {
@@ -225,6 +152,8 @@ union cvmx_pciercx_cfg001 {
225 struct cvmx_pciercx_cfg001_s cn52xxp1; 152 struct cvmx_pciercx_cfg001_s cn52xxp1;
226 struct cvmx_pciercx_cfg001_s cn56xx; 153 struct cvmx_pciercx_cfg001_s cn56xx;
227 struct cvmx_pciercx_cfg001_s cn56xxp1; 154 struct cvmx_pciercx_cfg001_s cn56xxp1;
155 struct cvmx_pciercx_cfg001_s cn63xx;
156 struct cvmx_pciercx_cfg001_s cn63xxp1;
228}; 157};
229 158
230union cvmx_pciercx_cfg002 { 159union cvmx_pciercx_cfg002 {
@@ -239,6 +168,8 @@ union cvmx_pciercx_cfg002 {
239 struct cvmx_pciercx_cfg002_s cn52xxp1; 168 struct cvmx_pciercx_cfg002_s cn52xxp1;
240 struct cvmx_pciercx_cfg002_s cn56xx; 169 struct cvmx_pciercx_cfg002_s cn56xx;
241 struct cvmx_pciercx_cfg002_s cn56xxp1; 170 struct cvmx_pciercx_cfg002_s cn56xxp1;
171 struct cvmx_pciercx_cfg002_s cn63xx;
172 struct cvmx_pciercx_cfg002_s cn63xxp1;
242}; 173};
243 174
244union cvmx_pciercx_cfg003 { 175union cvmx_pciercx_cfg003 {
@@ -254,6 +185,8 @@ union cvmx_pciercx_cfg003 {
254 struct cvmx_pciercx_cfg003_s cn52xxp1; 185 struct cvmx_pciercx_cfg003_s cn52xxp1;
255 struct cvmx_pciercx_cfg003_s cn56xx; 186 struct cvmx_pciercx_cfg003_s cn56xx;
256 struct cvmx_pciercx_cfg003_s cn56xxp1; 187 struct cvmx_pciercx_cfg003_s cn56xxp1;
188 struct cvmx_pciercx_cfg003_s cn63xx;
189 struct cvmx_pciercx_cfg003_s cn63xxp1;
257}; 190};
258 191
259union cvmx_pciercx_cfg004 { 192union cvmx_pciercx_cfg004 {
@@ -265,6 +198,8 @@ union cvmx_pciercx_cfg004 {
265 struct cvmx_pciercx_cfg004_s cn52xxp1; 198 struct cvmx_pciercx_cfg004_s cn52xxp1;
266 struct cvmx_pciercx_cfg004_s cn56xx; 199 struct cvmx_pciercx_cfg004_s cn56xx;
267 struct cvmx_pciercx_cfg004_s cn56xxp1; 200 struct cvmx_pciercx_cfg004_s cn56xxp1;
201 struct cvmx_pciercx_cfg004_s cn63xx;
202 struct cvmx_pciercx_cfg004_s cn63xxp1;
268}; 203};
269 204
270union cvmx_pciercx_cfg005 { 205union cvmx_pciercx_cfg005 {
@@ -276,6 +211,8 @@ union cvmx_pciercx_cfg005 {
276 struct cvmx_pciercx_cfg005_s cn52xxp1; 211 struct cvmx_pciercx_cfg005_s cn52xxp1;
277 struct cvmx_pciercx_cfg005_s cn56xx; 212 struct cvmx_pciercx_cfg005_s cn56xx;
278 struct cvmx_pciercx_cfg005_s cn56xxp1; 213 struct cvmx_pciercx_cfg005_s cn56xxp1;
214 struct cvmx_pciercx_cfg005_s cn63xx;
215 struct cvmx_pciercx_cfg005_s cn63xxp1;
279}; 216};
280 217
281union cvmx_pciercx_cfg006 { 218union cvmx_pciercx_cfg006 {
@@ -290,6 +227,8 @@ union cvmx_pciercx_cfg006 {
290 struct cvmx_pciercx_cfg006_s cn52xxp1; 227 struct cvmx_pciercx_cfg006_s cn52xxp1;
291 struct cvmx_pciercx_cfg006_s cn56xx; 228 struct cvmx_pciercx_cfg006_s cn56xx;
292 struct cvmx_pciercx_cfg006_s cn56xxp1; 229 struct cvmx_pciercx_cfg006_s cn56xxp1;
230 struct cvmx_pciercx_cfg006_s cn63xx;
231 struct cvmx_pciercx_cfg006_s cn63xxp1;
293}; 232};
294 233
295union cvmx_pciercx_cfg007 { 234union cvmx_pciercx_cfg007 {
@@ -317,6 +256,8 @@ union cvmx_pciercx_cfg007 {
317 struct cvmx_pciercx_cfg007_s cn52xxp1; 256 struct cvmx_pciercx_cfg007_s cn52xxp1;
318 struct cvmx_pciercx_cfg007_s cn56xx; 257 struct cvmx_pciercx_cfg007_s cn56xx;
319 struct cvmx_pciercx_cfg007_s cn56xxp1; 258 struct cvmx_pciercx_cfg007_s cn56xxp1;
259 struct cvmx_pciercx_cfg007_s cn63xx;
260 struct cvmx_pciercx_cfg007_s cn63xxp1;
320}; 261};
321 262
322union cvmx_pciercx_cfg008 { 263union cvmx_pciercx_cfg008 {
@@ -331,6 +272,8 @@ union cvmx_pciercx_cfg008 {
331 struct cvmx_pciercx_cfg008_s cn52xxp1; 272 struct cvmx_pciercx_cfg008_s cn52xxp1;
332 struct cvmx_pciercx_cfg008_s cn56xx; 273 struct cvmx_pciercx_cfg008_s cn56xx;
333 struct cvmx_pciercx_cfg008_s cn56xxp1; 274 struct cvmx_pciercx_cfg008_s cn56xxp1;
275 struct cvmx_pciercx_cfg008_s cn63xx;
276 struct cvmx_pciercx_cfg008_s cn63xxp1;
334}; 277};
335 278
336union cvmx_pciercx_cfg009 { 279union cvmx_pciercx_cfg009 {
@@ -347,6 +290,8 @@ union cvmx_pciercx_cfg009 {
347 struct cvmx_pciercx_cfg009_s cn52xxp1; 290 struct cvmx_pciercx_cfg009_s cn52xxp1;
348 struct cvmx_pciercx_cfg009_s cn56xx; 291 struct cvmx_pciercx_cfg009_s cn56xx;
349 struct cvmx_pciercx_cfg009_s cn56xxp1; 292 struct cvmx_pciercx_cfg009_s cn56xxp1;
293 struct cvmx_pciercx_cfg009_s cn63xx;
294 struct cvmx_pciercx_cfg009_s cn63xxp1;
350}; 295};
351 296
352union cvmx_pciercx_cfg010 { 297union cvmx_pciercx_cfg010 {
@@ -358,6 +303,8 @@ union cvmx_pciercx_cfg010 {
358 struct cvmx_pciercx_cfg010_s cn52xxp1; 303 struct cvmx_pciercx_cfg010_s cn52xxp1;
359 struct cvmx_pciercx_cfg010_s cn56xx; 304 struct cvmx_pciercx_cfg010_s cn56xx;
360 struct cvmx_pciercx_cfg010_s cn56xxp1; 305 struct cvmx_pciercx_cfg010_s cn56xxp1;
306 struct cvmx_pciercx_cfg010_s cn63xx;
307 struct cvmx_pciercx_cfg010_s cn63xxp1;
361}; 308};
362 309
363union cvmx_pciercx_cfg011 { 310union cvmx_pciercx_cfg011 {
@@ -369,6 +316,8 @@ union cvmx_pciercx_cfg011 {
369 struct cvmx_pciercx_cfg011_s cn52xxp1; 316 struct cvmx_pciercx_cfg011_s cn52xxp1;
370 struct cvmx_pciercx_cfg011_s cn56xx; 317 struct cvmx_pciercx_cfg011_s cn56xx;
371 struct cvmx_pciercx_cfg011_s cn56xxp1; 318 struct cvmx_pciercx_cfg011_s cn56xxp1;
319 struct cvmx_pciercx_cfg011_s cn63xx;
320 struct cvmx_pciercx_cfg011_s cn63xxp1;
372}; 321};
373 322
374union cvmx_pciercx_cfg012 { 323union cvmx_pciercx_cfg012 {
@@ -381,6 +330,8 @@ union cvmx_pciercx_cfg012 {
381 struct cvmx_pciercx_cfg012_s cn52xxp1; 330 struct cvmx_pciercx_cfg012_s cn52xxp1;
382 struct cvmx_pciercx_cfg012_s cn56xx; 331 struct cvmx_pciercx_cfg012_s cn56xx;
383 struct cvmx_pciercx_cfg012_s cn56xxp1; 332 struct cvmx_pciercx_cfg012_s cn56xxp1;
333 struct cvmx_pciercx_cfg012_s cn63xx;
334 struct cvmx_pciercx_cfg012_s cn63xxp1;
384}; 335};
385 336
386union cvmx_pciercx_cfg013 { 337union cvmx_pciercx_cfg013 {
@@ -393,6 +344,8 @@ union cvmx_pciercx_cfg013 {
393 struct cvmx_pciercx_cfg013_s cn52xxp1; 344 struct cvmx_pciercx_cfg013_s cn52xxp1;
394 struct cvmx_pciercx_cfg013_s cn56xx; 345 struct cvmx_pciercx_cfg013_s cn56xx;
395 struct cvmx_pciercx_cfg013_s cn56xxp1; 346 struct cvmx_pciercx_cfg013_s cn56xxp1;
347 struct cvmx_pciercx_cfg013_s cn63xx;
348 struct cvmx_pciercx_cfg013_s cn63xxp1;
396}; 349};
397 350
398union cvmx_pciercx_cfg014 { 351union cvmx_pciercx_cfg014 {
@@ -404,6 +357,8 @@ union cvmx_pciercx_cfg014 {
404 struct cvmx_pciercx_cfg014_s cn52xxp1; 357 struct cvmx_pciercx_cfg014_s cn52xxp1;
405 struct cvmx_pciercx_cfg014_s cn56xx; 358 struct cvmx_pciercx_cfg014_s cn56xx;
406 struct cvmx_pciercx_cfg014_s cn56xxp1; 359 struct cvmx_pciercx_cfg014_s cn56xxp1;
360 struct cvmx_pciercx_cfg014_s cn63xx;
361 struct cvmx_pciercx_cfg014_s cn63xxp1;
407}; 362};
408 363
409union cvmx_pciercx_cfg015 { 364union cvmx_pciercx_cfg015 {
@@ -429,6 +384,8 @@ union cvmx_pciercx_cfg015 {
429 struct cvmx_pciercx_cfg015_s cn52xxp1; 384 struct cvmx_pciercx_cfg015_s cn52xxp1;
430 struct cvmx_pciercx_cfg015_s cn56xx; 385 struct cvmx_pciercx_cfg015_s cn56xx;
431 struct cvmx_pciercx_cfg015_s cn56xxp1; 386 struct cvmx_pciercx_cfg015_s cn56xxp1;
387 struct cvmx_pciercx_cfg015_s cn63xx;
388 struct cvmx_pciercx_cfg015_s cn63xxp1;
432}; 389};
433 390
434union cvmx_pciercx_cfg016 { 391union cvmx_pciercx_cfg016 {
@@ -449,6 +406,8 @@ union cvmx_pciercx_cfg016 {
449 struct cvmx_pciercx_cfg016_s cn52xxp1; 406 struct cvmx_pciercx_cfg016_s cn52xxp1;
450 struct cvmx_pciercx_cfg016_s cn56xx; 407 struct cvmx_pciercx_cfg016_s cn56xx;
451 struct cvmx_pciercx_cfg016_s cn56xxp1; 408 struct cvmx_pciercx_cfg016_s cn56xxp1;
409 struct cvmx_pciercx_cfg016_s cn63xx;
410 struct cvmx_pciercx_cfg016_s cn63xxp1;
452}; 411};
453 412
454union cvmx_pciercx_cfg017 { 413union cvmx_pciercx_cfg017 {
@@ -471,6 +430,8 @@ union cvmx_pciercx_cfg017 {
471 struct cvmx_pciercx_cfg017_s cn52xxp1; 430 struct cvmx_pciercx_cfg017_s cn52xxp1;
472 struct cvmx_pciercx_cfg017_s cn56xx; 431 struct cvmx_pciercx_cfg017_s cn56xx;
473 struct cvmx_pciercx_cfg017_s cn56xxp1; 432 struct cvmx_pciercx_cfg017_s cn56xxp1;
433 struct cvmx_pciercx_cfg017_s cn63xx;
434 struct cvmx_pciercx_cfg017_s cn63xxp1;
474}; 435};
475 436
476union cvmx_pciercx_cfg020 { 437union cvmx_pciercx_cfg020 {
@@ -488,6 +449,8 @@ union cvmx_pciercx_cfg020 {
488 struct cvmx_pciercx_cfg020_s cn52xxp1; 449 struct cvmx_pciercx_cfg020_s cn52xxp1;
489 struct cvmx_pciercx_cfg020_s cn56xx; 450 struct cvmx_pciercx_cfg020_s cn56xx;
490 struct cvmx_pciercx_cfg020_s cn56xxp1; 451 struct cvmx_pciercx_cfg020_s cn56xxp1;
452 struct cvmx_pciercx_cfg020_s cn63xx;
453 struct cvmx_pciercx_cfg020_s cn63xxp1;
491}; 454};
492 455
493union cvmx_pciercx_cfg021 { 456union cvmx_pciercx_cfg021 {
@@ -500,6 +463,8 @@ union cvmx_pciercx_cfg021 {
500 struct cvmx_pciercx_cfg021_s cn52xxp1; 463 struct cvmx_pciercx_cfg021_s cn52xxp1;
501 struct cvmx_pciercx_cfg021_s cn56xx; 464 struct cvmx_pciercx_cfg021_s cn56xx;
502 struct cvmx_pciercx_cfg021_s cn56xxp1; 465 struct cvmx_pciercx_cfg021_s cn56xxp1;
466 struct cvmx_pciercx_cfg021_s cn63xx;
467 struct cvmx_pciercx_cfg021_s cn63xxp1;
503}; 468};
504 469
505union cvmx_pciercx_cfg022 { 470union cvmx_pciercx_cfg022 {
@@ -511,6 +476,8 @@ union cvmx_pciercx_cfg022 {
511 struct cvmx_pciercx_cfg022_s cn52xxp1; 476 struct cvmx_pciercx_cfg022_s cn52xxp1;
512 struct cvmx_pciercx_cfg022_s cn56xx; 477 struct cvmx_pciercx_cfg022_s cn56xx;
513 struct cvmx_pciercx_cfg022_s cn56xxp1; 478 struct cvmx_pciercx_cfg022_s cn56xxp1;
479 struct cvmx_pciercx_cfg022_s cn63xx;
480 struct cvmx_pciercx_cfg022_s cn63xxp1;
514}; 481};
515 482
516union cvmx_pciercx_cfg023 { 483union cvmx_pciercx_cfg023 {
@@ -523,6 +490,8 @@ union cvmx_pciercx_cfg023 {
523 struct cvmx_pciercx_cfg023_s cn52xxp1; 490 struct cvmx_pciercx_cfg023_s cn52xxp1;
524 struct cvmx_pciercx_cfg023_s cn56xx; 491 struct cvmx_pciercx_cfg023_s cn56xx;
525 struct cvmx_pciercx_cfg023_s cn56xxp1; 492 struct cvmx_pciercx_cfg023_s cn56xxp1;
493 struct cvmx_pciercx_cfg023_s cn63xx;
494 struct cvmx_pciercx_cfg023_s cn63xxp1;
526}; 495};
527 496
528union cvmx_pciercx_cfg028 { 497union cvmx_pciercx_cfg028 {
@@ -540,6 +509,8 @@ union cvmx_pciercx_cfg028 {
540 struct cvmx_pciercx_cfg028_s cn52xxp1; 509 struct cvmx_pciercx_cfg028_s cn52xxp1;
541 struct cvmx_pciercx_cfg028_s cn56xx; 510 struct cvmx_pciercx_cfg028_s cn56xx;
542 struct cvmx_pciercx_cfg028_s cn56xxp1; 511 struct cvmx_pciercx_cfg028_s cn56xxp1;
512 struct cvmx_pciercx_cfg028_s cn63xx;
513 struct cvmx_pciercx_cfg028_s cn63xxp1;
543}; 514};
544 515
545union cvmx_pciercx_cfg029 { 516union cvmx_pciercx_cfg029 {
@@ -561,6 +532,8 @@ union cvmx_pciercx_cfg029 {
561 struct cvmx_pciercx_cfg029_s cn52xxp1; 532 struct cvmx_pciercx_cfg029_s cn52xxp1;
562 struct cvmx_pciercx_cfg029_s cn56xx; 533 struct cvmx_pciercx_cfg029_s cn56xx;
563 struct cvmx_pciercx_cfg029_s cn56xxp1; 534 struct cvmx_pciercx_cfg029_s cn56xxp1;
535 struct cvmx_pciercx_cfg029_s cn63xx;
536 struct cvmx_pciercx_cfg029_s cn63xxp1;
564}; 537};
565 538
566union cvmx_pciercx_cfg030 { 539union cvmx_pciercx_cfg030 {
@@ -590,6 +563,8 @@ union cvmx_pciercx_cfg030 {
590 struct cvmx_pciercx_cfg030_s cn52xxp1; 563 struct cvmx_pciercx_cfg030_s cn52xxp1;
591 struct cvmx_pciercx_cfg030_s cn56xx; 564 struct cvmx_pciercx_cfg030_s cn56xx;
592 struct cvmx_pciercx_cfg030_s cn56xxp1; 565 struct cvmx_pciercx_cfg030_s cn56xxp1;
566 struct cvmx_pciercx_cfg030_s cn63xx;
567 struct cvmx_pciercx_cfg030_s cn63xxp1;
593}; 568};
594 569
595union cvmx_pciercx_cfg031 { 570union cvmx_pciercx_cfg031 {
@@ -611,6 +586,8 @@ union cvmx_pciercx_cfg031 {
611 struct cvmx_pciercx_cfg031_s cn52xxp1; 586 struct cvmx_pciercx_cfg031_s cn52xxp1;
612 struct cvmx_pciercx_cfg031_s cn56xx; 587 struct cvmx_pciercx_cfg031_s cn56xx;
613 struct cvmx_pciercx_cfg031_s cn56xxp1; 588 struct cvmx_pciercx_cfg031_s cn56xxp1;
589 struct cvmx_pciercx_cfg031_s cn63xx;
590 struct cvmx_pciercx_cfg031_s cn63xxp1;
614}; 591};
615 592
616union cvmx_pciercx_cfg032 { 593union cvmx_pciercx_cfg032 {
@@ -641,6 +618,8 @@ union cvmx_pciercx_cfg032 {
641 struct cvmx_pciercx_cfg032_s cn52xxp1; 618 struct cvmx_pciercx_cfg032_s cn52xxp1;
642 struct cvmx_pciercx_cfg032_s cn56xx; 619 struct cvmx_pciercx_cfg032_s cn56xx;
643 struct cvmx_pciercx_cfg032_s cn56xxp1; 620 struct cvmx_pciercx_cfg032_s cn56xxp1;
621 struct cvmx_pciercx_cfg032_s cn63xx;
622 struct cvmx_pciercx_cfg032_s cn63xxp1;
644}; 623};
645 624
646union cvmx_pciercx_cfg033 { 625union cvmx_pciercx_cfg033 {
@@ -663,6 +642,8 @@ union cvmx_pciercx_cfg033 {
663 struct cvmx_pciercx_cfg033_s cn52xxp1; 642 struct cvmx_pciercx_cfg033_s cn52xxp1;
664 struct cvmx_pciercx_cfg033_s cn56xx; 643 struct cvmx_pciercx_cfg033_s cn56xx;
665 struct cvmx_pciercx_cfg033_s cn56xxp1; 644 struct cvmx_pciercx_cfg033_s cn56xxp1;
645 struct cvmx_pciercx_cfg033_s cn63xx;
646 struct cvmx_pciercx_cfg033_s cn63xxp1;
666}; 647};
667 648
668union cvmx_pciercx_cfg034 { 649union cvmx_pciercx_cfg034 {
@@ -695,6 +676,8 @@ union cvmx_pciercx_cfg034 {
695 struct cvmx_pciercx_cfg034_s cn52xxp1; 676 struct cvmx_pciercx_cfg034_s cn52xxp1;
696 struct cvmx_pciercx_cfg034_s cn56xx; 677 struct cvmx_pciercx_cfg034_s cn56xx;
697 struct cvmx_pciercx_cfg034_s cn56xxp1; 678 struct cvmx_pciercx_cfg034_s cn56xxp1;
679 struct cvmx_pciercx_cfg034_s cn63xx;
680 struct cvmx_pciercx_cfg034_s cn63xxp1;
698}; 681};
699 682
700union cvmx_pciercx_cfg035 { 683union cvmx_pciercx_cfg035 {
@@ -713,6 +696,8 @@ union cvmx_pciercx_cfg035 {
713 struct cvmx_pciercx_cfg035_s cn52xxp1; 696 struct cvmx_pciercx_cfg035_s cn52xxp1;
714 struct cvmx_pciercx_cfg035_s cn56xx; 697 struct cvmx_pciercx_cfg035_s cn56xx;
715 struct cvmx_pciercx_cfg035_s cn56xxp1; 698 struct cvmx_pciercx_cfg035_s cn56xxp1;
699 struct cvmx_pciercx_cfg035_s cn63xx;
700 struct cvmx_pciercx_cfg035_s cn63xxp1;
716}; 701};
717 702
718union cvmx_pciercx_cfg036 { 703union cvmx_pciercx_cfg036 {
@@ -727,6 +712,8 @@ union cvmx_pciercx_cfg036 {
727 struct cvmx_pciercx_cfg036_s cn52xxp1; 712 struct cvmx_pciercx_cfg036_s cn52xxp1;
728 struct cvmx_pciercx_cfg036_s cn56xx; 713 struct cvmx_pciercx_cfg036_s cn56xx;
729 struct cvmx_pciercx_cfg036_s cn56xxp1; 714 struct cvmx_pciercx_cfg036_s cn56xxp1;
715 struct cvmx_pciercx_cfg036_s cn63xx;
716 struct cvmx_pciercx_cfg036_s cn63xxp1;
730}; 717};
731 718
732union cvmx_pciercx_cfg037 { 719union cvmx_pciercx_cfg037 {
@@ -740,6 +727,8 @@ union cvmx_pciercx_cfg037 {
740 struct cvmx_pciercx_cfg037_s cn52xxp1; 727 struct cvmx_pciercx_cfg037_s cn52xxp1;
741 struct cvmx_pciercx_cfg037_s cn56xx; 728 struct cvmx_pciercx_cfg037_s cn56xx;
742 struct cvmx_pciercx_cfg037_s cn56xxp1; 729 struct cvmx_pciercx_cfg037_s cn56xxp1;
730 struct cvmx_pciercx_cfg037_s cn63xx;
731 struct cvmx_pciercx_cfg037_s cn63xxp1;
743}; 732};
744 733
745union cvmx_pciercx_cfg038 { 734union cvmx_pciercx_cfg038 {
@@ -753,28 +742,51 @@ union cvmx_pciercx_cfg038 {
753 struct cvmx_pciercx_cfg038_s cn52xxp1; 742 struct cvmx_pciercx_cfg038_s cn52xxp1;
754 struct cvmx_pciercx_cfg038_s cn56xx; 743 struct cvmx_pciercx_cfg038_s cn56xx;
755 struct cvmx_pciercx_cfg038_s cn56xxp1; 744 struct cvmx_pciercx_cfg038_s cn56xxp1;
745 struct cvmx_pciercx_cfg038_s cn63xx;
746 struct cvmx_pciercx_cfg038_s cn63xxp1;
756}; 747};
757 748
758union cvmx_pciercx_cfg039 { 749union cvmx_pciercx_cfg039 {
759 uint32_t u32; 750 uint32_t u32;
760 struct cvmx_pciercx_cfg039_s { 751 struct cvmx_pciercx_cfg039_s {
761 uint32_t reserved_0_31:32; 752 uint32_t reserved_9_31:23;
753 uint32_t cls:1;
754 uint32_t slsv:7;
755 uint32_t reserved_0_0:1;
762 } s; 756 } s;
763 struct cvmx_pciercx_cfg039_s cn52xx; 757 struct cvmx_pciercx_cfg039_cn52xx {
764 struct cvmx_pciercx_cfg039_s cn52xxp1; 758 uint32_t reserved_0_31:32;
765 struct cvmx_pciercx_cfg039_s cn56xx; 759 } cn52xx;
766 struct cvmx_pciercx_cfg039_s cn56xxp1; 760 struct cvmx_pciercx_cfg039_cn52xx cn52xxp1;
761 struct cvmx_pciercx_cfg039_cn52xx cn56xx;
762 struct cvmx_pciercx_cfg039_cn52xx cn56xxp1;
763 struct cvmx_pciercx_cfg039_s cn63xx;
764 struct cvmx_pciercx_cfg039_cn52xx cn63xxp1;
767}; 765};
768 766
769union cvmx_pciercx_cfg040 { 767union cvmx_pciercx_cfg040 {
770 uint32_t u32; 768 uint32_t u32;
771 struct cvmx_pciercx_cfg040_s { 769 struct cvmx_pciercx_cfg040_s {
770 uint32_t reserved_17_31:15;
771 uint32_t cdl:1;
772 uint32_t reserved_13_15:3;
773 uint32_t cde:1;
774 uint32_t csos:1;
775 uint32_t emc:1;
776 uint32_t tm:3;
777 uint32_t sde:1;
778 uint32_t hasd:1;
779 uint32_t ec:1;
780 uint32_t tls:4;
781 } s;
782 struct cvmx_pciercx_cfg040_cn52xx {
772 uint32_t reserved_0_31:32; 783 uint32_t reserved_0_31:32;
773 } s; 784 } cn52xx;
774 struct cvmx_pciercx_cfg040_s cn52xx; 785 struct cvmx_pciercx_cfg040_cn52xx cn52xxp1;
775 struct cvmx_pciercx_cfg040_s cn52xxp1; 786 struct cvmx_pciercx_cfg040_cn52xx cn56xx;
776 struct cvmx_pciercx_cfg040_s cn56xx; 787 struct cvmx_pciercx_cfg040_cn52xx cn56xxp1;
777 struct cvmx_pciercx_cfg040_s cn56xxp1; 788 struct cvmx_pciercx_cfg040_s cn63xx;
789 struct cvmx_pciercx_cfg040_s cn63xxp1;
778}; 790};
779 791
780union cvmx_pciercx_cfg041 { 792union cvmx_pciercx_cfg041 {
@@ -786,6 +798,8 @@ union cvmx_pciercx_cfg041 {
786 struct cvmx_pciercx_cfg041_s cn52xxp1; 798 struct cvmx_pciercx_cfg041_s cn52xxp1;
787 struct cvmx_pciercx_cfg041_s cn56xx; 799 struct cvmx_pciercx_cfg041_s cn56xx;
788 struct cvmx_pciercx_cfg041_s cn56xxp1; 800 struct cvmx_pciercx_cfg041_s cn56xxp1;
801 struct cvmx_pciercx_cfg041_s cn63xx;
802 struct cvmx_pciercx_cfg041_s cn63xxp1;
789}; 803};
790 804
791union cvmx_pciercx_cfg042 { 805union cvmx_pciercx_cfg042 {
@@ -797,6 +811,8 @@ union cvmx_pciercx_cfg042 {
797 struct cvmx_pciercx_cfg042_s cn52xxp1; 811 struct cvmx_pciercx_cfg042_s cn52xxp1;
798 struct cvmx_pciercx_cfg042_s cn56xx; 812 struct cvmx_pciercx_cfg042_s cn56xx;
799 struct cvmx_pciercx_cfg042_s cn56xxp1; 813 struct cvmx_pciercx_cfg042_s cn56xxp1;
814 struct cvmx_pciercx_cfg042_s cn63xx;
815 struct cvmx_pciercx_cfg042_s cn63xxp1;
800}; 816};
801 817
802union cvmx_pciercx_cfg064 { 818union cvmx_pciercx_cfg064 {
@@ -810,6 +826,8 @@ union cvmx_pciercx_cfg064 {
810 struct cvmx_pciercx_cfg064_s cn52xxp1; 826 struct cvmx_pciercx_cfg064_s cn52xxp1;
811 struct cvmx_pciercx_cfg064_s cn56xx; 827 struct cvmx_pciercx_cfg064_s cn56xx;
812 struct cvmx_pciercx_cfg064_s cn56xxp1; 828 struct cvmx_pciercx_cfg064_s cn56xxp1;
829 struct cvmx_pciercx_cfg064_s cn63xx;
830 struct cvmx_pciercx_cfg064_s cn63xxp1;
813}; 831};
814 832
815union cvmx_pciercx_cfg065 { 833union cvmx_pciercx_cfg065 {
@@ -834,6 +852,8 @@ union cvmx_pciercx_cfg065 {
834 struct cvmx_pciercx_cfg065_s cn52xxp1; 852 struct cvmx_pciercx_cfg065_s cn52xxp1;
835 struct cvmx_pciercx_cfg065_s cn56xx; 853 struct cvmx_pciercx_cfg065_s cn56xx;
836 struct cvmx_pciercx_cfg065_s cn56xxp1; 854 struct cvmx_pciercx_cfg065_s cn56xxp1;
855 struct cvmx_pciercx_cfg065_s cn63xx;
856 struct cvmx_pciercx_cfg065_s cn63xxp1;
837}; 857};
838 858
839union cvmx_pciercx_cfg066 { 859union cvmx_pciercx_cfg066 {
@@ -858,6 +878,8 @@ union cvmx_pciercx_cfg066 {
858 struct cvmx_pciercx_cfg066_s cn52xxp1; 878 struct cvmx_pciercx_cfg066_s cn52xxp1;
859 struct cvmx_pciercx_cfg066_s cn56xx; 879 struct cvmx_pciercx_cfg066_s cn56xx;
860 struct cvmx_pciercx_cfg066_s cn56xxp1; 880 struct cvmx_pciercx_cfg066_s cn56xxp1;
881 struct cvmx_pciercx_cfg066_s cn63xx;
882 struct cvmx_pciercx_cfg066_s cn63xxp1;
861}; 883};
862 884
863union cvmx_pciercx_cfg067 { 885union cvmx_pciercx_cfg067 {
@@ -882,6 +904,8 @@ union cvmx_pciercx_cfg067 {
882 struct cvmx_pciercx_cfg067_s cn52xxp1; 904 struct cvmx_pciercx_cfg067_s cn52xxp1;
883 struct cvmx_pciercx_cfg067_s cn56xx; 905 struct cvmx_pciercx_cfg067_s cn56xx;
884 struct cvmx_pciercx_cfg067_s cn56xxp1; 906 struct cvmx_pciercx_cfg067_s cn56xxp1;
907 struct cvmx_pciercx_cfg067_s cn63xx;
908 struct cvmx_pciercx_cfg067_s cn63xxp1;
885}; 909};
886 910
887union cvmx_pciercx_cfg068 { 911union cvmx_pciercx_cfg068 {
@@ -901,6 +925,8 @@ union cvmx_pciercx_cfg068 {
901 struct cvmx_pciercx_cfg068_s cn52xxp1; 925 struct cvmx_pciercx_cfg068_s cn52xxp1;
902 struct cvmx_pciercx_cfg068_s cn56xx; 926 struct cvmx_pciercx_cfg068_s cn56xx;
903 struct cvmx_pciercx_cfg068_s cn56xxp1; 927 struct cvmx_pciercx_cfg068_s cn56xxp1;
928 struct cvmx_pciercx_cfg068_s cn63xx;
929 struct cvmx_pciercx_cfg068_s cn63xxp1;
904}; 930};
905 931
906union cvmx_pciercx_cfg069 { 932union cvmx_pciercx_cfg069 {
@@ -920,6 +946,8 @@ union cvmx_pciercx_cfg069 {
920 struct cvmx_pciercx_cfg069_s cn52xxp1; 946 struct cvmx_pciercx_cfg069_s cn52xxp1;
921 struct cvmx_pciercx_cfg069_s cn56xx; 947 struct cvmx_pciercx_cfg069_s cn56xx;
922 struct cvmx_pciercx_cfg069_s cn56xxp1; 948 struct cvmx_pciercx_cfg069_s cn56xxp1;
949 struct cvmx_pciercx_cfg069_s cn63xx;
950 struct cvmx_pciercx_cfg069_s cn63xxp1;
923}; 951};
924 952
925union cvmx_pciercx_cfg070 { 953union cvmx_pciercx_cfg070 {
@@ -936,6 +964,8 @@ union cvmx_pciercx_cfg070 {
936 struct cvmx_pciercx_cfg070_s cn52xxp1; 964 struct cvmx_pciercx_cfg070_s cn52xxp1;
937 struct cvmx_pciercx_cfg070_s cn56xx; 965 struct cvmx_pciercx_cfg070_s cn56xx;
938 struct cvmx_pciercx_cfg070_s cn56xxp1; 966 struct cvmx_pciercx_cfg070_s cn56xxp1;
967 struct cvmx_pciercx_cfg070_s cn63xx;
968 struct cvmx_pciercx_cfg070_s cn63xxp1;
939}; 969};
940 970
941union cvmx_pciercx_cfg071 { 971union cvmx_pciercx_cfg071 {
@@ -947,6 +977,8 @@ union cvmx_pciercx_cfg071 {
947 struct cvmx_pciercx_cfg071_s cn52xxp1; 977 struct cvmx_pciercx_cfg071_s cn52xxp1;
948 struct cvmx_pciercx_cfg071_s cn56xx; 978 struct cvmx_pciercx_cfg071_s cn56xx;
949 struct cvmx_pciercx_cfg071_s cn56xxp1; 979 struct cvmx_pciercx_cfg071_s cn56xxp1;
980 struct cvmx_pciercx_cfg071_s cn63xx;
981 struct cvmx_pciercx_cfg071_s cn63xxp1;
950}; 982};
951 983
952union cvmx_pciercx_cfg072 { 984union cvmx_pciercx_cfg072 {
@@ -958,6 +990,8 @@ union cvmx_pciercx_cfg072 {
958 struct cvmx_pciercx_cfg072_s cn52xxp1; 990 struct cvmx_pciercx_cfg072_s cn52xxp1;
959 struct cvmx_pciercx_cfg072_s cn56xx; 991 struct cvmx_pciercx_cfg072_s cn56xx;
960 struct cvmx_pciercx_cfg072_s cn56xxp1; 992 struct cvmx_pciercx_cfg072_s cn56xxp1;
993 struct cvmx_pciercx_cfg072_s cn63xx;
994 struct cvmx_pciercx_cfg072_s cn63xxp1;
961}; 995};
962 996
963union cvmx_pciercx_cfg073 { 997union cvmx_pciercx_cfg073 {
@@ -969,6 +1003,8 @@ union cvmx_pciercx_cfg073 {
969 struct cvmx_pciercx_cfg073_s cn52xxp1; 1003 struct cvmx_pciercx_cfg073_s cn52xxp1;
970 struct cvmx_pciercx_cfg073_s cn56xx; 1004 struct cvmx_pciercx_cfg073_s cn56xx;
971 struct cvmx_pciercx_cfg073_s cn56xxp1; 1005 struct cvmx_pciercx_cfg073_s cn56xxp1;
1006 struct cvmx_pciercx_cfg073_s cn63xx;
1007 struct cvmx_pciercx_cfg073_s cn63xxp1;
972}; 1008};
973 1009
974union cvmx_pciercx_cfg074 { 1010union cvmx_pciercx_cfg074 {
@@ -980,6 +1016,8 @@ union cvmx_pciercx_cfg074 {
980 struct cvmx_pciercx_cfg074_s cn52xxp1; 1016 struct cvmx_pciercx_cfg074_s cn52xxp1;
981 struct cvmx_pciercx_cfg074_s cn56xx; 1017 struct cvmx_pciercx_cfg074_s cn56xx;
982 struct cvmx_pciercx_cfg074_s cn56xxp1; 1018 struct cvmx_pciercx_cfg074_s cn56xxp1;
1019 struct cvmx_pciercx_cfg074_s cn63xx;
1020 struct cvmx_pciercx_cfg074_s cn63xxp1;
983}; 1021};
984 1022
985union cvmx_pciercx_cfg075 { 1023union cvmx_pciercx_cfg075 {
@@ -994,6 +1032,8 @@ union cvmx_pciercx_cfg075 {
994 struct cvmx_pciercx_cfg075_s cn52xxp1; 1032 struct cvmx_pciercx_cfg075_s cn52xxp1;
995 struct cvmx_pciercx_cfg075_s cn56xx; 1033 struct cvmx_pciercx_cfg075_s cn56xx;
996 struct cvmx_pciercx_cfg075_s cn56xxp1; 1034 struct cvmx_pciercx_cfg075_s cn56xxp1;
1035 struct cvmx_pciercx_cfg075_s cn63xx;
1036 struct cvmx_pciercx_cfg075_s cn63xxp1;
997}; 1037};
998 1038
999union cvmx_pciercx_cfg076 { 1039union cvmx_pciercx_cfg076 {
@@ -1013,6 +1053,8 @@ union cvmx_pciercx_cfg076 {
1013 struct cvmx_pciercx_cfg076_s cn52xxp1; 1053 struct cvmx_pciercx_cfg076_s cn52xxp1;
1014 struct cvmx_pciercx_cfg076_s cn56xx; 1054 struct cvmx_pciercx_cfg076_s cn56xx;
1015 struct cvmx_pciercx_cfg076_s cn56xxp1; 1055 struct cvmx_pciercx_cfg076_s cn56xxp1;
1056 struct cvmx_pciercx_cfg076_s cn63xx;
1057 struct cvmx_pciercx_cfg076_s cn63xxp1;
1016}; 1058};
1017 1059
1018union cvmx_pciercx_cfg077 { 1060union cvmx_pciercx_cfg077 {
@@ -1025,6 +1067,8 @@ union cvmx_pciercx_cfg077 {
1025 struct cvmx_pciercx_cfg077_s cn52xxp1; 1067 struct cvmx_pciercx_cfg077_s cn52xxp1;
1026 struct cvmx_pciercx_cfg077_s cn56xx; 1068 struct cvmx_pciercx_cfg077_s cn56xx;
1027 struct cvmx_pciercx_cfg077_s cn56xxp1; 1069 struct cvmx_pciercx_cfg077_s cn56xxp1;
1070 struct cvmx_pciercx_cfg077_s cn63xx;
1071 struct cvmx_pciercx_cfg077_s cn63xxp1;
1028}; 1072};
1029 1073
1030union cvmx_pciercx_cfg448 { 1074union cvmx_pciercx_cfg448 {
@@ -1037,6 +1081,8 @@ union cvmx_pciercx_cfg448 {
1037 struct cvmx_pciercx_cfg448_s cn52xxp1; 1081 struct cvmx_pciercx_cfg448_s cn52xxp1;
1038 struct cvmx_pciercx_cfg448_s cn56xx; 1082 struct cvmx_pciercx_cfg448_s cn56xx;
1039 struct cvmx_pciercx_cfg448_s cn56xxp1; 1083 struct cvmx_pciercx_cfg448_s cn56xxp1;
1084 struct cvmx_pciercx_cfg448_s cn63xx;
1085 struct cvmx_pciercx_cfg448_s cn63xxp1;
1040}; 1086};
1041 1087
1042union cvmx_pciercx_cfg449 { 1088union cvmx_pciercx_cfg449 {
@@ -1048,6 +1094,8 @@ union cvmx_pciercx_cfg449 {
1048 struct cvmx_pciercx_cfg449_s cn52xxp1; 1094 struct cvmx_pciercx_cfg449_s cn52xxp1;
1049 struct cvmx_pciercx_cfg449_s cn56xx; 1095 struct cvmx_pciercx_cfg449_s cn56xx;
1050 struct cvmx_pciercx_cfg449_s cn56xxp1; 1096 struct cvmx_pciercx_cfg449_s cn56xxp1;
1097 struct cvmx_pciercx_cfg449_s cn63xx;
1098 struct cvmx_pciercx_cfg449_s cn63xxp1;
1051}; 1099};
1052 1100
1053union cvmx_pciercx_cfg450 { 1101union cvmx_pciercx_cfg450 {
@@ -1064,6 +1112,8 @@ union cvmx_pciercx_cfg450 {
1064 struct cvmx_pciercx_cfg450_s cn52xxp1; 1112 struct cvmx_pciercx_cfg450_s cn52xxp1;
1065 struct cvmx_pciercx_cfg450_s cn56xx; 1113 struct cvmx_pciercx_cfg450_s cn56xx;
1066 struct cvmx_pciercx_cfg450_s cn56xxp1; 1114 struct cvmx_pciercx_cfg450_s cn56xxp1;
1115 struct cvmx_pciercx_cfg450_s cn63xx;
1116 struct cvmx_pciercx_cfg450_s cn63xxp1;
1067}; 1117};
1068 1118
1069union cvmx_pciercx_cfg451 { 1119union cvmx_pciercx_cfg451 {
@@ -1080,6 +1130,8 @@ union cvmx_pciercx_cfg451 {
1080 struct cvmx_pciercx_cfg451_s cn52xxp1; 1130 struct cvmx_pciercx_cfg451_s cn52xxp1;
1081 struct cvmx_pciercx_cfg451_s cn56xx; 1131 struct cvmx_pciercx_cfg451_s cn56xx;
1082 struct cvmx_pciercx_cfg451_s cn56xxp1; 1132 struct cvmx_pciercx_cfg451_s cn56xxp1;
1133 struct cvmx_pciercx_cfg451_s cn63xx;
1134 struct cvmx_pciercx_cfg451_s cn63xxp1;
1083}; 1135};
1084 1136
1085union cvmx_pciercx_cfg452 { 1137union cvmx_pciercx_cfg452 {
@@ -1103,6 +1155,8 @@ union cvmx_pciercx_cfg452 {
1103 struct cvmx_pciercx_cfg452_s cn52xxp1; 1155 struct cvmx_pciercx_cfg452_s cn52xxp1;
1104 struct cvmx_pciercx_cfg452_s cn56xx; 1156 struct cvmx_pciercx_cfg452_s cn56xx;
1105 struct cvmx_pciercx_cfg452_s cn56xxp1; 1157 struct cvmx_pciercx_cfg452_s cn56xxp1;
1158 struct cvmx_pciercx_cfg452_s cn63xx;
1159 struct cvmx_pciercx_cfg452_s cn63xxp1;
1106}; 1160};
1107 1161
1108union cvmx_pciercx_cfg453 { 1162union cvmx_pciercx_cfg453 {
@@ -1118,6 +1172,8 @@ union cvmx_pciercx_cfg453 {
1118 struct cvmx_pciercx_cfg453_s cn52xxp1; 1172 struct cvmx_pciercx_cfg453_s cn52xxp1;
1119 struct cvmx_pciercx_cfg453_s cn56xx; 1173 struct cvmx_pciercx_cfg453_s cn56xx;
1120 struct cvmx_pciercx_cfg453_s cn56xxp1; 1174 struct cvmx_pciercx_cfg453_s cn56xxp1;
1175 struct cvmx_pciercx_cfg453_s cn63xx;
1176 struct cvmx_pciercx_cfg453_s cn63xxp1;
1121}; 1177};
1122 1178
1123union cvmx_pciercx_cfg454 { 1179union cvmx_pciercx_cfg454 {
@@ -1136,6 +1192,8 @@ union cvmx_pciercx_cfg454 {
1136 struct cvmx_pciercx_cfg454_s cn52xxp1; 1192 struct cvmx_pciercx_cfg454_s cn52xxp1;
1137 struct cvmx_pciercx_cfg454_s cn56xx; 1193 struct cvmx_pciercx_cfg454_s cn56xx;
1138 struct cvmx_pciercx_cfg454_s cn56xxp1; 1194 struct cvmx_pciercx_cfg454_s cn56xxp1;
1195 struct cvmx_pciercx_cfg454_s cn63xx;
1196 struct cvmx_pciercx_cfg454_s cn63xxp1;
1139}; 1197};
1140 1198
1141union cvmx_pciercx_cfg455 { 1199union cvmx_pciercx_cfg455 {
@@ -1165,6 +1223,8 @@ union cvmx_pciercx_cfg455 {
1165 struct cvmx_pciercx_cfg455_s cn52xxp1; 1223 struct cvmx_pciercx_cfg455_s cn52xxp1;
1166 struct cvmx_pciercx_cfg455_s cn56xx; 1224 struct cvmx_pciercx_cfg455_s cn56xx;
1167 struct cvmx_pciercx_cfg455_s cn56xxp1; 1225 struct cvmx_pciercx_cfg455_s cn56xxp1;
1226 struct cvmx_pciercx_cfg455_s cn63xx;
1227 struct cvmx_pciercx_cfg455_s cn63xxp1;
1168}; 1228};
1169 1229
1170union cvmx_pciercx_cfg456 { 1230union cvmx_pciercx_cfg456 {
@@ -1178,6 +1238,8 @@ union cvmx_pciercx_cfg456 {
1178 struct cvmx_pciercx_cfg456_s cn52xxp1; 1238 struct cvmx_pciercx_cfg456_s cn52xxp1;
1179 struct cvmx_pciercx_cfg456_s cn56xx; 1239 struct cvmx_pciercx_cfg456_s cn56xx;
1180 struct cvmx_pciercx_cfg456_s cn56xxp1; 1240 struct cvmx_pciercx_cfg456_s cn56xxp1;
1241 struct cvmx_pciercx_cfg456_s cn63xx;
1242 struct cvmx_pciercx_cfg456_s cn63xxp1;
1181}; 1243};
1182 1244
1183union cvmx_pciercx_cfg458 { 1245union cvmx_pciercx_cfg458 {
@@ -1189,6 +1251,8 @@ union cvmx_pciercx_cfg458 {
1189 struct cvmx_pciercx_cfg458_s cn52xxp1; 1251 struct cvmx_pciercx_cfg458_s cn52xxp1;
1190 struct cvmx_pciercx_cfg458_s cn56xx; 1252 struct cvmx_pciercx_cfg458_s cn56xx;
1191 struct cvmx_pciercx_cfg458_s cn56xxp1; 1253 struct cvmx_pciercx_cfg458_s cn56xxp1;
1254 struct cvmx_pciercx_cfg458_s cn63xx;
1255 struct cvmx_pciercx_cfg458_s cn63xxp1;
1192}; 1256};
1193 1257
1194union cvmx_pciercx_cfg459 { 1258union cvmx_pciercx_cfg459 {
@@ -1200,6 +1264,8 @@ union cvmx_pciercx_cfg459 {
1200 struct cvmx_pciercx_cfg459_s cn52xxp1; 1264 struct cvmx_pciercx_cfg459_s cn52xxp1;
1201 struct cvmx_pciercx_cfg459_s cn56xx; 1265 struct cvmx_pciercx_cfg459_s cn56xx;
1202 struct cvmx_pciercx_cfg459_s cn56xxp1; 1266 struct cvmx_pciercx_cfg459_s cn56xxp1;
1267 struct cvmx_pciercx_cfg459_s cn63xx;
1268 struct cvmx_pciercx_cfg459_s cn63xxp1;
1203}; 1269};
1204 1270
1205union cvmx_pciercx_cfg460 { 1271union cvmx_pciercx_cfg460 {
@@ -1213,6 +1279,8 @@ union cvmx_pciercx_cfg460 {
1213 struct cvmx_pciercx_cfg460_s cn52xxp1; 1279 struct cvmx_pciercx_cfg460_s cn52xxp1;
1214 struct cvmx_pciercx_cfg460_s cn56xx; 1280 struct cvmx_pciercx_cfg460_s cn56xx;
1215 struct cvmx_pciercx_cfg460_s cn56xxp1; 1281 struct cvmx_pciercx_cfg460_s cn56xxp1;
1282 struct cvmx_pciercx_cfg460_s cn63xx;
1283 struct cvmx_pciercx_cfg460_s cn63xxp1;
1216}; 1284};
1217 1285
1218union cvmx_pciercx_cfg461 { 1286union cvmx_pciercx_cfg461 {
@@ -1226,6 +1294,8 @@ union cvmx_pciercx_cfg461 {
1226 struct cvmx_pciercx_cfg461_s cn52xxp1; 1294 struct cvmx_pciercx_cfg461_s cn52xxp1;
1227 struct cvmx_pciercx_cfg461_s cn56xx; 1295 struct cvmx_pciercx_cfg461_s cn56xx;
1228 struct cvmx_pciercx_cfg461_s cn56xxp1; 1296 struct cvmx_pciercx_cfg461_s cn56xxp1;
1297 struct cvmx_pciercx_cfg461_s cn63xx;
1298 struct cvmx_pciercx_cfg461_s cn63xxp1;
1229}; 1299};
1230 1300
1231union cvmx_pciercx_cfg462 { 1301union cvmx_pciercx_cfg462 {
@@ -1239,6 +1309,8 @@ union cvmx_pciercx_cfg462 {
1239 struct cvmx_pciercx_cfg462_s cn52xxp1; 1309 struct cvmx_pciercx_cfg462_s cn52xxp1;
1240 struct cvmx_pciercx_cfg462_s cn56xx; 1310 struct cvmx_pciercx_cfg462_s cn56xx;
1241 struct cvmx_pciercx_cfg462_s cn56xxp1; 1311 struct cvmx_pciercx_cfg462_s cn56xxp1;
1312 struct cvmx_pciercx_cfg462_s cn63xx;
1313 struct cvmx_pciercx_cfg462_s cn63xxp1;
1242}; 1314};
1243 1315
1244union cvmx_pciercx_cfg463 { 1316union cvmx_pciercx_cfg463 {
@@ -1253,6 +1325,8 @@ union cvmx_pciercx_cfg463 {
1253 struct cvmx_pciercx_cfg463_s cn52xxp1; 1325 struct cvmx_pciercx_cfg463_s cn52xxp1;
1254 struct cvmx_pciercx_cfg463_s cn56xx; 1326 struct cvmx_pciercx_cfg463_s cn56xx;
1255 struct cvmx_pciercx_cfg463_s cn56xxp1; 1327 struct cvmx_pciercx_cfg463_s cn56xxp1;
1328 struct cvmx_pciercx_cfg463_s cn63xx;
1329 struct cvmx_pciercx_cfg463_s cn63xxp1;
1256}; 1330};
1257 1331
1258union cvmx_pciercx_cfg464 { 1332union cvmx_pciercx_cfg464 {
@@ -1267,6 +1341,8 @@ union cvmx_pciercx_cfg464 {
1267 struct cvmx_pciercx_cfg464_s cn52xxp1; 1341 struct cvmx_pciercx_cfg464_s cn52xxp1;
1268 struct cvmx_pciercx_cfg464_s cn56xx; 1342 struct cvmx_pciercx_cfg464_s cn56xx;
1269 struct cvmx_pciercx_cfg464_s cn56xxp1; 1343 struct cvmx_pciercx_cfg464_s cn56xxp1;
1344 struct cvmx_pciercx_cfg464_s cn63xx;
1345 struct cvmx_pciercx_cfg464_s cn63xxp1;
1270}; 1346};
1271 1347
1272union cvmx_pciercx_cfg465 { 1348union cvmx_pciercx_cfg465 {
@@ -1281,6 +1357,8 @@ union cvmx_pciercx_cfg465 {
1281 struct cvmx_pciercx_cfg465_s cn52xxp1; 1357 struct cvmx_pciercx_cfg465_s cn52xxp1;
1282 struct cvmx_pciercx_cfg465_s cn56xx; 1358 struct cvmx_pciercx_cfg465_s cn56xx;
1283 struct cvmx_pciercx_cfg465_s cn56xxp1; 1359 struct cvmx_pciercx_cfg465_s cn56xxp1;
1360 struct cvmx_pciercx_cfg465_s cn63xx;
1361 struct cvmx_pciercx_cfg465_s cn63xxp1;
1284}; 1362};
1285 1363
1286union cvmx_pciercx_cfg466 { 1364union cvmx_pciercx_cfg466 {
@@ -1298,6 +1376,8 @@ union cvmx_pciercx_cfg466 {
1298 struct cvmx_pciercx_cfg466_s cn52xxp1; 1376 struct cvmx_pciercx_cfg466_s cn52xxp1;
1299 struct cvmx_pciercx_cfg466_s cn56xx; 1377 struct cvmx_pciercx_cfg466_s cn56xx;
1300 struct cvmx_pciercx_cfg466_s cn56xxp1; 1378 struct cvmx_pciercx_cfg466_s cn56xxp1;
1379 struct cvmx_pciercx_cfg466_s cn63xx;
1380 struct cvmx_pciercx_cfg466_s cn63xxp1;
1301}; 1381};
1302 1382
1303union cvmx_pciercx_cfg467 { 1383union cvmx_pciercx_cfg467 {
@@ -1313,6 +1393,8 @@ union cvmx_pciercx_cfg467 {
1313 struct cvmx_pciercx_cfg467_s cn52xxp1; 1393 struct cvmx_pciercx_cfg467_s cn52xxp1;
1314 struct cvmx_pciercx_cfg467_s cn56xx; 1394 struct cvmx_pciercx_cfg467_s cn56xx;
1315 struct cvmx_pciercx_cfg467_s cn56xxp1; 1395 struct cvmx_pciercx_cfg467_s cn56xxp1;
1396 struct cvmx_pciercx_cfg467_s cn63xx;
1397 struct cvmx_pciercx_cfg467_s cn63xxp1;
1316}; 1398};
1317 1399
1318union cvmx_pciercx_cfg468 { 1400union cvmx_pciercx_cfg468 {
@@ -1328,6 +1410,8 @@ union cvmx_pciercx_cfg468 {
1328 struct cvmx_pciercx_cfg468_s cn52xxp1; 1410 struct cvmx_pciercx_cfg468_s cn52xxp1;
1329 struct cvmx_pciercx_cfg468_s cn56xx; 1411 struct cvmx_pciercx_cfg468_s cn56xx;
1330 struct cvmx_pciercx_cfg468_s cn56xxp1; 1412 struct cvmx_pciercx_cfg468_s cn56xxp1;
1413 struct cvmx_pciercx_cfg468_s cn63xx;
1414 struct cvmx_pciercx_cfg468_s cn63xxp1;
1331}; 1415};
1332 1416
1333union cvmx_pciercx_cfg490 { 1417union cvmx_pciercx_cfg490 {
@@ -1342,6 +1426,8 @@ union cvmx_pciercx_cfg490 {
1342 struct cvmx_pciercx_cfg490_s cn52xxp1; 1426 struct cvmx_pciercx_cfg490_s cn52xxp1;
1343 struct cvmx_pciercx_cfg490_s cn56xx; 1427 struct cvmx_pciercx_cfg490_s cn56xx;
1344 struct cvmx_pciercx_cfg490_s cn56xxp1; 1428 struct cvmx_pciercx_cfg490_s cn56xxp1;
1429 struct cvmx_pciercx_cfg490_s cn63xx;
1430 struct cvmx_pciercx_cfg490_s cn63xxp1;
1345}; 1431};
1346 1432
1347union cvmx_pciercx_cfg491 { 1433union cvmx_pciercx_cfg491 {
@@ -1356,6 +1442,8 @@ union cvmx_pciercx_cfg491 {
1356 struct cvmx_pciercx_cfg491_s cn52xxp1; 1442 struct cvmx_pciercx_cfg491_s cn52xxp1;
1357 struct cvmx_pciercx_cfg491_s cn56xx; 1443 struct cvmx_pciercx_cfg491_s cn56xx;
1358 struct cvmx_pciercx_cfg491_s cn56xxp1; 1444 struct cvmx_pciercx_cfg491_s cn56xxp1;
1445 struct cvmx_pciercx_cfg491_s cn63xx;
1446 struct cvmx_pciercx_cfg491_s cn63xxp1;
1359}; 1447};
1360 1448
1361union cvmx_pciercx_cfg492 { 1449union cvmx_pciercx_cfg492 {
@@ -1370,6 +1458,23 @@ union cvmx_pciercx_cfg492 {
1370 struct cvmx_pciercx_cfg492_s cn52xxp1; 1458 struct cvmx_pciercx_cfg492_s cn52xxp1;
1371 struct cvmx_pciercx_cfg492_s cn56xx; 1459 struct cvmx_pciercx_cfg492_s cn56xx;
1372 struct cvmx_pciercx_cfg492_s cn56xxp1; 1460 struct cvmx_pciercx_cfg492_s cn56xxp1;
1461 struct cvmx_pciercx_cfg492_s cn63xx;
1462 struct cvmx_pciercx_cfg492_s cn63xxp1;
1463};
1464
1465union cvmx_pciercx_cfg515 {
1466 uint32_t u32;
1467 struct cvmx_pciercx_cfg515_s {
1468 uint32_t reserved_21_31:11;
1469 uint32_t s_d_e:1;
1470 uint32_t ctcrb:1;
1471 uint32_t cpyts:1;
1472 uint32_t dsc:1;
1473 uint32_t le:9;
1474 uint32_t n_fts:8;
1475 } s;
1476 struct cvmx_pciercx_cfg515_s cn63xx;
1477 struct cvmx_pciercx_cfg515_s cn63xxp1;
1373}; 1478};
1374 1479
1375union cvmx_pciercx_cfg516 { 1480union cvmx_pciercx_cfg516 {
@@ -1381,6 +1486,8 @@ union cvmx_pciercx_cfg516 {
1381 struct cvmx_pciercx_cfg516_s cn52xxp1; 1486 struct cvmx_pciercx_cfg516_s cn52xxp1;
1382 struct cvmx_pciercx_cfg516_s cn56xx; 1487 struct cvmx_pciercx_cfg516_s cn56xx;
1383 struct cvmx_pciercx_cfg516_s cn56xxp1; 1488 struct cvmx_pciercx_cfg516_s cn56xxp1;
1489 struct cvmx_pciercx_cfg516_s cn63xx;
1490 struct cvmx_pciercx_cfg516_s cn63xxp1;
1384}; 1491};
1385 1492
1386union cvmx_pciercx_cfg517 { 1493union cvmx_pciercx_cfg517 {
@@ -1392,6 +1499,8 @@ union cvmx_pciercx_cfg517 {
1392 struct cvmx_pciercx_cfg517_s cn52xxp1; 1499 struct cvmx_pciercx_cfg517_s cn52xxp1;
1393 struct cvmx_pciercx_cfg517_s cn56xx; 1500 struct cvmx_pciercx_cfg517_s cn56xx;
1394 struct cvmx_pciercx_cfg517_s cn56xxp1; 1501 struct cvmx_pciercx_cfg517_s cn56xxp1;
1502 struct cvmx_pciercx_cfg517_s cn63xx;
1503 struct cvmx_pciercx_cfg517_s cn63xxp1;
1395}; 1504};
1396 1505
1397#endif 1506#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pescx-defs.h b/arch/mips/include/asm/octeon/cvmx-pescx-defs.h
index f40cfaf84454..aef84851a94c 100644
--- a/arch/mips/include/asm/octeon/cvmx-pescx-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-pescx-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,38 +28,22 @@
28#ifndef __CVMX_PESCX_DEFS_H__ 28#ifndef __CVMX_PESCX_DEFS_H__
29#define __CVMX_PESCX_DEFS_H__ 29#define __CVMX_PESCX_DEFS_H__
30 30
31#define CVMX_PESCX_BIST_STATUS(block_id) \ 31#define CVMX_PESCX_BIST_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000018ull) + ((block_id) & 1) * 0x8000000ull)
32 CVMX_ADD_IO_SEG(0x00011800C8000018ull + (((block_id) & 1) * 0x8000000ull)) 32#define CVMX_PESCX_BIST_STATUS2(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000418ull) + ((block_id) & 1) * 0x8000000ull)
33#define CVMX_PESCX_BIST_STATUS2(block_id) \ 33#define CVMX_PESCX_CFG_RD(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000030ull) + ((block_id) & 1) * 0x8000000ull)
34 CVMX_ADD_IO_SEG(0x00011800C8000418ull + (((block_id) & 1) * 0x8000000ull)) 34#define CVMX_PESCX_CFG_WR(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000028ull) + ((block_id) & 1) * 0x8000000ull)
35#define CVMX_PESCX_CFG_RD(block_id) \ 35#define CVMX_PESCX_CPL_LUT_VALID(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000098ull) + ((block_id) & 1) * 0x8000000ull)
36 CVMX_ADD_IO_SEG(0x00011800C8000030ull + (((block_id) & 1) * 0x8000000ull)) 36#define CVMX_PESCX_CTL_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000000ull) + ((block_id) & 1) * 0x8000000ull)
37#define CVMX_PESCX_CFG_WR(block_id) \ 37#define CVMX_PESCX_CTL_STATUS2(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000400ull) + ((block_id) & 1) * 0x8000000ull)
38 CVMX_ADD_IO_SEG(0x00011800C8000028ull + (((block_id) & 1) * 0x8000000ull)) 38#define CVMX_PESCX_DBG_INFO(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000008ull) + ((block_id) & 1) * 0x8000000ull)
39#define CVMX_PESCX_CPL_LUT_VALID(block_id) \ 39#define CVMX_PESCX_DBG_INFO_EN(block_id) (CVMX_ADD_IO_SEG(0x00011800C80000A0ull) + ((block_id) & 1) * 0x8000000ull)
40 CVMX_ADD_IO_SEG(0x00011800C8000098ull + (((block_id) & 1) * 0x8000000ull)) 40#define CVMX_PESCX_DIAG_STATUS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000020ull) + ((block_id) & 1) * 0x8000000ull)
41#define CVMX_PESCX_CTL_STATUS(block_id) \ 41#define CVMX_PESCX_P2N_BAR0_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000080ull) + ((block_id) & 1) * 0x8000000ull)
42 CVMX_ADD_IO_SEG(0x00011800C8000000ull + (((block_id) & 1) * 0x8000000ull)) 42#define CVMX_PESCX_P2N_BAR1_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000088ull) + ((block_id) & 1) * 0x8000000ull)
43#define CVMX_PESCX_CTL_STATUS2(block_id) \ 43#define CVMX_PESCX_P2N_BAR2_START(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000090ull) + ((block_id) & 1) * 0x8000000ull)
44 CVMX_ADD_IO_SEG(0x00011800C8000400ull + (((block_id) & 1) * 0x8000000ull)) 44#define CVMX_PESCX_P2P_BARX_END(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000048ull) + (((offset) & 3) + ((block_id) & 1) * 0x800000ull) * 16)
45#define CVMX_PESCX_DBG_INFO(block_id) \ 45#define CVMX_PESCX_P2P_BARX_START(offset, block_id) (CVMX_ADD_IO_SEG(0x00011800C8000040ull) + (((offset) & 3) + ((block_id) & 1) * 0x800000ull) * 16)
46 CVMX_ADD_IO_SEG(0x00011800C8000008ull + (((block_id) & 1) * 0x8000000ull)) 46#define CVMX_PESCX_TLP_CREDITS(block_id) (CVMX_ADD_IO_SEG(0x00011800C8000038ull) + ((block_id) & 1) * 0x8000000ull)
47#define CVMX_PESCX_DBG_INFO_EN(block_id) \
48 CVMX_ADD_IO_SEG(0x00011800C80000A0ull + (((block_id) & 1) * 0x8000000ull))
49#define CVMX_PESCX_DIAG_STATUS(block_id) \
50 CVMX_ADD_IO_SEG(0x00011800C8000020ull + (((block_id) & 1) * 0x8000000ull))
51#define CVMX_PESCX_P2N_BAR0_START(block_id) \
52 CVMX_ADD_IO_SEG(0x00011800C8000080ull + (((block_id) & 1) * 0x8000000ull))
53#define CVMX_PESCX_P2N_BAR1_START(block_id) \
54 CVMX_ADD_IO_SEG(0x00011800C8000088ull + (((block_id) & 1) * 0x8000000ull))
55#define CVMX_PESCX_P2N_BAR2_START(block_id) \
56 CVMX_ADD_IO_SEG(0x00011800C8000090ull + (((block_id) & 1) * 0x8000000ull))
57#define CVMX_PESCX_P2P_BARX_END(offset, block_id) \
58 CVMX_ADD_IO_SEG(0x00011800C8000048ull + (((offset) & 3) * 16) + (((block_id) & 1) * 0x8000000ull))
59#define CVMX_PESCX_P2P_BARX_START(offset, block_id) \
60 CVMX_ADD_IO_SEG(0x00011800C8000040ull + (((offset) & 3) * 16) + (((block_id) & 1) * 0x8000000ull))
61#define CVMX_PESCX_TLP_CREDITS(block_id) \
62 CVMX_ADD_IO_SEG(0x00011800C8000038ull + (((block_id) & 1) * 0x8000000ull))
63 47
64union cvmx_pescx_bist_status { 48union cvmx_pescx_bist_status {
65 uint64_t u64; 49 uint64_t u64;
diff --git a/arch/mips/include/asm/octeon/cvmx-pexp-defs.h b/arch/mips/include/asm/octeon/cvmx-pexp-defs.h
index 5ea5dc571b54..5ab8679d89af 100644
--- a/arch/mips/include/asm/octeon/cvmx-pexp-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-pexp-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -35,195 +35,191 @@
35#ifndef __CVMX_PEXP_DEFS_H__ 35#ifndef __CVMX_PEXP_DEFS_H__
36#define __CVMX_PEXP_DEFS_H__ 36#define __CVMX_PEXP_DEFS_H__
37 37
38#define CVMX_PEXP_NPEI_BAR1_INDEXX(offset) \ 38#define CVMX_PEXP_NPEI_BAR1_INDEXX(offset) (CVMX_ADD_IO_SEG(0x00011F0000008000ull) + ((offset) & 31) * 16)
39 CVMX_ADD_IO_SEG(0x00011F0000008000ull + (((offset) & 31) * 16)) 39#define CVMX_PEXP_NPEI_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011F0000008580ull))
40#define CVMX_PEXP_NPEI_BIST_STATUS \ 40#define CVMX_PEXP_NPEI_BIST_STATUS2 (CVMX_ADD_IO_SEG(0x00011F0000008680ull))
41 CVMX_ADD_IO_SEG(0x00011F0000008580ull) 41#define CVMX_PEXP_NPEI_CTL_PORT0 (CVMX_ADD_IO_SEG(0x00011F0000008250ull))
42#define CVMX_PEXP_NPEI_BIST_STATUS2 \ 42#define CVMX_PEXP_NPEI_CTL_PORT1 (CVMX_ADD_IO_SEG(0x00011F0000008260ull))
43 CVMX_ADD_IO_SEG(0x00011F0000008680ull) 43#define CVMX_PEXP_NPEI_CTL_STATUS (CVMX_ADD_IO_SEG(0x00011F0000008570ull))
44#define CVMX_PEXP_NPEI_CTL_PORT0 \ 44#define CVMX_PEXP_NPEI_CTL_STATUS2 (CVMX_ADD_IO_SEG(0x00011F000000BC00ull))
45 CVMX_ADD_IO_SEG(0x00011F0000008250ull) 45#define CVMX_PEXP_NPEI_DATA_OUT_CNT (CVMX_ADD_IO_SEG(0x00011F00000085F0ull))
46#define CVMX_PEXP_NPEI_CTL_PORT1 \ 46#define CVMX_PEXP_NPEI_DBG_DATA (CVMX_ADD_IO_SEG(0x00011F0000008510ull))
47 CVMX_ADD_IO_SEG(0x00011F0000008260ull) 47#define CVMX_PEXP_NPEI_DBG_SELECT (CVMX_ADD_IO_SEG(0x00011F0000008500ull))
48#define CVMX_PEXP_NPEI_CTL_STATUS \ 48#define CVMX_PEXP_NPEI_DMA0_INT_LEVEL (CVMX_ADD_IO_SEG(0x00011F00000085C0ull))
49 CVMX_ADD_IO_SEG(0x00011F0000008570ull) 49#define CVMX_PEXP_NPEI_DMA1_INT_LEVEL (CVMX_ADD_IO_SEG(0x00011F00000085D0ull))
50#define CVMX_PEXP_NPEI_CTL_STATUS2 \ 50#define CVMX_PEXP_NPEI_DMAX_COUNTS(offset) (CVMX_ADD_IO_SEG(0x00011F0000008450ull) + ((offset) & 7) * 16)
51 CVMX_ADD_IO_SEG(0x00011F000000BC00ull) 51#define CVMX_PEXP_NPEI_DMAX_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F00000083B0ull) + ((offset) & 7) * 16)
52#define CVMX_PEXP_NPEI_DATA_OUT_CNT \ 52#define CVMX_PEXP_NPEI_DMAX_IBUFF_SADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000008400ull) + ((offset) & 7) * 16)
53 CVMX_ADD_IO_SEG(0x00011F00000085F0ull) 53#define CVMX_PEXP_NPEI_DMAX_NADDR(offset) (CVMX_ADD_IO_SEG(0x00011F00000084A0ull) + ((offset) & 7) * 16)
54#define CVMX_PEXP_NPEI_DBG_DATA \ 54#define CVMX_PEXP_NPEI_DMA_CNTS (CVMX_ADD_IO_SEG(0x00011F00000085E0ull))
55 CVMX_ADD_IO_SEG(0x00011F0000008510ull) 55#define CVMX_PEXP_NPEI_DMA_CONTROL (CVMX_ADD_IO_SEG(0x00011F00000083A0ull))
56#define CVMX_PEXP_NPEI_DBG_SELECT \ 56#define CVMX_PEXP_NPEI_DMA_PCIE_REQ_NUM (CVMX_ADD_IO_SEG(0x00011F00000085B0ull))
57 CVMX_ADD_IO_SEG(0x00011F0000008500ull) 57#define CVMX_PEXP_NPEI_DMA_STATE1 (CVMX_ADD_IO_SEG(0x00011F00000086C0ull))
58#define CVMX_PEXP_NPEI_DMA0_INT_LEVEL \ 58#define CVMX_PEXP_NPEI_DMA_STATE1_P1 (CVMX_ADD_IO_SEG(0x00011F0000008680ull))
59 CVMX_ADD_IO_SEG(0x00011F00000085C0ull) 59#define CVMX_PEXP_NPEI_DMA_STATE2 (CVMX_ADD_IO_SEG(0x00011F00000086D0ull))
60#define CVMX_PEXP_NPEI_DMA1_INT_LEVEL \ 60#define CVMX_PEXP_NPEI_DMA_STATE2_P1 (CVMX_ADD_IO_SEG(0x00011F0000008690ull))
61 CVMX_ADD_IO_SEG(0x00011F00000085D0ull) 61#define CVMX_PEXP_NPEI_DMA_STATE3_P1 (CVMX_ADD_IO_SEG(0x00011F00000086A0ull))
62#define CVMX_PEXP_NPEI_DMAX_COUNTS(offset) \ 62#define CVMX_PEXP_NPEI_DMA_STATE4_P1 (CVMX_ADD_IO_SEG(0x00011F00000086B0ull))
63 CVMX_ADD_IO_SEG(0x00011F0000008450ull + (((offset) & 7) * 16)) 63#define CVMX_PEXP_NPEI_DMA_STATE5_P1 (CVMX_ADD_IO_SEG(0x00011F00000086C0ull))
64#define CVMX_PEXP_NPEI_DMAX_DBELL(offset) \ 64#define CVMX_PEXP_NPEI_INT_A_ENB (CVMX_ADD_IO_SEG(0x00011F0000008560ull))
65 CVMX_ADD_IO_SEG(0x00011F00000083B0ull + (((offset) & 7) * 16)) 65#define CVMX_PEXP_NPEI_INT_A_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BCE0ull))
66#define CVMX_PEXP_NPEI_DMAX_IBUFF_SADDR(offset) \ 66#define CVMX_PEXP_NPEI_INT_A_SUM (CVMX_ADD_IO_SEG(0x00011F0000008550ull))
67 CVMX_ADD_IO_SEG(0x00011F0000008400ull + (((offset) & 7) * 16)) 67#define CVMX_PEXP_NPEI_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000008540ull))
68#define CVMX_PEXP_NPEI_DMAX_NADDR(offset) \ 68#define CVMX_PEXP_NPEI_INT_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BCD0ull))
69 CVMX_ADD_IO_SEG(0x00011F00000084A0ull + (((offset) & 7) * 16)) 69#define CVMX_PEXP_NPEI_INT_INFO (CVMX_ADD_IO_SEG(0x00011F0000008590ull))
70#define CVMX_PEXP_NPEI_DMA_CNTS \ 70#define CVMX_PEXP_NPEI_INT_SUM (CVMX_ADD_IO_SEG(0x00011F0000008530ull))
71 CVMX_ADD_IO_SEG(0x00011F00000085E0ull) 71#define CVMX_PEXP_NPEI_INT_SUM2 (CVMX_ADD_IO_SEG(0x00011F000000BCC0ull))
72#define CVMX_PEXP_NPEI_DMA_CONTROL \ 72#define CVMX_PEXP_NPEI_LAST_WIN_RDATA0 (CVMX_ADD_IO_SEG(0x00011F0000008600ull))
73 CVMX_ADD_IO_SEG(0x00011F00000083A0ull) 73#define CVMX_PEXP_NPEI_LAST_WIN_RDATA1 (CVMX_ADD_IO_SEG(0x00011F0000008610ull))
74#define CVMX_PEXP_NPEI_INT_A_ENB \ 74#define CVMX_PEXP_NPEI_MEM_ACCESS_CTL (CVMX_ADD_IO_SEG(0x00011F00000084F0ull))
75 CVMX_ADD_IO_SEG(0x00011F0000008560ull) 75#define CVMX_PEXP_NPEI_MEM_ACCESS_SUBIDX(offset) (CVMX_ADD_IO_SEG(0x00011F0000008280ull) + ((offset) & 31) * 16 - 16*12)
76#define CVMX_PEXP_NPEI_INT_A_ENB2 \ 76#define CVMX_PEXP_NPEI_MSI_ENB0 (CVMX_ADD_IO_SEG(0x00011F000000BC50ull))
77 CVMX_ADD_IO_SEG(0x00011F000000BCE0ull) 77#define CVMX_PEXP_NPEI_MSI_ENB1 (CVMX_ADD_IO_SEG(0x00011F000000BC60ull))
78#define CVMX_PEXP_NPEI_INT_A_SUM \ 78#define CVMX_PEXP_NPEI_MSI_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BC70ull))
79 CVMX_ADD_IO_SEG(0x00011F0000008550ull) 79#define CVMX_PEXP_NPEI_MSI_ENB3 (CVMX_ADD_IO_SEG(0x00011F000000BC80ull))
80#define CVMX_PEXP_NPEI_INT_ENB \ 80#define CVMX_PEXP_NPEI_MSI_RCV0 (CVMX_ADD_IO_SEG(0x00011F000000BC10ull))
81 CVMX_ADD_IO_SEG(0x00011F0000008540ull) 81#define CVMX_PEXP_NPEI_MSI_RCV1 (CVMX_ADD_IO_SEG(0x00011F000000BC20ull))
82#define CVMX_PEXP_NPEI_INT_ENB2 \ 82#define CVMX_PEXP_NPEI_MSI_RCV2 (CVMX_ADD_IO_SEG(0x00011F000000BC30ull))
83 CVMX_ADD_IO_SEG(0x00011F000000BCD0ull) 83#define CVMX_PEXP_NPEI_MSI_RCV3 (CVMX_ADD_IO_SEG(0x00011F000000BC40ull))
84#define CVMX_PEXP_NPEI_INT_INFO \ 84#define CVMX_PEXP_NPEI_MSI_RD_MAP (CVMX_ADD_IO_SEG(0x00011F000000BCA0ull))
85 CVMX_ADD_IO_SEG(0x00011F0000008590ull) 85#define CVMX_PEXP_NPEI_MSI_W1C_ENB0 (CVMX_ADD_IO_SEG(0x00011F000000BCF0ull))
86#define CVMX_PEXP_NPEI_INT_SUM \ 86#define CVMX_PEXP_NPEI_MSI_W1C_ENB1 (CVMX_ADD_IO_SEG(0x00011F000000BD00ull))
87 CVMX_ADD_IO_SEG(0x00011F0000008530ull) 87#define CVMX_PEXP_NPEI_MSI_W1C_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BD10ull))
88#define CVMX_PEXP_NPEI_INT_SUM2 \ 88#define CVMX_PEXP_NPEI_MSI_W1C_ENB3 (CVMX_ADD_IO_SEG(0x00011F000000BD20ull))
89 CVMX_ADD_IO_SEG(0x00011F000000BCC0ull) 89#define CVMX_PEXP_NPEI_MSI_W1S_ENB0 (CVMX_ADD_IO_SEG(0x00011F000000BD30ull))
90#define CVMX_PEXP_NPEI_LAST_WIN_RDATA0 \ 90#define CVMX_PEXP_NPEI_MSI_W1S_ENB1 (CVMX_ADD_IO_SEG(0x00011F000000BD40ull))
91 CVMX_ADD_IO_SEG(0x00011F0000008600ull) 91#define CVMX_PEXP_NPEI_MSI_W1S_ENB2 (CVMX_ADD_IO_SEG(0x00011F000000BD50ull))
92#define CVMX_PEXP_NPEI_LAST_WIN_RDATA1 \ 92#define CVMX_PEXP_NPEI_MSI_W1S_ENB3 (CVMX_ADD_IO_SEG(0x00011F000000BD60ull))
93 CVMX_ADD_IO_SEG(0x00011F0000008610ull) 93#define CVMX_PEXP_NPEI_MSI_WR_MAP (CVMX_ADD_IO_SEG(0x00011F000000BC90ull))
94#define CVMX_PEXP_NPEI_MEM_ACCESS_CTL \ 94#define CVMX_PEXP_NPEI_PCIE_CREDIT_CNT (CVMX_ADD_IO_SEG(0x00011F000000BD70ull))
95 CVMX_ADD_IO_SEG(0x00011F00000084F0ull) 95#define CVMX_PEXP_NPEI_PCIE_MSI_RCV (CVMX_ADD_IO_SEG(0x00011F000000BCB0ull))
96#define CVMX_PEXP_NPEI_MEM_ACCESS_SUBIDX(offset) \ 96#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B1 (CVMX_ADD_IO_SEG(0x00011F0000008650ull))
97 CVMX_ADD_IO_SEG(0x00011F0000008280ull + (((offset) & 31) * 16) - 16 * 12) 97#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B2 (CVMX_ADD_IO_SEG(0x00011F0000008660ull))
98#define CVMX_PEXP_NPEI_MSI_ENB0 \ 98#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B3 (CVMX_ADD_IO_SEG(0x00011F0000008670ull))
99 CVMX_ADD_IO_SEG(0x00011F000000BC50ull) 99#define CVMX_PEXP_NPEI_PKTX_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F000000A400ull) + ((offset) & 31) * 16)
100#define CVMX_PEXP_NPEI_MSI_ENB1 \ 100#define CVMX_PEXP_NPEI_PKTX_INSTR_BADDR(offset) (CVMX_ADD_IO_SEG(0x00011F000000A800ull) + ((offset) & 31) * 16)
101 CVMX_ADD_IO_SEG(0x00011F000000BC60ull) 101#define CVMX_PEXP_NPEI_PKTX_INSTR_BAOFF_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F000000AC00ull) + ((offset) & 31) * 16)
102#define CVMX_PEXP_NPEI_MSI_ENB2 \ 102#define CVMX_PEXP_NPEI_PKTX_INSTR_FIFO_RSIZE(offset) (CVMX_ADD_IO_SEG(0x00011F000000B000ull) + ((offset) & 31) * 16)
103 CVMX_ADD_IO_SEG(0x00011F000000BC70ull) 103#define CVMX_PEXP_NPEI_PKTX_INSTR_HEADER(offset) (CVMX_ADD_IO_SEG(0x00011F000000B400ull) + ((offset) & 31) * 16)
104#define CVMX_PEXP_NPEI_MSI_ENB3 \ 104#define CVMX_PEXP_NPEI_PKTX_IN_BP(offset) (CVMX_ADD_IO_SEG(0x00011F000000B800ull) + ((offset) & 31) * 16)
105 CVMX_ADD_IO_SEG(0x00011F000000BC80ull) 105#define CVMX_PEXP_NPEI_PKTX_SLIST_BADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000009400ull) + ((offset) & 31) * 16)
106#define CVMX_PEXP_NPEI_MSI_RCV0 \ 106#define CVMX_PEXP_NPEI_PKTX_SLIST_BAOFF_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F0000009800ull) + ((offset) & 31) * 16)
107 CVMX_ADD_IO_SEG(0x00011F000000BC10ull) 107#define CVMX_PEXP_NPEI_PKTX_SLIST_FIFO_RSIZE(offset) (CVMX_ADD_IO_SEG(0x00011F0000009C00ull) + ((offset) & 31) * 16)
108#define CVMX_PEXP_NPEI_MSI_RCV1 \ 108#define CVMX_PEXP_NPEI_PKT_CNT_INT (CVMX_ADD_IO_SEG(0x00011F0000009110ull))
109 CVMX_ADD_IO_SEG(0x00011F000000BC20ull) 109#define CVMX_PEXP_NPEI_PKT_CNT_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000009130ull))
110#define CVMX_PEXP_NPEI_MSI_RCV2 \ 110#define CVMX_PEXP_NPEI_PKT_DATA_OUT_ES (CVMX_ADD_IO_SEG(0x00011F00000090B0ull))
111 CVMX_ADD_IO_SEG(0x00011F000000BC30ull) 111#define CVMX_PEXP_NPEI_PKT_DATA_OUT_NS (CVMX_ADD_IO_SEG(0x00011F00000090A0ull))
112#define CVMX_PEXP_NPEI_MSI_RCV3 \ 112#define CVMX_PEXP_NPEI_PKT_DATA_OUT_ROR (CVMX_ADD_IO_SEG(0x00011F0000009090ull))
113 CVMX_ADD_IO_SEG(0x00011F000000BC40ull) 113#define CVMX_PEXP_NPEI_PKT_DPADDR (CVMX_ADD_IO_SEG(0x00011F0000009080ull))
114#define CVMX_PEXP_NPEI_MSI_RD_MAP \ 114#define CVMX_PEXP_NPEI_PKT_INPUT_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000009150ull))
115 CVMX_ADD_IO_SEG(0x00011F000000BCA0ull) 115#define CVMX_PEXP_NPEI_PKT_INSTR_ENB (CVMX_ADD_IO_SEG(0x00011F0000009000ull))
116#define CVMX_PEXP_NPEI_MSI_W1C_ENB0 \ 116#define CVMX_PEXP_NPEI_PKT_INSTR_RD_SIZE (CVMX_ADD_IO_SEG(0x00011F0000009190ull))
117 CVMX_ADD_IO_SEG(0x00011F000000BCF0ull) 117#define CVMX_PEXP_NPEI_PKT_INSTR_SIZE (CVMX_ADD_IO_SEG(0x00011F0000009020ull))
118#define CVMX_PEXP_NPEI_MSI_W1C_ENB1 \ 118#define CVMX_PEXP_NPEI_PKT_INT_LEVELS (CVMX_ADD_IO_SEG(0x00011F0000009100ull))
119 CVMX_ADD_IO_SEG(0x00011F000000BD00ull) 119#define CVMX_PEXP_NPEI_PKT_IN_BP (CVMX_ADD_IO_SEG(0x00011F00000086B0ull))
120#define CVMX_PEXP_NPEI_MSI_W1C_ENB2 \ 120#define CVMX_PEXP_NPEI_PKT_IN_DONEX_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F000000A000ull) + ((offset) & 31) * 16)
121 CVMX_ADD_IO_SEG(0x00011F000000BD10ull) 121#define CVMX_PEXP_NPEI_PKT_IN_INSTR_COUNTS (CVMX_ADD_IO_SEG(0x00011F00000086A0ull))
122#define CVMX_PEXP_NPEI_MSI_W1C_ENB3 \ 122#define CVMX_PEXP_NPEI_PKT_IN_PCIE_PORT (CVMX_ADD_IO_SEG(0x00011F00000091A0ull))
123 CVMX_ADD_IO_SEG(0x00011F000000BD20ull) 123#define CVMX_PEXP_NPEI_PKT_IPTR (CVMX_ADD_IO_SEG(0x00011F0000009070ull))
124#define CVMX_PEXP_NPEI_MSI_W1S_ENB0 \ 124#define CVMX_PEXP_NPEI_PKT_OUTPUT_WMARK (CVMX_ADD_IO_SEG(0x00011F0000009160ull))
125 CVMX_ADD_IO_SEG(0x00011F000000BD30ull) 125#define CVMX_PEXP_NPEI_PKT_OUT_BMODE (CVMX_ADD_IO_SEG(0x00011F00000090D0ull))
126#define CVMX_PEXP_NPEI_MSI_W1S_ENB1 \ 126#define CVMX_PEXP_NPEI_PKT_OUT_ENB (CVMX_ADD_IO_SEG(0x00011F0000009010ull))
127 CVMX_ADD_IO_SEG(0x00011F000000BD40ull) 127#define CVMX_PEXP_NPEI_PKT_PCIE_PORT (CVMX_ADD_IO_SEG(0x00011F00000090E0ull))
128#define CVMX_PEXP_NPEI_MSI_W1S_ENB2 \ 128#define CVMX_PEXP_NPEI_PKT_PORT_IN_RST (CVMX_ADD_IO_SEG(0x00011F0000008690ull))
129 CVMX_ADD_IO_SEG(0x00011F000000BD50ull) 129#define CVMX_PEXP_NPEI_PKT_SLIST_ES (CVMX_ADD_IO_SEG(0x00011F0000009050ull))
130#define CVMX_PEXP_NPEI_MSI_W1S_ENB3 \ 130#define CVMX_PEXP_NPEI_PKT_SLIST_ID_SIZE (CVMX_ADD_IO_SEG(0x00011F0000009180ull))
131 CVMX_ADD_IO_SEG(0x00011F000000BD60ull) 131#define CVMX_PEXP_NPEI_PKT_SLIST_NS (CVMX_ADD_IO_SEG(0x00011F0000009040ull))
132#define CVMX_PEXP_NPEI_MSI_WR_MAP \ 132#define CVMX_PEXP_NPEI_PKT_SLIST_ROR (CVMX_ADD_IO_SEG(0x00011F0000009030ull))
133 CVMX_ADD_IO_SEG(0x00011F000000BC90ull) 133#define CVMX_PEXP_NPEI_PKT_TIME_INT (CVMX_ADD_IO_SEG(0x00011F0000009120ull))
134#define CVMX_PEXP_NPEI_PCIE_CREDIT_CNT \ 134#define CVMX_PEXP_NPEI_PKT_TIME_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000009140ull))
135 CVMX_ADD_IO_SEG(0x00011F000000BD70ull) 135#define CVMX_PEXP_NPEI_RSL_INT_BLOCKS (CVMX_ADD_IO_SEG(0x00011F0000008520ull))
136#define CVMX_PEXP_NPEI_PCIE_MSI_RCV \ 136#define CVMX_PEXP_NPEI_SCRATCH_1 (CVMX_ADD_IO_SEG(0x00011F0000008270ull))
137 CVMX_ADD_IO_SEG(0x00011F000000BCB0ull) 137#define CVMX_PEXP_NPEI_STATE1 (CVMX_ADD_IO_SEG(0x00011F0000008620ull))
138#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B1 \ 138#define CVMX_PEXP_NPEI_STATE2 (CVMX_ADD_IO_SEG(0x00011F0000008630ull))
139 CVMX_ADD_IO_SEG(0x00011F0000008650ull) 139#define CVMX_PEXP_NPEI_STATE3 (CVMX_ADD_IO_SEG(0x00011F0000008640ull))
140#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B2 \ 140#define CVMX_PEXP_NPEI_WINDOW_CTL (CVMX_ADD_IO_SEG(0x00011F0000008380ull))
141 CVMX_ADD_IO_SEG(0x00011F0000008660ull) 141#define CVMX_PEXP_SLI_BIST_STATUS (CVMX_ADD_IO_SEG(0x00011F0000010580ull))
142#define CVMX_PEXP_NPEI_PCIE_MSI_RCV_B3 \ 142#define CVMX_PEXP_SLI_CTL_PORTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000010050ull) + ((offset) & 1) * 16)
143 CVMX_ADD_IO_SEG(0x00011F0000008670ull) 143#define CVMX_PEXP_SLI_CTL_STATUS (CVMX_ADD_IO_SEG(0x00011F0000010570ull))
144#define CVMX_PEXP_NPEI_PKTX_CNTS(offset) \ 144#define CVMX_PEXP_SLI_DATA_OUT_CNT (CVMX_ADD_IO_SEG(0x00011F00000105F0ull))
145 CVMX_ADD_IO_SEG(0x00011F000000A400ull + (((offset) & 31) * 16)) 145#define CVMX_PEXP_SLI_DBG_DATA (CVMX_ADD_IO_SEG(0x00011F0000010310ull))
146#define CVMX_PEXP_NPEI_PKTX_INSTR_BADDR(offset) \ 146#define CVMX_PEXP_SLI_DBG_SELECT (CVMX_ADD_IO_SEG(0x00011F0000010300ull))
147 CVMX_ADD_IO_SEG(0x00011F000000A800ull + (((offset) & 31) * 16)) 147#define CVMX_PEXP_SLI_DMAX_CNT(offset) (CVMX_ADD_IO_SEG(0x00011F0000010400ull) + ((offset) & 1) * 16)
148#define CVMX_PEXP_NPEI_PKTX_INSTR_BAOFF_DBELL(offset) \ 148#define CVMX_PEXP_SLI_DMAX_INT_LEVEL(offset) (CVMX_ADD_IO_SEG(0x00011F00000103E0ull) + ((offset) & 1) * 16)
149 CVMX_ADD_IO_SEG(0x00011F000000AC00ull + (((offset) & 31) * 16)) 149#define CVMX_PEXP_SLI_DMAX_TIM(offset) (CVMX_ADD_IO_SEG(0x00011F0000010420ull) + ((offset) & 1) * 16)
150#define CVMX_PEXP_NPEI_PKTX_INSTR_FIFO_RSIZE(offset) \ 150#define CVMX_PEXP_SLI_INT_ENB_CIU (CVMX_ADD_IO_SEG(0x00011F0000013CD0ull))
151 CVMX_ADD_IO_SEG(0x00011F000000B000ull + (((offset) & 31) * 16)) 151#define CVMX_PEXP_SLI_INT_ENB_PORTX(offset) (CVMX_ADD_IO_SEG(0x00011F0000010340ull) + ((offset) & 1) * 16)
152#define CVMX_PEXP_NPEI_PKTX_INSTR_HEADER(offset) \ 152#define CVMX_PEXP_SLI_INT_SUM (CVMX_ADD_IO_SEG(0x00011F0000010330ull))
153 CVMX_ADD_IO_SEG(0x00011F000000B400ull + (((offset) & 31) * 16)) 153#define CVMX_PEXP_SLI_LAST_WIN_RDATA0 (CVMX_ADD_IO_SEG(0x00011F0000010600ull))
154#define CVMX_PEXP_NPEI_PKTX_IN_BP(offset) \ 154#define CVMX_PEXP_SLI_LAST_WIN_RDATA1 (CVMX_ADD_IO_SEG(0x00011F0000010610ull))
155 CVMX_ADD_IO_SEG(0x00011F000000B800ull + (((offset) & 31) * 16)) 155#define CVMX_PEXP_SLI_MAC_CREDIT_CNT (CVMX_ADD_IO_SEG(0x00011F0000013D70ull))
156#define CVMX_PEXP_NPEI_PKTX_SLIST_BADDR(offset) \ 156#define CVMX_PEXP_SLI_MEM_ACCESS_CTL (CVMX_ADD_IO_SEG(0x00011F00000102F0ull))
157 CVMX_ADD_IO_SEG(0x00011F0000009400ull + (((offset) & 31) * 16)) 157#define CVMX_PEXP_SLI_MEM_ACCESS_SUBIDX(offset) (CVMX_ADD_IO_SEG(0x00011F00000100E0ull) + ((offset) & 31) * 16 - 16*12)
158#define CVMX_PEXP_NPEI_PKTX_SLIST_BAOFF_DBELL(offset) \ 158#define CVMX_PEXP_SLI_MSI_ENB0 (CVMX_ADD_IO_SEG(0x00011F0000013C50ull))
159 CVMX_ADD_IO_SEG(0x00011F0000009800ull + (((offset) & 31) * 16)) 159#define CVMX_PEXP_SLI_MSI_ENB1 (CVMX_ADD_IO_SEG(0x00011F0000013C60ull))
160#define CVMX_PEXP_NPEI_PKTX_SLIST_FIFO_RSIZE(offset) \ 160#define CVMX_PEXP_SLI_MSI_ENB2 (CVMX_ADD_IO_SEG(0x00011F0000013C70ull))
161 CVMX_ADD_IO_SEG(0x00011F0000009C00ull + (((offset) & 31) * 16)) 161#define CVMX_PEXP_SLI_MSI_ENB3 (CVMX_ADD_IO_SEG(0x00011F0000013C80ull))
162#define CVMX_PEXP_NPEI_PKT_CNT_INT \ 162#define CVMX_PEXP_SLI_MSI_RCV0 (CVMX_ADD_IO_SEG(0x00011F0000013C10ull))
163 CVMX_ADD_IO_SEG(0x00011F0000009110ull) 163#define CVMX_PEXP_SLI_MSI_RCV1 (CVMX_ADD_IO_SEG(0x00011F0000013C20ull))
164#define CVMX_PEXP_NPEI_PKT_CNT_INT_ENB \ 164#define CVMX_PEXP_SLI_MSI_RCV2 (CVMX_ADD_IO_SEG(0x00011F0000013C30ull))
165 CVMX_ADD_IO_SEG(0x00011F0000009130ull) 165#define CVMX_PEXP_SLI_MSI_RCV3 (CVMX_ADD_IO_SEG(0x00011F0000013C40ull))
166#define CVMX_PEXP_NPEI_PKT_DATA_OUT_ES \ 166#define CVMX_PEXP_SLI_MSI_RD_MAP (CVMX_ADD_IO_SEG(0x00011F0000013CA0ull))
167 CVMX_ADD_IO_SEG(0x00011F00000090B0ull) 167#define CVMX_PEXP_SLI_MSI_W1C_ENB0 (CVMX_ADD_IO_SEG(0x00011F0000013CF0ull))
168#define CVMX_PEXP_NPEI_PKT_DATA_OUT_NS \ 168#define CVMX_PEXP_SLI_MSI_W1C_ENB1 (CVMX_ADD_IO_SEG(0x00011F0000013D00ull))
169 CVMX_ADD_IO_SEG(0x00011F00000090A0ull) 169#define CVMX_PEXP_SLI_MSI_W1C_ENB2 (CVMX_ADD_IO_SEG(0x00011F0000013D10ull))
170#define CVMX_PEXP_NPEI_PKT_DATA_OUT_ROR \ 170#define CVMX_PEXP_SLI_MSI_W1C_ENB3 (CVMX_ADD_IO_SEG(0x00011F0000013D20ull))
171 CVMX_ADD_IO_SEG(0x00011F0000009090ull) 171#define CVMX_PEXP_SLI_MSI_W1S_ENB0 (CVMX_ADD_IO_SEG(0x00011F0000013D30ull))
172#define CVMX_PEXP_NPEI_PKT_DPADDR \ 172#define CVMX_PEXP_SLI_MSI_W1S_ENB1 (CVMX_ADD_IO_SEG(0x00011F0000013D40ull))
173 CVMX_ADD_IO_SEG(0x00011F0000009080ull) 173#define CVMX_PEXP_SLI_MSI_W1S_ENB2 (CVMX_ADD_IO_SEG(0x00011F0000013D50ull))
174#define CVMX_PEXP_NPEI_PKT_INPUT_CONTROL \ 174#define CVMX_PEXP_SLI_MSI_W1S_ENB3 (CVMX_ADD_IO_SEG(0x00011F0000013D60ull))
175 CVMX_ADD_IO_SEG(0x00011F0000009150ull) 175#define CVMX_PEXP_SLI_MSI_WR_MAP (CVMX_ADD_IO_SEG(0x00011F0000013C90ull))
176#define CVMX_PEXP_NPEI_PKT_INSTR_ENB \ 176#define CVMX_PEXP_SLI_PCIE_MSI_RCV (CVMX_ADD_IO_SEG(0x00011F0000013CB0ull))
177 CVMX_ADD_IO_SEG(0x00011F0000009000ull) 177#define CVMX_PEXP_SLI_PCIE_MSI_RCV_B1 (CVMX_ADD_IO_SEG(0x00011F0000010650ull))
178#define CVMX_PEXP_NPEI_PKT_INSTR_RD_SIZE \ 178#define CVMX_PEXP_SLI_PCIE_MSI_RCV_B2 (CVMX_ADD_IO_SEG(0x00011F0000010660ull))
179 CVMX_ADD_IO_SEG(0x00011F0000009190ull) 179#define CVMX_PEXP_SLI_PCIE_MSI_RCV_B3 (CVMX_ADD_IO_SEG(0x00011F0000010670ull))
180#define CVMX_PEXP_NPEI_PKT_INSTR_SIZE \ 180#define CVMX_PEXP_SLI_PKTX_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F0000012400ull) + ((offset) & 31) * 16)
181 CVMX_ADD_IO_SEG(0x00011F0000009020ull) 181#define CVMX_PEXP_SLI_PKTX_INSTR_BADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000012800ull) + ((offset) & 31) * 16)
182#define CVMX_PEXP_NPEI_PKT_INT_LEVELS \ 182#define CVMX_PEXP_SLI_PKTX_INSTR_BAOFF_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F0000012C00ull) + ((offset) & 31) * 16)
183 CVMX_ADD_IO_SEG(0x00011F0000009100ull) 183#define CVMX_PEXP_SLI_PKTX_INSTR_FIFO_RSIZE(offset) (CVMX_ADD_IO_SEG(0x00011F0000013000ull) + ((offset) & 31) * 16)
184#define CVMX_PEXP_NPEI_PKT_IN_BP \ 184#define CVMX_PEXP_SLI_PKTX_INSTR_HEADER(offset) (CVMX_ADD_IO_SEG(0x00011F0000013400ull) + ((offset) & 31) * 16)
185 CVMX_ADD_IO_SEG(0x00011F00000086B0ull) 185#define CVMX_PEXP_SLI_PKTX_IN_BP(offset) (CVMX_ADD_IO_SEG(0x00011F0000013800ull) + ((offset) & 31) * 16)
186#define CVMX_PEXP_NPEI_PKT_IN_DONEX_CNTS(offset) \ 186#define CVMX_PEXP_SLI_PKTX_OUT_SIZE(offset) (CVMX_ADD_IO_SEG(0x00011F0000010C00ull) + ((offset) & 31) * 16)
187 CVMX_ADD_IO_SEG(0x00011F000000A000ull + (((offset) & 31) * 16)) 187#define CVMX_PEXP_SLI_PKTX_SLIST_BADDR(offset) (CVMX_ADD_IO_SEG(0x00011F0000011400ull) + ((offset) & 31) * 16)
188#define CVMX_PEXP_NPEI_PKT_IN_INSTR_COUNTS \ 188#define CVMX_PEXP_SLI_PKTX_SLIST_BAOFF_DBELL(offset) (CVMX_ADD_IO_SEG(0x00011F0000011800ull) + ((offset) & 31) * 16)
189 CVMX_ADD_IO_SEG(0x00011F00000086A0ull) 189#define CVMX_PEXP_SLI_PKTX_SLIST_FIFO_RSIZE(offset) (CVMX_ADD_IO_SEG(0x00011F0000011C00ull) + ((offset) & 31) * 16)
190#define CVMX_PEXP_NPEI_PKT_IN_PCIE_PORT \ 190#define CVMX_PEXP_SLI_PKT_CNT_INT (CVMX_ADD_IO_SEG(0x00011F0000011130ull))
191 CVMX_ADD_IO_SEG(0x00011F00000091A0ull) 191#define CVMX_PEXP_SLI_PKT_CNT_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000011150ull))
192#define CVMX_PEXP_NPEI_PKT_IPTR \ 192#define CVMX_PEXP_SLI_PKT_CTL (CVMX_ADD_IO_SEG(0x00011F0000011220ull))
193 CVMX_ADD_IO_SEG(0x00011F0000009070ull) 193#define CVMX_PEXP_SLI_PKT_DATA_OUT_ES (CVMX_ADD_IO_SEG(0x00011F00000110B0ull))
194#define CVMX_PEXP_NPEI_PKT_OUTPUT_WMARK \ 194#define CVMX_PEXP_SLI_PKT_DATA_OUT_NS (CVMX_ADD_IO_SEG(0x00011F00000110A0ull))
195 CVMX_ADD_IO_SEG(0x00011F0000009160ull) 195#define CVMX_PEXP_SLI_PKT_DATA_OUT_ROR (CVMX_ADD_IO_SEG(0x00011F0000011090ull))
196#define CVMX_PEXP_NPEI_PKT_OUT_BMODE \ 196#define CVMX_PEXP_SLI_PKT_DPADDR (CVMX_ADD_IO_SEG(0x00011F0000011080ull))
197 CVMX_ADD_IO_SEG(0x00011F00000090D0ull) 197#define CVMX_PEXP_SLI_PKT_INPUT_CONTROL (CVMX_ADD_IO_SEG(0x00011F0000011170ull))
198#define CVMX_PEXP_NPEI_PKT_OUT_ENB \ 198#define CVMX_PEXP_SLI_PKT_INSTR_ENB (CVMX_ADD_IO_SEG(0x00011F0000011000ull))
199 CVMX_ADD_IO_SEG(0x00011F0000009010ull) 199#define CVMX_PEXP_SLI_PKT_INSTR_RD_SIZE (CVMX_ADD_IO_SEG(0x00011F00000111A0ull))
200#define CVMX_PEXP_NPEI_PKT_PCIE_PORT \ 200#define CVMX_PEXP_SLI_PKT_INSTR_SIZE (CVMX_ADD_IO_SEG(0x00011F0000011020ull))
201 CVMX_ADD_IO_SEG(0x00011F00000090E0ull) 201#define CVMX_PEXP_SLI_PKT_INT_LEVELS (CVMX_ADD_IO_SEG(0x00011F0000011120ull))
202#define CVMX_PEXP_NPEI_PKT_PORT_IN_RST \ 202#define CVMX_PEXP_SLI_PKT_IN_BP (CVMX_ADD_IO_SEG(0x00011F0000011210ull))
203 CVMX_ADD_IO_SEG(0x00011F0000008690ull) 203#define CVMX_PEXP_SLI_PKT_IN_DONEX_CNTS(offset) (CVMX_ADD_IO_SEG(0x00011F0000012000ull) + ((offset) & 31) * 16)
204#define CVMX_PEXP_NPEI_PKT_SLIST_ES \ 204#define CVMX_PEXP_SLI_PKT_IN_INSTR_COUNTS (CVMX_ADD_IO_SEG(0x00011F0000011200ull))
205 CVMX_ADD_IO_SEG(0x00011F0000009050ull) 205#define CVMX_PEXP_SLI_PKT_IN_PCIE_PORT (CVMX_ADD_IO_SEG(0x00011F00000111B0ull))
206#define CVMX_PEXP_NPEI_PKT_SLIST_ID_SIZE \ 206#define CVMX_PEXP_SLI_PKT_IPTR (CVMX_ADD_IO_SEG(0x00011F0000011070ull))
207 CVMX_ADD_IO_SEG(0x00011F0000009180ull) 207#define CVMX_PEXP_SLI_PKT_OUTPUT_WMARK (CVMX_ADD_IO_SEG(0x00011F0000011180ull))
208#define CVMX_PEXP_NPEI_PKT_SLIST_NS \ 208#define CVMX_PEXP_SLI_PKT_OUT_BMODE (CVMX_ADD_IO_SEG(0x00011F00000110D0ull))
209 CVMX_ADD_IO_SEG(0x00011F0000009040ull) 209#define CVMX_PEXP_SLI_PKT_OUT_ENB (CVMX_ADD_IO_SEG(0x00011F0000011010ull))
210#define CVMX_PEXP_NPEI_PKT_SLIST_ROR \ 210#define CVMX_PEXP_SLI_PKT_PCIE_PORT (CVMX_ADD_IO_SEG(0x00011F00000110E0ull))
211 CVMX_ADD_IO_SEG(0x00011F0000009030ull) 211#define CVMX_PEXP_SLI_PKT_PORT_IN_RST (CVMX_ADD_IO_SEG(0x00011F00000111F0ull))
212#define CVMX_PEXP_NPEI_PKT_TIME_INT \ 212#define CVMX_PEXP_SLI_PKT_SLIST_ES (CVMX_ADD_IO_SEG(0x00011F0000011050ull))
213 CVMX_ADD_IO_SEG(0x00011F0000009120ull) 213#define CVMX_PEXP_SLI_PKT_SLIST_NS (CVMX_ADD_IO_SEG(0x00011F0000011040ull))
214#define CVMX_PEXP_NPEI_PKT_TIME_INT_ENB \ 214#define CVMX_PEXP_SLI_PKT_SLIST_ROR (CVMX_ADD_IO_SEG(0x00011F0000011030ull))
215 CVMX_ADD_IO_SEG(0x00011F0000009140ull) 215#define CVMX_PEXP_SLI_PKT_TIME_INT (CVMX_ADD_IO_SEG(0x00011F0000011140ull))
216#define CVMX_PEXP_NPEI_RSL_INT_BLOCKS \ 216#define CVMX_PEXP_SLI_PKT_TIME_INT_ENB (CVMX_ADD_IO_SEG(0x00011F0000011160ull))
217 CVMX_ADD_IO_SEG(0x00011F0000008520ull) 217#define CVMX_PEXP_SLI_S2M_PORTX_CTL(offset) (CVMX_ADD_IO_SEG(0x00011F0000013D80ull) + ((offset) & 1) * 16)
218#define CVMX_PEXP_NPEI_SCRATCH_1 \ 218#define CVMX_PEXP_SLI_SCRATCH_1 (CVMX_ADD_IO_SEG(0x00011F00000103C0ull))
219 CVMX_ADD_IO_SEG(0x00011F0000008270ull) 219#define CVMX_PEXP_SLI_SCRATCH_2 (CVMX_ADD_IO_SEG(0x00011F00000103D0ull))
220#define CVMX_PEXP_NPEI_STATE1 \ 220#define CVMX_PEXP_SLI_STATE1 (CVMX_ADD_IO_SEG(0x00011F0000010620ull))
221 CVMX_ADD_IO_SEG(0x00011F0000008620ull) 221#define CVMX_PEXP_SLI_STATE2 (CVMX_ADD_IO_SEG(0x00011F0000010630ull))
222#define CVMX_PEXP_NPEI_STATE2 \ 222#define CVMX_PEXP_SLI_STATE3 (CVMX_ADD_IO_SEG(0x00011F0000010640ull))
223 CVMX_ADD_IO_SEG(0x00011F0000008630ull) 223#define CVMX_PEXP_SLI_WINDOW_CTL (CVMX_ADD_IO_SEG(0x00011F00000102E0ull))
224#define CVMX_PEXP_NPEI_STATE3 \
225 CVMX_ADD_IO_SEG(0x00011F0000008640ull)
226#define CVMX_PEXP_NPEI_WINDOW_CTL \
227 CVMX_ADD_IO_SEG(0x00011F0000008380ull)
228 224
229#endif 225#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-pow-defs.h b/arch/mips/include/asm/octeon/cvmx-pow-defs.h
index 2d82e24be51c..39fd75b03f77 100644
--- a/arch/mips/include/asm/octeon/cvmx-pow-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-pow-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,52 +28,29 @@
28#ifndef __CVMX_POW_DEFS_H__ 28#ifndef __CVMX_POW_DEFS_H__
29#define __CVMX_POW_DEFS_H__ 29#define __CVMX_POW_DEFS_H__
30 30
31#define CVMX_POW_BIST_STAT \ 31#define CVMX_POW_BIST_STAT (CVMX_ADD_IO_SEG(0x00016700000003F8ull))
32 CVMX_ADD_IO_SEG(0x00016700000003F8ull) 32#define CVMX_POW_DS_PC (CVMX_ADD_IO_SEG(0x0001670000000398ull))
33#define CVMX_POW_DS_PC \ 33#define CVMX_POW_ECC_ERR (CVMX_ADD_IO_SEG(0x0001670000000218ull))
34 CVMX_ADD_IO_SEG(0x0001670000000398ull) 34#define CVMX_POW_INT_CTL (CVMX_ADD_IO_SEG(0x0001670000000220ull))
35#define CVMX_POW_ECC_ERR \ 35#define CVMX_POW_IQ_CNTX(offset) (CVMX_ADD_IO_SEG(0x0001670000000340ull) + ((offset) & 7) * 8)
36 CVMX_ADD_IO_SEG(0x0001670000000218ull) 36#define CVMX_POW_IQ_COM_CNT (CVMX_ADD_IO_SEG(0x0001670000000388ull))
37#define CVMX_POW_INT_CTL \ 37#define CVMX_POW_IQ_INT (CVMX_ADD_IO_SEG(0x0001670000000238ull))
38 CVMX_ADD_IO_SEG(0x0001670000000220ull) 38#define CVMX_POW_IQ_INT_EN (CVMX_ADD_IO_SEG(0x0001670000000240ull))
39#define CVMX_POW_IQ_CNTX(offset) \ 39#define CVMX_POW_IQ_THRX(offset) (CVMX_ADD_IO_SEG(0x00016700000003A0ull) + ((offset) & 7) * 8)
40 CVMX_ADD_IO_SEG(0x0001670000000340ull + (((offset) & 7) * 8)) 40#define CVMX_POW_NOS_CNT (CVMX_ADD_IO_SEG(0x0001670000000228ull))
41#define CVMX_POW_IQ_COM_CNT \ 41#define CVMX_POW_NW_TIM (CVMX_ADD_IO_SEG(0x0001670000000210ull))
42 CVMX_ADD_IO_SEG(0x0001670000000388ull) 42#define CVMX_POW_PF_RST_MSK (CVMX_ADD_IO_SEG(0x0001670000000230ull))
43#define CVMX_POW_IQ_INT \ 43#define CVMX_POW_PP_GRP_MSKX(offset) (CVMX_ADD_IO_SEG(0x0001670000000000ull) + ((offset) & 15) * 8)
44 CVMX_ADD_IO_SEG(0x0001670000000238ull) 44#define CVMX_POW_QOS_RNDX(offset) (CVMX_ADD_IO_SEG(0x00016700000001C0ull) + ((offset) & 7) * 8)
45#define CVMX_POW_IQ_INT_EN \ 45#define CVMX_POW_QOS_THRX(offset) (CVMX_ADD_IO_SEG(0x0001670000000180ull) + ((offset) & 7) * 8)
46 CVMX_ADD_IO_SEG(0x0001670000000240ull) 46#define CVMX_POW_TS_PC (CVMX_ADD_IO_SEG(0x0001670000000390ull))
47#define CVMX_POW_IQ_THRX(offset) \ 47#define CVMX_POW_WA_COM_PC (CVMX_ADD_IO_SEG(0x0001670000000380ull))
48 CVMX_ADD_IO_SEG(0x00016700000003A0ull + (((offset) & 7) * 8)) 48#define CVMX_POW_WA_PCX(offset) (CVMX_ADD_IO_SEG(0x0001670000000300ull) + ((offset) & 7) * 8)
49#define CVMX_POW_NOS_CNT \ 49#define CVMX_POW_WQ_INT (CVMX_ADD_IO_SEG(0x0001670000000200ull))
50 CVMX_ADD_IO_SEG(0x0001670000000228ull) 50#define CVMX_POW_WQ_INT_CNTX(offset) (CVMX_ADD_IO_SEG(0x0001670000000100ull) + ((offset) & 15) * 8)
51#define CVMX_POW_NW_TIM \ 51#define CVMX_POW_WQ_INT_PC (CVMX_ADD_IO_SEG(0x0001670000000208ull))
52 CVMX_ADD_IO_SEG(0x0001670000000210ull) 52#define CVMX_POW_WQ_INT_THRX(offset) (CVMX_ADD_IO_SEG(0x0001670000000080ull) + ((offset) & 15) * 8)
53#define CVMX_POW_PF_RST_MSK \ 53#define CVMX_POW_WS_PCX(offset) (CVMX_ADD_IO_SEG(0x0001670000000280ull) + ((offset) & 15) * 8)
54 CVMX_ADD_IO_SEG(0x0001670000000230ull)
55#define CVMX_POW_PP_GRP_MSKX(offset) \
56 CVMX_ADD_IO_SEG(0x0001670000000000ull + (((offset) & 15) * 8))
57#define CVMX_POW_QOS_RNDX(offset) \
58 CVMX_ADD_IO_SEG(0x00016700000001C0ull + (((offset) & 7) * 8))
59#define CVMX_POW_QOS_THRX(offset) \
60 CVMX_ADD_IO_SEG(0x0001670000000180ull + (((offset) & 7) * 8))
61#define CVMX_POW_TS_PC \
62 CVMX_ADD_IO_SEG(0x0001670000000390ull)
63#define CVMX_POW_WA_COM_PC \
64 CVMX_ADD_IO_SEG(0x0001670000000380ull)
65#define CVMX_POW_WA_PCX(offset) \
66 CVMX_ADD_IO_SEG(0x0001670000000300ull + (((offset) & 7) * 8))
67#define CVMX_POW_WQ_INT \
68 CVMX_ADD_IO_SEG(0x0001670000000200ull)
69#define CVMX_POW_WQ_INT_CNTX(offset) \
70 CVMX_ADD_IO_SEG(0x0001670000000100ull + (((offset) & 15) * 8))
71#define CVMX_POW_WQ_INT_PC \
72 CVMX_ADD_IO_SEG(0x0001670000000208ull)
73#define CVMX_POW_WQ_INT_THRX(offset) \
74 CVMX_ADD_IO_SEG(0x0001670000000080ull + (((offset) & 15) * 8))
75#define CVMX_POW_WS_PCX(offset) \
76 CVMX_ADD_IO_SEG(0x0001670000000280ull + (((offset) & 15) * 8))
77 54
78union cvmx_pow_bist_stat { 55union cvmx_pow_bist_stat {
79 uint64_t u64; 56 uint64_t u64;
@@ -160,6 +137,19 @@ union cvmx_pow_bist_stat {
160 struct cvmx_pow_bist_stat_cn56xx cn56xxp1; 137 struct cvmx_pow_bist_stat_cn56xx cn56xxp1;
161 struct cvmx_pow_bist_stat_cn38xx cn58xx; 138 struct cvmx_pow_bist_stat_cn38xx cn58xx;
162 struct cvmx_pow_bist_stat_cn38xx cn58xxp1; 139 struct cvmx_pow_bist_stat_cn38xx cn58xxp1;
140 struct cvmx_pow_bist_stat_cn63xx {
141 uint64_t reserved_22_63:42;
142 uint64_t pp:6;
143 uint64_t reserved_12_15:4;
144 uint64_t cam:1;
145 uint64_t nbr:3;
146 uint64_t nbt:4;
147 uint64_t index:1;
148 uint64_t fidx:1;
149 uint64_t pend:1;
150 uint64_t adr:1;
151 } cn63xx;
152 struct cvmx_pow_bist_stat_cn63xx cn63xxp1;
163}; 153};
164 154
165union cvmx_pow_ds_pc { 155union cvmx_pow_ds_pc {
@@ -179,6 +169,8 @@ union cvmx_pow_ds_pc {
179 struct cvmx_pow_ds_pc_s cn56xxp1; 169 struct cvmx_pow_ds_pc_s cn56xxp1;
180 struct cvmx_pow_ds_pc_s cn58xx; 170 struct cvmx_pow_ds_pc_s cn58xx;
181 struct cvmx_pow_ds_pc_s cn58xxp1; 171 struct cvmx_pow_ds_pc_s cn58xxp1;
172 struct cvmx_pow_ds_pc_s cn63xx;
173 struct cvmx_pow_ds_pc_s cn63xxp1;
182}; 174};
183 175
184union cvmx_pow_ecc_err { 176union cvmx_pow_ecc_err {
@@ -219,6 +211,8 @@ union cvmx_pow_ecc_err {
219 struct cvmx_pow_ecc_err_s cn56xxp1; 211 struct cvmx_pow_ecc_err_s cn56xxp1;
220 struct cvmx_pow_ecc_err_s cn58xx; 212 struct cvmx_pow_ecc_err_s cn58xx;
221 struct cvmx_pow_ecc_err_s cn58xxp1; 213 struct cvmx_pow_ecc_err_s cn58xxp1;
214 struct cvmx_pow_ecc_err_s cn63xx;
215 struct cvmx_pow_ecc_err_s cn63xxp1;
222}; 216};
223 217
224union cvmx_pow_int_ctl { 218union cvmx_pow_int_ctl {
@@ -239,6 +233,8 @@ union cvmx_pow_int_ctl {
239 struct cvmx_pow_int_ctl_s cn56xxp1; 233 struct cvmx_pow_int_ctl_s cn56xxp1;
240 struct cvmx_pow_int_ctl_s cn58xx; 234 struct cvmx_pow_int_ctl_s cn58xx;
241 struct cvmx_pow_int_ctl_s cn58xxp1; 235 struct cvmx_pow_int_ctl_s cn58xxp1;
236 struct cvmx_pow_int_ctl_s cn63xx;
237 struct cvmx_pow_int_ctl_s cn63xxp1;
242}; 238};
243 239
244union cvmx_pow_iq_cntx { 240union cvmx_pow_iq_cntx {
@@ -258,6 +254,8 @@ union cvmx_pow_iq_cntx {
258 struct cvmx_pow_iq_cntx_s cn56xxp1; 254 struct cvmx_pow_iq_cntx_s cn56xxp1;
259 struct cvmx_pow_iq_cntx_s cn58xx; 255 struct cvmx_pow_iq_cntx_s cn58xx;
260 struct cvmx_pow_iq_cntx_s cn58xxp1; 256 struct cvmx_pow_iq_cntx_s cn58xxp1;
257 struct cvmx_pow_iq_cntx_s cn63xx;
258 struct cvmx_pow_iq_cntx_s cn63xxp1;
261}; 259};
262 260
263union cvmx_pow_iq_com_cnt { 261union cvmx_pow_iq_com_cnt {
@@ -277,6 +275,8 @@ union cvmx_pow_iq_com_cnt {
277 struct cvmx_pow_iq_com_cnt_s cn56xxp1; 275 struct cvmx_pow_iq_com_cnt_s cn56xxp1;
278 struct cvmx_pow_iq_com_cnt_s cn58xx; 276 struct cvmx_pow_iq_com_cnt_s cn58xx;
279 struct cvmx_pow_iq_com_cnt_s cn58xxp1; 277 struct cvmx_pow_iq_com_cnt_s cn58xxp1;
278 struct cvmx_pow_iq_com_cnt_s cn63xx;
279 struct cvmx_pow_iq_com_cnt_s cn63xxp1;
280}; 280};
281 281
282union cvmx_pow_iq_int { 282union cvmx_pow_iq_int {
@@ -289,6 +289,8 @@ union cvmx_pow_iq_int {
289 struct cvmx_pow_iq_int_s cn52xxp1; 289 struct cvmx_pow_iq_int_s cn52xxp1;
290 struct cvmx_pow_iq_int_s cn56xx; 290 struct cvmx_pow_iq_int_s cn56xx;
291 struct cvmx_pow_iq_int_s cn56xxp1; 291 struct cvmx_pow_iq_int_s cn56xxp1;
292 struct cvmx_pow_iq_int_s cn63xx;
293 struct cvmx_pow_iq_int_s cn63xxp1;
292}; 294};
293 295
294union cvmx_pow_iq_int_en { 296union cvmx_pow_iq_int_en {
@@ -301,6 +303,8 @@ union cvmx_pow_iq_int_en {
301 struct cvmx_pow_iq_int_en_s cn52xxp1; 303 struct cvmx_pow_iq_int_en_s cn52xxp1;
302 struct cvmx_pow_iq_int_en_s cn56xx; 304 struct cvmx_pow_iq_int_en_s cn56xx;
303 struct cvmx_pow_iq_int_en_s cn56xxp1; 305 struct cvmx_pow_iq_int_en_s cn56xxp1;
306 struct cvmx_pow_iq_int_en_s cn63xx;
307 struct cvmx_pow_iq_int_en_s cn63xxp1;
304}; 308};
305 309
306union cvmx_pow_iq_thrx { 310union cvmx_pow_iq_thrx {
@@ -313,6 +317,8 @@ union cvmx_pow_iq_thrx {
313 struct cvmx_pow_iq_thrx_s cn52xxp1; 317 struct cvmx_pow_iq_thrx_s cn52xxp1;
314 struct cvmx_pow_iq_thrx_s cn56xx; 318 struct cvmx_pow_iq_thrx_s cn56xx;
315 struct cvmx_pow_iq_thrx_s cn56xxp1; 319 struct cvmx_pow_iq_thrx_s cn56xxp1;
320 struct cvmx_pow_iq_thrx_s cn63xx;
321 struct cvmx_pow_iq_thrx_s cn63xxp1;
316}; 322};
317 323
318union cvmx_pow_nos_cnt { 324union cvmx_pow_nos_cnt {
@@ -341,6 +347,11 @@ union cvmx_pow_nos_cnt {
341 struct cvmx_pow_nos_cnt_s cn56xxp1; 347 struct cvmx_pow_nos_cnt_s cn56xxp1;
342 struct cvmx_pow_nos_cnt_s cn58xx; 348 struct cvmx_pow_nos_cnt_s cn58xx;
343 struct cvmx_pow_nos_cnt_s cn58xxp1; 349 struct cvmx_pow_nos_cnt_s cn58xxp1;
350 struct cvmx_pow_nos_cnt_cn63xx {
351 uint64_t reserved_11_63:53;
352 uint64_t nos_cnt:11;
353 } cn63xx;
354 struct cvmx_pow_nos_cnt_cn63xx cn63xxp1;
344}; 355};
345 356
346union cvmx_pow_nw_tim { 357union cvmx_pow_nw_tim {
@@ -360,6 +371,8 @@ union cvmx_pow_nw_tim {
360 struct cvmx_pow_nw_tim_s cn56xxp1; 371 struct cvmx_pow_nw_tim_s cn56xxp1;
361 struct cvmx_pow_nw_tim_s cn58xx; 372 struct cvmx_pow_nw_tim_s cn58xx;
362 struct cvmx_pow_nw_tim_s cn58xxp1; 373 struct cvmx_pow_nw_tim_s cn58xxp1;
374 struct cvmx_pow_nw_tim_s cn63xx;
375 struct cvmx_pow_nw_tim_s cn63xxp1;
363}; 376};
364 377
365union cvmx_pow_pf_rst_msk { 378union cvmx_pow_pf_rst_msk {
@@ -375,6 +388,8 @@ union cvmx_pow_pf_rst_msk {
375 struct cvmx_pow_pf_rst_msk_s cn56xxp1; 388 struct cvmx_pow_pf_rst_msk_s cn56xxp1;
376 struct cvmx_pow_pf_rst_msk_s cn58xx; 389 struct cvmx_pow_pf_rst_msk_s cn58xx;
377 struct cvmx_pow_pf_rst_msk_s cn58xxp1; 390 struct cvmx_pow_pf_rst_msk_s cn58xxp1;
391 struct cvmx_pow_pf_rst_msk_s cn63xx;
392 struct cvmx_pow_pf_rst_msk_s cn63xxp1;
378}; 393};
379 394
380union cvmx_pow_pp_grp_mskx { 395union cvmx_pow_pp_grp_mskx {
@@ -405,6 +420,8 @@ union cvmx_pow_pp_grp_mskx {
405 struct cvmx_pow_pp_grp_mskx_s cn56xxp1; 420 struct cvmx_pow_pp_grp_mskx_s cn56xxp1;
406 struct cvmx_pow_pp_grp_mskx_s cn58xx; 421 struct cvmx_pow_pp_grp_mskx_s cn58xx;
407 struct cvmx_pow_pp_grp_mskx_s cn58xxp1; 422 struct cvmx_pow_pp_grp_mskx_s cn58xxp1;
423 struct cvmx_pow_pp_grp_mskx_s cn63xx;
424 struct cvmx_pow_pp_grp_mskx_s cn63xxp1;
408}; 425};
409 426
410union cvmx_pow_qos_rndx { 427union cvmx_pow_qos_rndx {
@@ -427,6 +444,8 @@ union cvmx_pow_qos_rndx {
427 struct cvmx_pow_qos_rndx_s cn56xxp1; 444 struct cvmx_pow_qos_rndx_s cn56xxp1;
428 struct cvmx_pow_qos_rndx_s cn58xx; 445 struct cvmx_pow_qos_rndx_s cn58xx;
429 struct cvmx_pow_qos_rndx_s cn58xxp1; 446 struct cvmx_pow_qos_rndx_s cn58xxp1;
447 struct cvmx_pow_qos_rndx_s cn63xx;
448 struct cvmx_pow_qos_rndx_s cn63xxp1;
430}; 449};
431 450
432union cvmx_pow_qos_thrx { 451union cvmx_pow_qos_thrx {
@@ -485,6 +504,19 @@ union cvmx_pow_qos_thrx {
485 struct cvmx_pow_qos_thrx_s cn56xxp1; 504 struct cvmx_pow_qos_thrx_s cn56xxp1;
486 struct cvmx_pow_qos_thrx_s cn58xx; 505 struct cvmx_pow_qos_thrx_s cn58xx;
487 struct cvmx_pow_qos_thrx_s cn58xxp1; 506 struct cvmx_pow_qos_thrx_s cn58xxp1;
507 struct cvmx_pow_qos_thrx_cn63xx {
508 uint64_t reserved_59_63:5;
509 uint64_t des_cnt:11;
510 uint64_t reserved_47_47:1;
511 uint64_t buf_cnt:11;
512 uint64_t reserved_35_35:1;
513 uint64_t free_cnt:11;
514 uint64_t reserved_22_23:2;
515 uint64_t max_thr:10;
516 uint64_t reserved_10_11:2;
517 uint64_t min_thr:10;
518 } cn63xx;
519 struct cvmx_pow_qos_thrx_cn63xx cn63xxp1;
488}; 520};
489 521
490union cvmx_pow_ts_pc { 522union cvmx_pow_ts_pc {
@@ -504,6 +536,8 @@ union cvmx_pow_ts_pc {
504 struct cvmx_pow_ts_pc_s cn56xxp1; 536 struct cvmx_pow_ts_pc_s cn56xxp1;
505 struct cvmx_pow_ts_pc_s cn58xx; 537 struct cvmx_pow_ts_pc_s cn58xx;
506 struct cvmx_pow_ts_pc_s cn58xxp1; 538 struct cvmx_pow_ts_pc_s cn58xxp1;
539 struct cvmx_pow_ts_pc_s cn63xx;
540 struct cvmx_pow_ts_pc_s cn63xxp1;
507}; 541};
508 542
509union cvmx_pow_wa_com_pc { 543union cvmx_pow_wa_com_pc {
@@ -523,6 +557,8 @@ union cvmx_pow_wa_com_pc {
523 struct cvmx_pow_wa_com_pc_s cn56xxp1; 557 struct cvmx_pow_wa_com_pc_s cn56xxp1;
524 struct cvmx_pow_wa_com_pc_s cn58xx; 558 struct cvmx_pow_wa_com_pc_s cn58xx;
525 struct cvmx_pow_wa_com_pc_s cn58xxp1; 559 struct cvmx_pow_wa_com_pc_s cn58xxp1;
560 struct cvmx_pow_wa_com_pc_s cn63xx;
561 struct cvmx_pow_wa_com_pc_s cn63xxp1;
526}; 562};
527 563
528union cvmx_pow_wa_pcx { 564union cvmx_pow_wa_pcx {
@@ -542,6 +578,8 @@ union cvmx_pow_wa_pcx {
542 struct cvmx_pow_wa_pcx_s cn56xxp1; 578 struct cvmx_pow_wa_pcx_s cn56xxp1;
543 struct cvmx_pow_wa_pcx_s cn58xx; 579 struct cvmx_pow_wa_pcx_s cn58xx;
544 struct cvmx_pow_wa_pcx_s cn58xxp1; 580 struct cvmx_pow_wa_pcx_s cn58xxp1;
581 struct cvmx_pow_wa_pcx_s cn63xx;
582 struct cvmx_pow_wa_pcx_s cn63xxp1;
545}; 583};
546 584
547union cvmx_pow_wq_int { 585union cvmx_pow_wq_int {
@@ -562,6 +600,8 @@ union cvmx_pow_wq_int {
562 struct cvmx_pow_wq_int_s cn56xxp1; 600 struct cvmx_pow_wq_int_s cn56xxp1;
563 struct cvmx_pow_wq_int_s cn58xx; 601 struct cvmx_pow_wq_int_s cn58xx;
564 struct cvmx_pow_wq_int_s cn58xxp1; 602 struct cvmx_pow_wq_int_s cn58xxp1;
603 struct cvmx_pow_wq_int_s cn63xx;
604 struct cvmx_pow_wq_int_s cn63xxp1;
565}; 605};
566 606
567union cvmx_pow_wq_int_cntx { 607union cvmx_pow_wq_int_cntx {
@@ -604,6 +644,15 @@ union cvmx_pow_wq_int_cntx {
604 struct cvmx_pow_wq_int_cntx_s cn56xxp1; 644 struct cvmx_pow_wq_int_cntx_s cn56xxp1;
605 struct cvmx_pow_wq_int_cntx_s cn58xx; 645 struct cvmx_pow_wq_int_cntx_s cn58xx;
606 struct cvmx_pow_wq_int_cntx_s cn58xxp1; 646 struct cvmx_pow_wq_int_cntx_s cn58xxp1;
647 struct cvmx_pow_wq_int_cntx_cn63xx {
648 uint64_t reserved_28_63:36;
649 uint64_t tc_cnt:4;
650 uint64_t reserved_23_23:1;
651 uint64_t ds_cnt:11;
652 uint64_t reserved_11_11:1;
653 uint64_t iq_cnt:11;
654 } cn63xx;
655 struct cvmx_pow_wq_int_cntx_cn63xx cn63xxp1;
607}; 656};
608 657
609union cvmx_pow_wq_int_pc { 658union cvmx_pow_wq_int_pc {
@@ -626,6 +675,8 @@ union cvmx_pow_wq_int_pc {
626 struct cvmx_pow_wq_int_pc_s cn56xxp1; 675 struct cvmx_pow_wq_int_pc_s cn56xxp1;
627 struct cvmx_pow_wq_int_pc_s cn58xx; 676 struct cvmx_pow_wq_int_pc_s cn58xx;
628 struct cvmx_pow_wq_int_pc_s cn58xxp1; 677 struct cvmx_pow_wq_int_pc_s cn58xxp1;
678 struct cvmx_pow_wq_int_pc_s cn63xx;
679 struct cvmx_pow_wq_int_pc_s cn63xxp1;
629}; 680};
630 681
631union cvmx_pow_wq_int_thrx { 682union cvmx_pow_wq_int_thrx {
@@ -674,6 +725,16 @@ union cvmx_pow_wq_int_thrx {
674 struct cvmx_pow_wq_int_thrx_s cn56xxp1; 725 struct cvmx_pow_wq_int_thrx_s cn56xxp1;
675 struct cvmx_pow_wq_int_thrx_s cn58xx; 726 struct cvmx_pow_wq_int_thrx_s cn58xx;
676 struct cvmx_pow_wq_int_thrx_s cn58xxp1; 727 struct cvmx_pow_wq_int_thrx_s cn58xxp1;
728 struct cvmx_pow_wq_int_thrx_cn63xx {
729 uint64_t reserved_29_63:35;
730 uint64_t tc_en:1;
731 uint64_t tc_thr:4;
732 uint64_t reserved_22_23:2;
733 uint64_t ds_thr:10;
734 uint64_t reserved_10_11:2;
735 uint64_t iq_thr:10;
736 } cn63xx;
737 struct cvmx_pow_wq_int_thrx_cn63xx cn63xxp1;
677}; 738};
678 739
679union cvmx_pow_ws_pcx { 740union cvmx_pow_ws_pcx {
@@ -693,6 +754,8 @@ union cvmx_pow_ws_pcx {
693 struct cvmx_pow_ws_pcx_s cn56xxp1; 754 struct cvmx_pow_ws_pcx_s cn56xxp1;
694 struct cvmx_pow_ws_pcx_s cn58xx; 755 struct cvmx_pow_ws_pcx_s cn58xx;
695 struct cvmx_pow_ws_pcx_s cn58xxp1; 756 struct cvmx_pow_ws_pcx_s cn58xxp1;
757 struct cvmx_pow_ws_pcx_s cn63xx;
758 struct cvmx_pow_ws_pcx_s cn63xxp1;
696}; 759};
697 760
698#endif 761#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-rnm-defs.h b/arch/mips/include/asm/octeon/cvmx-rnm-defs.h
index 4586958c97be..c45da1f35ea7 100644
--- a/arch/mips/include/asm/octeon/cvmx-rnm-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-rnm-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -30,10 +30,11 @@
30 30
31#include <linux/types.h> 31#include <linux/types.h>
32 32
33#define CVMX_RNM_BIST_STATUS \ 33#define CVMX_RNM_BIST_STATUS (CVMX_ADD_IO_SEG(0x0001180040000008ull))
34 CVMX_ADD_IO_SEG(0x0001180040000008ull) 34#define CVMX_RNM_CTL_STATUS (CVMX_ADD_IO_SEG(0x0001180040000000ull))
35#define CVMX_RNM_CTL_STATUS \ 35#define CVMX_RNM_EER_DBG (CVMX_ADD_IO_SEG(0x0001180040000018ull))
36 CVMX_ADD_IO_SEG(0x0001180040000000ull) 36#define CVMX_RNM_EER_KEY (CVMX_ADD_IO_SEG(0x0001180040000010ull))
37#define CVMX_RNM_SERIAL_NUM (CVMX_ADD_IO_SEG(0x0001180040000020ull))
37 38
38union cvmx_rnm_bist_status { 39union cvmx_rnm_bist_status {
39 uint64_t u64; 40 uint64_t u64;
@@ -53,12 +54,16 @@ union cvmx_rnm_bist_status {
53 struct cvmx_rnm_bist_status_s cn56xxp1; 54 struct cvmx_rnm_bist_status_s cn56xxp1;
54 struct cvmx_rnm_bist_status_s cn58xx; 55 struct cvmx_rnm_bist_status_s cn58xx;
55 struct cvmx_rnm_bist_status_s cn58xxp1; 56 struct cvmx_rnm_bist_status_s cn58xxp1;
57 struct cvmx_rnm_bist_status_s cn63xx;
58 struct cvmx_rnm_bist_status_s cn63xxp1;
56}; 59};
57 60
58union cvmx_rnm_ctl_status { 61union cvmx_rnm_ctl_status {
59 uint64_t u64; 62 uint64_t u64;
60 struct cvmx_rnm_ctl_status_s { 63 struct cvmx_rnm_ctl_status_s {
61 uint64_t reserved_9_63:55; 64 uint64_t reserved_11_63:53;
65 uint64_t eer_lck:1;
66 uint64_t eer_val:1;
62 uint64_t ent_sel:4; 67 uint64_t ent_sel:4;
63 uint64_t exp_ent:1; 68 uint64_t exp_ent:1;
64 uint64_t rng_rst:1; 69 uint64_t rng_rst:1;
@@ -76,13 +81,49 @@ union cvmx_rnm_ctl_status {
76 struct cvmx_rnm_ctl_status_cn30xx cn31xx; 81 struct cvmx_rnm_ctl_status_cn30xx cn31xx;
77 struct cvmx_rnm_ctl_status_cn30xx cn38xx; 82 struct cvmx_rnm_ctl_status_cn30xx cn38xx;
78 struct cvmx_rnm_ctl_status_cn30xx cn38xxp2; 83 struct cvmx_rnm_ctl_status_cn30xx cn38xxp2;
79 struct cvmx_rnm_ctl_status_s cn50xx; 84 struct cvmx_rnm_ctl_status_cn50xx {
80 struct cvmx_rnm_ctl_status_s cn52xx; 85 uint64_t reserved_9_63:55;
81 struct cvmx_rnm_ctl_status_s cn52xxp1; 86 uint64_t ent_sel:4;
82 struct cvmx_rnm_ctl_status_s cn56xx; 87 uint64_t exp_ent:1;
83 struct cvmx_rnm_ctl_status_s cn56xxp1; 88 uint64_t rng_rst:1;
84 struct cvmx_rnm_ctl_status_s cn58xx; 89 uint64_t rnm_rst:1;
85 struct cvmx_rnm_ctl_status_s cn58xxp1; 90 uint64_t rng_en:1;
91 uint64_t ent_en:1;
92 } cn50xx;
93 struct cvmx_rnm_ctl_status_cn50xx cn52xx;
94 struct cvmx_rnm_ctl_status_cn50xx cn52xxp1;
95 struct cvmx_rnm_ctl_status_cn50xx cn56xx;
96 struct cvmx_rnm_ctl_status_cn50xx cn56xxp1;
97 struct cvmx_rnm_ctl_status_cn50xx cn58xx;
98 struct cvmx_rnm_ctl_status_cn50xx cn58xxp1;
99 struct cvmx_rnm_ctl_status_s cn63xx;
100 struct cvmx_rnm_ctl_status_s cn63xxp1;
101};
102
103union cvmx_rnm_eer_dbg {
104 uint64_t u64;
105 struct cvmx_rnm_eer_dbg_s {
106 uint64_t dat:64;
107 } s;
108 struct cvmx_rnm_eer_dbg_s cn63xx;
109 struct cvmx_rnm_eer_dbg_s cn63xxp1;
110};
111
112union cvmx_rnm_eer_key {
113 uint64_t u64;
114 struct cvmx_rnm_eer_key_s {
115 uint64_t key:64;
116 } s;
117 struct cvmx_rnm_eer_key_s cn63xx;
118 struct cvmx_rnm_eer_key_s cn63xxp1;
119};
120
121union cvmx_rnm_serial_num {
122 uint64_t u64;
123 struct cvmx_rnm_serial_num_s {
124 uint64_t dat:64;
125 } s;
126 struct cvmx_rnm_serial_num_s cn63xx;
86}; 127};
87 128
88#endif 129#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-smix-defs.h b/arch/mips/include/asm/octeon/cvmx-smix-defs.h
index 9ae45fcbe3e3..4f3c0666e94a 100644
--- a/arch/mips/include/asm/octeon/cvmx-smix-defs.h
+++ b/arch/mips/include/asm/octeon/cvmx-smix-defs.h
@@ -4,7 +4,7 @@
4 * Contact: support@caviumnetworks.com 4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK 5 * This file is part of the OCTEON SDK
6 * 6 *
7 * Copyright (c) 2003-2008 Cavium Networks 7 * Copyright (c) 2003-2010 Cavium Networks
8 * 8 *
9 * This file is free software; you can redistribute it and/or modify 9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as 10 * it under the terms of the GNU General Public License, Version 2, as
@@ -28,16 +28,11 @@
28#ifndef __CVMX_SMIX_DEFS_H__ 28#ifndef __CVMX_SMIX_DEFS_H__
29#define __CVMX_SMIX_DEFS_H__ 29#define __CVMX_SMIX_DEFS_H__
30 30
31#define CVMX_SMIX_CLK(offset) \ 31#define CVMX_SMIX_CLK(offset) (CVMX_ADD_IO_SEG(0x0001180000001818ull) + ((offset) & 1) * 256)
32 CVMX_ADD_IO_SEG(0x0001180000001818ull + (((offset) & 1) * 256)) 32#define CVMX_SMIX_CMD(offset) (CVMX_ADD_IO_SEG(0x0001180000001800ull) + ((offset) & 1) * 256)
33#define CVMX_SMIX_CMD(offset) \ 33#define CVMX_SMIX_EN(offset) (CVMX_ADD_IO_SEG(0x0001180000001820ull) + ((offset) & 1) * 256)
34 CVMX_ADD_IO_SEG(0x0001180000001800ull + (((offset) & 1) * 256)) 34#define CVMX_SMIX_RD_DAT(offset) (CVMX_ADD_IO_SEG(0x0001180000001810ull) + ((offset) & 1) * 256)
35#define CVMX_SMIX_EN(offset) \ 35#define CVMX_SMIX_WR_DAT(offset) (CVMX_ADD_IO_SEG(0x0001180000001808ull) + ((offset) & 1) * 256)
36 CVMX_ADD_IO_SEG(0x0001180000001820ull + (((offset) & 1) * 256))
37#define CVMX_SMIX_RD_DAT(offset) \
38 CVMX_ADD_IO_SEG(0x0001180000001810ull + (((offset) & 1) * 256))
39#define CVMX_SMIX_WR_DAT(offset) \
40 CVMX_ADD_IO_SEG(0x0001180000001808ull + (((offset) & 1) * 256))
41 36
42union cvmx_smix_clk { 37union cvmx_smix_clk {
43 uint64_t u64; 38 uint64_t u64;
@@ -56,7 +51,8 @@ union cvmx_smix_clk {
56 struct cvmx_smix_clk_cn30xx { 51 struct cvmx_smix_clk_cn30xx {
57 uint64_t reserved_21_63:43; 52 uint64_t reserved_21_63:43;
58 uint64_t sample_hi:5; 53 uint64_t sample_hi:5;
59 uint64_t reserved_14_15:2; 54 uint64_t sample_mode:1;
55 uint64_t reserved_14_14:1;
60 uint64_t clk_idle:1; 56 uint64_t clk_idle:1;
61 uint64_t preamble:1; 57 uint64_t preamble:1;
62 uint64_t sample:4; 58 uint64_t sample:4;
@@ -65,23 +61,15 @@ union cvmx_smix_clk {
65 struct cvmx_smix_clk_cn30xx cn31xx; 61 struct cvmx_smix_clk_cn30xx cn31xx;
66 struct cvmx_smix_clk_cn30xx cn38xx; 62 struct cvmx_smix_clk_cn30xx cn38xx;
67 struct cvmx_smix_clk_cn30xx cn38xxp2; 63 struct cvmx_smix_clk_cn30xx cn38xxp2;
68 struct cvmx_smix_clk_cn50xx { 64 struct cvmx_smix_clk_s cn50xx;
69 uint64_t reserved_25_63:39;
70 uint64_t mode:1;
71 uint64_t reserved_21_23:3;
72 uint64_t sample_hi:5;
73 uint64_t reserved_14_15:2;
74 uint64_t clk_idle:1;
75 uint64_t preamble:1;
76 uint64_t sample:4;
77 uint64_t phase:8;
78 } cn50xx;
79 struct cvmx_smix_clk_s cn52xx; 65 struct cvmx_smix_clk_s cn52xx;
80 struct cvmx_smix_clk_cn50xx cn52xxp1; 66 struct cvmx_smix_clk_s cn52xxp1;
81 struct cvmx_smix_clk_s cn56xx; 67 struct cvmx_smix_clk_s cn56xx;
82 struct cvmx_smix_clk_cn50xx cn56xxp1; 68 struct cvmx_smix_clk_s cn56xxp1;
83 struct cvmx_smix_clk_cn30xx cn58xx; 69 struct cvmx_smix_clk_cn30xx cn58xx;
84 struct cvmx_smix_clk_cn30xx cn58xxp1; 70 struct cvmx_smix_clk_cn30xx cn58xxp1;
71 struct cvmx_smix_clk_s cn63xx;
72 struct cvmx_smix_clk_s cn63xxp1;
85}; 73};
86 74
87union cvmx_smix_cmd { 75union cvmx_smix_cmd {
@@ -112,6 +100,8 @@ union cvmx_smix_cmd {
112 struct cvmx_smix_cmd_s cn56xxp1; 100 struct cvmx_smix_cmd_s cn56xxp1;
113 struct cvmx_smix_cmd_cn30xx cn58xx; 101 struct cvmx_smix_cmd_cn30xx cn58xx;
114 struct cvmx_smix_cmd_cn30xx cn58xxp1; 102 struct cvmx_smix_cmd_cn30xx cn58xxp1;
103 struct cvmx_smix_cmd_s cn63xx;
104 struct cvmx_smix_cmd_s cn63xxp1;
115}; 105};
116 106
117union cvmx_smix_en { 107union cvmx_smix_en {
@@ -131,6 +121,8 @@ union cvmx_smix_en {
131 struct cvmx_smix_en_s cn56xxp1; 121 struct cvmx_smix_en_s cn56xxp1;
132 struct cvmx_smix_en_s cn58xx; 122 struct cvmx_smix_en_s cn58xx;
133 struct cvmx_smix_en_s cn58xxp1; 123 struct cvmx_smix_en_s cn58xxp1;
124 struct cvmx_smix_en_s cn63xx;
125 struct cvmx_smix_en_s cn63xxp1;
134}; 126};
135 127
136union cvmx_smix_rd_dat { 128union cvmx_smix_rd_dat {
@@ -152,6 +144,8 @@ union cvmx_smix_rd_dat {
152 struct cvmx_smix_rd_dat_s cn56xxp1; 144 struct cvmx_smix_rd_dat_s cn56xxp1;
153 struct cvmx_smix_rd_dat_s cn58xx; 145 struct cvmx_smix_rd_dat_s cn58xx;
154 struct cvmx_smix_rd_dat_s cn58xxp1; 146 struct cvmx_smix_rd_dat_s cn58xxp1;
147 struct cvmx_smix_rd_dat_s cn63xx;
148 struct cvmx_smix_rd_dat_s cn63xxp1;
155}; 149};
156 150
157union cvmx_smix_wr_dat { 151union cvmx_smix_wr_dat {
@@ -173,6 +167,8 @@ union cvmx_smix_wr_dat {
173 struct cvmx_smix_wr_dat_s cn56xxp1; 167 struct cvmx_smix_wr_dat_s cn56xxp1;
174 struct cvmx_smix_wr_dat_s cn58xx; 168 struct cvmx_smix_wr_dat_s cn58xx;
175 struct cvmx_smix_wr_dat_s cn58xxp1; 169 struct cvmx_smix_wr_dat_s cn58xxp1;
170 struct cvmx_smix_wr_dat_s cn63xx;
171 struct cvmx_smix_wr_dat_s cn63xxp1;
176}; 172};
177 173
178#endif 174#endif
diff --git a/arch/mips/include/asm/octeon/cvmx-uctlx-defs.h b/arch/mips/include/asm/octeon/cvmx-uctlx-defs.h
new file mode 100644
index 000000000000..594f1b68cd62
--- /dev/null
+++ b/arch/mips/include/asm/octeon/cvmx-uctlx-defs.h
@@ -0,0 +1,261 @@
1/***********************license start***************
2 * Author: Cavium Networks
3 *
4 * Contact: support@caviumnetworks.com
5 * This file is part of the OCTEON SDK
6 *
7 * Copyright (c) 2003-2010 Cavium Networks
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 *
13 * This file is distributed in the hope that it will be useful, but
14 * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or
16 * NONINFRINGEMENT. See the GNU General Public License for more
17 * details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this file; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 * or visit http://www.gnu.org/licenses/.
23 *
24 * This file may also be available under a different license from Cavium.
25 * Contact Cavium Networks for more information
26 ***********************license end**************************************/
27
28#ifndef __CVMX_UCTLX_TYPEDEFS_H__
29#define __CVMX_UCTLX_TYPEDEFS_H__
30
31#define CVMX_UCTLX_BIST_STATUS(block_id) (CVMX_ADD_IO_SEG(0x000118006F0000A0ull))
32#define CVMX_UCTLX_CLK_RST_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000000ull))
33#define CVMX_UCTLX_EHCI_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000080ull))
34#define CVMX_UCTLX_EHCI_FLA(block_id) (CVMX_ADD_IO_SEG(0x000118006F0000A8ull))
35#define CVMX_UCTLX_ERTO_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000090ull))
36#define CVMX_UCTLX_IF_ENA(block_id) (CVMX_ADD_IO_SEG(0x000118006F000030ull))
37#define CVMX_UCTLX_INT_ENA(block_id) (CVMX_ADD_IO_SEG(0x000118006F000028ull))
38#define CVMX_UCTLX_INT_REG(block_id) (CVMX_ADD_IO_SEG(0x000118006F000020ull))
39#define CVMX_UCTLX_OHCI_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000088ull))
40#define CVMX_UCTLX_ORTO_CTL(block_id) (CVMX_ADD_IO_SEG(0x000118006F000098ull))
41#define CVMX_UCTLX_PPAF_WM(block_id) (CVMX_ADD_IO_SEG(0x000118006F000038ull))
42#define CVMX_UCTLX_UPHY_CTL_STATUS(block_id) (CVMX_ADD_IO_SEG(0x000118006F000008ull))
43#define CVMX_UCTLX_UPHY_PORTX_CTL_STATUS(offset, block_id) (CVMX_ADD_IO_SEG(0x000118006F000010ull) + (((offset) & 1) + ((block_id) & 0) * 0x0ull) * 8)
44
45union cvmx_uctlx_bist_status {
46 uint64_t u64;
47 struct cvmx_uctlx_bist_status_s {
48 uint64_t reserved_6_63:58;
49 uint64_t data_bis:1;
50 uint64_t desc_bis:1;
51 uint64_t erbm_bis:1;
52 uint64_t orbm_bis:1;
53 uint64_t wrbm_bis:1;
54 uint64_t ppaf_bis:1;
55 } s;
56 struct cvmx_uctlx_bist_status_s cn63xx;
57 struct cvmx_uctlx_bist_status_s cn63xxp1;
58};
59
60union cvmx_uctlx_clk_rst_ctl {
61 uint64_t u64;
62 struct cvmx_uctlx_clk_rst_ctl_s {
63 uint64_t reserved_25_63:39;
64 uint64_t clear_bist:1;
65 uint64_t start_bist:1;
66 uint64_t ehci_sm:1;
67 uint64_t ohci_clkcktrst:1;
68 uint64_t ohci_sm:1;
69 uint64_t ohci_susp_lgcy:1;
70 uint64_t app_start_clk:1;
71 uint64_t o_clkdiv_rst:1;
72 uint64_t h_clkdiv_byp:1;
73 uint64_t h_clkdiv_rst:1;
74 uint64_t h_clkdiv_en:1;
75 uint64_t o_clkdiv_en:1;
76 uint64_t h_div:4;
77 uint64_t p_refclk_sel:2;
78 uint64_t p_refclk_div:2;
79 uint64_t reserved_4_4:1;
80 uint64_t p_com_on:1;
81 uint64_t p_por:1;
82 uint64_t p_prst:1;
83 uint64_t hrst:1;
84 } s;
85 struct cvmx_uctlx_clk_rst_ctl_s cn63xx;
86 struct cvmx_uctlx_clk_rst_ctl_s cn63xxp1;
87};
88
89union cvmx_uctlx_ehci_ctl {
90 uint64_t u64;
91 struct cvmx_uctlx_ehci_ctl_s {
92 uint64_t reserved_20_63:44;
93 uint64_t desc_rbm:1;
94 uint64_t reg_nb:1;
95 uint64_t l2c_dc:1;
96 uint64_t l2c_bc:1;
97 uint64_t l2c_0pag:1;
98 uint64_t l2c_stt:1;
99 uint64_t l2c_buff_emod:2;
100 uint64_t l2c_desc_emod:2;
101 uint64_t inv_reg_a2:1;
102 uint64_t ehci_64b_addr_en:1;
103 uint64_t l2c_addr_msb:8;
104 } s;
105 struct cvmx_uctlx_ehci_ctl_s cn63xx;
106 struct cvmx_uctlx_ehci_ctl_s cn63xxp1;
107};
108
109union cvmx_uctlx_ehci_fla {
110 uint64_t u64;
111 struct cvmx_uctlx_ehci_fla_s {
112 uint64_t reserved_6_63:58;
113 uint64_t fla:6;
114 } s;
115 struct cvmx_uctlx_ehci_fla_s cn63xx;
116 struct cvmx_uctlx_ehci_fla_s cn63xxp1;
117};
118
119union cvmx_uctlx_erto_ctl {
120 uint64_t u64;
121 struct cvmx_uctlx_erto_ctl_s {
122 uint64_t reserved_32_63:32;
123 uint64_t to_val:27;
124 uint64_t reserved_0_4:5;
125 } s;
126 struct cvmx_uctlx_erto_ctl_s cn63xx;
127 struct cvmx_uctlx_erto_ctl_s cn63xxp1;
128};
129
130union cvmx_uctlx_if_ena {
131 uint64_t u64;
132 struct cvmx_uctlx_if_ena_s {
133 uint64_t reserved_1_63:63;
134 uint64_t en:1;
135 } s;
136 struct cvmx_uctlx_if_ena_s cn63xx;
137 struct cvmx_uctlx_if_ena_s cn63xxp1;
138};
139
140union cvmx_uctlx_int_ena {
141 uint64_t u64;
142 struct cvmx_uctlx_int_ena_s {
143 uint64_t reserved_8_63:56;
144 uint64_t ec_ovf_e:1;
145 uint64_t oc_ovf_e:1;
146 uint64_t wb_pop_e:1;
147 uint64_t wb_psh_f:1;
148 uint64_t cf_psh_f:1;
149 uint64_t or_psh_f:1;
150 uint64_t er_psh_f:1;
151 uint64_t pp_psh_f:1;
152 } s;
153 struct cvmx_uctlx_int_ena_s cn63xx;
154 struct cvmx_uctlx_int_ena_s cn63xxp1;
155};
156
157union cvmx_uctlx_int_reg {
158 uint64_t u64;
159 struct cvmx_uctlx_int_reg_s {
160 uint64_t reserved_8_63:56;
161 uint64_t ec_ovf_e:1;
162 uint64_t oc_ovf_e:1;
163 uint64_t wb_pop_e:1;
164 uint64_t wb_psh_f:1;
165 uint64_t cf_psh_f:1;
166 uint64_t or_psh_f:1;
167 uint64_t er_psh_f:1;
168 uint64_t pp_psh_f:1;
169 } s;
170 struct cvmx_uctlx_int_reg_s cn63xx;
171 struct cvmx_uctlx_int_reg_s cn63xxp1;
172};
173
174union cvmx_uctlx_ohci_ctl {
175 uint64_t u64;
176 struct cvmx_uctlx_ohci_ctl_s {
177 uint64_t reserved_19_63:45;
178 uint64_t reg_nb:1;
179 uint64_t l2c_dc:1;
180 uint64_t l2c_bc:1;
181 uint64_t l2c_0pag:1;
182 uint64_t l2c_stt:1;
183 uint64_t l2c_buff_emod:2;
184 uint64_t l2c_desc_emod:2;
185 uint64_t inv_reg_a2:1;
186 uint64_t reserved_8_8:1;
187 uint64_t l2c_addr_msb:8;
188 } s;
189 struct cvmx_uctlx_ohci_ctl_s cn63xx;
190 struct cvmx_uctlx_ohci_ctl_s cn63xxp1;
191};
192
193union cvmx_uctlx_orto_ctl {
194 uint64_t u64;
195 struct cvmx_uctlx_orto_ctl_s {
196 uint64_t reserved_32_63:32;
197 uint64_t to_val:24;
198 uint64_t reserved_0_7:8;
199 } s;
200 struct cvmx_uctlx_orto_ctl_s cn63xx;
201 struct cvmx_uctlx_orto_ctl_s cn63xxp1;
202};
203
204union cvmx_uctlx_ppaf_wm {
205 uint64_t u64;
206 struct cvmx_uctlx_ppaf_wm_s {
207 uint64_t reserved_5_63:59;
208 uint64_t wm:5;
209 } s;
210 struct cvmx_uctlx_ppaf_wm_s cn63xx;
211 struct cvmx_uctlx_ppaf_wm_s cn63xxp1;
212};
213
214union cvmx_uctlx_uphy_ctl_status {
215 uint64_t u64;
216 struct cvmx_uctlx_uphy_ctl_status_s {
217 uint64_t reserved_10_63:54;
218 uint64_t bist_done:1;
219 uint64_t bist_err:1;
220 uint64_t hsbist:1;
221 uint64_t fsbist:1;
222 uint64_t lsbist:1;
223 uint64_t siddq:1;
224 uint64_t vtest_en:1;
225 uint64_t uphy_bist:1;
226 uint64_t bist_en:1;
227 uint64_t ate_reset:1;
228 } s;
229 struct cvmx_uctlx_uphy_ctl_status_s cn63xx;
230 struct cvmx_uctlx_uphy_ctl_status_s cn63xxp1;
231};
232
233union cvmx_uctlx_uphy_portx_ctl_status {
234 uint64_t u64;
235 struct cvmx_uctlx_uphy_portx_ctl_status_s {
236 uint64_t reserved_43_63:21;
237 uint64_t tdata_out:4;
238 uint64_t txbiststuffenh:1;
239 uint64_t txbiststuffen:1;
240 uint64_t dmpulldown:1;
241 uint64_t dppulldown:1;
242 uint64_t vbusvldext:1;
243 uint64_t portreset:1;
244 uint64_t txhsvxtune:2;
245 uint64_t txvreftune:4;
246 uint64_t txrisetune:1;
247 uint64_t txpreemphasistune:1;
248 uint64_t txfslstune:4;
249 uint64_t sqrxtune:3;
250 uint64_t compdistune:3;
251 uint64_t loop_en:1;
252 uint64_t tclk:1;
253 uint64_t tdata_sel:1;
254 uint64_t taddr_in:4;
255 uint64_t tdata_in:8;
256 } s;
257 struct cvmx_uctlx_uphy_portx_ctl_status_s cn63xx;
258 struct cvmx_uctlx_uphy_portx_ctl_status_s cn63xxp1;
259};
260
261#endif
diff --git a/arch/mips/include/asm/octeon/octeon-model.h b/arch/mips/include/asm/octeon/octeon-model.h
index cf50336eca2e..700f88e31cad 100644
--- a/arch/mips/include/asm/octeon/octeon-model.h
+++ b/arch/mips/include/asm/octeon/octeon-model.h
@@ -35,14 +35,6 @@
35#ifndef __OCTEON_MODEL_H__ 35#ifndef __OCTEON_MODEL_H__
36#define __OCTEON_MODEL_H__ 36#define __OCTEON_MODEL_H__
37 37
38/* NOTE: These must match what is checked in common-config.mk */
39/* Defines to represent the different versions of Octeon. */
40
41/*
42 * IMPORTANT: When the default pass is updated for an Octeon Model,
43 * the corresponding change must also be made in the oct-sim script.
44 */
45
46/* 38/*
47 * The defines below should be used with the OCTEON_IS_MODEL() macro 39 * The defines below should be used with the OCTEON_IS_MODEL() macro
48 * to determine what model of chip the software is running on. Models 40 * to determine what model of chip the software is running on. Models
@@ -71,6 +63,21 @@
71#define OM_IGNORE_MINOR_REVISION 0x08000000 63#define OM_IGNORE_MINOR_REVISION 0x08000000
72#define OM_FLAG_MASK 0xff000000 64#define OM_FLAG_MASK 0xff000000
73 65
66#define OM_MATCH_5XXX_FAMILY_MODELS 0x20000000 /* Match all cn5XXX Octeon models. */
67#define OM_MATCH_6XXX_FAMILY_MODELS 0x40000000 /* Match all cn6XXX Octeon models. */
68
69/*
70 * CN6XXX models with new revision encoding
71 */
72#define OCTEON_CN63XX_PASS1_0 0x000d9000
73#define OCTEON_CN63XX_PASS1_1 0x000d9001
74#define OCTEON_CN63XX_PASS1_2 0x000d9002
75#define OCTEON_CN63XX_PASS2_0 0x000d9008
76
77#define OCTEON_CN63XX (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_REVISION)
78#define OCTEON_CN63XX_PASS1_X (OCTEON_CN63XX_PASS1_0 | OM_IGNORE_MINOR_REVISION)
79#define OCTEON_CN63XX_PASS2_X (OCTEON_CN63XX_PASS2_0 | OM_IGNORE_MINOR_REVISION)
80
74/* 81/*
75 * CN5XXX models with new revision encoding 82 * CN5XXX models with new revision encoding
76 */ 83 */
@@ -189,6 +196,9 @@
189 | OM_MATCH_PREVIOUS_MODELS \ 196 | OM_MATCH_PREVIOUS_MODELS \
190 | OM_IGNORE_REVISION) 197 | OM_IGNORE_REVISION)
191 198
199#define OCTEON_CN5XXX (OCTEON_CN58XX_PASS1_0 | OM_MATCH_5XXX_FAMILY_MODELS)
200#define OCTEON_CN6XXX (OCTEON_CN63XX_PASS1_0 | OM_MATCH_6XXX_FAMILY_MODELS)
201
192/* The revision byte (low byte) has two different encodings. 202/* The revision byte (low byte) has two different encodings.
193 * CN3XXX: 203 * CN3XXX:
194 * 204 *
@@ -222,6 +232,7 @@
222 | OCTEON_58XX_MODEL_MASK) 232 | OCTEON_58XX_MODEL_MASK)
223#define OCTEON_58XX_MODEL_MINOR_REV_MASK (OCTEON_58XX_MODEL_REV_MASK \ 233#define OCTEON_58XX_MODEL_MINOR_REV_MASK (OCTEON_58XX_MODEL_REV_MASK \
224 & 0x00fffff8) 234 & 0x00fffff8)
235#define OCTEON_5XXX_MODEL_MASK 0x00ff0fc0
225 236
226#define __OCTEON_MATCH_MASK__(x, y, z) (((x) & (z)) == ((y) & (z))) 237#define __OCTEON_MATCH_MASK__(x, y, z) (((x) & (z)) == ((y) & (z)))
227 238
@@ -273,6 +284,15 @@ static inline int __OCTEON_IS_MODEL_COMPILE__(uint32_t arg_model,
273 __OCTEON_MATCH_MASK__((chip_model), (arg_model), 284 __OCTEON_MATCH_MASK__((chip_model), (arg_model),
274 OCTEON_58XX_MODEL_REV_MASK)) 285 OCTEON_58XX_MODEL_REV_MASK))
275 return 1; 286 return 1;
287
288 if (((arg_model & OM_MATCH_5XXX_FAMILY_MODELS) == OM_MATCH_5XXX_FAMILY_MODELS) &&
289 ((chip_model) >= OCTEON_CN58XX_PASS1_0) && ((chip_model) < OCTEON_CN63XX_PASS1_0))
290 return 1;
291
292 if (((arg_model & OM_MATCH_6XXX_FAMILY_MODELS) == OM_MATCH_6XXX_FAMILY_MODELS) &&
293 ((chip_model) >= OCTEON_CN63XX_PASS1_0))
294 return 1;
295
276 if ((arg_model & OM_MATCH_PREVIOUS_MODELS) && 296 if ((arg_model & OM_MATCH_PREVIOUS_MODELS) &&
277 ((chip_model & OCTEON_58XX_MODEL_MASK) < 297 ((chip_model & OCTEON_58XX_MODEL_MASK) <
278 (arg_model & OCTEON_58XX_MODEL_MASK))) 298 (arg_model & OCTEON_58XX_MODEL_MASK)))
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h
index 917a6c413b1a..6b34afd0d4e7 100644
--- a/arch/mips/include/asm/octeon/octeon.h
+++ b/arch/mips/include/asm/octeon/octeon.h
@@ -35,6 +35,7 @@ extern int octeon_is_simulation(void);
35extern int octeon_is_pci_host(void); 35extern int octeon_is_pci_host(void);
36extern int octeon_usb_is_ref_clk(void); 36extern int octeon_usb_is_ref_clk(void);
37extern uint64_t octeon_get_clock_rate(void); 37extern uint64_t octeon_get_clock_rate(void);
38extern u64 octeon_get_io_clock_rate(void);
38extern const char *octeon_board_type_string(void); 39extern const char *octeon_board_type_string(void);
39extern const char *octeon_get_pci_interrupts(void); 40extern const char *octeon_get_pci_interrupts(void);
40extern int octeon_get_southbridge_interrupt(void); 41extern int octeon_get_southbridge_interrupt(void);
diff --git a/arch/mips/include/asm/octeon/pci-octeon.h b/arch/mips/include/asm/octeon/pci-octeon.h
index ece78043acf6..fba2ba200f58 100644
--- a/arch/mips/include/asm/octeon/pci-octeon.h
+++ b/arch/mips/include/asm/octeon/pci-octeon.h
@@ -36,6 +36,16 @@ extern int (*octeon_pcibios_map_irq)(const struct pci_dev *dev,
36 u8 slot, u8 pin); 36 u8 slot, u8 pin);
37 37
38/* 38/*
39 * For PCI (not PCIe) the BAR2 base address.
40 */
41#define OCTEON_BAR2_PCI_ADDRESS 0x8000000000ull
42
43/*
44 * For PCI (not PCIe) the base of the memory mapped by BAR1
45 */
46extern u64 octeon_bar1_pci_phys;
47
48/*
39 * The following defines are used when octeon_dma_bar_type = 49 * The following defines are used when octeon_dma_bar_type =
40 * OCTEON_DMA_BAR_TYPE_BIG 50 * OCTEON_DMA_BAR_TYPE_BIG
41 */ 51 */
diff --git a/arch/mips/include/asm/perf_event.h b/arch/mips/include/asm/perf_event.h
new file mode 100644
index 000000000000..e00007cf8162
--- /dev/null
+++ b/arch/mips/include/asm/perf_event.h
@@ -0,0 +1,25 @@
1/*
2 * linux/arch/mips/include/asm/perf_event.h
3 *
4 * Copyright (C) 2010 MIPS Technologies, Inc.
5 * Author: Deng-Cheng Zhu
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __MIPS_PERF_EVENT_H__
13#define __MIPS_PERF_EVENT_H__
14
15/*
16 * MIPS performance counters do not raise NMI upon overflow, a regular
17 * interrupt will be signaled. Hence we can do the pending perf event
18 * work at the tail of the irq handler.
19 */
20static inline void
21set_perf_event_pending(void)
22{
23}
24
25#endif /* __MIPS_PERF_EVENT_H__ */
diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
index f00896087dda..55908fd56b1f 100644
--- a/arch/mips/include/asm/pgtable-64.h
+++ b/arch/mips/include/asm/pgtable-64.h
@@ -113,10 +113,10 @@
113#endif 113#endif
114#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t)) 114#define PTRS_PER_PTE ((PAGE_SIZE << PTE_ORDER) / sizeof(pte_t))
115 115
116#if PGDIR_SIZE >= TASK_SIZE 116#if PGDIR_SIZE >= TASK_SIZE64
117#define USER_PTRS_PER_PGD (1) 117#define USER_PTRS_PER_PGD (1)
118#else 118#else
119#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE) 119#define USER_PTRS_PER_PGD (TASK_SIZE64 / PGDIR_SIZE)
120#endif 120#endif
121#define FIRST_USER_ADDRESS 0UL 121#define FIRST_USER_ADDRESS 0UL
122 122
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index 0d629bb93cbe..ead6928fa6b8 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -50,13 +50,10 @@ extern unsigned int vced_count, vcei_count;
50 * so don't change it unless you know what you are doing. 50 * so don't change it unless you know what you are doing.
51 */ 51 */
52#define TASK_SIZE 0x7fff8000UL 52#define TASK_SIZE 0x7fff8000UL
53#define STACK_TOP ((TASK_SIZE & PAGE_MASK) - SPECIAL_PAGES_SIZE)
54 53
55/* 54#ifdef __KERNEL__
56 * This decides where the kernel will search for a free chunk of vm 55#define STACK_TOP_MAX TASK_SIZE
57 * space during mmap's. 56#endif
58 */
59#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
60 57
61#define TASK_IS_32BIT_ADDR 1 58#define TASK_IS_32BIT_ADDR 1
62 59
@@ -71,28 +68,29 @@ extern unsigned int vced_count, vcei_count;
71 * 8192EB ... 68 * 8192EB ...
72 */ 69 */
73#define TASK_SIZE32 0x7fff8000UL 70#define TASK_SIZE32 0x7fff8000UL
74#define TASK_SIZE 0x10000000000UL 71#define TASK_SIZE64 0x10000000000UL
75#define STACK_TOP \ 72#define TASK_SIZE (test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64)
76 (((test_thread_flag(TIF_32BIT_ADDR) ? \ 73
77 TASK_SIZE32 : TASK_SIZE) & PAGE_MASK) - SPECIAL_PAGES_SIZE) 74#ifdef __KERNEL__
75#define STACK_TOP_MAX TASK_SIZE64
76#endif
77
78 78
79/*
80 * This decides where the kernel will search for a free chunk of vm
81 * space during mmap's.
82 */
83#define TASK_UNMAPPED_BASE \
84 (test_thread_flag(TIF_32BIT_ADDR) ? \
85 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
86#define TASK_SIZE_OF(tsk) \ 79#define TASK_SIZE_OF(tsk) \
87 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE) 80 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE64)
88 81
89#define TASK_IS_32BIT_ADDR test_thread_flag(TIF_32BIT_ADDR) 82#define TASK_IS_32BIT_ADDR test_thread_flag(TIF_32BIT_ADDR)
90 83
91#endif 84#endif
92 85
93#ifdef __KERNEL__ 86#define STACK_TOP ((TASK_SIZE & PAGE_MASK) - SPECIAL_PAGES_SIZE)
94#define STACK_TOP_MAX TASK_SIZE 87
95#endif 88/*
89 * This decides where the kernel will search for a free chunk of vm
90 * space during mmap's.
91 */
92#define TASK_UNMAPPED_BASE PAGE_ALIGN(TASK_SIZE / 3)
93
96 94
97#define NUM_FPU_REGS 32 95#define NUM_FPU_REGS 32
98 96
diff --git a/arch/mips/include/asm/system.h b/arch/mips/include/asm/system.h
index bb937ccfba1e..6018c80ce37a 100644
--- a/arch/mips/include/asm/system.h
+++ b/arch/mips/include/asm/system.h
@@ -115,21 +115,19 @@ static inline unsigned long __xchg_u32(volatile int * m, unsigned int val)
115 } else if (kernel_uses_llsc) { 115 } else if (kernel_uses_llsc) {
116 unsigned long dummy; 116 unsigned long dummy;
117 117
118 __asm__ __volatile__( 118 do {
119 " .set mips3 \n" 119 __asm__ __volatile__(
120 "1: ll %0, %3 # xchg_u32 \n" 120 " .set mips3 \n"
121 " .set mips0 \n" 121 " ll %0, %3 # xchg_u32 \n"
122 " move %2, %z4 \n" 122 " .set mips0 \n"
123 " .set mips3 \n" 123 " move %2, %z4 \n"
124 " sc %2, %1 \n" 124 " .set mips3 \n"
125 " beqz %2, 2f \n" 125 " sc %2, %1 \n"
126 " .subsection 2 \n" 126 " .set mips0 \n"
127 "2: b 1b \n" 127 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
128 " .previous \n" 128 : "R" (*m), "Jr" (val)
129 " .set mips0 \n" 129 : "memory");
130 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 130 } while (unlikely(!dummy));
131 : "R" (*m), "Jr" (val)
132 : "memory");
133 } else { 131 } else {
134 unsigned long flags; 132 unsigned long flags;
135 133
@@ -167,19 +165,17 @@ static inline __u64 __xchg_u64(volatile __u64 * m, __u64 val)
167 } else if (kernel_uses_llsc) { 165 } else if (kernel_uses_llsc) {
168 unsigned long dummy; 166 unsigned long dummy;
169 167
170 __asm__ __volatile__( 168 do {
171 " .set mips3 \n" 169 __asm__ __volatile__(
172 "1: lld %0, %3 # xchg_u64 \n" 170 " .set mips3 \n"
173 " move %2, %z4 \n" 171 " lld %0, %3 # xchg_u64 \n"
174 " scd %2, %1 \n" 172 " move %2, %z4 \n"
175 " beqz %2, 2f \n" 173 " scd %2, %1 \n"
176 " .subsection 2 \n" 174 " .set mips0 \n"
177 "2: b 1b \n" 175 : "=&r" (retval), "=m" (*m), "=&r" (dummy)
178 " .previous \n" 176 : "R" (*m), "Jr" (val)
179 " .set mips0 \n" 177 : "memory");
180 : "=&r" (retval), "=m" (*m), "=&r" (dummy) 178 } while (unlikely(!dummy));
181 : "R" (*m), "Jr" (val)
182 : "memory");
183 } else { 179 } else {
184 unsigned long flags; 180 unsigned long flags;
185 181
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index 70df9c0d3c5b..d309556cacf8 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -83,6 +83,8 @@ register struct thread_info *__current_thread_info __asm__("$28");
83#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) 83#define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER)
84#define THREAD_MASK (THREAD_SIZE - 1UL) 84#define THREAD_MASK (THREAD_SIZE - 1UL)
85 85
86#define STACK_WARN (THREAD_SIZE / 8)
87
86#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 88#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
87 89
88#ifdef CONFIG_DEBUG_STACK_USAGE 90#ifdef CONFIG_DEBUG_STACK_USAGE
diff --git a/arch/mips/include/asm/uaccess.h b/arch/mips/include/asm/uaccess.h
index c2d53c18fd36..653a412c036c 100644
--- a/arch/mips/include/asm/uaccess.h
+++ b/arch/mips/include/asm/uaccess.h
@@ -35,7 +35,9 @@
35 35
36#ifdef CONFIG_64BIT 36#ifdef CONFIG_64BIT
37 37
38#define __UA_LIMIT (- TASK_SIZE) 38extern u64 __ua_limit;
39
40#define __UA_LIMIT __ua_limit
39 41
40#define __UA_ADDR ".dword" 42#define __UA_ADDR ".dword"
41#define __UA_LA "dla" 43#define __UA_LA "dla"
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 80884983270d..22b2e0e38617 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -104,4 +104,6 @@ obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
104 104
105obj-$(CONFIG_MIPS_CPUFREQ) += cpufreq/ 105obj-$(CONFIG_MIPS_CPUFREQ) += cpufreq/
106 106
107obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o
108
107CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS) 109CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index b1b304ea2128..71620e19827a 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -25,6 +25,8 @@
25#include <asm/system.h> 25#include <asm/system.h>
26#include <asm/watch.h> 26#include <asm/watch.h>
27#include <asm/spram.h> 27#include <asm/spram.h>
28#include <asm/uaccess.h>
29
28/* 30/*
29 * Not all of the MIPS CPUs have the "wait" instruction available. Moreover, 31 * Not all of the MIPS CPUs have the "wait" instruction available. Moreover,
30 * the implementation of the "wait" feature differs between CPU families. This 32 * the implementation of the "wait" feature differs between CPU families. This
@@ -181,12 +183,13 @@ void __init check_wait(void)
181 case CPU_5KC: 183 case CPU_5KC:
182 case CPU_25KF: 184 case CPU_25KF:
183 case CPU_PR4450: 185 case CPU_PR4450:
184 case CPU_BCM3302: 186 case CPU_BMIPS3300:
185 case CPU_BCM6338: 187 case CPU_BMIPS4350:
186 case CPU_BCM6348: 188 case CPU_BMIPS4380:
187 case CPU_BCM6358: 189 case CPU_BMIPS5000:
188 case CPU_CAVIUM_OCTEON: 190 case CPU_CAVIUM_OCTEON:
189 case CPU_CAVIUM_OCTEON_PLUS: 191 case CPU_CAVIUM_OCTEON_PLUS:
192 case CPU_CAVIUM_OCTEON2:
190 case CPU_JZRISC: 193 case CPU_JZRISC:
191 cpu_wait = r4k_wait; 194 cpu_wait = r4k_wait;
192 break; 195 break;
@@ -902,33 +905,37 @@ static inline void cpu_probe_broadcom(struct cpuinfo_mips *c, unsigned int cpu)
902{ 905{
903 decode_configs(c); 906 decode_configs(c);
904 switch (c->processor_id & 0xff00) { 907 switch (c->processor_id & 0xff00) {
905 case PRID_IMP_BCM3302: 908 case PRID_IMP_BMIPS32:
906 /* same as PRID_IMP_BCM6338 */ 909 c->cputype = CPU_BMIPS32;
907 c->cputype = CPU_BCM3302; 910 __cpu_name[cpu] = "Broadcom BMIPS32";
908 __cpu_name[cpu] = "Broadcom BCM3302"; 911 break;
909 break; 912 case PRID_IMP_BMIPS3300:
910 case PRID_IMP_BCM4710: 913 case PRID_IMP_BMIPS3300_ALT:
911 c->cputype = CPU_BCM4710; 914 case PRID_IMP_BMIPS3300_BUG:
912 __cpu_name[cpu] = "Broadcom BCM4710"; 915 c->cputype = CPU_BMIPS3300;
913 break; 916 __cpu_name[cpu] = "Broadcom BMIPS3300";
914 case PRID_IMP_BCM6345: 917 break;
915 c->cputype = CPU_BCM6345; 918 case PRID_IMP_BMIPS43XX: {
916 __cpu_name[cpu] = "Broadcom BCM6345"; 919 int rev = c->processor_id & 0xff;
920
921 if (rev >= PRID_REV_BMIPS4380_LO &&
922 rev <= PRID_REV_BMIPS4380_HI) {
923 c->cputype = CPU_BMIPS4380;
924 __cpu_name[cpu] = "Broadcom BMIPS4380";
925 } else {
926 c->cputype = CPU_BMIPS4350;
927 __cpu_name[cpu] = "Broadcom BMIPS4350";
928 }
917 break; 929 break;
918 case PRID_IMP_BCM6348: 930 }
919 c->cputype = CPU_BCM6348; 931 case PRID_IMP_BMIPS5000:
920 __cpu_name[cpu] = "Broadcom BCM6348"; 932 c->cputype = CPU_BMIPS5000;
933 __cpu_name[cpu] = "Broadcom BMIPS5000";
934 c->options |= MIPS_CPU_ULRI;
921 break; 935 break;
922 case PRID_IMP_BCM4350: 936 case PRID_IMP_BMIPS4KC:
923 switch (c->processor_id & 0xf0) { 937 c->cputype = CPU_4KC;
924 case PRID_REV_BCM6358: 938 __cpu_name[cpu] = "MIPS 4Kc";
925 c->cputype = CPU_BCM6358;
926 __cpu_name[cpu] = "Broadcom BCM6358";
927 break;
928 default:
929 c->cputype = CPU_UNKNOWN;
930 break;
931 }
932 break; 939 break;
933 } 940 }
934} 941}
@@ -953,6 +960,12 @@ platform:
953 if (cpu == 0) 960 if (cpu == 0)
954 __elf_platform = "octeon"; 961 __elf_platform = "octeon";
955 break; 962 break;
963 case PRID_IMP_CAVIUM_CN63XX:
964 c->cputype = CPU_CAVIUM_OCTEON2;
965 __cpu_name[cpu] = "Cavium Octeon II";
966 if (cpu == 0)
967 __elf_platform = "octeon2";
968 break;
956 default: 969 default:
957 printk(KERN_INFO "Unknown Octeon chip!\n"); 970 printk(KERN_INFO "Unknown Octeon chip!\n");
958 c->cputype = CPU_UNKNOWN; 971 c->cputype = CPU_UNKNOWN;
@@ -976,6 +989,12 @@ static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
976 } 989 }
977} 990}
978 991
992#ifdef CONFIG_64BIT
993/* For use by uaccess.h */
994u64 __ua_limit;
995EXPORT_SYMBOL(__ua_limit);
996#endif
997
979const char *__cpu_name[NR_CPUS]; 998const char *__cpu_name[NR_CPUS];
980const char *__elf_platform; 999const char *__elf_platform;
981 1000
@@ -1053,6 +1072,11 @@ __cpuinit void cpu_probe(void)
1053 c->srsets = 1; 1072 c->srsets = 1;
1054 1073
1055 cpu_probe_vmbits(c); 1074 cpu_probe_vmbits(c);
1075
1076#ifdef CONFIG_64BIT
1077 if (cpu == 0)
1078 __ua_limit = ~((1ull << cpu_vmbits) - 1);
1079#endif
1056} 1080}
1057 1081
1058__cpuinit void cpu_report(void) 1082__cpuinit void cpu_report(void)
diff --git a/arch/mips/kernel/irq.c b/arch/mips/kernel/irq.c
index c6345f579a8a..4f93db58a79e 100644
--- a/arch/mips/kernel/irq.c
+++ b/arch/mips/kernel/irq.c
@@ -151,6 +151,29 @@ void __init init_IRQ(void)
151#endif 151#endif
152} 152}
153 153
154#ifdef DEBUG_STACKOVERFLOW
155static inline void check_stack_overflow(void)
156{
157 unsigned long sp;
158
159 __asm__ __volatile__("move %0, $sp" : "=r" (sp));
160 sp &= THREAD_MASK;
161
162 /*
163 * Check for stack overflow: is there less than STACK_WARN free?
164 * STACK_WARN is defined as 1/8 of THREAD_SIZE by default.
165 */
166 if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) {
167 printk("do_IRQ: stack overflow: %ld\n",
168 sp - sizeof(struct thread_info));
169 dump_stack();
170 }
171}
172#else
173static inline void check_stack_overflow(void) {}
174#endif
175
176
154/* 177/*
155 * do_IRQ handles all normal device IRQ's (the special 178 * do_IRQ handles all normal device IRQ's (the special
156 * SMP cross-CPU interrupts have their own specific 179 * SMP cross-CPU interrupts have their own specific
@@ -159,6 +182,7 @@ void __init init_IRQ(void)
159void __irq_entry do_IRQ(unsigned int irq) 182void __irq_entry do_IRQ(unsigned int irq)
160{ 183{
161 irq_enter(); 184 irq_enter();
185 check_stack_overflow();
162 __DO_IRQ_SMTC_HOOK(irq); 186 __DO_IRQ_SMTC_HOOK(irq);
163 generic_handle_irq(irq); 187 generic_handle_irq(irq);
164 irq_exit(); 188 irq_exit();
diff --git a/arch/mips/kernel/perf_event.c b/arch/mips/kernel/perf_event.c
new file mode 100644
index 000000000000..2b7f3f703b83
--- /dev/null
+++ b/arch/mips/kernel/perf_event.c
@@ -0,0 +1,601 @@
1/*
2 * Linux performance counter support for MIPS.
3 *
4 * Copyright (C) 2010 MIPS Technologies, Inc.
5 * Author: Deng-Cheng Zhu
6 *
7 * This code is based on the implementation for ARM, which is in turn
8 * based on the sparc64 perf event code and the x86 code. Performance
9 * counter access is based on the MIPS Oprofile code. And the callchain
10 * support references the code of MIPS stacktrace.c.
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/cpumask.h>
18#include <linux/interrupt.h>
19#include <linux/smp.h>
20#include <linux/kernel.h>
21#include <linux/perf_event.h>
22#include <linux/uaccess.h>
23
24#include <asm/irq.h>
25#include <asm/irq_regs.h>
26#include <asm/stacktrace.h>
27#include <asm/time.h> /* For perf_irq */
28
29/* These are for 32bit counters. For 64bit ones, define them accordingly. */
30#define MAX_PERIOD ((1ULL << 32) - 1)
31#define VALID_COUNT 0x7fffffff
32#define TOTAL_BITS 32
33#define HIGHEST_BIT 31
34
35#define MIPS_MAX_HWEVENTS 4
36
37struct cpu_hw_events {
38 /* Array of events on this cpu. */
39 struct perf_event *events[MIPS_MAX_HWEVENTS];
40
41 /*
42 * Set the bit (indexed by the counter number) when the counter
43 * is used for an event.
44 */
45 unsigned long used_mask[BITS_TO_LONGS(MIPS_MAX_HWEVENTS)];
46
47 /*
48 * The borrowed MSB for the performance counter. A MIPS performance
49 * counter uses its bit 31 (for 32bit counters) or bit 63 (for 64bit
50 * counters) as a factor of determining whether a counter overflow
51 * should be signaled. So here we use a separate MSB for each
52 * counter to make things easy.
53 */
54 unsigned long msbs[BITS_TO_LONGS(MIPS_MAX_HWEVENTS)];
55
56 /*
57 * Software copy of the control register for each performance counter.
58 * MIPS CPUs vary in performance counters. They use this differently,
59 * and even may not use it.
60 */
61 unsigned int saved_ctrl[MIPS_MAX_HWEVENTS];
62};
63DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
64 .saved_ctrl = {0},
65};
66
67/* The description of MIPS performance events. */
68struct mips_perf_event {
69 unsigned int event_id;
70 /*
71 * MIPS performance counters are indexed starting from 0.
72 * CNTR_EVEN indicates the indexes of the counters to be used are
73 * even numbers.
74 */
75 unsigned int cntr_mask;
76 #define CNTR_EVEN 0x55555555
77 #define CNTR_ODD 0xaaaaaaaa
78#ifdef CONFIG_MIPS_MT_SMP
79 enum {
80 T = 0,
81 V = 1,
82 P = 2,
83 } range;
84#else
85 #define T
86 #define V
87 #define P
88#endif
89};
90
91static struct mips_perf_event raw_event;
92static DEFINE_MUTEX(raw_event_mutex);
93
94#define UNSUPPORTED_PERF_EVENT_ID 0xffffffff
95#define C(x) PERF_COUNT_HW_CACHE_##x
96
97struct mips_pmu {
98 const char *name;
99 int irq;
100 irqreturn_t (*handle_irq)(int irq, void *dev);
101 int (*handle_shared_irq)(void);
102 void (*start)(void);
103 void (*stop)(void);
104 int (*alloc_counter)(struct cpu_hw_events *cpuc,
105 struct hw_perf_event *hwc);
106 u64 (*read_counter)(unsigned int idx);
107 void (*write_counter)(unsigned int idx, u64 val);
108 void (*enable_event)(struct hw_perf_event *evt, int idx);
109 void (*disable_event)(int idx);
110 const struct mips_perf_event *(*map_raw_event)(u64 config);
111 const struct mips_perf_event (*general_event_map)[PERF_COUNT_HW_MAX];
112 const struct mips_perf_event (*cache_event_map)
113 [PERF_COUNT_HW_CACHE_MAX]
114 [PERF_COUNT_HW_CACHE_OP_MAX]
115 [PERF_COUNT_HW_CACHE_RESULT_MAX];
116 unsigned int num_counters;
117};
118
119static const struct mips_pmu *mipspmu;
120
121static int
122mipspmu_event_set_period(struct perf_event *event,
123 struct hw_perf_event *hwc,
124 int idx)
125{
126 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
127 s64 left = local64_read(&hwc->period_left);
128 s64 period = hwc->sample_period;
129 int ret = 0;
130 u64 uleft;
131 unsigned long flags;
132
133 if (unlikely(left <= -period)) {
134 left = period;
135 local64_set(&hwc->period_left, left);
136 hwc->last_period = period;
137 ret = 1;
138 }
139
140 if (unlikely(left <= 0)) {
141 left += period;
142 local64_set(&hwc->period_left, left);
143 hwc->last_period = period;
144 ret = 1;
145 }
146
147 if (left > (s64)MAX_PERIOD)
148 left = MAX_PERIOD;
149
150 local64_set(&hwc->prev_count, (u64)-left);
151
152 local_irq_save(flags);
153 uleft = (u64)(-left) & MAX_PERIOD;
154 uleft > VALID_COUNT ?
155 set_bit(idx, cpuc->msbs) : clear_bit(idx, cpuc->msbs);
156 mipspmu->write_counter(idx, (u64)(-left) & VALID_COUNT);
157 local_irq_restore(flags);
158
159 perf_event_update_userpage(event);
160
161 return ret;
162}
163
164static int mipspmu_enable(struct perf_event *event)
165{
166 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
167 struct hw_perf_event *hwc = &event->hw;
168 int idx;
169 int err = 0;
170
171 /* To look for a free counter for this event. */
172 idx = mipspmu->alloc_counter(cpuc, hwc);
173 if (idx < 0) {
174 err = idx;
175 goto out;
176 }
177
178 /*
179 * If there is an event in the counter we are going to use then
180 * make sure it is disabled.
181 */
182 event->hw.idx = idx;
183 mipspmu->disable_event(idx);
184 cpuc->events[idx] = event;
185
186 /* Set the period for the event. */
187 mipspmu_event_set_period(event, hwc, idx);
188
189 /* Enable the event. */
190 mipspmu->enable_event(hwc, idx);
191
192 /* Propagate our changes to the userspace mapping. */
193 perf_event_update_userpage(event);
194
195out:
196 return err;
197}
198
199static void mipspmu_event_update(struct perf_event *event,
200 struct hw_perf_event *hwc,
201 int idx)
202{
203 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
204 unsigned long flags;
205 int shift = 64 - TOTAL_BITS;
206 s64 prev_raw_count, new_raw_count;
207 s64 delta;
208
209again:
210 prev_raw_count = local64_read(&hwc->prev_count);
211 local_irq_save(flags);
212 /* Make the counter value be a "real" one. */
213 new_raw_count = mipspmu->read_counter(idx);
214 if (new_raw_count & (test_bit(idx, cpuc->msbs) << HIGHEST_BIT)) {
215 new_raw_count &= VALID_COUNT;
216 clear_bit(idx, cpuc->msbs);
217 } else
218 new_raw_count |= (test_bit(idx, cpuc->msbs) << HIGHEST_BIT);
219 local_irq_restore(flags);
220
221 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
222 new_raw_count) != prev_raw_count)
223 goto again;
224
225 delta = (new_raw_count << shift) - (prev_raw_count << shift);
226 delta >>= shift;
227
228 local64_add(delta, &event->count);
229 local64_sub(delta, &hwc->period_left);
230
231 return;
232}
233
234static void mipspmu_disable(struct perf_event *event)
235{
236 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
237 struct hw_perf_event *hwc = &event->hw;
238 int idx = hwc->idx;
239
240
241 WARN_ON(idx < 0 || idx >= mipspmu->num_counters);
242
243 /* We are working on a local event. */
244 mipspmu->disable_event(idx);
245
246 barrier();
247
248 mipspmu_event_update(event, hwc, idx);
249 cpuc->events[idx] = NULL;
250 clear_bit(idx, cpuc->used_mask);
251
252 perf_event_update_userpage(event);
253}
254
255static void mipspmu_unthrottle(struct perf_event *event)
256{
257 struct hw_perf_event *hwc = &event->hw;
258
259 mipspmu->enable_event(hwc, hwc->idx);
260}
261
262static void mipspmu_read(struct perf_event *event)
263{
264 struct hw_perf_event *hwc = &event->hw;
265
266 /* Don't read disabled counters! */
267 if (hwc->idx < 0)
268 return;
269
270 mipspmu_event_update(event, hwc, hwc->idx);
271}
272
273static struct pmu pmu = {
274 .enable = mipspmu_enable,
275 .disable = mipspmu_disable,
276 .unthrottle = mipspmu_unthrottle,
277 .read = mipspmu_read,
278};
279
280static atomic_t active_events = ATOMIC_INIT(0);
281static DEFINE_MUTEX(pmu_reserve_mutex);
282static int (*save_perf_irq)(void);
283
284static int mipspmu_get_irq(void)
285{
286 int err;
287
288 if (mipspmu->irq >= 0) {
289 /* Request my own irq handler. */
290 err = request_irq(mipspmu->irq, mipspmu->handle_irq,
291 IRQF_DISABLED | IRQF_NOBALANCING,
292 "mips_perf_pmu", NULL);
293 if (err) {
294 pr_warning("Unable to request IRQ%d for MIPS "
295 "performance counters!\n", mipspmu->irq);
296 }
297 } else if (cp0_perfcount_irq < 0) {
298 /*
299 * We are sharing the irq number with the timer interrupt.
300 */
301 save_perf_irq = perf_irq;
302 perf_irq = mipspmu->handle_shared_irq;
303 err = 0;
304 } else {
305 pr_warning("The platform hasn't properly defined its "
306 "interrupt controller.\n");
307 err = -ENOENT;
308 }
309
310 return err;
311}
312
313static void mipspmu_free_irq(void)
314{
315 if (mipspmu->irq >= 0)
316 free_irq(mipspmu->irq, NULL);
317 else if (cp0_perfcount_irq < 0)
318 perf_irq = save_perf_irq;
319}
320
321static inline unsigned int
322mipspmu_perf_event_encode(const struct mips_perf_event *pev)
323{
324/*
325 * Top 8 bits for range, next 16 bits for cntr_mask, lowest 8 bits for
326 * event_id.
327 */
328#ifdef CONFIG_MIPS_MT_SMP
329 return ((unsigned int)pev->range << 24) |
330 (pev->cntr_mask & 0xffff00) |
331 (pev->event_id & 0xff);
332#else
333 return (pev->cntr_mask & 0xffff00) |
334 (pev->event_id & 0xff);
335#endif
336}
337
338static const struct mips_perf_event *
339mipspmu_map_general_event(int idx)
340{
341 const struct mips_perf_event *pev;
342
343 pev = ((*mipspmu->general_event_map)[idx].event_id ==
344 UNSUPPORTED_PERF_EVENT_ID ? ERR_PTR(-EOPNOTSUPP) :
345 &(*mipspmu->general_event_map)[idx]);
346
347 return pev;
348}
349
350static const struct mips_perf_event *
351mipspmu_map_cache_event(u64 config)
352{
353 unsigned int cache_type, cache_op, cache_result;
354 const struct mips_perf_event *pev;
355
356 cache_type = (config >> 0) & 0xff;
357 if (cache_type >= PERF_COUNT_HW_CACHE_MAX)
358 return ERR_PTR(-EINVAL);
359
360 cache_op = (config >> 8) & 0xff;
361 if (cache_op >= PERF_COUNT_HW_CACHE_OP_MAX)
362 return ERR_PTR(-EINVAL);
363
364 cache_result = (config >> 16) & 0xff;
365 if (cache_result >= PERF_COUNT_HW_CACHE_RESULT_MAX)
366 return ERR_PTR(-EINVAL);
367
368 pev = &((*mipspmu->cache_event_map)
369 [cache_type]
370 [cache_op]
371 [cache_result]);
372
373 if (pev->event_id == UNSUPPORTED_PERF_EVENT_ID)
374 return ERR_PTR(-EOPNOTSUPP);
375
376 return pev;
377
378}
379
380static int validate_event(struct cpu_hw_events *cpuc,
381 struct perf_event *event)
382{
383 struct hw_perf_event fake_hwc = event->hw;
384
385 if (event->pmu && event->pmu != &pmu)
386 return 0;
387
388 return mipspmu->alloc_counter(cpuc, &fake_hwc) >= 0;
389}
390
391static int validate_group(struct perf_event *event)
392{
393 struct perf_event *sibling, *leader = event->group_leader;
394 struct cpu_hw_events fake_cpuc;
395
396 memset(&fake_cpuc, 0, sizeof(fake_cpuc));
397
398 if (!validate_event(&fake_cpuc, leader))
399 return -ENOSPC;
400
401 list_for_each_entry(sibling, &leader->sibling_list, group_entry) {
402 if (!validate_event(&fake_cpuc, sibling))
403 return -ENOSPC;
404 }
405
406 if (!validate_event(&fake_cpuc, event))
407 return -ENOSPC;
408
409 return 0;
410}
411
412/*
413 * mipsxx/rm9000/loongson2 have different performance counters, they have
414 * specific low-level init routines.
415 */
416static void reset_counters(void *arg);
417static int __hw_perf_event_init(struct perf_event *event);
418
419static void hw_perf_event_destroy(struct perf_event *event)
420{
421 if (atomic_dec_and_mutex_lock(&active_events,
422 &pmu_reserve_mutex)) {
423 /*
424 * We must not call the destroy function with interrupts
425 * disabled.
426 */
427 on_each_cpu(reset_counters,
428 (void *)(long)mipspmu->num_counters, 1);
429 mipspmu_free_irq();
430 mutex_unlock(&pmu_reserve_mutex);
431 }
432}
433
434const struct pmu *hw_perf_event_init(struct perf_event *event)
435{
436 int err = 0;
437
438 if (!mipspmu || event->cpu >= nr_cpumask_bits ||
439 (event->cpu >= 0 && !cpu_online(event->cpu)))
440 return ERR_PTR(-ENODEV);
441
442 if (!atomic_inc_not_zero(&active_events)) {
443 if (atomic_read(&active_events) > MIPS_MAX_HWEVENTS) {
444 atomic_dec(&active_events);
445 return ERR_PTR(-ENOSPC);
446 }
447
448 mutex_lock(&pmu_reserve_mutex);
449 if (atomic_read(&active_events) == 0)
450 err = mipspmu_get_irq();
451
452 if (!err)
453 atomic_inc(&active_events);
454 mutex_unlock(&pmu_reserve_mutex);
455 }
456
457 if (err)
458 return ERR_PTR(err);
459
460 err = __hw_perf_event_init(event);
461 if (err)
462 hw_perf_event_destroy(event);
463
464 return err ? ERR_PTR(err) : &pmu;
465}
466
467void hw_perf_enable(void)
468{
469 if (mipspmu)
470 mipspmu->start();
471}
472
473void hw_perf_disable(void)
474{
475 if (mipspmu)
476 mipspmu->stop();
477}
478
479/* This is needed by specific irq handlers in perf_event_*.c */
480static void
481handle_associated_event(struct cpu_hw_events *cpuc,
482 int idx, struct perf_sample_data *data, struct pt_regs *regs)
483{
484 struct perf_event *event = cpuc->events[idx];
485 struct hw_perf_event *hwc = &event->hw;
486
487 mipspmu_event_update(event, hwc, idx);
488 data->period = event->hw.last_period;
489 if (!mipspmu_event_set_period(event, hwc, idx))
490 return;
491
492 if (perf_event_overflow(event, 0, data, regs))
493 mipspmu->disable_event(idx);
494}
495
496#include "perf_event_mipsxx.c"
497
498/* Callchain handling code. */
499static inline void
500callchain_store(struct perf_callchain_entry *entry,
501 u64 ip)
502{
503 if (entry->nr < PERF_MAX_STACK_DEPTH)
504 entry->ip[entry->nr++] = ip;
505}
506
507/*
508 * Leave userspace callchain empty for now. When we find a way to trace
509 * the user stack callchains, we add here.
510 */
511static void
512perf_callchain_user(struct pt_regs *regs,
513 struct perf_callchain_entry *entry)
514{
515}
516
517static void save_raw_perf_callchain(struct perf_callchain_entry *entry,
518 unsigned long reg29)
519{
520 unsigned long *sp = (unsigned long *)reg29;
521 unsigned long addr;
522
523 while (!kstack_end(sp)) {
524 addr = *sp++;
525 if (__kernel_text_address(addr)) {
526 callchain_store(entry, addr);
527 if (entry->nr >= PERF_MAX_STACK_DEPTH)
528 break;
529 }
530 }
531}
532
533static void
534perf_callchain_kernel(struct pt_regs *regs,
535 struct perf_callchain_entry *entry)
536{
537 unsigned long sp = regs->regs[29];
538#ifdef CONFIG_KALLSYMS
539 unsigned long ra = regs->regs[31];
540 unsigned long pc = regs->cp0_epc;
541
542 callchain_store(entry, PERF_CONTEXT_KERNEL);
543 if (raw_show_trace || !__kernel_text_address(pc)) {
544 unsigned long stack_page =
545 (unsigned long)task_stack_page(current);
546 if (stack_page && sp >= stack_page &&
547 sp <= stack_page + THREAD_SIZE - 32)
548 save_raw_perf_callchain(entry, sp);
549 return;
550 }
551 do {
552 callchain_store(entry, pc);
553 if (entry->nr >= PERF_MAX_STACK_DEPTH)
554 break;
555 pc = unwind_stack(current, &sp, pc, &ra);
556 } while (pc);
557#else
558 callchain_store(entry, PERF_CONTEXT_KERNEL);
559 save_raw_perf_callchain(entry, sp);
560#endif
561}
562
563static void
564perf_do_callchain(struct pt_regs *regs,
565 struct perf_callchain_entry *entry)
566{
567 int is_user;
568
569 if (!regs)
570 return;
571
572 is_user = user_mode(regs);
573
574 if (!current || !current->pid)
575 return;
576
577 if (is_user && current->state != TASK_RUNNING)
578 return;
579
580 if (!is_user) {
581 perf_callchain_kernel(regs, entry);
582 if (current->mm)
583 regs = task_pt_regs(current);
584 else
585 regs = NULL;
586 }
587 if (regs)
588 perf_callchain_user(regs, entry);
589}
590
591static DEFINE_PER_CPU(struct perf_callchain_entry, pmc_irq_entry);
592
593struct perf_callchain_entry *
594perf_callchain(struct pt_regs *regs)
595{
596 struct perf_callchain_entry *entry = &__get_cpu_var(pmc_irq_entry);
597
598 entry->nr = 0;
599 perf_do_callchain(regs, entry);
600 return entry;
601}
diff --git a/arch/mips/kernel/perf_event_mipsxx.c b/arch/mips/kernel/perf_event_mipsxx.c
new file mode 100644
index 000000000000..5c7c6fc07565
--- /dev/null
+++ b/arch/mips/kernel/perf_event_mipsxx.c
@@ -0,0 +1,1052 @@
1#if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64) || \
2 defined(CONFIG_CPU_R10000) || defined(CONFIG_CPU_SB1)
3
4#define M_CONFIG1_PC (1 << 4)
5
6#define M_PERFCTL_EXL (1UL << 0)
7#define M_PERFCTL_KERNEL (1UL << 1)
8#define M_PERFCTL_SUPERVISOR (1UL << 2)
9#define M_PERFCTL_USER (1UL << 3)
10#define M_PERFCTL_INTERRUPT_ENABLE (1UL << 4)
11#define M_PERFCTL_EVENT(event) (((event) & 0x3ff) << 5)
12#define M_PERFCTL_VPEID(vpe) ((vpe) << 16)
13#define M_PERFCTL_MT_EN(filter) ((filter) << 20)
14#define M_TC_EN_ALL M_PERFCTL_MT_EN(0)
15#define M_TC_EN_VPE M_PERFCTL_MT_EN(1)
16#define M_TC_EN_TC M_PERFCTL_MT_EN(2)
17#define M_PERFCTL_TCID(tcid) ((tcid) << 22)
18#define M_PERFCTL_WIDE (1UL << 30)
19#define M_PERFCTL_MORE (1UL << 31)
20
21#define M_PERFCTL_COUNT_EVENT_WHENEVER (M_PERFCTL_EXL | \
22 M_PERFCTL_KERNEL | \
23 M_PERFCTL_USER | \
24 M_PERFCTL_SUPERVISOR | \
25 M_PERFCTL_INTERRUPT_ENABLE)
26
27#ifdef CONFIG_MIPS_MT_SMP
28#define M_PERFCTL_CONFIG_MASK 0x3fff801f
29#else
30#define M_PERFCTL_CONFIG_MASK 0x1f
31#endif
32#define M_PERFCTL_EVENT_MASK 0xfe0
33
34#define M_COUNTER_OVERFLOW (1UL << 31)
35
36#ifdef CONFIG_MIPS_MT_SMP
37static int cpu_has_mipsmt_pertccounters;
38
39/*
40 * FIXME: For VSMP, vpe_id() is redefined for Perf-events, because
41 * cpu_data[cpuid].vpe_id reports 0 for _both_ CPUs.
42 */
43#if defined(CONFIG_HW_PERF_EVENTS)
44#define vpe_id() (cpu_has_mipsmt_pertccounters ? \
45 0 : smp_processor_id())
46#else
47#define vpe_id() (cpu_has_mipsmt_pertccounters ? \
48 0 : cpu_data[smp_processor_id()].vpe_id)
49#endif
50
51/* Copied from op_model_mipsxx.c */
52static inline unsigned int vpe_shift(void)
53{
54 if (num_possible_cpus() > 1)
55 return 1;
56
57 return 0;
58}
59#else /* !CONFIG_MIPS_MT_SMP */
60#define vpe_id() 0
61
62static inline unsigned int vpe_shift(void)
63{
64 return 0;
65}
66#endif /* CONFIG_MIPS_MT_SMP */
67
68static inline unsigned int
69counters_total_to_per_cpu(unsigned int counters)
70{
71 return counters >> vpe_shift();
72}
73
74static inline unsigned int
75counters_per_cpu_to_total(unsigned int counters)
76{
77 return counters << vpe_shift();
78}
79
80#define __define_perf_accessors(r, n, np) \
81 \
82static inline unsigned int r_c0_ ## r ## n(void) \
83{ \
84 unsigned int cpu = vpe_id(); \
85 \
86 switch (cpu) { \
87 case 0: \
88 return read_c0_ ## r ## n(); \
89 case 1: \
90 return read_c0_ ## r ## np(); \
91 default: \
92 BUG(); \
93 } \
94 return 0; \
95} \
96 \
97static inline void w_c0_ ## r ## n(unsigned int value) \
98{ \
99 unsigned int cpu = vpe_id(); \
100 \
101 switch (cpu) { \
102 case 0: \
103 write_c0_ ## r ## n(value); \
104 return; \
105 case 1: \
106 write_c0_ ## r ## np(value); \
107 return; \
108 default: \
109 BUG(); \
110 } \
111 return; \
112} \
113
114__define_perf_accessors(perfcntr, 0, 2)
115__define_perf_accessors(perfcntr, 1, 3)
116__define_perf_accessors(perfcntr, 2, 0)
117__define_perf_accessors(perfcntr, 3, 1)
118
119__define_perf_accessors(perfctrl, 0, 2)
120__define_perf_accessors(perfctrl, 1, 3)
121__define_perf_accessors(perfctrl, 2, 0)
122__define_perf_accessors(perfctrl, 3, 1)
123
124static inline int __n_counters(void)
125{
126 if (!(read_c0_config1() & M_CONFIG1_PC))
127 return 0;
128 if (!(read_c0_perfctrl0() & M_PERFCTL_MORE))
129 return 1;
130 if (!(read_c0_perfctrl1() & M_PERFCTL_MORE))
131 return 2;
132 if (!(read_c0_perfctrl2() & M_PERFCTL_MORE))
133 return 3;
134
135 return 4;
136}
137
138static inline int n_counters(void)
139{
140 int counters;
141
142 switch (current_cpu_type()) {
143 case CPU_R10000:
144 counters = 2;
145 break;
146
147 case CPU_R12000:
148 case CPU_R14000:
149 counters = 4;
150 break;
151
152 default:
153 counters = __n_counters();
154 }
155
156 return counters;
157}
158
159static void reset_counters(void *arg)
160{
161 int counters = (int)(long)arg;
162 switch (counters) {
163 case 4:
164 w_c0_perfctrl3(0);
165 w_c0_perfcntr3(0);
166 case 3:
167 w_c0_perfctrl2(0);
168 w_c0_perfcntr2(0);
169 case 2:
170 w_c0_perfctrl1(0);
171 w_c0_perfcntr1(0);
172 case 1:
173 w_c0_perfctrl0(0);
174 w_c0_perfcntr0(0);
175 }
176}
177
178static inline u64
179mipsxx_pmu_read_counter(unsigned int idx)
180{
181 switch (idx) {
182 case 0:
183 return r_c0_perfcntr0();
184 case 1:
185 return r_c0_perfcntr1();
186 case 2:
187 return r_c0_perfcntr2();
188 case 3:
189 return r_c0_perfcntr3();
190 default:
191 WARN_ONCE(1, "Invalid performance counter number (%d)\n", idx);
192 return 0;
193 }
194}
195
196static inline void
197mipsxx_pmu_write_counter(unsigned int idx, u64 val)
198{
199 switch (idx) {
200 case 0:
201 w_c0_perfcntr0(val);
202 return;
203 case 1:
204 w_c0_perfcntr1(val);
205 return;
206 case 2:
207 w_c0_perfcntr2(val);
208 return;
209 case 3:
210 w_c0_perfcntr3(val);
211 return;
212 }
213}
214
215static inline unsigned int
216mipsxx_pmu_read_control(unsigned int idx)
217{
218 switch (idx) {
219 case 0:
220 return r_c0_perfctrl0();
221 case 1:
222 return r_c0_perfctrl1();
223 case 2:
224 return r_c0_perfctrl2();
225 case 3:
226 return r_c0_perfctrl3();
227 default:
228 WARN_ONCE(1, "Invalid performance counter number (%d)\n", idx);
229 return 0;
230 }
231}
232
233static inline void
234mipsxx_pmu_write_control(unsigned int idx, unsigned int val)
235{
236 switch (idx) {
237 case 0:
238 w_c0_perfctrl0(val);
239 return;
240 case 1:
241 w_c0_perfctrl1(val);
242 return;
243 case 2:
244 w_c0_perfctrl2(val);
245 return;
246 case 3:
247 w_c0_perfctrl3(val);
248 return;
249 }
250}
251
252#ifdef CONFIG_MIPS_MT_SMP
253static DEFINE_RWLOCK(pmuint_rwlock);
254#endif
255
256/* 24K/34K/1004K cores can share the same event map. */
257static const struct mips_perf_event mipsxxcore_event_map
258 [PERF_COUNT_HW_MAX] = {
259 [PERF_COUNT_HW_CPU_CYCLES] = { 0x00, CNTR_EVEN | CNTR_ODD, P },
260 [PERF_COUNT_HW_INSTRUCTIONS] = { 0x01, CNTR_EVEN | CNTR_ODD, T },
261 [PERF_COUNT_HW_CACHE_REFERENCES] = { UNSUPPORTED_PERF_EVENT_ID },
262 [PERF_COUNT_HW_CACHE_MISSES] = { UNSUPPORTED_PERF_EVENT_ID },
263 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = { 0x02, CNTR_EVEN, T },
264 [PERF_COUNT_HW_BRANCH_MISSES] = { 0x02, CNTR_ODD, T },
265 [PERF_COUNT_HW_BUS_CYCLES] = { UNSUPPORTED_PERF_EVENT_ID },
266};
267
268/* 74K core has different branch event code. */
269static const struct mips_perf_event mipsxx74Kcore_event_map
270 [PERF_COUNT_HW_MAX] = {
271 [PERF_COUNT_HW_CPU_CYCLES] = { 0x00, CNTR_EVEN | CNTR_ODD, P },
272 [PERF_COUNT_HW_INSTRUCTIONS] = { 0x01, CNTR_EVEN | CNTR_ODD, T },
273 [PERF_COUNT_HW_CACHE_REFERENCES] = { UNSUPPORTED_PERF_EVENT_ID },
274 [PERF_COUNT_HW_CACHE_MISSES] = { UNSUPPORTED_PERF_EVENT_ID },
275 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = { 0x27, CNTR_EVEN, T },
276 [PERF_COUNT_HW_BRANCH_MISSES] = { 0x27, CNTR_ODD, T },
277 [PERF_COUNT_HW_BUS_CYCLES] = { UNSUPPORTED_PERF_EVENT_ID },
278};
279
280/* 24K/34K/1004K cores can share the same cache event map. */
281static const struct mips_perf_event mipsxxcore_cache_map
282 [PERF_COUNT_HW_CACHE_MAX]
283 [PERF_COUNT_HW_CACHE_OP_MAX]
284 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
285[C(L1D)] = {
286 /*
287 * Like some other architectures (e.g. ARM), the performance
288 * counters don't differentiate between read and write
289 * accesses/misses, so this isn't strictly correct, but it's the
290 * best we can do. Writes and reads get combined.
291 */
292 [C(OP_READ)] = {
293 [C(RESULT_ACCESS)] = { 0x0a, CNTR_EVEN, T },
294 [C(RESULT_MISS)] = { 0x0b, CNTR_EVEN | CNTR_ODD, T },
295 },
296 [C(OP_WRITE)] = {
297 [C(RESULT_ACCESS)] = { 0x0a, CNTR_EVEN, T },
298 [C(RESULT_MISS)] = { 0x0b, CNTR_EVEN | CNTR_ODD, T },
299 },
300 [C(OP_PREFETCH)] = {
301 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
302 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
303 },
304},
305[C(L1I)] = {
306 [C(OP_READ)] = {
307 [C(RESULT_ACCESS)] = { 0x09, CNTR_EVEN, T },
308 [C(RESULT_MISS)] = { 0x09, CNTR_ODD, T },
309 },
310 [C(OP_WRITE)] = {
311 [C(RESULT_ACCESS)] = { 0x09, CNTR_EVEN, T },
312 [C(RESULT_MISS)] = { 0x09, CNTR_ODD, T },
313 },
314 [C(OP_PREFETCH)] = {
315 [C(RESULT_ACCESS)] = { 0x14, CNTR_EVEN, T },
316 /*
317 * Note that MIPS has only "hit" events countable for
318 * the prefetch operation.
319 */
320 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
321 },
322},
323[C(LL)] = {
324 [C(OP_READ)] = {
325 [C(RESULT_ACCESS)] = { 0x15, CNTR_ODD, P },
326 [C(RESULT_MISS)] = { 0x16, CNTR_EVEN, P },
327 },
328 [C(OP_WRITE)] = {
329 [C(RESULT_ACCESS)] = { 0x15, CNTR_ODD, P },
330 [C(RESULT_MISS)] = { 0x16, CNTR_EVEN, P },
331 },
332 [C(OP_PREFETCH)] = {
333 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
334 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
335 },
336},
337[C(DTLB)] = {
338 [C(OP_READ)] = {
339 [C(RESULT_ACCESS)] = { 0x06, CNTR_EVEN, T },
340 [C(RESULT_MISS)] = { 0x06, CNTR_ODD, T },
341 },
342 [C(OP_WRITE)] = {
343 [C(RESULT_ACCESS)] = { 0x06, CNTR_EVEN, T },
344 [C(RESULT_MISS)] = { 0x06, CNTR_ODD, T },
345 },
346 [C(OP_PREFETCH)] = {
347 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
348 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
349 },
350},
351[C(ITLB)] = {
352 [C(OP_READ)] = {
353 [C(RESULT_ACCESS)] = { 0x05, CNTR_EVEN, T },
354 [C(RESULT_MISS)] = { 0x05, CNTR_ODD, T },
355 },
356 [C(OP_WRITE)] = {
357 [C(RESULT_ACCESS)] = { 0x05, CNTR_EVEN, T },
358 [C(RESULT_MISS)] = { 0x05, CNTR_ODD, T },
359 },
360 [C(OP_PREFETCH)] = {
361 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
362 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
363 },
364},
365[C(BPU)] = {
366 /* Using the same code for *HW_BRANCH* */
367 [C(OP_READ)] = {
368 [C(RESULT_ACCESS)] = { 0x02, CNTR_EVEN, T },
369 [C(RESULT_MISS)] = { 0x02, CNTR_ODD, T },
370 },
371 [C(OP_WRITE)] = {
372 [C(RESULT_ACCESS)] = { 0x02, CNTR_EVEN, T },
373 [C(RESULT_MISS)] = { 0x02, CNTR_ODD, T },
374 },
375 [C(OP_PREFETCH)] = {
376 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
377 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
378 },
379},
380};
381
382/* 74K core has completely different cache event map. */
383static const struct mips_perf_event mipsxx74Kcore_cache_map
384 [PERF_COUNT_HW_CACHE_MAX]
385 [PERF_COUNT_HW_CACHE_OP_MAX]
386 [PERF_COUNT_HW_CACHE_RESULT_MAX] = {
387[C(L1D)] = {
388 /*
389 * Like some other architectures (e.g. ARM), the performance
390 * counters don't differentiate between read and write
391 * accesses/misses, so this isn't strictly correct, but it's the
392 * best we can do. Writes and reads get combined.
393 */
394 [C(OP_READ)] = {
395 [C(RESULT_ACCESS)] = { 0x17, CNTR_ODD, T },
396 [C(RESULT_MISS)] = { 0x18, CNTR_ODD, T },
397 },
398 [C(OP_WRITE)] = {
399 [C(RESULT_ACCESS)] = { 0x17, CNTR_ODD, T },
400 [C(RESULT_MISS)] = { 0x18, CNTR_ODD, T },
401 },
402 [C(OP_PREFETCH)] = {
403 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
404 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
405 },
406},
407[C(L1I)] = {
408 [C(OP_READ)] = {
409 [C(RESULT_ACCESS)] = { 0x06, CNTR_EVEN, T },
410 [C(RESULT_MISS)] = { 0x06, CNTR_ODD, T },
411 },
412 [C(OP_WRITE)] = {
413 [C(RESULT_ACCESS)] = { 0x06, CNTR_EVEN, T },
414 [C(RESULT_MISS)] = { 0x06, CNTR_ODD, T },
415 },
416 [C(OP_PREFETCH)] = {
417 [C(RESULT_ACCESS)] = { 0x34, CNTR_EVEN, T },
418 /*
419 * Note that MIPS has only "hit" events countable for
420 * the prefetch operation.
421 */
422 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
423 },
424},
425[C(LL)] = {
426 [C(OP_READ)] = {
427 [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P },
428 [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN | CNTR_ODD, P },
429 },
430 [C(OP_WRITE)] = {
431 [C(RESULT_ACCESS)] = { 0x1c, CNTR_ODD, P },
432 [C(RESULT_MISS)] = { 0x1d, CNTR_EVEN | CNTR_ODD, P },
433 },
434 [C(OP_PREFETCH)] = {
435 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
436 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
437 },
438},
439[C(DTLB)] = {
440 /* 74K core does not have specific DTLB events. */
441 [C(OP_READ)] = {
442 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
443 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
444 },
445 [C(OP_WRITE)] = {
446 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
447 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
448 },
449 [C(OP_PREFETCH)] = {
450 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
451 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
452 },
453},
454[C(ITLB)] = {
455 [C(OP_READ)] = {
456 [C(RESULT_ACCESS)] = { 0x04, CNTR_EVEN, T },
457 [C(RESULT_MISS)] = { 0x04, CNTR_ODD, T },
458 },
459 [C(OP_WRITE)] = {
460 [C(RESULT_ACCESS)] = { 0x04, CNTR_EVEN, T },
461 [C(RESULT_MISS)] = { 0x04, CNTR_ODD, T },
462 },
463 [C(OP_PREFETCH)] = {
464 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
465 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
466 },
467},
468[C(BPU)] = {
469 /* Using the same code for *HW_BRANCH* */
470 [C(OP_READ)] = {
471 [C(RESULT_ACCESS)] = { 0x27, CNTR_EVEN, T },
472 [C(RESULT_MISS)] = { 0x27, CNTR_ODD, T },
473 },
474 [C(OP_WRITE)] = {
475 [C(RESULT_ACCESS)] = { 0x27, CNTR_EVEN, T },
476 [C(RESULT_MISS)] = { 0x27, CNTR_ODD, T },
477 },
478 [C(OP_PREFETCH)] = {
479 [C(RESULT_ACCESS)] = { UNSUPPORTED_PERF_EVENT_ID },
480 [C(RESULT_MISS)] = { UNSUPPORTED_PERF_EVENT_ID },
481 },
482},
483};
484
485#ifdef CONFIG_MIPS_MT_SMP
486static void
487check_and_calc_range(struct perf_event *event,
488 const struct mips_perf_event *pev)
489{
490 struct hw_perf_event *hwc = &event->hw;
491
492 if (event->cpu >= 0) {
493 if (pev->range > V) {
494 /*
495 * The user selected an event that is processor
496 * wide, while expecting it to be VPE wide.
497 */
498 hwc->config_base |= M_TC_EN_ALL;
499 } else {
500 /*
501 * FIXME: cpu_data[event->cpu].vpe_id reports 0
502 * for both CPUs.
503 */
504 hwc->config_base |= M_PERFCTL_VPEID(event->cpu);
505 hwc->config_base |= M_TC_EN_VPE;
506 }
507 } else
508 hwc->config_base |= M_TC_EN_ALL;
509}
510#else
511static void
512check_and_calc_range(struct perf_event *event,
513 const struct mips_perf_event *pev)
514{
515}
516#endif
517
518static int __hw_perf_event_init(struct perf_event *event)
519{
520 struct perf_event_attr *attr = &event->attr;
521 struct hw_perf_event *hwc = &event->hw;
522 const struct mips_perf_event *pev;
523 int err;
524
525 /* Returning MIPS event descriptor for generic perf event. */
526 if (PERF_TYPE_HARDWARE == event->attr.type) {
527 if (event->attr.config >= PERF_COUNT_HW_MAX)
528 return -EINVAL;
529 pev = mipspmu_map_general_event(event->attr.config);
530 } else if (PERF_TYPE_HW_CACHE == event->attr.type) {
531 pev = mipspmu_map_cache_event(event->attr.config);
532 } else if (PERF_TYPE_RAW == event->attr.type) {
533 /* We are working on the global raw event. */
534 mutex_lock(&raw_event_mutex);
535 pev = mipspmu->map_raw_event(event->attr.config);
536 } else {
537 /* The event type is not (yet) supported. */
538 return -EOPNOTSUPP;
539 }
540
541 if (IS_ERR(pev)) {
542 if (PERF_TYPE_RAW == event->attr.type)
543 mutex_unlock(&raw_event_mutex);
544 return PTR_ERR(pev);
545 }
546
547 /*
548 * We allow max flexibility on how each individual counter shared
549 * by the single CPU operates (the mode exclusion and the range).
550 */
551 hwc->config_base = M_PERFCTL_INTERRUPT_ENABLE;
552
553 /* Calculate range bits and validate it. */
554 if (num_possible_cpus() > 1)
555 check_and_calc_range(event, pev);
556
557 hwc->event_base = mipspmu_perf_event_encode(pev);
558 if (PERF_TYPE_RAW == event->attr.type)
559 mutex_unlock(&raw_event_mutex);
560
561 if (!attr->exclude_user)
562 hwc->config_base |= M_PERFCTL_USER;
563 if (!attr->exclude_kernel) {
564 hwc->config_base |= M_PERFCTL_KERNEL;
565 /* MIPS kernel mode: KSU == 00b || EXL == 1 || ERL == 1 */
566 hwc->config_base |= M_PERFCTL_EXL;
567 }
568 if (!attr->exclude_hv)
569 hwc->config_base |= M_PERFCTL_SUPERVISOR;
570
571 hwc->config_base &= M_PERFCTL_CONFIG_MASK;
572 /*
573 * The event can belong to another cpu. We do not assign a local
574 * counter for it for now.
575 */
576 hwc->idx = -1;
577 hwc->config = 0;
578
579 if (!hwc->sample_period) {
580 hwc->sample_period = MAX_PERIOD;
581 hwc->last_period = hwc->sample_period;
582 local64_set(&hwc->period_left, hwc->sample_period);
583 }
584
585 err = 0;
586 if (event->group_leader != event) {
587 err = validate_group(event);
588 if (err)
589 return -EINVAL;
590 }
591
592 event->destroy = hw_perf_event_destroy;
593
594 return err;
595}
596
597static void pause_local_counters(void)
598{
599 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
600 int counters = mipspmu->num_counters;
601 unsigned long flags;
602
603 local_irq_save(flags);
604 switch (counters) {
605 case 4:
606 cpuc->saved_ctrl[3] = r_c0_perfctrl3();
607 w_c0_perfctrl3(cpuc->saved_ctrl[3] &
608 ~M_PERFCTL_COUNT_EVENT_WHENEVER);
609 case 3:
610 cpuc->saved_ctrl[2] = r_c0_perfctrl2();
611 w_c0_perfctrl2(cpuc->saved_ctrl[2] &
612 ~M_PERFCTL_COUNT_EVENT_WHENEVER);
613 case 2:
614 cpuc->saved_ctrl[1] = r_c0_perfctrl1();
615 w_c0_perfctrl1(cpuc->saved_ctrl[1] &
616 ~M_PERFCTL_COUNT_EVENT_WHENEVER);
617 case 1:
618 cpuc->saved_ctrl[0] = r_c0_perfctrl0();
619 w_c0_perfctrl0(cpuc->saved_ctrl[0] &
620 ~M_PERFCTL_COUNT_EVENT_WHENEVER);
621 }
622 local_irq_restore(flags);
623}
624
625static void resume_local_counters(void)
626{
627 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
628 int counters = mipspmu->num_counters;
629 unsigned long flags;
630
631 local_irq_save(flags);
632 switch (counters) {
633 case 4:
634 w_c0_perfctrl3(cpuc->saved_ctrl[3]);
635 case 3:
636 w_c0_perfctrl2(cpuc->saved_ctrl[2]);
637 case 2:
638 w_c0_perfctrl1(cpuc->saved_ctrl[1]);
639 case 1:
640 w_c0_perfctrl0(cpuc->saved_ctrl[0]);
641 }
642 local_irq_restore(flags);
643}
644
645static int mipsxx_pmu_handle_shared_irq(void)
646{
647 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
648 struct perf_sample_data data;
649 unsigned int counters = mipspmu->num_counters;
650 unsigned int counter;
651 int handled = IRQ_NONE;
652 struct pt_regs *regs;
653
654 if (cpu_has_mips_r2 && !(read_c0_cause() & (1 << 26)))
655 return handled;
656
657 /*
658 * First we pause the local counters, so that when we are locked
659 * here, the counters are all paused. When it gets locked due to
660 * perf_disable(), the timer interrupt handler will be delayed.
661 *
662 * See also mipsxx_pmu_start().
663 */
664 pause_local_counters();
665#ifdef CONFIG_MIPS_MT_SMP
666 read_lock(&pmuint_rwlock);
667#endif
668
669 regs = get_irq_regs();
670
671 perf_sample_data_init(&data, 0);
672
673 switch (counters) {
674#define HANDLE_COUNTER(n) \
675 case n + 1: \
676 if (test_bit(n, cpuc->used_mask)) { \
677 counter = r_c0_perfcntr ## n(); \
678 if (counter & M_COUNTER_OVERFLOW) { \
679 w_c0_perfcntr ## n(counter & \
680 VALID_COUNT); \
681 if (test_and_change_bit(n, cpuc->msbs)) \
682 handle_associated_event(cpuc, \
683 n, &data, regs); \
684 handled = IRQ_HANDLED; \
685 } \
686 }
687 HANDLE_COUNTER(3)
688 HANDLE_COUNTER(2)
689 HANDLE_COUNTER(1)
690 HANDLE_COUNTER(0)
691 }
692
693 /*
694 * Do all the work for the pending perf events. We can do this
695 * in here because the performance counter interrupt is a regular
696 * interrupt, not NMI.
697 */
698 if (handled == IRQ_HANDLED)
699 perf_event_do_pending();
700
701#ifdef CONFIG_MIPS_MT_SMP
702 read_unlock(&pmuint_rwlock);
703#endif
704 resume_local_counters();
705 return handled;
706}
707
708static irqreturn_t
709mipsxx_pmu_handle_irq(int irq, void *dev)
710{
711 return mipsxx_pmu_handle_shared_irq();
712}
713
714static void mipsxx_pmu_start(void)
715{
716#ifdef CONFIG_MIPS_MT_SMP
717 write_unlock(&pmuint_rwlock);
718#endif
719 resume_local_counters();
720}
721
722/*
723 * MIPS performance counters can be per-TC. The control registers can
724 * not be directly accessed accross CPUs. Hence if we want to do global
725 * control, we need cross CPU calls. on_each_cpu() can help us, but we
726 * can not make sure this function is called with interrupts enabled. So
727 * here we pause local counters and then grab a rwlock and leave the
728 * counters on other CPUs alone. If any counter interrupt raises while
729 * we own the write lock, simply pause local counters on that CPU and
730 * spin in the handler. Also we know we won't be switched to another
731 * CPU after pausing local counters and before grabbing the lock.
732 */
733static void mipsxx_pmu_stop(void)
734{
735 pause_local_counters();
736#ifdef CONFIG_MIPS_MT_SMP
737 write_lock(&pmuint_rwlock);
738#endif
739}
740
741static int
742mipsxx_pmu_alloc_counter(struct cpu_hw_events *cpuc,
743 struct hw_perf_event *hwc)
744{
745 int i;
746
747 /*
748 * We only need to care the counter mask. The range has been
749 * checked definitely.
750 */
751 unsigned long cntr_mask = (hwc->event_base >> 8) & 0xffff;
752
753 for (i = mipspmu->num_counters - 1; i >= 0; i--) {
754 /*
755 * Note that some MIPS perf events can be counted by both
756 * even and odd counters, wheresas many other are only by
757 * even _or_ odd counters. This introduces an issue that
758 * when the former kind of event takes the counter the
759 * latter kind of event wants to use, then the "counter
760 * allocation" for the latter event will fail. In fact if
761 * they can be dynamically swapped, they both feel happy.
762 * But here we leave this issue alone for now.
763 */
764 if (test_bit(i, &cntr_mask) &&
765 !test_and_set_bit(i, cpuc->used_mask))
766 return i;
767 }
768
769 return -EAGAIN;
770}
771
772static void
773mipsxx_pmu_enable_event(struct hw_perf_event *evt, int idx)
774{
775 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
776 unsigned long flags;
777
778 WARN_ON(idx < 0 || idx >= mipspmu->num_counters);
779
780 local_irq_save(flags);
781 cpuc->saved_ctrl[idx] = M_PERFCTL_EVENT(evt->event_base & 0xff) |
782 (evt->config_base & M_PERFCTL_CONFIG_MASK) |
783 /* Make sure interrupt enabled. */
784 M_PERFCTL_INTERRUPT_ENABLE;
785 /*
786 * We do not actually let the counter run. Leave it until start().
787 */
788 local_irq_restore(flags);
789}
790
791static void
792mipsxx_pmu_disable_event(int idx)
793{
794 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
795 unsigned long flags;
796
797 WARN_ON(idx < 0 || idx >= mipspmu->num_counters);
798
799 local_irq_save(flags);
800 cpuc->saved_ctrl[idx] = mipsxx_pmu_read_control(idx) &
801 ~M_PERFCTL_COUNT_EVENT_WHENEVER;
802 mipsxx_pmu_write_control(idx, cpuc->saved_ctrl[idx]);
803 local_irq_restore(flags);
804}
805
806/* 24K */
807#define IS_UNSUPPORTED_24K_EVENT(r, b) \
808 ((b) == 12 || (r) == 151 || (r) == 152 || (b) == 26 || \
809 (b) == 27 || (r) == 28 || (r) == 158 || (b) == 31 || \
810 (b) == 32 || (b) == 34 || (b) == 36 || (r) == 168 || \
811 (r) == 172 || (b) == 47 || ((b) >= 56 && (b) <= 63) || \
812 ((b) >= 68 && (b) <= 127))
813#define IS_BOTH_COUNTERS_24K_EVENT(b) \
814 ((b) == 0 || (b) == 1 || (b) == 11)
815
816/* 34K */
817#define IS_UNSUPPORTED_34K_EVENT(r, b) \
818 ((b) == 12 || (r) == 27 || (r) == 158 || (b) == 36 || \
819 (b) == 38 || (r) == 175 || ((b) >= 56 && (b) <= 63) || \
820 ((b) >= 68 && (b) <= 127))
821#define IS_BOTH_COUNTERS_34K_EVENT(b) \
822 ((b) == 0 || (b) == 1 || (b) == 11)
823#ifdef CONFIG_MIPS_MT_SMP
824#define IS_RANGE_P_34K_EVENT(r, b) \
825 ((b) == 0 || (r) == 18 || (b) == 21 || (b) == 22 || \
826 (b) == 25 || (b) == 39 || (r) == 44 || (r) == 174 || \
827 (r) == 176 || ((b) >= 50 && (b) <= 55) || \
828 ((b) >= 64 && (b) <= 67))
829#define IS_RANGE_V_34K_EVENT(r) ((r) == 47)
830#endif
831
832/* 74K */
833#define IS_UNSUPPORTED_74K_EVENT(r, b) \
834 ((r) == 5 || ((r) >= 135 && (r) <= 137) || \
835 ((b) >= 10 && (b) <= 12) || (b) == 22 || (b) == 27 || \
836 (b) == 33 || (b) == 34 || ((b) >= 47 && (b) <= 49) || \
837 (r) == 178 || (b) == 55 || (b) == 57 || (b) == 60 || \
838 (b) == 61 || (r) == 62 || (r) == 191 || \
839 ((b) >= 64 && (b) <= 127))
840#define IS_BOTH_COUNTERS_74K_EVENT(b) \
841 ((b) == 0 || (b) == 1)
842
843/* 1004K */
844#define IS_UNSUPPORTED_1004K_EVENT(r, b) \
845 ((b) == 12 || (r) == 27 || (r) == 158 || (b) == 38 || \
846 (r) == 175 || (b) == 63 || ((b) >= 68 && (b) <= 127))
847#define IS_BOTH_COUNTERS_1004K_EVENT(b) \
848 ((b) == 0 || (b) == 1 || (b) == 11)
849#ifdef CONFIG_MIPS_MT_SMP
850#define IS_RANGE_P_1004K_EVENT(r, b) \
851 ((b) == 0 || (r) == 18 || (b) == 21 || (b) == 22 || \
852 (b) == 25 || (b) == 36 || (b) == 39 || (r) == 44 || \
853 (r) == 174 || (r) == 176 || ((b) >= 50 && (b) <= 59) || \
854 (r) == 188 || (b) == 61 || (b) == 62 || \
855 ((b) >= 64 && (b) <= 67))
856#define IS_RANGE_V_1004K_EVENT(r) ((r) == 47)
857#endif
858
859/*
860 * User can use 0-255 raw events, where 0-127 for the events of even
861 * counters, and 128-255 for odd counters. Note that bit 7 is used to
862 * indicate the parity. So, for example, when user wants to take the
863 * Event Num of 15 for odd counters (by referring to the user manual),
864 * then 128 needs to be added to 15 as the input for the event config,
865 * i.e., 143 (0x8F) to be used.
866 */
867static const struct mips_perf_event *
868mipsxx_pmu_map_raw_event(u64 config)
869{
870 unsigned int raw_id = config & 0xff;
871 unsigned int base_id = raw_id & 0x7f;
872
873 switch (current_cpu_type()) {
874 case CPU_24K:
875 if (IS_UNSUPPORTED_24K_EVENT(raw_id, base_id))
876 return ERR_PTR(-EOPNOTSUPP);
877 raw_event.event_id = base_id;
878 if (IS_BOTH_COUNTERS_24K_EVENT(base_id))
879 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
880 else
881 raw_event.cntr_mask =
882 raw_id > 127 ? CNTR_ODD : CNTR_EVEN;
883#ifdef CONFIG_MIPS_MT_SMP
884 /*
885 * This is actually doing nothing. Non-multithreading
886 * CPUs will not check and calculate the range.
887 */
888 raw_event.range = P;
889#endif
890 break;
891 case CPU_34K:
892 if (IS_UNSUPPORTED_34K_EVENT(raw_id, base_id))
893 return ERR_PTR(-EOPNOTSUPP);
894 raw_event.event_id = base_id;
895 if (IS_BOTH_COUNTERS_34K_EVENT(base_id))
896 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
897 else
898 raw_event.cntr_mask =
899 raw_id > 127 ? CNTR_ODD : CNTR_EVEN;
900#ifdef CONFIG_MIPS_MT_SMP
901 if (IS_RANGE_P_34K_EVENT(raw_id, base_id))
902 raw_event.range = P;
903 else if (unlikely(IS_RANGE_V_34K_EVENT(raw_id)))
904 raw_event.range = V;
905 else
906 raw_event.range = T;
907#endif
908 break;
909 case CPU_74K:
910 if (IS_UNSUPPORTED_74K_EVENT(raw_id, base_id))
911 return ERR_PTR(-EOPNOTSUPP);
912 raw_event.event_id = base_id;
913 if (IS_BOTH_COUNTERS_74K_EVENT(base_id))
914 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
915 else
916 raw_event.cntr_mask =
917 raw_id > 127 ? CNTR_ODD : CNTR_EVEN;
918#ifdef CONFIG_MIPS_MT_SMP
919 raw_event.range = P;
920#endif
921 break;
922 case CPU_1004K:
923 if (IS_UNSUPPORTED_1004K_EVENT(raw_id, base_id))
924 return ERR_PTR(-EOPNOTSUPP);
925 raw_event.event_id = base_id;
926 if (IS_BOTH_COUNTERS_1004K_EVENT(base_id))
927 raw_event.cntr_mask = CNTR_EVEN | CNTR_ODD;
928 else
929 raw_event.cntr_mask =
930 raw_id > 127 ? CNTR_ODD : CNTR_EVEN;
931#ifdef CONFIG_MIPS_MT_SMP
932 if (IS_RANGE_P_1004K_EVENT(raw_id, base_id))
933 raw_event.range = P;
934 else if (unlikely(IS_RANGE_V_1004K_EVENT(raw_id)))
935 raw_event.range = V;
936 else
937 raw_event.range = T;
938#endif
939 break;
940 }
941
942 return &raw_event;
943}
944
945static struct mips_pmu mipsxxcore_pmu = {
946 .handle_irq = mipsxx_pmu_handle_irq,
947 .handle_shared_irq = mipsxx_pmu_handle_shared_irq,
948 .start = mipsxx_pmu_start,
949 .stop = mipsxx_pmu_stop,
950 .alloc_counter = mipsxx_pmu_alloc_counter,
951 .read_counter = mipsxx_pmu_read_counter,
952 .write_counter = mipsxx_pmu_write_counter,
953 .enable_event = mipsxx_pmu_enable_event,
954 .disable_event = mipsxx_pmu_disable_event,
955 .map_raw_event = mipsxx_pmu_map_raw_event,
956 .general_event_map = &mipsxxcore_event_map,
957 .cache_event_map = &mipsxxcore_cache_map,
958};
959
960static struct mips_pmu mipsxx74Kcore_pmu = {
961 .handle_irq = mipsxx_pmu_handle_irq,
962 .handle_shared_irq = mipsxx_pmu_handle_shared_irq,
963 .start = mipsxx_pmu_start,
964 .stop = mipsxx_pmu_stop,
965 .alloc_counter = mipsxx_pmu_alloc_counter,
966 .read_counter = mipsxx_pmu_read_counter,
967 .write_counter = mipsxx_pmu_write_counter,
968 .enable_event = mipsxx_pmu_enable_event,
969 .disable_event = mipsxx_pmu_disable_event,
970 .map_raw_event = mipsxx_pmu_map_raw_event,
971 .general_event_map = &mipsxx74Kcore_event_map,
972 .cache_event_map = &mipsxx74Kcore_cache_map,
973};
974
975static int __init
976init_hw_perf_events(void)
977{
978 int counters, irq;
979
980 pr_info("Performance counters: ");
981
982 counters = n_counters();
983 if (counters == 0) {
984 pr_cont("No available PMU.\n");
985 return -ENODEV;
986 }
987
988#ifdef CONFIG_MIPS_MT_SMP
989 cpu_has_mipsmt_pertccounters = read_c0_config7() & (1<<19);
990 if (!cpu_has_mipsmt_pertccounters)
991 counters = counters_total_to_per_cpu(counters);
992#endif
993
994#ifdef MSC01E_INT_BASE
995 if (cpu_has_veic) {
996 /*
997 * Using platform specific interrupt controller defines.
998 */
999 irq = MSC01E_INT_BASE + MSC01E_INT_PERFCTR;
1000 } else {
1001#endif
1002 if (cp0_perfcount_irq >= 0)
1003 irq = MIPS_CPU_IRQ_BASE + cp0_perfcount_irq;
1004 else
1005 irq = -1;
1006#ifdef MSC01E_INT_BASE
1007 }
1008#endif
1009
1010 on_each_cpu(reset_counters, (void *)(long)counters, 1);
1011
1012 switch (current_cpu_type()) {
1013 case CPU_24K:
1014 mipsxxcore_pmu.name = "mips/24K";
1015 mipsxxcore_pmu.num_counters = counters;
1016 mipsxxcore_pmu.irq = irq;
1017 mipspmu = &mipsxxcore_pmu;
1018 break;
1019 case CPU_34K:
1020 mipsxxcore_pmu.name = "mips/34K";
1021 mipsxxcore_pmu.num_counters = counters;
1022 mipsxxcore_pmu.irq = irq;
1023 mipspmu = &mipsxxcore_pmu;
1024 break;
1025 case CPU_74K:
1026 mipsxx74Kcore_pmu.name = "mips/74K";
1027 mipsxx74Kcore_pmu.num_counters = counters;
1028 mipsxx74Kcore_pmu.irq = irq;
1029 mipspmu = &mipsxx74Kcore_pmu;
1030 break;
1031 case CPU_1004K:
1032 mipsxxcore_pmu.name = "mips/1004K";
1033 mipsxxcore_pmu.num_counters = counters;
1034 mipsxxcore_pmu.irq = irq;
1035 mipspmu = &mipsxxcore_pmu;
1036 break;
1037 default:
1038 pr_cont("Either hardware does not support performance "
1039 "counters, or not yet implemented.\n");
1040 return -ENODEV;
1041 }
1042
1043 if (mipspmu)
1044 pr_cont("%s PMU enabled, %d counters available to each "
1045 "CPU, irq %d%s\n", mipspmu->name, counters, irq,
1046 irq < 0 ? " (share with timer interrupt)" : "");
1047
1048 return 0;
1049}
1050arch_initcall(init_hw_perf_events);
1051
1052#endif /* defined(CONFIG_CPU_MIPS32)... */
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index a6b900f2962b..acd3f2c49c06 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -490,6 +490,7 @@ static void __init arch_mem_init(char **cmdline_p)
490 bootmem_init(); 490 bootmem_init();
491 device_tree_init(); 491 device_tree_init();
492 sparse_init(); 492 sparse_init();
493 plat_swiotlb_setup();
493 paging_init(); 494 paging_init();
494} 495}
495 496
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index d053bf4759e4..8e9fbe75894e 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -29,6 +29,7 @@
29#include <linux/notifier.h> 29#include <linux/notifier.h>
30#include <linux/kdb.h> 30#include <linux/kdb.h>
31#include <linux/irq.h> 31#include <linux/irq.h>
32#include <linux/perf_event.h>
32 33
33#include <asm/bootinfo.h> 34#include <asm/bootinfo.h>
34#include <asm/branch.h> 35#include <asm/branch.h>
@@ -576,10 +577,16 @@ static inline int simulate_sc(struct pt_regs *regs, unsigned int opcode)
576 */ 577 */
577static int simulate_llsc(struct pt_regs *regs, unsigned int opcode) 578static int simulate_llsc(struct pt_regs *regs, unsigned int opcode)
578{ 579{
579 if ((opcode & OPCODE) == LL) 580 if ((opcode & OPCODE) == LL) {
581 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
582 1, 0, regs, 0);
580 return simulate_ll(regs, opcode); 583 return simulate_ll(regs, opcode);
581 if ((opcode & OPCODE) == SC) 584 }
585 if ((opcode & OPCODE) == SC) {
586 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
587 1, 0, regs, 0);
582 return simulate_sc(regs, opcode); 588 return simulate_sc(regs, opcode);
589 }
583 590
584 return -1; /* Must be something else ... */ 591 return -1; /* Must be something else ... */
585} 592}
@@ -595,6 +602,8 @@ static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode)
595 if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) { 602 if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) {
596 int rd = (opcode & RD) >> 11; 603 int rd = (opcode & RD) >> 11;
597 int rt = (opcode & RT) >> 16; 604 int rt = (opcode & RT) >> 16;
605 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
606 1, 0, regs, 0);
598 switch (rd) { 607 switch (rd) {
599 case 0: /* CPU number */ 608 case 0: /* CPU number */
600 regs->regs[rt] = smp_processor_id(); 609 regs->regs[rt] = smp_processor_id();
@@ -630,8 +639,11 @@ static int simulate_rdhwr(struct pt_regs *regs, unsigned int opcode)
630 639
631static int simulate_sync(struct pt_regs *regs, unsigned int opcode) 640static int simulate_sync(struct pt_regs *regs, unsigned int opcode)
632{ 641{
633 if ((opcode & OPCODE) == SPEC0 && (opcode & FUNC) == SYNC) 642 if ((opcode & OPCODE) == SPEC0 && (opcode & FUNC) == SYNC) {
643 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
644 1, 0, regs, 0);
634 return 0; 645 return 0;
646 }
635 647
636 return -1; /* Must be something else ... */ 648 return -1; /* Must be something else ... */
637} 649}
@@ -1469,6 +1481,7 @@ void __cpuinit per_cpu_trap_init(void)
1469{ 1481{
1470 unsigned int cpu = smp_processor_id(); 1482 unsigned int cpu = smp_processor_id();
1471 unsigned int status_set = ST0_CU0; 1483 unsigned int status_set = ST0_CU0;
1484 unsigned int hwrena = cpu_hwrena_impl_bits;
1472#ifdef CONFIG_MIPS_MT_SMTC 1485#ifdef CONFIG_MIPS_MT_SMTC
1473 int secondaryTC = 0; 1486 int secondaryTC = 0;
1474 int bootTC = (cpu == 0); 1487 int bootTC = (cpu == 0);
@@ -1501,14 +1514,14 @@ void __cpuinit per_cpu_trap_init(void)
1501 change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX, 1514 change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX,
1502 status_set); 1515 status_set);
1503 1516
1504 if (cpu_has_mips_r2) { 1517 if (cpu_has_mips_r2)
1505 unsigned int enable = 0x0000000f | cpu_hwrena_impl_bits; 1518 hwrena |= 0x0000000f;
1506 1519
1507 if (!noulri && cpu_has_userlocal) 1520 if (!noulri && cpu_has_userlocal)
1508 enable |= (1 << 29); 1521 hwrena |= (1 << 29);
1509 1522
1510 write_c0_hwrena(enable); 1523 if (hwrena)
1511 } 1524 write_c0_hwrena(hwrena);
1512 1525
1513#ifdef CONFIG_MIPS_MT_SMTC 1526#ifdef CONFIG_MIPS_MT_SMTC
1514 if (!secondaryTC) { 1527 if (!secondaryTC) {
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 33d5a5ce4a29..cfea1adfa153 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -78,6 +78,8 @@
78#include <linux/smp.h> 78#include <linux/smp.h>
79#include <linux/sched.h> 79#include <linux/sched.h>
80#include <linux/debugfs.h> 80#include <linux/debugfs.h>
81#include <linux/perf_event.h>
82
81#include <asm/asm.h> 83#include <asm/asm.h>
82#include <asm/branch.h> 84#include <asm/branch.h>
83#include <asm/byteorder.h> 85#include <asm/byteorder.h>
@@ -109,6 +111,9 @@ static void emulate_load_store_insn(struct pt_regs *regs,
109 unsigned long value; 111 unsigned long value;
110 unsigned int res; 112 unsigned int res;
111 113
114 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
115 1, 0, regs, 0);
116
112 /* 117 /*
113 * This load never faults. 118 * This load never faults.
114 */ 119 */
@@ -511,6 +516,8 @@ asmlinkage void do_ade(struct pt_regs *regs)
511 unsigned int __user *pc; 516 unsigned int __user *pc;
512 mm_segment_t seg; 517 mm_segment_t seg;
513 518
519 perf_sw_event(PERF_COUNT_SW_ALIGNMENT_FAULTS,
520 1, 0, regs, regs->cp0_badvaddr);
514 /* 521 /*
515 * Did we catch a fault trying to load an instruction? 522 * Did we catch a fault trying to load an instruction?
516 * Or are we running in MIPS16 mode? 523 * Or are we running in MIPS16 mode?
diff --git a/arch/mips/loongson/Kconfig b/arch/mips/loongson/Kconfig
index c97ca69b94e0..6e1b77fec7ea 100644
--- a/arch/mips/loongson/Kconfig
+++ b/arch/mips/loongson/Kconfig
@@ -20,7 +20,6 @@ config LEMOTE_FULOONG2E
20 select SYS_SUPPORTS_LITTLE_ENDIAN 20 select SYS_SUPPORTS_LITTLE_ENDIAN
21 select SYS_SUPPORTS_HIGHMEM 21 select SYS_SUPPORTS_HIGHMEM
22 select SYS_HAS_EARLY_PRINTK 22 select SYS_HAS_EARLY_PRINTK
23 select GENERIC_HARDIRQS_NO__DO_IRQ
24 select GENERIC_ISA_DMA_SUPPORT_BROKEN 23 select GENERIC_ISA_DMA_SUPPORT_BROKEN
25 select CPU_HAS_WB 24 select CPU_HAS_WB
26 select LOONGSON_MC146818 25 select LOONGSON_MC146818
@@ -40,7 +39,6 @@ config LEMOTE_MACH2F
40 select CS5536 39 select CS5536
41 select CSRC_R4K if ! MIPS_EXTERNAL_TIMER 40 select CSRC_R4K if ! MIPS_EXTERNAL_TIMER
42 select DMA_NONCOHERENT 41 select DMA_NONCOHERENT
43 select GENERIC_HARDIRQS_NO__DO_IRQ
44 select GENERIC_ISA_DMA_SUPPORT_BROKEN 42 select GENERIC_ISA_DMA_SUPPORT_BROKEN
45 select HW_HAS_PCI 43 select HW_HAS_PCI
46 select I8259 44 select I8259
diff --git a/arch/mips/math-emu/cp1emu.c b/arch/mips/math-emu/cp1emu.c
index ec3faa413f3b..b2ad1b0910ff 100644
--- a/arch/mips/math-emu/cp1emu.c
+++ b/arch/mips/math-emu/cp1emu.c
@@ -36,6 +36,7 @@
36#include <linux/sched.h> 36#include <linux/sched.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/debugfs.h> 38#include <linux/debugfs.h>
39#include <linux/perf_event.h>
39 40
40#include <asm/inst.h> 41#include <asm/inst.h>
41#include <asm/bootinfo.h> 42#include <asm/bootinfo.h>
@@ -258,6 +259,8 @@ static int cop1Emulate(struct pt_regs *xcp, struct mips_fpu_struct *ctx)
258 } 259 }
259 260
260 emul: 261 emul:
262 perf_sw_event(PERF_COUNT_SW_EMULATION_FAULTS,
263 1, 0, xcp, 0);
261 MIPS_FPU_EMU_INC_STATS(emulated); 264 MIPS_FPU_EMU_INC_STATS(emulated);
262 switch (MIPSInst_OPCODE(ir)) { 265 switch (MIPSInst_OPCODE(ir)) {
263 case ldc1_op:{ 266 case ldc1_op:{
diff --git a/arch/mips/mm/c-octeon.c b/arch/mips/mm/c-octeon.c
index 0f9c488044d1..16c4d256b76f 100644
--- a/arch/mips/mm/c-octeon.c
+++ b/arch/mips/mm/c-octeon.c
@@ -181,10 +181,10 @@ static void __cpuinit probe_octeon(void)
181 unsigned int config1; 181 unsigned int config1;
182 struct cpuinfo_mips *c = &current_cpu_data; 182 struct cpuinfo_mips *c = &current_cpu_data;
183 183
184 config1 = read_c0_config1();
184 switch (c->cputype) { 185 switch (c->cputype) {
185 case CPU_CAVIUM_OCTEON: 186 case CPU_CAVIUM_OCTEON:
186 case CPU_CAVIUM_OCTEON_PLUS: 187 case CPU_CAVIUM_OCTEON_PLUS:
187 config1 = read_c0_config1();
188 c->icache.linesz = 2 << ((config1 >> 19) & 7); 188 c->icache.linesz = 2 << ((config1 >> 19) & 7);
189 c->icache.sets = 64 << ((config1 >> 22) & 7); 189 c->icache.sets = 64 << ((config1 >> 22) & 7);
190 c->icache.ways = 1 + ((config1 >> 16) & 7); 190 c->icache.ways = 1 + ((config1 >> 16) & 7);
@@ -204,6 +204,20 @@ static void __cpuinit probe_octeon(void)
204 c->options |= MIPS_CPU_PREFETCH; 204 c->options |= MIPS_CPU_PREFETCH;
205 break; 205 break;
206 206
207 case CPU_CAVIUM_OCTEON2:
208 c->icache.linesz = 2 << ((config1 >> 19) & 7);
209 c->icache.sets = 8;
210 c->icache.ways = 37;
211 c->icache.flags |= MIPS_CACHE_VTAG;
212 icache_size = c->icache.sets * c->icache.ways * c->icache.linesz;
213
214 c->dcache.linesz = 128;
215 c->dcache.ways = 32;
216 c->dcache.sets = 8;
217 dcache_size = c->dcache.sets * c->dcache.ways * c->dcache.linesz;
218 c->options |= MIPS_CPU_PREFETCH;
219 break;
220
207 default: 221 default:
208 panic("Unsupported Cavium Networks CPU type\n"); 222 panic("Unsupported Cavium Networks CPU type\n");
209 break; 223 break;
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 6721ee2b1e8b..b4923a75cb4b 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -42,14 +42,14 @@
42 * o collapses to normal function call on UP kernels 42 * o collapses to normal function call on UP kernels
43 * o collapses to normal function call on systems with a single shared 43 * o collapses to normal function call on systems with a single shared
44 * primary cache. 44 * primary cache.
45 * o doesn't disable interrupts on the local CPU
45 */ 46 */
46static inline void r4k_on_each_cpu(void (*func) (void *info), void *info, 47static inline void r4k_on_each_cpu(void (*func) (void *info), void *info)
47 int wait)
48{ 48{
49 preempt_disable(); 49 preempt_disable();
50 50
51#if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC) 51#if !defined(CONFIG_MIPS_MT_SMP) && !defined(CONFIG_MIPS_MT_SMTC)
52 smp_call_function(func, info, wait); 52 smp_call_function(func, info, 1);
53#endif 53#endif
54 func(info); 54 func(info);
55 preempt_enable(); 55 preempt_enable();
@@ -363,7 +363,7 @@ static inline void local_r4k___flush_cache_all(void * args)
363 363
364static void r4k___flush_cache_all(void) 364static void r4k___flush_cache_all(void)
365{ 365{
366 r4k_on_each_cpu(local_r4k___flush_cache_all, NULL, 1); 366 r4k_on_each_cpu(local_r4k___flush_cache_all, NULL);
367} 367}
368 368
369static inline int has_valid_asid(const struct mm_struct *mm) 369static inline int has_valid_asid(const struct mm_struct *mm)
@@ -410,7 +410,7 @@ static void r4k_flush_cache_range(struct vm_area_struct *vma,
410 int exec = vma->vm_flags & VM_EXEC; 410 int exec = vma->vm_flags & VM_EXEC;
411 411
412 if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc)) 412 if (cpu_has_dc_aliases || (exec && !cpu_has_ic_fills_f_dc))
413 r4k_on_each_cpu(local_r4k_flush_cache_range, vma, 1); 413 r4k_on_each_cpu(local_r4k_flush_cache_range, vma);
414} 414}
415 415
416static inline void local_r4k_flush_cache_mm(void * args) 416static inline void local_r4k_flush_cache_mm(void * args)
@@ -442,7 +442,7 @@ static void r4k_flush_cache_mm(struct mm_struct *mm)
442 if (!cpu_has_dc_aliases) 442 if (!cpu_has_dc_aliases)
443 return; 443 return;
444 444
445 r4k_on_each_cpu(local_r4k_flush_cache_mm, mm, 1); 445 r4k_on_each_cpu(local_r4k_flush_cache_mm, mm);
446} 446}
447 447
448struct flush_cache_page_args { 448struct flush_cache_page_args {
@@ -534,7 +534,7 @@ static void r4k_flush_cache_page(struct vm_area_struct *vma,
534 args.addr = addr; 534 args.addr = addr;
535 args.pfn = pfn; 535 args.pfn = pfn;
536 536
537 r4k_on_each_cpu(local_r4k_flush_cache_page, &args, 1); 537 r4k_on_each_cpu(local_r4k_flush_cache_page, &args);
538} 538}
539 539
540static inline void local_r4k_flush_data_cache_page(void * addr) 540static inline void local_r4k_flush_data_cache_page(void * addr)
@@ -547,8 +547,7 @@ static void r4k_flush_data_cache_page(unsigned long addr)
547 if (in_atomic()) 547 if (in_atomic())
548 local_r4k_flush_data_cache_page((void *)addr); 548 local_r4k_flush_data_cache_page((void *)addr);
549 else 549 else
550 r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr, 550 r4k_on_each_cpu(local_r4k_flush_data_cache_page, (void *) addr);
551 1);
552} 551}
553 552
554struct flush_icache_range_args { 553struct flush_icache_range_args {
@@ -589,7 +588,7 @@ static void r4k_flush_icache_range(unsigned long start, unsigned long end)
589 args.start = start; 588 args.start = start;
590 args.end = end; 589 args.end = end;
591 590
592 r4k_on_each_cpu(local_r4k_flush_icache_range_ipi, &args, 1); 591 r4k_on_each_cpu(local_r4k_flush_icache_range_ipi, &args);
593 instruction_hazard(); 592 instruction_hazard();
594} 593}
595 594
@@ -710,7 +709,7 @@ static void local_r4k_flush_cache_sigtramp(void * arg)
710 709
711static void r4k_flush_cache_sigtramp(unsigned long addr) 710static void r4k_flush_cache_sigtramp(unsigned long addr)
712{ 711{
713 r4k_on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr, 1); 712 r4k_on_each_cpu(local_r4k_flush_cache_sigtramp, (void *) addr);
714} 713}
715 714
716static void r4k_flush_icache_all(void) 715static void r4k_flush_icache_all(void)
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index 469d4019f795..4fc1a0fbe007 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -95,10 +95,9 @@ void *dma_alloc_noncoherent(struct device *dev, size_t size,
95 95
96 return ret; 96 return ret;
97} 97}
98
99EXPORT_SYMBOL(dma_alloc_noncoherent); 98EXPORT_SYMBOL(dma_alloc_noncoherent);
100 99
101void *dma_alloc_coherent(struct device *dev, size_t size, 100static void *mips_dma_alloc_coherent(struct device *dev, size_t size,
102 dma_addr_t * dma_handle, gfp_t gfp) 101 dma_addr_t * dma_handle, gfp_t gfp)
103{ 102{
104 void *ret; 103 void *ret;
@@ -123,7 +122,6 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
123 return ret; 122 return ret;
124} 123}
125 124
126EXPORT_SYMBOL(dma_alloc_coherent);
127 125
128void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr, 126void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr,
129 dma_addr_t dma_handle) 127 dma_addr_t dma_handle)
@@ -131,10 +129,9 @@ void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr,
131 plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL); 129 plat_unmap_dma_mem(dev, dma_handle, size, DMA_BIDIRECTIONAL);
132 free_pages((unsigned long) vaddr, get_order(size)); 130 free_pages((unsigned long) vaddr, get_order(size));
133} 131}
134
135EXPORT_SYMBOL(dma_free_noncoherent); 132EXPORT_SYMBOL(dma_free_noncoherent);
136 133
137void dma_free_coherent(struct device *dev, size_t size, void *vaddr, 134static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
138 dma_addr_t dma_handle) 135 dma_addr_t dma_handle)
139{ 136{
140 unsigned long addr = (unsigned long) vaddr; 137 unsigned long addr = (unsigned long) vaddr;
@@ -151,8 +148,6 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
151 free_pages(addr, get_order(size)); 148 free_pages(addr, get_order(size));
152} 149}
153 150
154EXPORT_SYMBOL(dma_free_coherent);
155
156static inline void __dma_sync(unsigned long addr, size_t size, 151static inline void __dma_sync(unsigned long addr, size_t size,
157 enum dma_data_direction direction) 152 enum dma_data_direction direction)
158{ 153{
@@ -174,21 +169,8 @@ static inline void __dma_sync(unsigned long addr, size_t size,
174 } 169 }
175} 170}
176 171
177dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size, 172static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,
178 enum dma_data_direction direction) 173 size_t size, enum dma_data_direction direction, struct dma_attrs *attrs)
179{
180 unsigned long addr = (unsigned long) ptr;
181
182 if (!plat_device_is_coherent(dev))
183 __dma_sync(addr, size, direction);
184
185 return plat_map_dma_mem(dev, ptr, size);
186}
187
188EXPORT_SYMBOL(dma_map_single);
189
190void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
191 enum dma_data_direction direction)
192{ 174{
193 if (cpu_is_noncoherent_r10000(dev)) 175 if (cpu_is_noncoherent_r10000(dev))
194 __dma_sync(dma_addr_to_virt(dev, dma_addr), size, 176 __dma_sync(dma_addr_to_virt(dev, dma_addr), size,
@@ -197,15 +179,11 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
197 plat_unmap_dma_mem(dev, dma_addr, size, direction); 179 plat_unmap_dma_mem(dev, dma_addr, size, direction);
198} 180}
199 181
200EXPORT_SYMBOL(dma_unmap_single); 182static int mips_dma_map_sg(struct device *dev, struct scatterlist *sg,
201 183 int nents, enum dma_data_direction direction, struct dma_attrs *attrs)
202int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
203 enum dma_data_direction direction)
204{ 184{
205 int i; 185 int i;
206 186
207 BUG_ON(direction == DMA_NONE);
208
209 for (i = 0; i < nents; i++, sg++) { 187 for (i = 0; i < nents; i++, sg++) {
210 unsigned long addr; 188 unsigned long addr;
211 189
@@ -219,33 +197,27 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
219 return nents; 197 return nents;
220} 198}
221 199
222EXPORT_SYMBOL(dma_map_sg); 200static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page,
223 201 unsigned long offset, size_t size, enum dma_data_direction direction,
224dma_addr_t dma_map_page(struct device *dev, struct page *page, 202 struct dma_attrs *attrs)
225 unsigned long offset, size_t size, enum dma_data_direction direction)
226{ 203{
227 BUG_ON(direction == DMA_NONE); 204 unsigned long addr;
228 205
229 if (!plat_device_is_coherent(dev)) { 206 addr = (unsigned long) page_address(page) + offset;
230 unsigned long addr;
231 207
232 addr = (unsigned long) page_address(page) + offset; 208 if (!plat_device_is_coherent(dev))
233 __dma_sync(addr, size, direction); 209 __dma_sync(addr, size, direction);
234 }
235 210
236 return plat_map_dma_mem_page(dev, page) + offset; 211 return plat_map_dma_mem(dev, (void *)addr, size);
237} 212}
238 213
239EXPORT_SYMBOL(dma_map_page); 214static void mips_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
240 215 int nhwentries, enum dma_data_direction direction,
241void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 216 struct dma_attrs *attrs)
242 enum dma_data_direction direction)
243{ 217{
244 unsigned long addr; 218 unsigned long addr;
245 int i; 219 int i;
246 220
247 BUG_ON(direction == DMA_NONE);
248
249 for (i = 0; i < nhwentries; i++, sg++) { 221 for (i = 0; i < nhwentries; i++, sg++) {
250 if (!plat_device_is_coherent(dev) && 222 if (!plat_device_is_coherent(dev) &&
251 direction != DMA_TO_DEVICE) { 223 direction != DMA_TO_DEVICE) {
@@ -257,13 +229,9 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
257 } 229 }
258} 230}
259 231
260EXPORT_SYMBOL(dma_unmap_sg); 232static void mips_dma_sync_single_for_cpu(struct device *dev,
261 233 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
262void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
263 size_t size, enum dma_data_direction direction)
264{ 234{
265 BUG_ON(direction == DMA_NONE);
266
267 if (cpu_is_noncoherent_r10000(dev)) { 235 if (cpu_is_noncoherent_r10000(dev)) {
268 unsigned long addr; 236 unsigned long addr;
269 237
@@ -272,13 +240,9 @@ void dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
272 } 240 }
273} 241}
274 242
275EXPORT_SYMBOL(dma_sync_single_for_cpu); 243static void mips_dma_sync_single_for_device(struct device *dev,
276 244 dma_addr_t dma_handle, size_t size, enum dma_data_direction direction)
277void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
278 size_t size, enum dma_data_direction direction)
279{ 245{
280 BUG_ON(direction == DMA_NONE);
281
282 plat_extra_sync_for_device(dev); 246 plat_extra_sync_for_device(dev);
283 if (!plat_device_is_coherent(dev)) { 247 if (!plat_device_is_coherent(dev)) {
284 unsigned long addr; 248 unsigned long addr;
@@ -288,46 +252,11 @@ void dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
288 } 252 }
289} 253}
290 254
291EXPORT_SYMBOL(dma_sync_single_for_device); 255static void mips_dma_sync_sg_for_cpu(struct device *dev,
292 256 struct scatterlist *sg, int nelems, enum dma_data_direction direction)
293void dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
294 unsigned long offset, size_t size, enum dma_data_direction direction)
295{
296 BUG_ON(direction == DMA_NONE);
297
298 if (cpu_is_noncoherent_r10000(dev)) {
299 unsigned long addr;
300
301 addr = dma_addr_to_virt(dev, dma_handle);
302 __dma_sync(addr + offset, size, direction);
303 }
304}
305
306EXPORT_SYMBOL(dma_sync_single_range_for_cpu);
307
308void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
309 unsigned long offset, size_t size, enum dma_data_direction direction)
310{
311 BUG_ON(direction == DMA_NONE);
312
313 plat_extra_sync_for_device(dev);
314 if (!plat_device_is_coherent(dev)) {
315 unsigned long addr;
316
317 addr = dma_addr_to_virt(dev, dma_handle);
318 __dma_sync(addr + offset, size, direction);
319 }
320}
321
322EXPORT_SYMBOL(dma_sync_single_range_for_device);
323
324void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
325 enum dma_data_direction direction)
326{ 257{
327 int i; 258 int i;
328 259
329 BUG_ON(direction == DMA_NONE);
330
331 /* Make sure that gcc doesn't leave the empty loop body. */ 260 /* Make sure that gcc doesn't leave the empty loop body. */
332 for (i = 0; i < nelems; i++, sg++) { 261 for (i = 0; i < nelems; i++, sg++) {
333 if (cpu_is_noncoherent_r10000(dev)) 262 if (cpu_is_noncoherent_r10000(dev))
@@ -336,15 +265,11 @@ void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
336 } 265 }
337} 266}
338 267
339EXPORT_SYMBOL(dma_sync_sg_for_cpu); 268static void mips_dma_sync_sg_for_device(struct device *dev,
340 269 struct scatterlist *sg, int nelems, enum dma_data_direction direction)
341void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
342 enum dma_data_direction direction)
343{ 270{
344 int i; 271 int i;
345 272
346 BUG_ON(direction == DMA_NONE);
347
348 /* Make sure that gcc doesn't leave the empty loop body. */ 273 /* Make sure that gcc doesn't leave the empty loop body. */
349 for (i = 0; i < nelems; i++, sg++) { 274 for (i = 0; i < nelems; i++, sg++) {
350 if (!plat_device_is_coherent(dev)) 275 if (!plat_device_is_coherent(dev))
@@ -353,24 +278,18 @@ void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nele
353 } 278 }
354} 279}
355 280
356EXPORT_SYMBOL(dma_sync_sg_for_device); 281int mips_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
357
358int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
359{ 282{
360 return plat_dma_mapping_error(dev, dma_addr); 283 return plat_dma_mapping_error(dev, dma_addr);
361} 284}
362 285
363EXPORT_SYMBOL(dma_mapping_error); 286int mips_dma_supported(struct device *dev, u64 mask)
364
365int dma_supported(struct device *dev, u64 mask)
366{ 287{
367 return plat_dma_supported(dev, mask); 288 return plat_dma_supported(dev, mask);
368} 289}
369 290
370EXPORT_SYMBOL(dma_supported); 291void mips_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
371 292 enum dma_data_direction direction)
372void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
373 enum dma_data_direction direction)
374{ 293{
375 BUG_ON(direction == DMA_NONE); 294 BUG_ON(direction == DMA_NONE);
376 295
@@ -379,4 +298,30 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
379 __dma_sync((unsigned long)vaddr, size, direction); 298 __dma_sync((unsigned long)vaddr, size, direction);
380} 299}
381 300
382EXPORT_SYMBOL(dma_cache_sync); 301static struct dma_map_ops mips_default_dma_map_ops = {
302 .alloc_coherent = mips_dma_alloc_coherent,
303 .free_coherent = mips_dma_free_coherent,
304 .map_page = mips_dma_map_page,
305 .unmap_page = mips_dma_unmap_page,
306 .map_sg = mips_dma_map_sg,
307 .unmap_sg = mips_dma_unmap_sg,
308 .sync_single_for_cpu = mips_dma_sync_single_for_cpu,
309 .sync_single_for_device = mips_dma_sync_single_for_device,
310 .sync_sg_for_cpu = mips_dma_sync_sg_for_cpu,
311 .sync_sg_for_device = mips_dma_sync_sg_for_device,
312 .mapping_error = mips_dma_mapping_error,
313 .dma_supported = mips_dma_supported
314};
315
316struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
317EXPORT_SYMBOL(mips_dma_map_ops);
318
319#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
320
321static int __init mips_dma_init(void)
322{
323 dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
324
325 return 0;
326}
327fs_initcall(mips_dma_init);
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index 783ad0065fdf..137ee76a0045 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -18,6 +18,7 @@
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/kprobes.h> 20#include <linux/kprobes.h>
21#include <linux/perf_event.h>
21 22
22#include <asm/branch.h> 23#include <asm/branch.h>
23#include <asm/mmu_context.h> 24#include <asm/mmu_context.h>
@@ -144,6 +145,7 @@ good_area:
144 * the fault. 145 * the fault.
145 */ 146 */
146 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0); 147 fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);
148 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
147 if (unlikely(fault & VM_FAULT_ERROR)) { 149 if (unlikely(fault & VM_FAULT_ERROR)) {
148 if (fault & VM_FAULT_OOM) 150 if (fault & VM_FAULT_OOM)
149 goto out_of_memory; 151 goto out_of_memory;
@@ -151,10 +153,15 @@ good_area:
151 goto do_sigbus; 153 goto do_sigbus;
152 BUG(); 154 BUG();
153 } 155 }
154 if (fault & VM_FAULT_MAJOR) 156 if (fault & VM_FAULT_MAJOR) {
157 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ,
158 1, 0, regs, address);
155 tsk->maj_flt++; 159 tsk->maj_flt++;
156 else 160 } else {
161 perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN,
162 1, 0, regs, address);
157 tsk->min_flt++; 163 tsk->min_flt++;
164 }
158 165
159 up_read(&mm->mmap_sem); 166 up_read(&mm->mmap_sem);
160 return; 167 return;
diff --git a/arch/mips/mm/sc-mips.c b/arch/mips/mm/sc-mips.c
index 5ab5fa8c1d82..505fecad4684 100644
--- a/arch/mips/mm/sc-mips.c
+++ b/arch/mips/mm/sc-mips.c
@@ -57,6 +57,34 @@ static struct bcache_ops mips_sc_ops = {
57 .bc_inv = mips_sc_inv 57 .bc_inv = mips_sc_inv
58}; 58};
59 59
60/*
61 * Check if the L2 cache controller is activated on a particular platform.
62 * MTI's L2 controller and the L2 cache controller of Broadcom's BMIPS
63 * cores both use c0_config2's bit 12 as "L2 Bypass" bit, that is the
64 * cache being disabled. However there is no guarantee for this to be
65 * true on all platforms. In an act of stupidity the spec defined bits
66 * 12..15 as implementation defined so below function will eventually have
67 * to be replaced by a platform specific probe.
68 */
69static inline int mips_sc_is_activated(struct cpuinfo_mips *c)
70{
71 /* Check the bypass bit (L2B) */
72 switch (c->cputype) {
73 case CPU_34K:
74 case CPU_74K:
75 case CPU_1004K:
76 case CPU_BMIPS5000:
77 if (config2 & (1 << 12))
78 return 0;
79 }
80
81 tmp = (config2 >> 4) & 0x0f;
82 if (0 < tmp && tmp <= 7)
83 c->scache.linesz = 2 << tmp;
84 else
85 return 0;
86}
87
60static inline int __init mips_sc_probe(void) 88static inline int __init mips_sc_probe(void)
61{ 89{
62 struct cpuinfo_mips *c = &current_cpu_data; 90 struct cpuinfo_mips *c = &current_cpu_data;
@@ -79,10 +107,8 @@ static inline int __init mips_sc_probe(void)
79 return 0; 107 return 0;
80 108
81 config2 = read_c0_config2(); 109 config2 = read_c0_config2();
82 tmp = (config2 >> 4) & 0x0f; 110
83 if (0 < tmp && tmp <= 7) 111 if (!mips_sc_is_activated(c))
84 c->scache.linesz = 2 << tmp;
85 else
86 return 0; 112 return 0;
87 113
88 tmp = (config2 >> 8) & 0x0f; 114 tmp = (config2 >> 8) & 0x0f;
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 4510e61883eb..93816f3bca67 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -338,13 +338,12 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
338 case CPU_4KSC: 338 case CPU_4KSC:
339 case CPU_20KC: 339 case CPU_20KC:
340 case CPU_25KF: 340 case CPU_25KF:
341 case CPU_BCM3302: 341 case CPU_BMIPS32:
342 case CPU_BCM4710: 342 case CPU_BMIPS3300:
343 case CPU_BMIPS4350:
344 case CPU_BMIPS4380:
345 case CPU_BMIPS5000:
343 case CPU_LOONGSON2: 346 case CPU_LOONGSON2:
344 case CPU_BCM6338:
345 case CPU_BCM6345:
346 case CPU_BCM6348:
347 case CPU_BCM6358:
348 case CPU_R5500: 347 case CPU_R5500:
349 if (m4kc_tlbp_war()) 348 if (m4kc_tlbp_war())
350 uasm_i_nop(p); 349 uasm_i_nop(p);
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c
index d2647a4e012b..23afdebc8e5c 100644
--- a/arch/mips/mm/uasm.c
+++ b/arch/mips/mm/uasm.c
@@ -405,7 +405,6 @@ I_u1u2u3(_mfc0)
405I_u1u2u3(_mtc0) 405I_u1u2u3(_mtc0)
406I_u2u1u3(_ori) 406I_u2u1u3(_ori)
407I_u3u1u2(_or) 407I_u3u1u2(_or)
408I_u2s3u1(_pref)
409I_0(_rfe) 408I_0(_rfe)
410I_u2s3u1(_sc) 409I_u2s3u1(_sc)
411I_u2s3u1(_scd) 410I_u2s3u1(_scd)
@@ -427,6 +426,25 @@ I_u1(_syscall);
427I_u1u2s3(_bbit0); 426I_u1u2s3(_bbit0);
428I_u1u2s3(_bbit1); 427I_u1u2s3(_bbit1);
429 428
429#ifdef CONFIG_CPU_CAVIUM_OCTEON
430#include <asm/octeon/octeon.h>
431void __uasminit uasm_i_pref(u32 **buf, unsigned int a, signed int b,
432 unsigned int c)
433{
434 if (OCTEON_IS_MODEL(OCTEON_CN63XX_PASS1_X) && a <= 24 && a != 5)
435 /*
436 * As per erratum Core-14449, replace prefetches 0-4,
437 * 6-24 with 'pref 28'.
438 */
439 build_insn(buf, insn_pref, c, 28, b);
440 else
441 build_insn(buf, insn_pref, c, a, b);
442}
443UASM_EXPORT_SYMBOL(uasm_i_pref);
444#else
445I_u2s3u1(_pref)
446#endif
447
430/* Handle labels. */ 448/* Handle labels. */
431void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid) 449void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid)
432{ 450{
diff --git a/arch/mips/pci/pci-octeon.c b/arch/mips/pci/pci-octeon.c
index d248b707eff3..2d74fc9ae3ba 100644
--- a/arch/mips/pci/pci-octeon.c
+++ b/arch/mips/pci/pci-octeon.c
@@ -11,6 +11,7 @@
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/swiotlb.h>
14 15
15#include <asm/time.h> 16#include <asm/time.h>
16 17
@@ -19,6 +20,8 @@
19#include <asm/octeon/cvmx-pci-defs.h> 20#include <asm/octeon/cvmx-pci-defs.h>
20#include <asm/octeon/pci-octeon.h> 21#include <asm/octeon/pci-octeon.h>
21 22
23#include <dma-coherence.h>
24
22#define USE_OCTEON_INTERNAL_ARBITER 25#define USE_OCTEON_INTERNAL_ARBITER
23 26
24/* 27/*
@@ -32,6 +35,8 @@
32/* Octeon't PCI controller uses did=3, subdid=3 for PCI memory. */ 35/* Octeon't PCI controller uses did=3, subdid=3 for PCI memory. */
33#define OCTEON_PCI_MEMSPACE_OFFSET (0x00011b0000000000ull) 36#define OCTEON_PCI_MEMSPACE_OFFSET (0x00011b0000000000ull)
34 37
38u64 octeon_bar1_pci_phys;
39
35/** 40/**
36 * This is the bit decoding used for the Octeon PCI controller addresses 41 * This is the bit decoding used for the Octeon PCI controller addresses
37 */ 42 */
@@ -170,6 +175,8 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
170 pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, dconfig); 175 pci_write_config_dword(dev, pos + PCI_ERR_ROOT_STATUS, dconfig);
171 } 176 }
172 177
178 dev->dev.archdata.dma_ops = octeon_pci_dma_map_ops;
179
173 return 0; 180 return 0;
174} 181}
175 182
@@ -618,12 +625,10 @@ static int __init octeon_pci_setup(void)
618 * before the readl()'s below. We don't want BAR2 overlapping 625 * before the readl()'s below. We don't want BAR2 overlapping
619 * with BAR0/BAR1 during these reads. 626 * with BAR0/BAR1 during these reads.
620 */ 627 */
621 octeon_npi_write32(CVMX_NPI_PCI_CFG08, 0); 628 octeon_npi_write32(CVMX_NPI_PCI_CFG08,
622 octeon_npi_write32(CVMX_NPI_PCI_CFG09, 0x80); 629 (u32)(OCTEON_BAR2_PCI_ADDRESS & 0xffffffffull));
623 630 octeon_npi_write32(CVMX_NPI_PCI_CFG09,
624 /* Disable the BAR1 movable mappings */ 631 (u32)(OCTEON_BAR2_PCI_ADDRESS >> 32));
625 for (index = 0; index < 32; index++)
626 octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index), 0);
627 632
628 if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_BIG) { 633 if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_BIG) {
629 /* Remap the Octeon BAR 0 to 0-2GB */ 634 /* Remap the Octeon BAR 0 to 0-2GB */
@@ -637,6 +642,25 @@ static int __init octeon_pci_setup(void)
637 octeon_npi_write32(CVMX_NPI_PCI_CFG06, 2ul << 30); 642 octeon_npi_write32(CVMX_NPI_PCI_CFG06, 2ul << 30);
638 octeon_npi_write32(CVMX_NPI_PCI_CFG07, 0); 643 octeon_npi_write32(CVMX_NPI_PCI_CFG07, 0);
639 644
645 /* BAR1 movable mappings set for identity mapping */
646 octeon_bar1_pci_phys = 0x80000000ull;
647 for (index = 0; index < 32; index++) {
648 union cvmx_pci_bar1_indexx bar1_index;
649
650 bar1_index.u32 = 0;
651 /* Address bits[35:22] sent to L2C */
652 bar1_index.s.addr_idx =
653 (octeon_bar1_pci_phys >> 22) + index;
654 /* Don't put PCI accesses in L2. */
655 bar1_index.s.ca = 1;
656 /* Endian Swap Mode */
657 bar1_index.s.end_swp = 1;
658 /* Set '1' when the selected address range is valid. */
659 bar1_index.s.addr_v = 1;
660 octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index),
661 bar1_index.u32);
662 }
663
640 /* Devices go after BAR1 */ 664 /* Devices go after BAR1 */
641 octeon_pci_mem_resource.start = 665 octeon_pci_mem_resource.start =
642 OCTEON_PCI_MEMSPACE_OFFSET + (4ul << 30) - 666 OCTEON_PCI_MEMSPACE_OFFSET + (4ul << 30) -
@@ -652,6 +676,27 @@ static int __init octeon_pci_setup(void)
652 octeon_npi_write32(CVMX_NPI_PCI_CFG06, 0); 676 octeon_npi_write32(CVMX_NPI_PCI_CFG06, 0);
653 octeon_npi_write32(CVMX_NPI_PCI_CFG07, 0); 677 octeon_npi_write32(CVMX_NPI_PCI_CFG07, 0);
654 678
679 /* BAR1 movable regions contiguous to cover the swiotlb */
680 octeon_bar1_pci_phys =
681 virt_to_phys(octeon_swiotlb) & ~((1ull << 22) - 1);
682
683 for (index = 0; index < 32; index++) {
684 union cvmx_pci_bar1_indexx bar1_index;
685
686 bar1_index.u32 = 0;
687 /* Address bits[35:22] sent to L2C */
688 bar1_index.s.addr_idx =
689 (octeon_bar1_pci_phys >> 22) + index;
690 /* Don't put PCI accesses in L2. */
691 bar1_index.s.ca = 1;
692 /* Endian Swap Mode */
693 bar1_index.s.end_swp = 1;
694 /* Set '1' when the selected address range is valid. */
695 bar1_index.s.addr_v = 1;
696 octeon_npi_write32(CVMX_NPI_PCI_BAR1_INDEXX(index),
697 bar1_index.u32);
698 }
699
655 /* Devices go after BAR0 */ 700 /* Devices go after BAR0 */
656 octeon_pci_mem_resource.start = 701 octeon_pci_mem_resource.start =
657 OCTEON_PCI_MEMSPACE_OFFSET + (128ul << 20) + 702 OCTEON_PCI_MEMSPACE_OFFSET + (128ul << 20) +
@@ -667,6 +712,9 @@ static int __init octeon_pci_setup(void)
667 * was setup properly. 712 * was setup properly.
668 */ 713 */
669 cvmx_write_csr(CVMX_NPI_PCI_INT_SUM2, -1); 714 cvmx_write_csr(CVMX_NPI_PCI_INT_SUM2, -1);
715
716 octeon_pci_dma_init();
717
670 return 0; 718 return 0;
671} 719}
672 720
diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
index 861361e0c9af..385f035b24e4 100644
--- a/arch/mips/pci/pcie-octeon.c
+++ b/arch/mips/pci/pcie-octeon.c
@@ -75,6 +75,8 @@ union cvmx_pcie_address {
75 } mem; 75 } mem;
76}; 76};
77 77
78#include <dma-coherence.h>
79
78/** 80/**
79 * Return the Core virtual base address for PCIe IO access. IOs are 81 * Return the Core virtual base address for PCIe IO access. IOs are
80 * read/written as an offset from this address. 82 * read/written as an offset from this address.
@@ -1391,6 +1393,9 @@ static int __init octeon_pcie_setup(void)
1391 cvmx_pcie_get_io_size(1) - 1; 1393 cvmx_pcie_get_io_size(1) - 1;
1392 register_pci_controller(&octeon_pcie1_controller); 1394 register_pci_controller(&octeon_pcie1_controller);
1393 } 1395 }
1396
1397 octeon_pci_dma_init();
1398
1394 return 0; 1399 return 0;
1395} 1400}
1396 1401
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 365766a3d536..41ba38513c89 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "Linux Kernel Configuration"
7
8config MN10300 1config MN10300
9 def_bool y 2 def_bool y
10 select HAVE_OPROFILE 3 select HAVE_OPROFILE
@@ -93,8 +86,6 @@ config GENERIC_HARDIRQS
93config HOTPLUG_CPU 86config HOTPLUG_CPU
94 def_bool n 87 def_bool n
95 88
96mainmenu "Panasonic MN10300/AM33 Kernel Configuration"
97
98source "init/Kconfig" 89source "init/Kconfig"
99 90
100source "kernel/Kconfig.freezer" 91source "kernel/Kconfig.freezer"
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 79a04a9394d5..0888675c98dd 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "Linux/PA-RISC Kernel Configuration"
7
8config PARISC 1config PARISC
9 def_bool y 2 def_bool y
10 select HAVE_IDE 3 select HAVE_IDE
@@ -19,6 +12,7 @@ config PARISC
19 select HAVE_IRQ_WORK 12 select HAVE_IRQ_WORK
20 select HAVE_PERF_EVENTS 13 select HAVE_PERF_EVENTS
21 select GENERIC_ATOMIC64 if !64BIT 14 select GENERIC_ATOMIC64 if !64BIT
15 select GENERIC_HARDIRQS_NO__DO_IRQ
22 help 16 help
23 The PA-RISC microprocessor is designed by Hewlett-Packard and used 17 The PA-RISC microprocessor is designed by Hewlett-Packard and used
24 in many of their workstations & servers (HP9000 700 and 800 series, 18 in many of their workstations & servers (HP9000 700 and 800 series,
@@ -85,6 +79,9 @@ config IRQ_PER_CPU
85 bool 79 bool
86 default y 80 default y
87 81
82config GENERIC_HARDIRQS_NO__DO_IRQ
83 def_bool y
84
88# unless you want to implement ACPI on PA-RISC ... ;-) 85# unless you want to implement ACPI on PA-RISC ... ;-)
89config PM 86config PM
90 bool 87 bool
diff --git a/arch/parisc/include/asm/cache.h b/arch/parisc/include/asm/cache.h
index 039880e7d2c9..47f11c707b65 100644
--- a/arch/parisc/include/asm/cache.h
+++ b/arch/parisc/include/asm/cache.h
@@ -24,8 +24,6 @@
24 24
25#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
26 26
27#define L1_CACHE_ALIGN(x) (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
28
29#define SMP_CACHE_BYTES L1_CACHE_BYTES 27#define SMP_CACHE_BYTES L1_CACHE_BYTES
30 28
31#define ARCH_DMA_MINALIGN L1_CACHE_BYTES 29#define ARCH_DMA_MINALIGN L1_CACHE_BYTES
diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index dba11aedce1b..f388a85bba11 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -126,20 +126,20 @@ static inline void *kmap(struct page *page)
126 126
127#define kunmap(page) kunmap_parisc(page_address(page)) 127#define kunmap(page) kunmap_parisc(page_address(page))
128 128
129static inline void *kmap_atomic(struct page *page, enum km_type idx) 129static inline void *__kmap_atomic(struct page *page)
130{ 130{
131 pagefault_disable(); 131 pagefault_disable();
132 return page_address(page); 132 return page_address(page);
133} 133}
134 134
135static inline void kunmap_atomic_notypecheck(void *addr, enum km_type idx) 135static inline void __kunmap_atomic(void *addr)
136{ 136{
137 kunmap_parisc(addr); 137 kunmap_parisc(addr);
138 pagefault_enable(); 138 pagefault_enable();
139} 139}
140 140
141#define kmap_atomic_prot(page, idx, prot) kmap_atomic(page, idx) 141#define kmap_atomic_prot(page, prot) kmap_atomic(page)
142#define kmap_atomic_pfn(pfn, idx) kmap_atomic(pfn_to_page(pfn), (idx)) 142#define kmap_atomic_pfn(pfn) kmap_atomic(pfn_to_page(pfn))
143#define kmap_atomic_to_page(ptr) virt_to_page(ptr) 143#define kmap_atomic_to_page(ptr) virt_to_page(ptr)
144#endif 144#endif
145 145
diff --git a/arch/parisc/include/asm/irq.h b/arch/parisc/include/asm/irq.h
index dfa26b67f919..c67dccf2e31f 100644
--- a/arch/parisc/include/asm/irq.h
+++ b/arch/parisc/include/asm/irq.h
@@ -40,7 +40,7 @@ struct irq_chip;
40void no_ack_irq(unsigned int irq); 40void no_ack_irq(unsigned int irq);
41void no_end_irq(unsigned int irq); 41void no_end_irq(unsigned int irq);
42void cpu_ack_irq(unsigned int irq); 42void cpu_ack_irq(unsigned int irq);
43void cpu_end_irq(unsigned int irq); 43void cpu_eoi_irq(unsigned int irq);
44 44
45extern int txn_alloc_irq(unsigned int nbits); 45extern int txn_alloc_irq(unsigned int nbits);
46extern int txn_claim_irq(int); 46extern int txn_claim_irq(int);
diff --git a/arch/parisc/include/asm/unistd.h b/arch/parisc/include/asm/unistd.h
index 1ce7d2851d90..3eb82c2a5ec3 100644
--- a/arch/parisc/include/asm/unistd.h
+++ b/arch/parisc/include/asm/unistd.h
@@ -813,8 +813,9 @@
813#define __NR_perf_event_open (__NR_Linux + 318) 813#define __NR_perf_event_open (__NR_Linux + 318)
814#define __NR_recvmmsg (__NR_Linux + 319) 814#define __NR_recvmmsg (__NR_Linux + 319)
815#define __NR_accept4 (__NR_Linux + 320) 815#define __NR_accept4 (__NR_Linux + 320)
816#define __NR_prlimit64 (__NR_Linux + 321)
816 817
817#define __NR_Linux_syscalls (__NR_accept4 + 1) 818#define __NR_Linux_syscalls (__NR_prlimit64 + 1)
818 819
819 820
820#define __IGNORE_select /* newselect */ 821#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/irq.c b/arch/parisc/kernel/irq.c
index efbcee5d2220..5024f643b3b1 100644
--- a/arch/parisc/kernel/irq.c
+++ b/arch/parisc/kernel/irq.c
@@ -52,7 +52,7 @@ static volatile unsigned long cpu_eiem = 0;
52*/ 52*/
53static DEFINE_PER_CPU(unsigned long, local_ack_eiem) = ~0UL; 53static DEFINE_PER_CPU(unsigned long, local_ack_eiem) = ~0UL;
54 54
55static void cpu_disable_irq(unsigned int irq) 55static void cpu_mask_irq(unsigned int irq)
56{ 56{
57 unsigned long eirr_bit = EIEM_MASK(irq); 57 unsigned long eirr_bit = EIEM_MASK(irq);
58 58
@@ -63,7 +63,7 @@ static void cpu_disable_irq(unsigned int irq)
63 * then gets disabled */ 63 * then gets disabled */
64} 64}
65 65
66static void cpu_enable_irq(unsigned int irq) 66static void cpu_unmask_irq(unsigned int irq)
67{ 67{
68 unsigned long eirr_bit = EIEM_MASK(irq); 68 unsigned long eirr_bit = EIEM_MASK(irq);
69 69
@@ -75,12 +75,6 @@ static void cpu_enable_irq(unsigned int irq)
75 smp_send_all_nop(); 75 smp_send_all_nop();
76} 76}
77 77
78static unsigned int cpu_startup_irq(unsigned int irq)
79{
80 cpu_enable_irq(irq);
81 return 0;
82}
83
84void no_ack_irq(unsigned int irq) { } 78void no_ack_irq(unsigned int irq) { }
85void no_end_irq(unsigned int irq) { } 79void no_end_irq(unsigned int irq) { }
86 80
@@ -99,7 +93,7 @@ void cpu_ack_irq(unsigned int irq)
99 mtctl(mask, 23); 93 mtctl(mask, 23);
100} 94}
101 95
102void cpu_end_irq(unsigned int irq) 96void cpu_eoi_irq(unsigned int irq)
103{ 97{
104 unsigned long mask = EIEM_MASK(irq); 98 unsigned long mask = EIEM_MASK(irq);
105 int cpu = smp_processor_id(); 99 int cpu = smp_processor_id();
@@ -146,12 +140,10 @@ static int cpu_set_affinity_irq(unsigned int irq, const struct cpumask *dest)
146 140
147static struct irq_chip cpu_interrupt_type = { 141static struct irq_chip cpu_interrupt_type = {
148 .name = "CPU", 142 .name = "CPU",
149 .startup = cpu_startup_irq, 143 .mask = cpu_mask_irq,
150 .shutdown = cpu_disable_irq, 144 .unmask = cpu_unmask_irq,
151 .enable = cpu_enable_irq,
152 .disable = cpu_disable_irq,
153 .ack = cpu_ack_irq, 145 .ack = cpu_ack_irq,
154 .end = cpu_end_irq, 146 .eoi = cpu_eoi_irq,
155#ifdef CONFIG_SMP 147#ifdef CONFIG_SMP
156 .set_affinity = cpu_set_affinity_irq, 148 .set_affinity = cpu_set_affinity_irq,
157#endif 149#endif
@@ -247,10 +239,11 @@ int cpu_claim_irq(unsigned int irq, struct irq_chip *type, void *data)
247 if (irq_desc[irq].chip != &cpu_interrupt_type) 239 if (irq_desc[irq].chip != &cpu_interrupt_type)
248 return -EBUSY; 240 return -EBUSY;
249 241
242 /* for iosapic interrupts */
250 if (type) { 243 if (type) {
251 irq_desc[irq].chip = type; 244 set_irq_chip_and_handler(irq, type, handle_level_irq);
252 irq_desc[irq].chip_data = data; 245 set_irq_chip_data(irq, data);
253 cpu_interrupt_type.enable(irq); 246 cpu_unmask_irq(irq);
254 } 247 }
255 return 0; 248 return 0;
256} 249}
@@ -368,7 +361,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)
368 goto set_out; 361 goto set_out;
369 } 362 }
370#endif 363#endif
371 __do_IRQ(irq); 364 generic_handle_irq(irq);
372 365
373 out: 366 out:
374 irq_exit(); 367 irq_exit();
@@ -398,14 +391,15 @@ static void claim_cpu_irqs(void)
398{ 391{
399 int i; 392 int i;
400 for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) { 393 for (i = CPU_IRQ_BASE; i <= CPU_IRQ_MAX; i++) {
401 irq_desc[i].chip = &cpu_interrupt_type; 394 set_irq_chip_and_handler(i, &cpu_interrupt_type,
395 handle_level_irq);
402 } 396 }
403 397
404 irq_desc[TIMER_IRQ].action = &timer_action; 398 set_irq_handler(TIMER_IRQ, handle_percpu_irq);
405 irq_desc[TIMER_IRQ].status = IRQ_PER_CPU; 399 setup_irq(TIMER_IRQ, &timer_action);
406#ifdef CONFIG_SMP 400#ifdef CONFIG_SMP
407 irq_desc[IPI_IRQ].action = &ipi_action; 401 set_irq_handler(IPI_IRQ, handle_percpu_irq);
408 irq_desc[IPI_IRQ].status = IRQ_PER_CPU; 402 setup_irq(IPI_IRQ, &ipi_action);
409#endif 403#endif
410} 404}
411 405
@@ -423,3 +417,4 @@ void __init init_IRQ(void)
423 set_eiem(cpu_eiem); /* EIEM : enable all external intr */ 417 set_eiem(cpu_eiem); /* EIEM : enable all external intr */
424 418
425} 419}
420
diff --git a/arch/parisc/kernel/pdc_cons.c b/arch/parisc/kernel/pdc_cons.c
index 1ff366cb9685..66d1f17fdb94 100644
--- a/arch/parisc/kernel/pdc_cons.c
+++ b/arch/parisc/kernel/pdc_cons.c
@@ -12,6 +12,7 @@
12 * Copyright (C) 2001 Helge Deller <deller at parisc-linux.org> 12 * Copyright (C) 2001 Helge Deller <deller at parisc-linux.org>
13 * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org> 13 * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org>
14 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> 14 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
15 * Copyright (C) 2010 Guy Martin <gmsoft at tuxicoman.be>
15 * 16 *
16 * 17 *
17 * This program is free software; you can redistribute it and/or modify 18 * This program is free software; you can redistribute it and/or modify
@@ -31,12 +32,11 @@
31 32
32/* 33/*
33 * The PDC console is a simple console, which can be used for debugging 34 * The PDC console is a simple console, which can be used for debugging
34 * boot related problems on HP PA-RISC machines. 35 * boot related problems on HP PA-RISC machines. It is also useful when no
36 * other console works.
35 * 37 *
36 * This code uses the ROM (=PDC) based functions to read and write characters 38 * This code uses the ROM (=PDC) based functions to read and write characters
37 * from and to PDC's boot path. 39 * from and to PDC's boot path.
38 * Since all character read from that path must be polled, this code never
39 * can or will be a fully functional linux console.
40 */ 40 */
41 41
42/* Define EARLY_BOOTUP_DEBUG to debug kernel related boot problems. 42/* Define EARLY_BOOTUP_DEBUG to debug kernel related boot problems.
@@ -53,6 +53,7 @@
53#include <asm/pdc.h> /* for iodc_call() proto and friends */ 53#include <asm/pdc.h> /* for iodc_call() proto and friends */
54 54
55static DEFINE_SPINLOCK(pdc_console_lock); 55static DEFINE_SPINLOCK(pdc_console_lock);
56static struct console pdc_cons;
56 57
57static void pdc_console_write(struct console *co, const char *s, unsigned count) 58static void pdc_console_write(struct console *co, const char *s, unsigned count)
58{ 59{
@@ -85,12 +86,138 @@ static int pdc_console_setup(struct console *co, char *options)
85 86
86#if defined(CONFIG_PDC_CONSOLE) 87#if defined(CONFIG_PDC_CONSOLE)
87#include <linux/vt_kern.h> 88#include <linux/vt_kern.h>
89#include <linux/tty_flip.h>
90
91#define PDC_CONS_POLL_DELAY (30 * HZ / 1000)
92
93static struct timer_list pdc_console_timer;
94
95extern struct console * console_drivers;
96
97static int pdc_console_tty_open(struct tty_struct *tty, struct file *filp)
98{
99
100 mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);
101
102 return 0;
103}
104
105static void pdc_console_tty_close(struct tty_struct *tty, struct file *filp)
106{
107 if (!tty->count)
108 del_timer(&pdc_console_timer);
109}
110
111static int pdc_console_tty_write(struct tty_struct *tty, const unsigned char *buf, int count)
112{
113 pdc_console_write(NULL, buf, count);
114 return count;
115}
116
117static int pdc_console_tty_write_room(struct tty_struct *tty)
118{
119 return 32768; /* no limit, no buffer used */
120}
121
122static int pdc_console_tty_chars_in_buffer(struct tty_struct *tty)
123{
124 return 0; /* no buffer */
125}
126
127static struct tty_driver *pdc_console_tty_driver;
128
129static const struct tty_operations pdc_console_tty_ops = {
130 .open = pdc_console_tty_open,
131 .close = pdc_console_tty_close,
132 .write = pdc_console_tty_write,
133 .write_room = pdc_console_tty_write_room,
134 .chars_in_buffer = pdc_console_tty_chars_in_buffer,
135};
136
137static void pdc_console_poll(unsigned long unused)
138{
139
140 int data, count = 0;
141
142 struct tty_struct *tty = pdc_console_tty_driver->ttys[0];
143
144 if (!tty)
145 return;
146
147 while (1) {
148 data = pdc_console_poll_key(NULL);
149 if (data == -1)
150 break;
151 tty_insert_flip_char(tty, data & 0xFF, TTY_NORMAL);
152 count ++;
153 }
154
155 if (count)
156 tty_flip_buffer_push(tty);
157
158 if (tty->count && (pdc_cons.flags & CON_ENABLED))
159 mod_timer(&pdc_console_timer, jiffies + PDC_CONS_POLL_DELAY);
160}
161
162static int __init pdc_console_tty_driver_init(void)
163{
164
165 int err;
166 struct tty_driver *drv;
167
168 /* Check if the console driver is still registered.
169 * It is unregistered if the pdc console was not selected as the
170 * primary console. */
171
172 struct console *tmp = console_drivers;
173
174 for (tmp = console_drivers; tmp; tmp = tmp->next)
175 if (tmp == &pdc_cons)
176 break;
177
178 if (!tmp) {
179 printk(KERN_INFO "PDC console driver not registered anymore, not creating %s\n", pdc_cons.name);
180 return -ENODEV;
181 }
182
183 printk(KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n");
184 pdc_cons.flags &= ~CON_BOOT;
185
186 drv = alloc_tty_driver(1);
187
188 if (!drv)
189 return -ENOMEM;
190
191 drv->driver_name = "pdc_cons";
192 drv->name = "ttyB";
193 drv->major = MUX_MAJOR;
194 drv->minor_start = 0;
195 drv->type = TTY_DRIVER_TYPE_SYSTEM;
196 drv->init_termios = tty_std_termios;
197 drv->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_RESET_TERMIOS;
198 tty_set_operations(drv, &pdc_console_tty_ops);
199
200 err = tty_register_driver(drv);
201 if (err) {
202 printk(KERN_ERR "Unable to register the PDC console TTY driver\n");
203 return err;
204 }
205
206 pdc_console_tty_driver = drv;
207
208 /* No need to initialize the pdc_console_timer if tty isn't allocated */
209 init_timer(&pdc_console_timer);
210 pdc_console_timer.function = pdc_console_poll;
211
212 return 0;
213}
214
215module_init(pdc_console_tty_driver_init);
88 216
89static struct tty_driver * pdc_console_device (struct console *c, int *index) 217static struct tty_driver * pdc_console_device (struct console *c, int *index)
90{ 218{
91 extern struct tty_driver console_driver; 219 *index = c->index;
92 *index = c->index ? c->index-1 : fg_console; 220 return pdc_console_tty_driver;
93 return &console_driver;
94} 221}
95#else 222#else
96#define pdc_console_device NULL 223#define pdc_console_device NULL
@@ -101,7 +228,7 @@ static struct console pdc_cons = {
101 .write = pdc_console_write, 228 .write = pdc_console_write,
102 .device = pdc_console_device, 229 .device = pdc_console_device,
103 .setup = pdc_console_setup, 230 .setup = pdc_console_setup,
104 .flags = CON_BOOT | CON_PRINTBUFFER | CON_ENABLED, 231 .flags = CON_BOOT | CON_PRINTBUFFER,
105 .index = -1, 232 .index = -1,
106}; 233};
107 234
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 3d52c978738f..74867dfdabe5 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -419,6 +419,7 @@
419 ENTRY_SAME(perf_event_open) 419 ENTRY_SAME(perf_event_open)
420 ENTRY_COMP(recvmmsg) 420 ENTRY_COMP(recvmmsg)
421 ENTRY_SAME(accept4) /* 320 */ 421 ENTRY_SAME(accept4) /* 320 */
422 ENTRY_SAME(prlimit64)
422 423
423 /* Nothing yet */ 424 /* Nothing yet */
424 425
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index 92d977bb5ea8..234e3682cf09 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -619,15 +619,12 @@ void handle_unaligned(struct pt_regs *regs)
619 flop=1; 619 flop=1;
620 ret = emulate_std(regs, R2(regs->iir),1); 620 ret = emulate_std(regs, R2(regs->iir),1);
621 break; 621 break;
622
623#ifdef CONFIG_PA20
624 case OPCODE_LDD_L: 622 case OPCODE_LDD_L:
625 ret = emulate_ldd(regs, R2(regs->iir),0); 623 ret = emulate_ldd(regs, R2(regs->iir),0);
626 break; 624 break;
627 case OPCODE_STD_L: 625 case OPCODE_STD_L:
628 ret = emulate_std(regs, R2(regs->iir),0); 626 ret = emulate_std(regs, R2(regs->iir),0);
629 break; 627 break;
630#endif
631 } 628 }
632#endif 629#endif
633 switch (regs->iir & OPCODE3_MASK) 630 switch (regs->iir & OPCODE3_MASK)
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
index d58eac1a8288..76ed62ed785b 100644
--- a/arch/parisc/kernel/unwind.c
+++ b/arch/parisc/kernel/unwind.c
@@ -80,8 +80,11 @@ find_unwind_entry(unsigned long addr)
80 if (addr >= table->start && 80 if (addr >= table->start &&
81 addr <= table->end) 81 addr <= table->end)
82 e = find_unwind_entry_in_table(table, addr); 82 e = find_unwind_entry_in_table(table, addr);
83 if (e) 83 if (e) {
84 /* Move-to-front to exploit common traces */
85 list_move(&table->list, &unwind_tables);
84 break; 86 break;
87 }
85 } 88 }
86 89
87 return e; 90 return e;
diff --git a/arch/parisc/math-emu/Makefile b/arch/parisc/math-emu/Makefile
index 1f3f225897f5..0bd63b08a79a 100644
--- a/arch/parisc/math-emu/Makefile
+++ b/arch/parisc/math-emu/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# See arch/parisc/math-emu/README 5# See arch/parisc/math-emu/README
6EXTRA_CFLAGS += -Wno-parentheses -Wno-implicit-function-declaration \ 6ccflags-y := -Wno-parentheses -Wno-implicit-function-declaration \
7 -Wno-uninitialized -Wno-strict-prototypes -Wno-return-type \ 7 -Wno-uninitialized -Wno-strict-prototypes -Wno-return-type \
8 -Wno-implicit-int 8 -Wno-implicit-int
9 9
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 4b1e521d966f..b6447190e1a2 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -1,9 +1,3 @@
1# For a description of the syntax of this configuration file,
2# see Documentation/kbuild/kconfig-language.txt.
3#
4
5mainmenu "Linux/PowerPC Kernel Configuration"
6
7source "arch/powerpc/platforms/Kconfig.cputype" 1source "arch/powerpc/platforms/Kconfig.cputype"
8 2
9config PPC32 3config PPC32
@@ -688,9 +682,12 @@ config 4xx_SOC
688 bool 682 bool
689 683
690config FSL_LBC 684config FSL_LBC
691 bool 685 bool "Freescale Local Bus support"
686 depends on FSL_SOC
692 help 687 help
693 Freescale Localbus support 688 Enables reporting of errors from the Freescale local bus
689 controller. Also contains some common code used by
690 drivers for specific local bus peripherals.
694 691
695config FSL_GTM 692config FSL_GTM
696 bool 693 bool
diff --git a/arch/powerpc/include/asm/fsl_lbc.h b/arch/powerpc/include/asm/fsl_lbc.h
index 1b5a21041f9b..5c1bf3466749 100644
--- a/arch/powerpc/include/asm/fsl_lbc.h
+++ b/arch/powerpc/include/asm/fsl_lbc.h
@@ -1,9 +1,10 @@
1/* Freescale Local Bus Controller 1/* Freescale Local Bus Controller
2 * 2 *
3 * Copyright (c) 2006-2007 Freescale Semiconductor 3 * Copyright © 2006-2007, 2010 Freescale Semiconductor
4 * 4 *
5 * Authors: Nick Spence <nick.spence@freescale.com>, 5 * Authors: Nick Spence <nick.spence@freescale.com>,
6 * Scott Wood <scottwood@freescale.com> 6 * Scott Wood <scottwood@freescale.com>
7 * Jack Lan <jack.lan@freescale.com>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
@@ -26,6 +27,8 @@
26#include <linux/compiler.h> 27#include <linux/compiler.h>
27#include <linux/types.h> 28#include <linux/types.h>
28#include <linux/io.h> 29#include <linux/io.h>
30#include <linux/device.h>
31#include <linux/spinlock.h>
29 32
30struct fsl_lbc_bank { 33struct fsl_lbc_bank {
31 __be32 br; /**< Base Register */ 34 __be32 br; /**< Base Register */
@@ -125,13 +128,23 @@ struct fsl_lbc_regs {
125#define LTESR_ATMW 0x00800000 128#define LTESR_ATMW 0x00800000
126#define LTESR_ATMR 0x00400000 129#define LTESR_ATMR 0x00400000
127#define LTESR_CS 0x00080000 130#define LTESR_CS 0x00080000
131#define LTESR_UPM 0x00000002
128#define LTESR_CC 0x00000001 132#define LTESR_CC 0x00000001
129#define LTESR_NAND_MASK (LTESR_FCT | LTESR_PAR | LTESR_CC) 133#define LTESR_NAND_MASK (LTESR_FCT | LTESR_PAR | LTESR_CC)
134#define LTESR_MASK (LTESR_BM | LTESR_FCT | LTESR_PAR | LTESR_WP \
135 | LTESR_ATMW | LTESR_ATMR | LTESR_CS | LTESR_UPM \
136 | LTESR_CC)
137#define LTESR_CLEAR 0xFFFFFFFF
138#define LTECCR_CLEAR 0xFFFFFFFF
139#define LTESR_STATUS LTESR_MASK
140#define LTEIR_ENABLE LTESR_MASK
141#define LTEDR_ENABLE 0x00000000
130 __be32 ltedr; /**< Transfer Error Disable Register */ 142 __be32 ltedr; /**< Transfer Error Disable Register */
131 __be32 lteir; /**< Transfer Error Interrupt Register */ 143 __be32 lteir; /**< Transfer Error Interrupt Register */
132 __be32 lteatr; /**< Transfer Error Attributes Register */ 144 __be32 lteatr; /**< Transfer Error Attributes Register */
133 __be32 ltear; /**< Transfer Error Address Register */ 145 __be32 ltear; /**< Transfer Error Address Register */
134 u8 res6[0xC]; 146 __be32 lteccr; /**< Transfer Error ECC Register */
147 u8 res6[0x8];
135 __be32 lbcr; /**< Configuration Register */ 148 __be32 lbcr; /**< Configuration Register */
136#define LBCR_LDIS 0x80000000 149#define LBCR_LDIS 0x80000000
137#define LBCR_LDIS_SHIFT 31 150#define LBCR_LDIS_SHIFT 31
@@ -235,6 +248,7 @@ struct fsl_upm {
235 int width; 248 int width;
236}; 249};
237 250
251extern u32 fsl_lbc_addr(phys_addr_t addr_base);
238extern int fsl_lbc_find(phys_addr_t addr_base); 252extern int fsl_lbc_find(phys_addr_t addr_base);
239extern int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm); 253extern int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm);
240 254
@@ -265,7 +279,23 @@ static inline void fsl_upm_end_pattern(struct fsl_upm *upm)
265 cpu_relax(); 279 cpu_relax();
266} 280}
267 281
282/* overview of the fsl lbc controller */
283
284struct fsl_lbc_ctrl {
285 /* device info */
286 struct device *dev;
287 struct fsl_lbc_regs __iomem *regs;
288 int irq;
289 wait_queue_head_t irq_wait;
290 spinlock_t lock;
291 void *nand;
292
293 /* status read from LTESR by irq handler */
294 unsigned int irq_status;
295};
296
268extern int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, 297extern int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base,
269 u32 mar); 298 u32 mar);
299extern struct fsl_lbc_ctrl *fsl_lbc_ctrl_dev;
270 300
271#endif /* __ASM_FSL_LBC_H */ 301#endif /* __ASM_FSL_LBC_H */
diff --git a/arch/powerpc/include/asm/kgdb.h b/arch/powerpc/include/asm/kgdb.h
index edd217006d27..9db24e77b9f4 100644
--- a/arch/powerpc/include/asm/kgdb.h
+++ b/arch/powerpc/include/asm/kgdb.h
@@ -31,6 +31,7 @@ static inline void arch_kgdb_breakpoint(void)
31 asm(".long 0x7d821008"); /* twge r2, r2 */ 31 asm(".long 0x7d821008"); /* twge r2, r2 */
32} 32}
33#define CACHE_FLUSH_IS_SAFE 1 33#define CACHE_FLUSH_IS_SAFE 1
34#define DBG_MAX_REG_NUM 70
34 35
35/* The number bytes of registers we have to save depends on a few 36/* The number bytes of registers we have to save depends on a few
36 * things. For 64bit we default to not including vector registers and 37 * things. For 64bit we default to not including vector registers and
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 7f61a3ac787c..7a9db64f3f04 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -194,40 +194,6 @@ static int kgdb_dabr_match(struct pt_regs *regs)
194 ptr = (unsigned long *)ptr32; \ 194 ptr = (unsigned long *)ptr32; \
195 } while (0) 195 } while (0)
196 196
197
198void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
199{
200 unsigned long *ptr = gdb_regs;
201 int reg;
202
203 memset(gdb_regs, 0, NUMREGBYTES);
204
205 for (reg = 0; reg < 32; reg++)
206 PACK64(ptr, regs->gpr[reg]);
207
208#ifdef CONFIG_FSL_BOOKE
209#ifdef CONFIG_SPE
210 for (reg = 0; reg < 32; reg++)
211 PACK64(ptr, current->thread.evr[reg]);
212#else
213 ptr += 32;
214#endif
215#else
216 /* fp registers not used by kernel, leave zero */
217 ptr += 32 * 8 / sizeof(long);
218#endif
219
220 PACK64(ptr, regs->nip);
221 PACK64(ptr, regs->msr);
222 PACK32(ptr, regs->ccr);
223 PACK64(ptr, regs->link);
224 PACK64(ptr, regs->ctr);
225 PACK32(ptr, regs->xer);
226
227 BUG_ON((unsigned long)ptr >
228 (unsigned long)(((void *)gdb_regs) + NUMREGBYTES));
229}
230
231void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) 197void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
232{ 198{
233 struct pt_regs *regs = (struct pt_regs *)(p->thread.ksp + 199 struct pt_regs *regs = (struct pt_regs *)(p->thread.ksp +
@@ -271,44 +237,140 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
271 (unsigned long)(((void *)gdb_regs) + NUMREGBYTES)); 237 (unsigned long)(((void *)gdb_regs) + NUMREGBYTES));
272} 238}
273 239
274#define UNPACK64(dest, ptr) do { dest = *(ptr++); } while (0) 240#define GDB_SIZEOF_REG sizeof(unsigned long)
241#define GDB_SIZEOF_REG_U32 sizeof(u32)
275 242
276#define UNPACK32(dest, ptr) do { \ 243#ifdef CONFIG_FSL_BOOKE
277 u32 *ptr32; \ 244#define GDB_SIZEOF_FLOAT_REG sizeof(unsigned long)
278 ptr32 = (u32 *)ptr; \ 245#else
279 dest = *(ptr32++); \ 246#define GDB_SIZEOF_FLOAT_REG sizeof(u64)
280 ptr = (unsigned long *)ptr32; \ 247#endif
281 } while (0)
282 248
283void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) 249struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
284{ 250{
285 unsigned long *ptr = gdb_regs; 251 { "r0", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[0]) },
286 int reg; 252 { "r1", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[1]) },
287 253 { "r2", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[2]) },
288 for (reg = 0; reg < 32; reg++) 254 { "r3", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[3]) },
289 UNPACK64(regs->gpr[reg], ptr); 255 { "r4", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[4]) },
256 { "r5", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[5]) },
257 { "r6", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[6]) },
258 { "r7", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[7]) },
259 { "r8", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[8]) },
260 { "r9", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[9]) },
261 { "r10", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[10]) },
262 { "r11", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[11]) },
263 { "r12", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[12]) },
264 { "r13", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[13]) },
265 { "r14", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[14]) },
266 { "r15", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[15]) },
267 { "r16", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[16]) },
268 { "r17", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[17]) },
269 { "r18", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[18]) },
270 { "r19", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[19]) },
271 { "r20", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[20]) },
272 { "r21", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[21]) },
273 { "r22", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[22]) },
274 { "r23", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[23]) },
275 { "r24", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[24]) },
276 { "r25", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[25]) },
277 { "r26", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[26]) },
278 { "r27", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[27]) },
279 { "r28", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[28]) },
280 { "r29", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[29]) },
281 { "r30", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[30]) },
282 { "r31", GDB_SIZEOF_REG, offsetof(struct pt_regs, gpr[31]) },
283
284 { "f0", GDB_SIZEOF_FLOAT_REG, 0 },
285 { "f1", GDB_SIZEOF_FLOAT_REG, 1 },
286 { "f2", GDB_SIZEOF_FLOAT_REG, 2 },
287 { "f3", GDB_SIZEOF_FLOAT_REG, 3 },
288 { "f4", GDB_SIZEOF_FLOAT_REG, 4 },
289 { "f5", GDB_SIZEOF_FLOAT_REG, 5 },
290 { "f6", GDB_SIZEOF_FLOAT_REG, 6 },
291 { "f7", GDB_SIZEOF_FLOAT_REG, 7 },
292 { "f8", GDB_SIZEOF_FLOAT_REG, 8 },
293 { "f9", GDB_SIZEOF_FLOAT_REG, 9 },
294 { "f10", GDB_SIZEOF_FLOAT_REG, 10 },
295 { "f11", GDB_SIZEOF_FLOAT_REG, 11 },
296 { "f12", GDB_SIZEOF_FLOAT_REG, 12 },
297 { "f13", GDB_SIZEOF_FLOAT_REG, 13 },
298 { "f14", GDB_SIZEOF_FLOAT_REG, 14 },
299 { "f15", GDB_SIZEOF_FLOAT_REG, 15 },
300 { "f16", GDB_SIZEOF_FLOAT_REG, 16 },
301 { "f17", GDB_SIZEOF_FLOAT_REG, 17 },
302 { "f18", GDB_SIZEOF_FLOAT_REG, 18 },
303 { "f19", GDB_SIZEOF_FLOAT_REG, 19 },
304 { "f20", GDB_SIZEOF_FLOAT_REG, 20 },
305 { "f21", GDB_SIZEOF_FLOAT_REG, 21 },
306 { "f22", GDB_SIZEOF_FLOAT_REG, 22 },
307 { "f23", GDB_SIZEOF_FLOAT_REG, 23 },
308 { "f24", GDB_SIZEOF_FLOAT_REG, 24 },
309 { "f25", GDB_SIZEOF_FLOAT_REG, 25 },
310 { "f26", GDB_SIZEOF_FLOAT_REG, 26 },
311 { "f27", GDB_SIZEOF_FLOAT_REG, 27 },
312 { "f28", GDB_SIZEOF_FLOAT_REG, 28 },
313 { "f29", GDB_SIZEOF_FLOAT_REG, 29 },
314 { "f30", GDB_SIZEOF_FLOAT_REG, 30 },
315 { "f31", GDB_SIZEOF_FLOAT_REG, 31 },
316
317 { "pc", GDB_SIZEOF_REG, offsetof(struct pt_regs, nip) },
318 { "msr", GDB_SIZEOF_REG, offsetof(struct pt_regs, msr) },
319 { "cr", GDB_SIZEOF_REG_U32, offsetof(struct pt_regs, ccr) },
320 { "lr", GDB_SIZEOF_REG, offsetof(struct pt_regs, link) },
321 { "ctr", GDB_SIZEOF_REG_U32, offsetof(struct pt_regs, ctr) },
322 { "xer", GDB_SIZEOF_REG, offsetof(struct pt_regs, xer) },
323};
290 324
291#ifdef CONFIG_FSL_BOOKE 325char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
292#ifdef CONFIG_SPE 326{
293 for (reg = 0; reg < 32; reg++) 327 if (regno >= DBG_MAX_REG_NUM || regno < 0)
294 UNPACK64(current->thread.evr[reg], ptr); 328 return NULL;
329
330 if (regno < 32 || regno >= 64)
331 /* First 0 -> 31 gpr registers*/
332 /* pc, msr, ls... registers 64 -> 69 */
333 memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
334 dbg_reg_def[regno].size);
335
336 if (regno >= 32 && regno < 64) {
337 /* FP registers 32 -> 63 */
338#if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
339 if (current)
340 memcpy(mem, current->thread.evr[regno-32],
341 dbg_reg_def[regno].size);
295#else 342#else
296 ptr += 32; 343 /* fp registers not used by kernel, leave zero */
344 memset(mem, 0, dbg_reg_def[regno].size);
297#endif 345#endif
346 }
347
348 return dbg_reg_def[regno].name;
349}
350
351int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
352{
353 if (regno >= DBG_MAX_REG_NUM || regno < 0)
354 return -EINVAL;
355
356 if (regno < 32 || regno >= 64)
357 /* First 0 -> 31 gpr registers*/
358 /* pc, msr, ls... registers 64 -> 69 */
359 memcpy((void *)regs + dbg_reg_def[regno].offset, mem,
360 dbg_reg_def[regno].size);
361
362 if (regno >= 32 && regno < 64) {
363 /* FP registers 32 -> 63 */
364#if defined(CONFIG_FSL_BOOKE) && defined(CONFIG_SPE)
365 memcpy(current->thread.evr[regno-32], mem,
366 dbg_reg_def[regno].size);
298#else 367#else
299 /* fp registers not used by kernel, leave zero */ 368 /* fp registers not used by kernel, leave zero */
300 ptr += 32 * 8 / sizeof(int); 369 return 0;
301#endif 370#endif
371 }
302 372
303 UNPACK64(regs->nip, ptr); 373 return 0;
304 UNPACK64(regs->msr, ptr);
305 UNPACK32(regs->ccr, ptr);
306 UNPACK64(regs->link, ptr);
307 UNPACK64(regs->ctr, ptr);
308 UNPACK32(regs->xer, ptr);
309
310 BUG_ON((unsigned long)ptr >
311 (unsigned long)(((void *)gdb_regs) + NUMREGBYTES));
312} 374}
313 375
314void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc) 376void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long pc)
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 428d0e538aec..b06bdae04064 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -127,7 +127,7 @@ static void kvm_patch_ins_nop(u32 *inst)
127 127
128static void kvm_patch_ins_b(u32 *inst, int addr) 128static void kvm_patch_ins_b(u32 *inst, int addr)
129{ 129{
130#ifdef CONFIG_RELOCATABLE 130#if defined(CONFIG_RELOCATABLE) && defined(CONFIG_PPC_BOOK3S)
131 /* On relocatable kernels interrupts handlers and our code 131 /* On relocatable kernels interrupts handlers and our code
132 can be in different regions, so we don't patch them */ 132 can be in different regions, so we don't patch them */
133 133
diff --git a/arch/powerpc/kvm/booke_interrupts.S b/arch/powerpc/kvm/booke_interrupts.S
index 049846911ce4..1cc471faac2d 100644
--- a/arch/powerpc/kvm/booke_interrupts.S
+++ b/arch/powerpc/kvm/booke_interrupts.S
@@ -416,7 +416,7 @@ lightweight_exit:
416 lwz r3, VCPU_PC(r4) 416 lwz r3, VCPU_PC(r4)
417 mtsrr0 r3 417 mtsrr0 r3
418 lwz r3, VCPU_SHARED(r4) 418 lwz r3, VCPU_SHARED(r4)
419 lwz r3, VCPU_SHARED_MSR(r3) 419 lwz r3, (VCPU_SHARED_MSR + 4)(r3)
420 oris r3, r3, KVMPPC_MSR_MASK@h 420 oris r3, r3, KVMPPC_MSR_MASK@h
421 ori r3, r3, KVMPPC_MSR_MASK@l 421 ori r3, r3, KVMPPC_MSR_MASK@l
422 mtsrr1 r3 422 mtsrr1 r3
diff --git a/arch/powerpc/kvm/e500.c b/arch/powerpc/kvm/e500.c
index 71750f2dd5d3..e3768ee9b595 100644
--- a/arch/powerpc/kvm/e500.c
+++ b/arch/powerpc/kvm/e500.c
@@ -138,8 +138,8 @@ void kvmppc_core_vcpu_free(struct kvm_vcpu *vcpu)
138 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu); 138 struct kvmppc_vcpu_e500 *vcpu_e500 = to_e500(vcpu);
139 139
140 free_page((unsigned long)vcpu->arch.shared); 140 free_page((unsigned long)vcpu->arch.shared);
141 kvmppc_e500_tlb_uninit(vcpu_e500);
142 kvm_vcpu_uninit(vcpu); 141 kvm_vcpu_uninit(vcpu);
142 kvmppc_e500_tlb_uninit(vcpu_e500);
143 kmem_cache_free(kvm_vcpu_cache, vcpu_e500); 143 kmem_cache_free(kvm_vcpu_cache, vcpu_e500);
144} 144}
145 145
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 2f87a1627f6c..38f756f25053 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -617,6 +617,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
617 switch (ioctl) { 617 switch (ioctl) {
618 case KVM_PPC_GET_PVINFO: { 618 case KVM_PPC_GET_PVINFO: {
619 struct kvm_ppc_pvinfo pvinfo; 619 struct kvm_ppc_pvinfo pvinfo;
620 memset(&pvinfo, 0, sizeof(pvinfo));
620 r = kvm_vm_ioctl_get_pvinfo(&pvinfo); 621 r = kvm_vm_ioctl_get_pvinfo(&pvinfo);
621 if (copy_to_user(argp, &pvinfo, sizeof(pvinfo))) { 622 if (copy_to_user(argp, &pvinfo, sizeof(pvinfo))) {
622 r = -EFAULT; 623 r = -EFAULT;
diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
index 46fa04f12a9b..a021f5827a33 100644
--- a/arch/powerpc/kvm/timing.c
+++ b/arch/powerpc/kvm/timing.c
@@ -35,7 +35,6 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
35 int i; 35 int i;
36 36
37 /* pause guest execution to avoid concurrent updates */ 37 /* pause guest execution to avoid concurrent updates */
38 local_irq_disable();
39 mutex_lock(&vcpu->mutex); 38 mutex_lock(&vcpu->mutex);
40 39
41 vcpu->arch.last_exit_type = 0xDEAD; 40 vcpu->arch.last_exit_type = 0xDEAD;
@@ -51,7 +50,6 @@ void kvmppc_init_timing_stats(struct kvm_vcpu *vcpu)
51 vcpu->arch.timing_last_enter.tv64 = 0; 50 vcpu->arch.timing_last_enter.tv64 = 0;
52 51
53 mutex_unlock(&vcpu->mutex); 52 mutex_unlock(&vcpu->mutex);
54 local_irq_enable();
55} 53}
56 54
57static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type) 55static void add_exit_timing(struct kvm_vcpu *vcpu, u64 duration, int type)
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 5dec408d6703..3532b92de983 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -798,17 +798,17 @@ spufs_fill_super(struct super_block *sb, void *data, int silent)
798 return spufs_create_root(sb, data); 798 return spufs_create_root(sb, data);
799} 799}
800 800
801static int 801static struct dentry *
802spufs_get_sb(struct file_system_type *fstype, int flags, 802spufs_mount(struct file_system_type *fstype, int flags,
803 const char *name, void *data, struct vfsmount *mnt) 803 const char *name, void *data)
804{ 804{
805 return get_sb_single(fstype, flags, data, spufs_fill_super, mnt); 805 return mount_single(fstype, flags, data, spufs_fill_super);
806} 806}
807 807
808static struct file_system_type spufs_type = { 808static struct file_system_type spufs_type = {
809 .owner = THIS_MODULE, 809 .owner = THIS_MODULE,
810 .name = "spufs", 810 .name = "spufs",
811 .get_sb = spufs_get_sb, 811 .mount = spufs_mount,
812 .kill_sb = kill_litter_super, 812 .kill_sb = kill_litter_super,
813}; 813};
814 814
diff --git a/arch/powerpc/sysdev/fsl_lbc.c b/arch/powerpc/sysdev/fsl_lbc.c
index dceb8d1a843d..4fcb5a4e60dd 100644
--- a/arch/powerpc/sysdev/fsl_lbc.c
+++ b/arch/powerpc/sysdev/fsl_lbc.c
@@ -1,9 +1,12 @@
1/* 1/*
2 * Freescale LBC and UPM routines. 2 * Freescale LBC and UPM routines.
3 * 3 *
4 * Copyright (c) 2007-2008 MontaVista Software, Inc. 4 * Copyright © 2007-2008 MontaVista Software, Inc.
5 * Copyright © 2010 Freescale Semiconductor
5 * 6 *
6 * Author: Anton Vorontsov <avorontsov@ru.mvista.com> 7 * Author: Anton Vorontsov <avorontsov@ru.mvista.com>
8 * Author: Jack Lan <Jack.Lan@freescale.com>
9 * Author: Roy Zang <tie-fei.zang@freescale.com>
7 * 10 *
8 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
@@ -19,39 +22,37 @@
19#include <linux/types.h> 22#include <linux/types.h>
20#include <linux/io.h> 23#include <linux/io.h>
21#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/slab.h>
26#include <linux/platform_device.h>
27#include <linux/interrupt.h>
28#include <linux/mod_devicetable.h>
22#include <asm/prom.h> 29#include <asm/prom.h>
23#include <asm/fsl_lbc.h> 30#include <asm/fsl_lbc.h>
24 31
25static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock); 32static spinlock_t fsl_lbc_lock = __SPIN_LOCK_UNLOCKED(fsl_lbc_lock);
26static struct fsl_lbc_regs __iomem *fsl_lbc_regs; 33struct fsl_lbc_ctrl *fsl_lbc_ctrl_dev;
34EXPORT_SYMBOL(fsl_lbc_ctrl_dev);
27 35
28static char __initdata *compat_lbc[] = { 36/**
29 "fsl,pq2-localbus", 37 * fsl_lbc_addr - convert the base address
30 "fsl,pq2pro-localbus", 38 * @addr_base: base address of the memory bank
31 "fsl,pq3-localbus", 39 *
32 "fsl,elbc", 40 * This function converts a base address of lbc into the right format for the
33}; 41 * BR register. If the SOC has eLBC then it returns 32bit physical address
34 42 * else it convers a 34bit local bus physical address to correct format of
35static int __init fsl_lbc_init(void) 43 * 32bit address for BR register (Example: MPC8641).
44 */
45u32 fsl_lbc_addr(phys_addr_t addr_base)
36{ 46{
37 struct device_node *lbus; 47 struct device_node *np = fsl_lbc_ctrl_dev->dev->of_node;
38 int i; 48 u32 addr = addr_base & 0xffff8000;
39 49
40 for (i = 0; i < ARRAY_SIZE(compat_lbc); i++) { 50 if (of_device_is_compatible(np, "fsl,elbc"))
41 lbus = of_find_compatible_node(NULL, NULL, compat_lbc[i]); 51 return addr;
42 if (lbus)
43 goto found;
44 }
45 return -ENODEV;
46 52
47found: 53 return addr | ((addr_base & 0x300000000ull) >> 19);
48 fsl_lbc_regs = of_iomap(lbus, 0);
49 of_node_put(lbus);
50 if (!fsl_lbc_regs)
51 return -ENOMEM;
52 return 0;
53} 54}
54arch_initcall(fsl_lbc_init); 55EXPORT_SYMBOL(fsl_lbc_addr);
55 56
56/** 57/**
57 * fsl_lbc_find - find Localbus bank 58 * fsl_lbc_find - find Localbus bank
@@ -65,15 +66,17 @@ arch_initcall(fsl_lbc_init);
65int fsl_lbc_find(phys_addr_t addr_base) 66int fsl_lbc_find(phys_addr_t addr_base)
66{ 67{
67 int i; 68 int i;
69 struct fsl_lbc_regs __iomem *lbc;
68 70
69 if (!fsl_lbc_regs) 71 if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
70 return -ENODEV; 72 return -ENODEV;
71 73
72 for (i = 0; i < ARRAY_SIZE(fsl_lbc_regs->bank); i++) { 74 lbc = fsl_lbc_ctrl_dev->regs;
73 __be32 br = in_be32(&fsl_lbc_regs->bank[i].br); 75 for (i = 0; i < ARRAY_SIZE(lbc->bank); i++) {
74 __be32 or = in_be32(&fsl_lbc_regs->bank[i].or); 76 __be32 br = in_be32(&lbc->bank[i].br);
77 __be32 or = in_be32(&lbc->bank[i].or);
75 78
76 if (br & BR_V && (br & or & BR_BA) == addr_base) 79 if (br & BR_V && (br & or & BR_BA) == fsl_lbc_addr(addr_base))
77 return i; 80 return i;
78 } 81 }
79 82
@@ -94,22 +97,27 @@ int fsl_upm_find(phys_addr_t addr_base, struct fsl_upm *upm)
94{ 97{
95 int bank; 98 int bank;
96 __be32 br; 99 __be32 br;
100 struct fsl_lbc_regs __iomem *lbc;
97 101
98 bank = fsl_lbc_find(addr_base); 102 bank = fsl_lbc_find(addr_base);
99 if (bank < 0) 103 if (bank < 0)
100 return bank; 104 return bank;
101 105
102 br = in_be32(&fsl_lbc_regs->bank[bank].br); 106 if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
107 return -ENODEV;
108
109 lbc = fsl_lbc_ctrl_dev->regs;
110 br = in_be32(&lbc->bank[bank].br);
103 111
104 switch (br & BR_MSEL) { 112 switch (br & BR_MSEL) {
105 case BR_MS_UPMA: 113 case BR_MS_UPMA:
106 upm->mxmr = &fsl_lbc_regs->mamr; 114 upm->mxmr = &lbc->mamr;
107 break; 115 break;
108 case BR_MS_UPMB: 116 case BR_MS_UPMB:
109 upm->mxmr = &fsl_lbc_regs->mbmr; 117 upm->mxmr = &lbc->mbmr;
110 break; 118 break;
111 case BR_MS_UPMC: 119 case BR_MS_UPMC:
112 upm->mxmr = &fsl_lbc_regs->mcmr; 120 upm->mxmr = &lbc->mcmr;
113 break; 121 break;
114 default: 122 default:
115 return -EINVAL; 123 return -EINVAL;
@@ -148,9 +156,12 @@ int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar)
148 int ret = 0; 156 int ret = 0;
149 unsigned long flags; 157 unsigned long flags;
150 158
159 if (!fsl_lbc_ctrl_dev || !fsl_lbc_ctrl_dev->regs)
160 return -ENODEV;
161
151 spin_lock_irqsave(&fsl_lbc_lock, flags); 162 spin_lock_irqsave(&fsl_lbc_lock, flags);
152 163
153 out_be32(&fsl_lbc_regs->mar, mar); 164 out_be32(&fsl_lbc_ctrl_dev->regs->mar, mar);
154 165
155 switch (upm->width) { 166 switch (upm->width) {
156 case 8: 167 case 8:
@@ -172,3 +183,166 @@ int fsl_upm_run_pattern(struct fsl_upm *upm, void __iomem *io_base, u32 mar)
172 return ret; 183 return ret;
173} 184}
174EXPORT_SYMBOL(fsl_upm_run_pattern); 185EXPORT_SYMBOL(fsl_upm_run_pattern);
186
187static int __devinit fsl_lbc_ctrl_init(struct fsl_lbc_ctrl *ctrl)
188{
189 struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
190
191 /* clear event registers */
192 setbits32(&lbc->ltesr, LTESR_CLEAR);
193 out_be32(&lbc->lteatr, 0);
194 out_be32(&lbc->ltear, 0);
195 out_be32(&lbc->lteccr, LTECCR_CLEAR);
196 out_be32(&lbc->ltedr, LTEDR_ENABLE);
197
198 /* Enable interrupts for any detected events */
199 out_be32(&lbc->lteir, LTEIR_ENABLE);
200
201 return 0;
202}
203
204/*
205 * NOTE: This interrupt is used to report localbus events of various kinds,
206 * such as transaction errors on the chipselects.
207 */
208
209static irqreturn_t fsl_lbc_ctrl_irq(int irqno, void *data)
210{
211 struct fsl_lbc_ctrl *ctrl = data;
212 struct fsl_lbc_regs __iomem *lbc = ctrl->regs;
213 u32 status;
214
215 status = in_be32(&lbc->ltesr);
216 if (!status)
217 return IRQ_NONE;
218
219 out_be32(&lbc->ltesr, LTESR_CLEAR);
220 out_be32(&lbc->lteatr, 0);
221 out_be32(&lbc->ltear, 0);
222 ctrl->irq_status = status;
223
224 if (status & LTESR_BM)
225 dev_err(ctrl->dev, "Local bus monitor time-out: "
226 "LTESR 0x%08X\n", status);
227 if (status & LTESR_WP)
228 dev_err(ctrl->dev, "Write protect error: "
229 "LTESR 0x%08X\n", status);
230 if (status & LTESR_ATMW)
231 dev_err(ctrl->dev, "Atomic write error: "
232 "LTESR 0x%08X\n", status);
233 if (status & LTESR_ATMR)
234 dev_err(ctrl->dev, "Atomic read error: "
235 "LTESR 0x%08X\n", status);
236 if (status & LTESR_CS)
237 dev_err(ctrl->dev, "Chip select error: "
238 "LTESR 0x%08X\n", status);
239 if (status & LTESR_UPM)
240 ;
241 if (status & LTESR_FCT) {
242 dev_err(ctrl->dev, "FCM command time-out: "
243 "LTESR 0x%08X\n", status);
244 smp_wmb();
245 wake_up(&ctrl->irq_wait);
246 }
247 if (status & LTESR_PAR) {
248 dev_err(ctrl->dev, "Parity or Uncorrectable ECC error: "
249 "LTESR 0x%08X\n", status);
250 smp_wmb();
251 wake_up(&ctrl->irq_wait);
252 }
253 if (status & LTESR_CC) {
254 smp_wmb();
255 wake_up(&ctrl->irq_wait);
256 }
257 if (status & ~LTESR_MASK)
258 dev_err(ctrl->dev, "Unknown error: "
259 "LTESR 0x%08X\n", status);
260 return IRQ_HANDLED;
261}
262
263/*
264 * fsl_lbc_ctrl_probe
265 *
266 * called by device layer when it finds a device matching
267 * one our driver can handled. This code allocates all of
268 * the resources needed for the controller only. The
269 * resources for the NAND banks themselves are allocated
270 * in the chip probe function.
271*/
272
273static int __devinit fsl_lbc_ctrl_probe(struct platform_device *dev)
274{
275 int ret;
276
277 if (!dev->dev.of_node) {
278 dev_err(&dev->dev, "Device OF-Node is NULL");
279 return -EFAULT;
280 }
281
282 fsl_lbc_ctrl_dev = kzalloc(sizeof(*fsl_lbc_ctrl_dev), GFP_KERNEL);
283 if (!fsl_lbc_ctrl_dev)
284 return -ENOMEM;
285
286 dev_set_drvdata(&dev->dev, fsl_lbc_ctrl_dev);
287
288 spin_lock_init(&fsl_lbc_ctrl_dev->lock);
289 init_waitqueue_head(&fsl_lbc_ctrl_dev->irq_wait);
290
291 fsl_lbc_ctrl_dev->regs = of_iomap(dev->dev.of_node, 0);
292 if (!fsl_lbc_ctrl_dev->regs) {
293 dev_err(&dev->dev, "failed to get memory region\n");
294 ret = -ENODEV;
295 goto err;
296 }
297
298 fsl_lbc_ctrl_dev->irq = irq_of_parse_and_map(dev->dev.of_node, 0);
299 if (fsl_lbc_ctrl_dev->irq == NO_IRQ) {
300 dev_err(&dev->dev, "failed to get irq resource\n");
301 ret = -ENODEV;
302 goto err;
303 }
304
305 fsl_lbc_ctrl_dev->dev = &dev->dev;
306
307 ret = fsl_lbc_ctrl_init(fsl_lbc_ctrl_dev);
308 if (ret < 0)
309 goto err;
310
311 ret = request_irq(fsl_lbc_ctrl_dev->irq, fsl_lbc_ctrl_irq, 0,
312 "fsl-lbc", fsl_lbc_ctrl_dev);
313 if (ret != 0) {
314 dev_err(&dev->dev, "failed to install irq (%d)\n",
315 fsl_lbc_ctrl_dev->irq);
316 ret = fsl_lbc_ctrl_dev->irq;
317 goto err;
318 }
319
320 return 0;
321
322err:
323 iounmap(fsl_lbc_ctrl_dev->regs);
324 kfree(fsl_lbc_ctrl_dev);
325 return ret;
326}
327
328static const struct of_device_id fsl_lbc_match[] = {
329 { .compatible = "fsl,elbc", },
330 { .compatible = "fsl,pq3-localbus", },
331 { .compatible = "fsl,pq2-localbus", },
332 { .compatible = "fsl,pq2pro-localbus", },
333 {},
334};
335
336static struct platform_driver fsl_lbc_ctrl_driver = {
337 .driver = {
338 .name = "fsl-lbc",
339 .of_match_table = fsl_lbc_match,
340 },
341 .probe = fsl_lbc_ctrl_probe,
342};
343
344static int __init fsl_lbc_init(void)
345{
346 return platform_driver_register(&fsl_lbc_ctrl_driver);
347}
348module_init(fsl_lbc_init);
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 068e55d1bba8..e0b98e71ff47 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -1,8 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6config SCHED_MC 1config SCHED_MC
7 def_bool y 2 def_bool y
8 depends on SMP 3 depends on SMP
@@ -78,8 +73,6 @@ config VIRT_CPU_ACCOUNTING
78config ARCH_SUPPORTS_DEBUG_PAGEALLOC 73config ARCH_SUPPORTS_DEBUG_PAGEALLOC
79 def_bool y 74 def_bool y
80 75
81mainmenu "Linux Kernel Configuration"
82
83config S390 76config S390
84 def_bool y 77 def_bool y
85 select USE_GENERIC_SMP_HELPERS if SMP 78 select USE_GENERIC_SMP_HELPERS if SMP
@@ -87,6 +80,7 @@ config S390
87 select HAVE_FUNCTION_TRACER 80 select HAVE_FUNCTION_TRACER
88 select HAVE_FUNCTION_TRACE_MCOUNT_TEST 81 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
89 select HAVE_FTRACE_MCOUNT_RECORD 82 select HAVE_FTRACE_MCOUNT_RECORD
83 select HAVE_C_RECORDMCOUNT
90 select HAVE_SYSCALL_TRACEPOINTS 84 select HAVE_SYSCALL_TRACEPOINTS
91 select HAVE_DYNAMIC_FTRACE 85 select HAVE_DYNAMIC_FTRACE
92 select HAVE_FUNCTION_GRAPH_TRACER 86 select HAVE_FUNCTION_GRAPH_TRACER
@@ -151,7 +145,7 @@ source "kernel/time/Kconfig"
151config 64BIT 145config 64BIT
152 bool "64 bit kernel" 146 bool "64 bit kernel"
153 help 147 help
154 Select this option if you have a 64 bit IBM zSeries machine 148 Select this option if you have an IBM z/Architecture machine
155 and want to use the 64 bit addressing mode. 149 and want to use the 64 bit addressing mode.
156 150
157config 32BIT 151config 32BIT
@@ -203,9 +197,18 @@ config HOTPLUG_CPU
203 can be controlled through /sys/devices/system/cpu/cpu#. 197 can be controlled through /sys/devices/system/cpu/cpu#.
204 Say N if you want to disable CPU hotplug. 198 Say N if you want to disable CPU hotplug.
205 199
200config SCHED_MC
201 def_bool y
202 prompt "Multi-core scheduler support"
203 depends on SMP
204 help
205 Multi-core scheduler support improves the CPU scheduler's decision
206 making when dealing with multi-core CPU chips at a cost of slightly
207 increased overhead in some places.
208
206config SCHED_BOOK 209config SCHED_BOOK
207 bool "Book scheduler support" 210 bool "Book scheduler support"
208 depends on SMP 211 depends on SMP && SCHED_MC
209 help 212 help
210 Book scheduler support improves the CPU scheduler's decision making 213 Book scheduler support improves the CPU scheduler's decision making
211 when dealing with machines that have several books. 214 when dealing with machines that have several books.
@@ -215,7 +218,7 @@ config MATHEMU
215 depends on MARCH_G5 218 depends on MARCH_G5
216 help 219 help
217 This option is required for IEEE compliant floating point arithmetic 220 This option is required for IEEE compliant floating point arithmetic
218 on older S/390 machines. Say Y unless you know your machine doesn't 221 on older ESA/390 machines. Say Y unless you know your machine doesn't
219 need this. 222 need this.
220 223
221config COMPAT 224config COMPAT
@@ -244,8 +247,8 @@ config S390_EXEC_PROTECT
244 space programs and it also selects the addressing mode option above. 247 space programs and it also selects the addressing mode option above.
245 The kernel parameter noexec=on will enable this feature and also 248 The kernel parameter noexec=on will enable this feature and also
246 switch the addressing modes, default is disabled. Enabling this (via 249 switch the addressing modes, default is disabled. Enabling this (via
247 kernel parameter) on machines earlier than IBM System z9-109 EC/BC 250 kernel parameter) on machines earlier than IBM System z9 this will
248 will reduce system performance. 251 reduce system performance.
249 252
250comment "Code generation options" 253comment "Code generation options"
251 254
@@ -254,49 +257,46 @@ choice
254 default MARCH_G5 257 default MARCH_G5
255 258
256config MARCH_G5 259config MARCH_G5
257 bool "S/390 model G5 and G6" 260 bool "System/390 model G5 and G6"
258 depends on !64BIT 261 depends on !64BIT
259 help 262 help
260 Select this to build a 31 bit kernel that works 263 Select this to build a 31 bit kernel that works
261 on all S/390 and zSeries machines. 264 on all ESA/390 and z/Architecture machines.
262 265
263config MARCH_Z900 266config MARCH_Z900
264 bool "IBM eServer zSeries model z800 and z900" 267 bool "IBM zSeries model z800 and z900"
265 help 268 help
266 Select this to optimize for zSeries machines. This 269 Select this to enable optimizations for model z800/z900 (2064 and
267 will enable some optimizations that are not available 270 2066 series). This will enable some optimizations that are not
268 on older 31 bit only CPUs. 271 available on older ESA/390 (31 Bit) only CPUs.
269 272
270config MARCH_Z990 273config MARCH_Z990
271 bool "IBM eServer zSeries model z890 and z990" 274 bool "IBM zSeries model z890 and z990"
272 help 275 help
273 Select this enable optimizations for model z890/z990. 276 Select this to enable optimizations for model z890/z990 (2084 and
274 This will be slightly faster but does not work on 277 2086 series). The kernel will be slightly faster but will not work
275 older machines such as the z900. 278 on older machines.
276 279
277config MARCH_Z9_109 280config MARCH_Z9_109
278 bool "IBM System z9" 281 bool "IBM System z9"
279 help 282 help
280 Select this to enable optimizations for IBM System z9-109, IBM 283 Select this to enable optimizations for IBM System z9 (2094 and
281 System z9 Enterprise Class (z9 EC), and IBM System z9 Business 284 2096 series). The kernel will be slightly faster but will not work
282 Class (z9 BC). The kernel will be slightly faster but will not 285 on older machines.
283 work on older machines such as the z990, z890, z900, and z800.
284 286
285config MARCH_Z10 287config MARCH_Z10
286 bool "IBM System z10" 288 bool "IBM System z10"
287 help 289 help
288 Select this to enable optimizations for IBM System z10. The 290 Select this to enable optimizations for IBM System z10 (2097 and
289 kernel will be slightly faster but will not work on older 291 2098 series). The kernel will be slightly faster but will not work
290 machines such as the z990, z890, z900, z800, z9-109, z9-ec 292 on older machines.
291 and z9-bc.
292 293
293config MARCH_Z196 294config MARCH_Z196
294 bool "IBM zEnterprise 196" 295 bool "IBM zEnterprise 196"
295 help 296 help
296 Select this to enable optimizations for IBM zEnterprise 196. 297 Select this to enable optimizations for IBM zEnterprise 196
297 The kernel will be slightly faster but will not work on older 298 (2817 series). The kernel will be slightly faster but will not work
298 machines such as the z990, z890, z900, z800, z9-109, z9-ec, 299 on older machines.
299 z9-bc, z10-ec and z10-bc.
300 300
301endchoice 301endchoice
302 302
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 020e51c063d2..cd4a81be9cf8 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -638,18 +638,21 @@ __init int hypfs_diag_init(void)
638 pr_err("The hardware system does not support hypfs\n"); 638 pr_err("The hardware system does not support hypfs\n");
639 return -ENODATA; 639 return -ENODATA;
640 } 640 }
641 rc = diag224_get_name_table();
642 if (rc) {
643 diag204_free_buffer();
644 pr_err("The hardware system does not provide all "
645 "functions required by hypfs\n");
646 }
647 if (diag204_info_type == INFO_EXT) { 641 if (diag204_info_type == INFO_EXT) {
648 rc = hypfs_dbfs_init(); 642 rc = hypfs_dbfs_init();
649 if (rc) 643 if (rc)
650 diag204_free_buffer(); 644 return rc;
651 } 645 }
652 return rc; 646 if (MACHINE_IS_LPAR) {
647 rc = diag224_get_name_table();
648 if (rc) {
649 pr_err("The hardware system does not provide all "
650 "functions required by hypfs\n");
651 debugfs_remove(dbfs_d204_file);
652 return rc;
653 }
654 }
655 return 0;
653} 656}
654 657
655void hypfs_diag_exit(void) 658void hypfs_diag_exit(void)
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 74d98670be27..47cc446dab8f 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -316,10 +316,10 @@ static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
316 return 0; 316 return 0;
317} 317}
318 318
319static int hypfs_get_super(struct file_system_type *fst, int flags, 319static struct dentry *hypfs_mount(struct file_system_type *fst, int flags,
320 const char *devname, void *data, struct vfsmount *mnt) 320 const char *devname, void *data)
321{ 321{
322 return get_sb_single(fst, flags, data, hypfs_fill_super, mnt); 322 return mount_single(fst, flags, data, hypfs_fill_super);
323} 323}
324 324
325static void hypfs_kill_super(struct super_block *sb) 325static void hypfs_kill_super(struct super_block *sb)
@@ -455,7 +455,7 @@ static const struct file_operations hypfs_file_ops = {
455static struct file_system_type hypfs_type = { 455static struct file_system_type hypfs_type = {
456 .owner = THIS_MODULE, 456 .owner = THIS_MODULE,
457 .name = "s390_hypfs", 457 .name = "s390_hypfs",
458 .get_sb = hypfs_get_super, 458 .mount = hypfs_mount,
459 .kill_sb = hypfs_kill_super 459 .kill_sb = hypfs_kill_super
460}; 460};
461 461
diff --git a/arch/s390/include/asm/dasd.h b/arch/s390/include/asm/dasd.h
index 218bce81ec70..b604a9186f8e 100644
--- a/arch/s390/include/asm/dasd.h
+++ b/arch/s390/include/asm/dasd.h
@@ -217,6 +217,25 @@ typedef struct dasd_symmio_parms {
217 int rssd_result_len; 217 int rssd_result_len;
218} __attribute__ ((packed)) dasd_symmio_parms_t; 218} __attribute__ ((packed)) dasd_symmio_parms_t;
219 219
220/*
221 * Data returned by Sense Path Group ID (SNID)
222 */
223struct dasd_snid_data {
224 struct {
225 __u8 group:2;
226 __u8 reserve:2;
227 __u8 mode:1;
228 __u8 res:3;
229 } __attribute__ ((packed)) path_state;
230 __u8 pgid[11];
231} __attribute__ ((packed));
232
233struct dasd_snid_ioctl_data {
234 struct dasd_snid_data data;
235 __u8 path_mask;
236} __attribute__ ((packed));
237
238
220/******************************************************************************** 239/********************************************************************************
221 * SECTION: Definition of IOCTLs 240 * SECTION: Definition of IOCTLs
222 * 241 *
@@ -261,25 +280,10 @@ typedef struct dasd_symmio_parms {
261/* Set Attributes (cache operations) */ 280/* Set Attributes (cache operations) */
262#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t) 281#define BIODASDSATTR _IOW(DASD_IOCTL_LETTER,2,attrib_data_t)
263 282
283/* Get Sense Path Group ID (SNID) data */
284#define BIODASDSNID _IOWR(DASD_IOCTL_LETTER, 1, struct dasd_snid_ioctl_data)
285
264#define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t) 286#define BIODASDSYMMIO _IOWR(DASD_IOCTL_LETTER, 240, dasd_symmio_parms_t)
265 287
266#endif /* DASD_H */ 288#endif /* DASD_H */
267 289
268/*
269 * Overrides for Emacs so that we follow Linus's tabbing style.
270 * Emacs will notice this stuff at the end of the file and automatically
271 * adjust the settings for this buffer only. This must remain at the end
272 * of the file.
273 * ---------------------------------------------------------------------------
274 * Local variables:
275 * c-indent-level: 4
276 * c-brace-imaginary-offset: 0
277 * c-brace-offset: -4
278 * c-argdecl-indent: 4
279 * c-label-offset: -4
280 * c-continued-statement-offset: 4
281 * c-continued-brace-offset: 0
282 * indent-tabs-mode: nil
283 * tab-width: 8
284 * End:
285 */
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index f3c1b823c9a8..33982e7ce04d 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -66,9 +66,9 @@ int main(void)
66 DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base)); 66 DEFINE(__VDSO_ECTG_BASE, offsetof(struct vdso_per_cpu_data, ectg_timer_base));
67 DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time)); 67 DEFINE(__VDSO_ECTG_USER, offsetof(struct vdso_per_cpu_data, ectg_user_time));
68 /* constants used by the vdso */ 68 /* constants used by the vdso */
69 DEFINE(CLOCK_REALTIME, CLOCK_REALTIME); 69 DEFINE(__CLOCK_REALTIME, CLOCK_REALTIME);
70 DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC); 70 DEFINE(__CLOCK_MONOTONIC, CLOCK_MONOTONIC);
71 DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); 71 DEFINE(__CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
72 BLANK(); 72 BLANK();
73 /* constants for SIGP */ 73 /* constants for SIGP */
74 DEFINE(__SIGP_STOP, sigp_stop); 74 DEFINE(__SIGP_STOP, sigp_stop);
diff --git a/arch/s390/kernel/early.c b/arch/s390/kernel/early.c
index d149609e46e6..3b7e7dddc324 100644
--- a/arch/s390/kernel/early.c
+++ b/arch/s390/kernel/early.c
@@ -282,8 +282,6 @@ static noinline __init void setup_facility_list(void)
282static noinline __init void setup_hpage(void) 282static noinline __init void setup_hpage(void)
283{ 283{
284#ifndef CONFIG_DEBUG_PAGEALLOC 284#ifndef CONFIG_DEBUG_PAGEALLOC
285 unsigned int facilities;
286
287 if (!test_facility(2) || !test_facility(8)) 285 if (!test_facility(2) || !test_facility(8))
288 return; 286 return;
289 S390_lowcore.machine_flags |= MACHINE_FLAG_HPAGE; 287 S390_lowcore.machine_flags |= MACHINE_FLAG_HPAGE;
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 5efce7202984..1ecc337fb679 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -557,6 +557,7 @@ pgm_svcper:
557# per was called from kernel, must be kprobes 557# per was called from kernel, must be kprobes
558# 558#
559kernel_per: 559kernel_per:
560 REENABLE_IRQS
560 mvi SP_SVCNR(%r15),0xff # set trap indication to pgm check 561 mvi SP_SVCNR(%r15),0xff # set trap indication to pgm check
561 mvi SP_SVCNR+1(%r15),0xff 562 mvi SP_SVCNR+1(%r15),0xff
562 la %r2,SP_PTREGS(%r15) # address of register-save area 563 la %r2,SP_PTREGS(%r15) # address of register-save area
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index a2be23922f43..8f3e802174db 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -568,6 +568,7 @@ pgm_svcper:
568# per was called from kernel, must be kprobes 568# per was called from kernel, must be kprobes
569# 569#
570kernel_per: 570kernel_per:
571 REENABLE_IRQS
571 xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number 572 xc SP_SVCNR(2,%r15),SP_SVCNR(%r15) # clear svc number
572 la %r2,SP_PTREGS(%r15) # address of register-save area 573 la %r2,SP_PTREGS(%r15) # address of register-save area
573 brasl %r14,do_single_step 574 brasl %r14,do_single_step
diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c
index 2a3d2bf6f083..d60fc4398516 100644
--- a/arch/s390/kernel/kprobes.c
+++ b/arch/s390/kernel/kprobes.c
@@ -316,6 +316,8 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
316 return 1; 316 return 1;
317 317
318ss_probe: 318ss_probe:
319 if (regs->psw.mask & (PSW_MASK_PER | PSW_MASK_IO))
320 local_irq_disable();
319 prepare_singlestep(p, regs); 321 prepare_singlestep(p, regs);
320 kcb->kprobe_status = KPROBE_HIT_SS; 322 kcb->kprobe_status = KPROBE_HIT_SS;
321 return 1; 323 return 1;
@@ -463,6 +465,8 @@ static int __kprobes post_kprobe_handler(struct pt_regs *regs)
463 goto out; 465 goto out;
464 } 466 }
465 reset_current_kprobe(); 467 reset_current_kprobe();
468 if (regs->psw.mask & (PSW_MASK_PER | PSW_MASK_IO))
469 local_irq_enable();
466out: 470out:
467 preempt_enable_no_resched(); 471 preempt_enable_no_resched();
468 472
@@ -502,8 +506,11 @@ int __kprobes kprobe_fault_handler(struct pt_regs *regs, int trapnr)
502 regs->psw.mask |= kcb->kprobe_saved_imask; 506 regs->psw.mask |= kcb->kprobe_saved_imask;
503 if (kcb->kprobe_status == KPROBE_REENTER) 507 if (kcb->kprobe_status == KPROBE_REENTER)
504 restore_previous_kprobe(kcb); 508 restore_previous_kprobe(kcb);
505 else 509 else {
506 reset_current_kprobe(); 510 reset_current_kprobe();
511 if (regs->psw.mask & (PSW_MASK_PER | PSW_MASK_IO))
512 local_irq_enable();
513 }
507 preempt_enable_no_resched(); 514 preempt_enable_no_resched();
508 break; 515 break;
509 case KPROBE_HIT_ACTIVE: 516 case KPROBE_HIT_ACTIVE:
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index e3ceb911dc75..6f6350826c81 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -761,6 +761,9 @@ static void __init setup_hwcaps(void)
761 case 0x2098: 761 case 0x2098:
762 strcpy(elf_platform, "z10"); 762 strcpy(elf_platform, "z10");
763 break; 763 break;
764 case 0x2817:
765 strcpy(elf_platform, "z196");
766 break;
764 } 767 }
765} 768}
766 769
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index f04d93aa48ec..5c9e439bf3f6 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -106,11 +106,13 @@ static int stsi_15_1_x(struct sysinfo_15_1_x *info, char *page, int len)
106 for (i = 0; i < TOPOLOGY_NR_MAG; i++) 106 for (i = 0; i < TOPOLOGY_NR_MAG; i++)
107 len += sprintf(page + len, " %d", info->mag[i]); 107 len += sprintf(page + len, " %d", info->mag[i]);
108 len += sprintf(page + len, "\n"); 108 len += sprintf(page + len, "\n");
109#ifdef CONFIG_SCHED_MC
109 store_topology(info); 110 store_topology(info);
110 len += sprintf(page + len, "CPU Topology SW: "); 111 len += sprintf(page + len, "CPU Topology SW: ");
111 for (i = 0; i < TOPOLOGY_NR_MAG; i++) 112 for (i = 0; i < TOPOLOGY_NR_MAG; i++)
112 len += sprintf(page + len, " %d", info->mag[i]); 113 len += sprintf(page + len, " %d", info->mag[i]);
113 len += sprintf(page + len, "\n"); 114 len += sprintf(page + len, "\n");
115#endif
114 return len; 116 return len;
115} 117}
116 118
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index a9dee9048ee5..94b06c31fc8a 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -53,8 +53,10 @@ static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu)
53 cpumask_t mask; 53 cpumask_t mask;
54 54
55 cpus_clear(mask); 55 cpus_clear(mask);
56 if (!topology_enabled || !MACHINE_HAS_TOPOLOGY) 56 if (!topology_enabled || !MACHINE_HAS_TOPOLOGY) {
57 return cpu_possible_map; 57 cpumask_copy(&mask, cpumask_of(cpu));
58 return mask;
59 }
58 while (info) { 60 while (info) {
59 if (cpu_isset(cpu, info->mask)) { 61 if (cpu_isset(cpu, info->mask)) {
60 mask = info->mask; 62 mask = info->mask;
diff --git a/arch/s390/kernel/vdso32/clock_getres.S b/arch/s390/kernel/vdso32/clock_getres.S
index 9532c4e6a9d2..36aaa25d05da 100644
--- a/arch/s390/kernel/vdso32/clock_getres.S
+++ b/arch/s390/kernel/vdso32/clock_getres.S
@@ -19,9 +19,9 @@
19 .type __kernel_clock_getres,@function 19 .type __kernel_clock_getres,@function
20__kernel_clock_getres: 20__kernel_clock_getres:
21 .cfi_startproc 21 .cfi_startproc
22 chi %r2,CLOCK_REALTIME 22 chi %r2,__CLOCK_REALTIME
23 je 0f 23 je 0f
24 chi %r2,CLOCK_MONOTONIC 24 chi %r2,__CLOCK_MONOTONIC
25 jne 3f 25 jne 3f
260: ltr %r3,%r3 260: ltr %r3,%r3
27 jz 2f /* res == NULL */ 27 jz 2f /* res == NULL */
@@ -34,6 +34,6 @@ __kernel_clock_getres:
343: lhi %r1,__NR_clock_getres /* fallback to svc */ 343: lhi %r1,__NR_clock_getres /* fallback to svc */
35 svc 0 35 svc 0
36 br %r14 36 br %r14
374: .long CLOCK_REALTIME_RES 374: .long __CLOCK_REALTIME_RES
38 .cfi_endproc 38 .cfi_endproc
39 .size __kernel_clock_getres,.-__kernel_clock_getres 39 .size __kernel_clock_getres,.-__kernel_clock_getres
diff --git a/arch/s390/kernel/vdso32/clock_gettime.S b/arch/s390/kernel/vdso32/clock_gettime.S
index 969643954273..b2224e0b974c 100644
--- a/arch/s390/kernel/vdso32/clock_gettime.S
+++ b/arch/s390/kernel/vdso32/clock_gettime.S
@@ -21,9 +21,9 @@ __kernel_clock_gettime:
21 .cfi_startproc 21 .cfi_startproc
22 basr %r5,0 22 basr %r5,0
230: al %r5,21f-0b(%r5) /* get &_vdso_data */ 230: al %r5,21f-0b(%r5) /* get &_vdso_data */
24 chi %r2,CLOCK_REALTIME 24 chi %r2,__CLOCK_REALTIME
25 je 10f 25 je 10f
26 chi %r2,CLOCK_MONOTONIC 26 chi %r2,__CLOCK_MONOTONIC
27 jne 19f 27 jne 19f
28 28
29 /* CLOCK_MONOTONIC */ 29 /* CLOCK_MONOTONIC */
diff --git a/arch/s390/kernel/vdso64/clock_getres.S b/arch/s390/kernel/vdso64/clock_getres.S
index 9ce8caafdb4e..176e1f75f9aa 100644
--- a/arch/s390/kernel/vdso64/clock_getres.S
+++ b/arch/s390/kernel/vdso64/clock_getres.S
@@ -19,9 +19,9 @@
19 .type __kernel_clock_getres,@function 19 .type __kernel_clock_getres,@function
20__kernel_clock_getres: 20__kernel_clock_getres:
21 .cfi_startproc 21 .cfi_startproc
22 cghi %r2,CLOCK_REALTIME 22 cghi %r2,__CLOCK_REALTIME
23 je 0f 23 je 0f
24 cghi %r2,CLOCK_MONOTONIC 24 cghi %r2,__CLOCK_MONOTONIC
25 je 0f 25 je 0f
26 cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */ 26 cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */
27 jne 2f 27 jne 2f
@@ -39,6 +39,6 @@ __kernel_clock_getres:
392: lghi %r1,__NR_clock_getres /* fallback to svc */ 392: lghi %r1,__NR_clock_getres /* fallback to svc */
40 svc 0 40 svc 0
41 br %r14 41 br %r14
423: .quad CLOCK_REALTIME_RES 423: .quad __CLOCK_REALTIME_RES
43 .cfi_endproc 43 .cfi_endproc
44 .size __kernel_clock_getres,.-__kernel_clock_getres 44 .size __kernel_clock_getres,.-__kernel_clock_getres
diff --git a/arch/s390/kernel/vdso64/clock_gettime.S b/arch/s390/kernel/vdso64/clock_gettime.S
index f40467884a03..d46c95ed5f19 100644
--- a/arch/s390/kernel/vdso64/clock_gettime.S
+++ b/arch/s390/kernel/vdso64/clock_gettime.S
@@ -20,11 +20,11 @@
20__kernel_clock_gettime: 20__kernel_clock_gettime:
21 .cfi_startproc 21 .cfi_startproc
22 larl %r5,_vdso_data 22 larl %r5,_vdso_data
23 cghi %r2,CLOCK_REALTIME 23 cghi %r2,__CLOCK_REALTIME
24 je 4f 24 je 4f
25 cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */ 25 cghi %r2,-2 /* CLOCK_THREAD_CPUTIME_ID for this thread */
26 je 9f 26 je 9f
27 cghi %r2,CLOCK_MONOTONIC 27 cghi %r2,__CLOCK_MONOTONIC
28 jne 12f 28 jne 12f
29 29
30 /* CLOCK_MONOTONIC */ 30 /* CLOCK_MONOTONIC */
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index be4a15584751..4293fdcb5398 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -1,8 +1,3 @@
1# For a description of the syntax of this configuration file,
2# see Documentation/kbuild/kconfig-language.txt.
3
4mainmenu "Linux/SCORE Kernel Configuration"
5
6menu "Machine selection" 1menu "Machine selection"
7 2
8choice 3choice
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 0f40fc35d0a2..7f217b3a50a8 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -1,10 +1,3 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "Linux/SuperH Kernel Configuration"
7
8config SUPERH 1config SUPERH
9 def_bool y 2 def_bool y
10 select EMBEDDED 3 select EMBEDDED
@@ -25,8 +18,11 @@ config SUPERH
25 select HAVE_KERNEL_LZO 18 select HAVE_KERNEL_LZO
26 select HAVE_SYSCALL_TRACEPOINTS 19 select HAVE_SYSCALL_TRACEPOINTS
27 select HAVE_REGS_AND_STACK_ACCESS_API 20 select HAVE_REGS_AND_STACK_ACCESS_API
21 select HAVE_GENERIC_HARDIRQS
22 select HAVE_SPARSE_IRQ
28 select RTC_LIB 23 select RTC_LIB
29 select GENERIC_ATOMIC64 24 select GENERIC_ATOMIC64
25 select GENERIC_HARDIRQS_NO_DEPRECATED
30 help 26 help
31 The SuperH is a RISC processor targeted for use in embedded systems 27 The SuperH is a RISC processor targeted for use in embedded systems
32 and consumer electronics; it was also used in the Sega Dreamcast 28 and consumer electronics; it was also used in the Sega Dreamcast
@@ -49,6 +45,7 @@ config SUPERH32
49 select HAVE_MIXED_BREAKPOINTS_REGS 45 select HAVE_MIXED_BREAKPOINTS_REGS
50 select PERF_EVENTS 46 select PERF_EVENTS
51 select ARCH_HIBERNATION_POSSIBLE if MMU 47 select ARCH_HIBERNATION_POSSIBLE if MMU
48 select SPARSE_IRQ
52 49
53config SUPERH64 50config SUPERH64
54 def_bool ARCH = "sh64" 51 def_bool ARCH = "sh64"
@@ -78,19 +75,9 @@ config GENERIC_FIND_NEXT_BIT
78config GENERIC_HWEIGHT 75config GENERIC_HWEIGHT
79 def_bool y 76 def_bool y
80 77
81config GENERIC_HARDIRQS
82 def_bool y
83
84config GENERIC_HARDIRQS_NO__DO_IRQ
85 def_bool y
86
87config IRQ_PER_CPU 78config IRQ_PER_CPU
88 def_bool y 79 def_bool y
89 80
90config SPARSE_IRQ
91 def_bool y
92 depends on SUPERH32
93
94config GENERIC_GPIO 81config GENERIC_GPIO
95 def_bool n 82 def_bool n
96 83
@@ -206,6 +193,7 @@ config CPU_SH2
206config CPU_SH2A 193config CPU_SH2A
207 bool 194 bool
208 select CPU_SH2 195 select CPU_SH2
196 select UNCACHED_MAPPING
209 197
210config CPU_SH3 198config CPU_SH3
211 bool 199 bool
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 307b3a4a790b..9c8c6e1a2a15 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -133,10 +133,7 @@ machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
133machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx 133machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx
134machdir-$(CONFIG_SH_DREAMCAST) += mach-dreamcast 134machdir-$(CONFIG_SH_DREAMCAST) += mach-dreamcast
135machdir-$(CONFIG_SH_SH03) += mach-sh03 135machdir-$(CONFIG_SH_SH03) += mach-sh03
136machdir-$(CONFIG_SH_SECUREEDGE5410) += mach-snapgear
137machdir-$(CONFIG_SH_RTS7751R2D) += mach-r2d 136machdir-$(CONFIG_SH_RTS7751R2D) += mach-r2d
138machdir-$(CONFIG_SH_7751_SYSTEMH) += mach-systemh
139machdir-$(CONFIG_SH_EDOSK7705) += mach-edosk7705
140machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander 137machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander
141machdir-$(CONFIG_SH_MIGOR) += mach-migor 138machdir-$(CONFIG_SH_MIGOR) += mach-migor
142machdir-$(CONFIG_SH_AP325RXA) += mach-ap325rxa 139machdir-$(CONFIG_SH_AP325RXA) += mach-ap325rxa
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 9c94711aa6ca..2018c7ea4c93 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -81,13 +81,6 @@ config SH_7343_SOLUTION_ENGINE
81 Select 7343 SolutionEngine if configuring for a Hitachi 81 Select 7343 SolutionEngine if configuring for a Hitachi
82 SH7343 (SH-Mobile 3AS) evaluation board. 82 SH7343 (SH-Mobile 3AS) evaluation board.
83 83
84config SH_7751_SYSTEMH
85 bool "SystemH7751R"
86 depends on CPU_SUBTYPE_SH7751R
87 help
88 Select SystemH if you are configuring for a Renesas SystemH
89 7751R evaluation board.
90
91config SH_HP6XX 84config SH_HP6XX
92 bool "HP6XX" 85 bool "HP6XX"
93 select SYS_SUPPORTS_APM_EMULATION 86 select SYS_SUPPORTS_APM_EMULATION
diff --git a/arch/sh/boards/Makefile b/arch/sh/boards/Makefile
index 38ef655cc0f0..be7d11d04b26 100644
--- a/arch/sh/boards/Makefile
+++ b/arch/sh/boards/Makefile
@@ -2,10 +2,12 @@
2# Specific board support, not covered by a mach group. 2# Specific board support, not covered by a mach group.
3# 3#
4obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o 4obj-$(CONFIG_SH_MAGIC_PANEL_R2) += board-magicpanelr2.o
5obj-$(CONFIG_SH_SECUREEDGE5410) += board-secureedge5410.o
5obj-$(CONFIG_SH_SH2007) += board-sh2007.o 6obj-$(CONFIG_SH_SH2007) += board-sh2007.o
6obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o 7obj-$(CONFIG_SH_SH7785LCR) += board-sh7785lcr.o
7obj-$(CONFIG_SH_URQUELL) += board-urquell.o 8obj-$(CONFIG_SH_URQUELL) += board-urquell.o
8obj-$(CONFIG_SH_SHMIN) += board-shmin.o 9obj-$(CONFIG_SH_SHMIN) += board-shmin.o
10obj-$(CONFIG_SH_EDOSK7705) += board-edosk7705.o
9obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o 11obj-$(CONFIG_SH_EDOSK7760) += board-edosk7760.o
10obj-$(CONFIG_SH_ESPT) += board-espt.o 12obj-$(CONFIG_SH_ESPT) += board-espt.o
11obj-$(CONFIG_SH_POLARIS) += board-polaris.o 13obj-$(CONFIG_SH_POLARIS) += board-polaris.o
diff --git a/arch/sh/boards/board-edosk7705.c b/arch/sh/boards/board-edosk7705.c
new file mode 100644
index 000000000000..4cb3bb74c36f
--- /dev/null
+++ b/arch/sh/boards/board-edosk7705.c
@@ -0,0 +1,78 @@
1/*
2 * arch/sh/boards/renesas/edosk7705/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 * Modified for edosk7705 development
9 * board by S. Dunn, 2003.
10 */
11#include <linux/init.h>
12#include <linux/irq.h>
13#include <linux/platform_device.h>
14#include <linux/interrupt.h>
15#include <linux/smc91x.h>
16#include <asm/machvec.h>
17#include <asm/sizes.h>
18
19#define SMC_IOBASE 0xA2000000
20#define SMC_IO_OFFSET 0x300
21#define SMC_IOADDR (SMC_IOBASE + SMC_IO_OFFSET)
22
23#define ETHERNET_IRQ 0x09
24
25static void __init sh_edosk7705_init_irq(void)
26{
27 make_imask_irq(ETHERNET_IRQ);
28}
29
30/* eth initialization functions */
31static struct smc91x_platdata smc91x_info = {
32 .flags = SMC91X_USE_16BIT | SMC91X_IO_SHIFT_1 | IORESOURCE_IRQ_LOWLEVEL,
33};
34
35static struct resource smc91x_res[] = {
36 [0] = {
37 .start = SMC_IOADDR,
38 .end = SMC_IOADDR + SZ_32 - 1,
39 .flags = IORESOURCE_MEM,
40 },
41 [1] = {
42 .start = ETHERNET_IRQ,
43 .end = ETHERNET_IRQ,
44 .flags = IORESOURCE_IRQ ,
45 }
46};
47
48static struct platform_device smc91x_dev = {
49 .name = "smc91x",
50 .id = -1,
51 .num_resources = ARRAY_SIZE(smc91x_res),
52 .resource = smc91x_res,
53
54 .dev = {
55 .platform_data = &smc91x_info,
56 },
57};
58
59/* platform init code */
60static struct platform_device *edosk7705_devices[] __initdata = {
61 &smc91x_dev,
62};
63
64static int __init init_edosk7705_devices(void)
65{
66 return platform_add_devices(edosk7705_devices,
67 ARRAY_SIZE(edosk7705_devices));
68}
69__initcall(init_edosk7705_devices);
70
71/*
72 * The Machine Vector
73 */
74static struct sh_machine_vector mv_edosk7705 __initmv = {
75 .mv_name = "EDOSK7705",
76 .mv_nr_irqs = 80,
77 .mv_init_irq = sh_edosk7705_init_irq,
78};
diff --git a/arch/sh/boards/mach-snapgear/setup.c b/arch/sh/boards/board-secureedge5410.c
index 331745dee379..32f875e8493d 100644
--- a/arch/sh/boards/mach-snapgear/setup.c
+++ b/arch/sh/boards/board-secureedge5410.c
@@ -1,6 +1,4 @@
1/* 1/*
2 * linux/arch/sh/boards/snapgear/setup.c
3 *
4 * Copyright (C) 2002 David McCullough <davidm@snapgear.com> 2 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
5 * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org> 3 * Copyright (C) 2003 Paul Mundt <lethal@linux-sh.org>
6 * 4 *
@@ -19,18 +17,19 @@
19#include <linux/module.h> 17#include <linux/module.h>
20#include <linux/sched.h> 18#include <linux/sched.h>
21#include <asm/machvec.h> 19#include <asm/machvec.h>
22#include <mach/snapgear.h> 20#include <mach/secureedge5410.h>
23#include <asm/irq.h> 21#include <asm/irq.h>
24#include <asm/io.h> 22#include <asm/io.h>
25#include <cpu/timer.h> 23#include <cpu/timer.h>
26 24
25unsigned short secureedge5410_ioport;
26
27/* 27/*
28 * EraseConfig handling functions 28 * EraseConfig handling functions
29 */ 29 */
30
31static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id) 30static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
32{ 31{
33 (void)__raw_readb(0xb8000000); /* dummy read */ 32 ctrl_delay(); /* dummy read */
34 33
35 printk("SnapGear: erase switch interrupt!\n"); 34 printk("SnapGear: erase switch interrupt!\n");
36 35
@@ -39,21 +38,22 @@ static irqreturn_t eraseconfig_interrupt(int irq, void *dev_id)
39 38
40static int __init eraseconfig_init(void) 39static int __init eraseconfig_init(void)
41{ 40{
41 unsigned int irq = evt2irq(0x240);
42
42 printk("SnapGear: EraseConfig init\n"); 43 printk("SnapGear: EraseConfig init\n");
44
43 /* Setup "EraseConfig" switch on external IRQ 0 */ 45 /* Setup "EraseConfig" switch on external IRQ 0 */
44 if (request_irq(IRL0_IRQ, eraseconfig_interrupt, IRQF_DISABLED, 46 if (request_irq(irq, eraseconfig_interrupt, IRQF_DISABLED,
45 "Erase Config", NULL)) 47 "Erase Config", NULL))
46 printk("SnapGear: failed to register IRQ%d for Reset witch\n", 48 printk("SnapGear: failed to register IRQ%d for Reset witch\n",
47 IRL0_IRQ); 49 irq);
48 else 50 else
49 printk("SnapGear: registered EraseConfig switch on IRQ%d\n", 51 printk("SnapGear: registered EraseConfig switch on IRQ%d\n",
50 IRL0_IRQ); 52 irq);
51 return(0); 53 return 0;
52} 54}
53
54module_init(eraseconfig_init); 55module_init(eraseconfig_init);
55 56
56/****************************************************************************/
57/* 57/*
58 * Initialize IRQ setting 58 * Initialize IRQ setting
59 * 59 *
@@ -62,7 +62,6 @@ module_init(eraseconfig_init);
62 * IRL2 = eth1 62 * IRL2 = eth1
63 * IRL3 = crypto 63 * IRL3 = crypto
64 */ 64 */
65
66static void __init init_snapgear_IRQ(void) 65static void __init init_snapgear_IRQ(void)
67{ 66{
68 printk("Setup SnapGear IRQ/IPR ...\n"); 67 printk("Setup SnapGear IRQ/IPR ...\n");
@@ -76,20 +75,5 @@ static void __init init_snapgear_IRQ(void)
76static struct sh_machine_vector mv_snapgear __initmv = { 75static struct sh_machine_vector mv_snapgear __initmv = {
77 .mv_name = "SnapGear SecureEdge5410", 76 .mv_name = "SnapGear SecureEdge5410",
78 .mv_nr_irqs = 72, 77 .mv_nr_irqs = 72,
79
80 .mv_inb = snapgear_inb,
81 .mv_inw = snapgear_inw,
82 .mv_inl = snapgear_inl,
83 .mv_outb = snapgear_outb,
84 .mv_outw = snapgear_outw,
85 .mv_outl = snapgear_outl,
86
87 .mv_inb_p = snapgear_inb_p,
88 .mv_inw_p = snapgear_inw,
89 .mv_inl_p = snapgear_inl,
90 .mv_outb_p = snapgear_outb_p,
91 .mv_outw_p = snapgear_outw,
92 .mv_outl_p = snapgear_outl,
93
94 .mv_init_irq = init_snapgear_IRQ, 78 .mv_init_irq = init_snapgear_IRQ,
95}; 79};
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 3da116f47f01..07ea908c510d 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -176,6 +176,21 @@ static void ap320_wvga_power_off(void *board_data)
176 __raw_writew(0, FPGA_LCDREG); 176 __raw_writew(0, FPGA_LCDREG);
177} 177}
178 178
179const static struct fb_videomode ap325rxa_lcdc_modes[] = {
180 {
181 .name = "LB070WV1",
182 .xres = 800,
183 .yres = 480,
184 .left_margin = 32,
185 .right_margin = 160,
186 .hsync_len = 8,
187 .upper_margin = 63,
188 .lower_margin = 80,
189 .vsync_len = 1,
190 .sync = 0, /* hsync and vsync are active low */
191 },
192};
193
179static struct sh_mobile_lcdc_info lcdc_info = { 194static struct sh_mobile_lcdc_info lcdc_info = {
180 .clock_source = LCDC_CLK_EXTERNAL, 195 .clock_source = LCDC_CLK_EXTERNAL,
181 .ch[0] = { 196 .ch[0] = {
@@ -183,18 +198,8 @@ static struct sh_mobile_lcdc_info lcdc_info = {
183 .bpp = 16, 198 .bpp = 16,
184 .interface_type = RGB18, 199 .interface_type = RGB18,
185 .clock_divider = 1, 200 .clock_divider = 1,
186 .lcd_cfg = { 201 .lcd_cfg = ap325rxa_lcdc_modes,
187 .name = "LB070WV1", 202 .num_cfg = ARRAY_SIZE(ap325rxa_lcdc_modes),
188 .xres = 800,
189 .yres = 480,
190 .left_margin = 32,
191 .right_margin = 160,
192 .hsync_len = 8,
193 .upper_margin = 63,
194 .lower_margin = 80,
195 .vsync_len = 1,
196 .sync = 0, /* hsync and vsync are active low */
197 },
198 .lcd_size_cfg = { /* 7.0 inch */ 203 .lcd_size_cfg = { /* 7.0 inch */
199 .width = 152, 204 .width = 152,
200 .height = 91, 205 .height = 91,
@@ -481,7 +486,6 @@ static struct soc_camera_link ov7725_link = {
481 .power = ov7725_power, 486 .power = ov7725_power,
482 .board_info = &ap325rxa_i2c_camera[0], 487 .board_info = &ap325rxa_i2c_camera[0],
483 .i2c_adapter_id = 0, 488 .i2c_adapter_id = 0,
484 .module_name = "ov772x",
485 .priv = &ov7725_info, 489 .priv = &ov7725_info,
486}; 490};
487 491
diff --git a/arch/sh/boards/mach-cayman/irq.c b/arch/sh/boards/mach-cayman/irq.c
index 1394b078db36..d7ac5af9d102 100644
--- a/arch/sh/boards/mach-cayman/irq.c
+++ b/arch/sh/boards/mach-cayman/irq.c
@@ -55,8 +55,9 @@ static struct irqaction cayman_action_pci2 = {
55 .flags = IRQF_DISABLED, 55 .flags = IRQF_DISABLED,
56}; 56};
57 57
58static void enable_cayman_irq(unsigned int irq) 58static void enable_cayman_irq(struct irq_data *data)
59{ 59{
60 unsigned int irq = data->irq;
60 unsigned long flags; 61 unsigned long flags;
61 unsigned long mask; 62 unsigned long mask;
62 unsigned int reg; 63 unsigned int reg;
@@ -72,8 +73,9 @@ static void enable_cayman_irq(unsigned int irq)
72 local_irq_restore(flags); 73 local_irq_restore(flags);
73} 74}
74 75
75void disable_cayman_irq(unsigned int irq) 76static void disable_cayman_irq(struct irq_data *data)
76{ 77{
78 unsigned int irq = data->irq;
77 unsigned long flags; 79 unsigned long flags;
78 unsigned long mask; 80 unsigned long mask;
79 unsigned int reg; 81 unsigned int reg;
@@ -89,16 +91,10 @@ void disable_cayman_irq(unsigned int irq)
89 local_irq_restore(flags); 91 local_irq_restore(flags);
90} 92}
91 93
92static void ack_cayman_irq(unsigned int irq)
93{
94 disable_cayman_irq(irq);
95}
96
97struct irq_chip cayman_irq_type = { 94struct irq_chip cayman_irq_type = {
98 .name = "Cayman-IRQ", 95 .name = "Cayman-IRQ",
99 .unmask = enable_cayman_irq, 96 .irq_unmask = enable_cayman_irq,
100 .mask = disable_cayman_irq, 97 .irq_mask = disable_cayman_irq,
101 .mask_ack = ack_cayman_irq,
102}; 98};
103 99
104int cayman_irq_demux(int evt) 100int cayman_irq_demux(int evt)
diff --git a/arch/sh/boards/mach-dreamcast/irq.c b/arch/sh/boards/mach-dreamcast/irq.c
index d932667410ab..72e7ac9549da 100644
--- a/arch/sh/boards/mach-dreamcast/irq.c
+++ b/arch/sh/boards/mach-dreamcast/irq.c
@@ -60,8 +60,9 @@
60 */ 60 */
61 61
62/* Disable the hardware event by masking its bit in its EMR */ 62/* Disable the hardware event by masking its bit in its EMR */
63static inline void disable_systemasic_irq(unsigned int irq) 63static inline void disable_systemasic_irq(struct irq_data *data)
64{ 64{
65 unsigned int irq = data->irq;
65 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); 66 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
66 __u32 mask; 67 __u32 mask;
67 68
@@ -71,8 +72,9 @@ static inline void disable_systemasic_irq(unsigned int irq)
71} 72}
72 73
73/* Enable the hardware event by setting its bit in its EMR */ 74/* Enable the hardware event by setting its bit in its EMR */
74static inline void enable_systemasic_irq(unsigned int irq) 75static inline void enable_systemasic_irq(struct irq_data *data)
75{ 76{
77 unsigned int irq = data->irq;
76 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2); 78 __u32 emr = EMR_BASE + (LEVEL(irq) << 4) + (LEVEL(irq) << 2);
77 __u32 mask; 79 __u32 mask;
78 80
@@ -82,18 +84,19 @@ static inline void enable_systemasic_irq(unsigned int irq)
82} 84}
83 85
84/* Acknowledge a hardware event by writing its bit back to its ESR */ 86/* Acknowledge a hardware event by writing its bit back to its ESR */
85static void mask_ack_systemasic_irq(unsigned int irq) 87static void mask_ack_systemasic_irq(struct irq_data *data)
86{ 88{
89 unsigned int irq = data->irq;
87 __u32 esr = ESR_BASE + (LEVEL(irq) << 2); 90 __u32 esr = ESR_BASE + (LEVEL(irq) << 2);
88 disable_systemasic_irq(irq); 91 disable_systemasic_irq(data);
89 outl((1 << EVENT_BIT(irq)), esr); 92 outl((1 << EVENT_BIT(irq)), esr);
90} 93}
91 94
92struct irq_chip systemasic_int = { 95struct irq_chip systemasic_int = {
93 .name = "System ASIC", 96 .name = "System ASIC",
94 .mask = disable_systemasic_irq, 97 .irq_mask = disable_systemasic_irq,
95 .mask_ack = mask_ack_systemasic_irq, 98 .irq_mask_ack = mask_ack_systemasic_irq,
96 .unmask = enable_systemasic_irq, 99 .irq_unmask = enable_systemasic_irq,
97}; 100};
98 101
99/* 102/*
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index 71a3368ab1fc..2eaeb9e59585 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -231,14 +231,41 @@ static struct platform_device usb1_common_device = {
231}; 231};
232 232
233/* LCDC */ 233/* LCDC */
234const static struct fb_videomode ecovec_lcd_modes[] = {
235 {
236 .name = "Panel",
237 .xres = 800,
238 .yres = 480,
239 .left_margin = 220,
240 .right_margin = 110,
241 .hsync_len = 70,
242 .upper_margin = 20,
243 .lower_margin = 5,
244 .vsync_len = 5,
245 .sync = 0, /* hsync and vsync are active low */
246 },
247};
248
249const static struct fb_videomode ecovec_dvi_modes[] = {
250 {
251 .name = "DVI",
252 .xres = 1280,
253 .yres = 720,
254 .left_margin = 220,
255 .right_margin = 110,
256 .hsync_len = 40,
257 .upper_margin = 20,
258 .lower_margin = 5,
259 .vsync_len = 5,
260 .sync = 0, /* hsync and vsync are active low */
261 },
262};
263
234static struct sh_mobile_lcdc_info lcdc_info = { 264static struct sh_mobile_lcdc_info lcdc_info = {
235 .ch[0] = { 265 .ch[0] = {
236 .interface_type = RGB18, 266 .interface_type = RGB18,
237 .chan = LCDC_CHAN_MAINLCD, 267 .chan = LCDC_CHAN_MAINLCD,
238 .bpp = 16, 268 .bpp = 16,
239 .lcd_cfg = {
240 .sync = 0, /* hsync and vsync are active low */
241 },
242 .lcd_size_cfg = { /* 7.0 inch */ 269 .lcd_size_cfg = { /* 7.0 inch */
243 .width = 152, 270 .width = 152,
244 .height = 91, 271 .height = 91,
@@ -620,7 +647,6 @@ static struct soc_camera_link tw9910_link = {
620 .bus_id = 1, 647 .bus_id = 1,
621 .power = tw9910_power, 648 .power = tw9910_power,
622 .board_info = &i2c_camera[0], 649 .board_info = &i2c_camera[0],
623 .module_name = "tw9910",
624 .priv = &tw9910_info, 650 .priv = &tw9910_info,
625}; 651};
626 652
@@ -644,7 +670,6 @@ static struct soc_camera_link mt9t112_link1 = {
644 .power = mt9t112_power1, 670 .power = mt9t112_power1,
645 .bus_id = 0, 671 .bus_id = 0,
646 .board_info = &i2c_camera[1], 672 .board_info = &i2c_camera[1],
647 .module_name = "mt9t112",
648 .priv = &mt9t112_info1, 673 .priv = &mt9t112_info1,
649}; 674};
650 675
@@ -667,7 +692,6 @@ static struct soc_camera_link mt9t112_link2 = {
667 .power = mt9t112_power2, 692 .power = mt9t112_power2,
668 .bus_id = 1, 693 .bus_id = 1,
669 .board_info = &i2c_camera[2], 694 .board_info = &i2c_camera[2],
670 .module_name = "mt9t112",
671 .priv = &mt9t112_info2, 695 .priv = &mt9t112_info2,
672}; 696};
673 697
@@ -793,7 +817,6 @@ static struct sh_vou_pdata sh_vou_pdata = {
793 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW, 817 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
794 .board_info = &ak8813, 818 .board_info = &ak8813,
795 .i2c_adap = 0, 819 .i2c_adap = 0,
796 .module_name = "ak881x",
797}; 820};
798 821
799static struct resource sh_vou_resources[] = { 822static struct resource sh_vou_resources[] = {
@@ -1079,33 +1102,18 @@ static int __init arch_setup(void)
1079 if (gpio_get_value(GPIO_PTE6)) { 1102 if (gpio_get_value(GPIO_PTE6)) {
1080 /* DVI */ 1103 /* DVI */
1081 lcdc_info.clock_source = LCDC_CLK_EXTERNAL; 1104 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
1082 lcdc_info.ch[0].clock_divider = 1, 1105 lcdc_info.ch[0].clock_divider = 1;
1083 lcdc_info.ch[0].lcd_cfg.name = "DVI"; 1106 lcdc_info.ch[0].lcd_cfg = ecovec_dvi_modes;
1084 lcdc_info.ch[0].lcd_cfg.xres = 1280; 1107 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_dvi_modes);
1085 lcdc_info.ch[0].lcd_cfg.yres = 720;
1086 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
1087 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
1088 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
1089 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
1090 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
1091 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
1092 1108
1093 gpio_set_value(GPIO_PTA2, 1); 1109 gpio_set_value(GPIO_PTA2, 1);
1094 gpio_set_value(GPIO_PTU1, 1); 1110 gpio_set_value(GPIO_PTU1, 1);
1095 } else { 1111 } else {
1096 /* Panel */ 1112 /* Panel */
1097
1098 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL; 1113 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
1099 lcdc_info.ch[0].clock_divider = 2, 1114 lcdc_info.ch[0].clock_divider = 2;
1100 lcdc_info.ch[0].lcd_cfg.name = "Panel"; 1115 lcdc_info.ch[0].lcd_cfg = ecovec_lcd_modes;
1101 lcdc_info.ch[0].lcd_cfg.xres = 800; 1116 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(ecovec_lcd_modes);
1102 lcdc_info.ch[0].lcd_cfg.yres = 480;
1103 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
1104 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
1105 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
1106 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
1107 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
1108 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
1109 1117
1110 gpio_set_value(GPIO_PTR1, 1); 1118 gpio_set_value(GPIO_PTR1, 1);
1111 1119
diff --git a/arch/sh/boards/mach-edosk7705/Makefile b/arch/sh/boards/mach-edosk7705/Makefile
deleted file mode 100644
index cd54acb51499..000000000000
--- a/arch/sh/boards/mach-edosk7705/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the EDOSK7705 specific parts of the kernel
3#
4
5obj-y := setup.o io.o
diff --git a/arch/sh/boards/mach-edosk7705/io.c b/arch/sh/boards/mach-edosk7705/io.c
deleted file mode 100644
index 5b9c57c43241..000000000000
--- a/arch/sh/boards/mach-edosk7705/io.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * arch/sh/boards/renesas/edosk7705/io.c
3 *
4 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
5 * Based largely on io_se.c.
6 *
7 * I/O routines for Hitachi EDOSK7705 board.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/io.h>
14#include <mach/edosk7705.h>
15#include <asm/addrspace.h>
16
17#define SMC_IOADDR 0xA2000000
18
19/* Map the Ethernet addresses as if it is at 0x300 - 0x320 */
20static unsigned long sh_edosk7705_isa_port2addr(unsigned long port)
21{
22 /*
23 * SMC91C96 registers are 4 byte aligned rather than the
24 * usual 2 byte!
25 */
26 if (port >= 0x300 && port < 0x320)
27 return SMC_IOADDR + ((port - 0x300) * 2);
28
29 maybebadio(port);
30 return port;
31}
32
33/* Trying to read / write bytes on odd-byte boundaries to the Ethernet
34 * registers causes problems. So we bit-shift the value and read / write
35 * in 2 byte chunks. Setting the low byte to 0 does not cause problems
36 * now as odd byte writes are only made on the bit mask / interrupt
37 * register. This may not be the case in future Mar-2003 SJD
38 */
39unsigned char sh_edosk7705_inb(unsigned long port)
40{
41 if (port >= 0x300 && port < 0x320 && port & 0x01)
42 return __raw_readw(port - 1) >> 8;
43
44 return __raw_readb(sh_edosk7705_isa_port2addr(port));
45}
46
47void sh_edosk7705_outb(unsigned char value, unsigned long port)
48{
49 if (port >= 0x300 && port < 0x320 && port & 0x01) {
50 __raw_writew(((unsigned short)value << 8), port - 1);
51 return;
52 }
53
54 __raw_writeb(value, sh_edosk7705_isa_port2addr(port));
55}
56
57void sh_edosk7705_insb(unsigned long port, void *addr, unsigned long count)
58{
59 unsigned char *p = addr;
60
61 while (count--)
62 *p++ = sh_edosk7705_inb(port);
63}
64
65void sh_edosk7705_outsb(unsigned long port, const void *addr, unsigned long count)
66{
67 unsigned char *p = (unsigned char *)addr;
68
69 while (count--)
70 sh_edosk7705_outb(*p++, port);
71}
diff --git a/arch/sh/boards/mach-edosk7705/setup.c b/arch/sh/boards/mach-edosk7705/setup.c
deleted file mode 100644
index d59225e26fb9..000000000000
--- a/arch/sh/boards/mach-edosk7705/setup.c
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * arch/sh/boards/renesas/edosk7705/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SolutionEngine Support.
7 *
8 * Modified for edosk7705 development
9 * board by S. Dunn, 2003.
10 */
11#include <linux/init.h>
12#include <linux/irq.h>
13#include <asm/machvec.h>
14#include <mach/edosk7705.h>
15
16static void __init sh_edosk7705_init_irq(void)
17{
18 /* This is the Ethernet interrupt */
19 make_imask_irq(0x09);
20}
21
22/*
23 * The Machine Vector
24 */
25static struct sh_machine_vector mv_edosk7705 __initmv = {
26 .mv_name = "EDOSK7705",
27 .mv_nr_irqs = 80,
28
29 .mv_inb = sh_edosk7705_inb,
30 .mv_outb = sh_edosk7705_outb,
31
32 .mv_insb = sh_edosk7705_insb,
33 .mv_outsb = sh_edosk7705_outsb,
34
35 .mv_init_irq = sh_edosk7705_init_irq,
36};
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index 68994a163f6c..9b60eaabf8f3 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -126,6 +126,21 @@ static struct platform_device kfr2r09_sh_keysc_device = {
126 }, 126 },
127}; 127};
128 128
129const static struct fb_videomode kfr2r09_lcdc_modes[] = {
130 {
131 .name = "TX07D34VM0AAA",
132 .xres = 240,
133 .yres = 400,
134 .left_margin = 0,
135 .right_margin = 16,
136 .hsync_len = 8,
137 .upper_margin = 0,
138 .lower_margin = 1,
139 .vsync_len = 1,
140 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
141 },
142};
143
129static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = { 144static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
130 .clock_source = LCDC_CLK_BUS, 145 .clock_source = LCDC_CLK_BUS,
131 .ch[0] = { 146 .ch[0] = {
@@ -134,18 +149,8 @@ static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
134 .interface_type = SYS18, 149 .interface_type = SYS18,
135 .clock_divider = 6, 150 .clock_divider = 6,
136 .flags = LCDC_FLAGS_DWPOL, 151 .flags = LCDC_FLAGS_DWPOL,
137 .lcd_cfg = { 152 .lcd_cfg = kfr2r09_lcdc_modes,
138 .name = "TX07D34VM0AAA", 153 .num_cfg = ARRAY_SIZE(kfr2r09_lcdc_modes),
139 .xres = 240,
140 .yres = 400,
141 .left_margin = 0,
142 .right_margin = 16,
143 .hsync_len = 8,
144 .upper_margin = 0,
145 .lower_margin = 1,
146 .vsync_len = 1,
147 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
148 },
149 .lcd_size_cfg = { 154 .lcd_size_cfg = {
150 .width = 35, 155 .width = 35,
151 .height = 58, 156 .height = 58,
@@ -333,7 +338,6 @@ static struct soc_camera_link rj54n1_link = {
333 .power = camera_power, 338 .power = camera_power,
334 .board_info = &kfr2r09_i2c_camera, 339 .board_info = &kfr2r09_i2c_camera,
335 .i2c_adapter_id = 1, 340 .i2c_adapter_id = 1,
336 .module_name = "rj54n1cb0c",
337 .priv = &rj54n1_priv, 341 .priv = &rj54n1_priv,
338}; 342};
339 343
diff --git a/arch/sh/boards/mach-landisk/irq.c b/arch/sh/boards/mach-landisk/irq.c
index 96f38a4187d0..e79412a40490 100644
--- a/arch/sh/boards/mach-landisk/irq.c
+++ b/arch/sh/boards/mach-landisk/irq.c
@@ -18,25 +18,24 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <mach-landisk/mach/iodata_landisk.h> 19#include <mach-landisk/mach/iodata_landisk.h>
20 20
21static void disable_landisk_irq(unsigned int irq) 21static void disable_landisk_irq(struct irq_data *data)
22{ 22{
23 unsigned char mask = 0xff ^ (0x01 << (irq - 5)); 23 unsigned char mask = 0xff ^ (0x01 << (data->irq - 5));
24 24
25 __raw_writeb(__raw_readb(PA_IMASK) & mask, PA_IMASK); 25 __raw_writeb(__raw_readb(PA_IMASK) & mask, PA_IMASK);
26} 26}
27 27
28static void enable_landisk_irq(unsigned int irq) 28static void enable_landisk_irq(struct irq_data *data)
29{ 29{
30 unsigned char value = (0x01 << (irq - 5)); 30 unsigned char value = (0x01 << (data->irq - 5));
31 31
32 __raw_writeb(__raw_readb(PA_IMASK) | value, PA_IMASK); 32 __raw_writeb(__raw_readb(PA_IMASK) | value, PA_IMASK);
33} 33}
34 34
35static struct irq_chip landisk_irq_chip __read_mostly = { 35static struct irq_chip landisk_irq_chip __read_mostly = {
36 .name = "LANDISK", 36 .name = "LANDISK",
37 .mask = disable_landisk_irq, 37 .irq_mask = disable_landisk_irq,
38 .unmask = enable_landisk_irq, 38 .irq_unmask = enable_landisk_irq,
39 .mask_ack = disable_landisk_irq,
40}; 39};
41 40
42/* 41/*
@@ -50,7 +49,7 @@ void __init init_landisk_IRQ(void)
50 disable_irq_nosync(i); 49 disable_irq_nosync(i);
51 set_irq_chip_and_handler_name(i, &landisk_irq_chip, 50 set_irq_chip_and_handler_name(i, &landisk_irq_chip,
52 handle_level_irq, "level"); 51 handle_level_irq, "level");
53 enable_landisk_irq(i); 52 enable_landisk_irq(irq_get_irq_data(i));
54 } 53 }
55 __raw_writeb(0x00, PA_PWRINT_CLR); 54 __raw_writeb(0x00, PA_PWRINT_CLR);
56} 55}
diff --git a/arch/sh/boards/mach-microdev/io.c b/arch/sh/boards/mach-microdev/io.c
index 2960c659020e..acdafb0c6404 100644
--- a/arch/sh/boards/mach-microdev/io.c
+++ b/arch/sh/boards/mach-microdev/io.c
@@ -54,7 +54,7 @@
54/* 54/*
55 * map I/O ports to memory-mapped addresses 55 * map I/O ports to memory-mapped addresses
56 */ 56 */
57static unsigned long microdev_isa_port2addr(unsigned long offset) 57void __iomem *microdev_ioport_map(unsigned long offset, unsigned int len)
58{ 58{
59 unsigned long result; 59 unsigned long result;
60 60
@@ -72,16 +72,6 @@ static unsigned long microdev_isa_port2addr(unsigned long offset)
72 * Configuration Registers 72 * Configuration Registers
73 */ 73 */
74 result = IO_SUPERIO_PHYS + (offset << 1); 74 result = IO_SUPERIO_PHYS + (offset << 1);
75#if 0
76 } else if (offset == KBD_DATA_REG || offset == KBD_CNTL_REG ||
77 offset == KBD_STATUS_REG) {
78 /*
79 * SMSC FDC37C93xAPM SuperIO chip
80 *
81 * PS/2 Keyboard + Mouse (ports 0x60 and 0x64).
82 */
83 result = IO_SUPERIO_PHYS + (offset << 1);
84#endif
85 } else if (((offset >= IO_IDE1_BASE) && 75 } else if (((offset >= IO_IDE1_BASE) &&
86 (offset < IO_IDE1_BASE + IO_IDE_EXTENT)) || 76 (offset < IO_IDE1_BASE + IO_IDE_EXTENT)) ||
87 (offset == IO_IDE1_MISC)) { 77 (offset == IO_IDE1_MISC)) {
@@ -131,237 +121,5 @@ static unsigned long microdev_isa_port2addr(unsigned long offset)
131 result = PVR; 121 result = PVR;
132 } 122 }
133 123
134 return result; 124 return (void __iomem *)result;
135}
136
137#define PORT2ADDR(x) (microdev_isa_port2addr(x))
138
139static inline void delay(void)
140{
141#if defined(CONFIG_PCI)
142 /* System board present, just make a dummy SRAM access. (CS0 will be
143 mapped to PCI memory, probably good to avoid it.) */
144 __raw_readw(0xa6800000);
145#else
146 /* CS0 will be mapped to flash, ROM etc so safe to access it. */
147 __raw_readw(0xa0000000);
148#endif
149}
150
151unsigned char microdev_inb(unsigned long port)
152{
153#ifdef CONFIG_PCI
154 if (port >= PCIBIOS_MIN_IO)
155 return microdev_pci_inb(port);
156#endif
157 return *(volatile unsigned char*)PORT2ADDR(port);
158}
159
160unsigned short microdev_inw(unsigned long port)
161{
162#ifdef CONFIG_PCI
163 if (port >= PCIBIOS_MIN_IO)
164 return microdev_pci_inw(port);
165#endif
166 return *(volatile unsigned short*)PORT2ADDR(port);
167}
168
169unsigned int microdev_inl(unsigned long port)
170{
171#ifdef CONFIG_PCI
172 if (port >= PCIBIOS_MIN_IO)
173 return microdev_pci_inl(port);
174#endif
175 return *(volatile unsigned int*)PORT2ADDR(port);
176}
177
178void microdev_outw(unsigned short b, unsigned long port)
179{
180#ifdef CONFIG_PCI
181 if (port >= PCIBIOS_MIN_IO) {
182 microdev_pci_outw(b, port);
183 return;
184 }
185#endif
186 *(volatile unsigned short*)PORT2ADDR(port) = b;
187}
188
189void microdev_outb(unsigned char b, unsigned long port)
190{
191#ifdef CONFIG_PCI
192 if (port >= PCIBIOS_MIN_IO) {
193 microdev_pci_outb(b, port);
194 return;
195 }
196#endif
197
198 /*
199 * There is a board feature with the current SH4-202 MicroDev in
200 * that the 2 byte enables (nBE0 and nBE1) are tied together (and
201 * to the Chip Select Line (Ethernet_CS)). Due to this connectivity,
202 * it is not possible to safely perform 8-bit writes to the
203 * Ethernet registers, as 16-bits will be consumed from the Data
204 * lines (corrupting the other byte). Hence, this function is
205 * written to implement 16-bit read/modify/write for all byte-wide
206 * accesses.
207 *
208 * Note: there is no problem with byte READS (even or odd).
209 *
210 * Sean McGoogan - 16th June 2003.
211 */
212 if ((port >= IO_LAN91C111_BASE) &&
213 (port < IO_LAN91C111_BASE + IO_LAN91C111_EXTENT)) {
214 /*
215 * Then are trying to perform a byte-write to the
216 * LAN91C111. This needs special care.
217 */
218 if (port % 2 == 1) { /* is the port odd ? */
219 /* unset bit-0, i.e. make even */
220 const unsigned long evenPort = port-1;
221 unsigned short word;
222
223 /*
224 * do a 16-bit read/write to write to 'port',
225 * preserving even byte.
226 *
227 * Even addresses are bits 0-7
228 * Odd addresses are bits 8-15
229 */
230 word = microdev_inw(evenPort);
231 word = (word & 0xffu) | (b << 8);
232 microdev_outw(word, evenPort);
233 } else {
234 /* else, we are trying to do an even byte write */
235 unsigned short word;
236
237 /*
238 * do a 16-bit read/write to write to 'port',
239 * preserving odd byte.
240 *
241 * Even addresses are bits 0-7
242 * Odd addresses are bits 8-15
243 */
244 word = microdev_inw(port);
245 word = (word & 0xff00u) | (b);
246 microdev_outw(word, port);
247 }
248 } else {
249 *(volatile unsigned char*)PORT2ADDR(port) = b;
250 }
251}
252
253void microdev_outl(unsigned int b, unsigned long port)
254{
255#ifdef CONFIG_PCI
256 if (port >= PCIBIOS_MIN_IO) {
257 microdev_pci_outl(b, port);
258 return;
259 }
260#endif
261 *(volatile unsigned int*)PORT2ADDR(port) = b;
262}
263
264unsigned char microdev_inb_p(unsigned long port)
265{
266 unsigned char v = microdev_inb(port);
267 delay();
268 return v;
269}
270
271unsigned short microdev_inw_p(unsigned long port)
272{
273 unsigned short v = microdev_inw(port);
274 delay();
275 return v;
276}
277
278unsigned int microdev_inl_p(unsigned long port)
279{
280 unsigned int v = microdev_inl(port);
281 delay();
282 return v;
283}
284
285void microdev_outb_p(unsigned char b, unsigned long port)
286{
287 microdev_outb(b, port);
288 delay();
289}
290
291void microdev_outw_p(unsigned short b, unsigned long port)
292{
293 microdev_outw(b, port);
294 delay();
295}
296
297void microdev_outl_p(unsigned int b, unsigned long port)
298{
299 microdev_outl(b, port);
300 delay();
301}
302
303void microdev_insb(unsigned long port, void *buffer, unsigned long count)
304{
305 volatile unsigned char *port_addr;
306 unsigned char *buf = buffer;
307
308 port_addr = (volatile unsigned char *)PORT2ADDR(port);
309
310 while (count--)
311 *buf++ = *port_addr;
312}
313
314void microdev_insw(unsigned long port, void *buffer, unsigned long count)
315{
316 volatile unsigned short *port_addr;
317 unsigned short *buf = buffer;
318
319 port_addr = (volatile unsigned short *)PORT2ADDR(port);
320
321 while (count--)
322 *buf++ = *port_addr;
323}
324
325void microdev_insl(unsigned long port, void *buffer, unsigned long count)
326{
327 volatile unsigned long *port_addr;
328 unsigned int *buf = buffer;
329
330 port_addr = (volatile unsigned long *)PORT2ADDR(port);
331
332 while (count--)
333 *buf++ = *port_addr;
334}
335
336void microdev_outsb(unsigned long port, const void *buffer, unsigned long count)
337{
338 volatile unsigned char *port_addr;
339 const unsigned char *buf = buffer;
340
341 port_addr = (volatile unsigned char *)PORT2ADDR(port);
342
343 while (count--)
344 *port_addr = *buf++;
345}
346
347void microdev_outsw(unsigned long port, const void *buffer, unsigned long count)
348{
349 volatile unsigned short *port_addr;
350 const unsigned short *buf = buffer;
351
352 port_addr = (volatile unsigned short *)PORT2ADDR(port);
353
354 while (count--)
355 *port_addr = *buf++;
356}
357
358void microdev_outsl(unsigned long port, const void *buffer, unsigned long count)
359{
360 volatile unsigned long *port_addr;
361 const unsigned int *buf = buffer;
362
363 port_addr = (volatile unsigned long *)PORT2ADDR(port);
364
365 while (count--)
366 *port_addr = *buf++;
367} 125}
diff --git a/arch/sh/boards/mach-microdev/irq.c b/arch/sh/boards/mach-microdev/irq.c
index a26d16669aa2..c35001fd9032 100644
--- a/arch/sh/boards/mach-microdev/irq.c
+++ b/arch/sh/boards/mach-microdev/irq.c
@@ -65,19 +65,9 @@ static const struct {
65# error Inconsistancy in defining the IRQ# for primary IDE! 65# error Inconsistancy in defining the IRQ# for primary IDE!
66#endif 66#endif
67 67
68static void enable_microdev_irq(unsigned int irq); 68static void disable_microdev_irq(struct irq_data *data)
69static void disable_microdev_irq(unsigned int irq);
70static void mask_and_ack_microdev(unsigned int);
71
72static struct irq_chip microdev_irq_type = {
73 .name = "MicroDev-IRQ",
74 .unmask = enable_microdev_irq,
75 .mask = disable_microdev_irq,
76 .ack = mask_and_ack_microdev,
77};
78
79static void disable_microdev_irq(unsigned int irq)
80{ 69{
70 unsigned int irq = data->irq;
81 unsigned int fpgaIrq; 71 unsigned int fpgaIrq;
82 72
83 if (irq >= NUM_EXTERNAL_IRQS) 73 if (irq >= NUM_EXTERNAL_IRQS)
@@ -91,8 +81,9 @@ static void disable_microdev_irq(unsigned int irq)
91 __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG); 81 __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTDSB_REG);
92} 82}
93 83
94static void enable_microdev_irq(unsigned int irq) 84static void enable_microdev_irq(struct irq_data *data)
95{ 85{
86 unsigned int irq = data->irq;
96 unsigned long priorityReg, priorities, pri; 87 unsigned long priorityReg, priorities, pri;
97 unsigned int fpgaIrq; 88 unsigned int fpgaIrq;
98 89
@@ -116,17 +107,18 @@ static void enable_microdev_irq(unsigned int irq)
116 __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG); 107 __raw_writel(MICRODEV_FPGA_INTC_MASK(fpgaIrq), MICRODEV_FPGA_INTENB_REG);
117} 108}
118 109
110static struct irq_chip microdev_irq_type = {
111 .name = "MicroDev-IRQ",
112 .irq_unmask = enable_microdev_irq,
113 .irq_mask = disable_microdev_irq,
114};
115
119/* This function sets the desired irq handler to be a MicroDev type */ 116/* This function sets the desired irq handler to be a MicroDev type */
120static void __init make_microdev_irq(unsigned int irq) 117static void __init make_microdev_irq(unsigned int irq)
121{ 118{
122 disable_irq_nosync(irq); 119 disable_irq_nosync(irq);
123 set_irq_chip_and_handler(irq, &microdev_irq_type, handle_level_irq); 120 set_irq_chip_and_handler(irq, &microdev_irq_type, handle_level_irq);
124 disable_microdev_irq(irq); 121 disable_microdev_irq(irq_get_irq_data(irq));
125}
126
127static void mask_and_ack_microdev(unsigned int irq)
128{
129 disable_microdev_irq(irq);
130} 122}
131 123
132extern void __init init_microdev_irq(void) 124extern void __init init_microdev_irq(void)
diff --git a/arch/sh/boards/mach-microdev/setup.c b/arch/sh/boards/mach-microdev/setup.c
index d1df2a4fb9b8..d8a747291e03 100644
--- a/arch/sh/boards/mach-microdev/setup.c
+++ b/arch/sh/boards/mach-microdev/setup.c
@@ -195,27 +195,6 @@ device_initcall(microdev_devices_setup);
195static struct sh_machine_vector mv_sh4202_microdev __initmv = { 195static struct sh_machine_vector mv_sh4202_microdev __initmv = {
196 .mv_name = "SH4-202 MicroDev", 196 .mv_name = "SH4-202 MicroDev",
197 .mv_nr_irqs = 72, 197 .mv_nr_irqs = 72,
198 198 .mv_ioport_map = microdev_ioport_map,
199 .mv_inb = microdev_inb,
200 .mv_inw = microdev_inw,
201 .mv_inl = microdev_inl,
202 .mv_outb = microdev_outb,
203 .mv_outw = microdev_outw,
204 .mv_outl = microdev_outl,
205
206 .mv_inb_p = microdev_inb_p,
207 .mv_inw_p = microdev_inw_p,
208 .mv_inl_p = microdev_inl_p,
209 .mv_outb_p = microdev_outb_p,
210 .mv_outw_p = microdev_outw_p,
211 .mv_outl_p = microdev_outl_p,
212
213 .mv_insb = microdev_insb,
214 .mv_insw = microdev_insw,
215 .mv_insl = microdev_insl,
216 .mv_outsb = microdev_outsb,
217 .mv_outsw = microdev_outsw,
218 .mv_outsl = microdev_outsl,
219
220 .mv_init_irq = init_microdev_irq, 199 .mv_init_irq = init_microdev_irq,
221}; 200};
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 662debe4ead2..c8acfec98695 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -213,51 +213,55 @@ static struct platform_device migor_nand_flash_device = {
213 } 213 }
214}; 214};
215 215
216const static struct fb_videomode migor_lcd_modes[] = {
217 {
218#if defined(CONFIG_SH_MIGOR_RTA_WVGA)
219 .name = "LB070WV1",
220 .xres = 800,
221 .yres = 480,
222 .left_margin = 64,
223 .right_margin = 16,
224 .hsync_len = 120,
225 .sync = 0,
226#elif defined(CONFIG_SH_MIGOR_QVGA)
227 .name = "PH240320T",
228 .xres = 320,
229 .yres = 240,
230 .left_margin = 0,
231 .right_margin = 16,
232 .hsync_len = 8,
233 .sync = FB_SYNC_HOR_HIGH_ACT,
234#endif
235 .upper_margin = 1,
236 .lower_margin = 17,
237 .vsync_len = 2,
238 },
239};
240
216static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = { 241static struct sh_mobile_lcdc_info sh_mobile_lcdc_info = {
217#ifdef CONFIG_SH_MIGOR_RTA_WVGA 242#if defined(CONFIG_SH_MIGOR_RTA_WVGA)
218 .clock_source = LCDC_CLK_BUS, 243 .clock_source = LCDC_CLK_BUS,
219 .ch[0] = { 244 .ch[0] = {
220 .chan = LCDC_CHAN_MAINLCD, 245 .chan = LCDC_CHAN_MAINLCD,
221 .bpp = 16, 246 .bpp = 16,
222 .interface_type = RGB16, 247 .interface_type = RGB16,
223 .clock_divider = 2, 248 .clock_divider = 2,
224 .lcd_cfg = { 249 .lcd_cfg = migor_lcd_modes,
225 .name = "LB070WV1", 250 .num_cfg = ARRAY_SIZE(migor_lcd_modes),
226 .xres = 800,
227 .yres = 480,
228 .left_margin = 64,
229 .right_margin = 16,
230 .hsync_len = 120,
231 .upper_margin = 1,
232 .lower_margin = 17,
233 .vsync_len = 2,
234 .sync = 0,
235 },
236 .lcd_size_cfg = { /* 7.0 inch */ 251 .lcd_size_cfg = { /* 7.0 inch */
237 .width = 152, 252 .width = 152,
238 .height = 91, 253 .height = 91,
239 }, 254 },
240 } 255 }
241#endif 256#elif defined(CONFIG_SH_MIGOR_QVGA)
242#ifdef CONFIG_SH_MIGOR_QVGA
243 .clock_source = LCDC_CLK_PERIPHERAL, 257 .clock_source = LCDC_CLK_PERIPHERAL,
244 .ch[0] = { 258 .ch[0] = {
245 .chan = LCDC_CHAN_MAINLCD, 259 .chan = LCDC_CHAN_MAINLCD,
246 .bpp = 16, 260 .bpp = 16,
247 .interface_type = SYS16A, 261 .interface_type = SYS16A,
248 .clock_divider = 10, 262 .clock_divider = 10,
249 .lcd_cfg = { 263 .lcd_cfg = migor_lcd_modes,
250 .name = "PH240320T", 264 .num_cfg = ARRAY_SIZE(migor_lcd_modes),
251 .xres = 320,
252 .yres = 240,
253 .left_margin = 0,
254 .right_margin = 16,
255 .hsync_len = 8,
256 .upper_margin = 1,
257 .lower_margin = 17,
258 .vsync_len = 2,
259 .sync = FB_SYNC_HOR_HIGH_ACT,
260 },
261 .lcd_size_cfg = { /* 2.4 inch */ 265 .lcd_size_cfg = { /* 2.4 inch */
262 .width = 49, 266 .width = 49,
263 .height = 37, 267 .height = 37,
@@ -450,7 +454,6 @@ static struct soc_camera_link ov7725_link = {
450 .power = ov7725_power, 454 .power = ov7725_power,
451 .board_info = &migor_i2c_camera[0], 455 .board_info = &migor_i2c_camera[0],
452 .i2c_adapter_id = 0, 456 .i2c_adapter_id = 0,
453 .module_name = "ov772x",
454 .priv = &ov7725_info, 457 .priv = &ov7725_info,
455}; 458};
456 459
@@ -463,7 +466,6 @@ static struct soc_camera_link tw9910_link = {
463 .power = tw9910_power, 466 .power = tw9910_power,
464 .board_info = &migor_i2c_camera[1], 467 .board_info = &migor_i2c_camera[1],
465 .i2c_adapter_id = 0, 468 .i2c_adapter_id = 0,
466 .module_name = "tw9910",
467 .priv = &tw9910_info, 469 .priv = &tw9910_info,
468}; 470};
469 471
diff --git a/arch/sh/boards/mach-se/7206/Makefile b/arch/sh/boards/mach-se/7206/Makefile
index 63e7ed699f39..5c9eaa0535b9 100644
--- a/arch/sh/boards/mach-se/7206/Makefile
+++ b/arch/sh/boards/mach-se/7206/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the 7206 SolutionEngine specific parts of the kernel 2# Makefile for the 7206 SolutionEngine specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-se/7206/io.c b/arch/sh/boards/mach-se/7206/io.c
deleted file mode 100644
index adadc77532ee..000000000000
--- a/arch/sh/boards/mach-se/7206/io.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* $Id: io.c,v 1.5 2004/02/22 23:08:43 kkojima Exp $
2 *
3 * linux/arch/sh/boards/se/7206/io.c
4 *
5 * Copyright (C) 2006 Yoshinori Sato
6 *
7 * I/O routine for Hitachi 7206 SolutionEngine.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <asm/io.h>
14#include <mach-se/mach/se7206.h>
15
16
17static inline void delay(void)
18{
19 __raw_readw(0x20000000); /* P2 ROM Area */
20}
21
22/* MS7750 requires special versions of in*, out* routines, since
23 PC-like io ports are located at upper half byte of 16-bit word which
24 can be accessed only with 16-bit wide. */
25
26static inline volatile __u16 *
27port2adr(unsigned int port)
28{
29 if (port >= 0x2000 && port < 0x2020)
30 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
31 else if (port >= 0x300 && port < 0x310)
32 return (volatile __u16 *) (PA_SMSC + (port - 0x300));
33
34 return (volatile __u16 *)port;
35}
36
37unsigned char se7206_inb(unsigned long port)
38{
39 return (*port2adr(port)) & 0xff;
40}
41
42unsigned char se7206_inb_p(unsigned long port)
43{
44 unsigned long v;
45
46 v = (*port2adr(port)) & 0xff;
47 delay();
48 return v;
49}
50
51unsigned short se7206_inw(unsigned long port)
52{
53 return *port2adr(port);
54}
55
56void se7206_outb(unsigned char value, unsigned long port)
57{
58 *(port2adr(port)) = value;
59}
60
61void se7206_outb_p(unsigned char value, unsigned long port)
62{
63 *(port2adr(port)) = value;
64 delay();
65}
66
67void se7206_outw(unsigned short value, unsigned long port)
68{
69 *port2adr(port) = value;
70}
71
72void se7206_insb(unsigned long port, void *addr, unsigned long count)
73{
74 volatile __u16 *p = port2adr(port);
75 __u8 *ap = addr;
76
77 while (count--)
78 *ap++ = *p;
79}
80
81void se7206_insw(unsigned long port, void *addr, unsigned long count)
82{
83 volatile __u16 *p = port2adr(port);
84 __u16 *ap = addr;
85 while (count--)
86 *ap++ = *p;
87}
88
89void se7206_outsb(unsigned long port, const void *addr, unsigned long count)
90{
91 volatile __u16 *p = port2adr(port);
92 const __u8 *ap = addr;
93
94 while (count--)
95 *p = *ap++;
96}
97
98void se7206_outsw(unsigned long port, const void *addr, unsigned long count)
99{
100 volatile __u16 *p = port2adr(port);
101 const __u16 *ap = addr;
102 while (count--)
103 *p = *ap++;
104}
diff --git a/arch/sh/boards/mach-se/7206/irq.c b/arch/sh/boards/mach-se/7206/irq.c
index 8d82175d83ab..d961949600fd 100644
--- a/arch/sh/boards/mach-se/7206/irq.c
+++ b/arch/sh/boards/mach-se/7206/irq.c
@@ -25,8 +25,9 @@
25#define INTC_IPR01 0xfffe0818 25#define INTC_IPR01 0xfffe0818
26#define INTC_ICR1 0xfffe0802 26#define INTC_ICR1 0xfffe0802
27 27
28static void disable_se7206_irq(unsigned int irq) 28static void disable_se7206_irq(struct irq_data *data)
29{ 29{
30 unsigned int irq = data->irq;
30 unsigned short val; 31 unsigned short val;
31 unsigned short mask = 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ - irq))); 32 unsigned short mask = 0xffff ^ (0x0f << 4 * (3 - (IRQ0_IRQ - irq)));
32 unsigned short msk0,msk1; 33 unsigned short msk0,msk1;
@@ -55,8 +56,9 @@ static void disable_se7206_irq(unsigned int irq)
55 __raw_writew(msk1, INTMSK1); 56 __raw_writew(msk1, INTMSK1);
56} 57}
57 58
58static void enable_se7206_irq(unsigned int irq) 59static void enable_se7206_irq(struct irq_data *data)
59{ 60{
61 unsigned int irq = data->irq;
60 unsigned short val; 62 unsigned short val;
61 unsigned short value = (0x0001 << 4 * (3 - (IRQ0_IRQ - irq))); 63 unsigned short value = (0x0001 << 4 * (3 - (IRQ0_IRQ - irq)));
62 unsigned short msk0,msk1; 64 unsigned short msk0,msk1;
@@ -86,13 +88,14 @@ static void enable_se7206_irq(unsigned int irq)
86 __raw_writew(msk1, INTMSK1); 88 __raw_writew(msk1, INTMSK1);
87} 89}
88 90
89static void eoi_se7206_irq(unsigned int irq) 91static void eoi_se7206_irq(struct irq_data *data)
90{ 92{
91 unsigned short sts0,sts1; 93 unsigned short sts0,sts1;
94 unsigned int irq = data->irq;
92 struct irq_desc *desc = irq_to_desc(irq); 95 struct irq_desc *desc = irq_to_desc(irq);
93 96
94 if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS))) 97 if (!(desc->status & (IRQ_DISABLED|IRQ_INPROGRESS)))
95 enable_se7206_irq(irq); 98 enable_se7206_irq(data);
96 /* FPGA isr clear */ 99 /* FPGA isr clear */
97 sts0 = __raw_readw(INTSTS0); 100 sts0 = __raw_readw(INTSTS0);
98 sts1 = __raw_readw(INTSTS1); 101 sts1 = __raw_readw(INTSTS1);
@@ -115,10 +118,9 @@ static void eoi_se7206_irq(unsigned int irq)
115 118
116static struct irq_chip se7206_irq_chip __read_mostly = { 119static struct irq_chip se7206_irq_chip __read_mostly = {
117 .name = "SE7206-FPGA", 120 .name = "SE7206-FPGA",
118 .mask = disable_se7206_irq, 121 .irq_mask = disable_se7206_irq,
119 .unmask = enable_se7206_irq, 122 .irq_unmask = enable_se7206_irq,
120 .mask_ack = disable_se7206_irq, 123 .irq_eoi = eoi_se7206_irq,
121 .eoi = eoi_se7206_irq,
122}; 124};
123 125
124static void make_se7206_irq(unsigned int irq) 126static void make_se7206_irq(unsigned int irq)
@@ -126,7 +128,7 @@ static void make_se7206_irq(unsigned int irq)
126 disable_irq_nosync(irq); 128 disable_irq_nosync(irq);
127 set_irq_chip_and_handler_name(irq, &se7206_irq_chip, 129 set_irq_chip_and_handler_name(irq, &se7206_irq_chip,
128 handle_level_irq, "level"); 130 handle_level_irq, "level");
129 disable_se7206_irq(irq); 131 disable_se7206_irq(irq_get_irq_data(irq));
130} 132}
131 133
132/* 134/*
@@ -137,11 +139,13 @@ void __init init_se7206_IRQ(void)
137 make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */ 139 make_se7206_irq(IRQ0_IRQ); /* SMC91C111 */
138 make_se7206_irq(IRQ1_IRQ); /* ATA */ 140 make_se7206_irq(IRQ1_IRQ); /* ATA */
139 make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */ 141 make_se7206_irq(IRQ3_IRQ); /* SLOT / PCM */
140 __raw_writew(inw(INTC_ICR1) | 0x000b ,INTC_ICR1 ) ; /* ICR1 */ 142
143 __raw_writew(__raw_readw(INTC_ICR1) | 0x000b, INTC_ICR); /* ICR1 */
141 144
142 /* FPGA System register setup*/ 145 /* FPGA System register setup*/
143 __raw_writew(0x0000,INTSTS0); /* Clear INTSTS0 */ 146 __raw_writew(0x0000,INTSTS0); /* Clear INTSTS0 */
144 __raw_writew(0x0000,INTSTS1); /* Clear INTSTS1 */ 147 __raw_writew(0x0000,INTSTS1); /* Clear INTSTS1 */
148
145 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */ 149 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */
146 __raw_writew(0x0001,INTSEL); 150 __raw_writew(0x0001,INTSEL);
147} 151}
diff --git a/arch/sh/boards/mach-se/7206/setup.c b/arch/sh/boards/mach-se/7206/setup.c
index 8f5c65d43d1d..7f4871c71a01 100644
--- a/arch/sh/boards/mach-se/7206/setup.c
+++ b/arch/sh/boards/mach-se/7206/setup.c
@@ -86,20 +86,5 @@ __initcall(se7206_devices_setup);
86static struct sh_machine_vector mv_se __initmv = { 86static struct sh_machine_vector mv_se __initmv = {
87 .mv_name = "SolutionEngine", 87 .mv_name = "SolutionEngine",
88 .mv_nr_irqs = 256, 88 .mv_nr_irqs = 256,
89 .mv_inb = se7206_inb,
90 .mv_inw = se7206_inw,
91 .mv_outb = se7206_outb,
92 .mv_outw = se7206_outw,
93
94 .mv_inb_p = se7206_inb_p,
95 .mv_inw_p = se7206_inw,
96 .mv_outb_p = se7206_outb_p,
97 .mv_outw_p = se7206_outw,
98
99 .mv_insb = se7206_insb,
100 .mv_insw = se7206_insw,
101 .mv_outsb = se7206_outsb,
102 .mv_outsw = se7206_outsw,
103
104 .mv_init_irq = init_se7206_IRQ, 89 .mv_init_irq = init_se7206_IRQ,
105}; 90};
diff --git a/arch/sh/boards/mach-se/7343/irq.c b/arch/sh/boards/mach-se/7343/irq.c
index d4305c26e9f7..76255a19417f 100644
--- a/arch/sh/boards/mach-se/7343/irq.c
+++ b/arch/sh/boards/mach-se/7343/irq.c
@@ -18,23 +18,22 @@
18 18
19unsigned int se7343_fpga_irq[SE7343_FPGA_IRQ_NR] = { 0, }; 19unsigned int se7343_fpga_irq[SE7343_FPGA_IRQ_NR] = { 0, };
20 20
21static void disable_se7343_irq(unsigned int irq) 21static void disable_se7343_irq(struct irq_data *data)
22{ 22{
23 unsigned int bit = (unsigned int)get_irq_chip_data(irq); 23 unsigned int bit = (unsigned int)irq_data_get_irq_chip_data(data);
24 __raw_writew(__raw_readw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK); 24 __raw_writew(__raw_readw(PA_CPLD_IMSK) | 1 << bit, PA_CPLD_IMSK);
25} 25}
26 26
27static void enable_se7343_irq(unsigned int irq) 27static void enable_se7343_irq(struct irq_data *data)
28{ 28{
29 unsigned int bit = (unsigned int)get_irq_chip_data(irq); 29 unsigned int bit = (unsigned int)irq_data_get_irq_chip_data(data);
30 __raw_writew(__raw_readw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK); 30 __raw_writew(__raw_readw(PA_CPLD_IMSK) & ~(1 << bit), PA_CPLD_IMSK);
31} 31}
32 32
33static struct irq_chip se7343_irq_chip __read_mostly = { 33static struct irq_chip se7343_irq_chip __read_mostly = {
34 .name = "SE7343-FPGA", 34 .name = "SE7343-FPGA",
35 .mask = disable_se7343_irq, 35 .irq_mask = disable_se7343_irq,
36 .unmask = enable_se7343_irq, 36 .irq_unmask = enable_se7343_irq,
37 .mask_ack = disable_se7343_irq,
38}; 37};
39 38
40static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc) 39static void se7343_irq_demux(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/sh/boards/mach-se/770x/Makefile b/arch/sh/boards/mach-se/770x/Makefile
index 8e624b06d5ea..43ea14feef51 100644
--- a/arch/sh/boards/mach-se/770x/Makefile
+++ b/arch/sh/boards/mach-se/770x/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the 770x SolutionEngine specific parts of the kernel 2# Makefile for the 770x SolutionEngine specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-se/770x/io.c b/arch/sh/boards/mach-se/770x/io.c
deleted file mode 100644
index 28833c8786ea..000000000000
--- a/arch/sh/boards/mach-se/770x/io.c
+++ /dev/null
@@ -1,156 +0,0 @@
1/*
2 * Copyright (C) 2000 Kazumoto Kojima
3 *
4 * I/O routine for Hitachi SolutionEngine.
5 */
6#include <linux/kernel.h>
7#include <linux/types.h>
8#include <asm/io.h>
9#include <mach-se/mach/se.h>
10
11/* MS7750 requires special versions of in*, out* routines, since
12 PC-like io ports are located at upper half byte of 16-bit word which
13 can be accessed only with 16-bit wide. */
14
15static inline volatile __u16 *
16port2adr(unsigned int port)
17{
18 if (port & 0xff000000)
19 return ( volatile __u16 *) port;
20 if (port >= 0x2000)
21 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
22 else if (port >= 0x1000)
23 return (volatile __u16 *) (PA_83902 + (port << 1));
24 else
25 return (volatile __u16 *) (PA_SUPERIO + (port << 1));
26}
27
28static inline int
29shifted_port(unsigned long port)
30{
31 /* For IDE registers, value is not shifted */
32 if ((0x1f0 <= port && port < 0x1f8) || port == 0x3f6)
33 return 0;
34 else
35 return 1;
36}
37
38unsigned char se_inb(unsigned long port)
39{
40 if (shifted_port(port))
41 return (*port2adr(port) >> 8);
42 else
43 return (*port2adr(port))&0xff;
44}
45
46unsigned char se_inb_p(unsigned long port)
47{
48 unsigned long v;
49
50 if (shifted_port(port))
51 v = (*port2adr(port) >> 8);
52 else
53 v = (*port2adr(port))&0xff;
54 ctrl_delay();
55 return v;
56}
57
58unsigned short se_inw(unsigned long port)
59{
60 if (port >= 0x2000)
61 return *port2adr(port);
62 else
63 maybebadio(port);
64 return 0;
65}
66
67unsigned int se_inl(unsigned long port)
68{
69 maybebadio(port);
70 return 0;
71}
72
73void se_outb(unsigned char value, unsigned long port)
74{
75 if (shifted_port(port))
76 *(port2adr(port)) = value << 8;
77 else
78 *(port2adr(port)) = value;
79}
80
81void se_outb_p(unsigned char value, unsigned long port)
82{
83 if (shifted_port(port))
84 *(port2adr(port)) = value << 8;
85 else
86 *(port2adr(port)) = value;
87 ctrl_delay();
88}
89
90void se_outw(unsigned short value, unsigned long port)
91{
92 if (port >= 0x2000)
93 *port2adr(port) = value;
94 else
95 maybebadio(port);
96}
97
98void se_outl(unsigned int value, unsigned long port)
99{
100 maybebadio(port);
101}
102
103void se_insb(unsigned long port, void *addr, unsigned long count)
104{
105 volatile __u16 *p = port2adr(port);
106 __u8 *ap = addr;
107
108 if (shifted_port(port)) {
109 while (count--)
110 *ap++ = *p >> 8;
111 } else {
112 while (count--)
113 *ap++ = *p;
114 }
115}
116
117void se_insw(unsigned long port, void *addr, unsigned long count)
118{
119 volatile __u16 *p = port2adr(port);
120 __u16 *ap = addr;
121 while (count--)
122 *ap++ = *p;
123}
124
125void se_insl(unsigned long port, void *addr, unsigned long count)
126{
127 maybebadio(port);
128}
129
130void se_outsb(unsigned long port, const void *addr, unsigned long count)
131{
132 volatile __u16 *p = port2adr(port);
133 const __u8 *ap = addr;
134
135 if (shifted_port(port)) {
136 while (count--)
137 *p = *ap++ << 8;
138 } else {
139 while (count--)
140 *p = *ap++;
141 }
142}
143
144void se_outsw(unsigned long port, const void *addr, unsigned long count)
145{
146 volatile __u16 *p = port2adr(port);
147 const __u16 *ap = addr;
148
149 while (count--)
150 *p = *ap++;
151}
152
153void se_outsl(unsigned long port, const void *addr, unsigned long count)
154{
155 maybebadio(port);
156}
diff --git a/arch/sh/boards/mach-se/770x/setup.c b/arch/sh/boards/mach-se/770x/setup.c
index 66d39d1b0901..31330c65c0ce 100644
--- a/arch/sh/boards/mach-se/770x/setup.c
+++ b/arch/sh/boards/mach-se/770x/setup.c
@@ -195,27 +195,5 @@ static struct sh_machine_vector mv_se __initmv = {
195#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712) 195#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
196 .mv_nr_irqs = 104, 196 .mv_nr_irqs = 104,
197#endif 197#endif
198
199 .mv_inb = se_inb,
200 .mv_inw = se_inw,
201 .mv_inl = se_inl,
202 .mv_outb = se_outb,
203 .mv_outw = se_outw,
204 .mv_outl = se_outl,
205
206 .mv_inb_p = se_inb_p,
207 .mv_inw_p = se_inw,
208 .mv_inl_p = se_inl,
209 .mv_outb_p = se_outb_p,
210 .mv_outw_p = se_outw,
211 .mv_outl_p = se_outl,
212
213 .mv_insb = se_insb,
214 .mv_insw = se_insw,
215 .mv_insl = se_insl,
216 .mv_outsb = se_outsb,
217 .mv_outsw = se_outsw,
218 .mv_outsl = se_outsl,
219
220 .mv_init_irq = init_se_IRQ, 198 .mv_init_irq = init_se_IRQ,
221}; 199};
diff --git a/arch/sh/boards/mach-se/7722/irq.c b/arch/sh/boards/mach-se/7722/irq.c
index 61605db04ee6..c013f95628ed 100644
--- a/arch/sh/boards/mach-se/7722/irq.c
+++ b/arch/sh/boards/mach-se/7722/irq.c
@@ -18,23 +18,22 @@
18 18
19unsigned int se7722_fpga_irq[SE7722_FPGA_IRQ_NR] = { 0, }; 19unsigned int se7722_fpga_irq[SE7722_FPGA_IRQ_NR] = { 0, };
20 20
21static void disable_se7722_irq(unsigned int irq) 21static void disable_se7722_irq(struct irq_data *data)
22{ 22{
23 unsigned int bit = (unsigned int)get_irq_chip_data(irq); 23 unsigned int bit = (unsigned int)irq_data_get_irq_chip_data(data);
24 __raw_writew(__raw_readw(IRQ01_MASK) | 1 << bit, IRQ01_MASK); 24 __raw_writew(__raw_readw(IRQ01_MASK) | 1 << bit, IRQ01_MASK);
25} 25}
26 26
27static void enable_se7722_irq(unsigned int irq) 27static void enable_se7722_irq(struct irq_data *data)
28{ 28{
29 unsigned int bit = (unsigned int)get_irq_chip_data(irq); 29 unsigned int bit = (unsigned int)irq_data_get_irq_chip_data(data);
30 __raw_writew(__raw_readw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK); 30 __raw_writew(__raw_readw(IRQ01_MASK) & ~(1 << bit), IRQ01_MASK);
31} 31}
32 32
33static struct irq_chip se7722_irq_chip __read_mostly = { 33static struct irq_chip se7722_irq_chip __read_mostly = {
34 .name = "SE7722-FPGA", 34 .name = "SE7722-FPGA",
35 .mask = disable_se7722_irq, 35 .irq_mask = disable_se7722_irq,
36 .unmask = enable_se7722_irq, 36 .irq_unmask = enable_se7722_irq,
37 .mask_ack = disable_se7722_irq,
38}; 37};
39 38
40static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc) 39static void se7722_irq_demux(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/sh/boards/mach-se/7724/irq.c b/arch/sh/boards/mach-se/7724/irq.c
index 0942be2daef6..5bd87c22b65b 100644
--- a/arch/sh/boards/mach-se/7724/irq.c
+++ b/arch/sh/boards/mach-se/7724/irq.c
@@ -68,25 +68,26 @@ static struct fpga_irq get_fpga_irq(unsigned int irq)
68 return set; 68 return set;
69} 69}
70 70
71static void disable_se7724_irq(unsigned int irq) 71static void disable_se7724_irq(struct irq_data *data)
72{ 72{
73 unsigned int irq = data->irq;
73 struct fpga_irq set = get_fpga_irq(fpga2irq(irq)); 74 struct fpga_irq set = get_fpga_irq(fpga2irq(irq));
74 unsigned int bit = irq - set.base; 75 unsigned int bit = irq - set.base;
75 __raw_writew(__raw_readw(set.mraddr) | 0x0001 << bit, set.mraddr); 76 __raw_writew(__raw_readw(set.mraddr) | 0x0001 << bit, set.mraddr);
76} 77}
77 78
78static void enable_se7724_irq(unsigned int irq) 79static void enable_se7724_irq(struct irq_data *data)
79{ 80{
81 unsigned int irq = data->irq;
80 struct fpga_irq set = get_fpga_irq(fpga2irq(irq)); 82 struct fpga_irq set = get_fpga_irq(fpga2irq(irq));
81 unsigned int bit = irq - set.base; 83 unsigned int bit = irq - set.base;
82 __raw_writew(__raw_readw(set.mraddr) & ~(0x0001 << bit), set.mraddr); 84 __raw_writew(__raw_readw(set.mraddr) & ~(0x0001 << bit), set.mraddr);
83} 85}
84 86
85static struct irq_chip se7724_irq_chip __read_mostly = { 87static struct irq_chip se7724_irq_chip __read_mostly = {
86 .name = "SE7724-FPGA", 88 .name = "SE7724-FPGA",
87 .mask = disable_se7724_irq, 89 .irq_mask = disable_se7724_irq,
88 .unmask = enable_se7724_irq, 90 .irq_unmask = enable_se7724_irq,
89 .mask_ack = disable_se7724_irq,
90}; 91};
91 92
92static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc) 93static void se7724_irq_demux(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 552ebd9ba82b..c31d228fdfc6 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -144,16 +144,42 @@ static struct platform_device nor_flash_device = {
144}; 144};
145 145
146/* LCDC */ 146/* LCDC */
147const static struct fb_videomode lcdc_720p_modes[] = {
148 {
149 .name = "LB070WV1",
150 .sync = 0, /* hsync and vsync are active low */
151 .xres = 1280,
152 .yres = 720,
153 .left_margin = 220,
154 .right_margin = 110,
155 .hsync_len = 40,
156 .upper_margin = 20,
157 .lower_margin = 5,
158 .vsync_len = 5,
159 },
160};
161
162const static struct fb_videomode lcdc_vga_modes[] = {
163 {
164 .name = "LB070WV1",
165 .sync = 0, /* hsync and vsync are active low */
166 .xres = 640,
167 .yres = 480,
168 .left_margin = 105,
169 .right_margin = 50,
170 .hsync_len = 96,
171 .upper_margin = 33,
172 .lower_margin = 10,
173 .vsync_len = 2,
174 },
175};
176
147static struct sh_mobile_lcdc_info lcdc_info = { 177static struct sh_mobile_lcdc_info lcdc_info = {
148 .clock_source = LCDC_CLK_EXTERNAL, 178 .clock_source = LCDC_CLK_EXTERNAL,
149 .ch[0] = { 179 .ch[0] = {
150 .chan = LCDC_CHAN_MAINLCD, 180 .chan = LCDC_CHAN_MAINLCD,
151 .bpp = 16, 181 .bpp = 16,
152 .clock_divider = 1, 182 .clock_divider = 1,
153 .lcd_cfg = {
154 .name = "LB070WV1",
155 .sync = 0, /* hsync and vsync are active low */
156 },
157 .lcd_size_cfg = { /* 7.0 inch */ 183 .lcd_size_cfg = { /* 7.0 inch */
158 .width = 152, 184 .width = 152,
159 .height = 91, 185 .height = 91,
@@ -550,7 +576,6 @@ static struct sh_vou_pdata sh_vou_pdata = {
550 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW, 576 .flags = SH_VOU_HSYNC_LOW | SH_VOU_VSYNC_LOW,
551 .board_info = &ak8813, 577 .board_info = &ak8813,
552 .i2c_adap = 0, 578 .i2c_adap = 0,
553 .module_name = "ak881x",
554}; 579};
555 580
556static struct resource sh_vou_resources[] = { 581static struct resource sh_vou_resources[] = {
@@ -909,24 +934,12 @@ static int __init devices_setup(void)
909 934
910 if (sw & SW41_B) { 935 if (sw & SW41_B) {
911 /* 720p */ 936 /* 720p */
912 lcdc_info.ch[0].lcd_cfg.xres = 1280; 937 lcdc_info.ch[0].lcd_cfg = lcdc_720p_modes;
913 lcdc_info.ch[0].lcd_cfg.yres = 720; 938 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_720p_modes);
914 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
915 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
916 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
917 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
918 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
919 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
920 } else { 939 } else {
921 /* VGA */ 940 /* VGA */
922 lcdc_info.ch[0].lcd_cfg.xres = 640; 941 lcdc_info.ch[0].lcd_cfg = lcdc_vga_modes;
923 lcdc_info.ch[0].lcd_cfg.yres = 480; 942 lcdc_info.ch[0].num_cfg = ARRAY_SIZE(lcdc_vga_modes);
924 lcdc_info.ch[0].lcd_cfg.left_margin = 105;
925 lcdc_info.ch[0].lcd_cfg.right_margin = 50;
926 lcdc_info.ch[0].lcd_cfg.hsync_len = 96;
927 lcdc_info.ch[0].lcd_cfg.upper_margin = 33;
928 lcdc_info.ch[0].lcd_cfg.lower_margin = 10;
929 lcdc_info.ch[0].lcd_cfg.vsync_len = 2;
930 } 943 }
931 944
932 if (sw & SW41_A) { 945 if (sw & SW41_A) {
diff --git a/arch/sh/boards/mach-se/7751/Makefile b/arch/sh/boards/mach-se/7751/Makefile
index e6f4341bfe6e..a338fd9d5039 100644
--- a/arch/sh/boards/mach-se/7751/Makefile
+++ b/arch/sh/boards/mach-se/7751/Makefile
@@ -2,4 +2,4 @@
2# Makefile for the 7751 SolutionEngine specific parts of the kernel 2# Makefile for the 7751 SolutionEngine specific parts of the kernel
3# 3#
4 4
5obj-y := setup.o io.o irq.o 5obj-y := setup.o irq.o
diff --git a/arch/sh/boards/mach-se/7751/io.c b/arch/sh/boards/mach-se/7751/io.c
deleted file mode 100644
index 6e75bd4459e5..000000000000
--- a/arch/sh/boards/mach-se/7751/io.c
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
3 * Based largely on io_se.c.
4 *
5 * I/O routine for Hitachi 7751 SolutionEngine.
6 *
7 * Initial version only to support LAN access; some
8 * placeholder code from io_se.c left in with the
9 * expectation of later SuperIO and PCMCIA access.
10 */
11#include <linux/kernel.h>
12#include <linux/types.h>
13#include <linux/pci.h>
14#include <asm/io.h>
15#include <mach-se/mach/se7751.h>
16#include <asm/addrspace.h>
17
18static inline volatile u16 *port2adr(unsigned int port)
19{
20 if (port >= 0x2000)
21 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
22 maybebadio((unsigned long)port);
23 return (volatile __u16*)port;
24}
25
26/*
27 * General outline: remap really low stuff [eventually] to SuperIO,
28 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
29 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
30 * should be way beyond the window, and is used w/o translation for
31 * compatibility.
32 */
33unsigned char sh7751se_inb(unsigned long port)
34{
35 if (PXSEG(port))
36 return *(volatile unsigned char *)port;
37 else
38 return (*port2adr(port)) & 0xff;
39}
40
41unsigned char sh7751se_inb_p(unsigned long port)
42{
43 unsigned char v;
44
45 if (PXSEG(port))
46 v = *(volatile unsigned char *)port;
47 else
48 v = (*port2adr(port)) & 0xff;
49 ctrl_delay();
50 return v;
51}
52
53unsigned short sh7751se_inw(unsigned long port)
54{
55 if (PXSEG(port))
56 return *(volatile unsigned short *)port;
57 else if (port >= 0x2000)
58 return *port2adr(port);
59 else
60 maybebadio(port);
61 return 0;
62}
63
64unsigned int sh7751se_inl(unsigned long port)
65{
66 if (PXSEG(port))
67 return *(volatile unsigned long *)port;
68 else if (port >= 0x2000)
69 return *port2adr(port);
70 else
71 maybebadio(port);
72 return 0;
73}
74
75void sh7751se_outb(unsigned char value, unsigned long port)
76{
77
78 if (PXSEG(port))
79 *(volatile unsigned char *)port = value;
80 else
81 *(port2adr(port)) = value;
82}
83
84void sh7751se_outb_p(unsigned char value, unsigned long port)
85{
86 if (PXSEG(port))
87 *(volatile unsigned char *)port = value;
88 else
89 *(port2adr(port)) = value;
90 ctrl_delay();
91}
92
93void sh7751se_outw(unsigned short value, unsigned long port)
94{
95 if (PXSEG(port))
96 *(volatile unsigned short *)port = value;
97 else if (port >= 0x2000)
98 *port2adr(port) = value;
99 else
100 maybebadio(port);
101}
102
103void sh7751se_outl(unsigned int value, unsigned long port)
104{
105 if (PXSEG(port))
106 *(volatile unsigned long *)port = value;
107 else
108 maybebadio(port);
109}
110
111void sh7751se_insl(unsigned long port, void *addr, unsigned long count)
112{
113 maybebadio(port);
114}
115
116void sh7751se_outsl(unsigned long port, const void *addr, unsigned long count)
117{
118 maybebadio(port);
119}
diff --git a/arch/sh/boards/mach-se/7751/setup.c b/arch/sh/boards/mach-se/7751/setup.c
index 50572512e3e8..9fbc51beb181 100644
--- a/arch/sh/boards/mach-se/7751/setup.c
+++ b/arch/sh/boards/mach-se/7751/setup.c
@@ -56,23 +56,5 @@ __initcall(se7751_devices_setup);
56static struct sh_machine_vector mv_7751se __initmv = { 56static struct sh_machine_vector mv_7751se __initmv = {
57 .mv_name = "7751 SolutionEngine", 57 .mv_name = "7751 SolutionEngine",
58 .mv_nr_irqs = 72, 58 .mv_nr_irqs = 72,
59
60 .mv_inb = sh7751se_inb,
61 .mv_inw = sh7751se_inw,
62 .mv_inl = sh7751se_inl,
63 .mv_outb = sh7751se_outb,
64 .mv_outw = sh7751se_outw,
65 .mv_outl = sh7751se_outl,
66
67 .mv_inb_p = sh7751se_inb_p,
68 .mv_inw_p = sh7751se_inw,
69 .mv_inl_p = sh7751se_inl,
70 .mv_outb_p = sh7751se_outb_p,
71 .mv_outw_p = sh7751se_outw,
72 .mv_outl_p = sh7751se_outl,
73
74 .mv_insl = sh7751se_insl,
75 .mv_outsl = sh7751se_outsl,
76
77 .mv_init_irq = init_7751se_IRQ, 59 .mv_init_irq = init_7751se_IRQ,
78}; 60};
diff --git a/arch/sh/boards/mach-snapgear/Makefile b/arch/sh/boards/mach-snapgear/Makefile
deleted file mode 100644
index d2d2f4b6a502..000000000000
--- a/arch/sh/boards/mach-snapgear/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the SnapGear specific parts of the kernel
3#
4
5obj-y := setup.o io.o
diff --git a/arch/sh/boards/mach-snapgear/io.c b/arch/sh/boards/mach-snapgear/io.c
deleted file mode 100644
index 476650e42dbc..000000000000
--- a/arch/sh/boards/mach-snapgear/io.c
+++ /dev/null
@@ -1,121 +0,0 @@
1/*
2 * Copyright (C) 2002 David McCullough <davidm@snapgear.com>
3 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
4 * Based largely on io_se.c.
5 *
6 * I/O routine for Hitachi 7751 SolutionEngine.
7 *
8 * Initial version only to support LAN access; some
9 * placeholder code from io_se.c left in with the
10 * expectation of later SuperIO and PCMCIA access.
11 */
12#include <linux/kernel.h>
13#include <linux/types.h>
14#include <linux/pci.h>
15#include <asm/io.h>
16#include <asm/addrspace.h>
17
18#ifdef CONFIG_SH_SECUREEDGE5410
19unsigned short secureedge5410_ioport;
20#endif
21
22static inline volatile __u16 *port2adr(unsigned int port)
23{
24 maybebadio((unsigned long)port);
25 return (volatile __u16*)port;
26}
27
28/*
29 * General outline: remap really low stuff [eventually] to SuperIO,
30 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
31 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
32 * should be way beyond the window, and is used w/o translation for
33 * compatibility.
34 */
35unsigned char snapgear_inb(unsigned long port)
36{
37 if (PXSEG(port))
38 return *(volatile unsigned char *)port;
39 else
40 return (*port2adr(port)) & 0xff;
41}
42
43unsigned char snapgear_inb_p(unsigned long port)
44{
45 unsigned char v;
46
47 if (PXSEG(port))
48 v = *(volatile unsigned char *)port;
49 else
50 v = (*port2adr(port))&0xff;
51 ctrl_delay();
52 return v;
53}
54
55unsigned short snapgear_inw(unsigned long port)
56{
57 if (PXSEG(port))
58 return *(volatile unsigned short *)port;
59 else if (port >= 0x2000)
60 return *port2adr(port);
61 else
62 maybebadio(port);
63 return 0;
64}
65
66unsigned int snapgear_inl(unsigned long port)
67{
68 if (PXSEG(port))
69 return *(volatile unsigned long *)port;
70 else if (port >= 0x2000)
71 return *port2adr(port);
72 else
73 maybebadio(port);
74 return 0;
75}
76
77void snapgear_outb(unsigned char value, unsigned long port)
78{
79
80 if (PXSEG(port))
81 *(volatile unsigned char *)port = value;
82 else
83 *(port2adr(port)) = value;
84}
85
86void snapgear_outb_p(unsigned char value, unsigned long port)
87{
88 if (PXSEG(port))
89 *(volatile unsigned char *)port = value;
90 else
91 *(port2adr(port)) = value;
92 ctrl_delay();
93}
94
95void snapgear_outw(unsigned short value, unsigned long port)
96{
97 if (PXSEG(port))
98 *(volatile unsigned short *)port = value;
99 else if (port >= 0x2000)
100 *port2adr(port) = value;
101 else
102 maybebadio(port);
103}
104
105void snapgear_outl(unsigned int value, unsigned long port)
106{
107 if (PXSEG(port))
108 *(volatile unsigned long *)port = value;
109 else
110 maybebadio(port);
111}
112
113void snapgear_insl(unsigned long port, void *addr, unsigned long count)
114{
115 maybebadio(port);
116}
117
118void snapgear_outsl(unsigned long port, const void *addr, unsigned long count)
119{
120 maybebadio(port);
121}
diff --git a/arch/sh/boards/mach-systemh/Makefile b/arch/sh/boards/mach-systemh/Makefile
deleted file mode 100644
index 2cc6a23d9d39..000000000000
--- a/arch/sh/boards/mach-systemh/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
1#
2# Makefile for the SystemH specific parts of the kernel
3#
4
5obj-y := setup.o irq.o io.o
6
7# XXX: This wants to be consolidated in arch/sh/drivers/pci, and more
8# importantly, with the generic sh7751_pcic_init() code. For now, we'll
9# just abuse the hell out of kbuild, because we can..
10
11obj-$(CONFIG_PCI) += pci.o
12pci-y := ../../se/7751/pci.o
13
diff --git a/arch/sh/boards/mach-systemh/io.c b/arch/sh/boards/mach-systemh/io.c
deleted file mode 100644
index 15577ff1f715..000000000000
--- a/arch/sh/boards/mach-systemh/io.c
+++ /dev/null
@@ -1,158 +0,0 @@
1/*
2 * linux/arch/sh/boards/renesas/systemh/io.c
3 *
4 * Copyright (C) 2001 Ian da Silva, Jeremy Siegel
5 * Based largely on io_se.c.
6 *
7 * I/O routine for Hitachi 7751 Systemh.
8 */
9#include <linux/kernel.h>
10#include <linux/types.h>
11#include <linux/pci.h>
12#include <mach/systemh7751.h>
13#include <asm/addrspace.h>
14#include <asm/io.h>
15
16#define ETHER_IOMAP(adr) (0xB3000000 + (adr)) /*map to 16bits access area
17 of smc lan chip*/
18static inline volatile __u16 *
19port2adr(unsigned int port)
20{
21 if (port >= 0x2000)
22 return (volatile __u16 *) (PA_MRSHPC + (port - 0x2000));
23 maybebadio((unsigned long)port);
24 return (volatile __u16*)port;
25}
26
27/*
28 * General outline: remap really low stuff [eventually] to SuperIO,
29 * stuff in PCI IO space (at or above window at pci.h:PCIBIOS_MIN_IO)
30 * is mapped through the PCI IO window. Stuff with high bits (PXSEG)
31 * should be way beyond the window, and is used w/o translation for
32 * compatibility.
33 */
34unsigned char sh7751systemh_inb(unsigned long port)
35{
36 if (PXSEG(port))
37 return *(volatile unsigned char *)port;
38 else if (port <= 0x3F1)
39 return *(volatile unsigned char *)ETHER_IOMAP(port);
40 else
41 return (*port2adr(port))&0xff;
42}
43
44unsigned char sh7751systemh_inb_p(unsigned long port)
45{
46 unsigned char v;
47
48 if (PXSEG(port))
49 v = *(volatile unsigned char *)port;
50 else if (port <= 0x3F1)
51 v = *(volatile unsigned char *)ETHER_IOMAP(port);
52 else
53 v = (*port2adr(port))&0xff;
54 ctrl_delay();
55 return v;
56}
57
58unsigned short sh7751systemh_inw(unsigned long port)
59{
60 if (PXSEG(port))
61 return *(volatile unsigned short *)port;
62 else if (port >= 0x2000)
63 return *port2adr(port);
64 else if (port <= 0x3F1)
65 return *(volatile unsigned int *)ETHER_IOMAP(port);
66 else
67 maybebadio(port);
68 return 0;
69}
70
71unsigned int sh7751systemh_inl(unsigned long port)
72{
73 if (PXSEG(port))
74 return *(volatile unsigned long *)port;
75 else if (port >= 0x2000)
76 return *port2adr(port);
77 else if (port <= 0x3F1)
78 return *(volatile unsigned int *)ETHER_IOMAP(port);
79 else
80 maybebadio(port);
81 return 0;
82}
83
84void sh7751systemh_outb(unsigned char value, unsigned long port)
85{
86
87 if (PXSEG(port))
88 *(volatile unsigned char *)port = value;
89 else if (port <= 0x3F1)
90 *(volatile unsigned char *)ETHER_IOMAP(port) = value;
91 else
92 *(port2adr(port)) = value;
93}
94
95void sh7751systemh_outb_p(unsigned char value, unsigned long port)
96{
97 if (PXSEG(port))
98 *(volatile unsigned char *)port = value;
99 else if (port <= 0x3F1)
100 *(volatile unsigned char *)ETHER_IOMAP(port) = value;
101 else
102 *(port2adr(port)) = value;
103 ctrl_delay();
104}
105
106void sh7751systemh_outw(unsigned short value, unsigned long port)
107{
108 if (PXSEG(port))
109 *(volatile unsigned short *)port = value;
110 else if (port >= 0x2000)
111 *port2adr(port) = value;
112 else if (port <= 0x3F1)
113 *(volatile unsigned short *)ETHER_IOMAP(port) = value;
114 else
115 maybebadio(port);
116}
117
118void sh7751systemh_outl(unsigned int value, unsigned long port)
119{
120 if (PXSEG(port))
121 *(volatile unsigned long *)port = value;
122 else
123 maybebadio(port);
124}
125
126void sh7751systemh_insb(unsigned long port, void *addr, unsigned long count)
127{
128 unsigned char *p = addr;
129 while (count--) *p++ = sh7751systemh_inb(port);
130}
131
132void sh7751systemh_insw(unsigned long port, void *addr, unsigned long count)
133{
134 unsigned short *p = addr;
135 while (count--) *p++ = sh7751systemh_inw(port);
136}
137
138void sh7751systemh_insl(unsigned long port, void *addr, unsigned long count)
139{
140 maybebadio(port);
141}
142
143void sh7751systemh_outsb(unsigned long port, const void *addr, unsigned long count)
144{
145 unsigned char *p = (unsigned char*)addr;
146 while (count--) sh7751systemh_outb(*p++, port);
147}
148
149void sh7751systemh_outsw(unsigned long port, const void *addr, unsigned long count)
150{
151 unsigned short *p = (unsigned short*)addr;
152 while (count--) sh7751systemh_outw(*p++, port);
153}
154
155void sh7751systemh_outsl(unsigned long port, const void *addr, unsigned long count)
156{
157 maybebadio(port);
158}
diff --git a/arch/sh/boards/mach-systemh/irq.c b/arch/sh/boards/mach-systemh/irq.c
deleted file mode 100644
index 523aea5dc94e..000000000000
--- a/arch/sh/boards/mach-systemh/irq.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * linux/arch/sh/boards/renesas/systemh/irq.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 *
6 * Hitachi SystemH Support.
7 *
8 * Modified for 7751 SystemH by
9 * Jonathan Short.
10 */
11
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <linux/interrupt.h>
15#include <linux/io.h>
16
17#include <mach/systemh7751.h>
18#include <asm/smc37c93x.h>
19
20/* address of external interrupt mask register
21 * address must be set prior to use these (maybe in init_XXX_irq())
22 * XXX : is it better to use .config than specifying it in code? */
23static unsigned long *systemh_irq_mask_register = (unsigned long *)0xB3F10004;
24static unsigned long *systemh_irq_request_register = (unsigned long *)0xB3F10000;
25
26/* forward declaration */
27static void enable_systemh_irq(unsigned int irq);
28static void disable_systemh_irq(unsigned int irq);
29static void mask_and_ack_systemh(unsigned int);
30
31static struct irq_chip systemh_irq_type = {
32 .name = " SystemH Register",
33 .unmask = enable_systemh_irq,
34 .mask = disable_systemh_irq,
35 .ack = mask_and_ack_systemh,
36};
37
38static void disable_systemh_irq(unsigned int irq)
39{
40 if (systemh_irq_mask_register) {
41 unsigned long val, mask = 0x01 << 1;
42
43 /* Clear the "irq"th bit in the mask and set it in the request */
44 val = __raw_readl((unsigned long)systemh_irq_mask_register);
45 val &= ~mask;
46 __raw_writel(val, (unsigned long)systemh_irq_mask_register);
47
48 val = __raw_readl((unsigned long)systemh_irq_request_register);
49 val |= mask;
50 __raw_writel(val, (unsigned long)systemh_irq_request_register);
51 }
52}
53
54static void enable_systemh_irq(unsigned int irq)
55{
56 if (systemh_irq_mask_register) {
57 unsigned long val, mask = 0x01 << 1;
58
59 /* Set "irq"th bit in the mask register */
60 val = __raw_readl((unsigned long)systemh_irq_mask_register);
61 val |= mask;
62 __raw_writel(val, (unsigned long)systemh_irq_mask_register);
63 }
64}
65
66static void mask_and_ack_systemh(unsigned int irq)
67{
68 disable_systemh_irq(irq);
69}
70
71void make_systemh_irq(unsigned int irq)
72{
73 disable_irq_nosync(irq);
74 set_irq_chip_and_handler(irq, &systemh_irq_type, handle_level_irq);
75 disable_systemh_irq(irq);
76}
diff --git a/arch/sh/boards/mach-systemh/setup.c b/arch/sh/boards/mach-systemh/setup.c
deleted file mode 100644
index 219fd800a43f..000000000000
--- a/arch/sh/boards/mach-systemh/setup.c
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/arch/sh/boards/renesas/systemh/setup.c
3 *
4 * Copyright (C) 2000 Kazumoto Kojima
5 * Copyright (C) 2003 Paul Mundt
6 *
7 * Hitachi SystemH Support.
8 *
9 * Modified for 7751 SystemH by Jonathan Short.
10 *
11 * Rewritten for 2.6 by Paul Mundt.
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 */
17#include <linux/init.h>
18#include <asm/machvec.h>
19#include <mach/systemh7751.h>
20
21extern void make_systemh_irq(unsigned int irq);
22
23/*
24 * Initialize IRQ setting
25 */
26static void __init sh7751systemh_init_irq(void)
27{
28 make_systemh_irq(0xb); /* Ethernet interrupt */
29}
30
31static struct sh_machine_vector mv_7751systemh __initmv = {
32 .mv_name = "7751 SystemH",
33 .mv_nr_irqs = 72,
34
35 .mv_inb = sh7751systemh_inb,
36 .mv_inw = sh7751systemh_inw,
37 .mv_inl = sh7751systemh_inl,
38 .mv_outb = sh7751systemh_outb,
39 .mv_outw = sh7751systemh_outw,
40 .mv_outl = sh7751systemh_outl,
41
42 .mv_inb_p = sh7751systemh_inb_p,
43 .mv_inw_p = sh7751systemh_inw,
44 .mv_inl_p = sh7751systemh_inl,
45 .mv_outb_p = sh7751systemh_outb_p,
46 .mv_outw_p = sh7751systemh_outw,
47 .mv_outl_p = sh7751systemh_outl,
48
49 .mv_insb = sh7751systemh_insb,
50 .mv_insw = sh7751systemh_insw,
51 .mv_insl = sh7751systemh_insl,
52 .mv_outsb = sh7751systemh_outsb,
53 .mv_outsw = sh7751systemh_outsw,
54 .mv_outsl = sh7751systemh_outsl,
55
56 .mv_init_irq = sh7751systemh_init_irq,
57};
diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c
index 594adf76e46a..239e74066253 100644
--- a/arch/sh/boards/mach-x3proto/gpio.c
+++ b/arch/sh/boards/mach-x3proto/gpio.c
@@ -54,18 +54,19 @@ static int x3proto_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)
54 54
55static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 55static void x3proto_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
56{ 56{
57 struct irq_chip *chip = get_irq_desc_chip(desc); 57 struct irq_data *data = irq_get_irq_data(irq);
58 struct irq_chip *chip = irq_data_get_irq_chip(data);
58 unsigned long mask; 59 unsigned long mask;
59 int pin; 60 int pin;
60 61
61 chip->mask_ack(irq); 62 chip->irq_mask_ack(data);
62 63
63 mask = __raw_readw(KEYDETR); 64 mask = __raw_readw(KEYDETR);
64 65
65 for_each_set_bit(pin, &mask, NR_BASEBOARD_GPIOS) 66 for_each_set_bit(pin, &mask, NR_BASEBOARD_GPIOS)
66 generic_handle_irq(x3proto_gpio_to_irq(NULL, pin)); 67 generic_handle_irq(x3proto_gpio_to_irq(NULL, pin));
67 68
68 chip->unmask(irq); 69 chip->irq_unmask(data);
69} 70}
70 71
71struct gpio_chip x3proto_gpio_chip = { 72struct gpio_chip x3proto_gpio_chip = {
diff --git a/arch/sh/cchips/hd6446x/hd64461.c b/arch/sh/cchips/hd6446x/hd64461.c
index bcb31ae84a51..177a10b25cad 100644
--- a/arch/sh/cchips/hd6446x/hd64461.c
+++ b/arch/sh/cchips/hd6446x/hd64461.c
@@ -17,8 +17,9 @@
17/* This belongs in cpu specific */ 17/* This belongs in cpu specific */
18#define INTC_ICR1 0xA4140010UL 18#define INTC_ICR1 0xA4140010UL
19 19
20static void hd64461_mask_irq(unsigned int irq) 20static void hd64461_mask_irq(struct irq_data *data)
21{ 21{
22 unsigned int irq = data->irq;
22 unsigned short nimr; 23 unsigned short nimr;
23 unsigned short mask = 1 << (irq - HD64461_IRQBASE); 24 unsigned short mask = 1 << (irq - HD64461_IRQBASE);
24 25
@@ -27,8 +28,9 @@ static void hd64461_mask_irq(unsigned int irq)
27 __raw_writew(nimr, HD64461_NIMR); 28 __raw_writew(nimr, HD64461_NIMR);
28} 29}
29 30
30static void hd64461_unmask_irq(unsigned int irq) 31static void hd64461_unmask_irq(struct irq_data *data)
31{ 32{
33 unsigned int irq = data->irq;
32 unsigned short nimr; 34 unsigned short nimr;
33 unsigned short mask = 1 << (irq - HD64461_IRQBASE); 35 unsigned short mask = 1 << (irq - HD64461_IRQBASE);
34 36
@@ -37,20 +39,21 @@ static void hd64461_unmask_irq(unsigned int irq)
37 __raw_writew(nimr, HD64461_NIMR); 39 __raw_writew(nimr, HD64461_NIMR);
38} 40}
39 41
40static void hd64461_mask_and_ack_irq(unsigned int irq) 42static void hd64461_mask_and_ack_irq(struct irq_data *data)
41{ 43{
42 hd64461_mask_irq(irq); 44 hd64461_mask_irq(data);
45
43#ifdef CONFIG_HD64461_ENABLER 46#ifdef CONFIG_HD64461_ENABLER
44 if (irq == HD64461_IRQBASE + 13) 47 if (data->irq == HD64461_IRQBASE + 13)
45 __raw_writeb(0x00, HD64461_PCC1CSCR); 48 __raw_writeb(0x00, HD64461_PCC1CSCR);
46#endif 49#endif
47} 50}
48 51
49static struct irq_chip hd64461_irq_chip = { 52static struct irq_chip hd64461_irq_chip = {
50 .name = "HD64461-IRQ", 53 .name = "HD64461-IRQ",
51 .mask = hd64461_mask_irq, 54 .irq_mask = hd64461_mask_irq,
52 .mask_ack = hd64461_mask_and_ack_irq, 55 .irq_mask_ack = hd64461_mask_and_ack_irq,
53 .unmask = hd64461_unmask_irq, 56 .irq_unmask = hd64461_unmask_irq,
54}; 57};
55 58
56static void hd64461_irq_demux(unsigned int irq, struct irq_desc *desc) 59static void hd64461_irq_demux(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/sh/configs/snapgear_defconfig b/arch/sh/configs/secureedge5410_defconfig
index 7eae4e59d7f0..7eae4e59d7f0 100644
--- a/arch/sh/configs/snapgear_defconfig
+++ b/arch/sh/configs/secureedge5410_defconfig
diff --git a/arch/sh/configs/systemh_defconfig b/arch/sh/configs/systemh_defconfig
deleted file mode 100644
index b58dfc505efe..000000000000
--- a/arch/sh/configs/systemh_defconfig
+++ /dev/null
@@ -1,28 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_LOG_BUF_SHIFT=14
3CONFIG_BLK_DEV_INITRD=y
4# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
5# CONFIG_SYSCTL_SYSCALL is not set
6# CONFIG_HOTPLUG is not set
7CONFIG_SLAB=y
8CONFIG_MODULES=y
9CONFIG_MODULE_UNLOAD=y
10# CONFIG_BLK_DEV_BSG is not set
11CONFIG_CPU_SUBTYPE_SH7751R=y
12CONFIG_MEMORY_START=0x0c000000
13CONFIG_MEMORY_SIZE=0x00400000
14CONFIG_FLATMEM_MANUAL=y
15CONFIG_SH_7751_SYSTEMH=y
16CONFIG_PREEMPT=y
17# CONFIG_STANDALONE is not set
18CONFIG_BLK_DEV_RAM=y
19CONFIG_BLK_DEV_RAM_SIZE=1024
20# CONFIG_INPUT is not set
21# CONFIG_SERIO_SERPORT is not set
22# CONFIG_VT is not set
23CONFIG_HW_RANDOM=y
24CONFIG_PROC_KCORE=y
25CONFIG_TMPFS=y
26CONFIG_CRAMFS=y
27CONFIG_ROMFS_FS=y
28# CONFIG_RCU_CPU_STALL_DETECTOR is not set
diff --git a/arch/sh/include/asm/addrspace.h b/arch/sh/include/asm/addrspace.h
index 446b3831c214..3d1ae2bfaa6f 100644
--- a/arch/sh/include/asm/addrspace.h
+++ b/arch/sh/include/asm/addrspace.h
@@ -44,10 +44,10 @@
44/* 44/*
45 * These will never work in 32-bit, don't even bother. 45 * These will never work in 32-bit, don't even bother.
46 */ 46 */
47#define P1SEGADDR(a) __futile_remapping_attempt 47#define P1SEGADDR(a) ({ (void)(a); BUG(); NULL; })
48#define P2SEGADDR(a) __futile_remapping_attempt 48#define P2SEGADDR(a) ({ (void)(a); BUG(); NULL; })
49#define P3SEGADDR(a) __futile_remapping_attempt 49#define P3SEGADDR(a) ({ (void)(a); BUG(); NULL; })
50#define P4SEGADDR(a) __futile_remapping_attempt 50#define P4SEGADDR(a) ({ (void)(a); BUG(); NULL; })
51#endif 51#endif
52#endif /* P1SEG */ 52#endif /* P1SEG */
53 53
diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h
index 02f77450cd8f..083ea068e819 100644
--- a/arch/sh/include/asm/pgtable.h
+++ b/arch/sh/include/asm/pgtable.h
@@ -66,7 +66,6 @@ static inline unsigned long long neff_sign_extend(unsigned long val)
66#define PHYS_ADDR_MASK29 0x1fffffff 66#define PHYS_ADDR_MASK29 0x1fffffff
67#define PHYS_ADDR_MASK32 0xffffffff 67#define PHYS_ADDR_MASK32 0xffffffff
68 68
69#ifdef CONFIG_PMB
70static inline unsigned long phys_addr_mask(void) 69static inline unsigned long phys_addr_mask(void)
71{ 70{
72 /* Is the MMU in 29bit mode? */ 71 /* Is the MMU in 29bit mode? */
@@ -75,17 +74,6 @@ static inline unsigned long phys_addr_mask(void)
75 74
76 return PHYS_ADDR_MASK32; 75 return PHYS_ADDR_MASK32;
77} 76}
78#elif defined(CONFIG_32BIT)
79static inline unsigned long phys_addr_mask(void)
80{
81 return PHYS_ADDR_MASK32;
82}
83#else
84static inline unsigned long phys_addr_mask(void)
85{
86 return PHYS_ADDR_MASK29;
87}
88#endif
89 77
90#define PTE_PHYS_MASK (phys_addr_mask() & PAGE_MASK) 78#define PTE_PHYS_MASK (phys_addr_mask() & PAGE_MASK)
91#define PTE_FLAGS_MASK (~(PTE_PHYS_MASK) << PAGE_SHIFT) 79#define PTE_FLAGS_MASK (~(PTE_PHYS_MASK) << PAGE_SHIFT)
@@ -169,6 +157,8 @@ extern void page_table_range_init(unsigned long start, unsigned long end,
169#define HAVE_ARCH_UNMAPPED_AREA 157#define HAVE_ARCH_UNMAPPED_AREA
170#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN 158#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
171 159
160#define __HAVE_ARCH_PTE_SPECIAL
161
172#include <asm-generic/pgtable.h> 162#include <asm-generic/pgtable.h>
173 163
174#endif /* __ASM_SH_PGTABLE_H */ 164#endif /* __ASM_SH_PGTABLE_H */
diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h
index 69fdfbf14ea5..43528ec656ba 100644
--- a/arch/sh/include/asm/pgtable_32.h
+++ b/arch/sh/include/asm/pgtable_32.h
@@ -378,8 +378,6 @@ PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED);
378PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED); 378PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED);
379PTE_BIT_FUNC(low, mkspecial, |= _PAGE_SPECIAL); 379PTE_BIT_FUNC(low, mkspecial, |= _PAGE_SPECIAL);
380 380
381#define __HAVE_ARCH_PTE_SPECIAL
382
383/* 381/*
384 * Macro and implementation to make a page protection as uncachable. 382 * Macro and implementation to make a page protection as uncachable.
385 */ 383 */
diff --git a/arch/sh/include/asm/pgtable_64.h b/arch/sh/include/asm/pgtable_64.h
index 10a48111226d..42cb9dd52161 100644
--- a/arch/sh/include/asm/pgtable_64.h
+++ b/arch/sh/include/asm/pgtable_64.h
@@ -130,6 +130,7 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval)
130 * anything above the PPN field. 130 * anything above the PPN field.
131 */ 131 */
132#define _PAGE_WIRED _PAGE_EXT(0x001) /* software: wire the tlb entry */ 132#define _PAGE_WIRED _PAGE_EXT(0x001) /* software: wire the tlb entry */
133#define _PAGE_SPECIAL _PAGE_EXT(0x002)
133 134
134#define _PAGE_CLEAR_FLAGS (_PAGE_PRESENT | _PAGE_FILE | _PAGE_SHARED | \ 135#define _PAGE_CLEAR_FLAGS (_PAGE_PRESENT | _PAGE_FILE | _PAGE_SHARED | \
135 _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_WIRED) 136 _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_WIRED)
@@ -173,7 +174,8 @@ static __inline__ void set_pte(pte_t *pteptr, pte_t pteval)
173/* Default flags for a User page */ 174/* Default flags for a User page */
174#define _PAGE_TABLE (_KERNPG_TABLE | _PAGE_USER) 175#define _PAGE_TABLE (_KERNPG_TABLE | _PAGE_USER)
175 176
176#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY) 177#define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \
178 _PAGE_SPECIAL)
177 179
178/* 180/*
179 * We have full permissions (Read/Write/Execute/Shared). 181 * We have full permissions (Read/Write/Execute/Shared).
@@ -263,7 +265,7 @@ static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
263static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } 265static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
264static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; } 266static inline int pte_file(pte_t pte) { return pte_val(pte) & _PAGE_FILE; }
265static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; } 267static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_WRITE; }
266static inline int pte_special(pte_t pte){ return 0; } 268static inline int pte_special(pte_t pte){ return pte_val(pte) & _PAGE_SPECIAL; }
267 269
268static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; } 270static inline pte_t pte_wrprotect(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_WRITE)); return pte; }
269static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; } 271static inline pte_t pte_mkclean(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) & ~_PAGE_DIRTY)); return pte; }
@@ -272,8 +274,7 @@ static inline pte_t pte_mkwrite(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) |
272static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; } 274static inline pte_t pte_mkdirty(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_DIRTY)); return pte; }
273static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; } 275static inline pte_t pte_mkyoung(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_ACCESSED)); return pte; }
274static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; } 276static inline pte_t pte_mkhuge(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SZHUGE)); return pte; }
275static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 277static inline pte_t pte_mkspecial(pte_t pte) { set_pte(&pte, __pte(pte_val(pte) | _PAGE_SPECIAL)); return pte; }
276
277 278
278/* 279/*
279 * Conversion functions: convert a page and protection to a page entry. 280 * Conversion functions: convert a page and protection to a page entry.
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 0a58cb25a658..c9e7cbc4768a 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -89,6 +89,7 @@ struct sh_cpuinfo {
89 struct task_struct *idle; 89 struct task_struct *idle;
90#endif 90#endif
91 91
92 unsigned int phys_bits;
92 unsigned long flags; 93 unsigned long flags;
93} __attribute__ ((aligned(L1_CACHE_BYTES))); 94} __attribute__ ((aligned(L1_CACHE_BYTES)));
94 95
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index 1f1af5afff03..10c8b1823a18 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -10,6 +10,7 @@
10#include <linux/compiler.h> 10#include <linux/compiler.h>
11#include <linux/linkage.h> 11#include <linux/linkage.h>
12#include <asm/types.h> 12#include <asm/types.h>
13#include <asm/uncached.h>
13 14
14#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */ 15#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
15 16
@@ -137,9 +138,6 @@ extern unsigned int instruction_size(unsigned int insn);
137#define instruction_size(insn) (4) 138#define instruction_size(insn) (4)
138#endif 139#endif
139 140
140extern unsigned long cached_to_uncached;
141extern unsigned long uncached_size;
142
143void per_cpu_trap_init(void); 141void per_cpu_trap_init(void);
144void default_idle(void); 142void default_idle(void);
145void cpu_idle_wait(void); 143void cpu_idle_wait(void);
diff --git a/arch/sh/include/asm/system_32.h b/arch/sh/include/asm/system_32.h
index c941b2739405..a4ad1cd9bc4d 100644
--- a/arch/sh/include/asm/system_32.h
+++ b/arch/sh/include/asm/system_32.h
@@ -145,42 +145,6 @@ do { \
145 __restore_dsp(prev); \ 145 __restore_dsp(prev); \
146} while (0) 146} while (0)
147 147
148/*
149 * Jump to uncached area.
150 * When handling TLB or caches, we need to do it from an uncached area.
151 */
152#define jump_to_uncached() \
153do { \
154 unsigned long __dummy; \
155 \
156 __asm__ __volatile__( \
157 "mova 1f, %0\n\t" \
158 "add %1, %0\n\t" \
159 "jmp @%0\n\t" \
160 " nop\n\t" \
161 ".balign 4\n" \
162 "1:" \
163 : "=&z" (__dummy) \
164 : "r" (cached_to_uncached)); \
165} while (0)
166
167/*
168 * Back to cached area.
169 */
170#define back_to_cached() \
171do { \
172 unsigned long __dummy; \
173 ctrl_barrier(); \
174 __asm__ __volatile__( \
175 "mov.l 1f, %0\n\t" \
176 "jmp @%0\n\t" \
177 " nop\n\t" \
178 ".balign 4\n" \
179 "1: .long 2f\n" \
180 "2:" \
181 : "=&r" (__dummy)); \
182} while (0)
183
184#ifdef CONFIG_CPU_HAS_SR_RB 148#ifdef CONFIG_CPU_HAS_SR_RB
185#define lookup_exception_vector() \ 149#define lookup_exception_vector() \
186({ \ 150({ \
diff --git a/arch/sh/include/asm/system_64.h b/arch/sh/include/asm/system_64.h
index 36338646dfc8..8593bc8d1a4e 100644
--- a/arch/sh/include/asm/system_64.h
+++ b/arch/sh/include/asm/system_64.h
@@ -34,9 +34,6 @@ do { \
34 &next->thread); \ 34 &next->thread); \
35} while (0) 35} while (0)
36 36
37#define jump_to_uncached() do { } while (0)
38#define back_to_cached() do { } while (0)
39
40#define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr)) 37#define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr))
41#define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr)) 38#define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr))
42#define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr)) 39#define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr))
diff --git a/arch/sh/include/asm/uncached.h b/arch/sh/include/asm/uncached.h
index e3419f96626a..6f8816b79cf1 100644
--- a/arch/sh/include/asm/uncached.h
+++ b/arch/sh/include/asm/uncached.h
@@ -4,15 +4,55 @@
4#include <linux/bug.h> 4#include <linux/bug.h>
5 5
6#ifdef CONFIG_UNCACHED_MAPPING 6#ifdef CONFIG_UNCACHED_MAPPING
7extern unsigned long cached_to_uncached;
8extern unsigned long uncached_size;
7extern unsigned long uncached_start, uncached_end; 9extern unsigned long uncached_start, uncached_end;
8 10
9extern int virt_addr_uncached(unsigned long kaddr); 11extern int virt_addr_uncached(unsigned long kaddr);
10extern void uncached_init(void); 12extern void uncached_init(void);
11extern void uncached_resize(unsigned long size); 13extern void uncached_resize(unsigned long size);
14
15/*
16 * Jump to uncached area.
17 * When handling TLB or caches, we need to do it from an uncached area.
18 */
19#define jump_to_uncached() \
20do { \
21 unsigned long __dummy; \
22 \
23 __asm__ __volatile__( \
24 "mova 1f, %0\n\t" \
25 "add %1, %0\n\t" \
26 "jmp @%0\n\t" \
27 " nop\n\t" \
28 ".balign 4\n" \
29 "1:" \
30 : "=&z" (__dummy) \
31 : "r" (cached_to_uncached)); \
32} while (0)
33
34/*
35 * Back to cached area.
36 */
37#define back_to_cached() \
38do { \
39 unsigned long __dummy; \
40 ctrl_barrier(); \
41 __asm__ __volatile__( \
42 "mov.l 1f, %0\n\t" \
43 "jmp @%0\n\t" \
44 " nop\n\t" \
45 ".balign 4\n" \
46 "1: .long 2f\n" \
47 "2:" \
48 : "=&r" (__dummy)); \
49} while (0)
12#else 50#else
13#define virt_addr_uncached(kaddr) (0) 51#define virt_addr_uncached(kaddr) (0)
14#define uncached_init() do { } while (0) 52#define uncached_init() do { } while (0)
15#define uncached_resize(size) BUG() 53#define uncached_resize(size) BUG()
54#define jump_to_uncached() do { } while (0)
55#define back_to_cached() do { } while (0)
16#endif 56#endif
17 57
18#endif /* __ASM_SH_UNCACHED_H */ 58#endif /* __ASM_SH_UNCACHED_H */
diff --git a/arch/sh/include/mach-common/mach/edosk7705.h b/arch/sh/include/mach-common/mach/edosk7705.h
deleted file mode 100644
index efc43b323466..000000000000
--- a/arch/sh/include/mach-common/mach/edosk7705.h
+++ /dev/null
@@ -1,7 +0,0 @@
1#ifndef __ASM_SH_EDOSK7705_H
2#define __ASM_SH_EDOSK7705_H
3
4#define __IO_PREFIX sh_edosk7705
5#include <asm/io_generic.h>
6
7#endif /* __ASM_SH_EDOSK7705_H */
diff --git a/arch/sh/include/mach-common/mach/microdev.h b/arch/sh/include/mach-common/mach/microdev.h
index 1aed15856e11..dcb05fa8c164 100644
--- a/arch/sh/include/mach-common/mach/microdev.h
+++ b/arch/sh/include/mach-common/mach/microdev.h
@@ -68,13 +68,4 @@ extern void microdev_print_fpga_intc_status(void);
68#define __IO_PREFIX microdev 68#define __IO_PREFIX microdev
69#include <asm/io_generic.h> 69#include <asm/io_generic.h>
70 70
71#if defined(CONFIG_PCI)
72unsigned char microdev_pci_inb(unsigned long port);
73unsigned short microdev_pci_inw(unsigned long port);
74unsigned long microdev_pci_inl(unsigned long port);
75void microdev_pci_outb(unsigned char data, unsigned long port);
76void microdev_pci_outw(unsigned short data, unsigned long port);
77void microdev_pci_outl(unsigned long data, unsigned long port);
78#endif
79
80#endif /* __ASM_SH_MICRODEV_H */ 71#endif /* __ASM_SH_MICRODEV_H */
diff --git a/arch/sh/include/mach-common/mach/snapgear.h b/arch/sh/include/mach-common/mach/secureedge5410.h
index 042d95f51c4d..3653b9a4bacc 100644
--- a/arch/sh/include/mach-common/mach/snapgear.h
+++ b/arch/sh/include/mach-common/mach/secureedge5410.h
@@ -12,30 +12,9 @@
12#ifndef _ASM_SH_IO_SNAPGEAR_H 12#ifndef _ASM_SH_IO_SNAPGEAR_H
13#define _ASM_SH_IO_SNAPGEAR_H 13#define _ASM_SH_IO_SNAPGEAR_H
14 14
15#if defined(CONFIG_CPU_SH4)
16/*
17 * The external interrupt lines, these take up ints 0 - 15 inclusive
18 * depending on the priority for the interrupt. In fact the priority
19 * is the interrupt :-)
20 */
21
22#define IRL0_IRQ 2
23#define IRL0_PRIORITY 13
24
25#define IRL1_IRQ 5
26#define IRL1_PRIORITY 10
27
28#define IRL2_IRQ 8
29#define IRL2_PRIORITY 7
30
31#define IRL3_IRQ 11
32#define IRL3_PRIORITY 4
33#endif
34
35#define __IO_PREFIX snapgear 15#define __IO_PREFIX snapgear
36#include <asm/io_generic.h> 16#include <asm/io_generic.h>
37 17
38#ifdef CONFIG_SH_SECUREEDGE5410
39/* 18/*
40 * We need to remember what was written to the ioport as some bits 19 * We need to remember what was written to the ioport as some bits
41 * are shared with other functions and you cannot read back what was 20 * are shared with other functions and you cannot read back what was
@@ -66,6 +45,5 @@ extern unsigned short secureedge5410_ioport;
66 ((secureedge5410_ioport & ~(mask)) | ((val) & (mask))))) 45 ((secureedge5410_ioport & ~(mask)) | ((val) & (mask)))))
67#define SECUREEDGE_READ_IOPORT() \ 46#define SECUREEDGE_READ_IOPORT() \
68 ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817)) 47 ((*SECUREEDGE_IOPORT_ADDR&0x0817) | (secureedge5410_ioport&~0x0817))
69#endif
70 48
71#endif /* _ASM_SH_IO_SNAPGEAR_H */ 49#endif /* _ASM_SH_IO_SNAPGEAR_H */
diff --git a/arch/sh/include/mach-common/mach/systemh7751.h b/arch/sh/include/mach-common/mach/systemh7751.h
deleted file mode 100644
index 4161122c84ef..000000000000
--- a/arch/sh/include/mach-common/mach/systemh7751.h
+++ /dev/null
@@ -1,71 +0,0 @@
1#ifndef __ASM_SH_SYSTEMH_7751SYSTEMH_H
2#define __ASM_SH_SYSTEMH_7751SYSTEMH_H
3
4/*
5 * linux/include/asm-sh/systemh/7751systemh.h
6 *
7 * Copyright (C) 2000 Kazumoto Kojima
8 *
9 * Hitachi SystemH support
10
11 * Modified for 7751 SystemH by
12 * Jonathan Short, 2002.
13 */
14
15/* Box specific addresses. */
16
17#define PA_ROM 0x00000000 /* EPROM */
18#define PA_ROM_SIZE 0x00400000 /* EPROM size 4M byte */
19#define PA_FROM 0x01000000 /* EPROM */
20#define PA_FROM_SIZE 0x00400000 /* EPROM size 4M byte */
21#define PA_EXT1 0x04000000
22#define PA_EXT1_SIZE 0x04000000
23#define PA_EXT2 0x08000000
24#define PA_EXT2_SIZE 0x04000000
25#define PA_SDRAM 0x0c000000
26#define PA_SDRAM_SIZE 0x04000000
27
28#define PA_EXT4 0x12000000
29#define PA_EXT4_SIZE 0x02000000
30#define PA_EXT5 0x14000000
31#define PA_EXT5_SIZE 0x04000000
32#define PA_PCIC 0x18000000 /* MR-SHPC-01 PCMCIA */
33
34#define PA_DIPSW0 0xb9000000 /* Dip switch 5,6 */
35#define PA_DIPSW1 0xb9000002 /* Dip switch 7,8 */
36#define PA_LED 0xba000000 /* LED */
37#define PA_BCR 0xbb000000 /* FPGA on the MS7751SE01 */
38
39#define PA_MRSHPC 0xb83fffe0 /* MR-SHPC-01 PCMCIA controller */
40#define PA_MRSHPC_MW1 0xb8400000 /* MR-SHPC-01 memory window base */
41#define PA_MRSHPC_MW2 0xb8500000 /* MR-SHPC-01 attribute window base */
42#define PA_MRSHPC_IO 0xb8600000 /* MR-SHPC-01 I/O window base */
43#define MRSHPC_MODE (PA_MRSHPC + 4)
44#define MRSHPC_OPTION (PA_MRSHPC + 6)
45#define MRSHPC_CSR (PA_MRSHPC + 8)
46#define MRSHPC_ISR (PA_MRSHPC + 10)
47#define MRSHPC_ICR (PA_MRSHPC + 12)
48#define MRSHPC_CPWCR (PA_MRSHPC + 14)
49#define MRSHPC_MW0CR1 (PA_MRSHPC + 16)
50#define MRSHPC_MW1CR1 (PA_MRSHPC + 18)
51#define MRSHPC_IOWCR1 (PA_MRSHPC + 20)
52#define MRSHPC_MW0CR2 (PA_MRSHPC + 22)
53#define MRSHPC_MW1CR2 (PA_MRSHPC + 24)
54#define MRSHPC_IOWCR2 (PA_MRSHPC + 26)
55#define MRSHPC_CDCR (PA_MRSHPC + 28)
56#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
57
58#define BCR_ILCRA (PA_BCR + 0)
59#define BCR_ILCRB (PA_BCR + 2)
60#define BCR_ILCRC (PA_BCR + 4)
61#define BCR_ILCRD (PA_BCR + 6)
62#define BCR_ILCRE (PA_BCR + 8)
63#define BCR_ILCRF (PA_BCR + 10)
64#define BCR_ILCRG (PA_BCR + 12)
65
66#define IRQ_79C973 13
67
68#define __IO_PREFIX sh7751systemh
69#include <asm/io_generic.h>
70
71#endif /* __ASM_SH_SYSTEMH_7751SYSTEMH_H */
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c
index 97661061ff20..fac742e514ee 100644
--- a/arch/sh/kernel/cpu/init.c
+++ b/arch/sh/kernel/cpu/init.c
@@ -340,6 +340,8 @@ asmlinkage void __cpuinit cpu_init(void)
340 */ 340 */
341 current_cpu_data.asid_cache = NO_CONTEXT; 341 current_cpu_data.asid_cache = NO_CONTEXT;
342 342
343 current_cpu_data.phys_bits = __in_29bit_mode() ? 29 : 32;
344
343 speculative_execution_init(); 345 speculative_execution_init();
344 expmask_init(); 346 expmask_init();
345 347
diff --git a/arch/sh/kernel/cpu/irq/imask.c b/arch/sh/kernel/cpu/irq/imask.c
index a351ed84eec5..32c825c9488e 100644
--- a/arch/sh/kernel/cpu/irq/imask.c
+++ b/arch/sh/kernel/cpu/irq/imask.c
@@ -51,16 +51,20 @@ static inline void set_interrupt_registers(int ip)
51 : "t"); 51 : "t");
52} 52}
53 53
54static void mask_imask_irq(unsigned int irq) 54static void mask_imask_irq(struct irq_data *data)
55{ 55{
56 unsigned int irq = data->irq;
57
56 clear_bit(irq, imask_mask); 58 clear_bit(irq, imask_mask);
57 if (interrupt_priority < IMASK_PRIORITY - irq) 59 if (interrupt_priority < IMASK_PRIORITY - irq)
58 interrupt_priority = IMASK_PRIORITY - irq; 60 interrupt_priority = IMASK_PRIORITY - irq;
59 set_interrupt_registers(interrupt_priority); 61 set_interrupt_registers(interrupt_priority);
60} 62}
61 63
62static void unmask_imask_irq(unsigned int irq) 64static void unmask_imask_irq(struct irq_data *data)
63{ 65{
66 unsigned int irq = data->irq;
67
64 set_bit(irq, imask_mask); 68 set_bit(irq, imask_mask);
65 interrupt_priority = IMASK_PRIORITY - 69 interrupt_priority = IMASK_PRIORITY -
66 find_first_zero_bit(imask_mask, IMASK_PRIORITY); 70 find_first_zero_bit(imask_mask, IMASK_PRIORITY);
@@ -69,9 +73,9 @@ static void unmask_imask_irq(unsigned int irq)
69 73
70static struct irq_chip imask_irq_chip = { 74static struct irq_chip imask_irq_chip = {
71 .name = "SR.IMASK", 75 .name = "SR.IMASK",
72 .mask = mask_imask_irq, 76 .irq_mask = mask_imask_irq,
73 .unmask = unmask_imask_irq, 77 .irq_unmask = unmask_imask_irq,
74 .mask_ack = mask_imask_irq, 78 .irq_mask_ack = mask_imask_irq,
75}; 79};
76 80
77void make_imask_irq(unsigned int irq) 81void make_imask_irq(unsigned int irq)
diff --git a/arch/sh/kernel/cpu/irq/intc-sh5.c b/arch/sh/kernel/cpu/irq/intc-sh5.c
index 96a239583948..5af48f8357e5 100644
--- a/arch/sh/kernel/cpu/irq/intc-sh5.c
+++ b/arch/sh/kernel/cpu/irq/intc-sh5.c
@@ -76,39 +76,11 @@ int intc_evt_to_irq[(0xE20/0x20)+1] = {
76}; 76};
77 77
78static unsigned long intc_virt; 78static unsigned long intc_virt;
79
80static unsigned int startup_intc_irq(unsigned int irq);
81static void shutdown_intc_irq(unsigned int irq);
82static void enable_intc_irq(unsigned int irq);
83static void disable_intc_irq(unsigned int irq);
84static void mask_and_ack_intc(unsigned int);
85static void end_intc_irq(unsigned int irq);
86
87static struct irq_chip intc_irq_type = {
88 .name = "INTC",
89 .startup = startup_intc_irq,
90 .shutdown = shutdown_intc_irq,
91 .enable = enable_intc_irq,
92 .disable = disable_intc_irq,
93 .ack = mask_and_ack_intc,
94 .end = end_intc_irq
95};
96
97static int irlm; /* IRL mode */ 79static int irlm; /* IRL mode */
98 80
99static unsigned int startup_intc_irq(unsigned int irq) 81static void enable_intc_irq(struct irq_data *data)
100{
101 enable_intc_irq(irq);
102 return 0; /* never anything pending */
103}
104
105static void shutdown_intc_irq(unsigned int irq)
106{
107 disable_intc_irq(irq);
108}
109
110static void enable_intc_irq(unsigned int irq)
111{ 82{
83 unsigned int irq = data->irq;
112 unsigned long reg; 84 unsigned long reg;
113 unsigned long bitmask; 85 unsigned long bitmask;
114 86
@@ -126,8 +98,9 @@ static void enable_intc_irq(unsigned int irq)
126 __raw_writel(bitmask, reg); 98 __raw_writel(bitmask, reg);
127} 99}
128 100
129static void disable_intc_irq(unsigned int irq) 101static void disable_intc_irq(struct irq_data *data)
130{ 102{
103 unsigned int irq = data->irq;
131 unsigned long reg; 104 unsigned long reg;
132 unsigned long bitmask; 105 unsigned long bitmask;
133 106
@@ -142,15 +115,11 @@ static void disable_intc_irq(unsigned int irq)
142 __raw_writel(bitmask, reg); 115 __raw_writel(bitmask, reg);
143} 116}
144 117
145static void mask_and_ack_intc(unsigned int irq) 118static struct irq_chip intc_irq_type = {
146{ 119 .name = "INTC",
147 disable_intc_irq(irq); 120 .irq_enable = enable_intc_irq,
148} 121 .irq_disable = disable_intc_irq,
149 122};
150static void end_intc_irq(unsigned int irq)
151{
152 enable_intc_irq(irq);
153}
154 123
155void __init plat_irq_setup(void) 124void __init plat_irq_setup(void)
156{ 125{
diff --git a/arch/sh/kernel/cpu/irq/ipr.c b/arch/sh/kernel/cpu/irq/ipr.c
index 9282d965a1b6..7516c35ee514 100644
--- a/arch/sh/kernel/cpu/irq/ipr.c
+++ b/arch/sh/kernel/cpu/irq/ipr.c
@@ -24,25 +24,25 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/topology.h> 25#include <linux/topology.h>
26 26
27static inline struct ipr_desc *get_ipr_desc(unsigned int irq) 27static inline struct ipr_desc *get_ipr_desc(struct irq_data *data)
28{ 28{
29 struct irq_chip *chip = get_irq_chip(irq); 29 struct irq_chip *chip = irq_data_get_irq_chip(data);
30 return container_of(chip, struct ipr_desc, chip); 30 return container_of(chip, struct ipr_desc, chip);
31} 31}
32 32
33static void disable_ipr_irq(unsigned int irq) 33static void disable_ipr_irq(struct irq_data *data)
34{ 34{
35 struct ipr_data *p = get_irq_chip_data(irq); 35 struct ipr_data *p = irq_data_get_irq_chip_data(data);
36 unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx]; 36 unsigned long addr = get_ipr_desc(data)->ipr_offsets[p->ipr_idx];
37 /* Set the priority in IPR to 0 */ 37 /* Set the priority in IPR to 0 */
38 __raw_writew(__raw_readw(addr) & (0xffff ^ (0xf << p->shift)), addr); 38 __raw_writew(__raw_readw(addr) & (0xffff ^ (0xf << p->shift)), addr);
39 (void)__raw_readw(addr); /* Read back to flush write posting */ 39 (void)__raw_readw(addr); /* Read back to flush write posting */
40} 40}
41 41
42static void enable_ipr_irq(unsigned int irq) 42static void enable_ipr_irq(struct irq_data *data)
43{ 43{
44 struct ipr_data *p = get_irq_chip_data(irq); 44 struct ipr_data *p = irq_data_get_irq_chip_data(data);
45 unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx]; 45 unsigned long addr = get_ipr_desc(data)->ipr_offsets[p->ipr_idx];
46 /* Set priority in IPR back to original value */ 46 /* Set priority in IPR back to original value */
47 __raw_writew(__raw_readw(addr) | (p->priority << p->shift), addr); 47 __raw_writew(__raw_readw(addr) | (p->priority << p->shift), addr);
48} 48}
@@ -56,19 +56,18 @@ void register_ipr_controller(struct ipr_desc *desc)
56{ 56{
57 int i; 57 int i;
58 58
59 desc->chip.mask = disable_ipr_irq; 59 desc->chip.irq_mask = disable_ipr_irq;
60 desc->chip.unmask = enable_ipr_irq; 60 desc->chip.irq_unmask = enable_ipr_irq;
61 desc->chip.mask_ack = disable_ipr_irq;
62 61
63 for (i = 0; i < desc->nr_irqs; i++) { 62 for (i = 0; i < desc->nr_irqs; i++) {
64 struct ipr_data *p = desc->ipr_data + i; 63 struct ipr_data *p = desc->ipr_data + i;
65 struct irq_desc *irq_desc; 64 int res;
66 65
67 BUG_ON(p->ipr_idx >= desc->nr_offsets); 66 BUG_ON(p->ipr_idx >= desc->nr_offsets);
68 BUG_ON(!desc->ipr_offsets[p->ipr_idx]); 67 BUG_ON(!desc->ipr_offsets[p->ipr_idx]);
69 68
70 irq_desc = irq_to_desc_alloc_node(p->irq, numa_node_id()); 69 res = irq_alloc_desc_at(p->irq, numa_node_id());
71 if (unlikely(!irq_desc)) { 70 if (unlikely(res != p->irq && res != -EEXIST)) {
72 printk(KERN_INFO "can not get irq_desc for %d\n", 71 printk(KERN_INFO "can not get irq_desc for %d\n",
73 p->irq); 72 p->irq);
74 continue; 73 continue;
@@ -78,7 +77,7 @@ void register_ipr_controller(struct ipr_desc *desc)
78 set_irq_chip_and_handler_name(p->irq, &desc->chip, 77 set_irq_chip_and_handler_name(p->irq, &desc->chip,
79 handle_level_irq, "level"); 78 handle_level_irq, "level");
80 set_irq_chip_data(p->irq, p); 79 set_irq_chip_data(p->irq, p);
81 disable_ipr_irq(p->irq); 80 disable_ipr_irq(irq_get_irq_data(p->irq));
82 } 81 }
83} 82}
84EXPORT_SYMBOL(register_ipr_controller); 83EXPORT_SYMBOL(register_ipr_controller);
diff --git a/arch/sh/kernel/cpu/sh4/perf_event.c b/arch/sh/kernel/cpu/sh4/perf_event.c
index 7f9ecc9c2d02..dbf3b4bb71fe 100644
--- a/arch/sh/kernel/cpu/sh4/perf_event.c
+++ b/arch/sh/kernel/cpu/sh4/perf_event.c
@@ -225,7 +225,7 @@ static void sh7750_pmu_enable_all(void)
225} 225}
226 226
227static struct sh_pmu sh7750_pmu = { 227static struct sh_pmu sh7750_pmu = {
228 .name = "SH7750", 228 .name = "sh7750",
229 .num_events = 2, 229 .num_events = 2,
230 .event_map = sh7750_event_map, 230 .event_map = sh7750_event_map,
231 .max_events = ARRAY_SIZE(sh7750_general_events), 231 .max_events = ARRAY_SIZE(sh7750_general_events),
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 2d9700c6b53a..0fe2e9329cb2 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -48,7 +48,7 @@ static struct clk r_clk = {
48 * Default rate for the root input clock, reset this with clk_set_rate() 48 * Default rate for the root input clock, reset this with clk_set_rate()
49 * from the platform code. 49 * from the platform code.
50 */ 50 */
51struct clk extal_clk = { 51static struct clk extal_clk = {
52 .rate = 33333333, 52 .rate = 33333333,
53}; 53};
54 54
@@ -111,7 +111,7 @@ static struct clk div3_clk = {
111 .parent = &pll_clk, 111 .parent = &pll_clk,
112}; 112};
113 113
114struct clk *main_clks[] = { 114static struct clk *main_clks[] = {
115 &r_clk, 115 &r_clk,
116 &extal_clk, 116 &extal_clk,
117 &fll_clk, 117 &fll_clk,
@@ -156,7 +156,7 @@ struct clk div4_clks[DIV4_NR] = {
156 156
157enum { DIV6_V, DIV6_FA, DIV6_FB, DIV6_I, DIV6_S, DIV6_NR }; 157enum { DIV6_V, DIV6_FA, DIV6_FB, DIV6_I, DIV6_S, DIV6_NR };
158 158
159struct clk div6_clks[DIV6_NR] = { 159static struct clk div6_clks[DIV6_NR] = {
160 [DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0), 160 [DIV6_V] = SH_CLK_DIV6(&div3_clk, VCLKCR, 0),
161 [DIV6_FA] = SH_CLK_DIV6(&div3_clk, FCLKACR, 0), 161 [DIV6_FA] = SH_CLK_DIV6(&div3_clk, FCLKACR, 0),
162 [DIV6_FB] = SH_CLK_DIV6(&div3_clk, FCLKBCR, 0), 162 [DIV6_FB] = SH_CLK_DIV6(&div3_clk, FCLKBCR, 0),
diff --git a/arch/sh/kernel/cpu/sh4a/perf_event.c b/arch/sh/kernel/cpu/sh4a/perf_event.c
index b8b873d8d6b5..580276525731 100644
--- a/arch/sh/kernel/cpu/sh4a/perf_event.c
+++ b/arch/sh/kernel/cpu/sh4a/perf_event.c
@@ -259,7 +259,7 @@ static void sh4a_pmu_enable_all(void)
259} 259}
260 260
261static struct sh_pmu sh4a_pmu = { 261static struct sh_pmu sh4a_pmu = {
262 .name = "SH-4A", 262 .name = "sh4a",
263 .num_events = 2, 263 .num_events = 2,
264 .event_map = sh4a_event_map, 264 .event_map = sh4a_event_map,
265 .max_events = ARRAY_SIZE(sh4a_general_events), 265 .max_events = ARRAY_SIZE(sh4a_general_events),
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 9dc447db8a44..68ecbe6c881a 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -56,6 +56,8 @@ int show_interrupts(struct seq_file *p, void *v)
56 int i = *(loff_t *)v, j, prec; 56 int i = *(loff_t *)v, j, prec;
57 struct irqaction *action; 57 struct irqaction *action;
58 struct irq_desc *desc; 58 struct irq_desc *desc;
59 struct irq_data *data;
60 struct irq_chip *chip;
59 61
60 if (i > nr_irqs) 62 if (i > nr_irqs)
61 return 0; 63 return 0;
@@ -77,6 +79,9 @@ int show_interrupts(struct seq_file *p, void *v)
77 if (!desc) 79 if (!desc)
78 return 0; 80 return 0;
79 81
82 data = irq_get_irq_data(i);
83 chip = irq_data_get_irq_chip(data);
84
80 raw_spin_lock_irqsave(&desc->lock, flags); 85 raw_spin_lock_irqsave(&desc->lock, flags);
81 for_each_online_cpu(j) 86 for_each_online_cpu(j)
82 any_count |= kstat_irqs_cpu(i, j); 87 any_count |= kstat_irqs_cpu(i, j);
@@ -87,7 +92,7 @@ int show_interrupts(struct seq_file *p, void *v)
87 seq_printf(p, "%*d: ", prec, i); 92 seq_printf(p, "%*d: ", prec, i);
88 for_each_online_cpu(j) 93 for_each_online_cpu(j)
89 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 94 seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
90 seq_printf(p, " %14s", desc->chip->name); 95 seq_printf(p, " %14s", chip->name);
91 seq_printf(p, "-%-8s", desc->name); 96 seq_printf(p, "-%-8s", desc->name);
92 97
93 if (action) { 98 if (action) {
@@ -273,12 +278,6 @@ void __init init_IRQ(void)
273{ 278{
274 plat_irq_setup(); 279 plat_irq_setup();
275 280
276 /*
277 * Pin any of the legacy IRQ vectors that haven't already been
278 * grabbed by the platform
279 */
280 reserve_irq_legacy();
281
282 /* Perform the machine specific initialisation */ 281 /* Perform the machine specific initialisation */
283 if (sh_mv.mv_init_irq) 282 if (sh_mv.mv_init_irq)
284 sh_mv.mv_init_irq(); 283 sh_mv.mv_init_irq();
@@ -297,13 +296,16 @@ int __init arch_probe_nr_irqs(void)
297#endif 296#endif
298 297
299#ifdef CONFIG_HOTPLUG_CPU 298#ifdef CONFIG_HOTPLUG_CPU
300static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu) 299static void route_irq(struct irq_data *data, unsigned int irq, unsigned int cpu)
301{ 300{
301 struct irq_desc *desc = irq_to_desc(irq);
302 struct irq_chip *chip = irq_data_get_irq_chip(data);
303
302 printk(KERN_INFO "IRQ%u: moving from cpu%u to cpu%u\n", 304 printk(KERN_INFO "IRQ%u: moving from cpu%u to cpu%u\n",
303 irq, desc->node, cpu); 305 irq, data->node, cpu);
304 306
305 raw_spin_lock_irq(&desc->lock); 307 raw_spin_lock_irq(&desc->lock);
306 desc->chip->set_affinity(irq, cpumask_of(cpu)); 308 chip->irq_set_affinity(data, cpumask_of(cpu), false);
307 raw_spin_unlock_irq(&desc->lock); 309 raw_spin_unlock_irq(&desc->lock);
308} 310}
309 311
@@ -314,24 +316,25 @@ static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu)
314 */ 316 */
315void migrate_irqs(void) 317void migrate_irqs(void)
316{ 318{
317 struct irq_desc *desc;
318 unsigned int irq, cpu = smp_processor_id(); 319 unsigned int irq, cpu = smp_processor_id();
319 320
320 for_each_irq_desc(irq, desc) { 321 for_each_active_irq(irq) {
321 if (desc->node == cpu) { 322 struct irq_data *data = irq_get_irq_data(irq);
322 unsigned int newcpu = cpumask_any_and(desc->affinity, 323
324 if (data->node == cpu) {
325 unsigned int newcpu = cpumask_any_and(data->affinity,
323 cpu_online_mask); 326 cpu_online_mask);
324 if (newcpu >= nr_cpu_ids) { 327 if (newcpu >= nr_cpu_ids) {
325 if (printk_ratelimit()) 328 if (printk_ratelimit())
326 printk(KERN_INFO "IRQ%u no longer affine to CPU%u\n", 329 printk(KERN_INFO "IRQ%u no longer affine to CPU%u\n",
327 irq, cpu); 330 irq, cpu);
328 331
329 cpumask_setall(desc->affinity); 332 cpumask_setall(data->affinity);
330 newcpu = cpumask_any_and(desc->affinity, 333 newcpu = cpumask_any_and(data->affinity,
331 cpu_online_mask); 334 cpu_online_mask);
332 } 335 }
333 336
334 route_irq(desc, irq, newcpu); 337 route_irq(data, irq, newcpu);
335 } 338 }
336 } 339 }
337} 340}
diff --git a/arch/sh/kernel/irq_64.c b/arch/sh/kernel/irq_64.c
index 32365ba0e039..8fc05b997b6d 100644
--- a/arch/sh/kernel/irq_64.c
+++ b/arch/sh/kernel/irq_64.c
@@ -11,17 +11,17 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <cpu/registers.h> 12#include <cpu/registers.h>
13 13
14void notrace raw_local_irq_restore(unsigned long flags) 14void notrace arch_local_irq_restore(unsigned long flags)
15{ 15{
16 unsigned long long __dummy; 16 unsigned long long __dummy;
17 17
18 if (flags == RAW_IRQ_DISABLED) { 18 if (flags == ARCH_IRQ_DISABLED) {
19 __asm__ __volatile__ ( 19 __asm__ __volatile__ (
20 "getcon " __SR ", %0\n\t" 20 "getcon " __SR ", %0\n\t"
21 "or %0, %1, %0\n\t" 21 "or %0, %1, %0\n\t"
22 "putcon %0, " __SR "\n\t" 22 "putcon %0, " __SR "\n\t"
23 : "=&r" (__dummy) 23 : "=&r" (__dummy)
24 : "r" (RAW_IRQ_DISABLED) 24 : "r" (ARCH_IRQ_DISABLED)
25 ); 25 );
26 } else { 26 } else {
27 __asm__ __volatile__ ( 27 __asm__ __volatile__ (
@@ -29,13 +29,13 @@ void notrace raw_local_irq_restore(unsigned long flags)
29 "and %0, %1, %0\n\t" 29 "and %0, %1, %0\n\t"
30 "putcon %0, " __SR "\n\t" 30 "putcon %0, " __SR "\n\t"
31 : "=&r" (__dummy) 31 : "=&r" (__dummy)
32 : "r" (~RAW_IRQ_DISABLED) 32 : "r" (~ARCH_IRQ_DISABLED)
33 ); 33 );
34 } 34 }
35} 35}
36EXPORT_SYMBOL(raw_local_irq_restore); 36EXPORT_SYMBOL(arch_local_irq_restore);
37 37
38unsigned long notrace __raw_local_save_flags(void) 38unsigned long notrace arch_local_save_flags(void)
39{ 39{
40 unsigned long flags; 40 unsigned long flags;
41 41
@@ -43,9 +43,9 @@ unsigned long notrace __raw_local_save_flags(void)
43 "getcon " __SR ", %0\n\t" 43 "getcon " __SR ", %0\n\t"
44 "and %0, %1, %0" 44 "and %0, %1, %0"
45 : "=&r" (flags) 45 : "=&r" (flags)
46 : "r" (RAW_IRQ_DISABLED) 46 : "r" (ARCH_IRQ_DISABLED)
47 ); 47 );
48 48
49 return flags; 49 return flags;
50} 50}
51EXPORT_SYMBOL(__raw_local_save_flags); 51EXPORT_SYMBOL(arch_local_save_flags);
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index 4e278467f76c..d6b018c7ebdc 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -41,6 +41,7 @@
41#include <asm/smp.h> 41#include <asm/smp.h>
42#include <asm/mmu_context.h> 42#include <asm/mmu_context.h>
43#include <asm/mmzone.h> 43#include <asm/mmzone.h>
44#include <asm/sparsemem.h>
44 45
45/* 46/*
46 * Initialize loops_per_jiffy as 10000000 (1000MIPS). 47 * Initialize loops_per_jiffy as 10000000 (1000MIPS).
@@ -52,6 +53,7 @@ struct sh_cpuinfo cpu_data[NR_CPUS] __read_mostly = {
52 .type = CPU_SH_NONE, 53 .type = CPU_SH_NONE,
53 .family = CPU_FAMILY_UNKNOWN, 54 .family = CPU_FAMILY_UNKNOWN,
54 .loops_per_jiffy = 10000000, 55 .loops_per_jiffy = 10000000,
56 .phys_bits = MAX_PHYSMEM_BITS,
55 }, 57 },
56}; 58};
57EXPORT_SYMBOL(cpu_data); 59EXPORT_SYMBOL(cpu_data);
@@ -432,6 +434,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
432 if (c->flags & CPU_HAS_L2_CACHE) 434 if (c->flags & CPU_HAS_L2_CACHE)
433 show_cacheinfo(m, "scache", c->scache); 435 show_cacheinfo(m, "scache", c->scache);
434 436
437 seq_printf(m, "address sizes\t: %u bits physical\n", c->phys_bits);
438
435 seq_printf(m, "bogomips\t: %lu.%02lu\n", 439 seq_printf(m, "bogomips\t: %lu.%02lu\n",
436 c->loops_per_jiffy/(500000/HZ), 440 c->loops_per_jiffy/(500000/HZ),
437 (c->loops_per_jiffy/(5000/HZ)) % 100); 441 (c->loops_per_jiffy/(5000/HZ)) % 100);
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 09370392aff1..c3e61b366493 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -79,7 +79,7 @@ config 29BIT
79 79
80config 32BIT 80config 32BIT
81 bool 81 bool
82 default y if CPU_SH5 82 default y if CPU_SH5 || !MMU
83 83
84config PMB 84config PMB
85 bool "Support 32-bit physical addressing through PMB" 85 bool "Support 32-bit physical addressing through PMB"
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index ab89ea4f9414..150aa326afff 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -15,7 +15,7 @@ cacheops-$(CONFIG_CPU_SHX3) += cache-shx3.o
15obj-y += $(cacheops-y) 15obj-y += $(cacheops-y)
16 16
17mmu-y := nommu.o extable_32.o 17mmu-y := nommu.o extable_32.o
18mmu-$(CONFIG_MMU) := extable_$(BITS).o fault_$(BITS).o \ 18mmu-$(CONFIG_MMU) := extable_$(BITS).o fault_$(BITS).o gup.o \
19 ioremap.o kmap.o pgtable.o tlbflush_$(BITS).o 19 ioremap.o kmap.o pgtable.o tlbflush_$(BITS).o
20 20
21obj-y += $(mmu-y) 21obj-y += $(mmu-y)
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 038793286990..40733a952402 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -79,21 +79,20 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
79void dma_cache_sync(struct device *dev, void *vaddr, size_t size, 79void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
80 enum dma_data_direction direction) 80 enum dma_data_direction direction)
81{ 81{
82#if defined(CONFIG_CPU_SH5) || defined(CONFIG_PMB) 82 void *addr;
83 void *p1addr = vaddr; 83
84#else 84 addr = __in_29bit_mode() ?
85 void *p1addr = (void*) P1SEGADDR((unsigned long)vaddr); 85 (void *)P1SEGADDR((unsigned long)vaddr) : vaddr;
86#endif
87 86
88 switch (direction) { 87 switch (direction) {
89 case DMA_FROM_DEVICE: /* invalidate only */ 88 case DMA_FROM_DEVICE: /* invalidate only */
90 __flush_invalidate_region(p1addr, size); 89 __flush_invalidate_region(addr, size);
91 break; 90 break;
92 case DMA_TO_DEVICE: /* writeback only */ 91 case DMA_TO_DEVICE: /* writeback only */
93 __flush_wback_region(p1addr, size); 92 __flush_wback_region(addr, size);
94 break; 93 break;
95 case DMA_BIDIRECTIONAL: /* writeback and invalidate */ 94 case DMA_BIDIRECTIONAL: /* writeback and invalidate */
96 __flush_purge_region(p1addr, size); 95 __flush_purge_region(addr, size);
97 break; 96 break;
98 default: 97 default:
99 BUG(); 98 BUG();
diff --git a/arch/sh/mm/gup.c b/arch/sh/mm/gup.c
new file mode 100644
index 000000000000..bf8daf9d9c9b
--- /dev/null
+++ b/arch/sh/mm/gup.c
@@ -0,0 +1,273 @@
1/*
2 * Lockless get_user_pages_fast for SuperH
3 *
4 * Copyright (C) 2009 - 2010 Paul Mundt
5 *
6 * Cloned from the x86 and PowerPC versions, by:
7 *
8 * Copyright (C) 2008 Nick Piggin
9 * Copyright (C) 2008 Novell Inc.
10 */
11#include <linux/sched.h>
12#include <linux/mm.h>
13#include <linux/vmstat.h>
14#include <linux/highmem.h>
15#include <asm/pgtable.h>
16
17static inline pte_t gup_get_pte(pte_t *ptep)
18{
19#ifndef CONFIG_X2TLB
20 return ACCESS_ONCE(*ptep);
21#else
22 /*
23 * With get_user_pages_fast, we walk down the pagetables without
24 * taking any locks. For this we would like to load the pointers
25 * atomically, but that is not possible with 64-bit PTEs. What
26 * we do have is the guarantee that a pte will only either go
27 * from not present to present, or present to not present or both
28 * -- it will not switch to a completely different present page
29 * without a TLB flush in between; something that we are blocking
30 * by holding interrupts off.
31 *
32 * Setting ptes from not present to present goes:
33 * ptep->pte_high = h;
34 * smp_wmb();
35 * ptep->pte_low = l;
36 *
37 * And present to not present goes:
38 * ptep->pte_low = 0;
39 * smp_wmb();
40 * ptep->pte_high = 0;
41 *
42 * We must ensure here that the load of pte_low sees l iff pte_high
43 * sees h. We load pte_high *after* loading pte_low, which ensures we
44 * don't see an older value of pte_high. *Then* we recheck pte_low,
45 * which ensures that we haven't picked up a changed pte high. We might
46 * have got rubbish values from pte_low and pte_high, but we are
47 * guaranteed that pte_low will not have the present bit set *unless*
48 * it is 'l'. And get_user_pages_fast only operates on present ptes, so
49 * we're safe.
50 *
51 * gup_get_pte should not be used or copied outside gup.c without being
52 * very careful -- it does not atomically load the pte or anything that
53 * is likely to be useful for you.
54 */
55 pte_t pte;
56
57retry:
58 pte.pte_low = ptep->pte_low;
59 smp_rmb();
60 pte.pte_high = ptep->pte_high;
61 smp_rmb();
62 if (unlikely(pte.pte_low != ptep->pte_low))
63 goto retry;
64
65 return pte;
66#endif
67}
68
69/*
70 * The performance critical leaf functions are made noinline otherwise gcc
71 * inlines everything into a single function which results in too much
72 * register pressure.
73 */
74static noinline int gup_pte_range(pmd_t pmd, unsigned long addr,
75 unsigned long end, int write, struct page **pages, int *nr)
76{
77 u64 mask, result;
78 pte_t *ptep;
79
80#ifdef CONFIG_X2TLB
81 result = _PAGE_PRESENT | _PAGE_EXT(_PAGE_EXT_KERN_READ | _PAGE_EXT_USER_READ);
82 if (write)
83 result |= _PAGE_EXT(_PAGE_EXT_KERN_WRITE | _PAGE_EXT_USER_WRITE);
84#elif defined(CONFIG_SUPERH64)
85 result = _PAGE_PRESENT | _PAGE_USER | _PAGE_READ;
86 if (write)
87 result |= _PAGE_WRITE;
88#else
89 result = _PAGE_PRESENT | _PAGE_USER;
90 if (write)
91 result |= _PAGE_RW;
92#endif
93
94 mask = result | _PAGE_SPECIAL;
95
96 ptep = pte_offset_map(&pmd, addr);
97 do {
98 pte_t pte = gup_get_pte(ptep);
99 struct page *page;
100
101 if ((pte_val(pte) & mask) != result) {
102 pte_unmap(ptep);
103 return 0;
104 }
105 VM_BUG_ON(!pfn_valid(pte_pfn(pte)));
106 page = pte_page(pte);
107 get_page(page);
108 pages[*nr] = page;
109 (*nr)++;
110
111 } while (ptep++, addr += PAGE_SIZE, addr != end);
112 pte_unmap(ptep - 1);
113
114 return 1;
115}
116
117static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
118 int write, struct page **pages, int *nr)
119{
120 unsigned long next;
121 pmd_t *pmdp;
122
123 pmdp = pmd_offset(&pud, addr);
124 do {
125 pmd_t pmd = *pmdp;
126
127 next = pmd_addr_end(addr, end);
128 if (pmd_none(pmd))
129 return 0;
130 if (!gup_pte_range(pmd, addr, next, write, pages, nr))
131 return 0;
132 } while (pmdp++, addr = next, addr != end);
133
134 return 1;
135}
136
137static int gup_pud_range(pgd_t pgd, unsigned long addr, unsigned long end,
138 int write, struct page **pages, int *nr)
139{
140 unsigned long next;
141 pud_t *pudp;
142
143 pudp = pud_offset(&pgd, addr);
144 do {
145 pud_t pud = *pudp;
146
147 next = pud_addr_end(addr, end);
148 if (pud_none(pud))
149 return 0;
150 if (!gup_pmd_range(pud, addr, next, write, pages, nr))
151 return 0;
152 } while (pudp++, addr = next, addr != end);
153
154 return 1;
155}
156
157/*
158 * Like get_user_pages_fast() except its IRQ-safe in that it won't fall
159 * back to the regular GUP.
160 */
161int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
162 struct page **pages)
163{
164 struct mm_struct *mm = current->mm;
165 unsigned long addr, len, end;
166 unsigned long next;
167 unsigned long flags;
168 pgd_t *pgdp;
169 int nr = 0;
170
171 start &= PAGE_MASK;
172 addr = start;
173 len = (unsigned long) nr_pages << PAGE_SHIFT;
174 end = start + len;
175 if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
176 (void __user *)start, len)))
177 return 0;
178
179 /*
180 * This doesn't prevent pagetable teardown, but does prevent
181 * the pagetables and pages from being freed.
182 */
183 local_irq_save(flags);
184 pgdp = pgd_offset(mm, addr);
185 do {
186 pgd_t pgd = *pgdp;
187
188 next = pgd_addr_end(addr, end);
189 if (pgd_none(pgd))
190 break;
191 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
192 break;
193 } while (pgdp++, addr = next, addr != end);
194 local_irq_restore(flags);
195
196 return nr;
197}
198
199/**
200 * get_user_pages_fast() - pin user pages in memory
201 * @start: starting user address
202 * @nr_pages: number of pages from start to pin
203 * @write: whether pages will be written to
204 * @pages: array that receives pointers to the pages pinned.
205 * Should be at least nr_pages long.
206 *
207 * Attempt to pin user pages in memory without taking mm->mmap_sem.
208 * If not successful, it will fall back to taking the lock and
209 * calling get_user_pages().
210 *
211 * Returns number of pages pinned. This may be fewer than the number
212 * requested. If nr_pages is 0 or negative, returns 0. If no pages
213 * were pinned, returns -errno.
214 */
215int get_user_pages_fast(unsigned long start, int nr_pages, int write,
216 struct page **pages)
217{
218 struct mm_struct *mm = current->mm;
219 unsigned long addr, len, end;
220 unsigned long next;
221 pgd_t *pgdp;
222 int nr = 0;
223
224 start &= PAGE_MASK;
225 addr = start;
226 len = (unsigned long) nr_pages << PAGE_SHIFT;
227
228 end = start + len;
229 if (end < start)
230 goto slow_irqon;
231
232 local_irq_disable();
233 pgdp = pgd_offset(mm, addr);
234 do {
235 pgd_t pgd = *pgdp;
236
237 next = pgd_addr_end(addr, end);
238 if (pgd_none(pgd))
239 goto slow;
240 if (!gup_pud_range(pgd, addr, next, write, pages, &nr))
241 goto slow;
242 } while (pgdp++, addr = next, addr != end);
243 local_irq_enable();
244
245 VM_BUG_ON(nr != (end - start) >> PAGE_SHIFT);
246 return nr;
247
248 {
249 int ret;
250
251slow:
252 local_irq_enable();
253slow_irqon:
254 /* Try to get the remaining pages with get_user_pages */
255 start += nr << PAGE_SHIFT;
256 pages += nr;
257
258 down_read(&mm->mmap_sem);
259 ret = get_user_pages(current, mm, start,
260 (end - start) >> PAGE_SHIFT, write, 0, pages, NULL);
261 up_read(&mm->mmap_sem);
262
263 /* Have to be a bit careful with return values */
264 if (nr > 0) {
265 if (ret < 0)
266 ret = nr;
267 else
268 ret += nr;
269 }
270
271 return ret;
272 }
273}
diff --git a/arch/sh/mm/uncached.c b/arch/sh/mm/uncached.c
index 8a4eca551fc0..a7767da815e9 100644
--- a/arch/sh/mm/uncached.c
+++ b/arch/sh/mm/uncached.c
@@ -28,7 +28,7 @@ EXPORT_SYMBOL(virt_addr_uncached);
28 28
29void __init uncached_init(void) 29void __init uncached_init(void)
30{ 30{
31#ifdef CONFIG_29BIT 31#if defined(CONFIG_29BIT) || !defined(CONFIG_MMU)
32 uncached_start = P2SEG; 32 uncached_start = P2SEG;
33#else 33#else
34 uncached_start = memory_end; 34 uncached_start = memory_end;
diff --git a/arch/sh/oprofile/Makefile b/arch/sh/oprofile/Makefile
index e85aae73e3dc..ce3b119021e7 100644
--- a/arch/sh/oprofile/Makefile
+++ b/arch/sh/oprofile/Makefile
@@ -1,5 +1,7 @@
1obj-$(CONFIG_OPROFILE) += oprofile.o 1obj-$(CONFIG_OPROFILE) += oprofile.o
2 2
3CFLAGS_common.o += -DUTS_MACHINE='"$(UTS_MACHINE)"'
4
3DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \ 5DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
4 oprof.o cpu_buffer.o buffer_sync.o \ 6 oprof.o cpu_buffer.o buffer_sync.o \
5 event_buffer.o oprofile_files.o \ 7 event_buffer.o oprofile_files.o \
diff --git a/arch/sh/oprofile/backtrace.c b/arch/sh/oprofile/backtrace.c
index 2bc74de23f08..37f3a75ea6cb 100644
--- a/arch/sh/oprofile/backtrace.c
+++ b/arch/sh/oprofile/backtrace.c
@@ -91,7 +91,7 @@ void sh_backtrace(struct pt_regs * const regs, unsigned int depth)
91 if (depth > backtrace_limit) 91 if (depth > backtrace_limit)
92 depth = backtrace_limit; 92 depth = backtrace_limit;
93 93
94 stackaddr = (unsigned long *)regs->regs[15]; 94 stackaddr = (unsigned long *)kernel_stack_pointer(regs);
95 if (!user_mode(regs)) { 95 if (!user_mode(regs)) {
96 if (depth) 96 if (depth)
97 unwind_stack(NULL, regs, stackaddr, 97 unwind_stack(NULL, regs, stackaddr,
diff --git a/arch/sh/oprofile/common.c b/arch/sh/oprofile/common.c
index e10d89376f9b..b4c2d2b946dd 100644
--- a/arch/sh/oprofile/common.c
+++ b/arch/sh/oprofile/common.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/sh/oprofile/init.c 2 * arch/sh/oprofile/init.c
3 * 3 *
4 * Copyright (C) 2003 - 2008 Paul Mundt 4 * Copyright (C) 2003 - 2010 Paul Mundt
5 * 5 *
6 * Based on arch/mips/oprofile/common.c: 6 * Based on arch/mips/oprofile/common.c:
7 * 7 *
@@ -18,43 +18,46 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/perf_event.h> 20#include <linux/perf_event.h>
21#include <linux/slab.h>
21#include <asm/processor.h> 22#include <asm/processor.h>
22 23
23#ifdef CONFIG_HW_PERF_EVENTS
24extern void sh_backtrace(struct pt_regs * const regs, unsigned int depth); 24extern void sh_backtrace(struct pt_regs * const regs, unsigned int depth);
25 25
26#ifdef CONFIG_HW_PERF_EVENTS
27/*
28 * This will need to be reworked when multiple PMUs are supported.
29 */
30static char *sh_pmu_op_name;
31
26char *op_name_from_perf_id(void) 32char *op_name_from_perf_id(void)
27{ 33{
28 const char *pmu; 34 return sh_pmu_op_name;
29 char buf[20];
30 int size;
31
32 pmu = perf_pmu_name();
33 if (!pmu)
34 return NULL;
35
36 size = snprintf(buf, sizeof(buf), "sh/%s", pmu);
37 if (size > -1 && size < sizeof(buf))
38 return buf;
39
40 return NULL;
41} 35}
42 36
43int __init oprofile_arch_init(struct oprofile_operations *ops) 37int __init oprofile_arch_init(struct oprofile_operations *ops)
44{ 38{
45 ops->backtrace = sh_backtrace; 39 ops->backtrace = sh_backtrace;
46 40
41 if (perf_num_counters() == 0)
42 return -ENODEV;
43
44 sh_pmu_op_name = kasprintf(GFP_KERNEL, "%s/%s",
45 UTS_MACHINE, perf_pmu_name());
46 if (unlikely(!sh_pmu_op_name))
47 return -ENOMEM;
48
47 return oprofile_perf_init(ops); 49 return oprofile_perf_init(ops);
48} 50}
49 51
50void __exit oprofile_arch_exit(void) 52void __exit oprofile_arch_exit(void)
51{ 53{
52 oprofile_perf_exit(); 54 oprofile_perf_exit();
55 kfree(sh_pmu_op_name);
53} 56}
54#else 57#else
55int __init oprofile_arch_init(struct oprofile_operations *ops) 58int __init oprofile_arch_init(struct oprofile_operations *ops)
56{ 59{
57 pr_info("oprofile: hardware counters not available\n"); 60 ops->backtrace = sh_backtrace;
58 return -ENODEV; 61 return -ENODEV;
59} 62}
60void __exit oprofile_arch_exit(void) {} 63void __exit oprofile_arch_exit(void) {}
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index 9f56eb978024..0e68465e7b50 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -26,7 +26,6 @@ HD64461 HD64461
267724SE SH_7724_SOLUTION_ENGINE 267724SE SH_7724_SOLUTION_ENGINE
277751SE SH_7751_SOLUTION_ENGINE 277751SE SH_7751_SOLUTION_ENGINE
287780SE SH_7780_SOLUTION_ENGINE 287780SE SH_7780_SOLUTION_ENGINE
297751SYSTEMH SH_7751_SYSTEMH
30HP6XX SH_HP6XX 29HP6XX SH_HP6XX
31DREAMCAST SH_DREAMCAST 30DREAMCAST SH_DREAMCAST
32SNAPGEAR SH_SECUREEDGE5410 31SNAPGEAR SH_SECUREEDGE5410
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 8e7bafc5dd0e..45d9c87d083a 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -1,9 +1,3 @@
1# For a description of the syntax of this configuration file,
2# see Documentation/kbuild/kconfig-language.txt.
3#
4
5mainmenu "Linux/SPARC Kernel Configuration"
6
7config 64BIT 1config 64BIT
8 bool "64-bit kernel" if ARCH = "sparc" 2 bool "64-bit kernel" if ARCH = "sparc"
9 default ARCH = "sparc64" 3 default ARCH = "sparc64"
@@ -28,8 +22,6 @@ config SPARC
28 select RTC_CLASS 22 select RTC_CLASS
29 select RTC_DRV_M48T59 23 select RTC_DRV_M48T59
30 select HAVE_IRQ_WORK 24 select HAVE_IRQ_WORK
31 select HAVE_PERF_EVENTS
32 select PERF_USE_VMALLOC
33 select HAVE_DMA_ATTRS 25 select HAVE_DMA_ATTRS
34 select HAVE_DMA_API_DEBUG 26 select HAVE_DMA_API_DEBUG
35 select HAVE_ARCH_JUMP_LABEL 27 select HAVE_ARCH_JUMP_LABEL
@@ -56,7 +48,6 @@ config SPARC64
56 select RTC_DRV_BQ4802 48 select RTC_DRV_BQ4802
57 select RTC_DRV_SUN4V 49 select RTC_DRV_SUN4V
58 select RTC_DRV_STARFIRE 50 select RTC_DRV_STARFIRE
59 select HAVE_IRQ_WORK
60 select HAVE_PERF_EVENTS 51 select HAVE_PERF_EVENTS
61 select PERF_USE_VMALLOC 52 select PERF_USE_VMALLOC
62 53
diff --git a/arch/sparc/include/asm/jump_label.h b/arch/sparc/include/asm/jump_label.h
index d95cf44fb40d..427d4684e0d2 100644
--- a/arch/sparc/include/asm/jump_label.h
+++ b/arch/sparc/include/asm/jump_label.h
@@ -4,7 +4,6 @@
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#include <linux/types.h> 6#include <linux/types.h>
7#include <asm/system.h>
8 7
9#define JUMP_LABEL_NOP_SIZE 4 8#define JUMP_LABEL_NOP_SIZE 4
10 9
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index 0116d8d10def..5ad6e5c5dbb3 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -365,7 +365,7 @@ static int request_fast_irq(unsigned int irq,
365 unsigned long flags; 365 unsigned long flags;
366 unsigned int cpu_irq; 366 unsigned int cpu_irq;
367 int ret; 367 int ret;
368#ifdef CONFIG_SMP 368#if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON
369 struct tt_entry *trap_table; 369 struct tt_entry *trap_table;
370 extern struct tt_entry trapbase_cpu1, trapbase_cpu2, trapbase_cpu3; 370 extern struct tt_entry trapbase_cpu1, trapbase_cpu2, trapbase_cpu3;
371#endif 371#endif
@@ -425,7 +425,7 @@ static int request_fast_irq(unsigned int irq,
425 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP; 425 table[SP_TRAP_IRQ1+(cpu_irq-1)].inst_four = SPARC_NOP;
426 426
427 INSTANTIATE(sparc_ttable) 427 INSTANTIATE(sparc_ttable)
428#ifdef CONFIG_SMP 428#if defined CONFIG_SMP && !defined CONFIG_SPARC_LEON
429 trap_table = &trapbase_cpu1; INSTANTIATE(trap_table) 429 trap_table = &trapbase_cpu1; INSTANTIATE(trap_table)
430 trap_table = &trapbase_cpu2; INSTANTIATE(trap_table) 430 trap_table = &trapbase_cpu2; INSTANTIATE(trap_table)
431 trap_table = &trapbase_cpu3; INSTANTIATE(trap_table) 431 trap_table = &trapbase_cpu3; INSTANTIATE(trap_table)
diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index e1656fc41ccb..7524689b03d2 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -56,8 +56,8 @@ void __init leon_configure_cache_smp(void);
56static inline unsigned long do_swap(volatile unsigned long *ptr, 56static inline unsigned long do_swap(volatile unsigned long *ptr,
57 unsigned long val) 57 unsigned long val)
58{ 58{
59 __asm__ __volatile__("swapa [%1] %2, %0\n\t" : "=&r"(val) 59 __asm__ __volatile__("swapa [%2] %3, %0\n\t" : "=&r"(val)
60 : "r"(ptr), "i"(ASI_LEON_DCACHE_MISS) 60 : "0"(val), "r"(ptr), "i"(ASI_LEON_DCACHE_MISS)
61 : "memory"); 61 : "memory");
62 return val; 62 return val;
63} 63}
diff --git a/arch/sparc/kernel/rtrap_32.S b/arch/sparc/kernel/rtrap_32.S
index 4da2e1f66290..5f5f74c2c2ca 100644
--- a/arch/sparc/kernel/rtrap_32.S
+++ b/arch/sparc/kernel/rtrap_32.S
@@ -78,9 +78,9 @@ signal_p:
78 call do_notify_resume 78 call do_notify_resume
79 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr 79 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr
80 80
81 /* Fall through. */ 81 b signal_p
82 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr 82 ld [%curptr + TI_FLAGS], %g2
83 clr %l6 83
84ret_trap_continue: 84ret_trap_continue:
85 sethi %hi(PSR_SYSCALL), %g1 85 sethi %hi(PSR_SYSCALL), %g1
86 andn %t_psr, %g1, %t_psr 86 andn %t_psr, %g1, %t_psr
diff --git a/arch/sparc/kernel/rtrap_64.S b/arch/sparc/kernel/rtrap_64.S
index 090b9e9ad5e3..77f1b95e0806 100644
--- a/arch/sparc/kernel/rtrap_64.S
+++ b/arch/sparc/kernel/rtrap_64.S
@@ -34,37 +34,9 @@ __handle_preemption:
34__handle_user_windows: 34__handle_user_windows:
35 call fault_in_user_windows 35 call fault_in_user_windows
36 wrpr %g0, RTRAP_PSTATE, %pstate 36 wrpr %g0, RTRAP_PSTATE, %pstate
37 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 37 ba,pt %xcc, __handle_preemption_continue
38 /* Redo sched+sig checks */ 38 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
39 ldx [%g6 + TI_FLAGS], %l0
40 andcc %l0, _TIF_NEED_RESCHED, %g0
41
42 be,pt %xcc, 1f
43 nop
44 call schedule
45 wrpr %g0, RTRAP_PSTATE, %pstate
46 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
47 ldx [%g6 + TI_FLAGS], %l0
48
491: andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
50 be,pt %xcc, __handle_user_windows_continue
51 nop
52 mov %l5, %o1
53 add %sp, PTREGS_OFF, %o0
54 mov %l0, %o2
55
56 call do_notify_resume
57 wrpr %g0, RTRAP_PSTATE, %pstate
58 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
59 /* Signal delivery can modify pt_regs tstate, so we must
60 * reload it.
61 */
62 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
63 sethi %hi(0xf << 20), %l4
64 and %l1, %l4, %l4
65 ba,pt %xcc, __handle_user_windows_continue
66 39
67 andn %l1, %l4, %l1
68__handle_userfpu: 40__handle_userfpu:
69 rd %fprs, %l5 41 rd %fprs, %l5
70 andcc %l5, FPRS_FEF, %g0 42 andcc %l5, FPRS_FEF, %g0
@@ -87,7 +59,7 @@ __handle_signal:
87 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1 59 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %l1
88 sethi %hi(0xf << 20), %l4 60 sethi %hi(0xf << 20), %l4
89 and %l1, %l4, %l4 61 and %l1, %l4, %l4
90 ba,pt %xcc, __handle_signal_continue 62 ba,pt %xcc, __handle_preemption_continue
91 andn %l1, %l4, %l1 63 andn %l1, %l4, %l1
92 64
93 /* When returning from a NMI (%pil==15) interrupt we want to 65 /* When returning from a NMI (%pil==15) interrupt we want to
@@ -177,11 +149,9 @@ __handle_preemption_continue:
177 bne,pn %xcc, __handle_preemption 149 bne,pn %xcc, __handle_preemption
178 andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0 150 andcc %l0, _TIF_DO_NOTIFY_RESUME_MASK, %g0
179 bne,pn %xcc, __handle_signal 151 bne,pn %xcc, __handle_signal
180__handle_signal_continue:
181 ldub [%g6 + TI_WSAVED], %o2 152 ldub [%g6 + TI_WSAVED], %o2
182 brnz,pn %o2, __handle_user_windows 153 brnz,pn %o2, __handle_user_windows
183 nop 154 nop
184__handle_user_windows_continue:
185 sethi %hi(TSTATE_PEF), %o0 155 sethi %hi(TSTATE_PEF), %o0
186 andcc %l1, %o0, %g0 156 andcc %l1, %o0, %g0
187 157
diff --git a/arch/sparc/mm/fault_32.c b/arch/sparc/mm/fault_32.c
index bd8601601afa..5b836f5aea90 100644
--- a/arch/sparc/mm/fault_32.c
+++ b/arch/sparc/mm/fault_32.c
@@ -539,6 +539,12 @@ do_sigbus:
539 __do_fault_siginfo(BUS_ADRERR, SIGBUS, tsk->thread.kregs, address); 539 __do_fault_siginfo(BUS_ADRERR, SIGBUS, tsk->thread.kregs, address);
540} 540}
541 541
542static void check_stack_aligned(unsigned long sp)
543{
544 if (sp & 0x7UL)
545 force_sig(SIGILL, current);
546}
547
542void window_overflow_fault(void) 548void window_overflow_fault(void)
543{ 549{
544 unsigned long sp; 550 unsigned long sp;
@@ -547,6 +553,8 @@ void window_overflow_fault(void)
547 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) 553 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
548 force_user_fault(sp + 0x38, 1); 554 force_user_fault(sp + 0x38, 1);
549 force_user_fault(sp, 1); 555 force_user_fault(sp, 1);
556
557 check_stack_aligned(sp);
550} 558}
551 559
552void window_underflow_fault(unsigned long sp) 560void window_underflow_fault(unsigned long sp)
@@ -554,6 +562,8 @@ void window_underflow_fault(unsigned long sp)
554 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) 562 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
555 force_user_fault(sp + 0x38, 0); 563 force_user_fault(sp + 0x38, 0);
556 force_user_fault(sp, 0); 564 force_user_fault(sp, 0);
565
566 check_stack_aligned(sp);
557} 567}
558 568
559void window_ret_fault(struct pt_regs *regs) 569void window_ret_fault(struct pt_regs *regs)
@@ -564,4 +574,6 @@ void window_ret_fault(struct pt_regs *regs)
564 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK)) 574 if(((sp + 0x38) & PAGE_MASK) != (sp & PAGE_MASK))
565 force_user_fault(sp + 0x38, 0); 575 force_user_fault(sp + 0x38, 0);
566 force_user_fault(sp, 0); 576 force_user_fault(sp, 0);
577
578 check_stack_aligned(sp);
567} 579}
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 7e8c2844e093..07ec8a865c1d 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -117,8 +117,6 @@ config TILE
117# config HUGETLB_PAGE_SIZE_VARIABLE 117# config HUGETLB_PAGE_SIZE_VARIABLE
118 118
119 119
120mainmenu "Linux/TILE Kernel Configuration"
121
122# Please note: TILE-Gx support is not yet finalized; this is 120# Please note: TILE-Gx support is not yet finalized; this is
123# the preliminary support. TILE-Gx drivers are only provided 121# the preliminary support. TILE-Gx drivers are only provided
124# with the alpha or beta test versions for Tilera customers. 122# with the alpha or beta test versions for Tilera customers.
diff --git a/arch/tile/include/asm/highmem.h b/arch/tile/include/asm/highmem.h
index e0f7ee186721..b2a6c5de79ab 100644
--- a/arch/tile/include/asm/highmem.h
+++ b/arch/tile/include/asm/highmem.h
@@ -23,7 +23,6 @@
23 23
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/threads.h> 25#include <linux/threads.h>
26#include <asm/kmap_types.h>
27#include <asm/tlbflush.h> 26#include <asm/tlbflush.h>
28#include <asm/homecache.h> 27#include <asm/homecache.h>
29 28
diff --git a/arch/tile/include/asm/kmap_types.h b/arch/tile/include/asm/kmap_types.h
index 1480106d1c05..3d0f20246260 100644
--- a/arch/tile/include/asm/kmap_types.h
+++ b/arch/tile/include/asm/kmap_types.h
@@ -16,28 +16,42 @@
16#define _ASM_TILE_KMAP_TYPES_H 16#define _ASM_TILE_KMAP_TYPES_H
17 17
18/* 18/*
19 * In TILE Linux each set of four of these uses another 16MB chunk of 19 * In 32-bit TILE Linux we have to balance the desire to have a lot of
20 * address space, given 64 tiles and 64KB pages, so we only enable 20 * nested atomic mappings with the fact that large page sizes and many
21 * ones that are required by the kernel configuration. 21 * processors chew up address space quickly. In a typical
22 * 64-processor, 64KB-page layout build, making KM_TYPE_NR one larger
23 * adds 4MB of required address-space. For now we leave KM_TYPE_NR
24 * set to depth 8.
22 */ 25 */
23enum km_type { 26enum km_type {
27 KM_TYPE_NR = 8
28};
29
30/*
31 * We provide dummy definitions of all the stray values that used to be
32 * required for kmap_atomic() and no longer are.
33 */
34enum {
24 KM_BOUNCE_READ, 35 KM_BOUNCE_READ,
25 KM_SKB_SUNRPC_DATA, 36 KM_SKB_SUNRPC_DATA,
26 KM_SKB_DATA_SOFTIRQ, 37 KM_SKB_DATA_SOFTIRQ,
27 KM_USER0, 38 KM_USER0,
28 KM_USER1, 39 KM_USER1,
29 KM_BIO_SRC_IRQ, 40 KM_BIO_SRC_IRQ,
41 KM_BIO_DST_IRQ,
42 KM_PTE0,
43 KM_PTE1,
30 KM_IRQ0, 44 KM_IRQ0,
31 KM_IRQ1, 45 KM_IRQ1,
32 KM_SOFTIRQ0, 46 KM_SOFTIRQ0,
33 KM_SOFTIRQ1, 47 KM_SOFTIRQ1,
34 KM_MEMCPY0, 48 KM_SYNC_ICACHE,
35 KM_MEMCPY1, 49 KM_SYNC_DCACHE,
36#if defined(CONFIG_HIGHPTE) 50 KM_UML_USERCOPY,
37 KM_PTE0, 51 KM_IRQ_PTE,
38 KM_PTE1, 52 KM_NMI,
39#endif 53 KM_NMI_PTE,
40 KM_TYPE_NR 54 KM_KDB
41}; 55};
42 56
43#endif /* _ASM_TILE_KMAP_TYPES_H */ 57#endif /* _ASM_TILE_KMAP_TYPES_H */
diff --git a/arch/tile/include/asm/pgtable.h b/arch/tile/include/asm/pgtable.h
index dc4ccdd855bc..a6604e9485da 100644
--- a/arch/tile/include/asm/pgtable.h
+++ b/arch/tile/include/asm/pgtable.h
@@ -344,10 +344,8 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
344#define pgd_offset_k(address) pgd_offset(&init_mm, address) 344#define pgd_offset_k(address) pgd_offset(&init_mm, address)
345 345
346#if defined(CONFIG_HIGHPTE) 346#if defined(CONFIG_HIGHPTE)
347extern pte_t *_pte_offset_map(pmd_t *, unsigned long address, enum km_type); 347extern pte_t *pte_offset_map(pmd_t *, unsigned long address);
348#define pte_offset_map(dir, address) \ 348#define pte_unmap(pte) kunmap_atomic(pte)
349 _pte_offset_map(dir, address, KM_PTE0)
350#define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
351#else 349#else
352#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) 350#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
353#define pte_unmap(pte) do { } while (0) 351#define pte_unmap(pte) do { } while (0)
diff --git a/arch/tile/include/asm/stat.h b/arch/tile/include/asm/stat.h
index 3dc90fa92c70..b16e5db8f0e7 100644
--- a/arch/tile/include/asm/stat.h
+++ b/arch/tile/include/asm/stat.h
@@ -1 +1,4 @@
1#ifdef CONFIG_COMPAT
2#define __ARCH_WANT_STAT64 /* Used for compat_sys_stat64() etc. */
3#endif
1#include <asm-generic/stat.h> 4#include <asm-generic/stat.h>
diff --git a/arch/tile/include/asm/unistd.h b/arch/tile/include/asm/unistd.h
index f2e3ff485333..b35c2db71199 100644
--- a/arch/tile/include/asm/unistd.h
+++ b/arch/tile/include/asm/unistd.h
@@ -41,6 +41,7 @@ __SYSCALL(__NR_cmpxchg_badaddr, sys_cmpxchg_badaddr)
41#ifdef CONFIG_COMPAT 41#ifdef CONFIG_COMPAT
42#define __ARCH_WANT_SYS_LLSEEK 42#define __ARCH_WANT_SYS_LLSEEK
43#endif 43#endif
44#define __ARCH_WANT_SYS_NEWFSTATAT
44#endif 45#endif
45 46
46#endif /* _ASM_TILE_UNISTD_H */ 47#endif /* _ASM_TILE_UNISTD_H */
diff --git a/arch/tile/kernel/compat.c b/arch/tile/kernel/compat.c
index 77739cdd9462..67617a05e602 100644
--- a/arch/tile/kernel/compat.c
+++ b/arch/tile/kernel/compat.c
@@ -148,11 +148,11 @@ long tile_compat_sys_msgrcv(int msqid,
148#define compat_sys_readahead sys32_readahead 148#define compat_sys_readahead sys32_readahead
149#define compat_sys_sync_file_range compat_sys_sync_file_range2 149#define compat_sys_sync_file_range compat_sys_sync_file_range2
150 150
151/* The native 64-bit "struct stat" matches the 32-bit "struct stat64". */ 151/* We leverage the "struct stat64" type for 32-bit time_t/nsec. */
152#define compat_sys_stat64 sys_newstat 152#define compat_sys_stat64 sys_stat64
153#define compat_sys_lstat64 sys_newlstat 153#define compat_sys_lstat64 sys_lstat64
154#define compat_sys_fstat64 sys_newfstat 154#define compat_sys_fstat64 sys_fstat64
155#define compat_sys_fstatat64 sys_newfstatat 155#define compat_sys_fstatat64 sys_fstatat64
156 156
157/* The native sys_ptrace dynamically handles compat binaries. */ 157/* The native sys_ptrace dynamically handles compat binaries. */
158#define compat_sys_ptrace sys_ptrace 158#define compat_sys_ptrace sys_ptrace
diff --git a/arch/tile/kernel/early_printk.c b/arch/tile/kernel/early_printk.c
index 2c54fd43a8a0..493a0e66d916 100644
--- a/arch/tile/kernel/early_printk.c
+++ b/arch/tile/kernel/early_printk.c
@@ -54,7 +54,7 @@ void early_printk(const char *fmt, ...)
54void early_panic(const char *fmt, ...) 54void early_panic(const char *fmt, ...)
55{ 55{
56 va_list ap; 56 va_list ap;
57 raw_local_irq_disable_all(); 57 arch_local_irq_disable_all();
58 va_start(ap, fmt); 58 va_start(ap, fmt);
59 early_printk("Kernel panic - not syncing: "); 59 early_printk("Kernel panic - not syncing: ");
60 early_vprintk(fmt, ap); 60 early_vprintk(fmt, ap);
diff --git a/arch/tile/kernel/hardwall.c b/arch/tile/kernel/hardwall.c
index 1e54a7843410..e910530436e6 100644
--- a/arch/tile/kernel/hardwall.c
+++ b/arch/tile/kernel/hardwall.c
@@ -151,12 +151,12 @@ enum direction_protect {
151 151
152static void enable_firewall_interrupts(void) 152static void enable_firewall_interrupts(void)
153{ 153{
154 raw_local_irq_unmask_now(INT_UDN_FIREWALL); 154 arch_local_irq_unmask_now(INT_UDN_FIREWALL);
155} 155}
156 156
157static void disable_firewall_interrupts(void) 157static void disable_firewall_interrupts(void)
158{ 158{
159 raw_local_irq_mask_now(INT_UDN_FIREWALL); 159 arch_local_irq_mask_now(INT_UDN_FIREWALL);
160} 160}
161 161
162/* Set up hardwall on this cpu based on the passed hardwall_info. */ 162/* Set up hardwall on this cpu based on the passed hardwall_info. */
@@ -768,13 +768,13 @@ static int hardwall_release(struct inode *inode, struct file *file)
768} 768}
769 769
770static const struct file_operations dev_hardwall_fops = { 770static const struct file_operations dev_hardwall_fops = {
771 .open = nonseekable_open,
771 .unlocked_ioctl = hardwall_ioctl, 772 .unlocked_ioctl = hardwall_ioctl,
772#ifdef CONFIG_COMPAT 773#ifdef CONFIG_COMPAT
773 .compat_ioctl = hardwall_compat_ioctl, 774 .compat_ioctl = hardwall_compat_ioctl,
774#endif 775#endif
775 .flush = hardwall_flush, 776 .flush = hardwall_flush,
776 .release = hardwall_release, 777 .release = hardwall_release,
777 .llseek = noop_llseek,
778}; 778};
779 779
780static struct cdev hardwall_dev; 780static struct cdev hardwall_dev;
diff --git a/arch/tile/kernel/irq.c b/arch/tile/kernel/irq.c
index e63917687e99..128805ef8f2c 100644
--- a/arch/tile/kernel/irq.c
+++ b/arch/tile/kernel/irq.c
@@ -26,7 +26,7 @@
26#define IS_HW_CLEARED 1 26#define IS_HW_CLEARED 1
27 27
28/* 28/*
29 * The set of interrupts we enable for raw_local_irq_enable(). 29 * The set of interrupts we enable for arch_local_irq_enable().
30 * This is initialized to have just a single interrupt that the kernel 30 * This is initialized to have just a single interrupt that the kernel
31 * doesn't actually use as a sentinel. During kernel init, 31 * doesn't actually use as a sentinel. During kernel init,
32 * interrupts are added as the kernel gets prepared to support them. 32 * interrupts are added as the kernel gets prepared to support them.
@@ -225,7 +225,7 @@ void __cpuinit setup_irq_regs(void)
225 /* Enable interrupt delivery. */ 225 /* Enable interrupt delivery. */
226 unmask_irqs(~0UL); 226 unmask_irqs(~0UL);
227#if CHIP_HAS_IPI() 227#if CHIP_HAS_IPI()
228 raw_local_irq_unmask(INT_IPI_K); 228 arch_local_irq_unmask(INT_IPI_K);
229#endif 229#endif
230} 230}
231 231
diff --git a/arch/tile/kernel/machine_kexec.c b/arch/tile/kernel/machine_kexec.c
index ba7a265d6179..0d8b9e933487 100644
--- a/arch/tile/kernel/machine_kexec.c
+++ b/arch/tile/kernel/machine_kexec.c
@@ -182,13 +182,13 @@ static void kexec_find_and_set_command_line(struct kimage *image)
182 182
183 if ((entry & IND_SOURCE)) { 183 if ((entry & IND_SOURCE)) {
184 void *va = 184 void *va =
185 kmap_atomic_pfn(entry >> PAGE_SHIFT, KM_USER0); 185 kmap_atomic_pfn(entry >> PAGE_SHIFT);
186 r = kexec_bn2cl(va); 186 r = kexec_bn2cl(va);
187 if (r) { 187 if (r) {
188 command_line = r; 188 command_line = r;
189 break; 189 break;
190 } 190 }
191 kunmap_atomic(va, KM_USER0); 191 kunmap_atomic(va);
192 } 192 }
193 } 193 }
194 194
@@ -198,7 +198,7 @@ static void kexec_find_and_set_command_line(struct kimage *image)
198 198
199 hverr = hv_set_command_line( 199 hverr = hv_set_command_line(
200 (HV_VirtAddr) command_line, strlen(command_line)); 200 (HV_VirtAddr) command_line, strlen(command_line));
201 kunmap_atomic(command_line, KM_USER0); 201 kunmap_atomic(command_line);
202 } else { 202 } else {
203 pr_info("%s: no command line found; making empty\n", 203 pr_info("%s: no command line found; making empty\n",
204 __func__); 204 __func__);
diff --git a/arch/tile/kernel/messaging.c b/arch/tile/kernel/messaging.c
index 997e3933f726..0858ee6b520f 100644
--- a/arch/tile/kernel/messaging.c
+++ b/arch/tile/kernel/messaging.c
@@ -34,7 +34,7 @@ void __cpuinit init_messaging(void)
34 panic("hv_register_message_state: error %d", rc); 34 panic("hv_register_message_state: error %d", rc);
35 35
36 /* Make sure downcall interrupts will be enabled. */ 36 /* Make sure downcall interrupts will be enabled. */
37 raw_local_irq_unmask(INT_INTCTRL_K); 37 arch_local_irq_unmask(INT_INTCTRL_K);
38} 38}
39 39
40void hv_message_intr(struct pt_regs *regs, int intnum) 40void hv_message_intr(struct pt_regs *regs, int intnum)
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 9cd29884c09f..e92e40527d6d 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -50,10 +50,10 @@ long arch_ptrace(struct task_struct *child, long request,
50{ 50{
51 unsigned long __user *datap = (long __user __force *)data; 51 unsigned long __user *datap = (long __user __force *)data;
52 unsigned long tmp; 52 unsigned long tmp;
53 int i;
54 long ret = -EIO; 53 long ret = -EIO;
55 unsigned long *childregs;
56 char *childreg; 54 char *childreg;
55 struct pt_regs copyregs;
56 int ex1_offset;
57 57
58 switch (request) { 58 switch (request) {
59 59
@@ -80,6 +80,16 @@ long arch_ptrace(struct task_struct *child, long request,
80 if (addr >= PTREGS_SIZE) 80 if (addr >= PTREGS_SIZE)
81 break; 81 break;
82 childreg = (char *)task_pt_regs(child) + addr; 82 childreg = (char *)task_pt_regs(child) + addr;
83
84 /* Guard against overwrites of the privilege level. */
85 ex1_offset = PTREGS_OFFSET_EX1;
86#if defined(CONFIG_COMPAT) && defined(__BIG_ENDIAN)
87 if (is_compat_task()) /* point at low word */
88 ex1_offset += sizeof(compat_long_t);
89#endif
90 if (addr == ex1_offset)
91 data = PL_ICS_EX1(USER_PL, EX1_ICS(data));
92
83#ifdef CONFIG_COMPAT 93#ifdef CONFIG_COMPAT
84 if (is_compat_task()) { 94 if (is_compat_task()) {
85 if (addr & (sizeof(compat_long_t)-1)) 95 if (addr & (sizeof(compat_long_t)-1))
@@ -96,26 +106,19 @@ long arch_ptrace(struct task_struct *child, long request,
96 break; 106 break;
97 107
98 case PTRACE_GETREGS: /* Get all registers from the child. */ 108 case PTRACE_GETREGS: /* Get all registers from the child. */
99 if (!access_ok(VERIFY_WRITE, datap, PTREGS_SIZE)) 109 if (copy_to_user(datap, task_pt_regs(child),
100 break; 110 sizeof(struct pt_regs)) == 0) {
101 childregs = (long *)task_pt_regs(child); 111 ret = 0;
102 for (i = 0; i < sizeof(struct pt_regs)/sizeof(unsigned long);
103 ++i) {
104 ret = __put_user(childregs[i], &datap[i]);
105 if (ret != 0)
106 break;
107 } 112 }
108 break; 113 break;
109 114
110 case PTRACE_SETREGS: /* Set all registers in the child. */ 115 case PTRACE_SETREGS: /* Set all registers in the child. */
111 if (!access_ok(VERIFY_READ, datap, PTREGS_SIZE)) 116 if (copy_from_user(&copyregs, datap,
112 break; 117 sizeof(struct pt_regs)) == 0) {
113 childregs = (long *)task_pt_regs(child); 118 copyregs.ex1 =
114 for (i = 0; i < sizeof(struct pt_regs)/sizeof(unsigned long); 119 PL_ICS_EX1(USER_PL, EX1_ICS(copyregs.ex1));
115 ++i) { 120 *task_pt_regs(child) = copyregs;
116 ret = __get_user(childregs[i], &datap[i]); 121 ret = 0;
117 if (ret != 0)
118 break;
119 } 122 }
120 break; 123 break;
121 124
diff --git a/arch/tile/kernel/reboot.c b/arch/tile/kernel/reboot.c
index acd86d20beba..baa3d905fee2 100644
--- a/arch/tile/kernel/reboot.c
+++ b/arch/tile/kernel/reboot.c
@@ -27,7 +27,7 @@
27void machine_halt(void) 27void machine_halt(void)
28{ 28{
29 warn_early_printk(); 29 warn_early_printk();
30 raw_local_irq_disable_all(); 30 arch_local_irq_disable_all();
31 smp_send_stop(); 31 smp_send_stop();
32 hv_halt(); 32 hv_halt();
33} 33}
@@ -35,14 +35,14 @@ void machine_halt(void)
35void machine_power_off(void) 35void machine_power_off(void)
36{ 36{
37 warn_early_printk(); 37 warn_early_printk();
38 raw_local_irq_disable_all(); 38 arch_local_irq_disable_all();
39 smp_send_stop(); 39 smp_send_stop();
40 hv_power_off(); 40 hv_power_off();
41} 41}
42 42
43void machine_restart(char *cmd) 43void machine_restart(char *cmd)
44{ 44{
45 raw_local_irq_disable_all(); 45 arch_local_irq_disable_all();
46 smp_send_stop(); 46 smp_send_stop();
47 hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd); 47 hv_restart((HV_VirtAddr) "vmlinux", (HV_VirtAddr) cmd);
48} 48}
diff --git a/arch/tile/kernel/setup.c b/arch/tile/kernel/setup.c
index ae51cad12da0..fb0b3cbeae14 100644
--- a/arch/tile/kernel/setup.c
+++ b/arch/tile/kernel/setup.c
@@ -868,14 +868,14 @@ void __cpuinit setup_cpu(int boot)
868 868
869 /* Allow asynchronous TLB interrupts. */ 869 /* Allow asynchronous TLB interrupts. */
870#if CHIP_HAS_TILE_DMA() 870#if CHIP_HAS_TILE_DMA()
871 raw_local_irq_unmask(INT_DMATLB_MISS); 871 arch_local_irq_unmask(INT_DMATLB_MISS);
872 raw_local_irq_unmask(INT_DMATLB_ACCESS); 872 arch_local_irq_unmask(INT_DMATLB_ACCESS);
873#endif 873#endif
874#if CHIP_HAS_SN_PROC() 874#if CHIP_HAS_SN_PROC()
875 raw_local_irq_unmask(INT_SNITLB_MISS); 875 arch_local_irq_unmask(INT_SNITLB_MISS);
876#endif 876#endif
877#ifdef __tilegx__ 877#ifdef __tilegx__
878 raw_local_irq_unmask(INT_SINGLE_STEP_K); 878 arch_local_irq_unmask(INT_SINGLE_STEP_K);
879#endif 879#endif
880 880
881 /* 881 /*
diff --git a/arch/tile/kernel/signal.c b/arch/tile/kernel/signal.c
index fb28e85ae3ae..687719d4abd1 100644
--- a/arch/tile/kernel/signal.c
+++ b/arch/tile/kernel/signal.c
@@ -71,6 +71,9 @@ int restore_sigcontext(struct pt_regs *regs,
71 for (i = 0; i < sizeof(struct pt_regs)/sizeof(long); ++i) 71 for (i = 0; i < sizeof(struct pt_regs)/sizeof(long); ++i)
72 err |= __get_user(regs->regs[i], &sc->gregs[i]); 72 err |= __get_user(regs->regs[i], &sc->gregs[i]);
73 73
74 /* Ensure that the PL is always set to USER_PL. */
75 regs->ex1 = PL_ICS_EX1(USER_PL, EX1_ICS(regs->ex1));
76
74 regs->faultnum = INT_SWINT_1_SIGRETURN; 77 regs->faultnum = INT_SWINT_1_SIGRETURN;
75 78
76 err |= __get_user(*pr0, &sc->gregs[0]); 79 err |= __get_user(*pr0, &sc->gregs[0]);
@@ -330,7 +333,7 @@ void do_signal(struct pt_regs *regs)
330 current_thread_info()->status &= ~TS_RESTORE_SIGMASK; 333 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
331 } 334 }
332 335
333 return; 336 goto done;
334 } 337 }
335 338
336 /* Did we come from a system call? */ 339 /* Did we come from a system call? */
@@ -358,4 +361,8 @@ void do_signal(struct pt_regs *regs)
358 current_thread_info()->status &= ~TS_RESTORE_SIGMASK; 361 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
359 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 362 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
360 } 363 }
364
365done:
366 /* Avoid double syscall restart if there are nested signals. */
367 regs->faultnum = INT_SWINT_1_SIGRETURN;
361} 368}
diff --git a/arch/tile/kernel/smp.c b/arch/tile/kernel/smp.c
index 75255d90aff3..9575b37a8b75 100644
--- a/arch/tile/kernel/smp.c
+++ b/arch/tile/kernel/smp.c
@@ -115,7 +115,7 @@ static void smp_start_cpu_interrupt(void)
115static void smp_stop_cpu_interrupt(void) 115static void smp_stop_cpu_interrupt(void)
116{ 116{
117 set_cpu_online(smp_processor_id(), 0); 117 set_cpu_online(smp_processor_id(), 0);
118 raw_local_irq_disable_all(); 118 arch_local_irq_disable_all();
119 for (;;) 119 for (;;)
120 asm("nap"); 120 asm("nap");
121} 121}
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index 6bed820e1421..f2e156e44692 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -132,7 +132,7 @@ static int tile_timer_set_next_event(unsigned long ticks,
132{ 132{
133 BUG_ON(ticks > MAX_TICK); 133 BUG_ON(ticks > MAX_TICK);
134 __insn_mtspr(SPR_TILE_TIMER_CONTROL, ticks); 134 __insn_mtspr(SPR_TILE_TIMER_CONTROL, ticks);
135 raw_local_irq_unmask_now(INT_TILE_TIMER); 135 arch_local_irq_unmask_now(INT_TILE_TIMER);
136 return 0; 136 return 0;
137} 137}
138 138
@@ -143,7 +143,7 @@ static int tile_timer_set_next_event(unsigned long ticks,
143static void tile_timer_set_mode(enum clock_event_mode mode, 143static void tile_timer_set_mode(enum clock_event_mode mode,
144 struct clock_event_device *evt) 144 struct clock_event_device *evt)
145{ 145{
146 raw_local_irq_mask_now(INT_TILE_TIMER); 146 arch_local_irq_mask_now(INT_TILE_TIMER);
147} 147}
148 148
149/* 149/*
@@ -172,7 +172,7 @@ void __cpuinit setup_tile_timer(void)
172 evt->cpumask = cpumask_of(smp_processor_id()); 172 evt->cpumask = cpumask_of(smp_processor_id());
173 173
174 /* Start out with timer not firing. */ 174 /* Start out with timer not firing. */
175 raw_local_irq_mask_now(INT_TILE_TIMER); 175 arch_local_irq_mask_now(INT_TILE_TIMER);
176 176
177 /* Register tile timer. */ 177 /* Register tile timer. */
178 clockevents_register_device(evt); 178 clockevents_register_device(evt);
@@ -188,7 +188,7 @@ void do_timer_interrupt(struct pt_regs *regs, int fault_num)
188 * Mask the timer interrupt here, since we are a oneshot timer 188 * Mask the timer interrupt here, since we are a oneshot timer
189 * and there are now by definition no events pending. 189 * and there are now by definition no events pending.
190 */ 190 */
191 raw_local_irq_mask(INT_TILE_TIMER); 191 arch_local_irq_mask(INT_TILE_TIMER);
192 192
193 /* Track time spent here in an interrupt context */ 193 /* Track time spent here in an interrupt context */
194 irq_enter(); 194 irq_enter();
diff --git a/arch/tile/lib/memcpy_tile64.c b/arch/tile/lib/memcpy_tile64.c
index dfedea7b266b..f7d4a6ad61e8 100644
--- a/arch/tile/lib/memcpy_tile64.c
+++ b/arch/tile/lib/memcpy_tile64.c
@@ -54,7 +54,7 @@ typedef unsigned long (*memcpy_t)(void *, const void *, unsigned long);
54 * we must run with interrupts disabled to avoid the risk of some 54 * we must run with interrupts disabled to avoid the risk of some
55 * other code seeing the incoherent data in our cache. (Recall that 55 * other code seeing the incoherent data in our cache. (Recall that
56 * our cache is indexed by PA, so even if the other code doesn't use 56 * our cache is indexed by PA, so even if the other code doesn't use
57 * our KM_MEMCPY virtual addresses, they'll still hit in cache using 57 * our kmap_atomic virtual addresses, they'll still hit in cache using
58 * the normal VAs that aren't supposed to hit in cache.) 58 * the normal VAs that aren't supposed to hit in cache.)
59 */ 59 */
60static void memcpy_multicache(void *dest, const void *source, 60static void memcpy_multicache(void *dest, const void *source,
@@ -64,6 +64,7 @@ static void memcpy_multicache(void *dest, const void *source,
64 unsigned long flags, newsrc, newdst; 64 unsigned long flags, newsrc, newdst;
65 pmd_t *pmdp; 65 pmd_t *pmdp;
66 pte_t *ptep; 66 pte_t *ptep;
67 int type0, type1;
67 int cpu = get_cpu(); 68 int cpu = get_cpu();
68 69
69 /* 70 /*
@@ -77,7 +78,8 @@ static void memcpy_multicache(void *dest, const void *source,
77 sim_allow_multiple_caching(1); 78 sim_allow_multiple_caching(1);
78 79
79 /* Set up the new dest mapping */ 80 /* Set up the new dest mapping */
80 idx = FIX_KMAP_BEGIN + (KM_TYPE_NR * cpu) + KM_MEMCPY0; 81 type0 = kmap_atomic_idx_push();
82 idx = FIX_KMAP_BEGIN + (KM_TYPE_NR * cpu) + type0;
81 newdst = __fix_to_virt(idx) + ((unsigned long)dest & (PAGE_SIZE-1)); 83 newdst = __fix_to_virt(idx) + ((unsigned long)dest & (PAGE_SIZE-1));
82 pmdp = pmd_offset(pud_offset(pgd_offset_k(newdst), newdst), newdst); 84 pmdp = pmd_offset(pud_offset(pgd_offset_k(newdst), newdst), newdst);
83 ptep = pte_offset_kernel(pmdp, newdst); 85 ptep = pte_offset_kernel(pmdp, newdst);
@@ -87,7 +89,8 @@ static void memcpy_multicache(void *dest, const void *source,
87 } 89 }
88 90
89 /* Set up the new source mapping */ 91 /* Set up the new source mapping */
90 idx += (KM_MEMCPY0 - KM_MEMCPY1); 92 type1 = kmap_atomic_idx_push();
93 idx += (type0 - type1);
91 src_pte = hv_pte_set_nc(src_pte); 94 src_pte = hv_pte_set_nc(src_pte);
92 src_pte = hv_pte_clear_writable(src_pte); /* be paranoid */ 95 src_pte = hv_pte_clear_writable(src_pte); /* be paranoid */
93 newsrc = __fix_to_virt(idx) + ((unsigned long)source & (PAGE_SIZE-1)); 96 newsrc = __fix_to_virt(idx) + ((unsigned long)source & (PAGE_SIZE-1));
@@ -119,6 +122,8 @@ static void memcpy_multicache(void *dest, const void *source,
119 * We're done: notify the simulator that all is back to normal, 122 * We're done: notify the simulator that all is back to normal,
120 * and re-enable interrupts and pre-emption. 123 * and re-enable interrupts and pre-emption.
121 */ 124 */
125 kmap_atomic_idx_pop();
126 kmap_atomic_idx_pop();
122 sim_allow_multiple_caching(0); 127 sim_allow_multiple_caching(0);
123 local_irq_restore(flags); 128 local_irq_restore(flags);
124 put_cpu(); 129 put_cpu();
diff --git a/arch/tile/mm/highmem.c b/arch/tile/mm/highmem.c
index abb57331cf6e..31dbbd9afe47 100644
--- a/arch/tile/mm/highmem.c
+++ b/arch/tile/mm/highmem.c
@@ -227,7 +227,7 @@ EXPORT_SYMBOL(kmap_atomic_prot);
227void *__kmap_atomic(struct page *page) 227void *__kmap_atomic(struct page *page)
228{ 228{
229 /* PAGE_NONE is a magic value that tells us to check immutability. */ 229 /* PAGE_NONE is a magic value that tells us to check immutability. */
230 return kmap_atomic_prot(page, type, PAGE_NONE); 230 return kmap_atomic_prot(page, PAGE_NONE);
231} 231}
232EXPORT_SYMBOL(__kmap_atomic); 232EXPORT_SYMBOL(__kmap_atomic);
233 233
diff --git a/arch/tile/mm/init.c b/arch/tile/mm/init.c
index 78e1982cb6c9..0b9ce69b0ee5 100644
--- a/arch/tile/mm/init.c
+++ b/arch/tile/mm/init.c
@@ -988,8 +988,12 @@ static long __write_once initfree = 1;
988/* Select whether to free (1) or mark unusable (0) the __init pages. */ 988/* Select whether to free (1) or mark unusable (0) the __init pages. */
989static int __init set_initfree(char *str) 989static int __init set_initfree(char *str)
990{ 990{
991 strict_strtol(str, 0, &initfree); 991 long val;
992 pr_info("initfree: %s free init pages\n", initfree ? "will" : "won't"); 992 if (strict_strtol(str, 0, &val)) {
993 initfree = val;
994 pr_info("initfree: %s free init pages\n",
995 initfree ? "will" : "won't");
996 }
993 return 1; 997 return 1;
994} 998}
995__setup("initfree=", set_initfree); 999__setup("initfree=", set_initfree);
diff --git a/arch/tile/mm/pgtable.c b/arch/tile/mm/pgtable.c
index 335c24621c41..1f5430c53d0d 100644
--- a/arch/tile/mm/pgtable.c
+++ b/arch/tile/mm/pgtable.c
@@ -134,9 +134,9 @@ void __set_fixmap(enum fixed_addresses idx, unsigned long phys, pgprot_t flags)
134} 134}
135 135
136#if defined(CONFIG_HIGHPTE) 136#if defined(CONFIG_HIGHPTE)
137pte_t *_pte_offset_map(pmd_t *dir, unsigned long address, enum km_type type) 137pte_t *_pte_offset_map(pmd_t *dir, unsigned long address)
138{ 138{
139 pte_t *pte = kmap_atomic(pmd_page(*dir), type) + 139 pte_t *pte = kmap_atomic(pmd_page(*dir)) +
140 (pmd_ptfn(*dir) << HV_LOG2_PAGE_TABLE_ALIGN) & ~PAGE_MASK; 140 (pmd_ptfn(*dir) << HV_LOG2_PAGE_TABLE_ALIGN) & ~PAGE_MASK;
141 return &pte[pte_index(address)]; 141 return &pte[pte_index(address)];
142} 142}
diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index 7c8e277f6d34..049d048b070d 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -19,8 +19,6 @@ config MMU
19config NO_IOMEM 19config NO_IOMEM
20 def_bool y 20 def_bool y
21 21
22mainmenu "Linux/Usermode Kernel Configuration"
23
24config ISA 22config ISA
25 bool 23 bool
26 24
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h
index 2cd899f75a3c..b7c5bab9bd77 100644
--- a/arch/um/include/asm/ptrace-generic.h
+++ b/arch/um/include/asm/ptrace-generic.h
@@ -38,8 +38,8 @@ struct pt_regs {
38 38
39struct task_struct; 39struct task_struct;
40 40
41extern long subarch_ptrace(struct task_struct *child, long request, long addr, 41extern long subarch_ptrace(struct task_struct *child, long request,
42 long data); 42 unsigned long addr, unsigned long data);
43extern unsigned long getreg(struct task_struct *child, int regno); 43extern unsigned long getreg(struct task_struct *child, int regno);
44extern int putreg(struct task_struct *child, int regno, unsigned long value); 44extern int putreg(struct task_struct *child, int regno, unsigned long value);
45extern int get_fpregs(struct user_i387_struct __user *buf, 45extern int get_fpregs(struct user_i387_struct __user *buf,
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index a5e33f29bbeb..701b672c1122 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -122,7 +122,7 @@ long arch_ptrace(struct task_struct *child, long request,
122 break; 122 break;
123 123
124 case PTRACE_SET_THREAD_AREA: 124 case PTRACE_SET_THREAD_AREA:
125 ret = ptrace_set_thread_area(child, addr, datavp); 125 ret = ptrace_set_thread_area(child, addr, vp);
126 break; 126 break;
127 127
128 case PTRACE_FAULTINFO: { 128 case PTRACE_FAULTINFO: {
diff --git a/arch/x86/Kbuild b/arch/x86/Kbuild
index ad8ec356fb36..0e103236b754 100644
--- a/arch/x86/Kbuild
+++ b/arch/x86/Kbuild
@@ -14,3 +14,4 @@ obj-y += crypto/
14obj-y += vdso/ 14obj-y += vdso/
15obj-$(CONFIG_IA32_EMULATION) += ia32/ 15obj-$(CONFIG_IA32_EMULATION) += ia32/
16 16
17obj-y += platform/
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 299fbc86f570..e8327686d3c5 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1,6 +1,3 @@
1# x86 configuration
2mainmenu "Linux Kernel Configuration for x86"
3
4# Select 32 or 64 bit 1# Select 32 or 64 bit
5config 64BIT 2config 64BIT
6 bool "64-bit kernel" if ARCH = "x86" 3 bool "64-bit kernel" if ARCH = "x86"
@@ -1896,6 +1893,11 @@ config PCI_OLPC
1896 def_bool y 1893 def_bool y
1897 depends on PCI && OLPC && (PCI_GOOLPC || PCI_GOANY) 1894 depends on PCI && OLPC && (PCI_GOOLPC || PCI_GOANY)
1898 1895
1896config PCI_XEN
1897 def_bool y
1898 depends on PCI && XEN
1899 select SWIOTLB_XEN
1900
1899config PCI_DOMAINS 1901config PCI_DOMAINS
1900 def_bool y 1902 def_bool y
1901 depends on PCI 1903 depends on PCI
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index 92091de11113..55d106b5e31b 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -93,6 +93,9 @@ extern u8 acpi_sci_flags;
93extern int acpi_sci_override_gsi; 93extern int acpi_sci_override_gsi;
94void acpi_pic_sci_set_trigger(unsigned int, u16); 94void acpi_pic_sci_set_trigger(unsigned int, u16);
95 95
96extern int (*__acpi_register_gsi)(struct device *dev, u32 gsi,
97 int trigger, int polarity);
98
96static inline void disable_acpi(void) 99static inline void disable_acpi(void)
97{ 100{
98 acpi_disabled = 1; 101 acpi_disabled = 1;
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 286de34b0ed6..f6ce0bda3b98 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -141,13 +141,13 @@ static inline void native_apic_msr_write(u32 reg, u32 v)
141 141
142static inline u32 native_apic_msr_read(u32 reg) 142static inline u32 native_apic_msr_read(u32 reg)
143{ 143{
144 u32 low, high; 144 u64 msr;
145 145
146 if (reg == APIC_DFR) 146 if (reg == APIC_DFR)
147 return -1; 147 return -1;
148 148
149 rdmsr(APIC_BASE_MSR + (reg >> 4), low, high); 149 rdmsrl(APIC_BASE_MSR + (reg >> 4), msr);
150 return low; 150 return (u32)msr;
151} 151}
152 152
153static inline void native_x2apic_wait_icr_idle(void) 153static inline void native_x2apic_wait_icr_idle(void)
@@ -181,12 +181,12 @@ extern void enable_x2apic(void);
181extern void x2apic_icr_write(u32 low, u32 id); 181extern void x2apic_icr_write(u32 low, u32 id);
182static inline int x2apic_enabled(void) 182static inline int x2apic_enabled(void)
183{ 183{
184 int msr, msr2; 184 u64 msr;
185 185
186 if (!cpu_has_x2apic) 186 if (!cpu_has_x2apic)
187 return 0; 187 return 0;
188 188
189 rdmsr(MSR_IA32_APICBASE, msr, msr2); 189 rdmsrl(MSR_IA32_APICBASE, msr);
190 if (msr & X2APIC_ENABLE) 190 if (msr & X2APIC_ENABLE)
191 return 1; 191 return 1;
192 return 0; 192 return 0;
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index f0203f4791a8..072273082528 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -41,6 +41,8 @@
41#include <asm-generic/int-ll64.h> 41#include <asm-generic/int-ll64.h>
42#include <asm/page.h> 42#include <asm/page.h>
43 43
44#include <xen/xen.h>
45
44#define build_mmio_read(name, size, type, reg, barrier) \ 46#define build_mmio_read(name, size, type, reg, barrier) \
45static inline type name(const volatile void __iomem *addr) \ 47static inline type name(const volatile void __iomem *addr) \
46{ type ret; asm volatile("mov" size " %1,%0":reg (ret) \ 48{ type ret; asm volatile("mov" size " %1,%0":reg (ret) \
@@ -351,6 +353,17 @@ extern void early_iounmap(void __iomem *addr, unsigned long size);
351extern void fixup_early_ioremap(void); 353extern void fixup_early_ioremap(void);
352extern bool is_early_ioremap_ptep(pte_t *ptep); 354extern bool is_early_ioremap_ptep(pte_t *ptep);
353 355
356#ifdef CONFIG_XEN
357struct bio_vec;
358
359extern bool xen_biovec_phys_mergeable(const struct bio_vec *vec1,
360 const struct bio_vec *vec2);
361
362#define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \
363 (__BIOVEC_PHYS_MERGEABLE(vec1, vec2) && \
364 (!xen_domain() || xen_biovec_phys_mergeable(vec1, vec2)))
365#endif /* CONFIG_XEN */
366
354#define IO_SPACE_LIMIT 0xffff 367#define IO_SPACE_LIMIT 0xffff
355 368
356#endif /* _ASM_X86_IO_H */ 369#endif /* _ASM_X86_IO_H */
diff --git a/arch/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h
index c8be4566c3d2..a6b28d017c2f 100644
--- a/arch/x86/include/asm/io_apic.h
+++ b/arch/x86/include/asm/io_apic.h
@@ -169,6 +169,7 @@ extern void mask_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries);
169extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries); 169extern int restore_IO_APIC_setup(struct IO_APIC_route_entry **ioapic_entries);
170 170
171extern void probe_nr_irqs_gsi(void); 171extern void probe_nr_irqs_gsi(void);
172extern int get_nr_irqs_gsi(void);
172 173
173extern void setup_ioapic_ids_from_mpc(void); 174extern void setup_ioapic_ids_from_mpc(void);
174 175
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index 18e3b8a8709f..ef9975812c77 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -824,27 +824,27 @@ static __always_inline void arch_spin_unlock(struct arch_spinlock *lock)
824#define __PV_IS_CALLEE_SAVE(func) \ 824#define __PV_IS_CALLEE_SAVE(func) \
825 ((struct paravirt_callee_save) { func }) 825 ((struct paravirt_callee_save) { func })
826 826
827static inline unsigned long arch_local_save_flags(void) 827static inline notrace unsigned long arch_local_save_flags(void)
828{ 828{
829 return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl); 829 return PVOP_CALLEE0(unsigned long, pv_irq_ops.save_fl);
830} 830}
831 831
832static inline void arch_local_irq_restore(unsigned long f) 832static inline notrace void arch_local_irq_restore(unsigned long f)
833{ 833{
834 PVOP_VCALLEE1(pv_irq_ops.restore_fl, f); 834 PVOP_VCALLEE1(pv_irq_ops.restore_fl, f);
835} 835}
836 836
837static inline void arch_local_irq_disable(void) 837static inline notrace void arch_local_irq_disable(void)
838{ 838{
839 PVOP_VCALLEE0(pv_irq_ops.irq_disable); 839 PVOP_VCALLEE0(pv_irq_ops.irq_disable);
840} 840}
841 841
842static inline void arch_local_irq_enable(void) 842static inline notrace void arch_local_irq_enable(void)
843{ 843{
844 PVOP_VCALLEE0(pv_irq_ops.irq_enable); 844 PVOP_VCALLEE0(pv_irq_ops.irq_enable);
845} 845}
846 846
847static inline unsigned long arch_local_irq_save(void) 847static inline notrace unsigned long arch_local_irq_save(void)
848{ 848{
849 unsigned long f; 849 unsigned long f;
850 850
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index d395540ff894..ca0437c714b2 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -7,6 +7,7 @@
7#include <linux/string.h> 7#include <linux/string.h>
8#include <asm/scatterlist.h> 8#include <asm/scatterlist.h>
9#include <asm/io.h> 9#include <asm/io.h>
10#include <asm/x86_init.h>
10 11
11#ifdef __KERNEL__ 12#ifdef __KERNEL__
12 13
@@ -94,8 +95,36 @@ static inline void early_quirks(void) { }
94 95
95extern void pci_iommu_alloc(void); 96extern void pci_iommu_alloc(void);
96 97
97/* MSI arch hook */ 98#ifdef CONFIG_PCI_MSI
98#define arch_setup_msi_irqs arch_setup_msi_irqs 99/* MSI arch specific hooks */
100static inline int x86_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
101{
102 return x86_msi.setup_msi_irqs(dev, nvec, type);
103}
104
105static inline void x86_teardown_msi_irqs(struct pci_dev *dev)
106{
107 x86_msi.teardown_msi_irqs(dev);
108}
109
110static inline void x86_teardown_msi_irq(unsigned int irq)
111{
112 x86_msi.teardown_msi_irq(irq);
113}
114#define arch_setup_msi_irqs x86_setup_msi_irqs
115#define arch_teardown_msi_irqs x86_teardown_msi_irqs
116#define arch_teardown_msi_irq x86_teardown_msi_irq
117/* implemented in arch/x86/kernel/apic/io_apic. */
118int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type);
119void native_teardown_msi_irq(unsigned int irq);
120/* default to the implementation in drivers/lib/msi.c */
121#define HAVE_DEFAULT_MSI_TEARDOWN_IRQS
122void default_teardown_msi_irqs(struct pci_dev *dev);
123#else
124#define native_setup_msi_irqs NULL
125#define native_teardown_msi_irq NULL
126#define default_teardown_msi_irqs NULL
127#endif
99 128
100#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) 129#define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
101 130
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index 49c7219826f9..704526734bef 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -47,6 +47,7 @@ enum pci_bf_sort_state {
47extern unsigned int pcibios_max_latency; 47extern unsigned int pcibios_max_latency;
48 48
49void pcibios_resource_survey(void); 49void pcibios_resource_survey(void);
50void pcibios_set_cache_line_size(void);
50 51
51/* pci-pc.c */ 52/* pci-pc.c */
52 53
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index bf6b88ef8eeb..e969f691cbfd 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -5,7 +5,7 @@
5 * 5 *
6 * SGI UV architectural definitions 6 * SGI UV architectural definitions
7 * 7 *
8 * Copyright (C) 2007-2008 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (C) 2007-2010 Silicon Graphics, Inc. All rights reserved.
9 */ 9 */
10 10
11#ifndef _ASM_X86_UV_UV_HUB_H 11#ifndef _ASM_X86_UV_UV_HUB_H
@@ -77,7 +77,8 @@
77 * 77 *
78 * 1111110000000000 78 * 1111110000000000
79 * 5432109876543210 79 * 5432109876543210
80 * pppppppppplc0cch 80 * pppppppppplc0cch Nehalem-EX
81 * ppppppppplcc0cch Westmere-EX
81 * sssssssssss 82 * sssssssssss
82 * 83 *
83 * p = pnode bits 84 * p = pnode bits
@@ -148,12 +149,25 @@ struct uv_hub_info_s {
148 unsigned char m_val; 149 unsigned char m_val;
149 unsigned char n_val; 150 unsigned char n_val;
150 struct uv_scir_s scir; 151 struct uv_scir_s scir;
152 unsigned char apic_pnode_shift;
151}; 153};
152 154
153DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info); 155DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
154#define uv_hub_info (&__get_cpu_var(__uv_hub_info)) 156#define uv_hub_info (&__get_cpu_var(__uv_hub_info))
155#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu)) 157#define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
156 158
159union uvh_apicid {
160 unsigned long v;
161 struct uvh_apicid_s {
162 unsigned long local_apic_mask : 24;
163 unsigned long local_apic_shift : 5;
164 unsigned long unused1 : 3;
165 unsigned long pnode_mask : 24;
166 unsigned long pnode_shift : 5;
167 unsigned long unused2 : 3;
168 } s;
169};
170
157/* 171/*
158 * Local & Global MMR space macros. 172 * Local & Global MMR space macros.
159 * Note: macros are intended to be used ONLY by inline functions 173 * Note: macros are intended to be used ONLY by inline functions
@@ -182,6 +196,7 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
182#define UV_GLOBAL_MMR64_PNODE_BITS(p) \ 196#define UV_GLOBAL_MMR64_PNODE_BITS(p) \
183 (((unsigned long)(p)) << UV_GLOBAL_MMR64_PNODE_SHIFT) 197 (((unsigned long)(p)) << UV_GLOBAL_MMR64_PNODE_SHIFT)
184 198
199#define UVH_APICID 0x002D0E00L
185#define UV_APIC_PNODE_SHIFT 6 200#define UV_APIC_PNODE_SHIFT 6
186 201
187/* Local Bus from cpu's perspective */ 202/* Local Bus from cpu's perspective */
@@ -280,7 +295,7 @@ static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
280 */ 295 */
281static inline int uv_apicid_to_pnode(int apicid) 296static inline int uv_apicid_to_pnode(int apicid)
282{ 297{
283 return (apicid >> UV_APIC_PNODE_SHIFT); 298 return (apicid >> uv_hub_info->apic_pnode_shift);
284} 299}
285 300
286/* 301/*
diff --git a/arch/x86/include/asm/uv/uv_mmrs.h b/arch/x86/include/asm/uv/uv_mmrs.h
index b2f2d2e05cec..6d90adf4428a 100644
--- a/arch/x86/include/asm/uv/uv_mmrs.h
+++ b/arch/x86/include/asm/uv/uv_mmrs.h
@@ -806,6 +806,78 @@ union uvh_node_present_table_u {
806}; 806};
807 807
808/* ========================================================================= */ 808/* ========================================================================= */
809/* UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR */
810/* ========================================================================= */
811#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR 0x16000c8UL
812
813#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_BASE_SHFT 24
814#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_BASE_MASK 0x00000000ff000000UL
815#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_M_ALIAS_SHFT 48
816#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_M_ALIAS_MASK 0x001f000000000000UL
817#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_ENABLE_SHFT 63
818#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR_ENABLE_MASK 0x8000000000000000UL
819
820union uvh_rh_gam_alias210_overlay_config_0_mmr_u {
821 unsigned long v;
822 struct uvh_rh_gam_alias210_overlay_config_0_mmr_s {
823 unsigned long rsvd_0_23: 24; /* */
824 unsigned long base : 8; /* RW */
825 unsigned long rsvd_32_47: 16; /* */
826 unsigned long m_alias : 5; /* RW */
827 unsigned long rsvd_53_62: 10; /* */
828 unsigned long enable : 1; /* RW */
829 } s;
830};
831
832/* ========================================================================= */
833/* UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR */
834/* ========================================================================= */
835#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR 0x16000d8UL
836
837#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_BASE_SHFT 24
838#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_BASE_MASK 0x00000000ff000000UL
839#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_M_ALIAS_SHFT 48
840#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_M_ALIAS_MASK 0x001f000000000000UL
841#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_ENABLE_SHFT 63
842#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR_ENABLE_MASK 0x8000000000000000UL
843
844union uvh_rh_gam_alias210_overlay_config_1_mmr_u {
845 unsigned long v;
846 struct uvh_rh_gam_alias210_overlay_config_1_mmr_s {
847 unsigned long rsvd_0_23: 24; /* */
848 unsigned long base : 8; /* RW */
849 unsigned long rsvd_32_47: 16; /* */
850 unsigned long m_alias : 5; /* RW */
851 unsigned long rsvd_53_62: 10; /* */
852 unsigned long enable : 1; /* RW */
853 } s;
854};
855
856/* ========================================================================= */
857/* UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR */
858/* ========================================================================= */
859#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR 0x16000e8UL
860
861#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_BASE_SHFT 24
862#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_BASE_MASK 0x00000000ff000000UL
863#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_M_ALIAS_SHFT 48
864#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_M_ALIAS_MASK 0x001f000000000000UL
865#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_ENABLE_SHFT 63
866#define UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR_ENABLE_MASK 0x8000000000000000UL
867
868union uvh_rh_gam_alias210_overlay_config_2_mmr_u {
869 unsigned long v;
870 struct uvh_rh_gam_alias210_overlay_config_2_mmr_s {
871 unsigned long rsvd_0_23: 24; /* */
872 unsigned long base : 8; /* RW */
873 unsigned long rsvd_32_47: 16; /* */
874 unsigned long m_alias : 5; /* RW */
875 unsigned long rsvd_53_62: 10; /* */
876 unsigned long enable : 1; /* RW */
877 } s;
878};
879
880/* ========================================================================= */
809/* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR */ 881/* UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR */
810/* ========================================================================= */ 882/* ========================================================================= */
811#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR 0x16000d0UL 883#define UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR 0x16000d0UL
@@ -857,6 +929,29 @@ union uvh_rh_gam_alias210_redirect_config_2_mmr_u {
857}; 929};
858 930
859/* ========================================================================= */ 931/* ========================================================================= */
932/* UVH_RH_GAM_CONFIG_MMR */
933/* ========================================================================= */
934#define UVH_RH_GAM_CONFIG_MMR 0x1600000UL
935
936#define UVH_RH_GAM_CONFIG_MMR_M_SKT_SHFT 0
937#define UVH_RH_GAM_CONFIG_MMR_M_SKT_MASK 0x000000000000003fUL
938#define UVH_RH_GAM_CONFIG_MMR_N_SKT_SHFT 6
939#define UVH_RH_GAM_CONFIG_MMR_N_SKT_MASK 0x00000000000003c0UL
940#define UVH_RH_GAM_CONFIG_MMR_MMIOL_CFG_SHFT 12
941#define UVH_RH_GAM_CONFIG_MMR_MMIOL_CFG_MASK 0x0000000000001000UL
942
943union uvh_rh_gam_config_mmr_u {
944 unsigned long v;
945 struct uvh_rh_gam_config_mmr_s {
946 unsigned long m_skt : 6; /* RW */
947 unsigned long n_skt : 4; /* RW */
948 unsigned long rsvd_10_11: 2; /* */
949 unsigned long mmiol_cfg : 1; /* RW */
950 unsigned long rsvd_13_63: 51; /* */
951 } s;
952};
953
954/* ========================================================================= */
860/* UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR */ 955/* UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR */
861/* ========================================================================= */ 956/* ========================================================================= */
862#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR 0x1600010UL 957#define UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR 0x1600010UL
@@ -987,97 +1082,5 @@ union uvh_rtc1_int_config_u {
987 } s; 1082 } s;
988}; 1083};
989 1084
990/* ========================================================================= */
991/* UVH_SI_ADDR_MAP_CONFIG */
992/* ========================================================================= */
993#define UVH_SI_ADDR_MAP_CONFIG 0xc80000UL
994
995#define UVH_SI_ADDR_MAP_CONFIG_M_SKT_SHFT 0
996#define UVH_SI_ADDR_MAP_CONFIG_M_SKT_MASK 0x000000000000003fUL
997#define UVH_SI_ADDR_MAP_CONFIG_N_SKT_SHFT 8
998#define UVH_SI_ADDR_MAP_CONFIG_N_SKT_MASK 0x0000000000000f00UL
999
1000union uvh_si_addr_map_config_u {
1001 unsigned long v;
1002 struct uvh_si_addr_map_config_s {
1003 unsigned long m_skt : 6; /* RW */
1004 unsigned long rsvd_6_7: 2; /* */
1005 unsigned long n_skt : 4; /* RW */
1006 unsigned long rsvd_12_63: 52; /* */
1007 } s;
1008};
1009
1010/* ========================================================================= */
1011/* UVH_SI_ALIAS0_OVERLAY_CONFIG */
1012/* ========================================================================= */
1013#define UVH_SI_ALIAS0_OVERLAY_CONFIG 0xc80008UL
1014
1015#define UVH_SI_ALIAS0_OVERLAY_CONFIG_BASE_SHFT 24
1016#define UVH_SI_ALIAS0_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
1017#define UVH_SI_ALIAS0_OVERLAY_CONFIG_M_ALIAS_SHFT 48
1018#define UVH_SI_ALIAS0_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
1019#define UVH_SI_ALIAS0_OVERLAY_CONFIG_ENABLE_SHFT 63
1020#define UVH_SI_ALIAS0_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
1021
1022union uvh_si_alias0_overlay_config_u {
1023 unsigned long v;
1024 struct uvh_si_alias0_overlay_config_s {
1025 unsigned long rsvd_0_23: 24; /* */
1026 unsigned long base : 8; /* RW */
1027 unsigned long rsvd_32_47: 16; /* */
1028 unsigned long m_alias : 5; /* RW */
1029 unsigned long rsvd_53_62: 10; /* */
1030 unsigned long enable : 1; /* RW */
1031 } s;
1032};
1033
1034/* ========================================================================= */
1035/* UVH_SI_ALIAS1_OVERLAY_CONFIG */
1036/* ========================================================================= */
1037#define UVH_SI_ALIAS1_OVERLAY_CONFIG 0xc80010UL
1038
1039#define UVH_SI_ALIAS1_OVERLAY_CONFIG_BASE_SHFT 24
1040#define UVH_SI_ALIAS1_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
1041#define UVH_SI_ALIAS1_OVERLAY_CONFIG_M_ALIAS_SHFT 48
1042#define UVH_SI_ALIAS1_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
1043#define UVH_SI_ALIAS1_OVERLAY_CONFIG_ENABLE_SHFT 63
1044#define UVH_SI_ALIAS1_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
1045
1046union uvh_si_alias1_overlay_config_u {
1047 unsigned long v;
1048 struct uvh_si_alias1_overlay_config_s {
1049 unsigned long rsvd_0_23: 24; /* */
1050 unsigned long base : 8; /* RW */
1051 unsigned long rsvd_32_47: 16; /* */
1052 unsigned long m_alias : 5; /* RW */
1053 unsigned long rsvd_53_62: 10; /* */
1054 unsigned long enable : 1; /* RW */
1055 } s;
1056};
1057
1058/* ========================================================================= */
1059/* UVH_SI_ALIAS2_OVERLAY_CONFIG */
1060/* ========================================================================= */
1061#define UVH_SI_ALIAS2_OVERLAY_CONFIG 0xc80018UL
1062
1063#define UVH_SI_ALIAS2_OVERLAY_CONFIG_BASE_SHFT 24
1064#define UVH_SI_ALIAS2_OVERLAY_CONFIG_BASE_MASK 0x00000000ff000000UL
1065#define UVH_SI_ALIAS2_OVERLAY_CONFIG_M_ALIAS_SHFT 48
1066#define UVH_SI_ALIAS2_OVERLAY_CONFIG_M_ALIAS_MASK 0x001f000000000000UL
1067#define UVH_SI_ALIAS2_OVERLAY_CONFIG_ENABLE_SHFT 63
1068#define UVH_SI_ALIAS2_OVERLAY_CONFIG_ENABLE_MASK 0x8000000000000000UL
1069
1070union uvh_si_alias2_overlay_config_u {
1071 unsigned long v;
1072 struct uvh_si_alias2_overlay_config_s {
1073 unsigned long rsvd_0_23: 24; /* */
1074 unsigned long base : 8; /* RW */
1075 unsigned long rsvd_32_47: 16; /* */
1076 unsigned long m_alias : 5; /* RW */
1077 unsigned long rsvd_53_62: 10; /* */
1078 unsigned long enable : 1; /* RW */
1079 } s;
1080};
1081
1082 1085
1083#endif /* _ASM_X86_UV_UV_MMRS_H */ 1086#endif /* __ASM_UV_MMRS_X86_H__ */
diff --git a/arch/x86/include/asm/x86_init.h b/arch/x86/include/asm/x86_init.h
index baa579c8e038..64642ad019fb 100644
--- a/arch/x86/include/asm/x86_init.h
+++ b/arch/x86/include/asm/x86_init.h
@@ -154,9 +154,18 @@ struct x86_platform_ops {
154 int (*i8042_detect)(void); 154 int (*i8042_detect)(void);
155}; 155};
156 156
157struct pci_dev;
158
159struct x86_msi_ops {
160 int (*setup_msi_irqs)(struct pci_dev *dev, int nvec, int type);
161 void (*teardown_msi_irq)(unsigned int irq);
162 void (*teardown_msi_irqs)(struct pci_dev *dev);
163};
164
157extern struct x86_init_ops x86_init; 165extern struct x86_init_ops x86_init;
158extern struct x86_cpuinit_ops x86_cpuinit; 166extern struct x86_cpuinit_ops x86_cpuinit;
159extern struct x86_platform_ops x86_platform; 167extern struct x86_platform_ops x86_platform;
168extern struct x86_msi_ops x86_msi;
160 169
161extern void x86_init_noop(void); 170extern void x86_init_noop(void);
162extern void x86_init_uint_noop(unsigned int unused); 171extern void x86_init_uint_noop(unsigned int unused);
diff --git a/arch/x86/include/asm/xen/pci.h b/arch/x86/include/asm/xen/pci.h
new file mode 100644
index 000000000000..2329b3eaf8d3
--- /dev/null
+++ b/arch/x86/include/asm/xen/pci.h
@@ -0,0 +1,65 @@
1#ifndef _ASM_X86_XEN_PCI_H
2#define _ASM_X86_XEN_PCI_H
3
4#if defined(CONFIG_PCI_XEN)
5extern int __init pci_xen_init(void);
6extern int __init pci_xen_hvm_init(void);
7#define pci_xen 1
8#else
9#define pci_xen 0
10#define pci_xen_init (0)
11static inline int pci_xen_hvm_init(void)
12{
13 return -1;
14}
15#endif
16#if defined(CONFIG_XEN_DOM0)
17void __init xen_setup_pirqs(void);
18#else
19static inline void __init xen_setup_pirqs(void)
20{
21}
22#endif
23
24#if defined(CONFIG_PCI_MSI)
25#if defined(CONFIG_PCI_XEN)
26/* The drivers/pci/xen-pcifront.c sets this structure to
27 * its own functions.
28 */
29struct xen_pci_frontend_ops {
30 int (*enable_msi)(struct pci_dev *dev, int **vectors);
31 void (*disable_msi)(struct pci_dev *dev);
32 int (*enable_msix)(struct pci_dev *dev, int **vectors, int nvec);
33 void (*disable_msix)(struct pci_dev *dev);
34};
35
36extern struct xen_pci_frontend_ops *xen_pci_frontend;
37
38static inline int xen_pci_frontend_enable_msi(struct pci_dev *dev,
39 int **vectors)
40{
41 if (xen_pci_frontend && xen_pci_frontend->enable_msi)
42 return xen_pci_frontend->enable_msi(dev, vectors);
43 return -ENODEV;
44}
45static inline void xen_pci_frontend_disable_msi(struct pci_dev *dev)
46{
47 if (xen_pci_frontend && xen_pci_frontend->disable_msi)
48 xen_pci_frontend->disable_msi(dev);
49}
50static inline int xen_pci_frontend_enable_msix(struct pci_dev *dev,
51 int **vectors, int nvec)
52{
53 if (xen_pci_frontend && xen_pci_frontend->enable_msix)
54 return xen_pci_frontend->enable_msix(dev, vectors, nvec);
55 return -ENODEV;
56}
57static inline void xen_pci_frontend_disable_msix(struct pci_dev *dev)
58{
59 if (xen_pci_frontend && xen_pci_frontend->disable_msix)
60 xen_pci_frontend->disable_msix(dev);
61}
62#endif /* CONFIG_PCI_XEN */
63#endif /* CONFIG_PCI_MSI */
64
65#endif /* _ASM_X86_XEN_PCI_H */
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 2c833d8c4141..9e13763b6092 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -36,7 +36,6 @@ obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
36obj-y += time.o ioport.o ldt.o dumpstack.o 36obj-y += time.o ioport.o ldt.o dumpstack.o
37obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o 37obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o
38obj-$(CONFIG_IRQ_WORK) += irq_work.o 38obj-$(CONFIG_IRQ_WORK) += irq_work.o
39obj-$(CONFIG_X86_VISWS) += visws_quirks.o
40obj-$(CONFIG_X86_32) += probe_roms_32.o 39obj-$(CONFIG_X86_32) += probe_roms_32.o
41obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o 40obj-$(CONFIG_X86_32) += sys_i386_32.o i386_ksyms_32.o
42obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o 41obj-$(CONFIG_X86_64) += sys_x86_64.o x8664_ksyms_64.o
@@ -58,7 +57,6 @@ obj-$(CONFIG_INTEL_TXT) += tboot.o
58obj-$(CONFIG_STACKTRACE) += stacktrace.o 57obj-$(CONFIG_STACKTRACE) += stacktrace.o
59obj-y += cpu/ 58obj-y += cpu/
60obj-y += acpi/ 59obj-y += acpi/
61obj-$(CONFIG_SFI) += sfi.o
62obj-y += reboot.o 60obj-y += reboot.o
63obj-$(CONFIG_MCA) += mca_32.o 61obj-$(CONFIG_MCA) += mca_32.o
64obj-$(CONFIG_X86_MSR) += msr.o 62obj-$(CONFIG_X86_MSR) += msr.o
@@ -82,7 +80,6 @@ obj-$(CONFIG_KEXEC) += relocate_kernel_$(BITS).o crash.o
82obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o 80obj-$(CONFIG_CRASH_DUMP) += crash_dump_$(BITS).o
83obj-$(CONFIG_KPROBES) += kprobes.o 81obj-$(CONFIG_KPROBES) += kprobes.o
84obj-$(CONFIG_MODULES) += module.o 82obj-$(CONFIG_MODULES) += module.o
85obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
86obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o 83obj-$(CONFIG_DOUBLEFAULT) += doublefault_32.o
87obj-$(CONFIG_KGDB) += kgdb.o 84obj-$(CONFIG_KGDB) += kgdb.o
88obj-$(CONFIG_VM86) += vm86_32.o 85obj-$(CONFIG_VM86) += vm86_32.o
@@ -104,14 +101,6 @@ obj-$(CONFIG_PARAVIRT_CLOCK) += pvclock.o
104 101
105obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o 102obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o
106 103
107obj-$(CONFIG_SCx200) += scx200.o
108scx200-y += scx200_32.o
109
110obj-$(CONFIG_OLPC) += olpc.o
111obj-$(CONFIG_OLPC_XO1) += olpc-xo1.o
112obj-$(CONFIG_OLPC_OPENFIRMWARE) += olpc_ofw.o
113obj-$(CONFIG_X86_MRST) += mrst.o
114
115microcode-y := microcode_core.o 104microcode-y := microcode_core.o
116microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o 105microcode-$(CONFIG_MICROCODE_INTEL) += microcode_intel.o
117microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o 106microcode-$(CONFIG_MICROCODE_AMD) += microcode_amd.o
@@ -124,7 +113,6 @@ obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
124### 113###
125# 64 bit specific files 114# 64 bit specific files
126ifeq ($(CONFIG_X86_64),y) 115ifeq ($(CONFIG_X86_64),y)
127 obj-$(CONFIG_X86_UV) += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o uv_time.o
128 obj-$(CONFIG_AUDIT) += audit_64.o 116 obj-$(CONFIG_AUDIT) += audit_64.o
129 117
130 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o 118 obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index c05872aa3ce0..71232b941b6c 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -513,35 +513,62 @@ int acpi_isa_irq_to_gsi(unsigned isa_irq, u32 *gsi)
513 return 0; 513 return 0;
514} 514}
515 515
516/* 516static int acpi_register_gsi_pic(struct device *dev, u32 gsi,
517 * success: return IRQ number (>=0) 517 int trigger, int polarity)
518 * failure: return < 0
519 */
520int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
521{ 518{
522 unsigned int irq;
523 unsigned int plat_gsi = gsi;
524
525#ifdef CONFIG_PCI 519#ifdef CONFIG_PCI
526 /* 520 /*
527 * Make sure all (legacy) PCI IRQs are set as level-triggered. 521 * Make sure all (legacy) PCI IRQs are set as level-triggered.
528 */ 522 */
529 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { 523 if (trigger == ACPI_LEVEL_SENSITIVE)
530 if (trigger == ACPI_LEVEL_SENSITIVE) 524 eisa_set_level_irq(gsi);
531 eisa_set_level_irq(gsi);
532 }
533#endif 525#endif
534 526
527 return gsi;
528}
529
530static int acpi_register_gsi_ioapic(struct device *dev, u32 gsi,
531 int trigger, int polarity)
532{
535#ifdef CONFIG_X86_IO_APIC 533#ifdef CONFIG_X86_IO_APIC
536 if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { 534 gsi = mp_register_gsi(dev, gsi, trigger, polarity);
537 plat_gsi = mp_register_gsi(dev, gsi, trigger, polarity);
538 }
539#endif 535#endif
536
537 return gsi;
538}
539
540int (*__acpi_register_gsi)(struct device *dev, u32 gsi,
541 int trigger, int polarity) = acpi_register_gsi_pic;
542
543/*
544 * success: return IRQ number (>=0)
545 * failure: return < 0
546 */
547int acpi_register_gsi(struct device *dev, u32 gsi, int trigger, int polarity)
548{
549 unsigned int irq;
550 unsigned int plat_gsi = gsi;
551
552 plat_gsi = (*__acpi_register_gsi)(dev, gsi, trigger, polarity);
540 irq = gsi_to_irq(plat_gsi); 553 irq = gsi_to_irq(plat_gsi);
541 554
542 return irq; 555 return irq;
543} 556}
544 557
558void __init acpi_set_irq_model_pic(void)
559{
560 acpi_irq_model = ACPI_IRQ_MODEL_PIC;
561 __acpi_register_gsi = acpi_register_gsi_pic;
562 acpi_ioapic = 0;
563}
564
565void __init acpi_set_irq_model_ioapic(void)
566{
567 acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;
568 __acpi_register_gsi = acpi_register_gsi_ioapic;
569 acpi_ioapic = 1;
570}
571
545/* 572/*
546 * ACPI based hotplug support for CPU 573 * ACPI based hotplug support for CPU
547 */ 574 */
@@ -1259,8 +1286,7 @@ static void __init acpi_process_madt(void)
1259 */ 1286 */
1260 error = acpi_parse_madt_ioapic_entries(); 1287 error = acpi_parse_madt_ioapic_entries();
1261 if (!error) { 1288 if (!error) {
1262 acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; 1289 acpi_set_irq_model_ioapic();
1263 acpi_ioapic = 1;
1264 1290
1265 smp_found_config = 1; 1291 smp_found_config = 1;
1266 } 1292 }
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index 0b30214282a8..5079f24c955a 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -638,7 +638,7 @@ void *__kprobes text_poke_smp(void *addr, const void *opcode, size_t len)
638 atomic_set(&stop_machine_first, 1); 638 atomic_set(&stop_machine_first, 1);
639 wrote_text = 0; 639 wrote_text = 0;
640 /* Use __stop_machine() because the caller already got online_cpus. */ 640 /* Use __stop_machine() because the caller already got online_cpus. */
641 __stop_machine(stop_machine_text_poke, (void *)&tpp, NULL); 641 __stop_machine(stop_machine_text_poke, (void *)&tpp, cpu_online_mask);
642 return addr; 642 return addr;
643} 643}
644 644
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 850657d1b0ed..3f838d537392 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -52,7 +52,6 @@
52#include <asm/mce.h> 52#include <asm/mce.h>
53#include <asm/kvm_para.h> 53#include <asm/kvm_para.h>
54#include <asm/tsc.h> 54#include <asm/tsc.h>
55#include <asm/atomic.h>
56 55
57unsigned int num_processors; 56unsigned int num_processors;
58 57
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index cefd6942f0e9..62f6e1e55b90 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -17,15 +17,16 @@
17#include <linux/nmi.h> 17#include <linux/nmi.h>
18#include <linux/module.h> 18#include <linux/module.h>
19 19
20/* For reliability, we're prepared to waste bits here. */
21static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
22
23u64 hw_nmi_get_sample_period(void) 20u64 hw_nmi_get_sample_period(void)
24{ 21{
25 return (u64)(cpu_khz) * 1000 * 60; 22 return (u64)(cpu_khz) * 1000 * 60;
26} 23}
27 24
28#ifdef ARCH_HAS_NMI_WATCHDOG 25#ifdef ARCH_HAS_NMI_WATCHDOG
26
27/* For reliability, we're prepared to waste bits here. */
28static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
29
29void arch_trigger_all_cpu_backtrace(void) 30void arch_trigger_all_cpu_backtrace(void)
30{ 31{
31 int i; 32 int i;
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 8ae808d110f4..7cc0a721f628 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3109,7 +3109,7 @@ void destroy_irq(unsigned int irq)
3109 3109
3110 irq_set_status_flags(irq, IRQ_NOREQUEST|IRQ_NOPROBE); 3110 irq_set_status_flags(irq, IRQ_NOREQUEST|IRQ_NOPROBE);
3111 3111
3112 if (intr_remapping_enabled) 3112 if (irq_remapped(cfg))
3113 free_irte(irq); 3113 free_irte(irq);
3114 raw_spin_lock_irqsave(&vector_lock, flags); 3114 raw_spin_lock_irqsave(&vector_lock, flags);
3115 __clear_irq_vector(irq, cfg); 3115 __clear_irq_vector(irq, cfg);
@@ -3331,7 +3331,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
3331 return 0; 3331 return 0;
3332} 3332}
3333 3333
3334int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) 3334int native_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
3335{ 3335{
3336 int node, ret, sub_handle, index = 0; 3336 int node, ret, sub_handle, index = 0;
3337 unsigned int irq, irq_want; 3337 unsigned int irq, irq_want;
@@ -3389,7 +3389,7 @@ error:
3389 return ret; 3389 return ret;
3390} 3390}
3391 3391
3392void arch_teardown_msi_irq(unsigned int irq) 3392void native_teardown_msi_irq(unsigned int irq)
3393{ 3393{
3394 destroy_irq(irq); 3394 destroy_irq(irq);
3395} 3395}
@@ -3650,6 +3650,11 @@ void __init probe_nr_irqs_gsi(void)
3650 printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi); 3650 printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi);
3651} 3651}
3652 3652
3653int get_nr_irqs_gsi(void)
3654{
3655 return nr_irqs_gsi;
3656}
3657
3653#ifdef CONFIG_SPARSE_IRQ 3658#ifdef CONFIG_SPARSE_IRQ
3654int __init arch_probe_nr_irqs(void) 3659int __init arch_probe_nr_irqs(void)
3655{ 3660{
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index f744f54cb248..194539aea175 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -5,7 +5,7 @@
5 * 5 *
6 * SGI UV APIC functions (note: not an Intel compatible APIC) 6 * SGI UV APIC functions (note: not an Intel compatible APIC)
7 * 7 *
8 * Copyright (C) 2007-2009 Silicon Graphics, Inc. All rights reserved. 8 * Copyright (C) 2007-2010 Silicon Graphics, Inc. All rights reserved.
9 */ 9 */
10#include <linux/cpumask.h> 10#include <linux/cpumask.h>
11#include <linux/hardirq.h> 11#include <linux/hardirq.h>
@@ -41,6 +41,7 @@ DEFINE_PER_CPU(int, x2apic_extra_bits);
41 41
42static enum uv_system_type uv_system_type; 42static enum uv_system_type uv_system_type;
43static u64 gru_start_paddr, gru_end_paddr; 43static u64 gru_start_paddr, gru_end_paddr;
44static union uvh_apicid uvh_apicid;
44int uv_min_hub_revision_id; 45int uv_min_hub_revision_id;
45EXPORT_SYMBOL_GPL(uv_min_hub_revision_id); 46EXPORT_SYMBOL_GPL(uv_min_hub_revision_id);
46static DEFINE_SPINLOCK(uv_nmi_lock); 47static DEFINE_SPINLOCK(uv_nmi_lock);
@@ -70,12 +71,27 @@ static int early_get_nodeid(void)
70 return node_id.s.node_id; 71 return node_id.s.node_id;
71} 72}
72 73
74static void __init early_get_apic_pnode_shift(void)
75{
76 unsigned long *mmr;
77
78 mmr = early_ioremap(UV_LOCAL_MMR_BASE | UVH_APICID, sizeof(*mmr));
79 uvh_apicid.v = *mmr;
80 early_iounmap(mmr, sizeof(*mmr));
81 if (!uvh_apicid.v)
82 /*
83 * Old bios, use default value
84 */
85 uvh_apicid.s.pnode_shift = UV_APIC_PNODE_SHIFT;
86}
87
73static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id) 88static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
74{ 89{
75 int nodeid; 90 int nodeid;
76 91
77 if (!strcmp(oem_id, "SGI")) { 92 if (!strcmp(oem_id, "SGI")) {
78 nodeid = early_get_nodeid(); 93 nodeid = early_get_nodeid();
94 early_get_apic_pnode_shift();
79 x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range; 95 x86_platform.is_untracked_pat_range = uv_is_untracked_pat_range;
80 x86_platform.nmi_init = uv_nmi_init; 96 x86_platform.nmi_init = uv_nmi_init;
81 if (!strcmp(oem_table_id, "UVL")) 97 if (!strcmp(oem_table_id, "UVL"))
@@ -84,7 +100,7 @@ static int __init uv_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
84 uv_system_type = UV_X2APIC; 100 uv_system_type = UV_X2APIC;
85 else if (!strcmp(oem_table_id, "UVH")) { 101 else if (!strcmp(oem_table_id, "UVH")) {
86 __get_cpu_var(x2apic_extra_bits) = 102 __get_cpu_var(x2apic_extra_bits) =
87 nodeid << (UV_APIC_PNODE_SHIFT - 1); 103 nodeid << (uvh_apicid.s.pnode_shift - 1);
88 uv_system_type = UV_NON_UNIQUE_APIC; 104 uv_system_type = UV_NON_UNIQUE_APIC;
89 return 1; 105 return 1;
90 } 106 }
@@ -363,14 +379,14 @@ struct redir_addr {
363#define DEST_SHIFT UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_SHFT 379#define DEST_SHIFT UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR_DEST_BASE_SHFT
364 380
365static __initdata struct redir_addr redir_addrs[] = { 381static __initdata struct redir_addr redir_addrs[] = {
366 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR, UVH_SI_ALIAS0_OVERLAY_CONFIG}, 382 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_0_MMR, UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_0_MMR},
367 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR, UVH_SI_ALIAS1_OVERLAY_CONFIG}, 383 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_1_MMR, UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_1_MMR},
368 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_SI_ALIAS2_OVERLAY_CONFIG}, 384 {UVH_RH_GAM_ALIAS210_REDIRECT_CONFIG_2_MMR, UVH_RH_GAM_ALIAS210_OVERLAY_CONFIG_2_MMR},
369}; 385};
370 386
371static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size) 387static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
372{ 388{
373 union uvh_si_alias0_overlay_config_u alias; 389 union uvh_rh_gam_alias210_overlay_config_2_mmr_u alias;
374 union uvh_rh_gam_alias210_redirect_config_2_mmr_u redirect; 390 union uvh_rh_gam_alias210_redirect_config_2_mmr_u redirect;
375 int i; 391 int i;
376 392
@@ -644,7 +660,7 @@ void uv_nmi_init(void)
644 660
645void __init uv_system_init(void) 661void __init uv_system_init(void)
646{ 662{
647 union uvh_si_addr_map_config_u m_n_config; 663 union uvh_rh_gam_config_mmr_u m_n_config;
648 union uvh_node_id_u node_id; 664 union uvh_node_id_u node_id;
649 unsigned long gnode_upper, lowmem_redir_base, lowmem_redir_size; 665 unsigned long gnode_upper, lowmem_redir_base, lowmem_redir_size;
650 int bytes, nid, cpu, lcpu, pnode, blade, i, j, m_val, n_val; 666 int bytes, nid, cpu, lcpu, pnode, blade, i, j, m_val, n_val;
@@ -654,7 +670,7 @@ void __init uv_system_init(void)
654 670
655 map_low_mmrs(); 671 map_low_mmrs();
656 672
657 m_n_config.v = uv_read_local_mmr(UVH_SI_ADDR_MAP_CONFIG); 673 m_n_config.v = uv_read_local_mmr(UVH_RH_GAM_CONFIG_MMR );
658 m_val = m_n_config.s.m_skt; 674 m_val = m_n_config.s.m_skt;
659 n_val = m_n_config.s.n_skt; 675 n_val = m_n_config.s.n_skt;
660 mmr_base = 676 mmr_base =
@@ -716,6 +732,10 @@ void __init uv_system_init(void)
716 int apicid = per_cpu(x86_cpu_to_apicid, cpu); 732 int apicid = per_cpu(x86_cpu_to_apicid, cpu);
717 733
718 nid = cpu_to_node(cpu); 734 nid = cpu_to_node(cpu);
735 /*
736 * apic_pnode_shift must be set before calling uv_apicid_to_pnode();
737 */
738 uv_cpu_hub_info(cpu)->apic_pnode_shift = uvh_apicid.s.pnode_shift;
719 pnode = uv_apicid_to_pnode(apicid); 739 pnode = uv_apicid_to_pnode(apicid);
720 blade = boot_pnode_to_blade(pnode); 740 blade = boot_pnode_to_blade(pnode);
721 lcpu = uv_blade_info[blade].nr_possible_cpus; 741 lcpu = uv_blade_info[blade].nr_possible_cpus;
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 46d58448c3af..e421b8cd6944 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -280,11 +280,11 @@ static struct amd_nb *amd_alloc_nb(int cpu, int nb_id)
280 struct amd_nb *nb; 280 struct amd_nb *nb;
281 int i; 281 int i;
282 282
283 nb = kmalloc(sizeof(struct amd_nb), GFP_KERNEL); 283 nb = kmalloc_node(sizeof(struct amd_nb), GFP_KERNEL | __GFP_ZERO,
284 cpu_to_node(cpu));
284 if (!nb) 285 if (!nb)
285 return NULL; 286 return NULL;
286 287
287 memset(nb, 0, sizeof(*nb));
288 nb->nb_id = nb_id; 288 nb->nb_id = nb_id;
289 289
290 /* 290 /*
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c
index 64668dbf00a4..96656f207751 100644
--- a/arch/x86/kernel/irq_32.c
+++ b/arch/x86/kernel/irq_32.c
@@ -17,6 +17,7 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/uaccess.h> 18#include <linux/uaccess.h>
19#include <linux/percpu.h> 19#include <linux/percpu.h>
20#include <linux/mm.h>
20 21
21#include <asm/apic.h> 22#include <asm/apic.h>
22 23
@@ -125,7 +126,9 @@ void __cpuinit irq_ctx_init(int cpu)
125 if (per_cpu(hardirq_ctx, cpu)) 126 if (per_cpu(hardirq_ctx, cpu))
126 return; 127 return;
127 128
128 irqctx = (union irq_ctx *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER); 129 irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
130 THREAD_FLAGS,
131 THREAD_ORDER));
129 irqctx->tinfo.task = NULL; 132 irqctx->tinfo.task = NULL;
130 irqctx->tinfo.exec_domain = NULL; 133 irqctx->tinfo.exec_domain = NULL;
131 irqctx->tinfo.cpu = cpu; 134 irqctx->tinfo.cpu = cpu;
@@ -134,7 +137,9 @@ void __cpuinit irq_ctx_init(int cpu)
134 137
135 per_cpu(hardirq_ctx, cpu) = irqctx; 138 per_cpu(hardirq_ctx, cpu) = irqctx;
136 139
137 irqctx = (union irq_ctx *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER); 140 irqctx = page_address(alloc_pages_node(cpu_to_node(cpu),
141 THREAD_FLAGS,
142 THREAD_ORDER));
138 irqctx->tinfo.task = NULL; 143 irqctx->tinfo.task = NULL;
139 irqctx->tinfo.exec_domain = NULL; 144 irqctx->tinfo.exec_domain = NULL;
140 irqctx->tinfo.cpu = cpu; 145 irqctx->tinfo.cpu = cpu;
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index d81cfebb848f..ec592caac4b4 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -387,7 +387,7 @@ kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
387 * disable hardware debugging while it is processing gdb packets or 387 * disable hardware debugging while it is processing gdb packets or
388 * handling exception. 388 * handling exception.
389 */ 389 */
390void kgdb_disable_hw_debug(struct pt_regs *regs) 390static void kgdb_disable_hw_debug(struct pt_regs *regs)
391{ 391{
392 int i; 392 int i;
393 int cpu = raw_smp_processor_id(); 393 int cpu = raw_smp_processor_id();
@@ -724,6 +724,7 @@ struct kgdb_arch arch_kgdb_ops = {
724 .flags = KGDB_HW_BREAKPOINT, 724 .flags = KGDB_HW_BREAKPOINT,
725 .set_hw_breakpoint = kgdb_set_hw_break, 725 .set_hw_breakpoint = kgdb_set_hw_break,
726 .remove_hw_breakpoint = kgdb_remove_hw_break, 726 .remove_hw_breakpoint = kgdb_remove_hw_break,
727 .disable_hw_break = kgdb_disable_hw_debug,
727 .remove_all_hw_break = kgdb_remove_all_hw_break, 728 .remove_all_hw_break = kgdb_remove_all_hw_break,
728 .correct_hw_break = kgdb_correct_hw_break, 729 .correct_hw_break = kgdb_correct_hw_break,
729}; 730};
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index e1af7c055c7d..ce0cb4721c9a 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -212,7 +212,7 @@ static int install_equiv_cpu_table(const u8 *buf)
212 return 0; 212 return 0;
213 } 213 }
214 214
215 equiv_cpu_table = (struct equiv_cpu_entry *) vmalloc(size); 215 equiv_cpu_table = vmalloc(size);
216 if (!equiv_cpu_table) { 216 if (!equiv_cpu_table) {
217 pr_err("failed to allocate equivalent CPU table\n"); 217 pr_err("failed to allocate equivalent CPU table\n");
218 return 0; 218 return 0;
diff --git a/arch/x86/kernel/mmconf-fam10h_64.c b/arch/x86/kernel/mmconf-fam10h_64.c
index 71825806cd44..6da143c2a6b8 100644
--- a/arch/x86/kernel/mmconf-fam10h_64.c
+++ b/arch/x86/kernel/mmconf-fam10h_64.c
@@ -217,13 +217,13 @@ void __cpuinit fam10h_check_enable_mmcfg(void)
217 wrmsrl(address, val); 217 wrmsrl(address, val);
218} 218}
219 219
220static int __devinit set_check_enable_amd_mmconf(const struct dmi_system_id *d) 220static int __init set_check_enable_amd_mmconf(const struct dmi_system_id *d)
221{ 221{
222 pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF; 222 pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
223 return 0; 223 return 0;
224} 224}
225 225
226static const struct dmi_system_id __cpuinitconst mmconf_dmi_table[] = { 226static const struct dmi_system_id __initconst mmconf_dmi_table[] = {
227 { 227 {
228 .callback = set_check_enable_amd_mmconf, 228 .callback = set_check_enable_amd_mmconf,
229 .ident = "Sun Microsystems Machine", 229 .ident = "Sun Microsystems Machine",
@@ -234,7 +234,8 @@ static const struct dmi_system_id __cpuinitconst mmconf_dmi_table[] = {
234 {} 234 {}
235}; 235};
236 236
237void __cpuinit check_enable_amd_mmconf_dmi(void) 237/* Called from a __cpuinit function, but only on the BSP. */
238void __ref check_enable_amd_mmconf_dmi(void)
238{ 239{
239 dmi_check_system(mmconf_dmi_table); 240 dmi_check_system(mmconf_dmi_table);
240} 241}
diff --git a/arch/x86/kernel/pvclock.c b/arch/x86/kernel/pvclock.c
index bab3b9e6f66d..008b91eefa18 100644
--- a/arch/x86/kernel/pvclock.c
+++ b/arch/x86/kernel/pvclock.c
@@ -41,44 +41,6 @@ void pvclock_set_flags(u8 flags)
41 valid_flags = flags; 41 valid_flags = flags;
42} 42}
43 43
44/*
45 * Scale a 64-bit delta by scaling and multiplying by a 32-bit fraction,
46 * yielding a 64-bit result.
47 */
48static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
49{
50 u64 product;
51#ifdef __i386__
52 u32 tmp1, tmp2;
53#endif
54
55 if (shift < 0)
56 delta >>= -shift;
57 else
58 delta <<= shift;
59
60#ifdef __i386__
61 __asm__ (
62 "mul %5 ; "
63 "mov %4,%%eax ; "
64 "mov %%edx,%4 ; "
65 "mul %5 ; "
66 "xor %5,%5 ; "
67 "add %4,%%eax ; "
68 "adc %5,%%edx ; "
69 : "=A" (product), "=r" (tmp1), "=r" (tmp2)
70 : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
71#elif defined(__x86_64__)
72 __asm__ (
73 "mul %%rdx ; shrd $32,%%rdx,%%rax"
74 : "=a" (product) : "0" (delta), "d" ((u64)mul_frac) );
75#else
76#error implement me!
77#endif
78
79 return product;
80}
81
82static u64 pvclock_get_nsec_offset(struct pvclock_shadow_time *shadow) 44static u64 pvclock_get_nsec_offset(struct pvclock_shadow_time *shadow)
83{ 45{
84 u64 delta = native_read_tsc() - shadow->tsc_timestamp; 46 u64 delta = native_read_tsc() - shadow->tsc_timestamp;
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 95a32746fbf9..21c6746338af 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -769,6 +769,8 @@ void __init setup_arch(char **cmdline_p)
769 769
770 x86_init.oem.arch_setup(); 770 x86_init.oem.arch_setup();
771 771
772 resource_alloc_from_bottom = 0;
773 iomem_resource.end = (1ULL << boot_cpu_data.x86_phys_bits) - 1;
772 setup_memory_map(); 774 setup_memory_map();
773 parse_setup_data(); 775 parse_setup_data();
774 /* update the e820_saved too */ 776 /* update the e820_saved too */
diff --git a/arch/x86/kernel/x86_init.c b/arch/x86/kernel/x86_init.c
index cd6da6bf3eca..ceb2911aa439 100644
--- a/arch/x86/kernel/x86_init.c
+++ b/arch/x86/kernel/x86_init.c
@@ -6,10 +6,12 @@
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/ioport.h> 7#include <linux/ioport.h>
8#include <linux/module.h> 8#include <linux/module.h>
9#include <linux/pci.h>
9 10
10#include <asm/bios_ebda.h> 11#include <asm/bios_ebda.h>
11#include <asm/paravirt.h> 12#include <asm/paravirt.h>
12#include <asm/pci_x86.h> 13#include <asm/pci_x86.h>
14#include <asm/pci.h>
13#include <asm/mpspec.h> 15#include <asm/mpspec.h>
14#include <asm/setup.h> 16#include <asm/setup.h>
15#include <asm/apic.h> 17#include <asm/apic.h>
@@ -99,3 +101,8 @@ struct x86_platform_ops x86_platform = {
99}; 101};
100 102
101EXPORT_SYMBOL_GPL(x86_platform); 103EXPORT_SYMBOL_GPL(x86_platform);
104struct x86_msi_ops x86_msi = {
105 .setup_msi_irqs = native_setup_msi_irqs,
106 .teardown_msi_irq = native_teardown_msi_irq,
107 .teardown_msi_irqs = default_teardown_msi_irqs,
108};
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 908ea5464a51..fb8b376bf28c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -720,7 +720,7 @@ static void rmap_remove(struct kvm *kvm, u64 *spte)
720 } 720 }
721} 721}
722 722
723static void set_spte_track_bits(u64 *sptep, u64 new_spte) 723static int set_spte_track_bits(u64 *sptep, u64 new_spte)
724{ 724{
725 pfn_t pfn; 725 pfn_t pfn;
726 u64 old_spte = *sptep; 726 u64 old_spte = *sptep;
@@ -731,19 +731,20 @@ static void set_spte_track_bits(u64 *sptep, u64 new_spte)
731 old_spte = __xchg_spte(sptep, new_spte); 731 old_spte = __xchg_spte(sptep, new_spte);
732 732
733 if (!is_rmap_spte(old_spte)) 733 if (!is_rmap_spte(old_spte))
734 return; 734 return 0;
735 735
736 pfn = spte_to_pfn(old_spte); 736 pfn = spte_to_pfn(old_spte);
737 if (!shadow_accessed_mask || old_spte & shadow_accessed_mask) 737 if (!shadow_accessed_mask || old_spte & shadow_accessed_mask)
738 kvm_set_pfn_accessed(pfn); 738 kvm_set_pfn_accessed(pfn);
739 if (!shadow_dirty_mask || (old_spte & shadow_dirty_mask)) 739 if (!shadow_dirty_mask || (old_spte & shadow_dirty_mask))
740 kvm_set_pfn_dirty(pfn); 740 kvm_set_pfn_dirty(pfn);
741 return 1;
741} 742}
742 743
743static void drop_spte(struct kvm *kvm, u64 *sptep, u64 new_spte) 744static void drop_spte(struct kvm *kvm, u64 *sptep, u64 new_spte)
744{ 745{
745 set_spte_track_bits(sptep, new_spte); 746 if (set_spte_track_bits(sptep, new_spte))
746 rmap_remove(kvm, sptep); 747 rmap_remove(kvm, sptep);
747} 748}
748 749
749static u64 *rmap_next(struct kvm *kvm, unsigned long *rmapp, u64 *spte) 750static u64 *rmap_next(struct kvm *kvm, unsigned long *rmapp, u64 *spte)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2288ad829b32..cdac9e592aa5 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2560,6 +2560,7 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
2560 !kvm_exception_is_soft(vcpu->arch.exception.nr); 2560 !kvm_exception_is_soft(vcpu->arch.exception.nr);
2561 events->exception.nr = vcpu->arch.exception.nr; 2561 events->exception.nr = vcpu->arch.exception.nr;
2562 events->exception.has_error_code = vcpu->arch.exception.has_error_code; 2562 events->exception.has_error_code = vcpu->arch.exception.has_error_code;
2563 events->exception.pad = 0;
2563 events->exception.error_code = vcpu->arch.exception.error_code; 2564 events->exception.error_code = vcpu->arch.exception.error_code;
2564 2565
2565 events->interrupt.injected = 2566 events->interrupt.injected =
@@ -2573,12 +2574,14 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
2573 events->nmi.injected = vcpu->arch.nmi_injected; 2574 events->nmi.injected = vcpu->arch.nmi_injected;
2574 events->nmi.pending = vcpu->arch.nmi_pending; 2575 events->nmi.pending = vcpu->arch.nmi_pending;
2575 events->nmi.masked = kvm_x86_ops->get_nmi_mask(vcpu); 2576 events->nmi.masked = kvm_x86_ops->get_nmi_mask(vcpu);
2577 events->nmi.pad = 0;
2576 2578
2577 events->sipi_vector = vcpu->arch.sipi_vector; 2579 events->sipi_vector = vcpu->arch.sipi_vector;
2578 2580
2579 events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING 2581 events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING
2580 | KVM_VCPUEVENT_VALID_SIPI_VECTOR 2582 | KVM_VCPUEVENT_VALID_SIPI_VECTOR
2581 | KVM_VCPUEVENT_VALID_SHADOW); 2583 | KVM_VCPUEVENT_VALID_SHADOW);
2584 memset(&events->reserved, 0, sizeof(events->reserved));
2582} 2585}
2583 2586
2584static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, 2587static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
@@ -2623,6 +2626,7 @@ static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu,
2623 dbgregs->dr6 = vcpu->arch.dr6; 2626 dbgregs->dr6 = vcpu->arch.dr6;
2624 dbgregs->dr7 = vcpu->arch.dr7; 2627 dbgregs->dr7 = vcpu->arch.dr7;
2625 dbgregs->flags = 0; 2628 dbgregs->flags = 0;
2629 memset(&dbgregs->reserved, 0, sizeof(dbgregs->reserved));
2626} 2630}
2627 2631
2628static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu, 2632static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu,
@@ -3106,6 +3110,7 @@ static int kvm_vm_ioctl_get_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps)
3106 sizeof(ps->channels)); 3110 sizeof(ps->channels));
3107 ps->flags = kvm->arch.vpit->pit_state.flags; 3111 ps->flags = kvm->arch.vpit->pit_state.flags;
3108 mutex_unlock(&kvm->arch.vpit->pit_state.lock); 3112 mutex_unlock(&kvm->arch.vpit->pit_state.lock);
3113 memset(&ps->reserved, 0, sizeof(ps->reserved));
3109 return r; 3114 return r;
3110} 3115}
3111 3116
@@ -3169,10 +3174,6 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
3169 struct kvm_memslots *slots, *old_slots; 3174 struct kvm_memslots *slots, *old_slots;
3170 unsigned long *dirty_bitmap; 3175 unsigned long *dirty_bitmap;
3171 3176
3172 spin_lock(&kvm->mmu_lock);
3173 kvm_mmu_slot_remove_write_access(kvm, log->slot);
3174 spin_unlock(&kvm->mmu_lock);
3175
3176 r = -ENOMEM; 3177 r = -ENOMEM;
3177 dirty_bitmap = vmalloc(n); 3178 dirty_bitmap = vmalloc(n);
3178 if (!dirty_bitmap) 3179 if (!dirty_bitmap)
@@ -3194,6 +3195,10 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
3194 dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap; 3195 dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap;
3195 kfree(old_slots); 3196 kfree(old_slots);
3196 3197
3198 spin_lock(&kvm->mmu_lock);
3199 kvm_mmu_slot_remove_write_access(kvm, log->slot);
3200 spin_unlock(&kvm->mmu_lock);
3201
3197 r = -EFAULT; 3202 r = -EFAULT;
3198 if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n)) { 3203 if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n)) {
3199 vfree(dirty_bitmap); 3204 vfree(dirty_bitmap);
@@ -3486,6 +3491,7 @@ long kvm_arch_vm_ioctl(struct file *filp,
3486 user_ns.clock = kvm->arch.kvmclock_offset + now_ns; 3491 user_ns.clock = kvm->arch.kvmclock_offset + now_ns;
3487 local_irq_enable(); 3492 local_irq_enable();
3488 user_ns.flags = 0; 3493 user_ns.flags = 0;
3494 memset(&user_ns.pad, 0, sizeof(user_ns.pad));
3489 3495
3490 r = -EFAULT; 3496 r = -EFAULT;
3491 if (copy_to_user(argp, &user_ns, sizeof(user_ns))) 3497 if (copy_to_user(argp, &user_ns, sizeof(user_ns)))
@@ -3972,8 +3978,10 @@ int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu)
3972 return X86EMUL_CONTINUE; 3978 return X86EMUL_CONTINUE;
3973 3979
3974 if (kvm_x86_ops->has_wbinvd_exit()) { 3980 if (kvm_x86_ops->has_wbinvd_exit()) {
3981 preempt_disable();
3975 smp_call_function_many(vcpu->arch.wbinvd_dirty_mask, 3982 smp_call_function_many(vcpu->arch.wbinvd_dirty_mask,
3976 wbinvd_ipi, NULL, 1); 3983 wbinvd_ipi, NULL, 1);
3984 preempt_enable();
3977 cpumask_clear(vcpu->arch.wbinvd_dirty_mask); 3985 cpumask_clear(vcpu->arch.wbinvd_dirty_mask);
3978 } 3986 }
3979 wbinvd(); 3987 wbinvd();
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 60f498511dd6..7ffc9b727efd 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -178,11 +178,8 @@ static void * __init early_node_mem(int nodeid, unsigned long start,
178 178
179 /* extend the search scope */ 179 /* extend the search scope */
180 end = max_pfn_mapped << PAGE_SHIFT; 180 end = max_pfn_mapped << PAGE_SHIFT;
181 if (end > (MAX_DMA32_PFN<<PAGE_SHIFT)) 181 start = MAX_DMA_PFN << PAGE_SHIFT;
182 start = MAX_DMA32_PFN<<PAGE_SHIFT; 182 mem = memblock_find_in_range(start, end, size, align);
183 else
184 start = MAX_DMA_PFN<<PAGE_SHIFT;
185 mem = memblock_x86_find_in_range_node(nodeid, start, end, size, align);
186 if (mem != MEMBLOCK_ERROR) 183 if (mem != MEMBLOCK_ERROR)
187 return __va(mem); 184 return __va(mem);
188 185
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 49358481c733..12cdbb17ad18 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -251,7 +251,7 @@ static void __cpuinit calculate_tlb_offset(void)
251 } 251 }
252} 252}
253 253
254static int tlb_cpuhp_notify(struct notifier_block *n, 254static int __cpuinit tlb_cpuhp_notify(struct notifier_block *n,
255 unsigned long action, void *hcpu) 255 unsigned long action, void *hcpu)
256{ 256{
257 switch (action & 0xf) { 257 switch (action & 0xf) {
diff --git a/arch/x86/pci/Makefile b/arch/x86/pci/Makefile
index a0207a7fdf39..effd96e33f16 100644
--- a/arch/x86/pci/Makefile
+++ b/arch/x86/pci/Makefile
@@ -4,6 +4,7 @@ obj-$(CONFIG_PCI_BIOS) += pcbios.o
4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$(BITS).o direct.o mmconfig-shared.o 4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig_$(BITS).o direct.o mmconfig-shared.o
5obj-$(CONFIG_PCI_DIRECT) += direct.o 5obj-$(CONFIG_PCI_DIRECT) += direct.o
6obj-$(CONFIG_PCI_OLPC) += olpc.o 6obj-$(CONFIG_PCI_OLPC) += olpc.o
7obj-$(CONFIG_PCI_XEN) += xen.o
7 8
8obj-y += fixup.o 9obj-y += fixup.o
9obj-$(CONFIG_ACPI) += acpi.o 10obj-$(CONFIG_ACPI) += acpi.o
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 15466c096ba5..0972315c3860 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -138,7 +138,6 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
138 struct acpi_resource_address64 addr; 138 struct acpi_resource_address64 addr;
139 acpi_status status; 139 acpi_status status;
140 unsigned long flags; 140 unsigned long flags;
141 struct resource *root, *conflict;
142 u64 start, end; 141 u64 start, end;
143 142
144 status = resource_to_addr(acpi_res, &addr); 143 status = resource_to_addr(acpi_res, &addr);
@@ -146,12 +145,10 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
146 return AE_OK; 145 return AE_OK;
147 146
148 if (addr.resource_type == ACPI_MEMORY_RANGE) { 147 if (addr.resource_type == ACPI_MEMORY_RANGE) {
149 root = &iomem_resource;
150 flags = IORESOURCE_MEM; 148 flags = IORESOURCE_MEM;
151 if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY) 149 if (addr.info.mem.caching == ACPI_PREFETCHABLE_MEMORY)
152 flags |= IORESOURCE_PREFETCH; 150 flags |= IORESOURCE_PREFETCH;
153 } else if (addr.resource_type == ACPI_IO_RANGE) { 151 } else if (addr.resource_type == ACPI_IO_RANGE) {
154 root = &ioport_resource;
155 flags = IORESOURCE_IO; 152 flags = IORESOURCE_IO;
156 } else 153 } else
157 return AE_OK; 154 return AE_OK;
@@ -172,25 +169,90 @@ setup_resource(struct acpi_resource *acpi_res, void *data)
172 return AE_OK; 169 return AE_OK;
173 } 170 }
174 171
175 conflict = insert_resource_conflict(root, res); 172 info->res_num++;
176 if (conflict) { 173 if (addr.translation_offset)
177 dev_err(&info->bridge->dev, 174 dev_info(&info->bridge->dev, "host bridge window %pR "
178 "address space collision: host bridge window %pR " 175 "(PCI address [%#llx-%#llx])\n",
179 "conflicts with %s %pR\n", 176 res, res->start - addr.translation_offset,
180 res, conflict->name, conflict); 177 res->end - addr.translation_offset);
181 } else { 178 else
182 pci_bus_add_resource(info->bus, res, 0); 179 dev_info(&info->bridge->dev, "host bridge window %pR\n", res);
183 info->res_num++; 180
184 if (addr.translation_offset) 181 return AE_OK;
185 dev_info(&info->bridge->dev, "host bridge window %pR " 182}
186 "(PCI address [%#llx-%#llx])\n", 183
187 res, res->start - addr.translation_offset, 184static bool resource_contains(struct resource *res, resource_size_t point)
188 res->end - addr.translation_offset); 185{
186 if (res->start <= point && point <= res->end)
187 return true;
188 return false;
189}
190
191static void coalesce_windows(struct pci_root_info *info, int type)
192{
193 int i, j;
194 struct resource *res1, *res2;
195
196 for (i = 0; i < info->res_num; i++) {
197 res1 = &info->res[i];
198 if (!(res1->flags & type))
199 continue;
200
201 for (j = i + 1; j < info->res_num; j++) {
202 res2 = &info->res[j];
203 if (!(res2->flags & type))
204 continue;
205
206 /*
207 * I don't like throwing away windows because then
208 * our resources no longer match the ACPI _CRS, but
209 * the kernel resource tree doesn't allow overlaps.
210 */
211 if (resource_contains(res1, res2->start) ||
212 resource_contains(res1, res2->end) ||
213 resource_contains(res2, res1->start) ||
214 resource_contains(res2, res1->end)) {
215 res1->start = min(res1->start, res2->start);
216 res1->end = max(res1->end, res2->end);
217 dev_info(&info->bridge->dev,
218 "host bridge window expanded to %pR; %pR ignored\n",
219 res1, res2);
220 res2->flags = 0;
221 }
222 }
223 }
224}
225
226static void add_resources(struct pci_root_info *info)
227{
228 int i;
229 struct resource *res, *root, *conflict;
230
231 if (!pci_use_crs)
232 return;
233
234 coalesce_windows(info, IORESOURCE_MEM);
235 coalesce_windows(info, IORESOURCE_IO);
236
237 for (i = 0; i < info->res_num; i++) {
238 res = &info->res[i];
239
240 if (res->flags & IORESOURCE_MEM)
241 root = &iomem_resource;
242 else if (res->flags & IORESOURCE_IO)
243 root = &ioport_resource;
189 else 244 else
190 dev_info(&info->bridge->dev, 245 continue;
191 "host bridge window %pR\n", res); 246
247 conflict = insert_resource_conflict(root, res);
248 if (conflict)
249 dev_err(&info->bridge->dev,
250 "address space collision: host bridge window %pR "
251 "conflicts with %s %pR\n",
252 res, conflict->name, conflict);
253 else
254 pci_bus_add_resource(info->bus, res, 0);
192 } 255 }
193 return AE_OK;
194} 256}
195 257
196static void 258static void
@@ -224,6 +286,7 @@ get_current_resources(struct acpi_device *device, int busnum,
224 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, 286 acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource,
225 &info); 287 &info);
226 288
289 add_resources(&info);
227 return; 290 return;
228 291
229name_alloc_fail: 292name_alloc_fail:
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index a0772af64efb..f7c8a399978c 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -421,16 +421,10 @@ struct pci_bus * __devinit pcibios_scan_root(int busnum)
421 421
422 return bus; 422 return bus;
423} 423}
424 424void __init pcibios_set_cache_line_size(void)
425int __init pcibios_init(void)
426{ 425{
427 struct cpuinfo_x86 *c = &boot_cpu_data; 426 struct cpuinfo_x86 *c = &boot_cpu_data;
428 427
429 if (!raw_pci_ops) {
430 printk(KERN_WARNING "PCI: System does not support PCI\n");
431 return 0;
432 }
433
434 /* 428 /*
435 * Set PCI cacheline size to that of the CPU if the CPU has reported it. 429 * Set PCI cacheline size to that of the CPU if the CPU has reported it.
436 * (For older CPUs that don't support cpuid, we se it to 32 bytes 430 * (For older CPUs that don't support cpuid, we se it to 32 bytes
@@ -445,7 +439,16 @@ int __init pcibios_init(void)
445 pci_dfl_cache_line_size = 32 >> 2; 439 pci_dfl_cache_line_size = 32 >> 2;
446 printk(KERN_DEBUG "PCI: Unknown cacheline size. Setting to 32 bytes\n"); 440 printk(KERN_DEBUG "PCI: Unknown cacheline size. Setting to 32 bytes\n");
447 } 441 }
442}
443
444int __init pcibios_init(void)
445{
446 if (!raw_pci_ops) {
447 printk(KERN_WARNING "PCI: System does not support PCI\n");
448 return 0;
449 }
448 450
451 pcibios_set_cache_line_size();
449 pcibios_resource_survey(); 452 pcibios_resource_survey();
450 453
451 if (pci_bf_sort >= pci_force_bf) 454 if (pci_bf_sort >= pci_force_bf)
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
index 55253095be84..c4bb261c106e 100644
--- a/arch/x86/pci/i386.c
+++ b/arch/x86/pci/i386.c
@@ -65,16 +65,21 @@ pcibios_align_resource(void *data, const struct resource *res,
65 resource_size_t size, resource_size_t align) 65 resource_size_t size, resource_size_t align)
66{ 66{
67 struct pci_dev *dev = data; 67 struct pci_dev *dev = data;
68 resource_size_t start = res->start; 68 resource_size_t start = round_down(res->end - size + 1, align);
69 69
70 if (res->flags & IORESOURCE_IO) { 70 if (res->flags & IORESOURCE_IO) {
71 if (skip_isa_ioresource_align(dev)) 71
72 return start; 72 /*
73 if (start & 0x300) 73 * If we're avoiding ISA aliases, the largest contiguous I/O
74 start = (start + 0x3ff) & ~0x3ff; 74 * port space is 256 bytes. Clearing bits 9 and 10 preserves
75 * all 256-byte and smaller alignments, so the result will
76 * still be correctly aligned.
77 */
78 if (!skip_isa_ioresource_align(dev))
79 start &= ~0x300;
75 } else if (res->flags & IORESOURCE_MEM) { 80 } else if (res->flags & IORESOURCE_MEM) {
76 if (start < BIOS_END) 81 if (start < BIOS_END)
77 start = BIOS_END; 82 start = res->end; /* fail; no space */
78 } 83 }
79 return start; 84 return start;
80} 85}
@@ -311,6 +316,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
311 */ 316 */
312 prot |= _PAGE_CACHE_UC_MINUS; 317 prot |= _PAGE_CACHE_UC_MINUS;
313 318
319 prot |= _PAGE_IOMAP; /* creating a mapping for IO */
320
314 vma->vm_page_prot = __pgprot(prot); 321 vma->vm_page_prot = __pgprot(prot);
315 322
316 if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, 323 if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index f547ee05f715..9f9bfb705cf9 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -584,27 +584,28 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
584 case PCI_DEVICE_ID_INTEL_ICH9_3: 584 case PCI_DEVICE_ID_INTEL_ICH9_3:
585 case PCI_DEVICE_ID_INTEL_ICH9_4: 585 case PCI_DEVICE_ID_INTEL_ICH9_4:
586 case PCI_DEVICE_ID_INTEL_ICH9_5: 586 case PCI_DEVICE_ID_INTEL_ICH9_5:
587 case PCI_DEVICE_ID_INTEL_TOLAPAI_0: 587 case PCI_DEVICE_ID_INTEL_EP80579_0:
588 case PCI_DEVICE_ID_INTEL_ICH10_0: 588 case PCI_DEVICE_ID_INTEL_ICH10_0:
589 case PCI_DEVICE_ID_INTEL_ICH10_1: 589 case PCI_DEVICE_ID_INTEL_ICH10_1:
590 case PCI_DEVICE_ID_INTEL_ICH10_2: 590 case PCI_DEVICE_ID_INTEL_ICH10_2:
591 case PCI_DEVICE_ID_INTEL_ICH10_3: 591 case PCI_DEVICE_ID_INTEL_ICH10_3:
592 case PCI_DEVICE_ID_INTEL_PATSBURG_LPC:
592 r->name = "PIIX/ICH"; 593 r->name = "PIIX/ICH";
593 r->get = pirq_piix_get; 594 r->get = pirq_piix_get;
594 r->set = pirq_piix_set; 595 r->set = pirq_piix_set;
595 return 1; 596 return 1;
596 } 597 }
597 598
598 if ((device >= PCI_DEVICE_ID_INTEL_PCH_LPC_MIN) && 599 if ((device >= PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MIN) &&
599 (device <= PCI_DEVICE_ID_INTEL_PCH_LPC_MAX)) { 600 (device <= PCI_DEVICE_ID_INTEL_5_3400_SERIES_LPC_MAX)) {
600 r->name = "PIIX/ICH"; 601 r->name = "PIIX/ICH";
601 r->get = pirq_piix_get; 602 r->get = pirq_piix_get;
602 r->set = pirq_piix_set; 603 r->set = pirq_piix_set;
603 return 1; 604 return 1;
604 } 605 }
605 606
606 if ((device >= PCI_DEVICE_ID_INTEL_CPT_LPC_MIN) && 607 if ((device >= PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MIN) &&
607 (device <= PCI_DEVICE_ID_INTEL_CPT_LPC_MAX)) { 608 (device <= PCI_DEVICE_ID_INTEL_COUGARPOINT_LPC_MAX)) {
608 r->name = "PIIX/ICH"; 609 r->name = "PIIX/ICH";
609 r->get = pirq_piix_get; 610 r->get = pirq_piix_get;
610 r->set = pirq_piix_set; 611 r->set = pirq_piix_set;
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index a918553ebc75..e282886616a0 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -65,7 +65,6 @@ static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start,
65 int end, u64 addr) 65 int end, u64 addr)
66{ 66{
67 struct pci_mmcfg_region *new; 67 struct pci_mmcfg_region *new;
68 int num_buses;
69 struct resource *res; 68 struct resource *res;
70 69
71 if (addr == 0) 70 if (addr == 0)
@@ -82,10 +81,9 @@ static __init struct pci_mmcfg_region *pci_mmconfig_add(int segment, int start,
82 81
83 list_add_sorted(new); 82 list_add_sorted(new);
84 83
85 num_buses = end - start + 1;
86 res = &new->res; 84 res = &new->res;
87 res->start = addr + PCI_MMCFG_BUS_OFFSET(start); 85 res->start = addr + PCI_MMCFG_BUS_OFFSET(start);
88 res->end = addr + PCI_MMCFG_BUS_OFFSET(num_buses) - 1; 86 res->end = addr + PCI_MMCFG_BUS_OFFSET(end + 1) - 1;
89 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; 87 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
90 snprintf(new->name, PCI_MMCFG_RESOURCE_NAME_LEN, 88 snprintf(new->name, PCI_MMCFG_RESOURCE_NAME_LEN,
91 "PCI MMCONFIG %04x [bus %02x-%02x]", segment, start, end); 89 "PCI MMCONFIG %04x [bus %02x-%02x]", segment, start, end);
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
new file mode 100644
index 000000000000..d7b5109f7a9c
--- /dev/null
+++ b/arch/x86/pci/xen.c
@@ -0,0 +1,416 @@
1/*
2 * Xen PCI Frontend Stub - puts some "dummy" functions in to the Linux
3 * x86 PCI core to support the Xen PCI Frontend
4 *
5 * Author: Ryan Wilson <hap9@epoch.ncsc.mil>
6 */
7#include <linux/module.h>
8#include <linux/init.h>
9#include <linux/pci.h>
10#include <linux/acpi.h>
11
12#include <linux/io.h>
13#include <asm/io_apic.h>
14#include <asm/pci_x86.h>
15
16#include <asm/xen/hypervisor.h>
17
18#include <xen/features.h>
19#include <xen/events.h>
20#include <asm/xen/pci.h>
21
22#ifdef CONFIG_ACPI
23static int xen_hvm_register_pirq(u32 gsi, int triggering)
24{
25 int rc, irq;
26 struct physdev_map_pirq map_irq;
27 int shareable = 0;
28 char *name;
29
30 if (!xen_hvm_domain())
31 return -1;
32
33 map_irq.domid = DOMID_SELF;
34 map_irq.type = MAP_PIRQ_TYPE_GSI;
35 map_irq.index = gsi;
36 map_irq.pirq = -1;
37
38 rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
39 if (rc) {
40 printk(KERN_WARNING "xen map irq failed %d\n", rc);
41 return -1;
42 }
43
44 if (triggering == ACPI_EDGE_SENSITIVE) {
45 shareable = 0;
46 name = "ioapic-edge";
47 } else {
48 shareable = 1;
49 name = "ioapic-level";
50 }
51
52 irq = xen_map_pirq_gsi(map_irq.pirq, gsi, shareable, name);
53
54 printk(KERN_DEBUG "xen: --> irq=%d, pirq=%d\n", irq, map_irq.pirq);
55
56 return irq;
57}
58
59static int acpi_register_gsi_xen_hvm(struct device *dev, u32 gsi,
60 int trigger, int polarity)
61{
62 return xen_hvm_register_pirq(gsi, trigger);
63}
64#endif
65
66#if defined(CONFIG_PCI_MSI)
67#include <linux/msi.h>
68#include <asm/msidef.h>
69
70struct xen_pci_frontend_ops *xen_pci_frontend;
71EXPORT_SYMBOL_GPL(xen_pci_frontend);
72
73static void xen_msi_compose_msg(struct pci_dev *pdev, unsigned int pirq,
74 struct msi_msg *msg)
75{
76 /* We set vector == 0 to tell the hypervisor we don't care about it,
77 * but we want a pirq setup instead.
78 * We use the dest_id field to pass the pirq that we want. */
79 msg->address_hi = MSI_ADDR_BASE_HI | MSI_ADDR_EXT_DEST_ID(pirq);
80 msg->address_lo =
81 MSI_ADDR_BASE_LO |
82 MSI_ADDR_DEST_MODE_PHYSICAL |
83 MSI_ADDR_REDIRECTION_CPU |
84 MSI_ADDR_DEST_ID(pirq);
85
86 msg->data =
87 MSI_DATA_TRIGGER_EDGE |
88 MSI_DATA_LEVEL_ASSERT |
89 /* delivery mode reserved */
90 (3 << 8) |
91 MSI_DATA_VECTOR(0);
92}
93
94static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
95{
96 int irq, pirq, ret = 0;
97 struct msi_desc *msidesc;
98 struct msi_msg msg;
99
100 list_for_each_entry(msidesc, &dev->msi_list, list) {
101 xen_allocate_pirq_msi((type == PCI_CAP_ID_MSIX) ?
102 "msi-x" : "msi", &irq, &pirq);
103 if (irq < 0 || pirq < 0)
104 goto error;
105 printk(KERN_DEBUG "xen: msi --> irq=%d, pirq=%d\n", irq, pirq);
106 xen_msi_compose_msg(dev, pirq, &msg);
107 ret = set_irq_msi(irq, msidesc);
108 if (ret < 0)
109 goto error_while;
110 write_msi_msg(irq, &msg);
111 }
112 return 0;
113
114error_while:
115 unbind_from_irqhandler(irq, NULL);
116error:
117 if (ret == -ENODEV)
118 dev_err(&dev->dev, "Xen PCI frontend has not registered" \
119 " MSI/MSI-X support!\n");
120
121 return ret;
122}
123
124/*
125 * For MSI interrupts we have to use drivers/xen/event.s functions to
126 * allocate an irq_desc and setup the right */
127
128
129static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
130{
131 int irq, ret, i;
132 struct msi_desc *msidesc;
133 int *v;
134
135 v = kzalloc(sizeof(int) * max(1, nvec), GFP_KERNEL);
136 if (!v)
137 return -ENOMEM;
138
139 if (type == PCI_CAP_ID_MSIX)
140 ret = xen_pci_frontend_enable_msix(dev, &v, nvec);
141 else
142 ret = xen_pci_frontend_enable_msi(dev, &v);
143 if (ret)
144 goto error;
145 i = 0;
146 list_for_each_entry(msidesc, &dev->msi_list, list) {
147 irq = xen_allocate_pirq(v[i], 0, /* not sharable */
148 (type == PCI_CAP_ID_MSIX) ?
149 "pcifront-msi-x" : "pcifront-msi");
150 if (irq < 0) {
151 ret = -1;
152 goto free;
153 }
154
155 ret = set_irq_msi(irq, msidesc);
156 if (ret)
157 goto error_while;
158 i++;
159 }
160 kfree(v);
161 return 0;
162
163error_while:
164 unbind_from_irqhandler(irq, NULL);
165error:
166 if (ret == -ENODEV)
167 dev_err(&dev->dev, "Xen PCI frontend has not registered" \
168 " MSI/MSI-X support!\n");
169free:
170 kfree(v);
171 return ret;
172}
173
174static void xen_teardown_msi_irqs(struct pci_dev *dev)
175{
176 struct msi_desc *msidesc;
177
178 msidesc = list_entry(dev->msi_list.next, struct msi_desc, list);
179 if (msidesc->msi_attrib.is_msix)
180 xen_pci_frontend_disable_msix(dev);
181 else
182 xen_pci_frontend_disable_msi(dev);
183}
184
185static void xen_teardown_msi_irq(unsigned int irq)
186{
187 xen_destroy_irq(irq);
188}
189
190static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
191{
192 int irq, ret;
193 struct msi_desc *msidesc;
194
195 list_for_each_entry(msidesc, &dev->msi_list, list) {
196 irq = xen_create_msi_irq(dev, msidesc, type);
197 if (irq < 0)
198 return -1;
199
200 ret = set_irq_msi(irq, msidesc);
201 if (ret)
202 goto error;
203 }
204 return 0;
205
206error:
207 xen_destroy_irq(irq);
208 return ret;
209}
210#endif
211
212static int xen_pcifront_enable_irq(struct pci_dev *dev)
213{
214 int rc;
215 int share = 1;
216
217 dev_info(&dev->dev, "Xen PCI enabling IRQ: %d\n", dev->irq);
218
219 if (dev->irq < 0)
220 return -EINVAL;
221
222 if (dev->irq < NR_IRQS_LEGACY)
223 share = 0;
224
225 rc = xen_allocate_pirq(dev->irq, share, "pcifront");
226 if (rc < 0) {
227 dev_warn(&dev->dev, "Xen PCI IRQ: %d, failed to register:%d\n",
228 dev->irq, rc);
229 return rc;
230 }
231 return 0;
232}
233
234int __init pci_xen_init(void)
235{
236 if (!xen_pv_domain() || xen_initial_domain())
237 return -ENODEV;
238
239 printk(KERN_INFO "PCI: setting up Xen PCI frontend stub\n");
240
241 pcibios_set_cache_line_size();
242
243 pcibios_enable_irq = xen_pcifront_enable_irq;
244 pcibios_disable_irq = NULL;
245
246#ifdef CONFIG_ACPI
247 /* Keep ACPI out of the picture */
248 acpi_noirq = 1;
249#endif
250
251#ifdef CONFIG_PCI_MSI
252 x86_msi.setup_msi_irqs = xen_setup_msi_irqs;
253 x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
254 x86_msi.teardown_msi_irqs = xen_teardown_msi_irqs;
255#endif
256 return 0;
257}
258
259int __init pci_xen_hvm_init(void)
260{
261 if (!xen_feature(XENFEAT_hvm_pirqs))
262 return 0;
263
264#ifdef CONFIG_ACPI
265 /*
266 * We don't want to change the actual ACPI delivery model,
267 * just how GSIs get registered.
268 */
269 __acpi_register_gsi = acpi_register_gsi_xen_hvm;
270#endif
271
272#ifdef CONFIG_PCI_MSI
273 x86_msi.setup_msi_irqs = xen_hvm_setup_msi_irqs;
274 x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
275#endif
276 return 0;
277}
278
279#ifdef CONFIG_XEN_DOM0
280static int xen_register_pirq(u32 gsi, int triggering)
281{
282 int rc, irq;
283 struct physdev_map_pirq map_irq;
284 int shareable = 0;
285 char *name;
286
287 if (!xen_pv_domain())
288 return -1;
289
290 if (triggering == ACPI_EDGE_SENSITIVE) {
291 shareable = 0;
292 name = "ioapic-edge";
293 } else {
294 shareable = 1;
295 name = "ioapic-level";
296 }
297
298 irq = xen_allocate_pirq(gsi, shareable, name);
299
300 printk(KERN_DEBUG "xen: --> irq=%d\n", irq);
301
302 if (irq < 0)
303 goto out;
304
305 map_irq.domid = DOMID_SELF;
306 map_irq.type = MAP_PIRQ_TYPE_GSI;
307 map_irq.index = gsi;
308 map_irq.pirq = irq;
309
310 rc = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq);
311 if (rc) {
312 printk(KERN_WARNING "xen map irq failed %d\n", rc);
313 return -1;
314 }
315
316out:
317 return irq;
318}
319
320static int xen_register_gsi(u32 gsi, int triggering, int polarity)
321{
322 int rc, irq;
323 struct physdev_setup_gsi setup_gsi;
324
325 if (!xen_pv_domain())
326 return -1;
327
328 printk(KERN_DEBUG "xen: registering gsi %u triggering %d polarity %d\n",
329 gsi, triggering, polarity);
330
331 irq = xen_register_pirq(gsi, triggering);
332
333 setup_gsi.gsi = gsi;
334 setup_gsi.triggering = (triggering == ACPI_EDGE_SENSITIVE ? 0 : 1);
335 setup_gsi.polarity = (polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
336
337 rc = HYPERVISOR_physdev_op(PHYSDEVOP_setup_gsi, &setup_gsi);
338 if (rc == -EEXIST)
339 printk(KERN_INFO "Already setup the GSI :%d\n", gsi);
340 else if (rc) {
341 printk(KERN_ERR "Failed to setup GSI :%d, err_code:%d\n",
342 gsi, rc);
343 }
344
345 return irq;
346}
347
348static __init void xen_setup_acpi_sci(void)
349{
350 int rc;
351 int trigger, polarity;
352 int gsi = acpi_sci_override_gsi;
353
354 if (!gsi)
355 return;
356
357 rc = acpi_get_override_irq(gsi, &trigger, &polarity);
358 if (rc) {
359 printk(KERN_WARNING "xen: acpi_get_override_irq failed for acpi"
360 " sci, rc=%d\n", rc);
361 return;
362 }
363 trigger = trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
364 polarity = polarity ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
365
366 printk(KERN_INFO "xen: sci override: global_irq=%d trigger=%d "
367 "polarity=%d\n", gsi, trigger, polarity);
368
369 gsi = xen_register_gsi(gsi, trigger, polarity);
370 printk(KERN_INFO "xen: acpi sci %d\n", gsi);
371
372 return;
373}
374
375static int acpi_register_gsi_xen(struct device *dev, u32 gsi,
376 int trigger, int polarity)
377{
378 return xen_register_gsi(gsi, trigger, polarity);
379}
380
381static int __init pci_xen_initial_domain(void)
382{
383#ifdef CONFIG_PCI_MSI
384 x86_msi.setup_msi_irqs = xen_initdom_setup_msi_irqs;
385 x86_msi.teardown_msi_irq = xen_teardown_msi_irq;
386#endif
387 xen_setup_acpi_sci();
388 __acpi_register_gsi = acpi_register_gsi_xen;
389
390 return 0;
391}
392
393void __init xen_setup_pirqs(void)
394{
395 int irq;
396
397 pci_xen_initial_domain();
398
399 if (0 == nr_ioapics) {
400 for (irq = 0; irq < NR_IRQS_LEGACY; irq++)
401 xen_allocate_pirq(irq, 0, "xt-pic");
402 return;
403 }
404
405 /* Pre-allocate legacy irqs */
406 for (irq = 0; irq < NR_IRQS_LEGACY; irq++) {
407 int trigger, polarity;
408
409 if (acpi_get_override_irq(irq, &trigger, &polarity) == -1)
410 continue;
411
412 xen_register_pirq(irq,
413 trigger ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE);
414 }
415}
416#endif
diff --git a/arch/x86/platform/Makefile b/arch/x86/platform/Makefile
new file mode 100644
index 000000000000..7bf70b812fa2
--- /dev/null
+++ b/arch/x86/platform/Makefile
@@ -0,0 +1,8 @@
1# Platform specific code goes here
2obj-y += efi/
3obj-y += mrst/
4obj-y += olpc/
5obj-y += scx200/
6obj-y += sfi/
7obj-y += visws/
8obj-y += uv/
diff --git a/arch/x86/platform/efi/Makefile b/arch/x86/platform/efi/Makefile
new file mode 100644
index 000000000000..73b8be0f3675
--- /dev/null
+++ b/arch/x86/platform/efi/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_EFI) += efi.o efi_$(BITS).o efi_stub_$(BITS).o
diff --git a/arch/x86/kernel/efi.c b/arch/x86/platform/efi/efi.c
index 0fe27d7c6258..0fe27d7c6258 100644
--- a/arch/x86/kernel/efi.c
+++ b/arch/x86/platform/efi/efi.c
diff --git a/arch/x86/kernel/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 5cab48ee61a4..5cab48ee61a4 100644
--- a/arch/x86/kernel/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
diff --git a/arch/x86/kernel/efi_64.c b/arch/x86/platform/efi/efi_64.c
index ac0621a7ac3d..ac0621a7ac3d 100644
--- a/arch/x86/kernel/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
diff --git a/arch/x86/kernel/efi_stub_32.S b/arch/x86/platform/efi/efi_stub_32.S
index fbe66e626c09..fbe66e626c09 100644
--- a/arch/x86/kernel/efi_stub_32.S
+++ b/arch/x86/platform/efi/efi_stub_32.S
diff --git a/arch/x86/kernel/efi_stub_64.S b/arch/x86/platform/efi/efi_stub_64.S
index 4c07ccab8146..4c07ccab8146 100644
--- a/arch/x86/kernel/efi_stub_64.S
+++ b/arch/x86/platform/efi/efi_stub_64.S
diff --git a/arch/x86/platform/mrst/Makefile b/arch/x86/platform/mrst/Makefile
new file mode 100644
index 000000000000..efbbc552fa95
--- /dev/null
+++ b/arch/x86/platform/mrst/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_X86_MRST) += mrst.o
diff --git a/arch/x86/kernel/mrst.c b/arch/x86/platform/mrst/mrst.c
index 79ae68154e87..79ae68154e87 100644
--- a/arch/x86/kernel/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
diff --git a/arch/x86/platform/olpc/Makefile b/arch/x86/platform/olpc/Makefile
new file mode 100644
index 000000000000..c31b8fcb5a86
--- /dev/null
+++ b/arch/x86/platform/olpc/Makefile
@@ -0,0 +1,3 @@
1obj-$(CONFIG_OLPC) += olpc.o
2obj-$(CONFIG_OLPC_XO1) += olpc-xo1.o
3obj-$(CONFIG_OLPC_OPENFIRMWARE) += olpc_ofw.o
diff --git a/arch/x86/kernel/olpc-xo1.c b/arch/x86/platform/olpc/olpc-xo1.c
index f5442c03abc3..f5442c03abc3 100644
--- a/arch/x86/kernel/olpc-xo1.c
+++ b/arch/x86/platform/olpc/olpc-xo1.c
diff --git a/arch/x86/kernel/olpc.c b/arch/x86/platform/olpc/olpc.c
index edaf3fe8dc5e..edaf3fe8dc5e 100644
--- a/arch/x86/kernel/olpc.c
+++ b/arch/x86/platform/olpc/olpc.c
diff --git a/arch/x86/kernel/olpc_ofw.c b/arch/x86/platform/olpc/olpc_ofw.c
index 787320464379..787320464379 100644
--- a/arch/x86/kernel/olpc_ofw.c
+++ b/arch/x86/platform/olpc/olpc_ofw.c
diff --git a/arch/x86/platform/scx200/Makefile b/arch/x86/platform/scx200/Makefile
new file mode 100644
index 000000000000..762b4c7f4314
--- /dev/null
+++ b/arch/x86/platform/scx200/Makefile
@@ -0,0 +1,2 @@
1obj-$(CONFIG_SCx200) += scx200.o
2scx200-y += scx200_32.o
diff --git a/arch/x86/kernel/scx200_32.c b/arch/x86/platform/scx200/scx200_32.c
index 7e004acbe526..7e004acbe526 100644
--- a/arch/x86/kernel/scx200_32.c
+++ b/arch/x86/platform/scx200/scx200_32.c
diff --git a/arch/x86/platform/sfi/Makefile b/arch/x86/platform/sfi/Makefile
new file mode 100644
index 000000000000..cc5db1168a5e
--- /dev/null
+++ b/arch/x86/platform/sfi/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_SFI) += sfi.o
diff --git a/arch/x86/kernel/sfi.c b/arch/x86/platform/sfi/sfi.c
index dd4c281ffe57..dd4c281ffe57 100644
--- a/arch/x86/kernel/sfi.c
+++ b/arch/x86/platform/sfi/sfi.c
diff --git a/arch/x86/platform/uv/Makefile b/arch/x86/platform/uv/Makefile
new file mode 100644
index 000000000000..6c40995fefb8
--- /dev/null
+++ b/arch/x86/platform/uv/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_X86_UV) += tlb_uv.o bios_uv.o uv_irq.o uv_sysfs.o uv_time.o
diff --git a/arch/x86/kernel/bios_uv.c b/arch/x86/platform/uv/bios_uv.c
index 8bc57baaa9ad..8bc57baaa9ad 100644
--- a/arch/x86/kernel/bios_uv.c
+++ b/arch/x86/platform/uv/bios_uv.c
diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index 20ea20a39e2a..a318194002b5 100644
--- a/arch/x86/kernel/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -1343,8 +1343,8 @@ uv_activation_descriptor_init(int node, int pnode)
1343 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR) 1343 * each bau_desc is 64 bytes; there are 8 (UV_ITEMS_PER_DESCRIPTOR)
1344 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub 1344 * per cpu; and up to 32 (UV_ADP_SIZE) cpu's per uvhub
1345 */ 1345 */
1346 bau_desc = (struct bau_desc *)kmalloc_node(sizeof(struct bau_desc)* 1346 bau_desc = kmalloc_node(sizeof(struct bau_desc) * UV_ADP_SIZE
1347 UV_ADP_SIZE*UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node); 1347 * UV_ITEMS_PER_DESCRIPTOR, GFP_KERNEL, node);
1348 BUG_ON(!bau_desc); 1348 BUG_ON(!bau_desc);
1349 1349
1350 pa = uv_gpa(bau_desc); /* need the real nasid*/ 1350 pa = uv_gpa(bau_desc); /* need the real nasid*/
@@ -1402,9 +1402,9 @@ uv_payload_queue_init(int node, int pnode)
1402 struct bau_payload_queue_entry *pqp_malloc; 1402 struct bau_payload_queue_entry *pqp_malloc;
1403 struct bau_control *bcp; 1403 struct bau_control *bcp;
1404 1404
1405 pqp = (struct bau_payload_queue_entry *) kmalloc_node( 1405 pqp = kmalloc_node((DEST_Q_SIZE + 1)
1406 (DEST_Q_SIZE + 1) * sizeof(struct bau_payload_queue_entry), 1406 * sizeof(struct bau_payload_queue_entry),
1407 GFP_KERNEL, node); 1407 GFP_KERNEL, node);
1408 BUG_ON(!pqp); 1408 BUG_ON(!pqp);
1409 pqp_malloc = pqp; 1409 pqp_malloc = pqp;
1410 1410
@@ -1520,8 +1520,7 @@ static void __init uv_init_per_cpu(int nuvhubs)
1520 1520
1521 timeout_us = calculate_destination_timeout(); 1521 timeout_us = calculate_destination_timeout();
1522 1522
1523 uvhub_descs = (struct uvhub_desc *) 1523 uvhub_descs = kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
1524 kmalloc(nuvhubs * sizeof(struct uvhub_desc), GFP_KERNEL);
1525 memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc)); 1524 memset(uvhub_descs, 0, nuvhubs * sizeof(struct uvhub_desc));
1526 uvhub_mask = kzalloc((nuvhubs+7)/8, GFP_KERNEL); 1525 uvhub_mask = kzalloc((nuvhubs+7)/8, GFP_KERNEL);
1527 for_each_present_cpu(cpu) { 1526 for_each_present_cpu(cpu) {
diff --git a/arch/x86/kernel/uv_irq.c b/arch/x86/platform/uv/uv_irq.c
index 7b24460917d5..7b24460917d5 100644
--- a/arch/x86/kernel/uv_irq.c
+++ b/arch/x86/platform/uv/uv_irq.c
diff --git a/arch/x86/kernel/uv_sysfs.c b/arch/x86/platform/uv/uv_sysfs.c
index 309c70fb7759..309c70fb7759 100644
--- a/arch/x86/kernel/uv_sysfs.c
+++ b/arch/x86/platform/uv/uv_sysfs.c
diff --git a/arch/x86/kernel/uv_time.c b/arch/x86/platform/uv/uv_time.c
index 56e421bc379b..56e421bc379b 100644
--- a/arch/x86/kernel/uv_time.c
+++ b/arch/x86/platform/uv/uv_time.c
diff --git a/arch/x86/platform/visws/Makefile b/arch/x86/platform/visws/Makefile
new file mode 100644
index 000000000000..91bc17ab2fd5
--- /dev/null
+++ b/arch/x86/platform/visws/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_X86_VISWS) += visws_quirks.o
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/platform/visws/visws_quirks.c
index 3371bd053b89..3371bd053b89 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/platform/visws/visws_quirks.c
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 90a7f5ad6916..5b54892e4bc3 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -13,6 +13,16 @@ config XEN
13 kernel to boot in a paravirtualized environment under the 13 kernel to boot in a paravirtualized environment under the
14 Xen hypervisor. 14 Xen hypervisor.
15 15
16config XEN_DOM0
17 def_bool y
18 depends on XEN && PCI_XEN && SWIOTLB_XEN
19 depends on X86_LOCAL_APIC && X86_IO_APIC && ACPI && PCI
20
21# Dummy symbol since people have come to rely on the PRIVILEGED_GUEST
22# name in tools.
23config XEN_PRIVILEGED_GUEST
24 def_bool XEN_DOM0
25
16config XEN_PVHVM 26config XEN_PVHVM
17 def_bool y 27 def_bool y
18 depends on XEN 28 depends on XEN
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 70ddeaeb1ef3..235c0f4d3861 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -46,6 +46,7 @@
46#include <asm/paravirt.h> 46#include <asm/paravirt.h>
47#include <asm/apic.h> 47#include <asm/apic.h>
48#include <asm/page.h> 48#include <asm/page.h>
49#include <asm/xen/pci.h>
49#include <asm/xen/hypercall.h> 50#include <asm/xen/hypercall.h>
50#include <asm/xen/hypervisor.h> 51#include <asm/xen/hypervisor.h>
51#include <asm/fixmap.h> 52#include <asm/fixmap.h>
@@ -236,6 +237,7 @@ static __init void xen_init_cpuid_mask(void)
236 cpuid_leaf1_edx_mask = 237 cpuid_leaf1_edx_mask =
237 ~((1 << X86_FEATURE_MCE) | /* disable MCE */ 238 ~((1 << X86_FEATURE_MCE) | /* disable MCE */
238 (1 << X86_FEATURE_MCA) | /* disable MCA */ 239 (1 << X86_FEATURE_MCA) | /* disable MCA */
240 (1 << X86_FEATURE_MTRR) | /* disable MTRR */
239 (1 << X86_FEATURE_ACC)); /* thermal monitoring */ 241 (1 << X86_FEATURE_ACC)); /* thermal monitoring */
240 242
241 if (!xen_initial_domain()) 243 if (!xen_initial_domain())
@@ -1184,6 +1186,7 @@ asmlinkage void __init xen_start_kernel(void)
1184 1186
1185 xen_raw_console_write("mapping kernel into physical memory\n"); 1187 xen_raw_console_write("mapping kernel into physical memory\n");
1186 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages); 1188 pgd = xen_setup_kernel_pagetable(pgd, xen_start_info->nr_pages);
1189 xen_ident_map_ISA();
1187 1190
1188 /* Allocate and initialize top and mid mfn levels for p2m structure */ 1191 /* Allocate and initialize top and mid mfn levels for p2m structure */
1189 xen_build_mfn_list_list(); 1192 xen_build_mfn_list_list();
@@ -1222,6 +1225,8 @@ asmlinkage void __init xen_start_kernel(void)
1222 add_preferred_console("xenboot", 0, NULL); 1225 add_preferred_console("xenboot", 0, NULL);
1223 add_preferred_console("tty", 0, NULL); 1226 add_preferred_console("tty", 0, NULL);
1224 add_preferred_console("hvc", 0, NULL); 1227 add_preferred_console("hvc", 0, NULL);
1228 if (pci_xen)
1229 x86_init.pci.arch_init = pci_xen_init;
1225 } else { 1230 } else {
1226 /* Make sure ACS will be enabled */ 1231 /* Make sure ACS will be enabled */
1227 pci_request_acs(); 1232 pci_request_acs();
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 9631c90907eb..21ed8d7f75a5 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -1975,6 +1975,7 @@ static void *m2v(phys_addr_t maddr)
1975 return __ka(m2p(maddr)); 1975 return __ka(m2p(maddr));
1976} 1976}
1977 1977
1978/* Set the page permissions on an identity-mapped pages */
1978static void set_page_prot(void *addr, pgprot_t prot) 1979static void set_page_prot(void *addr, pgprot_t prot)
1979{ 1980{
1980 unsigned long pfn = __pa(addr) >> PAGE_SHIFT; 1981 unsigned long pfn = __pa(addr) >> PAGE_SHIFT;
@@ -2125,7 +2126,7 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
2125{ 2126{
2126 pmd_t *kernel_pmd; 2127 pmd_t *kernel_pmd;
2127 2128
2128 level2_kernel_pgt = extend_brk(sizeof(pmd_t *) * PTRS_PER_PMD, PAGE_SIZE); 2129 level2_kernel_pgt = extend_brk(sizeof(pmd_t) * PTRS_PER_PMD, PAGE_SIZE);
2129 2130
2130 max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) + 2131 max_pfn_mapped = PFN_DOWN(__pa(xen_start_info->pt_base) +
2131 xen_start_info->nr_pt_frames * PAGE_SIZE + 2132 xen_start_info->nr_pt_frames * PAGE_SIZE +
@@ -2159,6 +2160,8 @@ __init pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd,
2159} 2160}
2160#endif /* CONFIG_X86_64 */ 2161#endif /* CONFIG_X86_64 */
2161 2162
2163static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss;
2164
2162static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) 2165static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2163{ 2166{
2164 pte_t pte; 2167 pte_t pte;
@@ -2179,15 +2182,28 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2179#else 2182#else
2180 case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE: 2183 case VSYSCALL_LAST_PAGE ... VSYSCALL_FIRST_PAGE:
2181#endif 2184#endif
2182#ifdef CONFIG_X86_LOCAL_APIC
2183 case FIX_APIC_BASE: /* maps dummy local APIC */
2184#endif
2185 case FIX_TEXT_POKE0: 2185 case FIX_TEXT_POKE0:
2186 case FIX_TEXT_POKE1: 2186 case FIX_TEXT_POKE1:
2187 /* All local page mappings */ 2187 /* All local page mappings */
2188 pte = pfn_pte(phys, prot); 2188 pte = pfn_pte(phys, prot);
2189 break; 2189 break;
2190 2190
2191#ifdef CONFIG_X86_LOCAL_APIC
2192 case FIX_APIC_BASE: /* maps dummy local APIC */
2193 pte = pfn_pte(PFN_DOWN(__pa(dummy_mapping)), PAGE_KERNEL);
2194 break;
2195#endif
2196
2197#ifdef CONFIG_X86_IO_APIC
2198 case FIX_IO_APIC_BASE_0 ... FIX_IO_APIC_BASE_END:
2199 /*
2200 * We just don't map the IO APIC - all access is via
2201 * hypercalls. Keep the address in the pte for reference.
2202 */
2203 pte = pfn_pte(PFN_DOWN(__pa(dummy_mapping)), PAGE_KERNEL);
2204 break;
2205#endif
2206
2191 case FIX_PARAVIRT_BOOTMAP: 2207 case FIX_PARAVIRT_BOOTMAP:
2192 /* This is an MFN, but it isn't an IO mapping from the 2208 /* This is an MFN, but it isn't an IO mapping from the
2193 IO domain */ 2209 IO domain */
@@ -2212,6 +2228,29 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot)
2212#endif 2228#endif
2213} 2229}
2214 2230
2231__init void xen_ident_map_ISA(void)
2232{
2233 unsigned long pa;
2234
2235 /*
2236 * If we're dom0, then linear map the ISA machine addresses into
2237 * the kernel's address space.
2238 */
2239 if (!xen_initial_domain())
2240 return;
2241
2242 xen_raw_printk("Xen: setup ISA identity maps\n");
2243
2244 for (pa = ISA_START_ADDRESS; pa < ISA_END_ADDRESS; pa += PAGE_SIZE) {
2245 pte_t pte = mfn_pte(PFN_DOWN(pa), PAGE_KERNEL_IO);
2246
2247 if (HYPERVISOR_update_va_mapping(PAGE_OFFSET + pa, pte, 0))
2248 BUG();
2249 }
2250
2251 xen_flush_tlb();
2252}
2253
2215static __init void xen_post_allocator_init(void) 2254static __init void xen_post_allocator_init(void)
2216{ 2255{
2217 pv_mmu_ops.set_pte = xen_set_pte; 2256 pv_mmu_ops.set_pte = xen_set_pte;
@@ -2320,6 +2359,8 @@ void __init xen_init_mmu_ops(void)
2320 pv_mmu_ops = xen_mmu_ops; 2359 pv_mmu_ops = xen_mmu_ops;
2321 2360
2322 vmap_lazy_unmap = false; 2361 vmap_lazy_unmap = false;
2362
2363 memset(dummy_mapping, 0xff, PAGE_SIZE);
2323} 2364}
2324 2365
2325/* Protected by xen_reservation_lock. */ 2366/* Protected by xen_reservation_lock. */
diff --git a/arch/x86/xen/pci-swiotlb-xen.c b/arch/x86/xen/pci-swiotlb-xen.c
index 22471001b74c..bfd0632fe65e 100644
--- a/arch/x86/xen/pci-swiotlb-xen.c
+++ b/arch/x86/xen/pci-swiotlb-xen.c
@@ -1,6 +1,7 @@
1/* Glue code to lib/swiotlb-xen.c */ 1/* Glue code to lib/swiotlb-xen.c */
2 2
3#include <linux/dma-mapping.h> 3#include <linux/dma-mapping.h>
4#include <linux/pci.h>
4#include <xen/swiotlb-xen.h> 5#include <xen/swiotlb-xen.h>
5 6
6#include <asm/xen/hypervisor.h> 7#include <asm/xen/hypervisor.h>
@@ -55,6 +56,9 @@ void __init pci_xen_swiotlb_init(void)
55 if (xen_swiotlb) { 56 if (xen_swiotlb) {
56 xen_swiotlb_init(1); 57 xen_swiotlb_init(1);
57 dma_ops = &xen_swiotlb_dma_ops; 58 dma_ops = &xen_swiotlb_dma_ops;
59
60 /* Make sure ACS will be enabled */
61 pci_request_acs();
58 } 62 }
59} 63}
60IOMMU_INIT_FINISH(pci_xen_swiotlb_detect, 64IOMMU_INIT_FINISH(pci_xen_swiotlb_detect,
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 105db2501050..769c4b01fa32 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -118,16 +118,18 @@ static unsigned long __init xen_return_unused_memory(unsigned long max_pfn,
118 const struct e820map *e820) 118 const struct e820map *e820)
119{ 119{
120 phys_addr_t max_addr = PFN_PHYS(max_pfn); 120 phys_addr_t max_addr = PFN_PHYS(max_pfn);
121 phys_addr_t last_end = 0; 121 phys_addr_t last_end = ISA_END_ADDRESS;
122 unsigned long released = 0; 122 unsigned long released = 0;
123 int i; 123 int i;
124 124
125 /* Free any unused memory above the low 1Mbyte. */
125 for (i = 0; i < e820->nr_map && last_end < max_addr; i++) { 126 for (i = 0; i < e820->nr_map && last_end < max_addr; i++) {
126 phys_addr_t end = e820->map[i].addr; 127 phys_addr_t end = e820->map[i].addr;
127 end = min(max_addr, end); 128 end = min(max_addr, end);
128 129
129 released += xen_release_chunk(last_end, end); 130 if (last_end < end)
130 last_end = e820->map[i].addr + e820->map[i].size; 131 released += xen_release_chunk(last_end, end);
132 last_end = max(last_end, e820->map[i].addr + e820->map[i].size);
131 } 133 }
132 134
133 if (last_end < max_addr) 135 if (last_end < max_addr)
@@ -164,6 +166,7 @@ char * __init xen_memory_setup(void)
164 XENMEM_memory_map; 166 XENMEM_memory_map;
165 rc = HYPERVISOR_memory_op(op, &memmap); 167 rc = HYPERVISOR_memory_op(op, &memmap);
166 if (rc == -ENOSYS) { 168 if (rc == -ENOSYS) {
169 BUG_ON(xen_initial_domain());
167 memmap.nr_entries = 1; 170 memmap.nr_entries = 1;
168 map[0].addr = 0ULL; 171 map[0].addr = 0ULL;
169 map[0].size = mem_end; 172 map[0].size = mem_end;
@@ -201,9 +204,13 @@ char * __init xen_memory_setup(void)
201 } 204 }
202 205
203 /* 206 /*
204 * Even though this is normal, usable memory under Xen, reserve 207 * In domU, the ISA region is normal, usable memory, but we
205 * ISA memory anyway because too many things think they can poke 208 * reserve ISA memory anyway because too many things poke
206 * about in there. 209 * about in there.
210 *
211 * In Dom0, the host E820 information can leave gaps in the
212 * ISA range, which would cause us to release those pages. To
213 * avoid this, we unconditionally reserve them here.
207 */ 214 */
208 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, 215 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
209 E820_RESERVED); 216 E820_RESERVED);
@@ -367,7 +374,5 @@ void __init xen_arch_setup(void)
367 374
368 pm_idle = xen_idle; 375 pm_idle = xen_idle;
369 376
370 paravirt_disable_iospace();
371
372 fiddle_vdso(); 377 fiddle_vdso();
373} 378}
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index f4d010031465..72a4c7959045 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -28,6 +28,7 @@
28#include <asm/xen/interface.h> 28#include <asm/xen/interface.h>
29#include <asm/xen/hypercall.h> 29#include <asm/xen/hypercall.h>
30 30
31#include <xen/xen.h>
31#include <xen/page.h> 32#include <xen/page.h>
32#include <xen/events.h> 33#include <xen/events.h>
33 34
@@ -156,11 +157,35 @@ static void __init xen_fill_possible_map(void)
156{ 157{
157 int i, rc; 158 int i, rc;
158 159
160 if (xen_initial_domain())
161 return;
162
163 for (i = 0; i < nr_cpu_ids; i++) {
164 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
165 if (rc >= 0) {
166 num_processors++;
167 set_cpu_possible(i, true);
168 }
169 }
170}
171
172static void __init xen_filter_cpu_maps(void)
173{
174 int i, rc;
175
176 if (!xen_initial_domain())
177 return;
178
179 num_processors = 0;
180 disabled_cpus = 0;
159 for (i = 0; i < nr_cpu_ids; i++) { 181 for (i = 0; i < nr_cpu_ids; i++) {
160 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); 182 rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL);
161 if (rc >= 0) { 183 if (rc >= 0) {
162 num_processors++; 184 num_processors++;
163 set_cpu_possible(i, true); 185 set_cpu_possible(i, true);
186 } else {
187 set_cpu_possible(i, false);
188 set_cpu_present(i, false);
164 } 189 }
165 } 190 }
166} 191}
@@ -174,6 +199,7 @@ static void __init xen_smp_prepare_boot_cpu(void)
174 old memory can be recycled */ 199 old memory can be recycled */
175 make_lowmem_page_readwrite(xen_initial_gdt); 200 make_lowmem_page_readwrite(xen_initial_gdt);
176 201
202 xen_filter_cpu_maps();
177 xen_setup_vcpu_info_placement(); 203 xen_setup_vcpu_info_placement();
178} 204}
179 205
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 0859bfd8ae93..d373d159e75e 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -1,8 +1,3 @@
1# For a description of the syntax of this configuration file,
2# see Documentation/kbuild/kconfig-language.txt.
3
4mainmenu "Linux/Xtensa Kernel Configuration"
5
6config FRAME_POINTER 1config FRAME_POINTER
7 def_bool n 2 def_bool n
8 3